From 5b9d5e7c3b714b2ccb3e9e355a376e4c85bb9f8d Mon Sep 17 00:00:00 2001
From: sgj <1442489573@qq.com>
Date: 星期六, 06 十二月 2025 17:09:07 +0800
Subject: [PATCH] 添加第一版,电子巡更页面

---
 fzzy-igdss-web/src/main/java/com/fzzy/sys/controller/patrol/PatrolController.java |  148 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 148 insertions(+), 0 deletions(-)

diff --git a/fzzy-igdss-web/src/main/java/com/fzzy/sys/controller/patrol/PatrolController.java b/fzzy-igdss-web/src/main/java/com/fzzy/sys/controller/patrol/PatrolController.java
new file mode 100644
index 0000000..2fd5edd
--- /dev/null
+++ b/fzzy-igdss-web/src/main/java/com/fzzy/sys/controller/patrol/PatrolController.java
@@ -0,0 +1,148 @@
+package com.fzzy.sys.controller.patrol;
+
+import com.fzzy.igds.domain.Patrol;
+import com.fzzy.igds.utils.ContextUtil;
+import com.fzzy.sys.manager.patrol.PatrolManager;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.ShiroUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.List;
+
+@Controller
+@RequestMapping("/patrol")
+public class PatrolController extends BaseController {
+
+    private static final String prefix = "patrol";
+
+    @Resource
+    private PatrolManager patrolManager;
+
+    /**
+     * 鐢靛瓙宸℃洿椤甸潰
+     *
+     * @author sgj
+     * @date 2025/12/06
+     */
+    @RequiresPermissions("web:patrol:view")
+    @GetMapping()
+    public String patrol() {
+        return prefix + "/patrol";
+    }
+
+    /**
+     * 鏌ヨ鐢靛瓙宸℃洿鍒楄〃
+     */
+    @RequiresPermissions("web:patrol:list")
+    @PostMapping("/list")
+    @ResponseBody
+    public TableDataInfo list(Patrol param) {
+        if (null == param.getCompanyId()) {
+            param.setCompanyId(ShiroUtils.getLoginUserCompanyId());
+        }
+        startPage();
+        List<Patrol> list = patrolManager.selectList(param);
+        return getDataTable(list);
+    }
+
+    /**
+     * 瀵煎嚭鐢靛瓙宸℃洿鍒楄〃
+     */
+    @Log(title = "鐢靛瓙宸℃洿绠$悊", businessType = BusinessType.EXPORT)
+    @RequiresPermissions("web:patrol:export")
+    @PostMapping("/export")
+    @ResponseBody
+    public AjaxResult export(Patrol param) {
+        if (null == param.getCompanyId()) {
+            param.setCompanyId(ShiroUtils.getLoginUserCompanyId());
+        }
+        List<Patrol> list = patrolManager.selectList(param);
+        ExcelUtil<Patrol> util = new ExcelUtil<>(Patrol.class);
+        return util.exportExcel(list, "鐢靛瓙宸℃洿鏁版嵁");
+    }
+
+    /**
+     * 鏂板鐢靛瓙宸℃洿椤甸潰
+     */
+    @GetMapping("/add")
+    public String add(ModelMap mmap) {
+        return prefix + "/add";
+    }
+
+    /**
+     * 鏂板鐢靛瓙宸℃洿鏁版嵁
+     */
+    @RequiresPermissions("web:patrol:add")
+    @Log(title = "鐢靛瓙宸℃洿绠$悊", businessType = BusinessType.INSERT)
+    @PostMapping("/add")
+    @ResponseBody
+    public AjaxResult addSave(@Validated Patrol param) {
+        if (null == param.getCompanyId()) {
+            param.setCompanyId(ShiroUtils.getLoginUserCompanyId());
+        }
+        param.setCreateBy(getLoginName());
+        param.setCreateTime(new Date());
+        if (StringUtils.isEmpty(param.getId())) {
+            param.setId(ContextUtil.generateId());
+        }
+        return toAjax(patrolManager.insertData(param));
+    }
+
+    /**
+     * 淇敼鐢靛瓙宸℃洿椤甸潰
+     */
+    @RequiresPermissions("web:patrol:edit")
+    @GetMapping("/edit/{id}")
+    public String edit(@PathVariable("id") String id, ModelMap mmap) {
+        String companyId = ShiroUtils.getLoginUserCompanyId();
+        Patrol record = patrolManager.selectById(id);
+        mmap.put("patrol", record);
+        return prefix + "/edit";
+    }
+
+    /**
+     * 淇敼鐢靛瓙宸℃洿鏁版嵁
+     */
+    @RequiresPermissions("web:patrol:edit")
+    @Log(title = "鐢靛瓙宸℃洿绠$悊", businessType = BusinessType.UPDATE)
+    @PostMapping("/edit")
+    @ResponseBody
+    public AjaxResult editSave(@Validated Patrol param) {
+        if (null == param.getCompanyId()) {
+            param.setCompanyId(ShiroUtils.getLoginUserCompanyId());
+        }
+        param.setUpdateBy(getLoginName());
+        param.setUpdateTime(new Date());
+        Patrol patrol = patrolManager.selectById(param.getId());
+        if (patrol == null) {
+            param.setId(ContextUtil.generateId());
+            return toAjax(patrolManager.insertData(param));
+        }
+
+        return toAjax(patrolManager.updateData(param));
+    }
+
+    /**
+     * 鍒犻櫎鐢靛瓙宸℃洿鏁版嵁
+     */
+    @RequiresPermissions("web:patrol:remove")
+    @Log(title = "鐢靛瓙宸℃洿绠$悊", businessType = BusinessType.DELETE)
+    @PostMapping("/remove")
+    @ResponseBody
+    public AjaxResult remove(String ids) {
+        patrolManager.deleteDataById(ids);
+        return success();
+    }
+}

--
Gitblit v1.9.3