From 4814862ee2b2cf21b8325ddf7622c0bc4beecfbf Mon Sep 17 00:00:00 2001 From: linfso Date: Thu, 23 May 2024 05:03:20 +0800 Subject: [PATCH] md --- .../erp/web/emis/EmisProblemTypeController.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisProblemTypeController.java b/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisProblemTypeController.java index 099ea0aef..d4d206cf1 100644 --- a/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisProblemTypeController.java +++ b/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisProblemTypeController.java @@ -15,8 +15,10 @@ import java.util.List; import javax.servlet.http.HttpServletResponse; import com.xdadan.erp.common.annotation.filter.jackson.JacksonFilter; +import com.xdadan.erp.emis.domain.EmisCustomerUser; import com.xdadan.erp.emis.domain.EmisGoods; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DuplicateKeyException; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -109,7 +111,12 @@ public class EmisProblemTypeController extends BaseController @PostMapping public AjaxResult add(@RequestBody EmisProblemType emisProblemType) { - return toAjax(emisProblemTypeService.insertEmisProblemType(emisProblemType)); + try { + return toAjax(emisProblemTypeService.insertEmisProblemType(emisProblemType)); + } catch (DuplicateKeyException e) { + e.printStackTrace(); + return AjaxResult.error("数据重复!"); + } } /** @@ -120,7 +127,13 @@ public class EmisProblemTypeController extends BaseController @PutMapping public AjaxResult edit(@RequestBody EmisProblemType emisProblemType) { - return toAjax(emisProblemTypeService.updateEmisProblemType(emisProblemType)); + try { + return toAjax(emisProblemTypeService.updateEmisProblemType(emisProblemType)); + } catch (DuplicateKeyException e) { + e.printStackTrace(); + return AjaxResult.error("数据重复!"); + } + } /**