优化商品库存查询逻辑,在没有选择仓库的时候过滤出当前有权限的仓库

This commit is contained in:
季圣华
2023-03-07 22:06:10 +08:00
parent a84b9e8c12
commit 81c065ea5c
4 changed files with 48 additions and 32 deletions

View File

@@ -287,6 +287,21 @@ public class DepotService {
return id;
}
public List<Long> parseDepotList(Long depotId) throws Exception {
List<Long> depotList = new ArrayList<>();
if(depotId !=null) {
depotList.add(depotId);
} else {
//未选择仓库时默认为当前用户有权限的仓库
JSONArray depotArr = findDepotByCurrentUser();
for(Object obj: depotArr) {
JSONObject object = JSONObject.parseObject(obj.toString());
depotList.add(object.getLong("id"));
}
}
return depotList;
}
public JSONArray findDepotByCurrentUser() throws Exception {
JSONArray arr = new JSONArray();
String type = "UserDepot";