update 修改controller中校验直接返回R.fail

feature/model
Yjoioooo 2 years ago
parent aa29f1cec5
commit 94846d281f

@ -72,7 +72,7 @@ public class SysOssController extends BaseController {
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public R<SysOssUploadVo> upload(@RequestPart("file") MultipartFile file) { public R<SysOssUploadVo> upload(@RequestPart("file") MultipartFile file) {
if (ObjectUtil.isNull(file)) { if (ObjectUtil.isNull(file)) {
throw new ServiceException("上传文件不能为空"); R.fail("上传文件不能为空");
} }
SysOssVo oss = ossService.upload(file); SysOssVo oss = ossService.upload(file);
SysOssUploadVo uploadVo = new SysOssUploadVo(); SysOssUploadVo uploadVo = new SysOssUploadVo();

@ -89,7 +89,7 @@ public class SysTenantController extends BaseController {
@PostMapping() @PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody SysTenantBo bo) { public R<Void> add(@Validated(AddGroup.class) @RequestBody SysTenantBo bo) {
if (!tenantService.checkCompanyNameUnique(bo)) { if (!tenantService.checkCompanyNameUnique(bo)) {
throw new ServiceException("新增租户'" + bo.getCompanyName() + "'失败,企业名称已存在"); R.fail("新增租户'" + bo.getCompanyName() + "'失败,企业名称已存在");
} }
return toAjax(tenantService.insertByBo(bo)); return toAjax(tenantService.insertByBo(bo));
} }
@ -105,7 +105,7 @@ public class SysTenantController extends BaseController {
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysTenantBo bo) { public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysTenantBo bo) {
tenantService.checkTenantAllowed(bo.getTenantId()); tenantService.checkTenantAllowed(bo.getTenantId());
if (!tenantService.checkCompanyNameUnique(bo)) { if (!tenantService.checkCompanyNameUnique(bo)) {
throw new ServiceException("修改租户'" + bo.getCompanyName() + "'失败,公司名称已存在"); R.fail("修改租户'" + bo.getCompanyName() + "'失败,公司名称已存在");
} }
return toAjax(tenantService.updateByBo(bo)); return toAjax(tenantService.updateByBo(bo));
} }

Loading…
Cancel
Save