mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-10-31 00:57:13 +08:00 
			
		
		
		
	refactor: 调整部分 Query 查询参数类型为对应枚举(目前已支持非 JSON 格式枚举参数转换)
This commit is contained in:
		| @@ -47,7 +47,7 @@ public class FileStorageConfigLoader implements ApplicationRunner { | ||||
|     @Override | ||||
|     public void run(ApplicationArguments args) { | ||||
|         StorageQuery query = new StorageQuery(); | ||||
|         query.setStatus(DisEnableStatusEnum.ENABLE.getValue()); | ||||
|         query.setStatus(DisEnableStatusEnum.ENABLE); | ||||
|         List<StorageResp> storageList = storageService.list(query, null); | ||||
|         if (CollUtil.isEmpty(storageList)) { | ||||
|             return; | ||||
|   | ||||
| @@ -18,6 +18,7 @@ package top.continew.admin.system.model.query; | ||||
|  | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
| import lombok.Data; | ||||
| import top.continew.admin.common.enums.DisEnableStatusEnum; | ||||
| import top.continew.starter.data.core.annotation.Query; | ||||
| import top.continew.starter.data.core.enums.QueryType; | ||||
|  | ||||
| @@ -47,6 +48,6 @@ public class DeptQuery implements Serializable { | ||||
|     /** | ||||
|      * 状态 | ||||
|      */ | ||||
|     @Schema(description = "状态(1:启用;2:禁用)", example = "1") | ||||
|     private Integer status; | ||||
|     @Schema(description = "状态", example = "1") | ||||
|     private DisEnableStatusEnum status; | ||||
| } | ||||
|   | ||||
| @@ -18,6 +18,7 @@ package top.continew.admin.system.model.query; | ||||
|  | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
| import lombok.Data; | ||||
| import top.continew.admin.common.enums.DisEnableStatusEnum; | ||||
| import top.continew.starter.data.core.annotation.Query; | ||||
| import top.continew.starter.data.core.enums.QueryType; | ||||
|  | ||||
| @@ -47,8 +48,8 @@ public class DictItemQuery implements Serializable { | ||||
|     /** | ||||
|      * 状态 | ||||
|      */ | ||||
|     @Schema(description = "状态(1:启用;2:禁用)", example = "1") | ||||
|     private Integer status; | ||||
|     @Schema(description = "状态", example = "1") | ||||
|     private DisEnableStatusEnum status; | ||||
|  | ||||
|     /** | ||||
|      * 字典 ID | ||||
|   | ||||
| @@ -18,6 +18,7 @@ package top.continew.admin.system.model.query; | ||||
|  | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
| import lombok.Data; | ||||
| import top.continew.admin.system.enums.FileTypeEnum; | ||||
| import top.continew.starter.data.core.annotation.Query; | ||||
| import top.continew.starter.data.core.enums.QueryType; | ||||
|  | ||||
| @@ -40,13 +41,13 @@ public class FileQuery implements Serializable { | ||||
|     /** | ||||
|      * 名称 | ||||
|      */ | ||||
|     @Schema(description = "名称") | ||||
|     @Schema(description = "名称", example = "图片") | ||||
|     @Query(type = QueryType.LIKE) | ||||
|     private String name; | ||||
|  | ||||
|     /** | ||||
|      * 类型 | ||||
|      */ | ||||
|     @Schema(description = "类型") | ||||
|     private Integer type; | ||||
|     @Schema(description = "类型", example = "2") | ||||
|     private FileTypeEnum type; | ||||
| } | ||||
| @@ -21,6 +21,7 @@ import io.swagger.v3.oas.annotations.media.Schema; | ||||
| import jakarta.validation.constraints.Size; | ||||
| import lombok.Data; | ||||
| import org.springframework.format.annotation.DateTimeFormat; | ||||
| import top.continew.admin.common.enums.DisEnableStatusEnum; | ||||
|  | ||||
| import java.io.Serial; | ||||
| import java.io.Serializable; | ||||
| @@ -75,6 +76,6 @@ public class LogQuery implements Serializable { | ||||
|     /** | ||||
|      * 状态 | ||||
|      */ | ||||
|     @Schema(description = "状态(1:成功;2:失败)", example = "1") | ||||
|     private Integer status; | ||||
|     @Schema(description = "状态", example = "1") | ||||
|     private DisEnableStatusEnum status; | ||||
| } | ||||
|   | ||||
| @@ -19,6 +19,7 @@ package top.continew.admin.system.model.query; | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
| import lombok.Data; | ||||
| import lombok.NoArgsConstructor; | ||||
| import top.continew.admin.common.enums.DisEnableStatusEnum; | ||||
| import top.continew.starter.data.core.annotation.Query; | ||||
| import top.continew.starter.data.core.enums.QueryType; | ||||
|  | ||||
| @@ -49,10 +50,10 @@ public class MenuQuery implements Serializable { | ||||
|     /** | ||||
|      * 状态 | ||||
|      */ | ||||
|     @Schema(description = "状态(1:启用;2:禁用)", example = "1") | ||||
|     private Integer status; | ||||
|     @Schema(description = "状态", example = "1") | ||||
|     private DisEnableStatusEnum status; | ||||
|  | ||||
|     public MenuQuery(Integer status) { | ||||
|     public MenuQuery(DisEnableStatusEnum status) { | ||||
|         this.status = status; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -18,6 +18,7 @@ package top.continew.admin.system.model.query; | ||||
|  | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
| import lombok.Data; | ||||
| import top.continew.admin.common.enums.MessageTypeEnum; | ||||
| import top.continew.starter.data.core.annotation.Query; | ||||
| import top.continew.starter.data.core.annotation.QueryIgnore; | ||||
| import top.continew.starter.data.core.enums.QueryType; | ||||
| @@ -54,8 +55,8 @@ public class MessageQuery implements Serializable { | ||||
|     /** | ||||
|      * 类型 | ||||
|      */ | ||||
|     @Schema(description = "类型(1:系统消息)", example = "1") | ||||
|     private Integer type; | ||||
|     @Schema(description = "类型", example = "1") | ||||
|     private MessageTypeEnum type; | ||||
|  | ||||
|     /** | ||||
|      * 是否已读 | ||||
|   | ||||
| @@ -18,6 +18,7 @@ package top.continew.admin.system.model.query; | ||||
|  | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
| import lombok.Data; | ||||
| import top.continew.admin.common.enums.DisEnableStatusEnum; | ||||
| import top.continew.starter.data.core.annotation.Query; | ||||
| import top.continew.starter.data.core.enums.QueryType; | ||||
|  | ||||
| @@ -47,6 +48,6 @@ public class StorageQuery implements Serializable { | ||||
|     /** | ||||
|      * 状态 | ||||
|      */ | ||||
|     @Schema(description = "状态(1:启用;2:禁用)", example = "1") | ||||
|     private Integer status; | ||||
|     @Schema(description = "状态", example = "1") | ||||
|     private DisEnableStatusEnum status; | ||||
| } | ||||
| @@ -21,6 +21,7 @@ import io.swagger.v3.oas.annotations.media.Schema; | ||||
| import jakarta.validation.constraints.Size; | ||||
| import lombok.Data; | ||||
| import org.springframework.format.annotation.DateTimeFormat; | ||||
| import top.continew.admin.common.enums.DisEnableStatusEnum; | ||||
|  | ||||
| import java.io.Serial; | ||||
| import java.io.Serializable; | ||||
| @@ -49,8 +50,8 @@ public class UserQuery implements Serializable { | ||||
|     /** | ||||
|      * 状态 | ||||
|      */ | ||||
|     @Schema(description = "状态(1:启用;2:禁用)", example = "1") | ||||
|     private Integer status; | ||||
|     @Schema(description = "状态", example = "1") | ||||
|     private DisEnableStatusEnum status; | ||||
|  | ||||
|     /** | ||||
|      * 创建时间 | ||||
|   | ||||
| @@ -29,6 +29,7 @@ import lombok.RequiredArgsConstructor; | ||||
| import lombok.extern.slf4j.Slf4j; | ||||
| import org.springframework.data.domain.Sort; | ||||
| import org.springframework.stereotype.Service; | ||||
| import top.continew.admin.common.enums.DisEnableStatusEnum; | ||||
| import top.continew.admin.system.mapper.LogMapper; | ||||
| import top.continew.admin.system.model.entity.LogDO; | ||||
| import top.continew.admin.system.model.query.LogQuery; | ||||
| @@ -151,7 +152,7 @@ public class LogServiceImpl implements LogService { | ||||
|         String module = query.getModule(); | ||||
|         String ip = query.getIp(); | ||||
|         String createUserString = query.getCreateUserString(); | ||||
|         Integer status = query.getStatus(); | ||||
|         DisEnableStatusEnum status = query.getStatus(); | ||||
|         List<Date> createTimeList = query.getCreateTime(); | ||||
|         return new QueryWrapper<LogDO>().and(StrUtil.isNotBlank(description), q -> q.like("t1.description", description) | ||||
|             .or() | ||||
|   | ||||
| @@ -82,7 +82,7 @@ public class MenuServiceImpl extends BaseServiceImpl<MenuMapper, MenuDO, MenuRes | ||||
|     @Override | ||||
|     @Cached(key = "'ALL'", name = CacheConstants.MENU_KEY_PREFIX) | ||||
|     public List<MenuResp> listAll() { | ||||
|         return super.list(new MenuQuery(DisEnableStatusEnum.ENABLE.getValue()), null); | ||||
|         return super.list(new MenuQuery(DisEnableStatusEnum.ENABLE), null); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|   | ||||
| @@ -471,7 +471,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes | ||||
|     @Override | ||||
|     protected QueryWrapper<UserDO> buildQueryWrapper(UserQuery query) { | ||||
|         String description = query.getDescription(); | ||||
|         Integer status = query.getStatus(); | ||||
|         DisEnableStatusEnum status = query.getStatus(); | ||||
|         List<Date> createTimeList = query.getCreateTime(); | ||||
|         Long deptId = query.getDeptId(); | ||||
|         return new QueryWrapper<UserDO>().and(StrUtil.isNotBlank(description), q -> q.like("t1.username", description) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user