diff --git a/src/main/java/com/cmhi/cf/configure/DictProviderConfigure.java b/src/main/java/com/cmhi/cf/configure/DictProviderConfigure.java index a17c2c2..3f9c240 100644 --- a/src/main/java/com/cmhi/cf/configure/DictProviderConfigure.java +++ b/src/main/java/com/cmhi/cf/configure/DictProviderConfigure.java @@ -26,7 +26,9 @@ public class DictProviderConfigure implements DictProvider { dictTypeMapper.selectAllWithRelations().forEach(k -> { DictTypeVo.DictTypeBuilder builder = DictTypeVo.newBuilder(k.getDictType(), k.getDictName(), k.getRemark()); - k.getDictDataList().forEach(v -> builder.add(v.getDictValue(), v.getDictLabel(), v.getDictSort())); + k.getDictDataList() + .stream().filter(m -> "0".equals(m.getStatus())) + .forEach(v -> builder.add(v.getDictValue(), v.getDictLabel(), v.getDictSort())); dictItems.add(builder.build()); }); diff --git a/src/main/java/com/cmhi/cf/controller/SystemDictController.java b/src/main/java/com/cmhi/cf/controller/SystemDictController.java index 786f3af..bbda560 100644 --- a/src/main/java/com/cmhi/cf/controller/SystemDictController.java +++ b/src/main/java/com/cmhi/cf/controller/SystemDictController.java @@ -87,9 +87,9 @@ public class SystemDictController { // 如果校验通过,validate为空;否则,validate包含未校验通过项 if (validate.isEmpty()) { NewUserDictReq req = mr.getMsgContent(); - dictionaryService.addNewDbDictionary(req.getDictType(), req.getDictName(), req.getRemark()); + dictionaryService.addNewUserDictionary(req.getDictName(), req.getDictAlias(), req.getDictRemark()); return ProtocolResp.result(NewUserDictResp.builder() - .dictType(req.getDictType()) + .dictName(req.getDictName()) .build()); } else { return ProtocolResp.result(ErrorCode.ERR_PARAMEXCEPTION, ErrorCode.ERR_PARAMEXCEPTION.getHttpCode(), @@ -107,9 +107,9 @@ public class SystemDictController { // 如果校验通过,validate为空;否则,validate包含未校验通过项 if (validate.isEmpty()) { NewUserDictReq req = mr.getMsgContent(); - dictionaryService.addNewDbDictionary(req.getDictType(), req.getDictName(), req.getRemark()); + dictionaryService.upgradeUserDictionary(req.getDictName(), req.getDictAlias(), req.getDictRemark()); return ProtocolResp.result(NewUserDictResp.builder() - .dictType(req.getDictType()) + .dictName(req.getDictName()) .build()); } else { return ProtocolResp.result(ErrorCode.ERR_PARAMEXCEPTION, ErrorCode.ERR_PARAMEXCEPTION.getHttpCode(), diff --git a/src/main/java/com/cmhi/cf/database/common/entity/DictData.java b/src/main/java/com/cmhi/cf/database/common/entity/DictData.java index ac40ca7..0e23f94 100644 --- a/src/main/java/com/cmhi/cf/database/common/entity/DictData.java +++ b/src/main/java/com/cmhi/cf/database/common/entity/DictData.java @@ -83,9 +83,9 @@ public class DictData { /** * 状态(0正常 1停用) */ - @Schema(description = "状态(0正常 1停用)") + @Schema(description = "状态 (CommonStatus):0-->正常,1-->锁定,2-->禁用,3-->删除") @Column(value = "status") - private String status; + private Integer status; /** * 创建者 diff --git a/src/main/java/com/cmhi/cf/database/common/entity/DictType.java b/src/main/java/com/cmhi/cf/database/common/entity/DictType.java index 6d171c8..95eafae 100644 --- a/src/main/java/com/cmhi/cf/database/common/entity/DictType.java +++ b/src/main/java/com/cmhi/cf/database/common/entity/DictType.java @@ -46,9 +46,9 @@ public class DictType { /** * 状态(0正常 1停用) */ - @Schema(description = "状态(0正常 1停用)") + @Schema(description = "状态 (CommonStatus):0-->正常,1-->锁定,2-->禁用,3-->删除") @Column(value = "status") - private String status; + private Integer status; /** * 创建者 @@ -62,7 +62,7 @@ public class DictType { */ @Schema(description = "创建时间") @Column(value = "create_time") - private java.util.Date createTime; + private Timestamp createTime; /** * 更新者 @@ -76,7 +76,7 @@ public class DictType { */ @Schema(description = "更新时间") @Column(value = "update_time") - private java.util.Date updateTime; + private Timestamp updateTime; /** * 备注 diff --git a/src/main/java/com/cmhi/cf/restapi/pojo/dto/NewUserDictReq.java b/src/main/java/com/cmhi/cf/restapi/pojo/dto/NewUserDictReq.java index 89734a4..fd92322 100644 --- a/src/main/java/com/cmhi/cf/restapi/pojo/dto/NewUserDictReq.java +++ b/src/main/java/com/cmhi/cf/restapi/pojo/dto/NewUserDictReq.java @@ -17,15 +17,15 @@ import lombok.NoArgsConstructor; @JsonInclude(JsonInclude.Include.NON_NULL) @Schema(name = "NewUserDictReq", description = "新增用户字典请求参数") public class NewUserDictReq { - @Schema(description = "字典类别,用于标识各个不同的字典") - @NotEmpty(message = "dictType 字典类别不能为空", groups = ValidGroups.DictReqValid.class) - private String dictType; - - @Schema(description = "字典名称,用于显示字典别名") - @NotNull(message = "dictName 字典类别不能为NULL", groups = ValidGroups.DictReqValid.class) + @Schema(description = "字典名,用于标识各个不同的字典") + @NotEmpty(message = "dictName 字典类别不能为空", groups = ValidGroups.DictReqValid.class) private String dictName; + @Schema(description = "字典别名,用于显示字典别名") + @NotNull(message = "dictAlias 字典类别不能为NULL", groups = ValidGroups.DictReqValid.class) + private String dictAlias; + @Schema(description = "字典备注信息") - @NotNull(message = "remark 字典类别不能为NULL", groups = ValidGroups.DictReqValid.class) - private String remark; + @NotNull(message = "dictRemark 字典类别不能为NULL", groups = ValidGroups.DictReqValid.class) + private String dictRemark; } diff --git a/src/main/java/com/cmhi/cf/restapi/pojo/dto/UpgradeUserDictReq.java b/src/main/java/com/cmhi/cf/restapi/pojo/dto/UpgradeUserDictReq.java new file mode 100644 index 0000000..e989123 --- /dev/null +++ b/src/main/java/com/cmhi/cf/restapi/pojo/dto/UpgradeUserDictReq.java @@ -0,0 +1,28 @@ +package com.cmhi.cf.restapi.pojo.dto; + +import com.cmhi.cf.validation.group.ValidGroups; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotEmpty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "UpgradeUserDictReq", description = "修改用户字典请求参数") +public class UpgradeUserDictReq { + @Schema(description = "字典类别,用于标识各个不同的字典") + @NotEmpty(message = "dictType 字典类别不能为空", groups = ValidGroups.DictReqValid.class) + private String dictName; + + @Schema(description = "新的字典别名,不修改时置为NULL") + private String newDictAlias; + + @Schema(description = "新的字典备注,不修改时置为NULL") + private String newDictRemark; +} diff --git a/src/main/java/com/cmhi/cf/restapi/pojo/po/DictContent.java b/src/main/java/com/cmhi/cf/restapi/pojo/po/DictContent.java index 4910c69..cfaa43f 100644 --- a/src/main/java/com/cmhi/cf/restapi/pojo/po/DictContent.java +++ b/src/main/java/com/cmhi/cf/restapi/pojo/po/DictContent.java @@ -3,21 +3,25 @@ package com.cmhi.cf.restapi.pojo.po; import com.cmhi.cf.restapi.pojo.base.BaseRespStatus; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.houkunlin.system.dict.starter.bean.DictTypeVo; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; +import java.util.List; + @EqualsAndHashCode(callSuper = true) @Data @Builder @AllArgsConstructor @NoArgsConstructor -@JsonPropertyOrder({"dictName", "dictContent", "status", "message"}) +@JsonPropertyOrder({"dictId", "dictName", "dictAlias", "dictRemark", "children", "status", "message"}) @JsonInclude(JsonInclude.Include.NON_NULL) public class DictContent extends BaseRespStatus { - private String dictName; - private DictTypeVo dictContent; + private Long dictId; + private String dictName; + private String dictAlias; + private String dictRemark; + private List children; } diff --git a/src/main/java/com/cmhi/cf/restapi/pojo/po/DictDetails.java b/src/main/java/com/cmhi/cf/restapi/pojo/po/DictDetails.java new file mode 100644 index 0000000..1058631 --- /dev/null +++ b/src/main/java/com/cmhi/cf/restapi/pojo/po/DictDetails.java @@ -0,0 +1,20 @@ +package com.cmhi.cf.restapi.pojo.po; + +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@JsonPropertyOrder({"id", "title", "value", "sorted", "disabled"}) +public class DictDetails { + private Long id; + private String title; + private Integer value; + private Integer sorted; + private Boolean disabled; +} diff --git a/src/main/java/com/cmhi/cf/restapi/pojo/vo/NewUserDictResp.java b/src/main/java/com/cmhi/cf/restapi/pojo/vo/NewUserDictResp.java index 9ef5ad8..05ac496 100644 --- a/src/main/java/com/cmhi/cf/restapi/pojo/vo/NewUserDictResp.java +++ b/src/main/java/com/cmhi/cf/restapi/pojo/vo/NewUserDictResp.java @@ -8,12 +8,8 @@ import lombok.EqualsAndHashCode; @EqualsAndHashCode(callSuper = true) @Data -@JsonPropertyOrder({"version", "status", "message"}) +@Builder +@JsonPropertyOrder({"dictName", "status", "message"}) public class NewUserDictResp extends BaseRespStatus { - private String dictType; - - @Builder - public NewUserDictResp(String dictType) { - this.dictType = dictType; - } + private String dictName; } diff --git a/src/main/java/com/cmhi/cf/service/DictionaryService.java b/src/main/java/com/cmhi/cf/service/DictionaryService.java index e8b4fd3..bca768c 100644 --- a/src/main/java/com/cmhi/cf/service/DictionaryService.java +++ b/src/main/java/com/cmhi/cf/service/DictionaryService.java @@ -12,7 +12,9 @@ public interface DictionaryService { List getEnumDictionaryContent(List dictType); - void addNewDbDictionary(String type, String name, String remark); + void addNewUserDictionary(String type, String name, String remark); + + void upgradeUserDictionary(String type, String name, String remark); PageResults getUserDictionary(Long pageNumber, Long pageSize, Long totalSize); diff --git a/src/main/java/com/cmhi/cf/service/impl/DictionaryServiceImpl.java b/src/main/java/com/cmhi/cf/service/impl/DictionaryServiceImpl.java index 7b24e5a..3581557 100644 --- a/src/main/java/com/cmhi/cf/service/impl/DictionaryServiceImpl.java +++ b/src/main/java/com/cmhi/cf/service/impl/DictionaryServiceImpl.java @@ -1,11 +1,13 @@ package com.cmhi.cf.service.impl; +import com.cmhi.cf.common.CommonStatus; import com.cmhi.cf.common.ErrorCode; import com.cmhi.cf.database.common.entity.DictType; import com.cmhi.cf.database.common.mapper.DictTypeMapper; import com.cmhi.cf.exception.CommonErrorCodeException; import com.cmhi.cf.restapi.misc.ApiContextUtils; import com.cmhi.cf.restapi.pojo.po.DictContent; +import com.cmhi.cf.restapi.pojo.po.DictDetails; import com.cmhi.cf.restapi.pojo.po.PageResults; import com.cmhi.cf.restapi.pojo.po.UserDictionary; import com.cmhi.cf.service.DictionaryService; @@ -23,6 +25,7 @@ import org.springframework.dao.DataAccessException; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.sql.Timestamp; import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -49,9 +52,17 @@ public class DictionaryServiceImpl implements DictionaryService { SystemDictStarter.getBean(SystemDictProvider.class).dictTypeIterator().forEachRemaining(k -> { if (dictType.contains(k.getType())) { + List children = new ArrayList<>(); + k.getChildren().forEach(m -> { + children.add(DictDetails.builder() + .title(m.getTitle()) + .value((Integer) m.getValue()) + .disabled(false) + .build()); + }); sysDictList.add(DictContent.builder() .dictName(k.getType()) - .dictContent(k) + .children(children) .build()); } allSysDict.add(k.getType()); @@ -61,7 +72,6 @@ public class DictionaryServiceImpl implements DictionaryService { dictType.forEach(k -> sysDictList.add(DictContent.builder() .dictName(k) - .dictContent(null) .build())); return sysDictList; @@ -69,12 +79,12 @@ public class DictionaryServiceImpl implements DictionaryService { @Override @Transactional(rollbackFor = Exception.class) - public void addNewDbDictionary(String type, String name, String remark) { + public void addNewUserDictionary(String type, String name, String remark) { DictType dt = new DictType(); dt.setRemark(remark); dt.setDictName(name); dt.setDictType(type); - dt.setStatus("0"); + dt.setStatus(CommonStatus.NORMAL.getValue()); dt.setCreateBy(ApiContextUtils.get().getUsername()); try { @@ -90,6 +100,45 @@ public class DictionaryServiceImpl implements DictionaryService { } } + @Override + public void upgradeUserDictionary(String type, String name, String remark) { + boolean changed = false; + + DictType dt = dictTypeMapper.selectOneByCondition(DICT_TYPE.DICT_TYPE_.eq(type)); + + // 找不到对应的字典供修改 + if (dt == null) { + throw new CommonErrorCodeException(ErrorCode.ERR_NOSUCHITEM, + type + ": " + ErrorCode.ERR_NOSUCHITEM.getDescription()); + } + + if (name != null) { + dt.setDictName(name); + changed = true; + } + + if (remark != null) { + dt.setRemark(remark); + changed = true; + } + + // 确认执行过修改 + if (changed) { + dt.setUpdateBy(ApiContextUtils.get().getUsername()); + dt.setUpdateTime(new Timestamp(System.currentTimeMillis())); + + if (dictTypeMapper.update(dt) != 1) { + throw new CommonErrorCodeException(ErrorCode.ERR_DATABASE); + } else { + // 数据库操作成功后更新缓存字典数据 + DictTypeVo dv = DictUtil.getDictType(dt.getDictType()); + dv.setRemark(dt.getRemark()); + dv.setTitle(dt.getDictName()); + publisher.publishEvent(new RefreshDictTypeEvent(dv)); + } + } + } + @Override public PageResults getUserDictionary(Long pageNumber, Long pageSize, Long totalSize) { if (totalSize == 0) { @@ -122,10 +171,27 @@ public class DictionaryServiceImpl implements DictionaryService { List ret = dictTypeMapper.selectListWithRelationsByQuery(wrapper); - ret.forEach(k -> resp.add(DictContent.builder() - .dictName(k.getDictType()) - .dictContent(DictUtil.getDictType(k.getDictType())) - .build())); + ret.forEach(k -> { + List children = new ArrayList<>(); + + k.getDictDataList().forEach(m -> { + children.add(DictDetails.builder() + .id(m.getId()) + .title(m.getDictLabel()) + .value(m.getDictValue()) + .sorted(m.getDictSort()) + .disabled(m.getStatus() != 0) + .build()); + }); + + resp.add(DictContent.builder() + .dictId(k.getId()) + .dictName(k.getDictType()) + .dictAlias(k.getDictName()) + .dictRemark(k.getRemark()) + .children(children) + .build()); + }); dictName.stream() .filter(k -> ret.stream().noneMatch(v -> v.getDictType().equals(k))) diff --git a/src/main/resources/rbac/data.sql b/src/main/resources/rbac/data.sql index cfb6ed6..eeff9d7 100644 --- a/src/main/resources/rbac/data.sql +++ b/src/main/resources/rbac/data.sql @@ -175,18 +175,18 @@ INSERT IGNORE INTO rbac_role_resource VALUES (1, 405, 1); #insert into sys_dict_type values(1, '用户性别', 'sys_user_sex', '0', 'admin', sysdate(), '', null, '用户性别列表'); #INSERT IGNORE INTO rbac_user (id, uid, username, gender, role_id) VALUES (3, '44ede496-d538-4a1d-afb9-bc409f752738', 'guest', 0, 4); -INSERT IGNORE INTO sys_dict_type (id, dict_name, dict_type, status, create_by, remark) VALUES (1, '资源类型', 'sys_res_type', '0', 'admin', '资源类型列表'); -INSERT IGNORE INTO sys_dict_type (id, dict_name, dict_type, status, create_by, remark) VALUES (2, '用户组', 'sys_role_group', '0', 'admin', '用户组列表'); +INSERT IGNORE INTO sys_dict_type (id, dict_name, dict_type, create_by, remark) VALUES (1, '资源类型', 'sys_res_type', 'admin', '资源类型列表'); +INSERT IGNORE INTO sys_dict_type (id, dict_name, dict_type, create_by, remark) VALUES (2, '用户组', 'sys_role_group', 'admin', '用户组列表'); -INSERT IGNORE INTO sys_dict_data VALUES (1, 1, '路由', 0, 1, '', '','Y', '0', 'admin', CURRENT_TIMESTAMP(6), '', null, 'URI 路由资源', null); -INSERT IGNORE INTO sys_dict_data VALUES (2, 2, '菜单', 1, 1, '', '','N', '0', 'admin', CURRENT_TIMESTAMP(6), '', null, 'UI 菜单资源', null); -INSERT IGNORE INTO sys_dict_data VALUES (3, 3, '按钮', 2, 1, '', '','N', '0', 'admin', CURRENT_TIMESTAMP(6), '', null, 'UI 按钮资源', null); +INSERT IGNORE INTO sys_dict_data VALUES (1, 1, '路由', 0, 1, '', '','Y', 0, 'admin', CURRENT_TIMESTAMP(6), '', null, 'URI 路由资源', null); +INSERT IGNORE INTO sys_dict_data VALUES (2, 2, '菜单', 1, 1, '', '','N', 0, 'admin', CURRENT_TIMESTAMP(6), '', null, 'UI 菜单资源', null); +INSERT IGNORE INTO sys_dict_data VALUES (3, 3, '按钮', 2, 1, '', '','N', 0, 'admin', CURRENT_TIMESTAMP(6), '', null, 'UI 按钮资源', null); -INSERT IGNORE INTO sys_dict_data VALUES (4, 1, 'ADMIN', 1, 2, '', '','N', '0', 'admin', CURRENT_TIMESTAMP(6), '', null, '超级管理员可以对企业内的所有用户进行管理,请谨慎修改超管权限', null); -INSERT IGNORE INTO sys_dict_data VALUES (5, 2, 'DEVELOPMENT', 2, 2, '', '','N', '0', 'admin', CURRENT_TIMESTAMP(6), '', null, '项目开发人员', null); -INSERT IGNORE INTO sys_dict_data VALUES (6, 3, 'USER', 3, 2, '', '','N', '0', 'admin', CURRENT_TIMESTAMP(6), '', null, '普通的用户', null); -INSERT IGNORE INTO sys_dict_data VALUES (7, 4, 'GUEST', 4, 2, '', '','N', '0', 'admin', CURRENT_TIMESTAMP(6), '', null, '系统访客,不需要认证,最小权限', null); +INSERT IGNORE INTO sys_dict_data VALUES (4, 1, 'ADMIN', 1, 2, '', '','N', 0, 'admin', CURRENT_TIMESTAMP(6), '', null, '超级管理员可以对企业内的所有用户进行管理,请谨慎修改超管权限', null); +INSERT IGNORE INTO sys_dict_data VALUES (5, 2, 'DEVELOPMENT', 2, 2, '', '','N', 0, 'admin', CURRENT_TIMESTAMP(6), '', null, '项目开发人员', null); +INSERT IGNORE INTO sys_dict_data VALUES (6, 3, 'USER', 3, 2, '', '','N', 0, 'admin', CURRENT_TIMESTAMP(6), '', null, '普通的用户', null); +INSERT IGNORE INTO sys_dict_data VALUES (7, 4, 'GUEST', 4, 2, '', '','N', 0, 'admin', CURRENT_TIMESTAMP(6), '', null, '系统访客,不需要认证,最小权限', null); # INSERT IGNORE INTO sys_dict_data VALUES (4, 1, '正常', '0', 'sys_common_status', '', '','Y', '0', 'admin', CURRENT_TIMESTAMP(6), '', null, 'UI 按钮资源', null); # INSERT IGNORE INTO sys_dict_data VALUES (5, 2, '已锁定', '1', 'sys_common_status', '', '','N', '0', 'admin', CURRENT_TIMESTAMP(6), '', null, 'UI 按钮资源', null); diff --git a/src/main/resources/rbac/schema.sql b/src/main/resources/rbac/schema.sql index a6c33a1..bb58eaa 100644 --- a/src/main/resources/rbac/schema.sql +++ b/src/main/resources/rbac/schema.sql @@ -177,20 +177,20 @@ CREATE TABLE IF NOT EXISTS `sys_operation_log` CREATE TABLE IF NOT EXISTS `sys_dict_data` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '字典编码', - `dict_sort` int(4) NULL DEFAULT 0 COMMENT '字典排序', - `dict_label` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '字典标签', + `dict_sort` int(4) NULL DEFAULT 0 COMMENT '字典排序', + `dict_label` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '字典标签', `dict_value` smallint NOT NULL COMMENT '字典键值', `type_id` bigint(20) NOT NULL COMMENT '字典类型', - `css_class` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '样式属性(其他样式扩展)', - `list_class` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '表格回显样式', - `is_default` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'N' COMMENT '是否默认(Y是 N否)', - `status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '状态(0正常 1停用)', - `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者', - `create_time` datetime(6) NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT '创建时间', - `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者', - `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', - `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', - `delete_time` datetime NULL DEFAULT NULL COMMENT '逻辑删除标记', + `css_class` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '样式属性(其他样式扩展)', + `list_class` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '表格回显样式', + `is_default` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'N' COMMENT '是否默认(Y是 N否)', + `status` smallint NOT NULL DEFAULT 0 COMMENT '当前状态(CommonStatus):0-->正常,1-->锁定,2-->禁用,3-->删除', + `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime(6) NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `delete_time` datetime NULL DEFAULT NULL COMMENT '逻辑删除标记', CONSTRAINT `FKa68196081fvovjhkekdicttype` FOREIGN KEY (`type_id`) REFERENCES `sys_dict_type` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB @@ -202,15 +202,15 @@ CREATE TABLE IF NOT EXISTS `sys_dict_data` CREATE TABLE IF NOT EXISTS `sys_dict_type` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '字典主键', - `dict_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '字典名称', - `dict_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '字典类型', - `status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '状态(0正常 1停用)', - `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者', - `create_time` datetime(6) NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT '创建时间', - `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者', - `update_time` datetime(6) NULL DEFAULT NULL COMMENT '更新时间', - `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', - `delete_time` datetime NULL DEFAULT NULL COMMENT '逻辑删除标记', + `dict_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '字典名称', + `dict_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '字典类型', + `status` smallint NOT NULL DEFAULT 0 COMMENT '当前状态(CommonStatus):0-->正常,1-->锁定,2-->禁用,3-->删除', + `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime(6) NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime(6) NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `delete_time` datetime NULL DEFAULT NULL COMMENT '逻辑删除标记', PRIMARY KEY (`id`) USING BTREE, UNIQUE INDEX `dict_type` (`dict_type`) USING BTREE ) ENGINE = InnoDB