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); + } + /** * 页面跳转 */