소스 검색

学区配置,学校下拉添加中、小学分组

liuyuqiang 2 년 전
부모
커밋
5e35240156

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

@@ -89,7 +89,8 @@ public class BtpSchoolPvController extends BaseController {
     public String add(ModelMap mmap) {
         mmap.put("policestations", btpPolicestationVillageService.getPolicestationVillagesByParentId(0L));
         mmap.put("villages", Arrays.asList(new BtpPolicestationVillage()));
-        mmap.put("schools", btpSchoolService.selectBtpSchoolList(new BtpSchool()));
+        mmap.put("schools", btpSchoolService.selectBtpSchoolList(new BtpSchool("1")));
+        mmap.put("schoolm", btpSchoolService.selectBtpSchoolList(new BtpSchool("2")));
         return prefix + "/add";
     }
 
@@ -116,7 +117,8 @@ public class BtpSchoolPvController extends BaseController {
         mmap.put("btpSchoolPv", btpSchoolPv);
         mmap.put("policestations", btpPolicestationVillageService.getPolicestationVillagesByParentId(0L));
         mmap.put("villages", btpPolicestationVillageService.getPolicestationVillagesByParentId(btpSchoolPv.getpId()));
-        mmap.put("schools", btpSchoolService.selectBtpSchoolList(new BtpSchool()));
+        mmap.put("schools", btpSchoolService.selectBtpSchoolList(new BtpSchool("1")));
+        mmap.put("schoolm", btpSchoolService.selectBtpSchoolList(new BtpSchool("2")));
         return prefix + "/edit";
     }
 

+ 8 - 1
sooka-admin/src/main/resources/templates/schooldistrict/config/add.html

@@ -11,7 +11,14 @@
                 <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>
+                        <optgroup label="请选择小学">
+                            <option th:each="school:${schools}"
+                                    th:value="${school.schoolId}" th:text="${school.schoolName}"></option>
+                        </optgroup>
+                        <optgroup label="请选择中学">
+                            <option th:each="school:${schoolm}"
+                                    th:value="${school.schoolId}" th:text="${school.schoolName}"></option>
+                        </optgroup>
                     </select>
                 </div>
             </div>

+ 8 - 1
sooka-admin/src/main/resources/templates/schooldistrict/config/edit.html

@@ -11,7 +11,14 @@
                 <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>
+                        <optgroup label="请选择小学">
+                            <option th:each="school:${schools}"
+                                    th:value="${school.schoolId}" th:text="${school.schoolName}"></option>
+                        </optgroup>
+                        <optgroup label="请选择中学">
+                            <option th:each="school:${schoolm}"
+                                    th:value="${school.schoolId}" th:text="${school.schoolName}"></option>
+                        </optgroup>
                     </select>
                 </div>
             </div>

+ 8 - 0
sooka-schooldistrict/src/main/java/com/sooka/schooldistrict/domain/BtpSchool.java

@@ -13,6 +13,14 @@ import org.apache.commons.lang3.builder.ToStringStyle;
  */
 public class BtpSchool extends BaseEntity {
 
+    public BtpSchool() {
+
+    }
+
+    public BtpSchool(String schoolType) {
+        this.schoolType = schoolType;
+    }
+
     private static final long serialVersionUID = 1L;
 
     /**