添加Swagger/OpenAPI依赖并更新用户账户管理相关的API文档注释,优化用户和管理员账户控制器的接口描述,移除不必要的字段和参数,调整数据库映射以简化用户账户管理逻辑。
This commit is contained in:
@@ -46,15 +46,15 @@ public class UserService {
|
||||
/**
|
||||
* 分页查询用户列表
|
||||
*/
|
||||
public Mono<PageResult<AccountResponse>> list(String userType, String status, String role, String keyword,
|
||||
public Mono<PageResult<AccountResponse>> list(String userType, String status, String keyword,
|
||||
Integer page, Integer size) {
|
||||
int p = (page == null || page < 1) ? 1 : page;
|
||||
int s = (size == null || size < 1 || size > 200) ? 20 : size;
|
||||
int offset = (p - 1) * s;
|
||||
|
||||
return Mono.fromCallable(() -> {
|
||||
long total = userAccountMapper.countByFilter(userType, status, role, keyword);
|
||||
List<UserAccount> list = userAccountMapper.listByFilter(userType, status, role, keyword, s, offset);
|
||||
long total = userAccountMapper.countByFilter(userType, status, keyword);
|
||||
List<UserAccount> list = userAccountMapper.listByFilter(userType, status, keyword, s, offset);
|
||||
List<AccountResponse> items = list.stream()
|
||||
.map(this::toAccountResponse)
|
||||
.collect(Collectors.toList());
|
||||
@@ -81,8 +81,6 @@ public class UserService {
|
||||
response.setId(account.getId());
|
||||
response.setUserType(account.getUserType());
|
||||
response.setUsername(account.getUsername());
|
||||
response.setDisplayName(account.getDisplayName());
|
||||
response.setRole(account.getRole());
|
||||
response.setStatus(account.getStatus());
|
||||
response.setPointsBalance(account.getPointsBalance());
|
||||
response.setCreatedAt(account.getCreatedAt());
|
||||
|
||||
@@ -31,8 +31,8 @@ public class AccountService {
|
||||
int s = (size == null || size < 1 || size > 200) ? 20 : size;
|
||||
int offset = (p - 1) * s;
|
||||
return Mono.fromCallable(() -> {
|
||||
long total = mapper.countByFilter(userType, status, null, keyword);
|
||||
List<UserAccount> list = mapper.listByFilter(userType, status, null, keyword, s, offset);
|
||||
long total = mapper.countByFilter(userType, status, keyword);
|
||||
List<UserAccount> list = mapper.listByFilter(userType, status, keyword, s, offset);
|
||||
List<AccountResponse> items = list.stream().map(this::toResp).collect(Collectors.toList());
|
||||
return new PageResult<>(items, total, p, s);
|
||||
})
|
||||
|
||||
@@ -38,7 +38,7 @@ public class AuthService {
|
||||
if (acc == null) {
|
||||
log.warn("login account not found username={}", req.getUsername());
|
||||
} else {
|
||||
log.debug("login account loaded id={}, status={}, role={} userType={}", acc.getId(), acc.getStatus(), acc.getRole(), acc.getUserType());
|
||||
log.debug("login account loaded id={}, status={}, userType={}", acc.getId(), acc.getStatus(), acc.getUserType());
|
||||
}
|
||||
})
|
||||
.flatMap(acc -> validatePasswordAndBuild(acc, req.getPassword()))
|
||||
@@ -73,7 +73,7 @@ public class AuthService {
|
||||
String token = jwtService.generateToken(
|
||||
userType + ":" + acc.getId(),
|
||||
userType, acc.getId(), acc.getUsername(),
|
||||
"admin".equals(userType) ? Map.of("role", acc.getRole()) : Map.of("displayName", acc.getDisplayName())
|
||||
Map.of()
|
||||
);
|
||||
LoginResponse resp = new LoginResponse();
|
||||
resp.setAccessToken(token);
|
||||
|
||||
Reference in New Issue
Block a user