From 6beecb7c88e1d0ce8182bc5c833c5a5fa92e0e89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E6=B5=B7=E6=AF=93?= <378101239@qq.com> Date: Thu, 13 May 2021 17:25:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=201.=E5=AD=97=E5=85=B8=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E8=A3=85=E9=85=8D=E7=B1=BB=E9=94=99=E8=AF=AF=202.=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=AD=97=E5=85=B8type=E6=97=A0=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/controller/dict/vo/type/SysDictTypeBaseVO.java | 5 +++++ .../system/service/dict/impl/SysDictTypeServiceImpl.java | 4 ++++ .../src/main/resources/META-INF/spring.factories | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/controller/dict/vo/type/SysDictTypeBaseVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/controller/dict/vo/type/SysDictTypeBaseVO.java index c4458cd26b..05d399e2f4 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/controller/dict/vo/type/SysDictTypeBaseVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/controller/dict/vo/type/SysDictTypeBaseVO.java @@ -23,6 +23,11 @@ public class SysDictTypeBaseVO { @NotNull(message = "状态不能为空") private Integer status; + @ApiModelProperty(value = "字典类型", required = true) + @NotNull(message = "字典类型不能为空") + @Size(max = 100, message = "字典类型长度不能超过100个字符") + private String type; + @ApiModelProperty(value = "备注", example = "快乐的备注") private String remark; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/dict/impl/SysDictTypeServiceImpl.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/dict/impl/SysDictTypeServiceImpl.java index b054764532..36a14b4152 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/dict/impl/SysDictTypeServiceImpl.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/dict/impl/SysDictTypeServiceImpl.java @@ -115,6 +115,10 @@ public class SysDictTypeServiceImpl implements SysDictTypeService { @VisibleForTesting public void checkDictTypeUnique(Long id, String type) { + // 判断type是否为空,减少一次查询数据库的操作 + if (type == null) { + return; + } SysDictTypeDO dictType = dictTypeMapper.selectByType(type); if (dictType == null) { return; diff --git a/yudao-framework/yudao-spring-boot-starter-biz-dict/src/main/resources/META-INF/spring.factories b/yudao-framework/yudao-spring-boot-starter-biz-dict/src/main/resources/META-INF/spring.factories index 529a476630..3986b1c2b2 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-dict/src/main/resources/META-INF/spring.factories +++ b/yudao-framework/yudao-spring-boot-starter-biz-dict/src/main/resources/META-INF/spring.factories @@ -1,2 +1,2 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ - cn.iocoder.yudao.framework.operatelog.config.YudaoOperateLogAutoConfiguration + cn.iocoder.yudao.framework.dict.config.YudaoDictAutoConfiguration