Commit b957c2c2 authored by 季圣华's avatar 季圣华
Browse files

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

parent f73d3689
...@@ -58,7 +58,7 @@ public class SupplierController { ...@@ -58,7 +58,7 @@ public class SupplierController {
@GetMapping(value = "/checkIsNameAndTypeExist") @GetMapping(value = "/checkIsNameAndTypeExist")
@ApiOperation(value = "检查名称和类型是否存在") @ApiOperation(value = "检查名称和类型是否存在")
public String checkIsNameAndTypeExist(@RequestParam Long id, public String checkIsNameAndTypeExist(@RequestParam Long id,
@RequestParam(value ="name") String name, @RequestParam(value ="name", required = false) String name,
@RequestParam(value ="type") String type, @RequestParam(value ="type") String type,
HttpServletRequest request)throws Exception { HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>(); Map<String, Object> objectMap = new HashMap<>();
......
...@@ -128,7 +128,7 @@ public class CommonQueryManager { ...@@ -128,7 +128,7 @@ public class CommonQueryManager {
* @return * @return
*/ */
public int checkIsNameExist(String apiName, Long id, String name) throws Exception{ 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 container.getCommonQuery(apiName).checkIsNameExist(id, name);
} }
return 0; return 0;
......
...@@ -272,6 +272,7 @@ public class SupplierService { ...@@ -272,6 +272,7 @@ public class SupplierService {
} }
public int checkIsNameAndTypeExist(Long id, String name, String type)throws Exception { public int checkIsNameAndTypeExist(Long id, String name, String type)throws Exception {
name = name == null? "": name;
SupplierExample example = new SupplierExample(); SupplierExample example = new SupplierExample();
example.createCriteria().andIdNotEqualTo(id).andSupplierEqualTo(name).andTypeEqualTo(type) example.createCriteria().andIdNotEqualTo(id).andSupplierEqualTo(name).andTypeEqualTo(type)
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); .andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment