修改选择用户接口
This commit is contained in:
+42
@@ -157,6 +157,7 @@ public class SysUserController {
|
||||
try {
|
||||
pageList = sysUserService.queryPage(page, subDepIds, roleId, groupId, queryWrapper);
|
||||
}catch (Exception e){
|
||||
log.error("操作异常:" + e.getMessage());
|
||||
return Result.error(MessageUtils.getMessage(ResultCommon.ERROR));
|
||||
}
|
||||
//批量查询用户的所属部门
|
||||
@@ -180,6 +181,47 @@ public class SysUserController {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户列表数据
|
||||
* @param user
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@ApiOperationSupport(order = 1)
|
||||
@ApiOperation(value="用户列表查询", notes="用户列表查询")
|
||||
@PermissionData(pageComponent = "system/UserList")
|
||||
@GetMapping("/list")
|
||||
public Result<List<String>> queryList(SysUser user,
|
||||
@RequestParam(name="departId", required = false) String departId,
|
||||
@RequestParam(name="roleId", required = false) String roleId,
|
||||
HttpServletRequest req) {
|
||||
// 处理手机号和邮箱,进行对应加密
|
||||
Map<String, String[]> parameterMap = req.getParameterMap();
|
||||
String groupId = req.getParameter("groupId");
|
||||
this.sysUserService.encryptReqMapData(parameterMap);
|
||||
user.setEmail(this.sysUserService.proceedEmailEncrypt(user.getEmail()));
|
||||
user.setPhone(this.sysUserService.proceedPhoneEncrypt(user.getPhone()));
|
||||
|
||||
QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(user, parameterMap);
|
||||
List<String> subDepIds = null;
|
||||
if (StrUtil.isNotEmpty(departId)){
|
||||
subDepIds = sysDepartService.getSubDepIdsByDepId(departId);
|
||||
}
|
||||
if (StringUtils.isNotBlank(user.getRealnameOrUsername())){
|
||||
queryWrapper.and(aw -> aw.like("realname", user.getRealnameOrUsername())
|
||||
.or().like("username", user.getRealnameOrUsername()));
|
||||
}
|
||||
List<String> pageList;
|
||||
try {
|
||||
pageList = sysUserService.queryList(subDepIds, roleId, groupId, queryWrapper);
|
||||
}catch (Exception e){
|
||||
log.error("操作异常:" + e.getMessage());
|
||||
return Result.error(MessageUtils.getMessage(ResultCommon.ERROR));
|
||||
}
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@RequiresPermissions("user:add")
|
||||
@PostMapping("/add")
|
||||
public Result<Object> add(@RequestBody JSONObject jsonObject) {
|
||||
|
||||
@@ -33,6 +33,14 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||
IPage<SysUser> queryPage(Page<SysUser> page, @Param("departIds") List<String> subDepIds , @Param("roleId") String roleId ,
|
||||
@Param("groupId") String groupId, @Param(Constants.WRAPPER) Wrapper<SysUser> wrapper);
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询用户,可支持组织机构检索
|
||||
* @return
|
||||
*/
|
||||
List<String> queryList( @Param("departIds") List<String> subDepIds , @Param("roleId") String roleId ,
|
||||
@Param("groupId") String groupId, @Param(Constants.WRAPPER) Wrapper<SysUser> wrapper);
|
||||
|
||||
/**
|
||||
* 通过用户账号查询用户信息
|
||||
* @param username
|
||||
|
||||
+32
-1
@@ -4,7 +4,38 @@
|
||||
|
||||
<!-- 分页查询用户信息 -->
|
||||
<select id="queryPage" resultType="com.jero.modules.system.entity.SysUser">
|
||||
select * from sys_user where del_flag = 0
|
||||
select id from sys_user where del_flag = 0
|
||||
<if test="departIds!=null and departIds.size()>0">
|
||||
and id in (select user_id from sys_user_depart where dep_id in
|
||||
<foreach collection="departIds" index="index" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="groupId != null and groupId !=' '">
|
||||
and id in (select user_id from sys_user_group where group_id = #{groupId}
|
||||
)
|
||||
</if>
|
||||
<if test="roleId!=null and roleId!=''">
|
||||
and id in (select user_id from sys_user_role where role_id = #{roleId}
|
||||
)
|
||||
</if>
|
||||
<if test="roleId!=null and roleId!=''">
|
||||
and id in (select user_id from sys_user_role where role_id = #{roleId}
|
||||
)
|
||||
</if>
|
||||
<choose>
|
||||
<when test="ew.sqlSegment.indexOf(' ORDER') == 0">
|
||||
${ew.sqlSegment}
|
||||
</when>
|
||||
<otherwise>
|
||||
AND ${ew.sqlSegment}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<select id="queryList" resultType="java.lang.String">
|
||||
select id from sys_user where del_flag = 0
|
||||
<if test="departIds!=null and departIds.size()>0">
|
||||
and id in (select user_id from sys_user_depart where dep_id in
|
||||
<foreach collection="departIds" index="index" item="id" open="(" separator="," close=")">
|
||||
|
||||
@@ -38,6 +38,16 @@ public interface ISysUserService extends IService<SysUser> {
|
||||
*/
|
||||
IPage<SysUser> queryPage(Page<SysUser> page, List<String> subDepIds, String roleId, String groupId, QueryWrapper<SysUser> queryWrapper);
|
||||
|
||||
/**
|
||||
* 查询用户id
|
||||
* @param subDepIds
|
||||
* @param roleId
|
||||
* @param groupId
|
||||
* @param queryWrapper
|
||||
* @return
|
||||
*/
|
||||
List<String> queryList(List<String> subDepIds, String roleId, String groupId, QueryWrapper<SysUser> queryWrapper);
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
*
|
||||
|
||||
+5
@@ -90,6 +90,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
return sysUserIPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> queryList(List<String> subDepIds, String roleId, String groupId, QueryWrapper<SysUser> queryWrapper){
|
||||
return this.userMapper.queryList(subDepIds, roleId, groupId, queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(value = {CacheConstant.SYS_USERS_CACHE}, allEntries = true)
|
||||
public Result<T> resetPassword(String username, String oldpassword, String newpassword, String confirmpassword) {
|
||||
|
||||
Reference in New Issue
Block a user