优化解决接口中仓库排序的bug

This commit is contained in:
季圣华
2021-12-13 23:51:23 +08:00
parent da275197a5
commit fdfd69c202

View File

@@ -231,20 +231,7 @@ public class DepotService {
public List<Depot> findUserDepot()throws Exception{
DepotExample example = new DepotExample();
example.createCriteria().andTypeEqualTo(0).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("Sort");
List<Depot> list=null;
try{
list= depotMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public List<Depot> findGiftByType(Integer type)throws Exception{
DepotExample example = new DepotExample();
example.createCriteria().andTypeEqualTo(type);
example.setOrderByClause("Sort");
example.setOrderByClause("sort");
List<Depot> list=null;
try{
list= depotMapper.selectByExample(example);
@@ -309,19 +296,19 @@ public class DepotService {
if(StringUtil.isNotEmpty(depotStr)){
depotStr = depotStr.replaceAll("\\[", "").replaceAll("]", ",");
String[] depotArr = depotStr.split(",");
for(String depotId: depotArr) {
JSONObject item = new JSONObject();
item.put("id", Long.parseLong(depotId));
for (Depot depot : dataList) {
for(String depotId: depotArr) {
if(depot.getId() == Long.parseLong(depotId)){
JSONObject item = new JSONObject();
item.put("id", depot.getId());
item.put("depotName", depot.getName());
item.put("isDefault", depot.getIsDefault());
}
}
arr.add(item);
}
}
}
}
}
} else {
for (Depot depot : dataList) {
JSONObject item = new JSONObject();