소스 검색

1.优化
2.修复学区配置相关缺陷

liuyuqiang 2 년 전
부모
커밋
b8c606888f
20개의 변경된 파일133개의 추가작업 그리고 130개의 파일을 삭제
  1. 6 6
      pom.xml
  2. 4 4
      sooka-admin/pom.xml
  3. 2 11
      sooka-admin/src/main/java/com/sooka/SookaApplication.java
  4. 1 1
      sooka-admin/src/main/java/com/sooka/web/controller/monitor/DruidController.java
  5. 16 12
      sooka-admin/src/main/java/com/sooka/web/controller/schooldistrict/BtpSchoolPvController.java
  6. 1 2
      sooka-admin/src/main/java/com/sooka/web/controller/system/SysIndexController.java
  7. 1 1
      sooka-admin/src/main/java/com/sooka/web/controller/tool/SwaggerController.java
  8. 2 4
      sooka-admin/src/main/resources/templates/main.html
  9. 20 21
      sooka-admin/src/main/resources/templates/schooldistrict/config/add.html
  10. 25 21
      sooka-admin/src/main/resources/templates/schooldistrict/config/edit.html
  11. 1 2
      sooka-admin/src/main/resources/templates/schooldistrict/policestationvillage/add.html
  12. 1 2
      sooka-admin/src/main/resources/templates/schooldistrict/policestationvillage/edit.html
  13. 1 1
      sooka-admin/src/main/resources/templates/schooldistrict/policestationvillage/policestationvillage.html
  14. 1 1
      sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/domain/BtpSchoolPv.java
  15. 5 2
      sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/mapper/BtpSchoolPvMapper.java
  16. 4 10
      sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/service/IBtpSchoolPvService.java
  17. 4 0
      sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/service/impl/BtpPolicestationVillageServiceImpl.java
  18. 13 17
      sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/service/impl/BtpSchoolPvServiceImpl.java
  19. 4 0
      sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/service/impl/BtpSchoolServiceImpl.java
  20. 21 12
      sooka-schooldistrict/src/main/resources/mapper/schooldistrict/BtpSchoolPvMapper.xml

+ 6 - 6
pom.xml

@@ -157,18 +157,18 @@
             </dependency>
 
             <!-- 定时任务-->
-            <dependency>
+            <!--<dependency>
                 <groupId>com.sooka</groupId>
                 <artifactId>sooka-quartz</artifactId>
                 <version>${sooka.version}</version>
-            </dependency>
+            </dependency>-->
 
             <!-- 代码生成-->
-            <dependency>
+            <!--<dependency>
                 <groupId>com.sooka</groupId>
                 <artifactId>sooka-generator</artifactId>
                 <version>${sooka.version}</version>
-            </dependency>
+            </dependency>-->
 
             <!-- 核心模块-->
             <dependency>
@@ -206,8 +206,8 @@
         <module>sooka-framework</module>
         <module>sooka-system</module>
         <module>sooka-schooldistrict</module>
-        <module>sooka-quartz</module>
-        <module>sooka-generator</module>
+        <!--<module>sooka-quartz</module>-->
+        <!--<module>sooka-generator</module>-->
         <module>sooka-common</module>
     </modules>
     <packaging>pom</packaging>

+ 4 - 4
sooka-admin/pom.xml

@@ -56,16 +56,16 @@
         </dependency>
 
         <!-- 定时任务-->
-        <dependency>
+        <!--<dependency>
             <groupId>com.sooka</groupId>
             <artifactId>sooka-quartz</artifactId>
-        </dependency>
+        </dependency>-->
 
         <!-- 代码生成-->
-        <dependency>
+        <!--<dependency>
             <groupId>com.sooka</groupId>
             <artifactId>sooka-generator</artifactId>
-        </dependency>
+        </dependency>-->
 
         <dependency>
             <groupId>com.sooka</groupId>

+ 2 - 11
sooka-admin/src/main/java/com/sooka/SookaApplication.java

@@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
 
 /**
  * 启动程序
- * 
+ *
  * @author sooka
  */
 @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
@@ -16,15 +16,6 @@ public class SookaApplication
     {
         // System.setProperty("spring.devtools.restart.enabled", "false");
         SpringApplication.run(SookaApplication.class, args);
-        System.out.println("(♥◠‿◠)ノ゙  首佳启动成功   ლ(´ڡ`ლ)゙  \n" +
-                " .-------.       ____     __        \n" +
-                " |  _ _   \\      \\   \\   /  /    \n" +
-                " | ( ' )  |       \\  _. /  '       \n" +
-                " |(_ o _) /        _( )_ .'         \n" +
-                " | (_,_).' __  ___(_ o _)'          \n" +
-                " |  |\\ \\  |  ||   |(_,_)'         \n" +
-                " |  | \\ `'   /|   `-'  /           \n" +
-                " |  |  \\    /  \\      /           \n" +
-                " ''-'   `'-'    `-..-'              ");
+        System.out.println("(♥◠‿◠)ノ゙  学区查询系统启动成功   ლ(´ڡ`ლ)゙");
     }
 }

+ 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 + "/config.html");
+        return redirect(prefix + "/index.html");
     }
 }

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

@@ -1,17 +1,17 @@
 package com.sooka.web.controller.schooldistrict;
 
-import com.sooka.schooldistrict.domain.BtpPolicestationVillage;
-import com.sooka.schooldistrict.domain.BtpSchool;
-import com.sooka.schooldistrict.domain.BtpSchoolPv;
-import com.sooka.schooldistrict.service.IBtpPolicestationVillageService;
-import com.sooka.schooldistrict.service.IBtpSchoolPvService;
-import com.sooka.schooldistrict.service.IBtpSchoolService;
 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.domain.BtpSchool;
+import com.sooka.schooldistrict.domain.BtpSchoolPv;
+import com.sooka.schooldistrict.service.IBtpPolicestationVillageService;
+import com.sooka.schooldistrict.service.IBtpSchoolPvService;
+import com.sooka.schooldistrict.service.IBtpSchoolService;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -99,9 +99,9 @@ public class BtpSchoolPvController extends BaseController {
      * 修改学区
      */
     @RequiresPermissions("schooldistrict:config:edit")
-    @GetMapping("/edit/{vIds}")
-    public String edit(@PathVariable("vIds") String vIds, ModelMap mmap) {
-        BtpSchoolPv btpSchoolPv = btpSchoolPvService.selectBtpSchoolPvInVIds(vIds);
+    @GetMapping("/edit/{id}")
+    public String edit(@PathVariable("id") String id, ModelMap mmap) {
+        BtpSchoolPv btpSchoolPv = btpSchoolPvService.selectBtpSchoolPvBySchoolIdAndVId(id);
         mmap.put("btpSchoolPv", btpSchoolPv);
         mmap.put("policestations", btpPolicestationVillageService.getPolicestationVillagesByParentId(0L));
         mmap.put("villages", btpPolicestationVillageService.getPolicestationVillagesByParentId(btpSchoolPv.getpId()));
@@ -116,8 +116,12 @@ public class BtpSchoolPvController extends BaseController {
     @Log(title = "学区配置", businessType = BusinessType.UPDATE)
     @PostMapping("/edit")
     @ResponseBody
-    public AjaxResult editSave(BtpSchoolPv btpSchoolPv) {
-        return toAjax(btpSchoolPvService.updateBtpSchoolPv(btpSchoolPv));
+    public AjaxResult editSave(String removeId, BtpSchoolPv btpSchoolPv) {
+        int result = btpSchoolPvService.deleteBtpSchoolPvBySchoolIdAndVIds(removeId);
+        if (result > 0) {
+            return toAjax(btpSchoolPvService.insertBtpSchoolPv(btpSchoolPv));
+        }
+        return AjaxResult.error();
     }
 
     /**
@@ -128,6 +132,6 @@ public class BtpSchoolPvController extends BaseController {
     @PostMapping("/remove")
     @ResponseBody
     public AjaxResult remove(String ids) {
-        return toAjax(btpSchoolPvService.deleteBtpSchoolPvByVIds(ids));
+        return toAjax(btpSchoolPvService.deleteBtpSchoolPvBySchoolIdAndVIds(ids));
     }
 }

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

@@ -174,8 +174,7 @@ public class SysIndexController extends BaseController
         {
             return AjaxResult.error(MessageUtils.message("user.jcaptcha.error"));
         }
-        List<BtpSchoolPv> list = btpSchoolPvService.selectBtpSchoolPvList(btpSchoolPv);
-        return AjaxResult.success(list);
+        return AjaxResult.success(btpSchoolPvService.getSchoolName(btpSchoolPv));
     }
 
     // content-main class

+ 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/config.html");
+        return redirect("/swagger-ui/index.html");
     }
 }

+ 2 - 4
sooka-admin/src/main/resources/templates/main.html

@@ -82,11 +82,9 @@
 					if (r.data.length == 0) {
 						name += "暂无学区 ";
 					} else {
-						$.each(r.data, function (i, item) {
-							name += item.schoolName + ",";
-						})
+						name += r.data.join(",");
 					}
-					$("#schoolId").empty().append(name.substring(0, name.length-1));
+					$("#schoolId").empty().append(name);
 				} else {
 					$('.imgcode').click();
 					$(".code").val("");

+ 20 - 21
sooka-admin/src/main/resources/templates/schooldistrict/config/add.html

@@ -1,33 +1,33 @@
 <!DOCTYPE html>
 <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
 <head>
-    <th:block th:include="include :: header('新增关系中间')" />
+    <th:block th:include="include :: header('新增学区配置')" />
     <th:block th:include="include :: select2-css" />
 </head>
 <body class="white-bg">
     <div class="wrapper wrapper-content animated fadeInRight ibox-content">
         <form class="form-horizontal m" id="form-pv-add">
             <div class="form-group">
-                <label class="col-sm-3 control-label is-required">派出所:</label>
+                <label class="col-sm-3 control-label is-required">学校:</label>
                 <div class="col-sm-8">
-                    <select id="pId" name="pId" class="form-control select2-multiple">
-                        <option th:each="policestation:${policestations}" th:value="${policestation.pvId}" th:text="${policestation.pvName}"></option>
+                    <select id="schoolId" name="schoolId" class="form-control select2-multiple">
+                        <option th:each="school:${schools}" th:value="${school.schoolId}" th:text="${school.schoolName}"></option>
                     </select>
                 </div>
             </div>
             <div class="form-group">
-                <label class="col-sm-3 control-label is-required">委(村):</label>
+                <label class="col-sm-3 control-label is-required">派出所:</label>
                 <div class="col-sm-8">
-                    <select id="vId" class="form-control select2-multiple" multiple>
-                        <option th:each="village:${villages}" th:value="${village.pvId}" th:text="${village.pvName}" ></option>
+                    <select id="pId" name="pId" class="form-control select2-multiple">
+                        <option th:each="policestation:${policestations}" th:value="${policestation.pvId}" th:text="${policestation.pvName}"></option>
                     </select>
                 </div>
             </div>
             <div class="form-group">
-                <label class="col-sm-3 control-label is-required">学校:</label>
+                <label class="col-sm-3 control-label is-required">委(村):</label>
                 <div class="col-sm-8">
-                    <select id="schoolId" name="schoolId" class="form-control select2-multiple">
-                        <option th:each="school:${schools}" th:value="${school.schoolId}" th:text="${school.schoolName}"></option>
+                    <select id="vId" name="vId" class="form-control select2-multiple" multiple>
+                        <option th:each="village:${villages}" th:value="${village.pvId}" th:text="${village.pvName}" ></option>
                     </select>
                 </div>
             </div>
@@ -45,6 +45,10 @@
             if ($.validate.form()) {
                 var data = $("#form-pv-add").serializeArray();
                 var vIds = $.form.selectSelects("vId");
+                if (vIds == "") {
+                    $.modal.msg("请选择委(村)");
+                    return;
+                }
                 data.push({"name": "id", "value": vIds});
                 $.operate.save(prefix + "/add", data);
             }
@@ -60,25 +64,20 @@
 
         $(function() {
             $('#pId').select2({
-                placeholder: "请选择派出所",
-                allowClear: false
-            }).on('select2:select', function (e) {
-                //处理自己的业务
+                placeholder: "请选择派出所"
+            }).on('change.select2', function (e) {
                 $.get("/schooldistrict/policestationvillage/getPolicestationVillagesByParentId?parentId=" + this.value, function(result) {
                     $('#vId').empty().select2({
                         data: getData(result),
-                        placeholder: "请选择委(村)",
-                        allowClear: false
+                        placeholder: "请选择委(村)"
                     });
                 });
-            });
+            }).trigger("change");
             $('#vId').select2({
-                placeholder: "请选择委(村)",
-                allowClear: false
+                placeholder: "请选择委(村)"
             });
             $('#schoolId').select2({
-                placeholder: "请选择学校",
-                allowClear: false
+                placeholder: "请选择学校"
             });
         })
     </script>

+ 25 - 21
sooka-admin/src/main/resources/templates/schooldistrict/config/edit.html

@@ -1,34 +1,34 @@
 <!DOCTYPE html>
 <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
 <head>
-    <th:block th:include="include :: header('修改关系中间')" />
+    <th:block th:include="include :: header('修改学区配置')" />
     <th:block th:include="include :: select2-css" />
 </head>
 <body class="white-bg">
     <div class="wrapper wrapper-content animated fadeInRight ibox-content">
         <form class="form-horizontal m" id="form-pv-edit" th:object="${btpSchoolPv}">
             <div class="form-group">
-                <label class="col-sm-3 control-label is-required">派出所:</label>
+                <label class="col-sm-3 control-label is-required">学校:</label>
                 <div class="col-sm-8">
-                    <select id="pId" name="pId" th:field="*{pId}" class="form-control select2-multiple">
-                        <option th:each="policestation:${policestations}" th:value="${policestation.pvId}" th:text="${policestation.pvName}"></option>
+                    <select id="schoolId" name="schoolId" th:field="*{schoolId}" class="form-control select2-multiple">
+                        <option th:each="school:${schools}" th:value="${school.schoolId}" th:text="${school.schoolName}"></option>
                     </select>
                 </div>
             </div>
             <div class="form-group">
-                <label class="col-sm-3 control-label is-required">委(村):</label>
+                <label class="col-sm-3 control-label is-required">派出所:</label>
                 <div class="col-sm-8">
-                    <select id="vId" class="form-control select2-multiple" multiple>
-                        <option th:each="village:${villages}" th:value="${village.pvId}" th:text="${village.pvName}"
-                                th:selected="${#arrays.contains(btpSchoolPv.id.split(','),village.pvId.toString())}"></option>
+                    <select id="pId" name="pId" th:field="*{pId}" class="form-control select2-multiple">
+                        <option th:each="policestation:${policestations}" th:value="${policestation.pvId}" th:text="${policestation.pvName}"></option>
                     </select>
                 </div>
             </div>
             <div class="form-group">
-                <label class="col-sm-3 control-label is-required">学校:</label>
+                <label class="col-sm-3 control-label is-required">委(村):</label>
                 <div class="col-sm-8">
-                    <select id="schoolId" name="schoolId" th:field="*{schoolId}" class="form-control select2-multiple">
-                        <option th:each="school:${schools}" th:value="${school.schoolId}" th:text="${school.schoolName}"></option>
+                    <select id="vId" name="vId" class="form-control select2-multiple" multiple>
+                        <option th:each="village:${villages}" th:value="${village.pvId}" th:text="${village.pvName}"
+                                th:selected="${#arrays.contains(btpSchoolPv.id.split('_')[1].split(','),village.pvId.toString())}"></option>
                     </select>
                 </div>
             </div>
@@ -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/config";
+        var prefix = ctx + "schooldistrict/config", removeId = [[${btpSchoolPv.id}]];
         $("#form-pv-edit").validate({
             focusCleanup: true
         });
@@ -45,33 +45,37 @@
         function submitHandler() {
             if ($.validate.form()) {
                 var data = $("#form-pv-edit").serializeArray();
+                data.push({"name": "removeId", "value": removeId});
                 var vIds = $.form.selectSelects("vId");
                 data.push({"name": "id", "value": vIds});
                 $.operate.save(prefix + "/edit", data);
             }
         }
 
+        function getData(array) {
+            $.each(array, function (index, item) {
+                item.id = item.pvId;
+                item.text = item.pvName;
+            })
+            return array;
+        }
+
         $(function() {
             $('#pId').select2({
-                placeholder: "请选择派出所",
-                allowClear: false
+                placeholder: "请选择派出所"
             }).on('select2:select', function (e) {
                 $.get("/schooldistrict/policestationvillage/getPolicestationVillagesByParentId?parentId=" + this.value, function(result) {
                     $('#vId').empty().select2({
                         data: getData(result),
-                        placeholder: "请选择委(村)",
-                        allowClear: false
+                        placeholder: "请选择委(村)"
                     });
                 });
             });
-            $('#pId').trigger("select");
             $('#vId').select2({
-                placeholder: "请选择委(村)",
-                allowClear: false
+                placeholder: "请选择委(村)"
             });
             $('#schoolId').select2({
-                placeholder: "请选择学校",
-                allowClear: false
+                placeholder: "请选择学校"
             });
         })
     </script>

+ 1 - 2
sooka-admin/src/main/resources/templates/schooldistrict/policestationvillage/add.html

@@ -39,8 +39,7 @@
 
     $(function() {
         $('#parentId').select2({
-            placeholder: "请选择所属派出所",
-            allowClear: false
+            placeholder: "请选择所属派出所"
         });
         if ("0" == [[${parentId}]]) {
             $("#parentId").select2("val", [0]);

+ 1 - 2
sooka-admin/src/main/resources/templates/schooldistrict/policestationvillage/edit.html

@@ -40,8 +40,7 @@
 
     $(function() {
         $('#parentId').select2({
-            placeholder: "请选择所属派出所",
-            allowClear: false
+            placeholder: "请选择所属派出所"
         });
     })
 </script>

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

@@ -53,7 +53,7 @@
 <script th:inline="javascript">
     var editFlag = [[${@permission.hasPermi('schooldistrict:policestationvillage:edit')}]];
     var removeFlag = [[${@permission.hasPermi('schooldistrict:policestationvillage:remove')}]];
-    var prefix = ctx + "schooldistrict/policestationvillage", parentId = '[[${parentId}]]';
+    var prefix = ctx + "schooldistrict/policestationvillage", parentId = [[${parentId}]];
     if (parentId != 0) {
         $("#parentName").show();
     }

+ 1 - 1
sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/domain/BtpSchoolPv.java

@@ -6,7 +6,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 
 /**
- * 关系中间对象 btp_school_pv
+ * 学区配置对象 btp_school_pv
  *
  * @author lyq
  * @date 2023-02-20

+ 5 - 2
sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/mapper/BtpSchoolPvMapper.java

@@ -1,6 +1,7 @@
 package com.sooka.schooldistrict.mapper;
 
 import com.sooka.schooldistrict.domain.BtpSchoolPv;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -18,7 +19,7 @@ public interface BtpSchoolPvMapper {
      * @param vIds 学区配置的委(村)主键
      * @return 学区配置
      */
-    BtpSchoolPv selectBtpSchoolPvInVIds(String vIds);
+    BtpSchoolPv selectBtpSchoolPvBySchoolIdAndVId(@Param("schoolId") String schoolId, @Param("vIds") String[] vIds);
 
     /**
      * 查询学区配置列表
@@ -50,7 +51,9 @@ public interface BtpSchoolPvMapper {
      * @param vIds 需要删除的学区配置的委(村)主键集合
      * @return 结果
      */
-    int deleteBtpSchoolPvByVIds(String[] vIds);
+    int deleteBtpSchoolPvBySchoolIdAndVIds(@Param("schoolId") String schoolId, @Param("vIds") String[] vIds);
 
     List<BtpSchoolPv> getBtpSchoolPvsInSchoolIds(String[] schoolIds);
+
+    List<String> getSchoolName(BtpSchoolPv btpSchoolPv);
 }

+ 4 - 10
sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/service/IBtpSchoolPvService.java

@@ -18,7 +18,7 @@ public interface IBtpSchoolPvService {
      * @param vIds 学区配置的委(村)主键
      * @return 学区配置
      */
-    BtpSchoolPv selectBtpSchoolPvInVIds(String vIds);
+    BtpSchoolPv selectBtpSchoolPvBySchoolIdAndVId(String id);
 
     /**
      * 查询学区配置列表
@@ -37,20 +37,14 @@ public interface IBtpSchoolPvService {
     int insertBtpSchoolPv(BtpSchoolPv btpSchoolPv);
 
     /**
-     * 修改学区
-     *
-     * @param btpSchoolPv 学区配置
-     * @return 结果
-     */
-    int updateBtpSchoolPv(BtpSchoolPv btpSchoolPv);
-
-    /**
      * 批量删除学区
      *
      * @param vIds 需要删除的学区配置的委(村)主键集合
      * @return 结果
      */
-    int deleteBtpSchoolPvByVIds(String vIds);
+    int deleteBtpSchoolPvBySchoolIdAndVIds(String id);
 
     List<BtpSchoolPv> getBtpSchoolPvsInSchoolIds(String schoolIds);
+
+    List<String> getSchoolName(BtpSchoolPv btpSchoolPv);
 }

+ 4 - 0
sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/service/impl/BtpPolicestationVillageServiceImpl.java

@@ -6,6 +6,7 @@ import com.sooka.schooldistrict.mapper.BtpPolicestationVillageMapper;
 import com.sooka.schooldistrict.service.IBtpPolicestationVillageService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.util.List;
 
@@ -49,6 +50,7 @@ public class BtpPolicestationVillageServiceImpl implements IBtpPolicestationVill
      * @param btpPolicestationVillage 派出所、委(村)
      * @return 结果
      */
+    @Transactional
     @Override
     public int insertBtpPolicestationVillage(BtpPolicestationVillage btpPolicestationVillage) {
         return btpPolicestationVillageMapper.insertBtpPolicestationVillage(btpPolicestationVillage);
@@ -60,6 +62,7 @@ public class BtpPolicestationVillageServiceImpl implements IBtpPolicestationVill
      * @param btpPolicestationVillage 派出所、委(村)
      * @return 结果
      */
+    @Transactional
     @Override
     public int updateBtpPolicestationVillage(BtpPolicestationVillage btpPolicestationVillage) {
         return btpPolicestationVillageMapper.updateBtpPolicestationVillage(btpPolicestationVillage);
@@ -71,6 +74,7 @@ public class BtpPolicestationVillageServiceImpl implements IBtpPolicestationVill
      * @param pvIds 需要删除的派出所、委(村)主键
      * @return 结果
      */
+    @Transactional
     @Override
     public int deleteBtpPolicestationVillageByPvIds(String pvIds) {
         return btpPolicestationVillageMapper.deleteBtpPolicestationVillageByPvIds(Convert.toStrArray(pvIds));

+ 13 - 17
sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/service/impl/BtpSchoolPvServiceImpl.java

@@ -29,8 +29,9 @@ public class BtpSchoolPvServiceImpl implements IBtpSchoolPvService {
      * @return 学区配置
      */
     @Override
-    public BtpSchoolPv selectBtpSchoolPvInVIds(String vIds) {
-        return btpSchoolPvMapper.selectBtpSchoolPvInVIds(vIds);
+    public BtpSchoolPv selectBtpSchoolPvBySchoolIdAndVId(String id) {
+        String[] ids = Convert.toStrArray("_", id);
+        return btpSchoolPvMapper.selectBtpSchoolPvBySchoolIdAndVId(ids[0], Convert.toStrArray(ids[1]));
     }
 
     /**
@@ -50,6 +51,7 @@ public class BtpSchoolPvServiceImpl implements IBtpSchoolPvService {
      * @param btpSchoolPv 学区配置
      * @return 结果
      */
+    @Transactional
     @Override
     public int insertBtpSchoolPv(BtpSchoolPv btpSchoolPv) {
         int result = 0;
@@ -61,31 +63,25 @@ public class BtpSchoolPvServiceImpl implements IBtpSchoolPvService {
     }
 
     /**
-     * 修改学区配置
-     *
-     * @param btpSchoolPv 学区配置
-     * @return 结果
-     */
-    @Transactional
-    @Override
-    public int updateBtpSchoolPv(BtpSchoolPv btpSchoolPv) {
-        this.deleteBtpSchoolPvByVIds(btpSchoolPv.getId());
-        return this.insertBtpSchoolPv(btpSchoolPv);
-    }
-
-    /**
      * 批量删除学区配置
      *
      * @param vIds 需要删除的学区配置的委(村)主键
      * @return 结果
      */
+    @Transactional
     @Override
-    public int deleteBtpSchoolPvByVIds(String vIds) {
-        return btpSchoolPvMapper.deleteBtpSchoolPvByVIds(Convert.toStrArray(vIds));
+    public int deleteBtpSchoolPvBySchoolIdAndVIds(String id) {
+        String[] ids = Convert.toStrArray("_", id);
+        return btpSchoolPvMapper.deleteBtpSchoolPvBySchoolIdAndVIds(ids[0], Convert.toStrArray(ids[1]));
     }
 
     @Override
     public List<BtpSchoolPv> getBtpSchoolPvsInSchoolIds(String schoolIds) {
         return btpSchoolPvMapper.getBtpSchoolPvsInSchoolIds(Convert.toStrArray(schoolIds));
     }
+
+    @Override
+    public List<String> getSchoolName(BtpSchoolPv btpSchoolPv) {
+        return btpSchoolPvMapper.getSchoolName(btpSchoolPv);
+    }
 }

+ 4 - 0
sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/service/impl/BtpSchoolServiceImpl.java

@@ -6,6 +6,7 @@ import com.sooka.schooldistrict.mapper.BtpSchoolMapper;
 import com.sooka.schooldistrict.service.IBtpSchoolService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.util.List;
 
@@ -49,6 +50,7 @@ public class BtpSchoolServiceImpl implements IBtpSchoolService {
      * @param btpSchool 学校
      * @return 结果
      */
+    @Transactional
     @Override
     public int insertBtpSchool(BtpSchool btpSchool) {
         return btpSchoolMapper.insertBtpSchool(btpSchool);
@@ -60,6 +62,7 @@ public class BtpSchoolServiceImpl implements IBtpSchoolService {
      * @param btpSchool 学校
      * @return 结果
      */
+    @Transactional
     @Override
     public int updateBtpSchool(BtpSchool btpSchool) {
         return btpSchoolMapper.updateBtpSchool(btpSchool);
@@ -71,6 +74,7 @@ public class BtpSchoolServiceImpl implements IBtpSchoolService {
      * @param schoolIds 需要删除的学校主键
      * @return 结果
      */
+    @Transactional
     @Override
     public int deleteBtpSchoolBySchoolIds(String schoolIds) {
         return btpSchoolMapper.deleteBtpSchoolBySchoolIds(Convert.toStrArray(schoolIds));

+ 21 - 12
sooka-schooldistrict/src/main/resources/mapper/schooldistrict/BtpSchoolPvMapper.xml

@@ -20,16 +20,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </sql>
 
     <select id="selectBtpSchoolPvList" parameterType="BtpSchoolPv" resultMap="BtpSchoolPvResult">
-        select group_concat(a.v_id) id, a.p_id, b.pv_name p_name, group_concat(c.pv_name) v_name, a.school_id, d.school_name, d.school_type
+        select
+            concat( a.school_id, '_', group_concat( a.v_id ) ) id,
+            a.p_id, b.pv_name p_name,
+            group_concat( c.pv_name ) v_name,
+            a.school_id, d.school_name, d.school_type
         from btp_school_pv a
         left join btp_policestation_village b on b.pv_id = a.p_id
         left join btp_policestation_village c on c.pv_id = a.v_id
         left join btp_school d on d.school_id = a.school_id
         <where>
-            <if test="pId != null "> and a.p_id = #{pId}</if>
-            <if test="vId != null "> and a.v_id = #{vId}</if>
-            <if test="schoolType != null "> and d.school_type = #{schoolType}</if>
-
             <if test="pName != null "> and b.pv_name like concat('%', #{pName}, '%')</if>
             <if test="vName != null "> and c.pv_name like concat('%', #{vName}, '%')</if>
             <if test="schoolName != null "> and d.school_name like concat('%', #{schoolName}, '%')</if>
@@ -37,10 +37,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         group by a.p_id, a.school_id
     </select>
 
-    <select id="selectBtpSchoolPvInVIds" parameterType="Long" resultMap="BtpSchoolPvResult">
-        select group_concat(v_id) id, p_id, school_id from btp_school_pv
-        where v_id in
-        <foreach item="item" index="index" collection="vIds.split(',')"  open="(" separator="," close=")">
+    <select id="selectBtpSchoolPvBySchoolIdAndVId" parameterType="Long" resultMap="BtpSchoolPvResult">
+        select concat( school_id, '_', group_concat( v_id ) ) id, p_id, school_id from btp_school_pv
+        where school_id = #{schoolId} and v_id in
+        <foreach item="item" index="index" collection="vIds" open="(" separator="," close=")">
             #{item}
         </foreach>
     </select>
@@ -68,9 +68,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where p_id = #{pId}
     </update>
 
-    <delete id="deleteBtpSchoolPvByVIds" parameterType="String">
-        delete from btp_school_pv where v_id in
-        <foreach item="vId" collection="array" open="(" separator="," close=")">
+    <delete id="deleteBtpSchoolPvBySchoolIdAndVIds" parameterType="String">
+        delete from btp_school_pv where school_id = #{schoolId} and v_id in
+        <foreach item="vId" collection="vIds" open="(" separator="," close=")">
             #{vId}
         </foreach>
     </delete>
@@ -83,4 +83,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </select>
 
+    <select id="getSchoolName" parameterType="BtpSchoolPv" resultType="String">
+        select school_name from schooldistrict_view
+        <where>
+            <if test="schoolType != null "> and school_type = #{schoolType}</if>
+            <if test="pId != null "> and p_id = #{pId}</if>
+            <if test="vId != null "> and v_id = #{vId}</if>
+        </where>
+    </select>
+
 </mapper>