给商品条码增加重复校验

This commit is contained in:
季圣华
2021-06-20 14:33:22 +08:00
parent bc90059cfa
commit be3a882dba
5 changed files with 75 additions and 23 deletions

View File

@@ -81,4 +81,27 @@ public class MaterialExtendController {
}
return res;
}
@GetMapping(value = "/checkIsBarCodeExist")
public BaseResponseInfo checkIsBarCodeExist(@RequestParam("id") Long id,
@RequestParam("barCode") String barCode,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<>();
try {
int exist = materialExtendService.checkIsBarCodeExist(id, barCode);
if(exist > 0) {
map.put("status", true);
} else {
map.put("status", false);
}
res.code = 200;
res.data = map;
} catch (Exception e) {
e.printStackTrace();
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
}