Skip to content

Commit

Permalink
refactor: 优化字典管理相关 API
Browse files Browse the repository at this point in the history
1.合并 DictResp 及 DictDetailResp
2.合并 DictItemResp 及 DictItemDetailResp
3.字典项增加状态 status 字段
  • Loading branch information
Charles7c committed Apr 11, 2024
1 parent f7b5a4f commit 9ec5945
Show file tree
Hide file tree
Showing 20 changed files with 100 additions and 282 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ public class CacheConstants {
*/
public static final String MENU_KEY_PREFIX = "MENU" + DELIMITER;

/**
* 字典缓存键前缀
*/
public static final String DICT_KEY_PREFIX = "DICT" + DELIMITER;

/**
* 参数缓存键前缀
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@

package top.charles7c.continew.admin.system.model.entity;

import java.io.Serial;

import lombok.Data;

import com.baomidou.mybatisplus.annotation.TableName;

import lombok.Data;
import top.charles7c.continew.admin.common.enums.DisEnableStatusEnum;
import top.charles7c.continew.starter.extension.crud.model.entity.BaseDO;

import java.io.Serial;

/**
* 字典项实体
*
Expand Down Expand Up @@ -62,6 +61,11 @@ public class DictItemDO extends BaseDO {
*/
private String description;

/**
* 状态
*/
private DisEnableStatusEnum status;

/**
* 字典ID
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import top.charles7c.continew.starter.data.core.annotation.Query;
import top.charles7c.continew.starter.data.core.enums.QueryType;

import java.io.Serial;
import java.io.Serializable;
Expand All @@ -35,6 +37,19 @@ public class DictItemQuery implements Serializable {
@Serial
private static final long serialVersionUID = 1L;

/**
* 关键词
*/
@Schema(description = "关键词")
@Query(columns = {"label", "description"}, type = QueryType.LIKE)
private String description;

/**
* 状态
*/
@Schema(description = "状态(1:启用;2:禁用)", example = "1")
private Integer status;

/**
* 字典 ID
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ public class DictQuery implements Serializable {
private static final long serialVersionUID = 1L;

/**
* 名称
* 关键词
*/
@Schema(description = "名称")
@Schema(description = "关键词")
@Query(columns = {"name", "code", "description"}, type = QueryType.LIKE)
private String name;

private String description;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,17 @@

package top.charles7c.continew.admin.system.model.req;

import java.io.Serial;

import jakarta.validation.constraints.*;

import lombok.Data;

import io.swagger.v3.oas.annotations.media.Schema;

import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import top.charles7c.continew.admin.common.enums.DisEnableStatusEnum;
import top.charles7c.continew.starter.extension.crud.model.req.BaseReq;

import java.io.Serial;

/**
* 创建或修改字典项信息
*
Expand Down Expand Up @@ -78,6 +77,12 @@ public class DictItemReq extends BaseReq {
@Length(max = 200, message = "描述长度不能超过 {max} 个字符")
private String description;

/**
* 状态
*/
@Schema(description = "状态(1:启用;2:禁用)", type = "Integer", allowableValues = {"1", "2"}, example = "1")
private DisEnableStatusEnum status;

/**
* 所属字典
*/
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@

package top.charles7c.continew.admin.system.model.resp;

import java.io.Serial;

import lombok.Data;

import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import top.charles7c.continew.admin.common.enums.DisEnableStatusEnum;
import top.charles7c.continew.starter.extension.crud.converter.ExcelBaseEnumConverter;
import top.charles7c.continew.starter.extension.crud.model.resp.BaseDetailResp;

import top.charles7c.continew.starter.extension.crud.model.resp.BaseResp;
import java.io.Serial;

/**
* 字典项信息
Expand All @@ -32,7 +33,7 @@
*/
@Data
@Schema(description = "字典项信息")
public class DictItemResp extends BaseResp {
public class DictItemResp extends BaseDetailResp {

@Serial
private static final long serialVersionUID = 1L;
Expand All @@ -56,14 +57,27 @@ public class DictItemResp extends BaseResp {
private String color;

/**
* 描述
* 状态
*/
@Schema(description = "描述", example = "通知描述信息")
private String description;
@Schema(description = "状态(1:启用;2:禁用)", type = "Integer", allowableValues = {"1", "2"}, example = "1")
@ExcelProperty(value = "状态", converter = ExcelBaseEnumConverter.class)
private DisEnableStatusEnum status;

/**
* 排序
*/
@Schema(description = "排序", example = "1")
private Integer sort;

/**
* 描述
*/
@Schema(description = "描述", example = "通知描述信息")
private String description;

/**
* 字典 ID
*/
@Schema(description = "字典 ID", example = "1")
private Long dictId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@

package top.charles7c.continew.admin.system.model.resp;

import java.io.Serial;

import lombok.Data;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import top.charles7c.continew.starter.extension.crud.model.resp.BaseDetailResp;

import top.charles7c.continew.starter.extension.crud.model.resp.BaseResp;
import java.io.Serial;

/**
* 字典信息
Expand All @@ -32,7 +30,7 @@
*/
@Data
@Schema(description = "字典信息")
public class DictResp extends BaseResp {
public class DictResp extends BaseDetailResp {

@Serial
private static final long serialVersionUID = 1L;
Expand Down
Loading

0 comments on commit 9ec5945

Please sign in to comment.