|
|
|
@ -81,7 +81,7 @@ public class AdminController {
|
|
|
|
|
private String tel;
|
|
|
|
|
@Schema(title = "密码")
|
|
|
|
|
private String password;
|
|
|
|
|
@Schema(title = "角色id",description = "多个角色用','分隔")
|
|
|
|
|
@Schema(title = "角色id", description = "多个角色用','分隔")
|
|
|
|
|
private String roleIds;
|
|
|
|
|
@Schema(title = "真实名称")
|
|
|
|
|
private String realName;
|
|
|
|
@ -115,7 +115,7 @@ public class AdminController {
|
|
|
|
|
private String tel;
|
|
|
|
|
@Schema(title = "密码")
|
|
|
|
|
private String password;
|
|
|
|
|
@Schema(title = "角色id",description = "多个角色用','分隔")
|
|
|
|
|
@Schema(title = "角色id", description = "多个角色用','分隔")
|
|
|
|
|
private String roleIds;
|
|
|
|
|
@Schema(title = "真实名称")
|
|
|
|
|
private String realName;
|
|
|
|
@ -131,23 +131,23 @@ public class AdminController {
|
|
|
|
|
if (null == adminService.getOne(up)) {
|
|
|
|
|
return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "未找到该用户!");
|
|
|
|
|
}
|
|
|
|
|
up.set(param.getName()!=null,"name",param.getName() );
|
|
|
|
|
up.set(param.getName()!=null,"tel",param.getName() );
|
|
|
|
|
up.set(param.getName()!=null,"password",param.getName() );
|
|
|
|
|
up.set(param.getName()!=null,"roleIds",param.getName() );
|
|
|
|
|
up.set(param.getName()!=null,"realName",param.getName() );
|
|
|
|
|
up.set("updateAt",LocalDateTime.now());
|
|
|
|
|
return Result.success( adminService.update(up));
|
|
|
|
|
up.set(param.getName() != null, "name", param.getName());
|
|
|
|
|
up.set(param.getName() != null, "tel", param.getName());
|
|
|
|
|
up.set(param.getName() != null, "password", param.getName());
|
|
|
|
|
up.set(param.getName() != null, "roleIds", param.getName());
|
|
|
|
|
up.set(param.getName() != null, "realName", param.getName());
|
|
|
|
|
up.set("updateAt", LocalDateTime.now());
|
|
|
|
|
return Result.success(adminService.update(up));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Data
|
|
|
|
|
static class AdminStatusParam {
|
|
|
|
|
static class AdminStatusParam {
|
|
|
|
|
@NotNull(message = "账号id不能为空")
|
|
|
|
|
@Schema(title = "账号id")
|
|
|
|
|
private String id;
|
|
|
|
|
@NotNull(message = "open不能为空")
|
|
|
|
|
@Schema(title = "开启或禁用",description = "open为true为开启;为false为禁用")
|
|
|
|
|
private boolean open;
|
|
|
|
|
// @NotNull(message = "open不能为空")
|
|
|
|
|
// @Schema(title = "开启或禁用",description = "open为true为开启;为false为禁用")
|
|
|
|
|
// private boolean open;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "切换账户状态")
|
|
|
|
@ -155,19 +155,19 @@ public class AdminController {
|
|
|
|
|
@AdminTokenValid
|
|
|
|
|
@AdminCheckAuthorityAnnotation(jurisdictionId = "27")
|
|
|
|
|
public Result switchStatus(@Validated @RequestBody AdminStatusParam param) {
|
|
|
|
|
int status = param.open?1:2;
|
|
|
|
|
// int status = param.open?1:2;
|
|
|
|
|
UpdateWrapper<Admin> up = new UpdateWrapper<>();
|
|
|
|
|
up.eq("id", param.getId());
|
|
|
|
|
Admin admin = adminService.getOne(up);
|
|
|
|
|
if (null == admin) {
|
|
|
|
|
return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "未找到该用户!");
|
|
|
|
|
}
|
|
|
|
|
if(admin.getStatus() == status) {
|
|
|
|
|
return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "未发生改动!");
|
|
|
|
|
}
|
|
|
|
|
up.set("status",status );
|
|
|
|
|
up.set("updateAt",LocalDateTime.now());
|
|
|
|
|
return Result.success( adminService.update(up));
|
|
|
|
|
// if(admin.getStatus() == status) {
|
|
|
|
|
// return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "未发生改动!");
|
|
|
|
|
// }
|
|
|
|
|
up.set("status", admin.getStatus() == 1 ? 2 : 1);
|
|
|
|
|
up.set("updateAt", LocalDateTime.now());
|
|
|
|
|
return Result.success(adminService.update(up), "修改完成");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Data
|
|
|
|
@ -187,9 +187,9 @@ public class AdminController {
|
|
|
|
|
@AdminTokenValid
|
|
|
|
|
public Result list(@Validated @RequestBody adminListParam param) {
|
|
|
|
|
QueryWrapper<Admin> qw = new QueryWrapper<>();
|
|
|
|
|
qw.like(param.getName()!=null,"name",param.getName() );
|
|
|
|
|
qw.like(param.getTel()!=null,"tel",param.getTel() );
|
|
|
|
|
qw.like(param.getRealName()!=null,"realName",param.getRealName() );
|
|
|
|
|
return Result.success( adminService.page(MybatisPlusUtil.SetNumPage(param.getPageNum(), param.getPageSize()),qw));
|
|
|
|
|
qw.like(param.getName() != null, "name", param.getName());
|
|
|
|
|
qw.like(param.getTel() != null, "tel", param.getTel());
|
|
|
|
|
qw.like(param.getRealName() != null, "realName", param.getRealName());
|
|
|
|
|
return Result.success(adminService.page(MybatisPlusUtil.SetNumPage(param.getPageNum(), param.getPageSize()), qw));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|