|
@@ -0,0 +1,133 @@
|
|
|
+package com.sooka.web.controller.schooldistrict;
|
|
|
+
|
|
|
+import com.sooka.business.schooldistrict.domain.BtpPolicestationVillage;
|
|
|
+import com.sooka.business.schooldistrict.domain.BtpSchool;
|
|
|
+import com.sooka.business.schooldistrict.domain.BtpSchoolPv;
|
|
|
+import com.sooka.business.schooldistrict.service.IBtpPolicestationVillageService;
|
|
|
+import com.sooka.business.schooldistrict.service.IBtpSchoolPvService;
|
|
|
+import com.sooka.business.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 org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Controller;
|
|
|
+import org.springframework.ui.ModelMap;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 关系中间Controller
|
|
|
+ *
|
|
|
+ * @author lyq
|
|
|
+ * @date 2023-02-20
|
|
|
+ */
|
|
|
+@Controller
|
|
|
+@RequestMapping("/schooldistrict/index")
|
|
|
+public class BtpSchoolPvController extends BaseController {
|
|
|
+
|
|
|
+ private String prefix = "schooldistrict/index";
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IBtpSchoolPvService btpSchoolPvService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IBtpPolicestationVillageService btpPolicestationVillageService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IBtpSchoolService btpSchoolService;
|
|
|
+
|
|
|
+ @RequiresPermissions("schooldistrict:index:view")
|
|
|
+ @GetMapping()
|
|
|
+ public String index() {
|
|
|
+ return prefix + "/index";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询关系中间列表
|
|
|
+ */
|
|
|
+ @RequiresPermissions("schooldistrict:index:list")
|
|
|
+ @PostMapping("/list")
|
|
|
+ @ResponseBody
|
|
|
+ public TableDataInfo list(BtpSchoolPv btpSchoolPv) {
|
|
|
+ startPage();
|
|
|
+ List<BtpSchoolPv> list = btpSchoolPvService.selectBtpSchoolPvList(btpSchoolPv);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出关系中间列表
|
|
|
+ */
|
|
|
+ @RequiresPermissions("schooldistrict:index: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, "关系中间数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增关系中间
|
|
|
+ */
|
|
|
+ @GetMapping("/add")
|
|
|
+ public String add(ModelMap mmap) {
|
|
|
+ mmap.put("policestations", btpPolicestationVillageService.getAllByParentId(0L));
|
|
|
+ mmap.put("villages", Arrays.asList(new BtpPolicestationVillage()));
|
|
|
+ mmap.put("schools", btpSchoolService.selectBtpSchoolList(new BtpSchool()));
|
|
|
+ return prefix + "/add";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增保存关系中间
|
|
|
+ */
|
|
|
+ @RequiresPermissions("schooldistrict:index:add")
|
|
|
+ @Log(title = "关系中间", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping("/add")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult addSave(BtpSchoolPv btpSchoolPv) {
|
|
|
+ return toAjax(btpSchoolPvService.insertBtpSchoolPv(btpSchoolPv));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改关系中间
|
|
|
+ */
|
|
|
+ @RequiresPermissions("schooldistrict:index: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("schools", btpSchoolService.selectBtpSchoolList(new BtpSchool()));
|
|
|
+ return prefix + "/edit";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改保存关系中间
|
|
|
+ */
|
|
|
+ @RequiresPermissions("schooldistrict:index:edit")
|
|
|
+ @Log(title = "关系中间", businessType = BusinessType.UPDATE)
|
|
|
+ @PostMapping("/edit")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult editSave(BtpSchoolPv btpSchoolPv) {
|
|
|
+ return toAjax(btpSchoolPvService.updateBtpSchoolPv(btpSchoolPv));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除关系中间
|
|
|
+ */
|
|
|
+ @RequiresPermissions("schooldistrict:index:remove")
|
|
|
+ @Log(title = "关系中间", businessType = BusinessType.DELETE)
|
|
|
+ @PostMapping("/remove")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult remove(String ids) {
|
|
|
+ return toAjax(btpSchoolPvService.deleteBtpSchoolPvByVIds(ids));
|
|
|
+ }
|
|
|
+}
|