解决供应商和客户重名校验接口的bug

This commit is contained in:
季圣华
2022-12-12 00:18:06 +08:00
parent f73d368965
commit b957c2c239
3 changed files with 3 additions and 2 deletions

View File

@@ -58,7 +58,7 @@ public class SupplierController {
@GetMapping(value = "/checkIsNameAndTypeExist")
@ApiOperation(value = "检查名称和类型是否存在")
public String checkIsNameAndTypeExist(@RequestParam Long id,
@RequestParam(value ="name") String name,
@RequestParam(value ="name", required = false) String name,
@RequestParam(value ="type") String type,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();

View File

@@ -128,7 +128,7 @@ public class CommonQueryManager {
* @return
*/
public int checkIsNameExist(String apiName, Long id, String name) throws Exception{
if (StringUtil.isNotEmpty(apiName)) {
if (StringUtil.isNotEmpty(apiName) && name!=null) {
return container.getCommonQuery(apiName).checkIsNameExist(id, name);
}
return 0;

View File

@@ -272,6 +272,7 @@ public class SupplierService {
}
public int checkIsNameAndTypeExist(Long id, String name, String type)throws Exception {
name = name == null? "": name;
SupplierExample example = new SupplierExample();
example.createCriteria().andIdNotEqualTo(id).andSupplierEqualTo(name).andTypeEqualTo(type)
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);