release_1.0.0
xueqingkun 8 months ago
parent 63ac2da86e
commit 3ab095c896

@ -69,9 +69,10 @@ public class UserController {
public IPage<UserInfoDTO> list(@Parameter(name = "userName",description = "用户名") @RequestParam(required = false) String userName,
@Parameter(name = "deptId",description = "部门id") @RequestParam(required = false) String deptId,
@Parameter(name = "roleId",description = "角色id") @RequestParam(required = false) String roleId,
@Parameter(name = "roleName",description = "角色名") @RequestParam(required = false) String roleName,
@Parameter(name = "pageNum",description = "页码") @RequestParam(defaultValue = "1") Integer pageNum,
@Parameter(name = "pageSize",description = "每页大小") @RequestParam(defaultValue = "10") Integer pageSize) {
return userManageService.list(userName, deptId, roleId, pageNum, pageSize);
return userManageService.list(userName, deptId, roleId, roleName, pageNum, pageSize);
}

@ -27,7 +27,7 @@ public interface UserManageService {
Boolean deleteUser(String id);
IPage<UserInfoDTO> list(String userName, String deptId, String roleId, Integer pageNum, Integer pageSize);
IPage<UserInfoDTO> list(String userName, String deptId, String roleId, String roleName,Integer pageNum, Integer pageSize);
Boolean resetPW(String id);

@ -11,7 +11,7 @@ public interface UserRoleRelationManageService {
List<SystemUserRoleRelation> updateUserRoleRelation(String userId, List<String> roleIdList);
List<UserRoleDTO> listUserRole(String userId, String roleId);
List<UserRoleDTO> listUserRole(String userId, String roleId,String roleName);
List<UserRoleDTO> listUserRoleByUserIds(List<String> userIds);

@ -8,12 +8,12 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.supervision.knowsub.domain.UserInfo;
import com.supervision.knowsub.dto.role.UserRoleDTO;
import com.supervision.knowsub.dto.user.UserPageQuery;
import com.supervision.knowsub.exception.BusinessException;
import com.supervision.knowsub.model.SystemDept;
import com.supervision.knowsub.model.SystemRole;
import com.supervision.knowsub.model.SystemUser;
import com.supervision.knowsub.service.SystemDeptService;
import com.supervision.knowsub.service.UserManageService;
@ -66,7 +66,7 @@ public class UserManageServiceImpl implements UserManageService {
LoginResVO loginResVO = BeanUtil.toBean(user.get(), LoginResVO.class);
loginResVO.setToken(token);
loginResVO.setUsername(user.get().getUsername());
List<UserRoleDTO> userRoleDTOS = userRoleRelationManageService.listUserRole(user.get().getId(),null);
List<UserRoleDTO> userRoleDTOS = userRoleRelationManageService.listUserRole(user.get().getId(),null,null);
loginResVO.setUserRoleDTOList(userRoleDTOS);
// 获取用户的部门
Optional<SystemDept> optById = systemDeptService.getOptById(user.get().getDeptId());
@ -155,11 +155,14 @@ public class UserManageServiceImpl implements UserManageService {
}
@Override
public IPage<UserInfoDTO> list(String userName, String deptId, String roleId, Integer pageNum, Integer pageSize) {
public IPage<UserInfoDTO> list(String userName, String deptId, String roleId,String roleName, Integer pageNum, Integer pageSize) {
List<UserRoleDTO> userRoleDTOS = new ArrayList<>();
if (StrUtil.isNotEmpty(roleId)){
userRoleDTOS = userRoleRelationManageService.listUserRole(null, roleId);
if (StrUtil.isNotEmpty(roleId) || StrUtil.isNotEmpty(roleName)){
userRoleDTOS = userRoleRelationManageService.listUserRole(null, roleId, roleName);
if (CollUtil.isEmpty(userRoleDTOS)){
return Page.of(pageNum, pageSize, 0);
}
}
//构建查询条件
UserPageQuery userPageQuery = UserPageQuery.builder().userName(userName).deptId(deptId)

@ -54,8 +54,8 @@ public class UserRoleRelationManageServiceImpl implements UserRoleRelationManage
@Override
@Transactional(rollbackFor = Exception.class)
public List<UserRoleDTO> listUserRole(String userId, String roleId) {
return userRoleRelationService.listUserRole(userId,roleId);
public List<UserRoleDTO> listUserRole(String userId, String roleId,String roleName) {
return userRoleRelationService.listUserRole(userId,roleId,roleName);
}
@Override

@ -15,7 +15,8 @@ import java.util.List;
*/
public interface SystemUserRoleRelationMapper extends BaseMapper<SystemUserRoleRelation> {
List<UserRoleDTO> listUserRole(@Param("userId") String userId, @Param("roleId") String roleId);
List<UserRoleDTO> listUserRole(@Param("userId") String userId, @Param("roleId") String roleId,
@Param("roleName") String roleName);
List<UserRoleDTO> listUserRoleByUserIds(List<String> userIds);
}

@ -14,7 +14,7 @@ import java.util.List;
public interface SystemUserRoleRelationService extends IService<SystemUserRoleRelation> {
List<UserRoleDTO> listUserRole(String userId, String roleId);
List<UserRoleDTO> listUserRole(String userId, String roleId,String roleName);
List<UserRoleDTO> listUserRoleByUserIds(List<String> userIds);
}

@ -19,8 +19,8 @@ public class SystemUserRoleRelationServiceImpl extends ServiceImpl<SystemUserRol
implements SystemUserRoleRelationService{
@Override
public List<UserRoleDTO> listUserRole(String userId, String roleId) {
return super.getBaseMapper().listUserRole(userId, roleId);
public List<UserRoleDTO> listUserRole(String userId, String roleId,String roleName) {
return super.getBaseMapper().listUserRole(userId, roleId,roleName);
}
@Override

@ -28,7 +28,8 @@
t1.dept_code as deptCode,
t1.dept_name as deptName,
t1.parent_dept_id as parentDeptId,
t2.dept_name as parentDeptName
t2.dept_name as parentDeptName,
t1.remark as remark
from ks_system_dept t1
left join ks_system_dept t2 on t1.parent_dept_id = t2.id
where 1=1

@ -29,6 +29,9 @@
<if test="roleId != null and roleId != ''">
and r.id = #{roleId}
</if>
<if test="roleName != null and roleName != ''">
and r.role_name like concat('%',#{roleName},'%')
</if>
<if test="userId != null and userId != ''">
and ur.user_id = #{userId}
</if>

Loading…
Cancel
Save