From 8bafb39c563225acb1068a3b83462c33f4b3bab7 Mon Sep 17 00:00:00 2001
From: Administrator <1144154118@qq.com>
Date: 星期六, 05 八月 2023 16:37:26 +0800
Subject: [PATCH] 获取权限下用户和兴趣点
---
ard-work/src/main/java/com/ruoyi/app/patrolplan/mapper/ArdAppPatrolplanMapper.java | 2
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java | 7 ++
ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java | 2
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml | 2
ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolplanServiceImpl.java | 10 +++
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java | 2
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java | 7 ++
ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java | 9 +++
ard-work/src/main/java/com/ruoyi/app/patrolplan/controller/ArdAppPatrolplanController.java | 86 +++++++++++++++++++++-------
ard-work/src/main/java/com/ruoyi/app/patrolplan/service/IArdAppPatrolplanService.java | 4 +
10 files changed, 109 insertions(+), 22 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java
index 1db5728..7651383 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java
+++ b/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);
}
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java
index ea80ad6..5837b00 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java
+++ b/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);
+ }
}
diff --git a/ard-work/src/main/java/com/ruoyi/app/patrolplan/controller/ArdAppPatrolplanController.java b/ard-work/src/main/java/com/ruoyi/app/patrolplan/controller/ArdAppPatrolplanController.java
index b13e2ff..71ce6f2 100644
--- a/ard-work/src/main/java/com/ruoyi/app/patrolplan/controller/ArdAppPatrolplanController.java
+++ b/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鎴栬�呭綋鍓嶅強鎵�灞炰笅绾х殑鎵�鏈塪eptId
+ List<Long> deptList = sysDeptService.deptIdBySub(sysUser.getDeptId());
+ //鏍规嵁deptId鍒楄〃鑾峰彇鍒版墍鏈夌敤鎴�
+ List<SysUser> sysUserList = sysUserService.userByDeptList(deptList);
+ jsonObject.put("user",sysUserList);
+ //鏍规嵁deptId鍒楄〃鑾峰彇鍒版墍鏈夊叴瓒g偣
+ 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));
+ }
+
+
}
diff --git a/ard-work/src/main/java/com/ruoyi/app/patrolplan/mapper/ArdAppPatrolplanMapper.java b/ard-work/src/main/java/com/ruoyi/app/patrolplan/mapper/ArdAppPatrolplanMapper.java
index 5c5274d..14cf74b 100644
--- a/ard-work/src/main/java/com/ruoyi/app/patrolplan/mapper/ArdAppPatrolplanMapper.java
+++ b/ard-work/src/main/java/com/ruoyi/app/patrolplan/mapper/ArdAppPatrolplanMapper.java
@@ -57,4 +57,6 @@
*/
public int deleteArdAppPatrolplanById(String id);
+
+
}
diff --git a/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/IArdAppPatrolplanService.java b/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/IArdAppPatrolplanService.java
index cf72771..cfe84ed 100644
--- a/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/IArdAppPatrolplanService.java
+++ b/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);
}
diff --git a/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolplanServiceImpl.java b/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolplanServiceImpl.java
index a34c489..b0360cb 100644
--- a/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolplanServiceImpl.java
+++ b/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;
+ }
}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java
index 86d8cab..e12ef24 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java
+++ b/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() {
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
index e104d2d..156e22c 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
+++ b/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);
+
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
index efb229a..ba64906 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
+++ b/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);
+ }
}
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
index 8e1754c..a441840 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
+++ b/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>
\ No newline at end of file
--
Gitblit v1.9.3