refactor: 优化 QueryTypeEnum 枚举值命名
This commit is contained in:
parent
2df4cceedd
commit
9648cf64a4
@ -16,22 +16,18 @@
|
||||
|
||||
package top.charles7c.continew.admin.monitor.model.query;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import top.charles7c.continew.starter.data.mybatis.plus.query.Query;
|
||||
import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
|
||||
import top.charles7c.continew.starter.data.mybatis.plus.query.Query;
|
||||
import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType;
|
||||
|
||||
/**
|
||||
* 操作日志查询条件
|
||||
*
|
||||
@ -49,7 +45,7 @@ public class OperationLogQuery implements Serializable {
|
||||
* 操作内容
|
||||
*/
|
||||
@Schema(description = "操作内容", example = "新增数据")
|
||||
@Query(type = QueryType.INNER_LIKE)
|
||||
@Query(type = QueryType.LIKE)
|
||||
private String description;
|
||||
|
||||
/**
|
||||
@ -71,6 +67,6 @@ public class OperationLogQuery implements Serializable {
|
||||
* 操作人
|
||||
*/
|
||||
@Schema(description = "操作人", example = "张三")
|
||||
@Query(property = "createUser")
|
||||
@Query(columns = "create_user")
|
||||
private Long uid;
|
||||
}
|
||||
|
@ -43,13 +43,13 @@ public class AnnouncementQuery implements Serializable {
|
||||
* 标题
|
||||
*/
|
||||
@Schema(description = "标题", example = "这是公告标题")
|
||||
@Query(type = QueryType.INNER_LIKE)
|
||||
@Query(type = QueryType.LIKE)
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@Schema(description = "类型", example = "1")
|
||||
@Query(type = QueryType.EQUAL)
|
||||
@Query
|
||||
private String type;
|
||||
}
|
@ -43,7 +43,7 @@ public class DeptQuery implements Serializable {
|
||||
* 名称
|
||||
*/
|
||||
@Schema(description = "名称", example = "测试部")
|
||||
@Query(type = QueryType.INNER_LIKE)
|
||||
@Query(type = QueryType.LIKE)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
|
@ -16,15 +16,14 @@
|
||||
|
||||
package top.charles7c.continew.admin.system.model.query;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import top.charles7c.continew.starter.data.mybatis.plus.query.Query;
|
||||
import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import top.charles7c.continew.starter.data.mybatis.plus.query.Query;
|
||||
|
||||
/**
|
||||
* 字典查询条件
|
||||
*
|
||||
@ -42,7 +41,7 @@ public class DictQuery implements Serializable {
|
||||
* 名称
|
||||
*/
|
||||
@Schema(description = "名称")
|
||||
@Query(blurry = {"code", "name", "description"})
|
||||
@Query(columns = {"name", "code", "description"}, type = QueryType.LIKE)
|
||||
private String name;
|
||||
|
||||
}
|
@ -43,13 +43,13 @@ public class FileQuery implements Serializable {
|
||||
* 名称
|
||||
*/
|
||||
@Schema(description = "名称")
|
||||
@Query(type = QueryType.INNER_LIKE)
|
||||
@Query(type = QueryType.LIKE)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@Schema(description = "类型")
|
||||
@Query(type = QueryType.EQUAL)
|
||||
@Query
|
||||
private Integer type;
|
||||
}
|
@ -43,7 +43,7 @@ public class MenuQuery implements Serializable {
|
||||
* 标题
|
||||
*/
|
||||
@Schema(description = "标题", example = "用户管理")
|
||||
@Query(type = QueryType.INNER_LIKE)
|
||||
@Query(type = QueryType.LIKE)
|
||||
private String title;
|
||||
|
||||
/**
|
||||
|
@ -48,7 +48,7 @@ public class MessageQuery implements Serializable {
|
||||
* 标题
|
||||
*/
|
||||
@Schema(description = "标题", example = "欢迎注册 xxx")
|
||||
@Query(type = QueryType.INNER_LIKE)
|
||||
@Query(type = QueryType.LIKE)
|
||||
private String title;
|
||||
|
||||
/**
|
||||
|
@ -16,15 +16,14 @@
|
||||
|
||||
package top.charles7c.continew.admin.system.model.query;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import top.charles7c.continew.starter.data.mybatis.plus.query.Query;
|
||||
import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import top.charles7c.continew.starter.data.mybatis.plus.query.Query;
|
||||
|
||||
/**
|
||||
* 角色查询条件
|
||||
*
|
||||
@ -42,7 +41,7 @@ public class RoleQuery implements Serializable {
|
||||
* 名称
|
||||
*/
|
||||
@Schema(description = "名称", example = "测试人员")
|
||||
@Query(blurry = {"name", "code"})
|
||||
@Query(columns = {"name", "code"}, type = QueryType.LIKE)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
|
@ -43,13 +43,13 @@ public class StorageQuery implements Serializable {
|
||||
* 名称
|
||||
*/
|
||||
@Schema(description = "名称")
|
||||
@Query(type = QueryType.INNER_LIKE)
|
||||
@Query(type = QueryType.LIKE)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@Schema(description = "状态")
|
||||
@Query(type = QueryType.EQUAL)
|
||||
@Query
|
||||
private Integer status;
|
||||
}
|
@ -16,22 +16,18 @@
|
||||
|
||||
package top.charles7c.continew.admin.system.model.query;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import top.charles7c.continew.starter.data.mybatis.plus.query.Query;
|
||||
import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
|
||||
import top.charles7c.continew.starter.data.mybatis.plus.query.Query;
|
||||
import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType;
|
||||
|
||||
/**
|
||||
* 用户查询条件
|
||||
*
|
||||
@ -49,7 +45,7 @@ public class UserQuery implements Serializable {
|
||||
* 用户名
|
||||
*/
|
||||
@Schema(description = "用户名", example = "zhangsan")
|
||||
@Query(blurry = {"username", "nickname", "email", "phone"})
|
||||
@Query(columns = {"username", "nickname", "email", "phone"}, type = QueryType.LIKE)
|
||||
private String username;
|
||||
|
||||
/**
|
||||
|
@ -32,57 +32,70 @@ import top.charles7c.continew.starter.data.mybatis.plus.base.IBaseEnum;
|
||||
public enum QueryTypeEnum implements IBaseEnum<Integer> {
|
||||
|
||||
/**
|
||||
* 等值查询,例如:WHERE `age` = 18
|
||||
* 等于 =,例如:WHERE `age` = 18
|
||||
*/
|
||||
EQUAL(1, "="),
|
||||
EQ(1, "="),
|
||||
|
||||
/**
|
||||
* 非等值查询,例如:WHERE `age` != 18
|
||||
* 不等于 !=,例如:WHERE `age` != 18
|
||||
*/
|
||||
NOT_EQUAL(2, "!="),
|
||||
NE(2, "!="),
|
||||
|
||||
/**
|
||||
* 大于查询,例如:WHERE `age` > 18
|
||||
* 大于 >,例如:WHERE `age` > 18
|
||||
*/
|
||||
GREATER_THAN(3, ">"),
|
||||
GT(3, ">"),
|
||||
|
||||
/**
|
||||
* 小于查询,例如:WHERE `age` < 18
|
||||
* 大于等于 >= ,例如:WHERE `age` >= 18
|
||||
*/
|
||||
LESS_THAN(4, "<"),
|
||||
GE(4, ">="),
|
||||
|
||||
/**
|
||||
* 大于等于查询,例如:WHERE `age` >= 18
|
||||
* 小于 <,例如:WHERE `age` < 18
|
||||
*/
|
||||
GREATER_THAN_OR_EQUAL(5, ">="),
|
||||
LT(5, "<"),
|
||||
|
||||
/**
|
||||
* 小于等于查询,例如:WHERE `age` <= 18
|
||||
* 小于等于 <=,例如:WHERE `age` <= 18
|
||||
*/
|
||||
LESS_THAN_OR_EQUAL(6, "<="),
|
||||
LE(6, "<="),
|
||||
|
||||
/**
|
||||
* 范围查询,例如:WHERE `age` BETWEEN 10 AND 18
|
||||
*/
|
||||
BETWEEN(7, "BETWEEN"),
|
||||
|
||||
/**
|
||||
* 左模糊查询,例如:WHERE `nickname` LIKE '%s'
|
||||
* LIKE '%值%',例如:WHERE `nickname` LIKE '%s%'
|
||||
*/
|
||||
LEFT_LIKE(8, "LIKE '%s'"),
|
||||
LIKE(8, "LIKE '%s%'"),
|
||||
|
||||
/**
|
||||
* 中模糊查询,例如:WHERE `nickname` LIKE '%s%'
|
||||
* LIKE '%值',例如:WHERE `nickname` LIKE '%s'
|
||||
*/
|
||||
INNER_LIKE(9, "LIKE '%s%'"),
|
||||
LIKE_LEFT(9, "LIKE '%s'"),
|
||||
|
||||
/**
|
||||
* 右模糊查询,例如:WHERE `nickname` LIKE 's%'
|
||||
* LIKE '值%',例如:WHERE `nickname` LIKE 's%'
|
||||
*/
|
||||
RIGHT_LIKE(10, "LIKE 's%'"),
|
||||
LIKE_RIGHT(10, "LIKE 's%'"),
|
||||
|
||||
/**
|
||||
* 包含查询,例如:WHERE `age` IN (10, 20, 30)
|
||||
*/
|
||||
IN(11, "IN"),
|
||||
|
||||
/**
|
||||
* 不包含查询,例如:WHERE `age` NOT IN (20, 30)
|
||||
*/
|
||||
NOT_IN(12, "NOT IN"),
|
||||
|
||||
/**
|
||||
* 空查询,例如:WHERE `email` IS NULL
|
||||
*/
|
||||
IS_NULL(13, "IS NULL"),
|
||||
|
||||
/**
|
||||
* 非空查询,例如:WHERE `email` IS NOT NULL
|
||||
*/
|
||||
|
@ -16,31 +16,26 @@
|
||||
|
||||
package top.charles7c.continew.admin.tool.model.entity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.NonNull;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.db.meta.Column;
|
||||
import cn.hutool.setting.dialect.Props;
|
||||
import cn.hutool.setting.dialect.PropsUtil;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.NonNull;
|
||||
import top.charles7c.continew.admin.tool.enums.FormTypeEnum;
|
||||
import top.charles7c.continew.admin.tool.enums.QueryTypeEnum;
|
||||
import top.charles7c.continew.starter.core.constant.StringConstants;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 字段配置实体
|
||||
*
|
||||
@ -160,7 +155,7 @@ public class FieldConfigDO implements Serializable {
|
||||
this.setShowInForm(isRequired);
|
||||
this.setShowInQuery(isRequired);
|
||||
this.setFormType(FormTypeEnum.TEXT);
|
||||
this.setQueryType("String".equals(this.getFieldType()) ? QueryTypeEnum.INNER_LIKE : QueryTypeEnum.EQUAL);
|
||||
this.setQueryType("String".equals(this.getFieldType()) ? QueryTypeEnum.LIKE : QueryTypeEnum.EQ);
|
||||
}
|
||||
|
||||
public void setColumnName(String columnName) {
|
||||
|
Loading…
Reference in New Issue
Block a user