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