收银点改动

This commit is contained in:
liuyingfang 2023-06-15 10:33:22 +08:00
parent 0e926adf3d
commit 766351e0f6
1 changed files with 4 additions and 4 deletions

View File

@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
/** /**
* @author DJH * @author DJH
@ -35,7 +36,9 @@ public class MerchantCashPlaceController {
@PostMapping @PostMapping
public Result<Object> add(@RequestBody MerchantCashPlace merchantCashPlace) { public Result<Object> add(@RequestBody MerchantCashPlace merchantCashPlace) {
//判定字符位数 //判定字符位数
size(merchantCashPlace.getAddress()); if (Objects.equals(merchantCashPlace.getAddress(), null) || Objects.equals(merchantCashPlace.getName(), null)){
throw new MsgException("地址或收银点名称不能为空");
}
size(merchantCashPlace.getName()); size(merchantCashPlace.getName());
cashPlaceService.saveOrUpdate(merchantCashPlace); cashPlaceService.saveOrUpdate(merchantCashPlace);
return ResultGenerator.genSuccessResult("保存成功", merchantCashPlace); return ResultGenerator.genSuccessResult("保存成功", merchantCashPlace);
@ -106,9 +109,6 @@ public class MerchantCashPlaceController {
return ResultGenerator.genSuccessResult(pageData); return ResultGenerator.genSuccessResult(pageData);
} }
private void size(String character){ private void size(String character){
if (character.isEmpty()){
throw new MsgException("地址或收银点名称不能为空");
}
if (character.length() >= 50){ if (character.length() >= 50){
throw new MsgException("输入内容过长"); throw new MsgException("输入内容过长");
} }