feat(新增): 完善用户部门查询
This commit is contained in:
parent
4778891133
commit
25d01f0317
|
@ -6,6 +6,8 @@ import lombok.Builder;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
|
@ -34,4 +36,7 @@ public class AdminUserDto {
|
|||
@Schema(name = "status", title = "状态", description = "1:禁用 0:正常")
|
||||
private Boolean status;
|
||||
|
||||
@Schema(name = "deptId", title = "部门")
|
||||
private List<Long> deptIds;
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package cn.bunny.dao.dto.system.user;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Schema(name = "UserUpdateWithPasswordDto对象", title = "管理员用户修改密码", description = "管理员用户修改密码")
|
||||
public class AdminUserUpdateUserStatusDto {
|
||||
|
||||
@Schema(name = "userId", title = "用户ID")
|
||||
@NotNull(message = "用户ID不能为空")
|
||||
private Long userId;
|
||||
|
||||
@Schema(name = "status", title = "用户状态")
|
||||
@NotNull(message = "用户状态不能为空")
|
||||
private Boolean status;
|
||||
|
||||
}
|
|
@ -14,7 +14,7 @@ import lombok.NoArgsConstructor;
|
|||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Schema(name = "UserUpdateWithPasswordDto对象", title = "管理员用户修改密码", description = "管理员用户修改密码")
|
||||
public class UserUpdateWithPasswordDto {
|
||||
public class AdminUserUpdateWithPasswordDto {
|
||||
|
||||
@Schema(name = "userId", title = "用户ID")
|
||||
@NotNull(message = "用户ID不能为空")
|
|
@ -49,7 +49,7 @@ public class UserController {
|
|||
return Mono.just(Result.success(vo));
|
||||
}
|
||||
|
||||
@Operation(summary = "查询用户", description = "查询用户")
|
||||
@Operation(summary = "多条件查询用户", description = "多条件查询用户")
|
||||
@GetMapping("queryUser")
|
||||
public Mono<Result<List<AdminUserVo>>> queryUser(String keyword) {
|
||||
List<AdminUserVo> voList = userService.queryUser(keyword);
|
||||
|
@ -58,9 +58,37 @@ public class UserController {
|
|||
|
||||
@Operation(summary = "更新用户信息", description = "更新用户信息")
|
||||
@PutMapping("updateAdminUser")
|
||||
public Mono<Result<String>> updateAdminUser(@Valid @RequestBody AdminUserUpdateDto dto) {
|
||||
public Result<String> updateAdminUser(@Valid @RequestBody AdminUserUpdateDto dto) {
|
||||
userService.updateAdminUser(dto);
|
||||
return Mono.just(Result.success(ResultCodeEnum.UPDATE_SUCCESS));
|
||||
return Result.success(ResultCodeEnum.UPDATE_SUCCESS);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改用户状态", description = "管理员修改用户状态")
|
||||
@PutMapping("updateUserStatusByAdmin")
|
||||
public Result<String> updateUserStatusByAdmin(@Valid @RequestBody AdminUserUpdateUserStatusDto dto) {
|
||||
userService.updateUserStatusByAdmin(dto);
|
||||
return Result.success(ResultCodeEnum.UPDATE_SUCCESS);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改管理员用户密码", description = "管理员修改管理员用户密码")
|
||||
@PutMapping("updateUserPasswordByAdmin")
|
||||
public Result<String> updateUserPasswordByAdmin(@Valid @RequestBody AdminUserUpdateWithPasswordDto dto) {
|
||||
userService.updateUserPasswordByAdmin(dto);
|
||||
return Result.success(ResultCodeEnum.UPDATE_SUCCESS);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改用户头像", description = "管理员修改用户头像")
|
||||
@PutMapping("uploadAvatarByAdmin")
|
||||
public Result<String> uploadAvatarByAdmin(@Valid UserUpdateWithAvatarDto dto) {
|
||||
userService.uploadAvatarByAdmin(dto);
|
||||
return Result.success(ResultCodeEnum.UPDATE_SUCCESS);
|
||||
}
|
||||
|
||||
@Operation(summary = "强制退出", description = "强制退出")
|
||||
@PutMapping("forcedOffline")
|
||||
public Result<String> forcedOffline(@RequestBody Long id) {
|
||||
userService.forcedOffline(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@Operation(summary = "登录发送邮件验证码", description = "登录发送邮件验证码")
|
||||
|
@ -79,9 +107,9 @@ public class UserController {
|
|||
|
||||
@Operation(summary = "添加用户信息", description = "添加用户信息")
|
||||
@PostMapping("addAdminUser")
|
||||
public Mono<Result<String>> addAdminUser(@Valid @RequestBody AdminUserAddDto dto) {
|
||||
public Result<Object> addAdminUser(@Valid @RequestBody AdminUserAddDto dto) {
|
||||
userService.addAdminUser(dto);
|
||||
return Mono.just(Result.success(ResultCodeEnum.ADD_SUCCESS));
|
||||
return Result.success(ResultCodeEnum.ADD_SUCCESS);
|
||||
}
|
||||
|
||||
@Operation(summary = "退出登录", description = "退出登录")
|
||||
|
@ -91,27 +119,6 @@ public class UserController {
|
|||
return Result.success(ResultCodeEnum.LOGOUT_SUCCESS);
|
||||
}
|
||||
|
||||
@Operation(summary = "管理员修改管理员用户密码", description = "管理员修改管理员用户密码")
|
||||
@PutMapping("updateUserPasswordByAdmin")
|
||||
public Result<String> updateUserPasswordByAdmin(@Valid @RequestBody UserUpdateWithPasswordDto dto) {
|
||||
userService.updateUserPasswordByAdmin(dto);
|
||||
return Result.success(ResultCodeEnum.UPDATE_SUCCESS);
|
||||
}
|
||||
|
||||
@Operation(summary = "管理员上传用户头像", description = "管理员上传用户头像")
|
||||
@PutMapping("uploadAvatarByAdmin")
|
||||
public Result<String> uploadAvatarByAdmin(@Valid UserUpdateWithAvatarDto dto) {
|
||||
userService.uploadAvatarByAdmin(dto);
|
||||
return Result.success(ResultCodeEnum.UPDATE_SUCCESS);
|
||||
}
|
||||
|
||||
@Operation(summary = "强制退出", description = "强制退出")
|
||||
@PutMapping("forcedOffline")
|
||||
public Result<String> forcedOffline(@RequestBody Long id) {
|
||||
userService.forcedOffline(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@Operation(summary = "删除用户信息", description = "删除用户信息")
|
||||
@DeleteMapping("deleteAdminUser")
|
||||
public Mono<Result<String>> deleteAdminUser(@RequestBody List<Long> ids) {
|
||||
|
|
|
@ -85,7 +85,7 @@ public interface UserService extends IService<AdminUser> {
|
|||
*
|
||||
* @param dto 管理员用户修改密码
|
||||
*/
|
||||
void updateUserPasswordByAdmin(UserUpdateWithPasswordDto dto);
|
||||
void updateUserPasswordByAdmin(AdminUserUpdateWithPasswordDto dto);
|
||||
|
||||
/**
|
||||
* * 管理员上传用户头像
|
||||
|
@ -108,4 +108,11 @@ public interface UserService extends IService<AdminUser> {
|
|||
* @return 用户信息列表
|
||||
*/
|
||||
List<AdminUserVo> queryUser(String keyword);
|
||||
|
||||
/**
|
||||
* * 修改用户状态
|
||||
*
|
||||
* @param dto 管理员用户修改密码
|
||||
*/
|
||||
void updateUserStatusByAdmin(AdminUserUpdateUserStatusDto dto);
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, AdminUser> implemen
|
|||
* @param dto 管理员用户修改密码
|
||||
*/
|
||||
@Override
|
||||
public void updateUserPasswordByAdmin(UserUpdateWithPasswordDto dto) {
|
||||
public void updateUserPasswordByAdmin(AdminUserUpdateWithPasswordDto dto) {
|
||||
Long userId = dto.getUserId();
|
||||
String password = dto.getPassword();
|
||||
|
||||
|
@ -246,6 +246,20 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, AdminUser> implemen
|
|||
}).toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* * 修改用户状态
|
||||
*
|
||||
* @param dto 管理员用户修改密码
|
||||
*/
|
||||
@Override
|
||||
public void updateUserStatusByAdmin(AdminUserUpdateUserStatusDto dto) {
|
||||
AdminUser adminUser = new AdminUser();
|
||||
adminUser.setId(dto.getUserId());
|
||||
adminUser.setStatus(dto.getStatus());
|
||||
|
||||
updateById(adminUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* * 用户信息 服务实现类
|
||||
*
|
||||
|
|
|
@ -77,8 +77,8 @@ mybatis-plus:
|
|||
global-config:
|
||||
db-config:
|
||||
logic-delete-field: isDelete
|
||||
configuration:
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 查看日志
|
||||
# configuration:
|
||||
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 查看日志
|
||||
|
||||
logging:
|
||||
level:
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
<result column="last_login_ip" property="lastLoginIp"/>
|
||||
<result column="last_login_ip_address" property="lastLoginIpAddress"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="dept_Id" property="deptId"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
|
@ -26,7 +25,7 @@
|
|||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, username, nick_name, email, phone, password, avatar, sex, summary, last_login_ip, last_login_ip_address, status, dept_Id, create_user, create_time, update_time, update_user, is_deleted
|
||||
id, username, nick_name, email, phone, password, avatar, sex, summary, last_login_ip, last_login_ip_address, status, create_user, create_time, update_time, update_user, is_deleted
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询用户信息内容 -->
|
||||
|
@ -56,6 +55,12 @@
|
|||
<if test="dto.status != null and dto.status != ''">
|
||||
status = #{dto.status}
|
||||
</if>
|
||||
<if test="dto.deptIds != null and dto.deptIds.size() > 0">
|
||||
user_dept.dept_id in
|
||||
<foreach collection="dto.deptIds" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
|
||||
</select>
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
package cn.bunny.service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
class Solution {
|
||||
public List<List<String>> groupAnagrams(String[] strs) {
|
||||
HashMap<String, List<String>> hashMap = new HashMap<>();
|
||||
|
||||
for (String str : strs) {
|
||||
char[] charArray = str.toCharArray();
|
||||
Arrays.sort(charArray);
|
||||
|
||||
String value = String.valueOf(charArray);
|
||||
if (hashMap.containsKey(value)) {
|
||||
hashMap.get(value).add(str);
|
||||
} else {
|
||||
hashMap.put(value, List.of(str));
|
||||
}
|
||||
}
|
||||
|
||||
return hashMap.values().stream().toList();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue