Commit a9254848 authored by yuanshuo's avatar yuanshuo

2024/12/3修改接口

1./system/user/getInspectionNew
这个接口原先是查询所有人员但是现在要实现部门间的数据隔离,所以修改了一下,当前用户只能查询到当前部门和当前父部门下的其他子部门人员。
parent d9a4e3ba
...@@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.domain.R;
import com.ruoyi.domain.Sample;
import com.ruoyi.system.domain.vo.SysUserVO; import com.ruoyi.system.domain.vo.SysUserVO;
import com.ruoyi.system.domain.vo.SysUserVONew; import com.ruoyi.system.domain.vo.SysUserVONew;
import com.ruoyi.system.request.InspectionRequest; import com.ruoyi.system.request.InspectionRequest;
...@@ -140,7 +141,8 @@ public class SysUserController extends BaseController ...@@ -140,7 +141,8 @@ public class SysUserController extends BaseController
@ApiOperation("获取检验人员列表新") @ApiOperation("获取检验人员列表新")
@PostMapping("/getInspectionNew") @PostMapping("/getInspectionNew")
public R<List<SysUserVONew>> getInspectionNew() { public R<List<SysUserVONew>> getInspectionNew() {
return R.ok(userService.getInspectionNew()); SysUserVONew s = new SysUserVONew();
return R.ok(userService.getInspectionNew(s));
} }
@Trace @Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "param1", value = "arg[1]"), @Tag(key = "result", value = "returnedObj")}) @Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "param1", value = "arg[1]"), @Tag(key = "result", value = "returnedObj")})
......
package com.ruoyi.system.domain.vo; package com.ruoyi.system.domain.vo;
import com.ruoyi.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
...@@ -8,7 +9,7 @@ import java.util.List; ...@@ -8,7 +9,7 @@ import java.util.List;
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
public class SysUserVONew { public class SysUserVONew extends BaseEntity {
@ApiModelProperty("用户id") @ApiModelProperty("用户id")
private Long userId; private Long userId;
......
...@@ -166,5 +166,5 @@ public interface SysUserMapper ...@@ -166,5 +166,5 @@ public interface SysUserMapper
* 获取检验人员列表 * 获取检验人员列表
* @return * @return
*/ */
List<SysUserVONew> getInspectionNew(); List<SysUserVONew> getInspectionNew(SysUserVONew s);
} }
...@@ -4,7 +4,6 @@ import java.util.List; ...@@ -4,7 +4,6 @@ import java.util.List;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.system.domain.vo.SysUserVO; import com.ruoyi.system.domain.vo.SysUserVO;
import com.ruoyi.system.domain.vo.SysUserVONew; import com.ruoyi.system.domain.vo.SysUserVONew;
import com.ruoyi.system.request.InspectionRequest;
/** /**
* 用户 业务层 * 用户 业务层
...@@ -241,5 +240,5 @@ public interface ISysUserService ...@@ -241,5 +240,5 @@ public interface ISysUserService
*/ */
List<SysUserVO> getInspection(); List<SysUserVO> getInspection();
List<SysUserVONew> getInspectionNew(); List<SysUserVONew> getInspectionNew(SysUserVONew s);
} }
...@@ -10,7 +10,6 @@ import com.ruoyi.system.domain.vo.SysUserVO; ...@@ -10,7 +10,6 @@ import com.ruoyi.system.domain.vo.SysUserVO;
import com.ruoyi.system.domain.vo.SysUserVONew; import com.ruoyi.system.domain.vo.SysUserVONew;
import com.ruoyi.system.domain.vo.UserCountVo; import com.ruoyi.system.domain.vo.UserCountVo;
import com.ruoyi.system.mapper.*; import com.ruoyi.system.mapper.*;
import com.ruoyi.system.request.InspectionRequest;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -627,8 +626,9 @@ public class SysUserServiceImpl implements ISysUserService ...@@ -627,8 +626,9 @@ public class SysUserServiceImpl implements ISysUserService
* @return * @return
*/ */
@Override @Override
public List<SysUserVONew> getInspectionNew() { @DataScope(deptAlias = "d")
List<SysUserVONew> userList = userMapper.getInspectionNew(); public List<SysUserVONew> getInspectionNew(SysUserVONew s) {
List<SysUserVONew> userList = userMapper.getInspectionNew(s);
for (SysUserVONew sysUserVONew : userList){ for (SysUserVONew sysUserVONew : userList){
List<Long> roleId = userRoleMapper.selectRoleIdByUserId(sysUserVONew.getUserId()); List<Long> roleId = userRoleMapper.selectRoleIdByUserId(sysUserVONew.getUserId());
sysUserVONew.setRoleId(roleId); sysUserVONew.setRoleId(roleId);
......
...@@ -261,12 +261,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -261,12 +261,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and u.del_flag = '0' and u.del_flag = '0'
</select> </select>
<select id="getInspectionNew" resultType="com.ruoyi.system.domain.vo.SysUserVONew"> <select id="getInspectionNew" resultType="com.ruoyi.system.domain.vo.SysUserVONew">
select u.user_id,u.user_name,u.nick_name,u.status,u.del_flag, sd.dept_name select u.user_id,u.user_name,u.nick_name,u.status,u.del_flag, d.dept_name
from sys_user u from sys_user u
left join sys_user_role sr on u.user_id = sr.user_id left join sys_user_role sr on u.user_id = sr.user_id
left join sys_dept sd on sd.dept_id = u.dept_id left join sys_dept d on d.dept_id = u.dept_id
where sr.role_id IN (106, 112) where
'a'='a'
${params.dataScope}
and sr.role_id IN (106, 112)
and u.del_flag = '0' and u.del_flag = '0'
</select> </select>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment