liuyuqiang 2 سال پیش
والد
کامیت
9c07c38e62

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

@@ -22,7 +22,7 @@ import java.util.Arrays;
 import java.util.List;
 
 /**
- * 关系中间Controller
+ * 学区查询Controller
  *
  * @author lyq
  * @date 2023-02-20
@@ -49,9 +49,10 @@ public class BtpSchoolPvController extends BaseController {
     }
 
     /**
-     * 查询关系中间列表
+     * 查询学区列表
      */
-    @RequiresPermissions("schooldistrict:index:list")
+//    @RequiresPermissions("schooldistrict:index:list")
+    @Log(title = "学区查询", businessType = BusinessType.SELECT)
     @PostMapping("/list")
     @ResponseBody
     public TableDataInfo list(BtpSchoolPv btpSchoolPv) {
@@ -61,20 +62,20 @@ public class BtpSchoolPvController extends BaseController {
     }
 
     /**
-     * 导出关系中间列表
+     * 导出学区列表
      */
     @RequiresPermissions("schooldistrict:index:export")
-    @Log(title = "关系中间", businessType = BusinessType.EXPORT)
+    @Log(title = "学区查询", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     @ResponseBody
     public AjaxResult export(BtpSchoolPv btpSchoolPv) {
         List<BtpSchoolPv> list = btpSchoolPvService.selectBtpSchoolPvList(btpSchoolPv);
         ExcelUtil<BtpSchoolPv> util = new ExcelUtil<>(BtpSchoolPv.class);
-        return util.exportExcel(list, "关系中间数据");
+        return util.exportExcel(list, "学区数据");
     }
 
     /**
-     * 新增关系中间
+     * 新增学区
      */
     @GetMapping("/add")
     public String add(ModelMap mmap) {
@@ -85,10 +86,10 @@ public class BtpSchoolPvController extends BaseController {
     }
 
     /**
-     * 新增保存关系中间
+     * 新增保存学区
      */
     @RequiresPermissions("schooldistrict:index:add")
-    @Log(title = "关系中间", businessType = BusinessType.INSERT)
+    @Log(title = "学区查询", businessType = BusinessType.INSERT)
     @PostMapping("/add")
     @ResponseBody
     public AjaxResult addSave(BtpSchoolPv btpSchoolPv) {
@@ -96,7 +97,7 @@ public class BtpSchoolPvController extends BaseController {
     }
 
     /**
-     * 修改关系中间
+     * 修改学区
      */
     @RequiresPermissions("schooldistrict:index:edit")
     @GetMapping("/edit/{vIds}")
@@ -110,10 +111,10 @@ public class BtpSchoolPvController extends BaseController {
     }
 
     /**
-     * 修改保存关系中间
+     * 修改保存学区
      */
     @RequiresPermissions("schooldistrict:index:edit")
-    @Log(title = "关系中间", businessType = BusinessType.UPDATE)
+    @Log(title = "学区查询", businessType = BusinessType.UPDATE)
     @PostMapping("/edit")
     @ResponseBody
     public AjaxResult editSave(BtpSchoolPv btpSchoolPv) {
@@ -121,10 +122,10 @@ public class BtpSchoolPvController extends BaseController {
     }
 
     /**
-     * 删除关系中间
+     * 删除学区
      */
     @RequiresPermissions("schooldistrict:index:remove")
-    @Log(title = "关系中间", businessType = BusinessType.DELETE)
+    @Log(title = "学区查询", businessType = BusinessType.DELETE)
     @PostMapping("/remove")
     @ResponseBody
     public AjaxResult remove(String ids) {

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

@@ -8,6 +8,8 @@ import javax.servlet.http.HttpServletResponse;
 
 import com.sooka.business.schooldistrict.domain.BtpPolicestationVillage;
 import com.sooka.business.schooldistrict.service.IBtpPolicestationVillageService;
+import com.sooka.system.domain.SysNotice;
+import com.sooka.system.service.ISysNoticeService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.ModelMap;
@@ -48,6 +50,9 @@ public class SysIndexController extends BaseController
     private SysPasswordService passwordService;
 
     @Autowired
+    private ISysNoticeService noticeService;
+
+    @Autowired
     private IBtpPolicestationVillageService btpPolicestationVillageService;
 
     // 系统首页
@@ -137,8 +142,20 @@ public class SysIndexController extends BaseController
     @GetMapping("/system/main")
     public String main(ModelMap mmap)
     {
-        mmap.put("policestations", btpPolicestationVillageService.getAllByParentId(0L));
-        mmap.put("villages", Arrays.asList(new BtpPolicestationVillage()));
+        SysNotice sysNotice = noticeService.selectNoticeById(10L);
+        if (true) {
+            mmap.put("flag", true);
+            mmap.put("title", noticeService.selectNoticeById(1L));
+            mmap.put("notice", noticeService.selectNoticeById(2L));
+            mmap.put("policestations", btpPolicestationVillageService.getAllByParentId(0L));
+            mmap.put("villages", Arrays.asList(new BtpPolicestationVillage()));
+        } else {
+            mmap.put("flag", false);
+            mmap.put("announcement", noticeService.selectNoticeById(11L));
+            List<BtpPolicestationVillage> list = Arrays.asList(new BtpPolicestationVillage());
+            mmap.put("policestations", list);
+            mmap.put("villages", list);
+        }
         return "main";
     }
 

+ 18 - 11
sooka-admin/src/main/resources/templates/main.html

@@ -19,7 +19,7 @@
 			<div class="form-group">
 				<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">
+					<select id="schoolType" name="schoolType" class="form-control select2-multiple">
 						<option value="0" th:text="小学"></option>
 						<option value="1" th:text="中学"></option>
 					</select>
@@ -36,11 +36,15 @@
 			<div class="form-group">
 				<label class="col-sm-3 control-label is-required">委(村):</label>
 				<div class="col-sm-8">
-					<select id="vId" class="form-control select2-multiple" multiple>
+					<select id="vId" class="form-control select2-multiple">
 						<option th:each="village:${villages}" th:value="${village.pvId}" th:text="${village.pvName}" ></option>
 					</select>
 				</div>
 			</div>
+			<div class="form-group">
+				<label class="col-sm-3 control-label is-required">学校:</label>
+				<div id="schoolId" class="col-sm-8"></div>
+			</div>
 		</form>
 		<div class="btn-group-sm" id="toolbar" role="group">
 			<a class="btn btn-primary btn-rounded btn-sm" onclick="submitHandler()"><i class="fa fa-search"></i>&nbsp;搜索</a>
@@ -53,14 +57,17 @@
 	<script th:src="@{/ajax/libs/select2/select2.min.js?v=4.0.13}"></script>
     <script type="text/javascript">
 		function submitHandler() {
-			console.log("test")
-			// $.get("/schooldistrict/policestationvillage/getAllByParentId?parentId=" + this.value, function(result) {
-			// 	$('#vId').empty().select2({
-			// 		data: getData(result),
-			// 		placeholder: "请选择委(村)",
-			// 		allowClear: true
-			// 	});
-			// });
+			$.post("/schooldistrict/index/list", {
+				schoolType: $("#schoolType").val(),
+				pId: $("#pId").val(),
+				vId: $("#vId").val()
+			}, function(result) {
+				var name = "";
+				$.each(result.rows, function (i, item) {
+					name += item.schoolName + ",";
+				})
+				$("#schoolId").empty().append(name.substring(0, name.length-1));
+			});
 		}
 
 		function getData(array) {
@@ -89,7 +96,7 @@
 				placeholder: "请选择委(村)",
 				allowClear: true
 			});
-			$('#schoolId').select2({
+			$('#schoolType').select2({
 				placeholder: "请选择中、小学",
 				allowClear: true
 			});

+ 1 - 1
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", ids = '[[${btpSchoolPv.id}]]'.split(",");
+        var prefix = ctx + "schooldistrict/index";
         $("#form-pv-edit").validate({
             focusCleanup: true
         });

+ 10 - 0
sooka-business/src/main/java/com/sooka/business/schooldistrict/domain/BtpSchoolPv.java

@@ -41,6 +41,8 @@ public class BtpSchoolPv extends BaseEntity {
     @Excel(name = "学校")
     private String schoolName;
 
+    private String schoolType;
+
     public String getId() {
         return id;
     }
@@ -97,6 +99,14 @@ public class BtpSchoolPv extends BaseEntity {
         this.schoolName = schoolName;
     }
 
+    public String getSchoolType() {
+        return schoolType;
+    }
+
+    public void setSchoolType(String schoolType) {
+        this.schoolType = schoolType;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

+ 14 - 14
sooka-business/src/main/java/com/sooka/business/schooldistrict/mapper/BtpSchoolPvMapper.java

@@ -5,7 +5,7 @@ import com.sooka.business.schooldistrict.domain.BtpSchoolPv;
 import java.util.List;
 
 /**
- * 关系中间Mapper接口
+ * 学区查询Mapper接口
  *
  * @author lyq
  * @date 2023-02-20
@@ -13,47 +13,47 @@ import java.util.List;
 public interface BtpSchoolPvMapper {
 
     /**
-     * 查询关系中间
+     * 查询学区
      *
-     * @param pId 关系中间主键
-     * @return 关系中间
+     * @param vIds 学区主键
+     * @return 学区
      */
     public BtpSchoolPv selectBtpSchoolPvInVIds(String vIds);
 
     /**
-     * 查询关系中间列表
+     * 查询学区列表
      *
-     * @param btpSchoolPv 关系中间
-     * @return 关系中间集合
+     * @param btpSchoolPv 学区
+     * @return 学区集合
      */
     public List<BtpSchoolPv> selectBtpSchoolPvList(BtpSchoolPv btpSchoolPv);
 
     /**
-     * 新增关系中间
+     * 新增学区
      *
-     * @param btpSchoolPv 关系中间
+     * @param btpSchoolPv 学区
      * @return 结果
      */
     public int insertBtpSchoolPv(BtpSchoolPv btpSchoolPv);
 
     /**
-     * 修改关系中间
+     * 修改学区
      *
-     * @param btpSchoolPv 关系中间
+     * @param btpSchoolPv 学区
      * @return 结果
      */
     public int updateBtpSchoolPv(BtpSchoolPv btpSchoolPv);
 
     /**
-     * 删除关系中间
+     * 删除学区
      *
-     * @param pId 关系中间主键
+     * @param pId 学区主键
      * @return 结果
      */
     public int deleteBtpSchoolPvByPId(Long pId);
 
     /**
-     * 批量删除关系中间
+     * 批量删除学区
      *
      * @param pIds 需要删除的数据主键集合
      * @return 结果

+ 7 - 7
sooka-business/src/main/java/com/sooka/business/schooldistrict/service/IBtpSchoolPvService.java

@@ -15,7 +15,7 @@ public interface IBtpSchoolPvService {
     /**
      * 查询关系中间
      *
-     * @param pId 关系中间主键
+     * @param vIds 关系中间主键
      * @return 关系中间
      */
     public BtpSchoolPv selectBtpSchoolPvInVIds(String vIds);
@@ -37,25 +37,25 @@ public interface IBtpSchoolPvService {
     public int insertBtpSchoolPv(BtpSchoolPv btpSchoolPv);
 
     /**
-     * 修改关系中间
+     * 修改学区
      *
-     * @param btpSchoolPv 关系中间
+     * @param btpSchoolPv 学区
      * @return 结果
      */
     public int updateBtpSchoolPv(BtpSchoolPv btpSchoolPv);
 
     /**
-     * 批量删除关系中间
+     * 批量删除学区
      *
-     * @param pIds 需要删除的关系中间主键集合
+     * @param pIds 需要删除的学区主键集合
      * @return 结果
      */
     public int deleteBtpSchoolPvByVIds(String vIds);
 
     /**
-     * 删除关系中间信息
+     * 删除学区信息
      *
-     * @param pId 关系中间主键
+     * @param pId 学区主键
      * @return 结果
      */
     public int deleteBtpSchoolPvByPId(Long pId);

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

@@ -11,7 +11,7 @@ import org.springframework.transaction.annotation.Transactional;
 import java.util.List;
 
 /**
- * 关系中间Service业务层处理
+ * 学区查询Service业务层处理
  *
  * @author lyq
  * @date 2023-02-20
@@ -23,10 +23,10 @@ public class BtpSchoolPvServiceImpl implements IBtpSchoolPvService {
     private BtpSchoolPvMapper btpSchoolPvMapper;
 
     /**
-     * 查询关系中间
+     * 查询学区
      *
-     * @param pId 关系中间主键
-     * @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,9 +45,9 @@ public class BtpSchoolPvServiceImpl implements IBtpSchoolPvService {
     }
 
     /**
-     * 新增关系中间
+     * 新增学区
      *
-     * @param btpSchoolPv 关系中间
+     * @param btpSchoolPv 学区
      * @return 结果
      */
     @Override
@@ -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 pIds 需要删除的学区主键
      * @return 结果
      */
     @Override
@@ -85,9 +85,9 @@ public class BtpSchoolPvServiceImpl implements IBtpSchoolPvService {
     }
 
     /**
-     * 删除关系中间信息
+     * 删除学区信息
      *
-     * @param pId 关系中间主键
+     * @param pId 学区主键
      * @return 结果
      */
     @Override

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

@@ -25,6 +25,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         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>

+ 5 - 0
sooka-common/src/main/java/com/sooka/common/enums/BusinessType.java

@@ -56,4 +56,9 @@ public enum BusinessType
      * 清空
      */
     CLEAN,
+
+    /**
+     * 查询
+     */
+    SELECT,
 }

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

@@ -293,6 +293,9 @@ public class ShiroConfig
         filterChainDefinitionMap.put("/logout", "logout");
         // 不需要拦截的访问
         filterChainDefinitionMap.put("/login", "anon,captchaValidate");
+        filterChainDefinitionMap.put("/system/main", "anon,captchaValidate");
+        filterChainDefinitionMap.put("/schooldistrict/policestationvillage/getAllByParentId", "anon,captchaValidate");
+        filterChainDefinitionMap.put("/schooldistrict/index/list", "anon,captchaValidate");
         // 注册相关
         filterChainDefinitionMap.put("/register", "anon,captchaValidate");
         // 系统权限列表