feat(新增): 用户CURD
This commit is contained in:
parent
54c2de2d93
commit
a3e6cd9e15
|
@ -3,11 +3,11 @@ package cn.bunny.common.generator.generator;
|
|||
import cn.bunny.common.generator.entity.BaseField;
|
||||
import cn.bunny.common.generator.entity.BaseResultMap;
|
||||
import cn.bunny.common.generator.utils.GeneratorCodeUtils;
|
||||
import cn.bunny.dao.dto.system.rolePower.PowerAddDto;
|
||||
import cn.bunny.dao.dto.system.rolePower.PowerDto;
|
||||
import cn.bunny.dao.dto.system.rolePower.PowerUpdateDto;
|
||||
import cn.bunny.dao.entity.system.Power;
|
||||
import cn.bunny.dao.vo.system.rolePower.PowerVo;
|
||||
import cn.bunny.dao.dto.system.user.AdminUserAddDto;
|
||||
import cn.bunny.dao.dto.system.user.AdminUserDto;
|
||||
import cn.bunny.dao.dto.system.user.AdminUserUpdateDto;
|
||||
import cn.bunny.dao.entity.system.AdminUser;
|
||||
import cn.bunny.dao.vo.system.user.AdminUserVo;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.google.common.base.CaseFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
@ -51,11 +51,11 @@ public class WebGeneratorCode {
|
|||
public static String resourceMapperPath = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service\\src\\main\\resources\\mapper\\";
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
Class<?> originalClass = Power.class;
|
||||
Class<?> dtoClass = PowerDto.class;
|
||||
Class<?> addDtoClass = PowerAddDto.class;
|
||||
Class<?> updateDtoClass = PowerUpdateDto.class;
|
||||
Class<?> voClass = PowerVo.class;
|
||||
Class<?> originalClass = AdminUser.class;
|
||||
Class<?> dtoClass = AdminUserDto.class;
|
||||
Class<?> addDtoClass = AdminUserAddDto.class;
|
||||
Class<?> updateDtoClass = AdminUserUpdateDto.class;
|
||||
Class<?> voClass = AdminUserVo.class;
|
||||
|
||||
// 设置velocity资源加载器
|
||||
Properties prop = new Properties();
|
||||
|
|
|
@ -10,10 +10,10 @@ export const columns: TableColumnList = [
|
|||
// $field.annotation
|
||||
{ label: $t('${lowercaseName}_$field.name'), prop: '$field.name' },
|
||||
#end
|
||||
{ label: $t('table.updateTime'), prop: 'updateTime', sortable: true },
|
||||
{ label: $t('table.createTime'), prop: 'createTime', sortable: true },
|
||||
{ label: $t('table.createUser'), prop: 'createUser', slot: 'createUser' },
|
||||
{ label: $t('table.updateUser'), prop: 'updateUser', slot: 'updateUser' },
|
||||
{ label: $t('table.updateTime'), prop: 'updateTime', sortable: true, width: 160 },
|
||||
{ label: $t('table.createTime'), prop: 'createTime', sortable: true, width: 160 },
|
||||
{ label: $t('table.createUser'), prop: 'createUser', slot: 'createUser', width: 90 },
|
||||
{ label: $t('table.updateUser'), prop: 'updateUser', slot: 'updateUser', width: 90 },
|
||||
{ label: $t('table.operation'), fixed: 'right', width: 210, slot: 'operation' },
|
||||
];
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package cn.bunny.dao.dto.system.rolePower;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
|
@ -14,10 +13,6 @@ import lombok.NoArgsConstructor;
|
|||
@Schema(name = "PowerDto对象", title = "权限", description = "权限管理")
|
||||
public class PowerDto {
|
||||
|
||||
@Schema(name = "parentId", title = "父级id")
|
||||
private Long parentId;
|
||||
|
||||
@ApiModelProperty("权限编码")
|
||||
@Schema(name = "parentId", title = "权限编码")
|
||||
private String powerCode;
|
||||
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
package cn.bunny.dao.dto.system.user;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Schema(name = "AdminUserAddDto对象", title = "用户", description = "用户管理")
|
||||
public class AdminUserAddDto {
|
||||
|
||||
@Schema(name = "username", title = "用户名")
|
||||
@NotBlank(message = "用户名不能为空")
|
||||
private String username;
|
||||
|
||||
@Schema(name = "nickName", title = "昵称")
|
||||
@NotBlank(message = "昵称不能为空")
|
||||
private String nickName;
|
||||
|
||||
@Schema(name = "email", title = "邮箱")
|
||||
@NotBlank(message = "邮箱不能为空")
|
||||
private String email;
|
||||
|
||||
@Schema(name = "phone", title = "手机号")
|
||||
private String phone;
|
||||
|
||||
@Schema(name = "password", title = "密码")
|
||||
@NotBlank(message = "密码不能为空")
|
||||
private String password;
|
||||
|
||||
@Schema(name = "avatar", title = "头像")
|
||||
private String avatar;
|
||||
|
||||
@Schema(name = "sex", title = "性别", description = "0:女 1:男")
|
||||
private Byte sex = 1;
|
||||
|
||||
@Schema(name = "summary", title = "个人描述")
|
||||
private String summary;
|
||||
|
||||
@Schema(name = "status", title = "状态", description = "1:禁用 0:正常")
|
||||
private Boolean status = false;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package cn.bunny.dao.dto.system.user;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Schema(name = "AdminUserAddDto对象", title = "用户", description = "用户管理")
|
||||
public class AdminUserDto {
|
||||
|
||||
@Schema(name = "username", title = "用户名")
|
||||
private String username;
|
||||
|
||||
@Schema(name = "nickName", title = "昵称")
|
||||
private String nickName;
|
||||
|
||||
@Schema(name = "email", title = "邮箱")
|
||||
private String email;
|
||||
|
||||
@Schema(name = "phone", title = "手机号")
|
||||
private String phone;
|
||||
|
||||
@Schema(name = "sex", title = "性别", description = "0:女 1:男")
|
||||
private Byte sex;
|
||||
|
||||
@Schema(name = "summary", title = "个人描述")
|
||||
private String summary;
|
||||
|
||||
@Schema(name = "status", title = "状态", description = "1:禁用 0:正常")
|
||||
private Boolean status;
|
||||
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package cn.bunny.dao.dto.system.user;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Schema(name = "AdminUserUpdateDto对象", title = "用户", description = "用户管理")
|
||||
public class AdminUserUpdateDto {
|
||||
|
||||
@Schema(name = "username", title = "用户名")
|
||||
@NotBlank(message = "用户名不能为空")
|
||||
private String username;
|
||||
|
||||
@Schema(name = "nickName", title = "昵称")
|
||||
@NotBlank(message = "昵称不能为空")
|
||||
private String nickName;
|
||||
|
||||
@Schema(name = "email", title = "邮箱")
|
||||
@NotBlank(message = "邮箱不能为空")
|
||||
private String email;
|
||||
|
||||
@Schema(name = "phone", title = "手机号")
|
||||
private String phone;
|
||||
|
||||
@Schema(name = "password", title = "密码")
|
||||
@NotBlank(message = "密码不能为空")
|
||||
private String password;
|
||||
|
||||
@Schema(name = "avatar", title = "头像")
|
||||
private String avatar;
|
||||
|
||||
@Schema(name = "sex", title = "性别", description = "0:女 1:男")
|
||||
private Byte sex = 1;
|
||||
|
||||
@Schema(name = "summary", title = "个人描述")
|
||||
private String summary;
|
||||
|
||||
@Schema(name = "status", title = "状态", description = "1:禁用 0:正常")
|
||||
private Boolean status = false;
|
||||
|
||||
}
|
|
@ -52,5 +52,6 @@ public class AdminUser extends BaseEntity {
|
|||
private String lastLoginIpAddress;
|
||||
|
||||
@Schema(name = "status", title = "状态", description = "1:禁用 0:正常")
|
||||
private Byte status;
|
||||
private Boolean status;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package cn.bunny.dao.vo.system.user;
|
||||
|
||||
import cn.bunny.dao.vo.BaseVo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Schema(name = "AdminUserVo对象", title = "用户信息", description = "用户信息")
|
||||
public class AdminUserVo extends BaseVo {
|
||||
@Schema(name = "username", title = "用户名")
|
||||
private String username;
|
||||
|
||||
@Schema(name = "nickName", title = "昵称")
|
||||
private String nickName;
|
||||
|
||||
@Schema(name = "email", title = "邮箱")
|
||||
private String email;
|
||||
|
||||
@Schema(name = "phone", title = "手机号")
|
||||
private String phone;
|
||||
|
||||
@Schema(name = "avatar", title = "头像")
|
||||
private String avatar;
|
||||
|
||||
@Schema(name = "sex", title = "性别", description = "0:女 1:男")
|
||||
private Byte sex;
|
||||
|
||||
@Schema(name = "summary", title = "个人描述")
|
||||
private String summary;
|
||||
|
||||
@Schema(name = "lastLoginIp", title = "最后登录IP")
|
||||
private String lastLoginIp;
|
||||
|
||||
@Schema(name = "lastLoginIpAddress", title = "最后登录ip归属地")
|
||||
private String lastLoginIpAddress;
|
||||
|
||||
@Schema(name = "status", title = "状态", description = "1:禁用 0:正常")
|
||||
private Boolean status;
|
||||
}
|
|
@ -1,20 +1,30 @@
|
|||
package cn.bunny.services.controller;
|
||||
|
||||
import cn.bunny.dao.dto.system.user.AdminUserAddDto;
|
||||
import cn.bunny.dao.dto.system.user.AdminUserDto;
|
||||
import cn.bunny.dao.dto.system.user.AdminUserUpdateDto;
|
||||
import cn.bunny.dao.dto.system.user.RefreshTokenDto;
|
||||
import cn.bunny.dao.entity.system.AdminUser;
|
||||
import cn.bunny.dao.pojo.result.PageResult;
|
||||
import cn.bunny.dao.pojo.result.Result;
|
||||
import cn.bunny.dao.pojo.result.ResultCodeEnum;
|
||||
import cn.bunny.dao.vo.system.user.AdminUserVo;
|
||||
import cn.bunny.dao.vo.system.user.RefreshTokenVo;
|
||||
import cn.bunny.dao.vo.system.user.UserVo;
|
||||
import cn.bunny.services.service.UserService;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name = "系统用户", description = "系统用户相关接口")
|
||||
|
||||
@Tag(name = "用户信息", description = "用户信息相关接口")
|
||||
@RestController
|
||||
@RequestMapping("/admin/user")
|
||||
public class UserController {
|
||||
|
@ -22,6 +32,40 @@ public class UserController {
|
|||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Operation(summary = "分页查询用户信息", description = "分页查询用户信息")
|
||||
@GetMapping("getAdminUserList/{page}/{limit}")
|
||||
public Mono<Result<PageResult<AdminUserVo>>> getAdminUserList(
|
||||
@Parameter(name = "page", description = "当前页", required = true)
|
||||
@PathVariable("page") Integer page,
|
||||
@Parameter(name = "limit", description = "每页记录数", required = true)
|
||||
@PathVariable("limit") Integer limit,
|
||||
AdminUserDto dto) {
|
||||
Page<AdminUser> pageParams = new Page<>(page, limit);
|
||||
PageResult<AdminUserVo> pageResult = userService.getAdminUserList(pageParams, dto);
|
||||
return Mono.just(Result.success(pageResult));
|
||||
}
|
||||
|
||||
@Operation(summary = "添加用户信息", description = "添加用户信息")
|
||||
@PostMapping("addAdminUser")
|
||||
public Mono<Result<String>> addAdminUser(@Valid @RequestBody AdminUserAddDto dto) {
|
||||
userService.addAdminUser(dto);
|
||||
return Mono.just(Result.success(ResultCodeEnum.ADD_SUCCESS));
|
||||
}
|
||||
|
||||
@Operation(summary = "更新用户信息", description = "更新用户信息")
|
||||
@PutMapping("updateAdminUser")
|
||||
public Mono<Result<String>> updateAdminUser(@Valid @RequestBody AdminUserUpdateDto dto) {
|
||||
userService.updateAdminUser(dto);
|
||||
return Mono.just(Result.success(ResultCodeEnum.UPDATE_SUCCESS));
|
||||
}
|
||||
|
||||
@Operation(summary = "删除用户信息", description = "删除用户信息")
|
||||
@DeleteMapping("deleteAdminUser")
|
||||
public Mono<Result<String>> deleteAdminUser(@RequestBody List<Long> ids) {
|
||||
userService.deleteAdminUser(ids);
|
||||
return Mono.just(Result.success(ResultCodeEnum.DELETE_SUCCESS));
|
||||
}
|
||||
|
||||
@Operation(summary = "登录发送邮件验证码", description = "登录发送邮件验证码")
|
||||
@PostMapping("noAuth/sendLoginEmail")
|
||||
public Result<String> sendLoginEmail(String email) {
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
package cn.bunny.services.mapper;
|
||||
|
||||
import cn.bunny.dao.dto.system.user.AdminUserDto;
|
||||
import cn.bunny.dao.entity.system.AdminUser;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -15,4 +21,19 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
@Mapper
|
||||
public interface UserMapper extends BaseMapper<AdminUser> {
|
||||
|
||||
/**
|
||||
* * 分页查询用户信息内容
|
||||
*
|
||||
* @param pageParams 用户信息分页参数
|
||||
* @param dto 用户信息查询表单
|
||||
* @return 用户信息分页结果
|
||||
*/
|
||||
IPage<AdminUser> selectListByPage(@Param("page") Page<AdminUser> pageParams, @Param("dto") AdminUserDto dto);
|
||||
|
||||
/**
|
||||
* 物理删除用户信息
|
||||
*
|
||||
* @param ids 删除 id 列表
|
||||
*/
|
||||
void deleteBatchIdsWithPhysics(List<Long> ids);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,21 @@
|
|||
package cn.bunny.services.service;
|
||||
|
||||
import cn.bunny.dao.dto.system.user.AdminUserAddDto;
|
||||
import cn.bunny.dao.dto.system.user.AdminUserDto;
|
||||
import cn.bunny.dao.dto.system.user.AdminUserUpdateDto;
|
||||
import cn.bunny.dao.dto.system.user.RefreshTokenDto;
|
||||
import cn.bunny.dao.entity.system.AdminUser;
|
||||
import cn.bunny.dao.pojo.result.PageResult;
|
||||
import cn.bunny.dao.vo.system.user.AdminUserVo;
|
||||
import cn.bunny.dao.vo.system.user.RefreshTokenVo;
|
||||
import cn.bunny.dao.vo.system.user.UserVo;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import jakarta.validation.Valid;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户信息 服务类
|
||||
|
@ -17,6 +26,34 @@ import org.jetbrains.annotations.NotNull;
|
|||
*/
|
||||
public interface UserService extends IService<AdminUser> {
|
||||
|
||||
/**
|
||||
* * 获取用户信息列表
|
||||
*
|
||||
* @return 用户信息返回列表
|
||||
*/
|
||||
PageResult<AdminUserVo> getAdminUserList(Page<AdminUser> pageParams, AdminUserDto dto);
|
||||
|
||||
/**
|
||||
* * 添加用户信息
|
||||
*
|
||||
* @param dto 添加表单
|
||||
*/
|
||||
void addAdminUser(@Valid AdminUserAddDto dto);
|
||||
|
||||
/**
|
||||
* * 更新用户信息
|
||||
*
|
||||
* @param dto 更新表单
|
||||
*/
|
||||
void updateAdminUser(@Valid AdminUserUpdateDto dto);
|
||||
|
||||
/**
|
||||
* * 删除|批量删除用户信息类型
|
||||
*
|
||||
* @param ids 删除id列表
|
||||
*/
|
||||
void deleteAdminUser(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 登录发送邮件验证码
|
||||
*
|
||||
|
|
|
@ -4,12 +4,17 @@ import cn.bunny.common.service.context.BaseContext;
|
|||
import cn.bunny.common.service.exception.BunnyException;
|
||||
import cn.bunny.common.service.utils.JwtHelper;
|
||||
import cn.bunny.common.service.utils.minio.MinioUtil;
|
||||
import cn.bunny.dao.dto.system.user.AdminUserAddDto;
|
||||
import cn.bunny.dao.dto.system.user.AdminUserDto;
|
||||
import cn.bunny.dao.dto.system.user.AdminUserUpdateDto;
|
||||
import cn.bunny.dao.dto.system.user.RefreshTokenDto;
|
||||
import cn.bunny.dao.entity.system.AdminUser;
|
||||
import cn.bunny.dao.entity.system.EmailUsers;
|
||||
import cn.bunny.dao.pojo.common.EmailSendInit;
|
||||
import cn.bunny.dao.pojo.constant.RedisUserConstant;
|
||||
import cn.bunny.dao.pojo.result.PageResult;
|
||||
import cn.bunny.dao.pojo.result.ResultCodeEnum;
|
||||
import cn.bunny.dao.vo.system.user.AdminUserVo;
|
||||
import cn.bunny.dao.vo.system.user.LoginVo;
|
||||
import cn.bunny.dao.vo.system.user.RefreshTokenVo;
|
||||
import cn.bunny.dao.vo.system.user.UserVo;
|
||||
|
@ -18,8 +23,11 @@ import cn.bunny.services.factory.UserFactory;
|
|||
import cn.bunny.services.mapper.EmailUsersMapper;
|
||||
import cn.bunny.services.mapper.UserMapper;
|
||||
import cn.bunny.services.service.UserService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.validation.Valid;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -28,6 +36,8 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 用户信息 服务实现类
|
||||
|
@ -85,7 +95,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, AdminUser> implemen
|
|||
AdminUser adminUser = getOne(Wrappers.<AdminUser>lambdaQuery().eq(AdminUser::getId, userId));
|
||||
|
||||
if (adminUser == null) throw new BunnyException(ResultCodeEnum.FAIL_REQUEST_NOT_AUTH);
|
||||
if (adminUser.getStatus() == 1) throw new BunnyException(ResultCodeEnum.FAIL_NO_ACCESS_DENIED_USER_LOCKED);
|
||||
if (adminUser.getStatus()) throw new BunnyException(ResultCodeEnum.FAIL_NO_ACCESS_DENIED_USER_LOCKED);
|
||||
|
||||
LoginVo buildUserVo = userFactory.buildUserVo(adminUser, dto.getReadMeDay());
|
||||
RefreshTokenVo refreshTokenVo = new RefreshTokenVo();
|
||||
|
@ -124,4 +134,66 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, AdminUser> implemen
|
|||
if (StringUtils.hasText(avatar)) userVo.setAvatar(minioUtil.getObjectNameFullPath(avatar));
|
||||
return userVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* * 用户信息 服务实现类
|
||||
*
|
||||
* @param pageParams 用户信息分页查询page对象
|
||||
* @param dto 用户信息分页查询对象
|
||||
* @return 查询分页用户信息返回对象
|
||||
*/
|
||||
@Override
|
||||
public PageResult<AdminUserVo> getAdminUserList(Page<AdminUser> pageParams, AdminUserDto dto) {
|
||||
// 分页查询菜单图标
|
||||
IPage<AdminUser> page = baseMapper.selectListByPage(pageParams, dto);
|
||||
|
||||
List<AdminUserVo> voList = page.getRecords().stream().map(AdminUser -> {
|
||||
AdminUserVo AdminUserVo = new AdminUserVo();
|
||||
BeanUtils.copyProperties(AdminUser, AdminUserVo);
|
||||
return AdminUserVo;
|
||||
}).toList();
|
||||
|
||||
return PageResult.<AdminUserVo>builder()
|
||||
.list(voList)
|
||||
.pageNo(page.getCurrent())
|
||||
.pageSize(page.getSize())
|
||||
.total(page.getTotal())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加用户信息
|
||||
*
|
||||
* @param dto 用户信息添加
|
||||
*/
|
||||
@Override
|
||||
public void addAdminUser(@Valid AdminUserAddDto dto) {
|
||||
// 保存数据
|
||||
AdminUser adminUser = new AdminUser();
|
||||
BeanUtils.copyProperties(dto, adminUser);
|
||||
save(adminUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户信息
|
||||
*
|
||||
* @param dto 用户信息更新
|
||||
*/
|
||||
@Override
|
||||
public void updateAdminUser(@Valid AdminUserUpdateDto dto) {
|
||||
// 更新内容
|
||||
AdminUser adminUser = new AdminUser();
|
||||
BeanUtils.copyProperties(dto, adminUser);
|
||||
updateById(adminUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除|批量删除用户信息
|
||||
*
|
||||
* @param ids 删除id列表
|
||||
*/
|
||||
@Override
|
||||
public void deleteAdminUser(List<Long> ids) {
|
||||
baseMapper.deleteBatchIdsWithPhysics(ids);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,9 +27,6 @@
|
|||
<include refid="Base_Column_List"/>
|
||||
from sys_power
|
||||
<where>
|
||||
<if test="dto.parentId != null and dto.parentId != ''">
|
||||
parent_id like CONCAT('%',#{dto.parentId},'%')
|
||||
</if>
|
||||
<if test="dto.powerCode != null and dto.powerCode != ''">
|
||||
power_code like CONCAT('%',#{dto.powerCode},'%')
|
||||
</if>
|
||||
|
|
|
@ -28,4 +28,45 @@
|
|||
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>
|
||||
|
||||
<!-- 分页查询用户信息内容 -->
|
||||
<select id="selectListByPage" resultType="cn.bunny.dao.entity.system.AdminUser">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from sys_user
|
||||
<where>
|
||||
<if test="dto.username != null and dto.username != ''">
|
||||
username like CONCAT('%',#{dto.username},'%')
|
||||
</if>
|
||||
<if test="dto.nickName != null and dto.nickName != ''">
|
||||
nick_name like CONCAT('%',#{dto.nickName},'%')
|
||||
</if>
|
||||
<if test="dto.email != null and dto.email != ''">
|
||||
email like CONCAT('%',#{dto.email},'%')
|
||||
</if>
|
||||
<if test="dto.phone != null and dto.phone != ''">
|
||||
phone like CONCAT('%',#{dto.phone},'%')
|
||||
</if>
|
||||
<if test="dto.sex != null and dto.sex != ''">
|
||||
sex = #{dto.sex}
|
||||
</if>
|
||||
<if test="dto.summary != null and dto.summary != ''">
|
||||
summary like CONCAT('%',#{dto.summary},'%')
|
||||
</if>
|
||||
<if test="dto.status != null and dto.status != ''">
|
||||
status = #{dto.status}
|
||||
</if>
|
||||
</where>
|
||||
order by update_time
|
||||
</select>
|
||||
|
||||
<!-- 物理删除用户信息 -->
|
||||
<delete id="deleteBatchIdsWithPhysics">
|
||||
delete
|
||||
from sys_user
|
||||
where id in
|
||||
<foreach collection="ids" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue