将单据明细中直接的SQL拼接替换为预编译语句
This commit is contained in:
@@ -1062,7 +1062,7 @@ public class DepotItemController {
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
String message = "";
|
||||
try {
|
||||
String barCodes = "";
|
||||
List<String> barCodeList = new ArrayList<>();
|
||||
//文件扩展名只能为xls
|
||||
String fileName = file.getOriginalFilename();
|
||||
if(StringUtil.isNotEmpty(fileName)) {
|
||||
@@ -1118,12 +1118,9 @@ public class DepotItemController {
|
||||
materialMap.put("taxRate", taxRate);
|
||||
materialMap.put("remark", remark);
|
||||
detailList.add(materialMap);
|
||||
barCodes += "'" + barCode + "',";
|
||||
barCodeList.add(barCode);
|
||||
}
|
||||
if (StringUtil.isNotEmpty(barCodes)) {
|
||||
barCodes = barCodes.substring(0, barCodes.length() - 1);
|
||||
}
|
||||
JSONObject map = depotItemService.parseMapByExcelData(barCodes, detailList, prefixNo);
|
||||
JSONObject map = depotItemService.parseMapByExcelData(barCodeList, detailList, prefixNo);
|
||||
if (map != null) {
|
||||
res.code = 200;
|
||||
} else {
|
||||
|
||||
@@ -252,7 +252,7 @@ public interface DepotItemMapperEx {
|
||||
@Param("batchNumber") String batchNumber);
|
||||
|
||||
List<MaterialVo4Unit> getBillItemByParam(
|
||||
@Param("barCodes") String barCodes);
|
||||
@Param("barCodeList") List<String> barCodeList);
|
||||
|
||||
BigDecimal getCurrentStockByParam(
|
||||
@Param("depotId") Long depotId,
|
||||
|
||||
@@ -1341,10 +1341,10 @@ public class DepotItemService {
|
||||
return depotItemMapperEx.getCountByMaterialAndDepot(mId, depotId);
|
||||
}
|
||||
|
||||
public JSONObject parseMapByExcelData(String barCodes, List<Map<String, String>> detailList, String prefixNo) throws Exception {
|
||||
public JSONObject parseMapByExcelData(List<String> barCodeList, List<Map<String, String>> detailList, String prefixNo) throws Exception {
|
||||
JSONObject map = new JSONObject();
|
||||
JSONArray arr = new JSONArray();
|
||||
List<MaterialVo4Unit> list = depotItemMapperEx.getBillItemByParam(barCodes);
|
||||
List<MaterialVo4Unit> list = depotItemMapperEx.getBillItemByParam(barCodeList);
|
||||
Map<String, MaterialVo4Unit> materialMap = new HashMap<>();
|
||||
Map<String, Long> depotMap = new HashMap<>();
|
||||
for (MaterialVo4Unit material: list) {
|
||||
|
||||
Reference in New Issue
Block a user