便利店

This commit is contained in:
cun-nan 2023-10-28 17:10:02 +08:00
parent 92eafa75ec
commit 7da876c51e
2 changed files with 8 additions and 4 deletions

View File

@ -132,22 +132,27 @@ public class CvsGoodsServiceImpl extends ServiceImpl<CvsGoodsMapper,CvsGoods> im
queryWrapper.eq("store_id",storeId); queryWrapper.eq("store_id",storeId);
List<CvsGoods> cvsGoods = baseMapper.selectList(queryWrapper); List<CvsGoods> cvsGoods = baseMapper.selectList(queryWrapper);
List<CvsGoodsTree> list = new ArrayList<>(); List<CvsGoodsTree> list = new ArrayList<>();
List<CvsGoodsVo> goodsVos = new ArrayList<>();
for (CvsGoods cvsGood : cvsGoods) { for (CvsGoods cvsGood : cvsGoods) {
if (cvsGood.getPid()==0){ if (cvsGood.getPid()==0){
CvsGoodsTree cvsGoodsTree = new CvsGoodsTree(); CvsGoodsTree cvsGoodsTree = new CvsGoodsTree();
cvsGoodsTree.setPid(cvsGood.getPid()); CvsGoodsVo cvsGoodsVo = new CvsGoodsVo();
cvsGoodsVo.setPid(cvsGood.getPid());
cvsGoodsTree.setValue(cvsGood.getId()); cvsGoodsTree.setValue(cvsGood.getId());
cvsGoodsTree.setLabel(cvsGood.getName()); cvsGoodsTree.setLabel(cvsGood.getName());
cvsGoodsTree.setChildren(new ArrayList<>()); cvsGoodsTree.setChildren(new ArrayList<>());
list.add(cvsGoodsTree); list.add(cvsGoodsTree);
goodsVos.add(cvsGoodsVo);
} }
} }
for (int i = 0; i < cvsGoods.size(); i++){ for (int i = 0; i < cvsGoods.size(); i++){
List<CvsGoodsTree> children = new ArrayList<>(); List<CvsGoodsTree> children = new ArrayList<>();
for (CvsGoods cvsGood : cvsGoods) { for (CvsGoods cvsGood : cvsGoods) {
if (list.get(i).getPid()==cvsGood.getPid()){ if (goodsVos.get(i).getPid()==cvsGood.getPid()){
CvsGoodsTree cvsGoodsTree = new CvsGoodsTree(); CvsGoodsTree cvsGoodsTree = new CvsGoodsTree();
cvsGoodsTree.setPid(cvsGood.getPid());
cvsGoodsTree.setValue(cvsGood.getId()); cvsGoodsTree.setValue(cvsGood.getId());
cvsGoodsTree.setLabel(cvsGood.getName()); cvsGoodsTree.setLabel(cvsGood.getName());
children.add(cvsGoodsTree); children.add(cvsGoodsTree);

View File

@ -7,7 +7,6 @@ import java.util.List;
@Data @Data
public class CvsGoodsTree { public class CvsGoodsTree {
private Integer value; private Integer value;
private Integer pid;
private String label; private String label;
private List<CvsGoodsTree> children; private List<CvsGoodsTree> children;
} }