Explorar o código

add 移动端接口

459242451@qq.com %!s(int64=3) %!d(string=hai) anos
pai
achega
8b1ecb7ebf

+ 2 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/qdtl/TlElectricDeviceLocationController.java

@@ -47,7 +47,7 @@ public class TlElectricDeviceLocationController extends BaseController {
                                           @RequestParam(required = false) String areaName,
                                           @RequestParam(required = false) String imei) {
         startDate = startDate + " 00:00:00";
-        endDate = endDate + "23:59:59";
+        endDate = endDate + " 23:59:59";
         return AjaxResult.success(tlElectricDeviceLocationService.queryLocationRecord(startDate, endDate, areaName, imei));
     }
 
@@ -72,7 +72,7 @@ public class TlElectricDeviceLocationController extends BaseController {
                                                 @RequestParam String endDate,
                                                 @RequestParam String imei) {
         startDate = startDate + " 00:00:00";
-        endDate = endDate + "23:59:59";
+        endDate = endDate + " 23:59:59";
         return AjaxResult.success(tlElectricDeviceLocationService.getSingleElectricLocation(startDate, endDate, imei));
     }
 

+ 152 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/qdtl/TlIncidentController.java

@@ -0,0 +1,152 @@
+package com.ruoyi.web.controller.qdtl;
+
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+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.poi.ExcelUtil;
+import com.ruoyi.qdtl.domain.TlIncident;
+import com.ruoyi.qdtl.service.ITlIncidentService;
+import com.ruoyi.system.service.ISysRoleService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * 巡检事件管理Controller
+ *
+ * @author ruoyi
+ * @date 2022-08-09
+ */
+@RestController
+@RequestMapping("/qdtl/incident")
+public class TlIncidentController extends BaseController {
+    @Autowired
+    private ITlIncidentService tlIncidentService;
+    @Autowired
+    private ISysRoleService sysRoleService;
+
+    /**
+     * 查询巡检事件管理列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(TlIncident tlIncident) {
+        startPage();
+        // 根据当前用户角色,如果是巡检员的话,则只查询自己的
+        // 如果是巡检员管理员的话,查询接收人是自己的
+        Set<String> roleSet = sysRoleService.selectRolePermissionByUserId(getUserId());
+        if (roleSet.contains("xun")) {
+            tlIncident.setCreateBy(getUsername());
+        } else if (roleSet.contains("xun_manage")) {
+            tlIncident.setAcceptUser(getUsername());
+        }
+        List<TlIncident> list = tlIncidentService.selectTlIncidentList(tlIncident);
+        return getDataTable(list);
+    }
+
+    @GetMapping("/count")
+    public AjaxResult count() {
+        TlIncident tlIncident = new TlIncident();
+        // 根据当前用户角色,如果是巡检员的话,则只查询自己的
+        // 如果是巡检员管理员的话,查询接收人是自己的
+        Set<String> roleSet = sysRoleService.selectRolePermissionByUserId(getUserId());
+        if (roleSet.contains("xun")) {
+            tlIncident.setCreateBy(getUsername());
+        } else if (roleSet.contains("xun_manage")) {
+            tlIncident.setAcceptUser(getUsername());
+        }
+        Map<String, Object> result = new HashMap<>();
+        List<TlIncident> list = tlIncidentService.selectTlIncidentList(tlIncident);
+        long unDeal = list.stream().filter(a -> StrUtil.equals(a.getStatus(), "1")).count();
+        long deal = list.stream().filter(a -> StrUtil.equals(a.getStatus(), "2")).count();
+        result.put("unDeal", unDeal);
+        result.put("deal", deal);
+        return AjaxResult.success(result);
+    }
+
+    /**
+     * 导出巡检事件管理列表
+     */
+    @PreAuthorize("@ss.hasPermi('qdtl:incident:export')")
+    @Log(title = "巡检事件管理", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, TlIncident tlIncident) {
+        List<TlIncident> list = tlIncidentService.selectTlIncidentList(tlIncident);
+        ExcelUtil<TlIncident> util = new ExcelUtil<TlIncident>(TlIncident.class);
+        util.exportExcel(response, list, "巡检事件管理数据");
+    }
+
+    /**
+     * 获取巡检事件管理详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('qdtl:incident:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
+        return AjaxResult.success(tlIncidentService.selectTlIncidentById(id));
+    }
+
+    /**
+     * 新增巡检事件管理
+     */
+    @Log(title = "巡检事件管理", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody TlIncident tlIncident) {
+        tlIncident.setCreateBy(getUsername());
+        tlIncident.setCreateByName(getLoginUser().getUser().getNickName());
+        tlIncident.setStatus("1");
+        return toAjax(tlIncidentService.insertTlIncident(tlIncident));
+    }
+
+    /**
+     * 修改巡检事件管理
+     */
+    @Log(title = "巡检事件管理", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody TlIncident tlIncident) {
+        return toAjax(tlIncidentService.updateTlIncident(tlIncident));
+    }
+
+    @Log(title = "巡检事件管理-处理", businessType = BusinessType.UPDATE)
+    @PutMapping("/deal")
+    public AjaxResult deal(@RequestBody TlIncident tlIncident) {
+        if (ObjectUtil.isNull(tlIncident.getId()) || StrUtil.isBlank(tlIncident.getStatus())) {
+            return AjaxResult.error("缺少必要残损!");
+        }
+        TlIncident save = new TlIncident();
+        save.setId(tlIncident.getId());
+        save.setStatus(tlIncident.getStatus());
+        save.setDealUser(getUsername());
+        save.setDealUserName(getLoginUser().getUser().getNickName());
+        save.setDealTime(new Date());
+        return toAjax(tlIncidentService.updateTlIncident(save));
+    }
+
+    /**
+     * 删除巡检事件管理
+     */
+    @PreAuthorize("@ss.hasPermi('qdtl:incident:remove')")
+    @Log(title = "巡检事件管理", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
+        return toAjax(tlIncidentService.deleteTlIncidentByIds(ids));
+    }
+
+
+}

+ 40 - 62
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java

@@ -1,18 +1,5 @@
 package com.ruoyi.web.controller.system;
 
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.constant.UserConstants;
 import com.ruoyi.common.core.controller.BaseController;
@@ -29,32 +16,44 @@ import com.ruoyi.framework.web.service.TokenService;
 import com.ruoyi.system.domain.SysUserRole;
 import com.ruoyi.system.service.ISysRoleService;
 import com.ruoyi.system.service.ISysUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 /**
  * 角色信息
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/system/role")
-public class SysRoleController extends BaseController
-{
+public class SysRoleController extends BaseController {
     @Autowired
     private ISysRoleService roleService;
 
     @Autowired
     private TokenService tokenService;
-    
+
     @Autowired
     private SysPermissionService permissionService;
-    
+
     @Autowired
     private ISysUserService userService;
 
     @PreAuthorize("@ss.hasPermi('system:role:list')")
     @GetMapping("/list")
-    public TableDataInfo list(SysRole role)
-    {
+    public TableDataInfo list(SysRole role) {
         startPage();
         List<SysRole> list = roleService.selectRoleList(role);
         return getDataTable(list);
@@ -63,8 +62,7 @@ public class SysRoleController extends BaseController
     @Log(title = "角色管理", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('system:role:export')")
     @PostMapping("/export")
-    public void export(HttpServletResponse response, SysRole role)
-    {
+    public void export(HttpServletResponse response, SysRole role) {
         List<SysRole> list = roleService.selectRoleList(role);
         ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
         util.exportExcel(response, list, "角色数据");
@@ -75,8 +73,7 @@ public class SysRoleController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:role:query')")
     @GetMapping(value = "/{roleId}")
-    public AjaxResult getInfo(@PathVariable Long roleId)
-    {
+    public AjaxResult getInfo(@PathVariable Long roleId) {
         roleService.checkRoleDataScope(roleId);
         return AjaxResult.success(roleService.selectRoleById(roleId));
     }
@@ -87,14 +84,10 @@ public class SysRoleController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:role:add')")
     @Log(title = "角色管理", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@Validated @RequestBody SysRole role)
-    {
-        if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
-        {
+    public AjaxResult add(@Validated @RequestBody SysRole role) {
+        if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) {
             return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
-        }
-        else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
-        {
+        } else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) {
             return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
         }
         role.setCreateBy(getUsername());
@@ -108,26 +101,20 @@ public class SysRoleController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:role:edit')")
     @Log(title = "角色管理", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@Validated @RequestBody SysRole role)
-    {
+    public AjaxResult edit(@Validated @RequestBody SysRole role) {
         roleService.checkRoleAllowed(role);
         roleService.checkRoleDataScope(role.getRoleId());
-        if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
-        {
+        if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) {
             return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
-        }
-        else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
-        {
+        } else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) {
             return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
         }
         role.setUpdateBy(getUsername());
-        
-        if (roleService.updateRole(role) > 0)
-        {
+
+        if (roleService.updateRole(role) > 0) {
             // 更新缓存用户权限
             LoginUser loginUser = getLoginUser();
-            if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
-            {
+            if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin()) {
                 loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
                 loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
                 tokenService.setLoginUser(loginUser);
@@ -143,8 +130,7 @@ public class SysRoleController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:role:edit')")
     @Log(title = "角色管理", businessType = BusinessType.UPDATE)
     @PutMapping("/dataScope")
-    public AjaxResult dataScope(@RequestBody SysRole role)
-    {
+    public AjaxResult dataScope(@RequestBody SysRole role) {
         roleService.checkRoleAllowed(role);
         roleService.checkRoleDataScope(role.getRoleId());
         return toAjax(roleService.authDataScope(role));
@@ -156,8 +142,7 @@ public class SysRoleController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:role:edit')")
     @Log(title = "角色管理", businessType = BusinessType.UPDATE)
     @PutMapping("/changeStatus")
-    public AjaxResult changeStatus(@RequestBody SysRole role)
-    {
+    public AjaxResult changeStatus(@RequestBody SysRole role) {
         roleService.checkRoleAllowed(role);
         roleService.checkRoleDataScope(role.getRoleId());
         role.setUpdateBy(getUsername());
@@ -170,8 +155,7 @@ public class SysRoleController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:role:remove')")
     @Log(title = "角色管理", businessType = BusinessType.DELETE)
     @DeleteMapping("/{roleIds}")
-    public AjaxResult remove(@PathVariable Long[] roleIds)
-    {
+    public AjaxResult remove(@PathVariable Long[] roleIds) {
         return toAjax(roleService.deleteRoleByIds(roleIds));
     }
 
@@ -180,18 +164,16 @@ public class SysRoleController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:role:query')")
     @GetMapping("/optionselect")
-    public AjaxResult optionselect()
-    {
+    public AjaxResult optionselect() {
         return AjaxResult.success(roleService.selectRoleAll());
     }
 
     /**
      * 查询已分配用户角色列表
      */
-    @PreAuthorize("@ss.hasPermi('system:role:list')")
+//    @PreAuthorize("@ss.hasPermi('system:role:list')")
     @GetMapping("/authUser/allocatedList")
-    public TableDataInfo allocatedList(SysUser user)
-    {
+    public TableDataInfo allocatedList(SysUser user) {
         startPage();
         List<SysUser> list = userService.selectAllocatedList(user);
         return getDataTable(list);
@@ -202,8 +184,7 @@ public class SysRoleController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:role:list')")
     @GetMapping("/authUser/unallocatedList")
-    public TableDataInfo unallocatedList(SysUser user)
-    {
+    public TableDataInfo unallocatedList(SysUser user) {
         startPage();
         List<SysUser> list = userService.selectUnallocatedList(user);
         return getDataTable(list);
@@ -215,8 +196,7 @@ public class SysRoleController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:role:edit')")
     @Log(title = "角色管理", businessType = BusinessType.GRANT)
     @PutMapping("/authUser/cancel")
-    public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole)
-    {
+    public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) {
         return toAjax(roleService.deleteAuthUser(userRole));
     }
 
@@ -226,8 +206,7 @@ public class SysRoleController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:role:edit')")
     @Log(title = "角色管理", businessType = BusinessType.GRANT)
     @PutMapping("/authUser/cancelAll")
-    public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
-    {
+    public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds) {
         return toAjax(roleService.deleteAuthUsers(roleId, userIds));
     }
 
@@ -237,8 +216,7 @@ public class SysRoleController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:role:edit')")
     @Log(title = "角色管理", businessType = BusinessType.GRANT)
     @PutMapping("/authUser/selectAll")
-    public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
-    {
+    public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) {
         roleService.checkRoleDataScope(roleId);
         return toAjax(roleService.insertAuthUsers(roleId, userIds));
     }

+ 252 - 0
ruoyi-system/src/main/java/com/ruoyi/qdtl/domain/TlIncident.java

@@ -0,0 +1,252 @@
+package com.ruoyi.qdtl.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import java.util.Date;
+
+/**
+ * 巡检事件管理对象 tl_incident
+ *
+ * @author ruoyi
+ * @date 2022-08-09
+ */
+public class TlIncident extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    private Long id;
+
+    /**
+     * 事件名称
+     */
+    @Excel(name = "事件名称")
+    private String name;
+
+    /**
+     * 事件描述
+     */
+    @Excel(name = "事件描述")
+    private String detail;
+
+    /**
+     * 事件等级
+     */
+    @Excel(name = "事件等级")
+    private String incLevel;
+
+    /**
+     * 发生日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "发生日期", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date happenTime;
+
+    /**
+     * 图片
+     */
+    @Excel(name = "图片")
+    private String pics;
+
+    /**
+     * 区域
+     */
+    @Excel(name = "区域")
+    private String area;
+
+    /**
+     * 我的位置
+     */
+    @Excel(name = "我的位置")
+    private String address;
+
+    /**
+     * 接收人
+     */
+    @Excel(name = "接收人")
+    private String acceptUser;
+
+    /**
+     * 接收人姓名
+     */
+    @Excel(name = "接收人姓名")
+    private String acceptUserName;
+
+    /**
+     * 上报人姓名
+     */
+    @Excel(name = "上报人姓名")
+    private String createByName;
+
+    /**
+     * 当前状态
+     */
+    @Excel(name = "当前状态")
+    private String status;
+
+    /**
+     * 处理人
+     */
+    @Excel(name = "处理人")
+    private String dealUser;
+
+    /**
+     * 处理人姓名
+     */
+    @Excel(name = "处理人姓名")
+    private String dealUserName;
+
+    /**
+     * 处理时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "处理时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date dealTime;
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setDetail(String detail) {
+        this.detail = detail;
+    }
+
+    public String getDetail() {
+        return detail;
+    }
+
+    public void setIncLevel(String incLevel) {
+        this.incLevel = incLevel;
+    }
+
+    public String getIncLevel() {
+        return incLevel;
+    }
+
+    public void setHappenTime(Date happenTime) {
+        this.happenTime = happenTime;
+    }
+
+    public Date getHappenTime() {
+        return happenTime;
+    }
+
+    public void setPics(String pics) {
+        this.pics = pics;
+    }
+
+    public String getPics() {
+        return pics;
+    }
+
+    public void setArea(String area) {
+        this.area = area;
+    }
+
+    public String getArea() {
+        return area;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAcceptUser(String acceptUser) {
+        this.acceptUser = acceptUser;
+    }
+
+    public String getAcceptUser() {
+        return acceptUser;
+    }
+
+    public void setAcceptUserName(String acceptUserName) {
+        this.acceptUserName = acceptUserName;
+    }
+
+    public String getAcceptUserName() {
+        return acceptUserName;
+    }
+
+    public void setCreateByName(String createByName) {
+        this.createByName = createByName;
+    }
+
+    public String getCreateByName() {
+        return createByName;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setDealUser(String dealUser) {
+        this.dealUser = dealUser;
+    }
+
+    public String getDealUser() {
+        return dealUser;
+    }
+
+    public void setDealUserName(String dealUserName) {
+        this.dealUserName = dealUserName;
+    }
+
+    public String getDealUserName() {
+        return dealUserName;
+    }
+
+    public void setDealTime(Date dealTime) {
+        this.dealTime = dealTime;
+    }
+
+    public Date getDealTime() {
+        return dealTime;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("id", getId())
+                .append("name", getName())
+                .append("detail", getDetail())
+                .append("incLevel", getIncLevel())
+                .append("happenTime", getHappenTime())
+                .append("pics", getPics())
+                .append("area", getArea())
+                .append("address", getAddress())
+                .append("acceptUser", getAcceptUser())
+                .append("acceptUserName", getAcceptUserName())
+                .append("createBy", getCreateBy())
+                .append("createByName", getCreateByName())
+                .append("status", getStatus())
+                .append("dealUser", getDealUser())
+                .append("dealUserName", getDealUserName())
+                .append("dealTime", getDealTime())
+                .toString();
+    }
+}

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/qdtl/mapper/TlIncidentMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.qdtl.mapper;
+
+import java.util.List;
+import com.ruoyi.qdtl.domain.TlIncident;
+
+/**
+ * 巡检事件管理Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2022-08-09
+ */
+public interface TlIncidentMapper 
+{
+    /**
+     * 查询巡检事件管理
+     * 
+     * @param id 巡检事件管理主键
+     * @return 巡检事件管理
+     */
+    public TlIncident selectTlIncidentById(Long id);
+
+    /**
+     * 查询巡检事件管理列表
+     * 
+     * @param tlIncident 巡检事件管理
+     * @return 巡检事件管理集合
+     */
+    public List<TlIncident> selectTlIncidentList(TlIncident tlIncident);
+
+    /**
+     * 新增巡检事件管理
+     * 
+     * @param tlIncident 巡检事件管理
+     * @return 结果
+     */
+    public int insertTlIncident(TlIncident tlIncident);
+
+    /**
+     * 修改巡检事件管理
+     * 
+     * @param tlIncident 巡检事件管理
+     * @return 结果
+     */
+    public int updateTlIncident(TlIncident tlIncident);
+
+    /**
+     * 删除巡检事件管理
+     * 
+     * @param id 巡检事件管理主键
+     * @return 结果
+     */
+    public int deleteTlIncidentById(Long id);
+
+    /**
+     * 批量删除巡检事件管理
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteTlIncidentByIds(Long[] ids);
+}

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/qdtl/service/ITlIncidentService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.qdtl.service;
+
+import java.util.List;
+import com.ruoyi.qdtl.domain.TlIncident;
+
+/**
+ * 巡检事件管理Service接口
+ * 
+ * @author ruoyi
+ * @date 2022-08-09
+ */
+public interface ITlIncidentService 
+{
+    /**
+     * 查询巡检事件管理
+     * 
+     * @param id 巡检事件管理主键
+     * @return 巡检事件管理
+     */
+    public TlIncident selectTlIncidentById(Long id);
+
+    /**
+     * 查询巡检事件管理列表
+     * 
+     * @param tlIncident 巡检事件管理
+     * @return 巡检事件管理集合
+     */
+    public List<TlIncident> selectTlIncidentList(TlIncident tlIncident);
+
+    /**
+     * 新增巡检事件管理
+     * 
+     * @param tlIncident 巡检事件管理
+     * @return 结果
+     */
+    public int insertTlIncident(TlIncident tlIncident);
+
+    /**
+     * 修改巡检事件管理
+     * 
+     * @param tlIncident 巡检事件管理
+     * @return 结果
+     */
+    public int updateTlIncident(TlIncident tlIncident);
+
+    /**
+     * 批量删除巡检事件管理
+     * 
+     * @param ids 需要删除的巡检事件管理主键集合
+     * @return 结果
+     */
+    public int deleteTlIncidentByIds(Long[] ids);
+
+    /**
+     * 删除巡检事件管理信息
+     * 
+     * @param id 巡检事件管理主键
+     * @return 结果
+     */
+    public int deleteTlIncidentById(Long id);
+}

+ 93 - 0
ruoyi-system/src/main/java/com/ruoyi/qdtl/service/impl/TlIncidentServiceImpl.java

@@ -0,0 +1,93 @@
+package com.ruoyi.qdtl.service.impl;
+
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.qdtl.mapper.TlIncidentMapper;
+import com.ruoyi.qdtl.domain.TlIncident;
+import com.ruoyi.qdtl.service.ITlIncidentService;
+
+/**
+ * 巡检事件管理Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2022-08-09
+ */
+@Service
+public class TlIncidentServiceImpl implements ITlIncidentService 
+{
+    @Autowired
+    private TlIncidentMapper tlIncidentMapper;
+
+    /**
+     * 查询巡检事件管理
+     * 
+     * @param id 巡检事件管理主键
+     * @return 巡检事件管理
+     */
+    @Override
+    public TlIncident selectTlIncidentById(Long id)
+    {
+        return tlIncidentMapper.selectTlIncidentById(id);
+    }
+
+    /**
+     * 查询巡检事件管理列表
+     * 
+     * @param tlIncident 巡检事件管理
+     * @return 巡检事件管理
+     */
+    @Override
+    public List<TlIncident> selectTlIncidentList(TlIncident tlIncident)
+    {
+        return tlIncidentMapper.selectTlIncidentList(tlIncident);
+    }
+
+    /**
+     * 新增巡检事件管理
+     * 
+     * @param tlIncident 巡检事件管理
+     * @return 结果
+     */
+    @Override
+    public int insertTlIncident(TlIncident tlIncident)
+    {
+        return tlIncidentMapper.insertTlIncident(tlIncident);
+    }
+
+    /**
+     * 修改巡检事件管理
+     * 
+     * @param tlIncident 巡检事件管理
+     * @return 结果
+     */
+    @Override
+    public int updateTlIncident(TlIncident tlIncident)
+    {
+        return tlIncidentMapper.updateTlIncident(tlIncident);
+    }
+
+    /**
+     * 批量删除巡检事件管理
+     * 
+     * @param ids 需要删除的巡检事件管理主键
+     * @return 结果
+     */
+    @Override
+    public int deleteTlIncidentByIds(Long[] ids)
+    {
+        return tlIncidentMapper.deleteTlIncidentByIds(ids);
+    }
+
+    /**
+     * 删除巡检事件管理信息
+     * 
+     * @param id 巡检事件管理主键
+     * @return 结果
+     */
+    @Override
+    public int deleteTlIncidentById(Long id)
+    {
+        return tlIncidentMapper.deleteTlIncidentById(id);
+    }
+}

+ 144 - 0
ruoyi-system/src/main/resources/mapper/qdtl/TlIncidentMapper.xml

@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.qdtl.mapper.TlIncidentMapper">
+
+    <resultMap type="TlIncident" id="TlIncidentResult">
+        <result property="id" column="id"/>
+        <result property="name" column="name"/>
+        <result property="detail" column="detail"/>
+        <result property="incLevel" column="inc_level"/>
+        <result property="happenTime" column="happen_time"/>
+        <result property="pics" column="pics"/>
+        <result property="area" column="area"/>
+        <result property="address" column="address"/>
+        <result property="acceptUser" column="accept_user"/>
+        <result property="acceptUserName" column="accept_user_name"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createByName" column="create_by_name"/>
+        <result property="status" column="status"/>
+        <result property="dealUser" column="deal_user"/>
+        <result property="dealUserName" column="deal_user_name"/>
+        <result property="dealTime" column="deal_time"/>
+    </resultMap>
+
+    <sql id="selectTlIncidentVo">
+        select id,
+               name,
+               detail,
+               inc_level,
+               happen_time,
+               pics,
+               area,
+               address,
+               accept_user,
+               accept_user_name,
+               create_by,
+               create_by_name,
+               status,
+               deal_user,
+               deal_user_name,
+               deal_time
+        from tl_incident
+    </sql>
+
+    <select id="selectTlIncidentList" parameterType="TlIncident" resultMap="TlIncidentResult">
+        <include refid="selectTlIncidentVo"/>
+        <where>
+            <if test="name != null  and name != ''">and name like concat('%', #{name}, '%')</if>
+            <if test="detail != null  and detail != ''">and detail = #{detail}</if>
+            <if test="incLevel != null  and incLevel != ''">and inc_level = #{incLevel}</if>
+            <if test="happenTime != null ">and happen_time = #{happenTime}</if>
+            <if test="pics != null  and pics != ''">and pics = #{pics}</if>
+            <if test="area != null  and area != ''">and area = #{area}</if>
+            <if test="address != null  and address != ''">and address = #{address}</if>
+            <if test="acceptUser != null  and acceptUser != ''">and accept_user = #{acceptUser}</if>
+            <if test="acceptUserName != null  and acceptUserName != ''">and accept_user_name like concat('%', #{acceptUserName}, '%')</if>
+            <if test="createByName != null  and createByName != ''">and create_by_name like concat('%', #{createByName}, '%')</if>
+            <if test="createBy != null  and createBy != ''">and create_by = #{createByName}</if>
+            <if test="status != null  and status != ''">and status = #{status}</if>
+            <if test="dealUser != null  and dealUser != ''">and deal_user = #{dealUser}</if>
+            <if test="dealUserName != null  and dealUserName != ''">and deal_user_name like concat('%', #{dealUserName}, '%')</if>
+            <if test="dealTime != null ">and deal_time = #{dealTime}</if>
+        </where>
+    </select>
+
+    <select id="selectTlIncidentById" parameterType="Long" resultMap="TlIncidentResult">
+        <include refid="selectTlIncidentVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertTlIncident" parameterType="TlIncident" useGeneratedKeys="true" keyProperty="id">
+        insert into tl_incident
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="name != null">name,</if>
+            <if test="detail != null">detail,</if>
+            <if test="incLevel != null">inc_level,</if>
+            <if test="happenTime != null">happen_time,</if>
+            <if test="pics != null">pics,</if>
+            <if test="area != null">area,</if>
+            <if test="address != null">address,</if>
+            <if test="acceptUser != null">accept_user,</if>
+            <if test="acceptUserName != null">accept_user_name,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createByName != null">create_by_name,</if>
+            <if test="status != null">status,</if>
+            <if test="dealUser != null">deal_user,</if>
+            <if test="dealUserName != null">deal_user_name,</if>
+            <if test="dealTime != null">deal_time,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="name != null">#{name},</if>
+            <if test="detail != null">#{detail},</if>
+            <if test="incLevel != null">#{incLevel},</if>
+            <if test="happenTime != null">#{happenTime},</if>
+            <if test="pics != null">#{pics},</if>
+            <if test="area != null">#{area},</if>
+            <if test="address != null">#{address},</if>
+            <if test="acceptUser != null">#{acceptUser},</if>
+            <if test="acceptUserName != null">#{acceptUserName},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createByName != null">#{createByName},</if>
+            <if test="status != null">#{status},</if>
+            <if test="dealUser != null">#{dealUser},</if>
+            <if test="dealUserName != null">#{dealUserName},</if>
+            <if test="dealTime != null">#{dealTime},</if>
+        </trim>
+    </insert>
+
+    <update id="updateTlIncident" parameterType="TlIncident">
+        update tl_incident
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="name != null">name = #{name},</if>
+            <if test="detail != null">detail = #{detail},</if>
+            <if test="incLevel != null">inc_level = #{incLevel},</if>
+            <if test="happenTime != null">happen_time = #{happenTime},</if>
+            <if test="pics != null">pics = #{pics},</if>
+            <if test="area != null">area = #{area},</if>
+            <if test="address != null">address = #{address},</if>
+            <if test="acceptUser != null">accept_user = #{acceptUser},</if>
+            <if test="acceptUserName != null">accept_user_name = #{acceptUserName},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createByName != null">create_by_name = #{createByName},</if>
+            <if test="status != null">status = #{status},</if>
+            <if test="dealUser != null">deal_user = #{dealUser},</if>
+            <if test="dealUserName != null">deal_user_name = #{dealUserName},</if>
+            <if test="dealTime != null">deal_time = #{dealTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteTlIncidentById" parameterType="Long">
+        delete
+        from tl_incident
+        where id = #{id}
+    </delete>
+
+    <delete id="deleteTlIncidentByIds" parameterType="String">
+        delete from tl_incident where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>