Pārlūkot izejas kodu

1.优化
2.添加派出所、委(村)删除验证

liuyuqiang 2 gadi atpakaļ
vecāks
revīzija
22c6d699c9
24 mainītis faili ar 167 papildinājumiem un 234 dzēšanām
  1. 1 1
      sooka-admin/src/main/java/com/sooka/web/controller/monitor/DruidController.java
  2. 10 6
      sooka-admin/src/main/java/com/sooka/web/controller/schooldistrict/BtpPolicestationVillageController.java
  3. 2 2
      sooka-admin/src/main/java/com/sooka/web/controller/schooldistrict/BtpSchoolController.java
  4. 14 14
      sooka-admin/src/main/java/com/sooka/web/controller/schooldistrict/BtpSchoolPvController.java
  5. 1 1
      sooka-admin/src/main/java/com/sooka/web/controller/system/SysIndexController.java
  6. 1 1
      sooka-admin/src/main/java/com/sooka/web/controller/tool/SwaggerController.java
  7. 2 2
      sooka-admin/src/main/resources/application.yml
  8. 1 1
      sooka-admin/src/main/resources/templates/main.html
  9. 6 6
      sooka-admin/src/main/resources/templates/schooldistrict/index/add.html
  10. 7 7
      sooka-admin/src/main/resources/templates/schooldistrict/index/index.html
  11. 7 7
      sooka-admin/src/main/resources/templates/schooldistrict/index/edit.html
  12. 1 1
      sooka-framework/src/main/java/com/sooka/framework/config/ShiroConfig.java
  13. 13 19
      sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/mapper/BtpPolicestationVillageMapper.java
  14. 5 13
      sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/mapper/BtpSchoolMapper.java
  15. 18 26
      sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/mapper/BtpSchoolPvMapper.java
  16. 11 17
      sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/service/IBtpPolicestationVillageService.java
  17. 16 24
      sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/service/IBtpSchoolPvService.java
  18. 5 13
      sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/service/IBtpSchoolService.java
  19. 11 17
      sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/service/impl/BtpPolicestationVillageServiceImpl.java
  20. 15 26
      sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/service/impl/BtpSchoolPvServiceImpl.java
  21. 1 12
      sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/service/impl/BtpSchoolServiceImpl.java
  22. 18 9
      sooka-schooldistrict/src/main/resources/mapper/schooldistrict/BtpPolicestationVillageMapper.xml
  23. 0 4
      sooka-schooldistrict/src/main/resources/mapper/schooldistrict/BtpSchoolMapper.xml
  24. 1 5
      sooka-schooldistrict/src/main/resources/mapper/schooldistrict/BtpSchoolPvMapper.xml

+ 1 - 1
sooka-admin/src/main/java/com/sooka/web/controller/monitor/DruidController.java

@@ -21,6 +21,6 @@ public class DruidController extends BaseController
     @GetMapping()
     public String index()
     {
-        return redirect(prefix + "/index.html");
+        return redirect(prefix + "/config.html");
     }
 }

+ 10 - 6
sooka-admin/src/main/java/com/sooka/web/controller/schooldistrict/BtpPolicestationVillageController.java

@@ -1,13 +1,13 @@
 package com.sooka.web.controller.schooldistrict;
 
-import com.sooka.schooldistrict.domain.BtpPolicestationVillage;
-import com.sooka.schooldistrict.service.IBtpPolicestationVillageService;
 import com.sooka.common.annotation.Log;
 import com.sooka.common.core.controller.BaseController;
 import com.sooka.common.core.domain.AjaxResult;
 import com.sooka.common.core.page.TableDataInfo;
 import com.sooka.common.enums.BusinessType;
 import com.sooka.common.utils.poi.ExcelUtil;
+import com.sooka.schooldistrict.domain.BtpPolicestationVillage;
+import com.sooka.schooldistrict.service.IBtpPolicestationVillageService;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -151,15 +151,19 @@ public class BtpPolicestationVillageController extends BaseController {
     @PostMapping("/remove")
     @ResponseBody
     public AjaxResult remove(String ids) {
-        return toAjax(btpPolicestationVillageService.deleteBtpPolicestationVillageByPvIds(ids));
+        int result = btpPolicestationVillageService.getSubResources(ids);
+        if (result == 0) {
+            return toAjax(btpPolicestationVillageService.deleteBtpPolicestationVillageByPvIds(ids));
+        }
+        return AjaxResult.error("请先删除下级资源");
     }
 
     /**
      * 查询派出所、委(村)列表
      */
-    @GetMapping("/getAllByParentId")
+    @GetMapping("/getPolicestationVillagesByParentId")
     @ResponseBody
-    public List<BtpPolicestationVillage> list(Long parentId) {
-        return btpPolicestationVillageService.getAllByParentId(parentId);
+    public List<BtpPolicestationVillage> getPolicestationVillagesByParentId(Long parentId) {
+        return btpPolicestationVillageService.getPolicestationVillagesByParentId(parentId);
     }
 }

+ 2 - 2
sooka-admin/src/main/java/com/sooka/web/controller/schooldistrict/BtpSchoolController.java

@@ -117,10 +117,10 @@ public class BtpSchoolController extends BaseController {
     @PostMapping("/remove")
     @ResponseBody
     public AjaxResult remove(String ids) {
-        List<BtpSchoolPv> schoolPvs = btpSchoolPvService.selectBtpSchoolPvInSchoolId(ids);
+        List<BtpSchoolPv> schoolPvs = btpSchoolPvService.getBtpSchoolPvsInSchoolIds(ids);
         if (StringUtils.isEmpty(schoolPvs)) {
             return toAjax(btpSchoolService.deleteBtpSchoolBySchoolIds(ids));
         }
-        return AjaxResult.error();
+        return AjaxResult.error("请先删除下级资源");
     }
 }

+ 14 - 14
sooka-admin/src/main/java/com/sooka/web/controller/schooldistrict/BtpSchoolPvController.java

@@ -28,10 +28,10 @@ import java.util.List;
  * @date 2023-02-20
  */
 @Controller
-@RequestMapping("/schooldistrict/index")
+@RequestMapping("/schooldistrict/config")
 public class BtpSchoolPvController extends BaseController {
 
-    private String prefix = "schooldistrict/index";
+    private String prefix = "schooldistrict/config";
 
     @Autowired
     private IBtpSchoolPvService btpSchoolPvService;
@@ -42,16 +42,16 @@ public class BtpSchoolPvController extends BaseController {
     @Autowired
     private IBtpSchoolService btpSchoolService;
 
-    @RequiresPermissions("schooldistrict:index:view")
+    @RequiresPermissions("schooldistrict:config:view")
     @GetMapping()
-    public String index() {
-        return prefix + "/index";
+    public String config() {
+        return prefix + "/config";
     }
 
     /**
      * 查询学区列表
      */
-    @RequiresPermissions("schooldistrict:index:list")
+    @RequiresPermissions("schooldistrict:config:list")
     @PostMapping("/list")
     @ResponseBody
     public TableDataInfo list(BtpSchoolPv btpSchoolPv) {
@@ -63,7 +63,7 @@ public class BtpSchoolPvController extends BaseController {
     /**
      * 导出学区列表
      */
-    @RequiresPermissions("schooldistrict:index:export")
+    @RequiresPermissions("schooldistrict:config:export")
     @Log(title = "学区配置", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     @ResponseBody
@@ -78,7 +78,7 @@ public class BtpSchoolPvController extends BaseController {
      */
     @GetMapping("/add")
     public String add(ModelMap mmap) {
-        mmap.put("policestations", btpPolicestationVillageService.getAllByParentId(0L));
+        mmap.put("policestations", btpPolicestationVillageService.getPolicestationVillagesByParentId(0L));
         mmap.put("villages", Arrays.asList(new BtpPolicestationVillage()));
         mmap.put("schools", btpSchoolService.selectBtpSchoolList(new BtpSchool()));
         return prefix + "/add";
@@ -87,7 +87,7 @@ public class BtpSchoolPvController extends BaseController {
     /**
      * 新增保存学区
      */
-    @RequiresPermissions("schooldistrict:index:add")
+    @RequiresPermissions("schooldistrict:config:add")
     @Log(title = "学区配置", businessType = BusinessType.INSERT)
     @PostMapping("/add")
     @ResponseBody
@@ -98,13 +98,13 @@ public class BtpSchoolPvController extends BaseController {
     /**
      * 修改学区
      */
-    @RequiresPermissions("schooldistrict:index:edit")
+    @RequiresPermissions("schooldistrict:config:edit")
     @GetMapping("/edit/{vIds}")
     public String edit(@PathVariable("vIds") String vIds, ModelMap mmap) {
         BtpSchoolPv btpSchoolPv = btpSchoolPvService.selectBtpSchoolPvInVIds(vIds);
         mmap.put("btpSchoolPv", btpSchoolPv);
-        mmap.put("policestations", btpPolicestationVillageService.getAllByParentId(0L));
-        mmap.put("villages", btpPolicestationVillageService.getAllByParentId(btpSchoolPv.getpId()));
+        mmap.put("policestations", btpPolicestationVillageService.getPolicestationVillagesByParentId(0L));
+        mmap.put("villages", btpPolicestationVillageService.getPolicestationVillagesByParentId(btpSchoolPv.getpId()));
         mmap.put("schools", btpSchoolService.selectBtpSchoolList(new BtpSchool()));
         return prefix + "/edit";
     }
@@ -112,7 +112,7 @@ public class BtpSchoolPvController extends BaseController {
     /**
      * 修改保存学区
      */
-    @RequiresPermissions("schooldistrict:index:edit")
+    @RequiresPermissions("schooldistrict:config:edit")
     @Log(title = "学区配置", businessType = BusinessType.UPDATE)
     @PostMapping("/edit")
     @ResponseBody
@@ -123,7 +123,7 @@ public class BtpSchoolPvController extends BaseController {
     /**
      * 删除学区
      */
-    @RequiresPermissions("schooldistrict:index:remove")
+    @RequiresPermissions("schooldistrict:config:remove")
     @Log(title = "学区配置", businessType = BusinessType.DELETE)
     @PostMapping("/remove")
     @ResponseBody

+ 1 - 1
sooka-admin/src/main/java/com/sooka/web/controller/system/SysIndexController.java

@@ -151,7 +151,7 @@ public class SysIndexController extends BaseController
             mmap.put("flag", true);
             mmap.put("title", noticeService.selectNoticeById(1L));
             mmap.put("notice", noticeService.selectNoticeById(2L));
-            mmap.put("policestations", btpPolicestationVillageService.getAllByParentId(0L));
+            mmap.put("policestations", btpPolicestationVillageService.getPolicestationVillagesByParentId(0L));
             mmap.put("villages", Arrays.asList(new BtpPolicestationVillage()));
         } else {
             mmap.put("flag", false);

+ 1 - 1
sooka-admin/src/main/java/com/sooka/web/controller/tool/SwaggerController.java

@@ -19,6 +19,6 @@ public class SwaggerController extends BaseController
     @GetMapping()
     public String index()
     {
-        return redirect("/swagger-ui/index.html");
+        return redirect("/swagger-ui/config.html");
     }
 }

+ 2 - 2
sooka-admin/src/main/resources/application.yml

@@ -99,9 +99,9 @@ shiro:
     # 首页地址
     indexUrl: /index
     # 验证码开关
-    captchaEnabled: true
+    captchaEnabled: false
     # 验证码类型 math 数组计算 char 字符
-    captchaType: math
+    captchaType: char
   cookie:
     # 设置Cookie的域名 默认空,即当前访问的域名
     domain: 

+ 1 - 1
sooka-admin/src/main/resources/templates/main.html

@@ -110,7 +110,7 @@
 				allowClear: false
 			}).on('select2:select', function (e) {
 				//处理自己的业务
-				$.get("/schooldistrict/policestationvillage/getAllByParentId?parentId=" + this.value, function(result) {
+				$.get("/schooldistrict/policestationvillage/getPolicestationVillagesByParentId?parentId=" + this.value, function(result) {
 					$('#vId').empty().select2({
 						data: getData(result),
 						placeholder: "请选择委(村)",

+ 6 - 6
sooka-admin/src/main/resources/templates/schooldistrict/index/add.html

@@ -36,7 +36,7 @@
     <th:block th:include="include :: footer" />
     <th:block th:include="include :: select2-js" />
     <script th:inline="javascript">
-        var prefix = ctx + "schooldistrict/index"
+        var prefix = ctx + "schooldistrict/config"
         $("#form-pv-add").validate({
             focusCleanup: true
         });
@@ -61,24 +61,24 @@
         $(function() {
             $('#pId').select2({
                 placeholder: "请选择派出所",
-                allowClear: true
+                allowClear: false
             }).on('select2:select', function (e) {
                 //处理自己的业务
-                $.get("/schooldistrict/policestationvillage/getAllByParentId?parentId=" + this.value, function(result) {
+                $.get("/schooldistrict/policestationvillage/getPolicestationVillagesByParentId?parentId=" + this.value, function(result) {
                     $('#vId').empty().select2({
                         data: getData(result),
                         placeholder: "请选择委(村)",
-                        allowClear: true
+                        allowClear: false
                     });
                 });
             });
             $('#vId').select2({
                 placeholder: "请选择委(村)",
-                allowClear: true
+                allowClear: false
             });
             $('#schoolId').select2({
                 placeholder: "请选择学校",
-                allowClear: true
+                allowClear: false
             });
         })
     </script>

+ 7 - 7
sooka-admin/src/main/resources/templates/schooldistrict/index/index.html

@@ -32,16 +32,16 @@
             </div>
 
             <div class="btn-group-sm" id="toolbar" role="group">
-                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="schooldistrict:index:add">
+                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="schooldistrict:config:add">
                     <i class="fa fa-plus"></i> 添加
                 </a>
-                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="schooldistrict:index:edit">
+                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="schooldistrict:config:edit">
                     <i class="fa fa-edit"></i> 修改
                 </a>
-                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="schooldistrict:index:remove">
+                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="schooldistrict:config:remove">
                     <i class="fa fa-remove"></i> 删除
                 </a>
-                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="schooldistrict:index:export">
+                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="schooldistrict:config:export">
                     <i class="fa fa-download"></i> 导出
                 </a>
             </div>
@@ -52,10 +52,10 @@
     </div>
     <th:block th:include="include :: footer" />
     <script th:inline="javascript">
-        var editFlag = [[${@permission.hasPermi('schooldistrict:index:edit')}]];
-        var removeFlag = [[${@permission.hasPermi('schooldistrict:index:remove')}]];
+        var editFlag = [[${@permission.hasPermi('schooldistrict:config:edit')}]];
+        var removeFlag = [[${@permission.hasPermi('schooldistrict:config:remove')}]];
         var types = [[${@dict.getType('school_type')}]];
-        var prefix = ctx + "schooldistrict/index";
+        var prefix = ctx + "schooldistrict/config";
 
         $(function() {
             var options = {

+ 7 - 7
sooka-admin/src/main/resources/templates/schooldistrict/index/edit.html

@@ -37,7 +37,7 @@
     <th:block th:include="include :: footer" />
     <th:block th:include="include :: select2-js" />
     <script th:inline="javascript">
-        var prefix = ctx + "schooldistrict/index";
+        var prefix = ctx + "schooldistrict/config";
         $("#form-pv-edit").validate({
             focusCleanup: true
         });
@@ -54,24 +54,24 @@
         $(function() {
             $('#pId').select2({
                 placeholder: "请选择派出所",
-                allowClear: true
+                allowClear: false
             }).on('select2:select', function (e) {
-                //处理自己的业务
-                $.get("/schooldistrict/policestationvillage/getAllByParentId?parentId=" + this.value, function(result) {
+                $.get("/schooldistrict/policestationvillage/getPolicestationVillagesByParentId?parentId=" + this.value, function(result) {
                     $('#vId').empty().select2({
                         data: getData(result),
                         placeholder: "请选择委(村)",
-                        allowClear: true
+                        allowClear: false
                     });
                 });
             });
+            $('#pId').trigger("select");
             $('#vId').select2({
                 placeholder: "请选择委(村)",
-                allowClear: true
+                allowClear: false
             });
             $('#schoolId').select2({
                 placeholder: "请选择学校",
-                allowClear: true
+                allowClear: false
             });
         })
     </script>

+ 1 - 1
sooka-framework/src/main/java/com/sooka/framework/config/ShiroConfig.java

@@ -294,7 +294,7 @@ public class ShiroConfig
         // 不需要拦截的访问
         filterChainDefinitionMap.put("/login", "anon,captchaValidate");
         filterChainDefinitionMap.put("/system/main", "anon,captchaValidate");
-        filterChainDefinitionMap.put("/schooldistrict/policestationvillage/getAllByParentId", "anon,captchaValidate");
+        filterChainDefinitionMap.put("/schooldistrict/policestationvillage/getPolicestationVillagesByParentId", "anon,captchaValidate");
         filterChainDefinitionMap.put("/system/select", "anon,captchaValidate");
         // 注册相关
         filterChainDefinitionMap.put("/register", "anon,captchaValidate");

+ 13 - 19
sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/mapper/BtpPolicestationVillageMapper.java

@@ -18,15 +18,7 @@ public interface BtpPolicestationVillageMapper {
      * @param pvId 派出所、委(村)主键
      * @return 派出所、委(村)
      */
-    public BtpPolicestationVillage selectBtpPolicestationVillageByPvId(Long pvId);
-
-    /**
-     * 查询派出所、委(村)
-     *
-     * @param parentId 派出所、委(村)父级id
-     * @return 派出所、委(村)
-     */
-    public List<BtpPolicestationVillage> getAllByParentId(Long parentId);
+    BtpPolicestationVillage selectBtpPolicestationVillageByPvId(Long pvId);
 
     /**
      * 查询派出所、委(村)列表
@@ -34,7 +26,7 @@ public interface BtpPolicestationVillageMapper {
      * @param btpPolicestationVillage 派出所、委(村)
      * @return 派出所、委(村)集合
      */
-    public List<BtpPolicestationVillage> selectBtpPolicestationVillageList(BtpPolicestationVillage btpPolicestationVillage);
+    List<BtpPolicestationVillage> selectBtpPolicestationVillageList(BtpPolicestationVillage btpPolicestationVillage);
 
     /**
      * 新增派出所、委(村)
@@ -42,7 +34,7 @@ public interface BtpPolicestationVillageMapper {
      * @param btpPolicestationVillage 派出所、委(村)
      * @return 结果
      */
-    public int insertBtpPolicestationVillage(BtpPolicestationVillage btpPolicestationVillage);
+    int insertBtpPolicestationVillage(BtpPolicestationVillage btpPolicestationVillage);
 
     /**
      * 修改派出所、委(村)
@@ -50,21 +42,23 @@ public interface BtpPolicestationVillageMapper {
      * @param btpPolicestationVillage 派出所、委(村)
      * @return 结果
      */
-    public int updateBtpPolicestationVillage(BtpPolicestationVillage btpPolicestationVillage);
+    int updateBtpPolicestationVillage(BtpPolicestationVillage btpPolicestationVillage);
 
     /**
-     * 删除派出所、委(村)
+     * 批量删除派出所、委(村)
      *
-     * @param pvId 派出所、委(村)主键
+     * @param pvIds 需要删除的数据主键集合
      * @return 结果
      */
-    public int deleteBtpPolicestationVillageByPvId(Long pvId);
+    int deleteBtpPolicestationVillageByPvIds(String[] pvIds);
+
+    int getSubResources(String[] ids);
 
     /**
-     * 批量删除派出所、委(村)
+     * 查询派出所、委(村)
      *
-     * @param pvIds 需要删除的数据主键集合
-     * @return 结果
+     * @param parentId 派出所、委(村)父级id
+     * @return 派出所、委(村)
      */
-    public int deleteBtpPolicestationVillageByPvIds(String[] pvIds);
+    List<BtpPolicestationVillage> getPolicestationVillagesByParentId(Long parentId);
 }

+ 5 - 13
sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/mapper/BtpSchoolMapper.java

@@ -18,7 +18,7 @@ public interface BtpSchoolMapper {
      * @param schoolId 学校主键
      * @return 学校
      */
-    public BtpSchool selectBtpSchoolBySchoolId(Long schoolId);
+    BtpSchool selectBtpSchoolBySchoolId(Long schoolId);
 
     /**
      * 查询学校列表
@@ -26,7 +26,7 @@ public interface BtpSchoolMapper {
      * @param btpSchool 学校
      * @return 学校集合
      */
-    public List<BtpSchool> selectBtpSchoolList(BtpSchool btpSchool);
+    List<BtpSchool> selectBtpSchoolList(BtpSchool btpSchool);
 
     /**
      * 新增学校
@@ -34,7 +34,7 @@ public interface BtpSchoolMapper {
      * @param btpSchool 学校
      * @return 结果
      */
-    public int insertBtpSchool(BtpSchool btpSchool);
+    int insertBtpSchool(BtpSchool btpSchool);
 
     /**
      * 修改学校
@@ -42,15 +42,7 @@ public interface BtpSchoolMapper {
      * @param btpSchool 学校
      * @return 结果
      */
-    public int updateBtpSchool(BtpSchool btpSchool);
-
-    /**
-     * 删除学校
-     *
-     * @param schoolId 学校主键
-     * @return 结果
-     */
-    public int deleteBtpSchoolBySchoolId(Long schoolId);
+    int updateBtpSchool(BtpSchool btpSchool);
 
     /**
      * 批量删除学校
@@ -58,5 +50,5 @@ public interface BtpSchoolMapper {
      * @param schoolIds 需要删除的数据主键集合
      * @return 结果
      */
-    public int deleteBtpSchoolBySchoolIds(String[] schoolIds);
+    int deleteBtpSchoolBySchoolIds(String[] schoolIds);
 }

+ 18 - 26
sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/mapper/BtpSchoolPvMapper.java

@@ -13,52 +13,44 @@ import java.util.List;
 public interface BtpSchoolPvMapper {
 
     /**
-     * 查询学区
+     * 查询学区配置
      *
-     * @param vIds 学区主键
-     * @return 学区
+     * @param vIds 学区配置的委(村)主键
+     * @return 学区配置
      */
-    public BtpSchoolPv selectBtpSchoolPvInVIds(String vIds);
+    BtpSchoolPv selectBtpSchoolPvInVIds(String vIds);
 
     /**
-     * 查询学区列表
+     * 查询学区配置列表
      *
-     * @param btpSchoolPv 学区
-     * @return 学区集合
+     * @param btpSchoolPv 学区配置
+     * @return 学区配置集合
      */
-    public List<BtpSchoolPv> selectBtpSchoolPvList(BtpSchoolPv btpSchoolPv);
+    List<BtpSchoolPv> selectBtpSchoolPvList(BtpSchoolPv btpSchoolPv);
 
     /**
-     * 新增学区
+     * 新增学区配置
      *
-     * @param btpSchoolPv 学区
+     * @param btpSchoolPv 学区配置
      * @return 结果
      */
-    public int insertBtpSchoolPv(BtpSchoolPv btpSchoolPv);
+    int insertBtpSchoolPv(BtpSchoolPv btpSchoolPv);
 
     /**
-     * 修改学区
+     * 修改学区配置
      *
-     * @param btpSchoolPv 学区
+     * @param btpSchoolPv 学区配置
      * @return 结果
      */
-    public int updateBtpSchoolPv(BtpSchoolPv btpSchoolPv);
+    int updateBtpSchoolPv(BtpSchoolPv btpSchoolPv);
 
     /**
-     * 删除学区
+     * 批量删除学区配置
      *
-     * @param pId 学区主键
+     * @param vIds 需要删除的学区配置的委(村)主键集合
      * @return 结果
      */
-    public int deleteBtpSchoolPvByPId(Long pId);
+    int deleteBtpSchoolPvByVIds(String[] vIds);
 
-    /**
-     * 批量删除学区
-     *
-     * @param pIds 需要删除的数据主键集合
-     * @return 结果
-     */
-    public int deleteBtpSchoolPvByVIds(String[] vIds);
-
-    public List<BtpSchoolPv> selectBtpSchoolPvInSchoolId(String[] schoolIds);
+    List<BtpSchoolPv> getBtpSchoolPvsInSchoolIds(String[] schoolIds);
 }

+ 11 - 17
sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/service/IBtpPolicestationVillageService.java

@@ -18,15 +18,7 @@ public interface IBtpPolicestationVillageService {
      * @param pvId 派出所、委(村)主键
      * @return 派出所、委(村)
      */
-    public BtpPolicestationVillage selectBtpPolicestationVillageByPvId(Long pvId);
-
-    /**
-     * 查询派出所、委(村)
-     *
-     * @param parentId 派出所、委(村)父级id
-     * @return 派出所、委(村)
-     */
-    public List<BtpPolicestationVillage> getAllByParentId(Long parentId);
+    BtpPolicestationVillage selectBtpPolicestationVillageByPvId(Long pvId);
 
     /**
      * 查询派出所、委(村)列表
@@ -34,7 +26,7 @@ public interface IBtpPolicestationVillageService {
      * @param btpPolicestationVillage 派出所、委(村)
      * @return 派出所、委(村)集合
      */
-    public List<BtpPolicestationVillage> selectBtpPolicestationVillageList(BtpPolicestationVillage btpPolicestationVillage);
+    List<BtpPolicestationVillage> selectBtpPolicestationVillageList(BtpPolicestationVillage btpPolicestationVillage);
 
     /**
      * 新增派出所、委(村)
@@ -42,7 +34,7 @@ public interface IBtpPolicestationVillageService {
      * @param btpPolicestationVillage 派出所、委(村)
      * @return 结果
      */
-    public int insertBtpPolicestationVillage(BtpPolicestationVillage btpPolicestationVillage);
+    int insertBtpPolicestationVillage(BtpPolicestationVillage btpPolicestationVillage);
 
     /**
      * 修改派出所、委(村)
@@ -50,7 +42,7 @@ public interface IBtpPolicestationVillageService {
      * @param btpPolicestationVillage 派出所、委(村)
      * @return 结果
      */
-    public int updateBtpPolicestationVillage(BtpPolicestationVillage btpPolicestationVillage);
+    int updateBtpPolicestationVillage(BtpPolicestationVillage btpPolicestationVillage);
 
     /**
      * 批量删除派出所、委(村)
@@ -58,13 +50,15 @@ public interface IBtpPolicestationVillageService {
      * @param pvIds 需要删除的派出所、委(村)主键集合
      * @return 结果
      */
-    public int deleteBtpPolicestationVillageByPvIds(String pvIds);
+    int deleteBtpPolicestationVillageByPvIds(String pvIds);
+
+    int getSubResources(String ids);
 
     /**
-     * 删除派出所、委(村)信息
+     * 查询派出所、委(村)
      *
-     * @param pvId 派出所、委(村)主键
-     * @return 结果
+     * @param parentId 派出所、委(村)父级id
+     * @return 派出所、委(村)
      */
-    public int deleteBtpPolicestationVillageByPvId(Long pvId);
+    List<BtpPolicestationVillage> getPolicestationVillagesByParentId(Long parentId);
 }

+ 16 - 24
sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/service/IBtpSchoolPvService.java

@@ -13,52 +13,44 @@ import java.util.List;
 public interface IBtpSchoolPvService {
 
     /**
-     * 查询关系中间
+     * 查询学区配置
      *
-     * @param vIds 关系中间主键
-     * @return 关系中间
+     * @param vIds 学区配置的委(村)主键
+     * @return 学区配置
      */
-    public BtpSchoolPv selectBtpSchoolPvInVIds(String vIds);
+    BtpSchoolPv selectBtpSchoolPvInVIds(String vIds);
 
     /**
-     * 查询关系中间列表
+     * 查询学区配置列表
      *
-     * @param btpSchoolPv 关系中间
-     * @return 关系中间集合
+     * @param btpSchoolPv 学区配置
+     * @return 学区配置集合
      */
-    public List<BtpSchoolPv> selectBtpSchoolPvList(BtpSchoolPv btpSchoolPv);
+    List<BtpSchoolPv> selectBtpSchoolPvList(BtpSchoolPv btpSchoolPv);
 
     /**
-     * 新增关系中间
+     * 新增学区配置
      *
-     * @param btpSchoolPv 关系中间
+     * @param btpSchoolPv 学区配置
      * @return 结果
      */
-    public int insertBtpSchoolPv(BtpSchoolPv btpSchoolPv);
+    int insertBtpSchoolPv(BtpSchoolPv btpSchoolPv);
 
     /**
      * 修改学区
      *
-     * @param btpSchoolPv 学区
+     * @param btpSchoolPv 学区配置
      * @return 结果
      */
-    public int updateBtpSchoolPv(BtpSchoolPv btpSchoolPv);
+    int updateBtpSchoolPv(BtpSchoolPv btpSchoolPv);
 
     /**
      * 批量删除学区
      *
-     * @param pIds 需要删除的学区主键集合
+     * @param vIds 需要删除的学区配置的委(村)主键集合
      * @return 结果
      */
-    public int deleteBtpSchoolPvByVIds(String vIds);
+    int deleteBtpSchoolPvByVIds(String vIds);
 
-    /**
-     * 删除学区信息
-     *
-     * @param pId 学区主键
-     * @return 结果
-     */
-    public int deleteBtpSchoolPvByPId(Long pId);
-
-    public List<BtpSchoolPv> selectBtpSchoolPvInSchoolId(String schoolIds);
+    List<BtpSchoolPv> getBtpSchoolPvsInSchoolIds(String schoolIds);
 }

+ 5 - 13
sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/service/IBtpSchoolService.java

@@ -18,7 +18,7 @@ public interface IBtpSchoolService {
      * @param schoolId 学校主键
      * @return 学校
      */
-    public BtpSchool selectBtpSchoolBySchoolId(Long schoolId);
+    BtpSchool selectBtpSchoolBySchoolId(Long schoolId);
 
     /**
      * 查询学校列表
@@ -26,7 +26,7 @@ public interface IBtpSchoolService {
      * @param btpSchool 学校
      * @return 学校集合
      */
-    public List<BtpSchool> selectBtpSchoolList(BtpSchool btpSchool);
+    List<BtpSchool> selectBtpSchoolList(BtpSchool btpSchool);
 
     /**
      * 新增学校
@@ -34,7 +34,7 @@ public interface IBtpSchoolService {
      * @param btpSchool 学校
      * @return 结果
      */
-    public int insertBtpSchool(BtpSchool btpSchool);
+    int insertBtpSchool(BtpSchool btpSchool);
 
     /**
      * 修改学校
@@ -42,7 +42,7 @@ public interface IBtpSchoolService {
      * @param btpSchool 学校
      * @return 结果
      */
-    public int updateBtpSchool(BtpSchool btpSchool);
+    int updateBtpSchool(BtpSchool btpSchool);
 
     /**
      * 批量删除学校
@@ -50,13 +50,5 @@ public interface IBtpSchoolService {
      * @param schoolIds 需要删除的学校主键集合
      * @return 结果
      */
-    public int deleteBtpSchoolBySchoolIds(String schoolIds);
-
-    /**
-     * 删除学校信息
-     *
-     * @param schoolId 学校主键
-     * @return 结果
-     */
-    public int deleteBtpSchoolBySchoolId(Long schoolId);
+    int deleteBtpSchoolBySchoolIds(String schoolIds);
 }

+ 11 - 17
sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/service/impl/BtpPolicestationVillageServiceImpl.java

@@ -1,9 +1,9 @@
 package com.sooka.schooldistrict.service.impl;
 
+import com.sooka.common.core.text.Convert;
 import com.sooka.schooldistrict.domain.BtpPolicestationVillage;
 import com.sooka.schooldistrict.mapper.BtpPolicestationVillageMapper;
 import com.sooka.schooldistrict.service.IBtpPolicestationVillageService;
-import com.sooka.common.core.text.Convert;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -33,17 +33,6 @@ public class BtpPolicestationVillageServiceImpl implements IBtpPolicestationVill
     }
 
     /**
-     * 查询派出所、委(村)
-     *
-     * @param parentId 派出所、委(村)父级id
-     * @return 派出所、委(村)
-     */
-    @Override
-    public List<BtpPolicestationVillage> getAllByParentId(Long parentId) {
-        return btpPolicestationVillageMapper.getAllByParentId(parentId);
-    }
-
-    /**
      * 查询派出所、委(村)列表
      *
      * @param btpPolicestationVillage 派出所、委(村)
@@ -87,14 +76,19 @@ public class BtpPolicestationVillageServiceImpl implements IBtpPolicestationVill
         return btpPolicestationVillageMapper.deleteBtpPolicestationVillageByPvIds(Convert.toStrArray(pvIds));
     }
 
+    @Override
+    public int getSubResources(String ids) {
+        return btpPolicestationVillageMapper.getSubResources(Convert.toStrArray(ids));
+    }
+
     /**
-     * 删除派出所、委(村)信息
+     * 查询派出所、委(村)
      *
-     * @param pvId 派出所、委(村)主键
-     * @return 结果
+     * @param parentId 派出所、委(村)父级id
+     * @return 派出所、委(村)
      */
     @Override
-    public int deleteBtpPolicestationVillageByPvId(Long pvId) {
-        return btpPolicestationVillageMapper.deleteBtpPolicestationVillageByPvId(pvId);
+    public List<BtpPolicestationVillage> getPolicestationVillagesByParentId(Long parentId) {
+        return btpPolicestationVillageMapper.getPolicestationVillagesByParentId(parentId);
     }
 }

+ 15 - 26
sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/service/impl/BtpSchoolPvServiceImpl.java

@@ -23,10 +23,10 @@ public class BtpSchoolPvServiceImpl implements IBtpSchoolPvService {
     private BtpSchoolPvMapper btpSchoolPvMapper;
 
     /**
-     * 查询学区
+     * 查询学区配置
      *
-     * @param vIds 学区主键
-     * @return 学区
+     * @param vIds 学区配置的委(村)主键
+     * @return 学区配置
      */
     @Override
     public BtpSchoolPv selectBtpSchoolPvInVIds(String vIds) {
@@ -34,10 +34,10 @@ public class BtpSchoolPvServiceImpl implements IBtpSchoolPvService {
     }
 
     /**
-     * 查询学区列表
+     * 查询学区配置列表
      *
-     * @param btpSchoolPv 学区
-     * @return 学区
+     * @param btpSchoolPv 学区配置
+     * @return 学区配置集合
      */
     @Override
     public List<BtpSchoolPv> selectBtpSchoolPvList(BtpSchoolPv btpSchoolPv) {
@@ -45,15 +45,15 @@ public class BtpSchoolPvServiceImpl implements IBtpSchoolPvService {
     }
 
     /**
-     * 新增学区
+     * 新增学区配置
      *
-     * @param btpSchoolPv 学区
+     * @param btpSchoolPv 学区配置
      * @return 结果
      */
     @Override
     public int insertBtpSchoolPv(BtpSchoolPv btpSchoolPv) {
         int result = 0;
-        for (String vId : btpSchoolPv.getId().split(",")) {
+        for (String vId : Convert.toStrArray(btpSchoolPv.getId())) {
             btpSchoolPv.setvId(Long.parseLong(vId));
             result += btpSchoolPvMapper.insertBtpSchoolPv(btpSchoolPv);
         }
@@ -61,9 +61,9 @@ public class BtpSchoolPvServiceImpl implements IBtpSchoolPvService {
     }
 
     /**
-     * 修改学区
+     * 修改学区配置
      *
-     * @param btpSchoolPv 学区
+     * @param btpSchoolPv 学区配置
      * @return 结果
      */
     @Transactional
@@ -74,9 +74,9 @@ public class BtpSchoolPvServiceImpl implements IBtpSchoolPvService {
     }
 
     /**
-     * 批量删除学区
+     * 批量删除学区配置
      *
-     * @param pIds 需要删除的学区主键
+     * @param vIds 需要删除的学区配置的委(村)主键
      * @return 结果
      */
     @Override
@@ -84,19 +84,8 @@ public class BtpSchoolPvServiceImpl implements IBtpSchoolPvService {
         return btpSchoolPvMapper.deleteBtpSchoolPvByVIds(Convert.toStrArray(vIds));
     }
 
-    /**
-     * 删除学区信息
-     *
-     * @param pId 学区主键
-     * @return 结果
-     */
-    @Override
-    public int deleteBtpSchoolPvByPId(Long pId) {
-        return btpSchoolPvMapper.deleteBtpSchoolPvByPId(pId);
-    }
-
     @Override
-    public List<BtpSchoolPv> selectBtpSchoolPvInSchoolId(String schoolIds) {
-        return btpSchoolPvMapper.selectBtpSchoolPvInSchoolId(Convert.toStrArray(schoolIds));
+    public List<BtpSchoolPv> getBtpSchoolPvsInSchoolIds(String schoolIds) {
+        return btpSchoolPvMapper.getBtpSchoolPvsInSchoolIds(Convert.toStrArray(schoolIds));
     }
 }

+ 1 - 12
sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/service/impl/BtpSchoolServiceImpl.java

@@ -1,9 +1,9 @@
 package com.sooka.schooldistrict.service.impl;
 
+import com.sooka.common.core.text.Convert;
 import com.sooka.schooldistrict.domain.BtpSchool;
 import com.sooka.schooldistrict.mapper.BtpSchoolMapper;
 import com.sooka.schooldistrict.service.IBtpSchoolService;
-import com.sooka.common.core.text.Convert;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -75,15 +75,4 @@ public class BtpSchoolServiceImpl implements IBtpSchoolService {
     public int deleteBtpSchoolBySchoolIds(String schoolIds) {
         return btpSchoolMapper.deleteBtpSchoolBySchoolIds(Convert.toStrArray(schoolIds));
     }
-
-    /**
-     * 删除学校信息
-     *
-     * @param schoolId 学校主键
-     * @return 结果
-     */
-    @Override
-    public int deleteBtpSchoolBySchoolId(Long schoolId) {
-        return btpSchoolMapper.deleteBtpSchoolBySchoolId(schoolId);
-    }
 }

+ 18 - 9
sooka-schooldistrict/src/main/resources/mapper/schooldistrict/BtpPolicestationVillageMapper.xml

@@ -44,11 +44,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where pv_id = #{pvId}
     </select>
 
-    <select id="getAllByParentId" parameterType="BtpPolicestationVillage" resultMap="BtpPolicestationVillageResult">
-        <include refid="selectBtpPolicestationVillageVo"/>
-        where parent_id = #{parentId}
-    </select>
-
     <insert id="insertBtpPolicestationVillage" parameterType="BtpPolicestationVillage" useGeneratedKeys="true" keyProperty="pvId">
         insert into btp_policestation_village
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -70,10 +65,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where pv_id = #{pvId}
     </update>
 
-    <delete id="deleteBtpPolicestationVillageByPvId" parameterType="Long">
-        delete from btp_policestation_village where pv_id = #{pvId}
-    </delete>
-
     <delete id="deleteBtpPolicestationVillageByPvIds" parameterType="String">
         delete from btp_policestation_village where pv_id in 
         <foreach item="pvId" collection="array" open="(" separator="," close=")">
@@ -81,4 +72,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </delete>
 
+    <select id="getSubResources" resultType="Integer">
+        select count(*) from btp_policestation_village a
+        left join btp_school_pv b on b.v_id = a.pv_id
+        where a.parent_id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+        or b.v_id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </select>
+
+    <select id="getPolicestationVillagesByParentId" parameterType="Long" resultMap="BtpPolicestationVillageResult">
+        <include refid="selectBtpPolicestationVillageVo"/>
+        where parent_id = #{parentId}
+    </select>
+
 </mapper>

+ 0 - 4
sooka-schooldistrict/src/main/resources/mapper/schooldistrict/BtpSchoolMapper.xml

@@ -48,10 +48,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where school_id = #{schoolId}
     </update>
 
-    <delete id="deleteBtpSchoolBySchoolId" parameterType="Long">
-        delete from btp_school where school_id = #{schoolId}
-    </delete>
-
     <delete id="deleteBtpSchoolBySchoolIds" parameterType="String">
         delete from btp_school where school_id in 
         <foreach item="schoolId" collection="array" open="(" separator="," close=")">

+ 1 - 5
sooka-schooldistrict/src/main/resources/mapper/schooldistrict/BtpSchoolPvMapper.xml

@@ -68,10 +68,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where p_id = #{pId}
     </update>
 
-    <delete id="deleteBtpSchoolPvByPId" parameterType="Long">
-        delete from btp_school_pv where p_id = #{pId}
-    </delete>
-
     <delete id="deleteBtpSchoolPvByVIds" parameterType="String">
         delete from btp_school_pv where v_id in
         <foreach item="vId" collection="array" open="(" separator="," close=")">
@@ -79,7 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </delete>
 
-    <select id="selectBtpSchoolPvInSchoolId" parameterType="String" resultMap="BtpSchoolPvResult">
+    <select id="getBtpSchoolPvsInSchoolIds" parameterType="String" resultMap="BtpSchoolPvResult">
         <include refid="selectBtpSchoolPvVo"/>
         where school_id in
         <foreach item="schoolId" collection="array" open="(" separator="," close=")">