From 4bbc952f57f77d6ec11e6ae0b23409c4f6ea6dfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B7=AF=E6=98=8E=E6=85=A7?= <1191093413@qq.com> Date: Mon, 26 Feb 2024 11:17:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E7=AE=A1=E7=90=86=EF=BC=9A?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=92=8C=E6=B7=BB=E5=8A=A0=E6=97=B6=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=90=8E=E7=AB=AF=E6=A0=A1=E9=AA=8C=E4=BC=81=E4=B8=9A?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E5=92=8C=E7=A8=8E=E5=8F=B7=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/CompanyserviceController.java | 14 ++++++++++++++ .../common/core/controller/BaseController.java | 11 +++++++++++ 2 files changed, 25 insertions(+) diff --git a/jianshui-admin/src/main/java/com/jianshui/web/controller/system/CompanyserviceController.java b/jianshui-admin/src/main/java/com/jianshui/web/controller/system/CompanyserviceController.java index 0314c1c..d1639ff 100644 --- a/jianshui-admin/src/main/java/com/jianshui/web/controller/system/CompanyserviceController.java +++ b/jianshui-admin/src/main/java/com/jianshui/web/controller/system/CompanyserviceController.java @@ -4,6 +4,7 @@ import java.util.List; import javax.servlet.http.HttpServletResponse; import com.jianshui.common.core.domain.entity.Companyservice; +import org.apache.commons.lang3.StringUtils; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -78,6 +79,12 @@ public class CompanyserviceController extends BaseController @PostMapping public AjaxResult add(@RequestBody Companyservice companyservice) { + if (StringUtils.isBlank(companyservice.getSellertax())){ + return toAjax("企业税号不能为空",false); + } + if (StringUtils.isBlank(companyservice.getSellername())){ + return toAjax("企业名称不能为空",false); + } return toAjax(companyserviceService.insertCompanyservice(companyservice)); } @@ -89,6 +96,13 @@ public class CompanyserviceController extends BaseController @PutMapping public AjaxResult edit(@RequestBody Companyservice companyservice) { + if (StringUtils.isBlank(companyservice.getSellertax())){ + return toAjax("企业税号不能为空",false); + } + if (StringUtils.isBlank(companyservice.getSellername())){ + return toAjax("企业名称不能为空",false); + } + return toAjax(companyserviceService.updateCompanyservice(companyservice)); } diff --git a/jianshui-common/src/main/java/com/jianshui/common/core/controller/BaseController.java b/jianshui-common/src/main/java/com/jianshui/common/core/controller/BaseController.java index 11efeef..0a79d81 100644 --- a/jianshui-common/src/main/java/com/jianshui/common/core/controller/BaseController.java +++ b/jianshui-common/src/main/java/com/jianshui/common/core/controller/BaseController.java @@ -143,6 +143,17 @@ public class BaseController return result ? success() : error(); } + /** + * 响应返回结果 + * + * @param msg 返回信息 + * @return 操作结果 + */ + protected AjaxResult toAjax(String msg, boolean result) + { + return result ? AjaxResult.success(msg) : AjaxResult.error(msg); + } + /** * 页面跳转 */