diff --git a/common/common-generator/src/main/java/cn/bunny/common/generator/generator/AdminCodeGenerator.java b/common/common-generator/src/main/java/cn/bunny/common/generator/generator/AdminCodeGenerator.java
index 6fc4758..c3de48f 100644
--- a/common/common-generator/src/main/java/cn/bunny/common/generator/generator/AdminCodeGenerator.java
+++ b/common/common-generator/src/main/java/cn/bunny/common/generator/generator/AdminCodeGenerator.java
@@ -20,7 +20,7 @@ public class AdminCodeGenerator {
public static final String entity = "Bunny";
public static void main(String[] args) {
- Generation("sys_dept", "sys_user_dept");
+ Generation("sys_files");
}
/**
diff --git a/dao/src/main/java/cn/bunny/dao/dto/i18n/I18nUpdateDto.java b/dao/src/main/java/cn/bunny/dao/dto/i18n/I18nUpdateDto.java
index 0cfa3ef..0d8b875 100644
--- a/dao/src/main/java/cn/bunny/dao/dto/i18n/I18nUpdateDto.java
+++ b/dao/src/main/java/cn/bunny/dao/dto/i18n/I18nUpdateDto.java
@@ -2,6 +2,7 @@ package cn.bunny.dao.dto.i18n;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -15,7 +16,7 @@ import lombok.NoArgsConstructor;
public class I18nUpdateDto {
@Schema(name = "id", title = "主键")
- @NotBlank(message = "id不能为空")
+ @NotNull(message = "id不能为空")
private Long id;
@Schema(name = "keyName", title = "多语言key")
diff --git a/dao/src/main/java/cn/bunny/dao/dto/system/files/FileUploadDto.java b/dao/src/main/java/cn/bunny/dao/dto/system/files/FileUploadDto.java
new file mode 100644
index 0000000..8aaed7b
--- /dev/null
+++ b/dao/src/main/java/cn/bunny/dao/dto/system/files/FileUploadDto.java
@@ -0,0 +1,23 @@
+package cn.bunny.dao.dto.system.files;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.springframework.web.multipart.MultipartFile;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+@Schema(name = "FileUploadDto对象", title = "文件上传", description = "文件上传管理")
+public class FileUploadDto {
+
+ @Schema(name = "file", title = "文件")
+ MultipartFile file;
+
+ @Schema(name = "type", title = "文件类型")
+ String type;
+
+}
\ No newline at end of file
diff --git a/dao/src/main/java/cn/bunny/dao/dto/system/user/AdminUserUpdateDto.java b/dao/src/main/java/cn/bunny/dao/dto/system/user/AdminUserUpdateDto.java
index 37c6f85..bad7ae5 100644
--- a/dao/src/main/java/cn/bunny/dao/dto/system/user/AdminUserUpdateDto.java
+++ b/dao/src/main/java/cn/bunny/dao/dto/system/user/AdminUserUpdateDto.java
@@ -2,6 +2,7 @@ package cn.bunny.dao.dto.system.user;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -14,6 +15,10 @@ import lombok.NoArgsConstructor;
@Schema(name = "AdminUserUpdateDto对象", title = "用户", description = "用户管理")
public class AdminUserUpdateDto {
+ @Schema(name = "id", title = "主键")
+ @NotNull(message = "id不能为空")
+ private Long id;
+
@Schema(name = "username", title = "用户名")
@NotBlank(message = "用户名不能为空")
private String username;
@@ -29,20 +34,16 @@ public class AdminUserUpdateDto {
@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;
+ private Byte sex;
@Schema(name = "summary", title = "个人描述")
private String summary;
@Schema(name = "status", title = "状态", description = "1:禁用 0:正常")
- private Boolean status = false;
+ private Boolean status;
}
\ No newline at end of file
diff --git a/dao/src/main/java/cn/bunny/dao/dto/system/user/UserUpdateWithPasswordDto.java b/dao/src/main/java/cn/bunny/dao/dto/system/user/UserUpdateWithPasswordDto.java
new file mode 100644
index 0000000..5167116
--- /dev/null
+++ b/dao/src/main/java/cn/bunny/dao/dto/system/user/UserUpdateWithPasswordDto.java
@@ -0,0 +1,28 @@
+package cn.bunny.dao.dto.system.user;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotEmpty;
+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 UserUpdateWithPasswordDto {
+
+ @Schema(name = "userId", title = "用户ID")
+ @NotNull(message = "用户ID不能为空")
+ private Long userId;
+
+ @Schema(name = "password", title = "用户密码")
+ @NotBlank(message = "密码不能为空")
+ @NotEmpty
+ private String password;
+
+}
diff --git a/dao/src/main/java/cn/bunny/dao/pojo/result/ResultCodeEnum.java b/dao/src/main/java/cn/bunny/dao/pojo/result/ResultCodeEnum.java
index bba2d02..7553a9e 100644
--- a/dao/src/main/java/cn/bunny/dao/pojo/result/ResultCodeEnum.java
+++ b/dao/src/main/java/cn/bunny/dao/pojo/result/ResultCodeEnum.java
@@ -32,6 +32,9 @@ public enum ResultCodeEnum {
DATA_EXIST(201, "数据已存在"),
DATA_NOT_EXIST(201, "数据不存在"),
REQUEST_IS_EMPTY(201, "请求数据为空"),
+ DATA_TOO_LARGE(201, "请求数据为空"),
+ USER_IS_EMPTY(201, "用户不存在"),
+ UPDATE_NEW_PASSWORD_SAME_AS_OLD_PASSWORD(201, "新密码与密码相同"),
// 数据相关 206
ILLEGAL_REQUEST(206, "非法请求"),
diff --git a/dao/src/main/java/cn/bunny/dao/vo/system/files/FileInfoVo.java b/dao/src/main/java/cn/bunny/dao/vo/system/files/FileInfoVo.java
new file mode 100644
index 0000000..4794bde
--- /dev/null
+++ b/dao/src/main/java/cn/bunny/dao/vo/system/files/FileInfoVo.java
@@ -0,0 +1,36 @@
+package cn.bunny.dao.vo.system.files;
+
+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 = "FileInfoVo对象", title = "管理端返回文件信息", description = "管理端返回文件信息")
+public class FileInfoVo extends BaseVo {
+
+ @Schema(name = "url", title = "文件的路径")
+ private String url;
+
+ @Schema(name = "filename", title = "文件的名称")
+ private String filename;
+
+ @Schema(name = "filepath", title = "文件在服务器上的存储路径")
+ private String filepath;
+
+ @Schema(name = "fileSize", title = "文件的大小,以字节为单位")
+ private Long fileSize;
+
+ @Schema(name = "size", title = "文件大小")
+ private String size;
+
+ @Schema(name = "fileType", title = "文件的MIME类型")
+ private String fileType;
+
+}
diff --git a/service/src/main/java/cn/bunny/services/Bunny/Files.java b/service/src/main/java/cn/bunny/services/Bunny/Files.java
new file mode 100644
index 0000000..f5ef409
--- /dev/null
+++ b/service/src/main/java/cn/bunny/services/Bunny/Files.java
@@ -0,0 +1,41 @@
+package cn.bunny.services.Bunny;
+
+import cn.bunny.dao.entity.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.experimental.Accessors;
+
+/**
+ *
+ * 系统文件表
+ *
+ *
+ * @author Bunny
+ * @since 2024-10-04
+ */
+@Getter
+@Setter
+@Accessors(chain = true)
+@TableName("sys_files")
+@ApiModel(value = "Files对象", description = "系统文件表")
+public class Files extends BaseEntity {
+
+ @Schema(name = "filename", title = "文件的名称")
+ private String filename;
+
+ @Schema(name = "filepath", title = "文件在服务器上的存储路径")
+ private String filepath;
+
+ @Schema(name = "fileSize", title = "文件的大小,以字节为单位")
+ private Long fileSize;
+
+ @Schema(name = "fileType", title = "文件的MIME类型")
+ private String fileType;
+
+ @Schema(name = "downloadCount", title = "下载数量")
+ private Integer downloadCount;
+
+}
diff --git a/service/src/main/java/cn/bunny/services/controller/FilesController.java b/service/src/main/java/cn/bunny/services/controller/FilesController.java
new file mode 100644
index 0000000..93f08c0
--- /dev/null
+++ b/service/src/main/java/cn/bunny/services/controller/FilesController.java
@@ -0,0 +1,35 @@
+package cn.bunny.services.controller;
+
+import cn.bunny.dao.dto.system.files.FileUploadDto;
+import cn.bunny.dao.pojo.result.Result;
+import cn.bunny.dao.pojo.result.ResultCodeEnum;
+import cn.bunny.dao.vo.system.files.FileInfoVo;
+import cn.bunny.services.service.FilesService;
+import io.swagger.v3.oas.annotations.Operation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ *
+ * 系统文件表 前端控制器
+ *
+ *
+ * @author Bunny
+ * @since 2024-10-04
+ */
+@RestController
+@RequestMapping("admin/files")
+public class FilesController {
+
+ @Autowired
+ private FilesService filesService;
+
+ @Operation(summary = "上传文件", description = "上传文件")
+ @PostMapping("upload")
+ public Result upload(FileUploadDto dto) {
+ FileInfoVo vo = filesService.upload(dto);
+ return Result.success(vo, ResultCodeEnum.SUCCESS_UPLOAD);
+ }
+}
diff --git a/service/src/main/java/cn/bunny/services/controller/UserController.java b/service/src/main/java/cn/bunny/services/controller/UserController.java
index 4e6efe8..4b56fef 100644
--- a/service/src/main/java/cn/bunny/services/controller/UserController.java
+++ b/service/src/main/java/cn/bunny/services/controller/UserController.java
@@ -1,9 +1,6 @@
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.dto.system.user.*;
import cn.bunny.dao.entity.system.AdminUser;
import cn.bunny.dao.pojo.result.PageResult;
import cn.bunny.dao.pojo.result.Result;
@@ -66,6 +63,13 @@ public class UserController {
return Mono.just(Result.success(ResultCodeEnum.DELETE_SUCCESS));
}
+ @Operation(summary = "管理员修改管理员用户密码", description = "管理员修改管理员用户密码")
+ @PutMapping("updateUserPasswordByAdmin")
+ public Result updateUserPasswordByAdmin(@Valid @RequestBody UserUpdateWithPasswordDto dto) {
+ userService.updateUserPasswordByAdmin(dto);
+ return Result.success(ResultCodeEnum.UPDATE_SUCCESS);
+ }
+
@Operation(summary = "登录发送邮件验证码", description = "登录发送邮件验证码")
@PostMapping("noAuth/sendLoginEmail")
public Result sendLoginEmail(String email) {
diff --git a/service/src/main/java/cn/bunny/services/controller/UserDeptController.java b/service/src/main/java/cn/bunny/services/controller/UserDeptController.java
index 9692d79..c27d8b4 100644
--- a/service/src/main/java/cn/bunny/services/controller/UserDeptController.java
+++ b/service/src/main/java/cn/bunny/services/controller/UserDeptController.java
@@ -1,5 +1,6 @@
package cn.bunny.services.controller;
+import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -11,6 +12,7 @@ import org.springframework.web.bind.annotation.RestController;
* @author Bunny
* @since 2024-10-04
*/
+@Tag(name = "用户和部门", description = "用户和部门相关接口")
@RestController
@RequestMapping("admin/userDept")
public class UserDeptController {
diff --git a/service/src/main/java/cn/bunny/services/mapper/FilesMapper.java b/service/src/main/java/cn/bunny/services/mapper/FilesMapper.java
new file mode 100644
index 0000000..bdab061
--- /dev/null
+++ b/service/src/main/java/cn/bunny/services/mapper/FilesMapper.java
@@ -0,0 +1,18 @@
+package cn.bunny.services.mapper;
+
+import cn.bunny.services.Bunny.Files;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ *
+ * 系统文件表 Mapper 接口
+ *
+ *
+ * @author Bunny
+ * @since 2024-10-04
+ */
+@Mapper
+public interface FilesMapper extends BaseMapper {
+
+}
diff --git a/service/src/main/java/cn/bunny/services/service/FilesService.java b/service/src/main/java/cn/bunny/services/service/FilesService.java
new file mode 100644
index 0000000..096e4ea
--- /dev/null
+++ b/service/src/main/java/cn/bunny/services/service/FilesService.java
@@ -0,0 +1,25 @@
+package cn.bunny.services.service;
+
+import cn.bunny.dao.dto.system.files.FileUploadDto;
+import cn.bunny.dao.vo.system.files.FileInfoVo;
+import cn.bunny.services.Bunny.Files;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ *
+ * 系统文件表 服务类
+ *
+ *
+ * @author Bunny
+ * @since 2024-10-04
+ */
+public interface FilesService extends IService {
+
+ /**
+ * * 上传文件
+ *
+ * @param dto 文件上传
+ * @return 管理端返回文件信息
+ */
+ FileInfoVo upload(FileUploadDto dto);
+}
diff --git a/service/src/main/java/cn/bunny/services/service/UserService.java b/service/src/main/java/cn/bunny/services/service/UserService.java
index 18a6d20..569138d 100644
--- a/service/src/main/java/cn/bunny/services/service/UserService.java
+++ b/service/src/main/java/cn/bunny/services/service/UserService.java
@@ -1,9 +1,6 @@
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.dto.system.user.*;
import cn.bunny.dao.entity.system.AdminUser;
import cn.bunny.dao.pojo.result.PageResult;
import cn.bunny.dao.vo.system.user.AdminUserVo;
@@ -82,4 +79,11 @@ public interface UserService extends IService {
* @return 用户信息
*/
UserVo getUserinfoById(Long id);
+
+ /**
+ * * 管理员修改管理员用户密码
+ *
+ * @param dto 管理员用户修改密码
+ */
+ void updateUserPasswordByAdmin(UserUpdateWithPasswordDto dto);
}
diff --git a/service/src/main/java/cn/bunny/services/service/impl/FilesServiceImpl.java b/service/src/main/java/cn/bunny/services/service/impl/FilesServiceImpl.java
new file mode 100644
index 0000000..32ab581
--- /dev/null
+++ b/service/src/main/java/cn/bunny/services/service/impl/FilesServiceImpl.java
@@ -0,0 +1,86 @@
+package cn.bunny.services.service.impl;
+
+import cn.bunny.common.service.context.BaseContext;
+import cn.bunny.common.service.exception.BunnyException;
+import cn.bunny.common.service.utils.FileUtil;
+import cn.bunny.common.service.utils.minio.MinioUtil;
+import cn.bunny.dao.dto.system.files.FileUploadDto;
+import cn.bunny.dao.pojo.common.MinioFIlePath;
+import cn.bunny.dao.pojo.result.ResultCodeEnum;
+import cn.bunny.dao.vo.system.files.FileInfoVo;
+import cn.bunny.services.Bunny.Files;
+import cn.bunny.services.mapper.FilesMapper;
+import cn.bunny.services.service.FilesService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.SneakyThrows;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ *
+ * 系统文件表 服务实现类
+ *
+ *
+ * @author Bunny
+ * @since 2024-10-04
+ */
+@Service
+public class FilesServiceImpl extends ServiceImpl implements FilesService {
+
+ @Autowired
+ private MinioUtil minioUtil;
+
+ @Value("${spring.servlet.multipart.max-file-size}")
+ private String maxFileSize;
+
+ /**
+ * * 上传文件
+ *
+ * @param dto 文件上传
+ * @return 管理端返回文件信息
+ */
+ @SneakyThrows
+ @Override
+ public FileInfoVo upload(FileUploadDto dto) {
+ MultipartFile file = dto.getFile();
+ String type = dto.getType();
+
+ // 管理员Id
+ Long userId = BaseContext.getUserId();
+ // 文件大小
+ long fileSize = file.getSize();
+ // 文件类型
+ String contentType = file.getContentType();
+ // 文件名
+ String filename = file.getOriginalFilename();
+
+ // 上传文件
+ MinioFIlePath minioFIlePath = minioUtil.getUploadMinioObjectFilePath(file, type);
+ String bucketNameFilepath = minioFIlePath.getBucketNameFilepath();
+
+ // 盘读研数据是否过大
+ String mb = maxFileSize.replace("MB", "");
+ if (fileSize / 1024 / 1024 > Long.parseLong(mb)) throw new BunnyException(ResultCodeEnum.DATA_TOO_LARGE);
+
+ // 插入文件信息
+ Files adminFiles = new Files();
+ adminFiles.setFileSize(fileSize);
+ adminFiles.setFileType(contentType);
+ adminFiles.setFilename(filename);
+ adminFiles.setFilepath(bucketNameFilepath);
+ adminFiles.setCreateUser(userId);
+ save(adminFiles);
+
+ // 返回信息内容化
+ return FileInfoVo.builder()
+ .size(FileUtil.getSize(fileSize))
+ .filepath(bucketNameFilepath)
+ .fileSize(fileSize)
+ .fileType(contentType)
+ .filename(filename)
+ .url(minioUtil.getObjectNameFullPath(bucketNameFilepath))
+ .build();
+ }
+}
diff --git a/service/src/main/java/cn/bunny/services/service/impl/UserServiceImpl.java b/service/src/main/java/cn/bunny/services/service/impl/UserServiceImpl.java
index 2596020..2540a6b 100644
--- a/service/src/main/java/cn/bunny/services/service/impl/UserServiceImpl.java
+++ b/service/src/main/java/cn/bunny/services/service/impl/UserServiceImpl.java
@@ -4,10 +4,7 @@ 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.dto.system.user.*;
import cn.bunny.dao.entity.system.AdminUser;
import cn.bunny.dao.entity.system.EmailUsers;
import cn.bunny.dao.pojo.common.EmailSendInit;
@@ -34,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.DigestUtils;
import org.springframework.util.StringUtils;
import java.util.List;
@@ -60,6 +58,7 @@ public class UserServiceImpl extends ServiceImpl implemen
@Autowired
private EmailFactory emailFactory;
+
@Autowired
private MinioUtil minioUtil;
@@ -135,6 +134,37 @@ public class UserServiceImpl extends ServiceImpl implemen
return userVo;
}
+ /**
+ * * 管理员修改管理员用户密码
+ *
+ * @param dto 管理员用户修改密码
+ */
+ @Override
+ public void updateUserPasswordByAdmin(UserUpdateWithPasswordDto dto) {
+ Long userId = dto.getUserId();
+ String password = dto.getPassword();
+
+ // 对密码加密
+ String md5Password = DigestUtils.md5DigestAsHex(password.getBytes());
+ AdminUser adminUser = getOne(Wrappers.lambdaQuery().eq(AdminUser::getId, userId));
+
+ // 判断是否存在这个用户
+ if (adminUser == null) {
+ throw new BunnyException(ResultCodeEnum.USER_IS_EMPTY);
+ }
+
+ // 判断新密码是否与旧密码相同
+ if (adminUser.getPassword().equals(md5Password)) {
+ throw new BunnyException(ResultCodeEnum.UPDATE_NEW_PASSWORD_SAME_AS_OLD_PASSWORD);
+ }
+
+ // 更新用户密码
+ adminUser = new AdminUser();
+ adminUser.setPassword(md5Password);
+ adminUser.setId(userId);
+ updateById(adminUser);
+ }
+
/**
* * 用户信息 服务实现类
*
@@ -148,9 +178,16 @@ public class UserServiceImpl extends ServiceImpl implemen
IPage page = baseMapper.selectListByPage(pageParams, dto);
List voList = page.getRecords().stream().map(AdminUser -> {
- AdminUserVo AdminUserVo = new AdminUserVo();
- BeanUtils.copyProperties(AdminUser, AdminUserVo);
- return AdminUserVo;
+ // 如果存在用户头像,则设置用户头像
+ String avatar = AdminUser.getAvatar();
+ if (StringUtils.hasText(avatar)) {
+ avatar = minioUtil.getObjectNameFullPath(avatar);
+ }
+
+ AdminUserVo adminUserVo = new AdminUserVo();
+ BeanUtils.copyProperties(AdminUser, adminUserVo);
+ adminUserVo.setAvatar(avatar);
+ return adminUserVo;
}).toList();
return PageResult.builder()
@@ -168,9 +205,19 @@ public class UserServiceImpl extends ServiceImpl implemen
*/
@Override
public void addAdminUser(@Valid AdminUserAddDto dto) {
+ // 对密码加密
+ String password = dto.getPassword();
+
// 保存数据
AdminUser adminUser = new AdminUser();
BeanUtils.copyProperties(dto, adminUser);
+
+ // 对密码加密
+ if (StringUtils.hasText(password)) {
+ password = DigestUtils.md5DigestAsHex(password.getBytes());
+ adminUser.setPassword(password);
+ }
+
save(adminUser);
}
@@ -181,7 +228,6 @@ public class UserServiceImpl extends ServiceImpl implemen
*/
@Override
public void updateAdminUser(@Valid AdminUserUpdateDto dto) {
- // 更新内容
AdminUser adminUser = new AdminUser();
BeanUtils.copyProperties(dto, adminUser);
updateById(adminUser);
diff --git a/service/src/main/resources/application.yml b/service/src/main/resources/application.yml
index 6efc37c..96a5dfe 100644
--- a/service/src/main/resources/application.yml
+++ b/service/src/main/resources/application.yml
@@ -6,6 +6,9 @@ spring:
active: @profiles.active@
application:
name: bunny-service
+ servlet:
+ multipart:
+ max-file-size: 6MB
datasource:
# type: com.zaxxer.hikari.HikariDataSource
diff --git a/service/src/main/resources/mapper/FilesMapper.xml b/service/src/main/resources/mapper/FilesMapper.xml
new file mode 100644
index 0000000..1e03719
--- /dev/null
+++ b/service/src/main/resources/mapper/FilesMapper.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id, filename, filepath, file_size, file_type, download_count, create_user, update_time, update_user, create_time, is_deleted
+
+
+
diff --git a/service/src/main/resources/mapper/UserMapper.xml b/service/src/main/resources/mapper/UserMapper.xml
index fbfde89..283eca2 100644
--- a/service/src/main/resources/mapper/UserMapper.xml
+++ b/service/src/main/resources/mapper/UserMapper.xml
@@ -56,7 +56,6 @@
status = #{dto.status}
- order by update_time
diff --git a/service/src/main/resources/static/user.jpg b/service/src/main/resources/static/user.jpg
new file mode 100644
index 0000000..4cb471f
Binary files /dev/null and b/service/src/main/resources/static/user.jpg differ