Commit 629cdb79 authored by wdy's avatar wdy

Merge branch 'dev' into 'master'

dev - master 37

See merge request !398
parents 8c4389af 2e064def
...@@ -6,6 +6,8 @@ import javax.servlet.http.HttpServletResponse; ...@@ -6,6 +6,8 @@ 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.system.domain.vo.SysUserVO;
import com.ruoyi.system.request.InspectionRequest;
import com.ruoyi.system.service.*; import com.ruoyi.system.service.*;
import com.ruoyi.web.request.UserByRoleRequest; import com.ruoyi.web.request.UserByRoleRequest;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -94,6 +96,26 @@ public class SysUserController extends BaseController ...@@ -94,6 +96,26 @@ public class SysUserController extends BaseController
} }
} }
/**
* 获取主检验人员列表
* @return
*/
@ApiOperation("获取主检验人员列表")
@PostMapping("/getPrimaryInspection")
public R<List<SysUserVO>> getPrimaryInspection() {
return R.ok(userService.getPrimaryInspection());
}
/**
* 获取检验人员列表
* @return
*/
@ApiOperation("获取检验人员列表")
@PostMapping("/getInspection")
public R<List<SysUserVO>> getInspection() {
return R.ok(userService.getInspection());
}
@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")})
@Log(title = "用户管理", businessType = BusinessType.EXPORT) @Log(title = "用户管理", businessType = BusinessType.EXPORT)
......
package com.ruoyi.system.domain.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
public class SysUserVO {
@ApiModelProperty("用户id")
private Long userId;
@ApiModelProperty("用户账号")
private String userName;
@ApiModelProperty("用户昵称")
private String nickname;
@ApiModelProperty("部门名称")
private String deptName;
@ApiModelProperty("角色id")
private Long roleId;
@ApiModelProperty("帐号状态(0正常 1停用)")
private String status;
@ApiModelProperty("删除标志(0代表存在 2代表删除)")
private String delFlag;
}
package com.ruoyi.system.mapper; package com.ruoyi.system.mapper;
import java.util.List; import java.util.List;
import com.ruoyi.system.domain.vo.SysUserVO;
import com.ruoyi.system.domain.vo.UserCountVo; import com.ruoyi.system.domain.vo.UserCountVo;
import com.ruoyi.system.request.InspectionRequest;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
...@@ -146,4 +149,16 @@ public interface SysUserMapper ...@@ -146,4 +149,16 @@ public interface SysUserMapper
* @return * @return
*/ */
List<UserCountVo> countTaskByUserId(@Param("userIds") Long[] userIds); List<UserCountVo> countTaskByUserId(@Param("userIds") Long[] userIds);
/**
* 获取主检验人员列表
* @return
*/
List<SysUserVO> getPrimaryInspection();
/**
* 获取检验人员列表
* @return
*/
List<SysUserVO> getInspection();
} }
package com.ruoyi.system.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel
public class InspectionRequest {
@ApiModelProperty("类型")
private String flag;
}
...@@ -2,6 +2,8 @@ package com.ruoyi.system.service; ...@@ -2,6 +2,8 @@ package com.ruoyi.system.service;
import java.util.List; 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.request.InspectionRequest;
/** /**
* 用户 业务层 * 用户 业务层
...@@ -225,4 +227,16 @@ public interface ISysUserService ...@@ -225,4 +227,16 @@ public interface ISysUserService
* @return * @return
*/ */
List<SysUser> selectUserByRoleInDept(Long roleId); List<SysUser> selectUserByRoleInDept(Long roleId);
/**
* 获取主检验人员列表
* @return
*/
List<SysUserVO> getPrimaryInspection();
/**
* 获取检验人员列表
* @return
*/
List<SysUserVO> getInspection();
} }
...@@ -6,8 +6,10 @@ import java.util.stream.Collectors; ...@@ -6,8 +6,10 @@ import java.util.stream.Collectors;
import javax.validation.Validator; import javax.validation.Validator;
import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.system.domain.vo.SysUserVO;
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;
...@@ -591,6 +593,40 @@ public class SysUserServiceImpl implements ISysUserService ...@@ -591,6 +593,40 @@ public class SysUserServiceImpl implements ISysUserService
return list; return list;
} }
/**
* 获取主检验人员列表
* @return
*/
@Override
public List<SysUserVO> getPrimaryInspection() {
List<SysUserVO> userList = userMapper.getPrimaryInspection();
// 使用Stream API进行去重,基于userId字段
List<SysUserVO> deduplicatedList = userList.stream()
.filter(distinctByKey(user -> user.getUserId()))
.collect(Collectors.toList());
return deduplicatedList;
}
/**
* 获取检验人员列表
* @return
*/
@Override
public List<SysUserVO> getInspection() {
List<SysUserVO> userList = userMapper.getInspection();
// 使用Stream API进行去重,基于userId字段
List<SysUserVO> deduplicatedList = userList.stream()
.filter(distinctByKey(user -> user.getUserId()))
.collect(Collectors.toList());
return deduplicatedList;
}
// 辅助方法,用于去重
private static <T> java.util.function.Predicate<T> distinctByKey(java.util.function.Function<? super T, ?> keyExtractor) {
java.util.Map<Object, Boolean> seen = new java.util.concurrent.ConcurrentHashMap<>();
return t -> seen.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null;
}
/** /**
* 递归 * 递归
* 查询出当前用户所在部门以及所有子部门 * 查询出当前用户所在部门以及所有子部门
......
...@@ -244,5 +244,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -244,5 +244,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach> </foreach>
group by tr.user_id group by tr.user_id
</select> </select>
<select id="getPrimaryInspection" resultType="com.ruoyi.system.domain.vo.SysUserVO">
select u.user_id,sr.role_id,u.user_name,u.nick_name,u.status,u.del_flag, sd.dept_name
from sys_user u
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
where sr.role_id = 112
and u.del_flag = '0'
</select>
<select id="getInspection" resultType="com.ruoyi.system.domain.vo.SysUserVO">
select u.user_id,sr.role_id,u.user_name,u.nick_name,u.status,u.del_flag, sd.dept_name
from sys_user u
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
where sr.role_id IN (106, 112)
and u.del_flag = '0'
</select>
</mapper> </mapper>
\ No newline at end of file
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