From 9fe1ec3afe8696c628d076d1f76686c4efc3012e Mon Sep 17 00:00:00 2001
From: zc <zyzc>
Date: 星期二, 21 十月 2025 10:49:55 +0800
Subject: [PATCH] 容器初始化功能优化
---
rsf-server/src/main/java/com/vincent/rsf/server/system/controller/DictTypeController.java | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/system/controller/DictTypeController.java b/rsf-server/src/main/java/com/vincent/rsf/server/system/controller/DictTypeController.java
index 1e06e7c..a705dd9 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/system/controller/DictTypeController.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/system/controller/DictTypeController.java
@@ -61,13 +61,15 @@
if (Objects.isNull(dictType.getName())) {
throw new CoolException("瀛楀吀鍚嶇О涓嶈兘涓虹┖锛侊紒");
}
- if (Objects.isNull(dictType.getDescription())) {
- throw new CoolException("瀛楀吀鎻忚堪涓嶈兘涓虹┖锛侊紒");
- }
if (Objects.isNull(dictType.getCode())) {
throw new CoolException("瀛楀吀缂栫爜涓嶈兘涓虹┖锛侊紒");
}
-
+ if (!dictTypeService.list(new LambdaQueryWrapper<DictType>().eq(DictType::getCode, dictType.getCode())).isEmpty()) {
+ throw new CoolException("缂栫爜涓嶈兘閲嶅锛侊紒");
+ }
+ if (!dictTypeService.list(new LambdaQueryWrapper<DictType>().eq(DictType::getName, dictType.getName())).isEmpty()) {
+ throw new CoolException("鍚嶇О涓嶈兘閲嶅锛侊紒");
+ }
if (!dictTypeService.save(dictType)) {
return R.error("Save Fail");
}
@@ -78,8 +80,10 @@
@OperationLog("Update 鏁版嵁瀛楀吀")
@PostMapping("/dictType/update")
public R update(@RequestBody DictType dictType) {
+ if (Objects.isNull(dictType)) {
+ throw new CoolException("鍙傛暟涓嶈兘涓虹┖锛侊紒");
+ }
dictType.setUpdateBy(getLoginUserId());
- dictType.setUpdateTime(new Date());
if (!dictTypeService.updateById(dictType)) {
return R.error("Update Fail");
}
--
Gitblit v1.9.1