Commit bdf696ac authored by yuanshuo's avatar yuanshuo

2024/11/27新增和修改方法

1.新增接口/system/user/getInspectionNew用来在发起任务时,直接获取所有人的信息,并不是先获取主检然后再获取检验员了
2.更改TaskServiceImpl文件中关于leader部分的寻找,之前是通过前端传来的isLeader标识符寻找,改成for循环找到的第一个主检人员设置为leader。
3.暂存任务时,由于之前添加了两个字段enterpriseName和enterpriseId所以暂存任务时也要将这两个加上。
parent 30c41068
...@@ -20,6 +20,7 @@ import com.ruoyi.domain.*; ...@@ -20,6 +20,7 @@ import com.ruoyi.domain.*;
import com.ruoyi.domain.vo.CaseStatisticsVO; import com.ruoyi.domain.vo.CaseStatisticsVO;
import com.ruoyi.mapper.*; import com.ruoyi.mapper.*;
import com.ruoyi.service.*; import com.ruoyi.service.*;
import com.ruoyi.system.mapper.SysUserRoleMapper;
import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.web.request.*; import com.ruoyi.web.request.*;
import com.ruoyi.web.response.*; import com.ruoyi.web.response.*;
...@@ -138,6 +139,9 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -138,6 +139,9 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
@Autowired @Autowired
private TestRecordsMapper testRecordsMapper; private TestRecordsMapper testRecordsMapper;
@Autowired
private SysUserRoleMapper sysUserRoleMapper;
@Override @Override
public List<Task> findList(TaskListRequest request) { public List<Task> findList(TaskListRequest request) {
return taskMapper.findList(request); return taskMapper.findList(request);
...@@ -196,8 +200,15 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -196,8 +200,15 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
TaskUserRelation leader = null; TaskUserRelation leader = null;
List<TaskUserRelation> auditors = request.getAuditors(); List<TaskUserRelation> auditors = request.getAuditors();
for(TaskUserRelation auditor : auditors) { for(TaskUserRelation auditor : auditors) {
if(auditor.getIsLeader() == 1) { List<Long> roleIdList = sysUserRoleMapper.selectRoleIdByUserId(auditor.getUserId());
leader = auditor; for (Long roleId : roleIdList){
if (roleId.equals(112L)){
leader = auditor;
auditor.setIsLeader(1);
break;
}
}
if (leader != null){
break; break;
} }
} }
...@@ -334,8 +345,15 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -334,8 +345,15 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
TaskUserRelation leader = null; TaskUserRelation leader = null;
List<TaskUserRelation> auditors = request.getAuditors(); List<TaskUserRelation> auditors = request.getAuditors();
for(TaskUserRelation auditor : auditors) { for(TaskUserRelation auditor : auditors) {
if(auditor.getIsLeader() == 1) { List<Long> roleIdList = sysUserRoleMapper.selectRoleIdByUserId(auditor.getUserId());
leader = auditor; for (Long roleId : roleIdList){
if (roleId.equals(112L)){
leader = auditor;
auditor.setIsLeader(1);
break;
}
}
if (leader != null){
break; break;
} }
} }
...@@ -588,10 +606,32 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -588,10 +606,32 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
task.setStandardNo(standard.getStandardNo()); task.setStandardNo(standard.getStandardNo());
task.setFile(standard.getFile()); task.setFile(standard.getFile());
} }
if(request.getEnterpriseName() != null){
task.setEnterpriseName(request.getEnterpriseName());
}
if (request.getEnterpriseId() != null){
task.setEnterpriseId(request.getEnterpriseId());
}
// 找到审查组长 // 找到审查组长
TaskUserRelation leader = null; TaskUserRelation leader = null;
List<TaskUserRelation> auditors = request.getAuditors(); List<TaskUserRelation> auditors = request.getAuditors();
for(TaskUserRelation auditor : auditors) {
List<Long> roleIdList = sysUserRoleMapper.selectRoleIdByUserId(auditor.getUserId());
for (Long roleId : roleIdList){
if (roleId.equals(112L)){
leader = auditor;
auditor.setIsLeader(1);
break;
}
}
if (leader != null){
task.setLeaderId(leader.getUserId());
task.setLeader(leader.getName());
break;
}
}
/*TaskUserRelation leader = null;
List<TaskUserRelation> auditors = request.getAuditors();
if (auditors != null && auditors.size() != 0) { if (auditors != null && auditors.size() != 0) {
for(TaskUserRelation auditor : auditors) { for(TaskUserRelation auditor : auditors) {
if(auditor.getIsLeader() == 1) { if(auditor.getIsLeader() == 1) {
...@@ -603,7 +643,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -603,7 +643,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
// 任务组长 // 任务组长
task.setLeaderId(leader.getUserId()); task.setLeaderId(leader.getUserId());
task.setLeader(leader.getName()); task.setLeader(leader.getName());
} }*/
// 暂存 // 暂存
taskService.save(task); taskService.save(task);
...@@ -657,6 +697,23 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -657,6 +697,23 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
// 找到审查组长 // 找到审查组长
TaskUserRelation leader = null; TaskUserRelation leader = null;
List<TaskUserRelation> auditors = request.getAuditors(); List<TaskUserRelation> auditors = request.getAuditors();
for(TaskUserRelation auditor : auditors) {
List<Long> roleIdList = sysUserRoleMapper.selectRoleIdByUserId(auditor.getUserId());
for (Long roleId : roleIdList){
if (roleId.equals(112L)){
leader = auditor;
auditor.setIsLeader(1);
break;
}
}
if (leader != null){
task.setLeaderId(leader.getUserId());
task.setLeader(leader.getName());
break;
}
}
/*TaskUserRelation leader = null;
List<TaskUserRelation> auditors = request.getAuditors();
if (auditors != null && auditors.size() != 0) { if (auditors != null && auditors.size() != 0) {
for(TaskUserRelation auditor : auditors) { for(TaskUserRelation auditor : auditors) {
if(auditor.getIsLeader() == 1) { if(auditor.getIsLeader() == 1) {
...@@ -667,7 +724,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -667,7 +724,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
// 任务组长 // 任务组长
task.setLeaderId(leader.getUserId()); task.setLeaderId(leader.getUserId());
task.setLeader(leader.getName()); task.setLeader(leader.getName());
} }*/
// 更新暂存 // 更新暂存
taskService.updateById(task); taskService.updateById(task);
......
...@@ -7,6 +7,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -7,6 +7,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.system.domain.vo.SysUserVO; import com.ruoyi.system.domain.vo.SysUserVO;
import com.ruoyi.system.domain.vo.SysUserVONew;
import com.ruoyi.system.request.InspectionRequest; 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;
...@@ -136,6 +137,11 @@ public class SysUserController extends BaseController ...@@ -136,6 +137,11 @@ public class SysUserController extends BaseController
return R.ok(userService.getInspection()); return R.ok(userService.getInspection());
} }
@ApiOperation("获取检验人员列表新")
@PostMapping("/getInspectionNew")
public R<List<SysUserVONew>> getInspectionNew() {
return R.ok(userService.getInspectionNew());
}
@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;
import java.util.List;
@Data
@Accessors(chain = true)
public class SysUserVONew {
@ApiModelProperty("用户id")
private Long userId;
@ApiModelProperty("用户账号")
private String userName;
@ApiModelProperty("用户昵称")
private String nickname;
@ApiModelProperty("部门名称")
private String deptName;
@ApiModelProperty("角色id")
private List<Long> roleId;
@ApiModelProperty("帐号状态(0正常 1停用)")
private String status;
@ApiModelProperty("删除标志(0代表存在 2代表删除)")
private String delFlag;
}
...@@ -3,6 +3,7 @@ package com.ruoyi.system.mapper; ...@@ -3,6 +3,7 @@ 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.SysUserVO;
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.request.InspectionRequest; import com.ruoyi.system.request.InspectionRequest;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -10,14 +11,14 @@ import com.ruoyi.common.core.domain.entity.SysUser; ...@@ -10,14 +11,14 @@ import com.ruoyi.common.core.domain.entity.SysUser;
/** /**
* 用户表 数据层 * 用户表 数据层
* *
* @author ruoyi * @author ruoyi
*/ */
public interface SysUserMapper public interface SysUserMapper
{ {
/** /**
* 根据条件分页查询用户列表 * 根据条件分页查询用户列表
* *
* @param sysUser 用户信息 * @param sysUser 用户信息
* @return 用户信息集合信息 * @return 用户信息集合信息
*/ */
...@@ -25,7 +26,7 @@ public interface SysUserMapper ...@@ -25,7 +26,7 @@ public interface SysUserMapper
/** /**
* 根据条件分页查询已配用户角色列表 * 根据条件分页查询已配用户角色列表
* *
* @param user 用户信息 * @param user 用户信息
* @return 用户信息集合信息 * @return 用户信息集合信息
*/ */
...@@ -33,7 +34,7 @@ public interface SysUserMapper ...@@ -33,7 +34,7 @@ public interface SysUserMapper
/** /**
* 根据条件分页查询未分配用户角色列表 * 根据条件分页查询未分配用户角色列表
* *
* @param user 用户信息 * @param user 用户信息
* @return 用户信息集合信息 * @return 用户信息集合信息
*/ */
...@@ -41,7 +42,7 @@ public interface SysUserMapper ...@@ -41,7 +42,7 @@ public interface SysUserMapper
/** /**
* 通过用户名查询用户 * 通过用户名查询用户
* *
* @param userName 用户名 * @param userName 用户名
* @return 用户对象信息 * @return 用户对象信息
*/ */
...@@ -49,7 +50,7 @@ public interface SysUserMapper ...@@ -49,7 +50,7 @@ public interface SysUserMapper
/** /**
* 通过用户ID查询用户 * 通过用户ID查询用户
* *
* @param userId 用户ID * @param userId 用户ID
* @return 用户对象信息 * @return 用户对象信息
*/ */
...@@ -57,7 +58,7 @@ public interface SysUserMapper ...@@ -57,7 +58,7 @@ public interface SysUserMapper
/** /**
* 新增用户信息 * 新增用户信息
* *
* @param user 用户信息 * @param user 用户信息
* @return 结果 * @return 结果
*/ */
...@@ -65,7 +66,7 @@ public interface SysUserMapper ...@@ -65,7 +66,7 @@ public interface SysUserMapper
/** /**
* 修改用户信息 * 修改用户信息
* *
* @param user 用户信息 * @param user 用户信息
* @return 结果 * @return 结果
*/ */
...@@ -73,7 +74,7 @@ public interface SysUserMapper ...@@ -73,7 +74,7 @@ public interface SysUserMapper
/** /**
* 修改用户头像 * 修改用户头像
* *
* @param userName 用户名 * @param userName 用户名
* @param avatar 头像地址 * @param avatar 头像地址
* @return 结果 * @return 结果
...@@ -82,7 +83,7 @@ public interface SysUserMapper ...@@ -82,7 +83,7 @@ public interface SysUserMapper
/** /**
* 重置用户密码 * 重置用户密码
* *
* @param userName 用户名 * @param userName 用户名
* @param password 密码 * @param password 密码
* @return 结果 * @return 结果
...@@ -91,7 +92,7 @@ public interface SysUserMapper ...@@ -91,7 +92,7 @@ public interface SysUserMapper
/** /**
* 通过用户ID删除用户 * 通过用户ID删除用户
* *
* @param userId 用户ID * @param userId 用户ID
* @return 结果 * @return 结果
*/ */
...@@ -99,7 +100,7 @@ public interface SysUserMapper ...@@ -99,7 +100,7 @@ public interface SysUserMapper
/** /**
* 批量删除用户信息 * 批量删除用户信息
* *
* @param userIds 需要删除的用户ID * @param userIds 需要删除的用户ID
* @return 结果 * @return 结果
*/ */
...@@ -107,7 +108,7 @@ public interface SysUserMapper ...@@ -107,7 +108,7 @@ public interface SysUserMapper
/** /**
* 校验用户名称是否唯一 * 校验用户名称是否唯一
* *
* @param userName 用户名称 * @param userName 用户名称
* @return 结果 * @return 结果
*/ */
...@@ -161,4 +162,9 @@ public interface SysUserMapper ...@@ -161,4 +162,9 @@ public interface SysUserMapper
* @return * @return
*/ */
List<SysUserVO> getInspection(); List<SysUserVO> getInspection();
/**
* 获取检验人员列表
* @return
*/
List<SysUserVONew> getInspectionNew();
} }
...@@ -66,4 +66,9 @@ public interface SysUserRoleMapper ...@@ -66,4 +66,9 @@ public interface SysUserRoleMapper
*根据roleId查询审核员Id *根据roleId查询审核员Id
* */ * */
List<Long> selectReviewerIdByRoleId(Long roleId); List<Long> selectReviewerIdByRoleId(Long roleId);
/*
* 根据用户获取角色id
* */
List<Long> selectRoleIdByUserId(Long userId);
} }
...@@ -3,6 +3,7 @@ package com.ruoyi.system.service; ...@@ -3,6 +3,7 @@ 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.domain.vo.SysUserVO;
import com.ruoyi.system.domain.vo.SysUserVONew;
import com.ruoyi.system.request.InspectionRequest; import com.ruoyi.system.request.InspectionRequest;
/** /**
...@@ -239,4 +240,6 @@ public interface ISysUserService ...@@ -239,4 +240,6 @@ public interface ISysUserService
* @return * @return
*/ */
List<SysUserVO> getInspection(); List<SysUserVO> getInspection();
List<SysUserVONew> getInspectionNew();
} }
...@@ -7,6 +7,7 @@ import javax.validation.Validator; ...@@ -7,6 +7,7 @@ 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.SysUserVO;
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 com.ruoyi.system.request.InspectionRequest;
...@@ -621,6 +622,24 @@ public class SysUserServiceImpl implements ISysUserService ...@@ -621,6 +622,24 @@ public class SysUserServiceImpl implements ISysUserService
return deduplicatedList; return deduplicatedList;
} }
/**
* 获取检验人员列表
* @return
*/
@Override
public List<SysUserVONew> getInspectionNew() {
List<SysUserVONew> userList = userMapper.getInspectionNew();
for (SysUserVONew sysUserVONew : userList){
List<Long> roleId = userRoleMapper.selectRoleIdByUserId(sysUserVONew.getUserId());
sysUserVONew.setRoleId(roleId);
}
// 使用Stream API进行去重,基于userId字段
/*List<SysUserVO> deduplicatedList = userList.stream()
.filter(distinctByKey(user -> user.getUserId()))
.collect(Collectors.toList());*/
return userList;
}
// 辅助方法,用于去重 // 辅助方法,用于去重
private static <T> java.util.function.Predicate<T> distinctByKey(java.util.function.Function<? super T, ?> keyExtractor) { 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<>(); java.util.Map<Object, Boolean> seen = new java.util.concurrent.ConcurrentHashMap<>();
......
...@@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<association property="dept" javaType="SysDept" resultMap="deptResult" /> <association property="dept" javaType="SysDept" resultMap="deptResult" />
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" /> <collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
</resultMap> </resultMap>
<resultMap id="deptResult" type="SysDept"> <resultMap id="deptResult" type="SysDept">
<id property="deptId" column="dept_id" /> <id property="deptId" column="dept_id" />
<result property="parentId" column="parent_id" /> <result property="parentId" column="parent_id" />
...@@ -37,7 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -37,7 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="leader" column="leader" /> <result property="leader" column="leader" />
<result property="status" column="dept_status" /> <result property="status" column="dept_status" />
</resultMap> </resultMap>
<resultMap id="RoleResult" type="SysRole"> <resultMap id="RoleResult" type="SysRole">
<id property="roleId" column="role_id" /> <id property="roleId" column="role_id" />
<result property="roleName" column="role_name" /> <result property="roleName" column="role_name" />
...@@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="dataScope" column="data_scope" /> <result property="dataScope" column="data_scope" />
<result property="status" column="role_status" /> <result property="status" column="role_status" />
</resultMap> </resultMap>
<sql id="selectUserVo"> <sql id="selectUserVo">
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, u.signature_picture, select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, u.signature_picture,
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status, d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
...@@ -56,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -56,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join sys_user_role ur on u.user_id = ur.user_id left join sys_user_role ur on u.user_id = ur.user_id
left join sys_role r on r.role_id = ur.role_id left join sys_role r on r.role_id = ur.role_id
</sql> </sql>
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult"> <select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
left join sys_dept d on u.dept_id = d.dept_id left join sys_dept d on u.dept_id = d.dept_id
...@@ -85,7 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -85,7 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- 数据范围过滤 --> <!-- 数据范围过滤 -->
${params.dataScope} ${params.dataScope}
</select> </select>
<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult"> <select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
from sys_user u from sys_user u
...@@ -102,7 +102,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -102,7 +102,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- 数据范围过滤 --> <!-- 数据范围过滤 -->
${params.dataScope} ${params.dataScope}
</select> </select>
<select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult"> <select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult">
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
from sys_user u from sys_user u
...@@ -120,25 +120,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -120,25 +120,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- 数据范围过滤 --> <!-- 数据范围过滤 -->
${params.dataScope} ${params.dataScope}
</select> </select>
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult"> <select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
<include refid="selectUserVo"/> <include refid="selectUserVo"/>
where u.user_name = #{userName} and u.del_flag = '0' where u.user_name = #{userName} and u.del_flag = '0'
</select> </select>
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult"> <select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
<include refid="selectUserVo"/> <include refid="selectUserVo"/>
where u.user_id = #{userId} where u.user_id = #{userId}
</select> </select>
<select id="checkUserNameUnique" parameterType="String" resultMap="SysUserResult"> <select id="checkUserNameUnique" parameterType="String" resultMap="SysUserResult">
select user_id, user_name from sys_user where user_name = #{userName} and del_flag = '0' limit 1 select user_id, user_name from sys_user where user_name = #{userName} and del_flag = '0' limit 1
</select> </select>
<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult"> <select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} and del_flag = '0' limit 1 select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} and del_flag = '0' limit 1
</select> </select>
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult"> <select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1 select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1
</select> </select>
...@@ -188,7 +188,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -188,7 +188,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sysdate() sysdate()
) )
</insert> </insert>
<update id="updateUser" parameterType="SysUser"> <update id="updateUser" parameterType="SysUser">
update sys_user update sys_user
<set> <set>
...@@ -210,28 +210,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -210,28 +210,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</set> </set>
where user_id = #{userId} where user_id = #{userId}
</update> </update>
<update id="updateUserStatus" parameterType="SysUser"> <update id="updateUserStatus" parameterType="SysUser">
update sys_user set status = #{status} where user_id = #{userId} update sys_user set status = #{status} where user_id = #{userId}
</update> </update>
<update id="updateUserAvatar" parameterType="SysUser"> <update id="updateUserAvatar" parameterType="SysUser">
update sys_user set avatar = #{avatar} where user_name = #{userName} update sys_user set avatar = #{avatar} where user_name = #{userName}
</update> </update>
<update id="resetUserPwd" parameterType="SysUser"> <update id="resetUserPwd" parameterType="SysUser">
update sys_user set password = #{password} where user_name = #{userName} update sys_user set password = #{password} where user_name = #{userName}
</update> </update>
<delete id="deleteUserById" parameterType="Long"> <delete id="deleteUserById" parameterType="Long">
update sys_user set del_flag = '2' where user_id = #{userId} update sys_user set del_flag = '2' where user_id = #{userId}
</delete> </delete>
<delete id="deleteUserByIds" parameterType="Long"> <delete id="deleteUserByIds" parameterType="Long">
update sys_user set del_flag = '2' where user_id in update sys_user set del_flag = '2' where user_id in
<foreach collection="array" item="userId" open="(" separator="," close=")"> <foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId} #{userId}
</foreach> </foreach>
</delete> </delete>
<select id="countTaskByUserId" resultType="com.ruoyi.system.domain.vo.UserCountVo"> <select id="countTaskByUserId" resultType="com.ruoyi.system.domain.vo.UserCountVo">
select count(*) countNum, tr.user_id userId, s.nick_name nikeName select count(*) countNum, tr.user_id userId, s.nick_name nikeName
...@@ -260,5 +260,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -260,5 +260,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where sr.role_id IN (106, 112) where sr.role_id IN (106, 112)
and u.del_flag = '0' and u.del_flag = '0'
</select> </select>
<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
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
...@@ -20,6 +20,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -20,6 +20,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectReviewerIdByRoleId" resultType="java.lang.Long"> <select id="selectReviewerIdByRoleId" resultType="java.lang.Long">
select user_id from sys_user_role where role_id = #{roleId} select user_id from sys_user_role where role_id = #{roleId}
</select> </select>
<select id="selectRoleIdByUserId" resultType="java.lang.Long">
select role_id
from sys_user_role
where user_id = #{userId}
</select>
<delete id="deleteUserRole" parameterType="Long"> <delete id="deleteUserRole" parameterType="Long">
delete from sys_user_role where user_id in delete from sys_user_role where user_id in
......
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