From 2ce6327ec49e7fe73cc1cd3bcc2b63b28d89d38f Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期二, 17 三月 2026 14:05:25 +0800
Subject: [PATCH] #
---
rsf-server/src/main/java/com/vincent/rsf/server/system/controller/DictTypeController.java | 22 ++++++++++++++++++----
1 files changed, 18 insertions(+), 4 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 fbeb7d9..ddc135f 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
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.vincent.rsf.framework.common.Cools;
import com.vincent.rsf.framework.common.R;
+import com.vincent.rsf.framework.exception.CoolException;
import com.vincent.rsf.server.common.utils.ExcelUtil;
import com.vincent.rsf.server.common.annotation.OperationLog;
import com.vincent.rsf.server.common.domain.BaseParam;
@@ -16,7 +17,7 @@
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpServletResponse;
import java.util.*;
@RestController
@@ -56,9 +57,19 @@
@PostMapping("/dictType/save")
public R save(@RequestBody DictType dictType) {
dictType.setCreateBy(getLoginUserId());
- dictType.setCreateTime(new Date());
dictType.setUpdateBy(getLoginUserId());
- dictType.setUpdateTime(new Date());
+ if (Objects.isNull(dictType.getName())) {
+ 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");
}
@@ -69,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");
}
@@ -108,3 +121,4 @@
}
}
+
--
Gitblit v1.9.1