ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java
@@ -95,4 +95,6 @@ * @param well 井信息 */ public void checkWellAllowed(ArdAlarmpointsWell well); List<ArdAlarmpointsWell> wellByDeptList(List<Long> deptList); } ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java
@@ -2,6 +2,7 @@ import java.util.List; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell; import com.ruoyi.alarmpoints.well.mapper.ArdAlarmpointsWellMapper; import com.ruoyi.alarmpoints.well.service.IArdAlarmpointsWellService; @@ -224,4 +225,12 @@ } } } @Override public List<ArdAlarmpointsWell> wellByDeptList(List<Long> deptList) { QueryWrapper<ArdAlarmpointsWell> queryWrapper = new QueryWrapper<>(); queryWrapper.in("dept_id",deptList); return ardAlarmpointsWellMapper.selectList(queryWrapper); } } ard-work/src/main/java/com/ruoyi/app/patrolplan/controller/ArdAppPatrolplanController.java
@@ -5,12 +5,20 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell; import com.ruoyi.alarmpoints.well.service.IArdAlarmpointsWellService; import com.ruoyi.app.patrolplan.domain.ArdAppPatrolpoint; import com.ruoyi.app.patrolplan.service.IArdAppPatrolpointService; import com.ruoyi.app.patrolplan.service.IArdAppPatroluserService; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.system.service.ISysDeptService; import com.ruoyi.system.service.ISysUserService; import com.ruoyi.utils.result.Results; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -54,6 +62,15 @@ @Resource IArdAppPatroluserService ardAppPatroluserService; @Resource ISysUserService sysUserService; @Resource ISysDeptService sysDeptService; @Resource IArdAlarmpointsWellService wellService; /** * 查询app巡检计划列表 */ @@ -62,6 +79,12 @@ @ApiOperation("查询全部巡检列表及搜索筛选") public Results list(ArdAppPatrolplan ardAppPatrolplan) { if(ardAppPatrolplan.getPageNum()==null || ardAppPatrolplan.getPageNum() == 0){ ardAppPatrolplan.setPageNum(1); } if(ardAppPatrolplan.getPageSize()==null || ardAppPatrolplan.getPageSize() == 0){ ardAppPatrolplan.setPageSize(10); } PageHelper.startPage(ardAppPatrolplan.getPageNum(),ardAppPatrolplan.getPageSize()); List<ArdAppPatrolplan> list = ardAppPatrolplanService.selectArdAppPatrolplanList(ardAppPatrolplan); return Results.succeed(new PageInfo<>(list)); @@ -97,7 +120,7 @@ */ @PreAuthorize("@ss.hasPermi('app:appPatrolplan:userByPlanId')") @GetMapping(value = "userByPlanId/{id}") @ApiOperation("根据巡检ID查询巡检人") @ApiOperation("根据巡检ID查询巡检人员") public Results userByPlanId(@PathVariable String id) { return ardAppPatroluserService.userByPlanId(id); @@ -117,27 +140,24 @@ return toAjax(ardAppPatrolplanService.deleteArdApp(id)); } /** * 新增app巡检计划 */ @PreAuthorize("@ss.hasPermi('app:appPatrolplan:add')") @Log(title = "app巡检计划", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody ArdAppPatrolplan ardAppPatrolplan) @PreAuthorize("@ss.hasPermi('app:appPatrolplan:allPlanUser')") @PostMapping("allPlanUser") @ApiOperation("查询权限下全部人员和兴趣点") public Results allPlanUser() { return toAjax(ardAppPatrolplanService.insertArdAppPatrolplan(ardAppPatrolplan)); } /** * 修改app巡检计划 */ @PreAuthorize("@ss.hasPermi('app:appPatrolplan:edit')") @Log(title = "app巡检计划", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody ArdAppPatrolplan ardAppPatrolplan) { return toAjax(ardAppPatrolplanService.updateArdAppPatrolplan(ardAppPatrolplan)); JSONObject jsonObject = new JSONObject(); String userId = SecurityUtils.getUserId(); //根据userId查询部门Id SysUser sysUser = sysUserService.selectUserById(userId); //根据当前deptId或者当前及所属下级的所有deptId List<Long> deptList = sysDeptService.deptIdBySub(sysUser.getDeptId()); //根据deptId列表获取到所有用户 List<SysUser> sysUserList = sysUserService.userByDeptList(deptList); jsonObject.put("user",sysUserList); //根据deptId列表获取到所有兴趣点 List<ArdAlarmpointsWell> wellList = wellService.wellByDeptList(deptList); jsonObject.put("well",wellList); return Results.succeed(jsonObject); } /** @@ -151,4 +171,28 @@ { return toAjax(ardAppPatrolplanService.insertArdAppPatrolplan(para)); } /** * 查询单条数据 */ @PreAuthorize("@ss.hasPermi('app:appPatrolplan:oneById')") @PostMapping("/oneById/{id}") @ApiOperation("查询单条数据") public Results oneById(@PathVariable String id) { return ardAppPatrolplanService.oneById(id); } /** * 修改app巡检计划 */ @PreAuthorize("@ss.hasPermi('app:appPatrolplan:edit')") @Log(title = "app巡检计划", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody ArdAppPatrolplan ardAppPatrolplan) { return toAjax(ardAppPatrolplanService.updateArdAppPatrolplan(ardAppPatrolplan)); } } ard-work/src/main/java/com/ruoyi/app/patrolplan/mapper/ArdAppPatrolplanMapper.java
@@ -57,4 +57,6 @@ */ public int deleteArdAppPatrolplanById(String id); } ard-work/src/main/java/com/ruoyi/app/patrolplan/service/IArdAppPatrolplanService.java
@@ -57,4 +57,8 @@ * 新增app巡检计划及人员点位 */ public int insertArdAppPatrolplan(Map<String,Object> para); Results oneById(String id); Results allPlanUser(String id); } ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolplanServiceImpl.java
@@ -153,4 +153,14 @@ ardAppPatroluserMapper.insertArdAppPatroluserList(ardAppPatroluserList);//新增关联人员 return result; } @Override public Results oneById(String id) { return null; } @Override public Results allPlanUser(String id) { return null; } } ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java
@@ -3,6 +3,7 @@ import java.util.Date; import java.util.List; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.fasterxml.jackson.annotation.JsonInclude; import com.ruoyi.common.annotation.Excel; @@ -110,26 +111,31 @@ @Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT), @Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT) }) @TableField(exist = false) private SysDept dept; /** * 角色对象 */ @TableField(exist = false) private List<SysRole> roles; /** * 角色组 */ @TableField(exist = false) private Long[] roleIds; /** * 岗位组 */ @TableField(exist = false) private Long[] postIds; /** * 角色ID */ @TableField(exist = false) private Long roleId; /** @@ -154,6 +160,7 @@ /** * 关联报警类型组 */ @TableField(exist = false) private List<String> commands; public SysUser() { ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
@@ -234,4 +234,6 @@ */ public void clearUserCache(String[] userIds); List<SysUser> userByDeptList(List<Long> deptList); } ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -9,6 +9,7 @@ import javax.annotation.Resource; import javax.validation.Validator; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.ruoyi.alarm.config.domain.ArdAlarmTypeConfig; import com.ruoyi.alarm.config.mapper.ArdAlarmTypeConfigMapper; import com.ruoyi.common.constant.CacheConstants; @@ -631,4 +632,10 @@ } @Override public List<SysUser> userByDeptList(List<Long> deptList) { QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>(); queryWrapper.in("dept_id",deptList); return userMapper.selectList(queryWrapper); } } ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -293,6 +293,6 @@ </select> <select id="userByPlanId" parameterType="String" resultMap="SysUserResult"> select nick_name from sys_user where id in (select app_user_id from ard_app_patroluser where patrolplan_id = ${id}) select * from sys_user where user_id in (select app_user_id from ard_app_patroluser where patrolplan_id = #{id}) </select> </mapper>