doum
2 天以前 bcad3fe1b888ae11d437f6558b7974cfa30cfb2e
server/dmmall_service/src/main/java/com/doumee/service/business/impl/LabelsServiceImpl.java
@@ -232,10 +232,7 @@
    @Override
    public List<Labels> findList(Labels labels) {
        MPJLambdaWrapper<Labels> query = new MPJLambdaWrapper<>();
        if(labels!=null&&labels.getParentId()!=null){
            query.eq(Labels::getParentId,labels.getParentId());
        }else{
@@ -248,7 +245,15 @@
        }
        query.eq(Labels::getIsdeleted,Constants.ZERO);
        query.eq(labels.getType()!=null,Labels::getType,labels.getType());
        query.orderByAsc(Labels::getSortnum);
        List<Labels> list= labelsJoinMapper.selectList(query);
        List<Labels> childList= null;
        if(Constants.equalsInteger(labels.getType(),Constants.LabelsType.APPLICABLE_BRAND.getKey())){
            childList= labelsJoinMapper.selectList(new QueryWrapper<Labels>().lambda()
                    .eq(Labels::getIsdeleted,Constants.ZERO)
                    .eq(Labels::getType,Constants.LabelsType.SERIES_BRAND.getKey())
                    .orderByAsc(Labels::getSortnum));
        }
        for(Labels model:list){
            if(Constants.equalsInteger(model.getType(),Constants.LabelsType.BIG_AREA.getKey())){
                //如果是大区信息,查询所有绑定额省份信息
@@ -256,6 +261,24 @@
                        .eq(Areas::getIsdeleted,Constants.ZERO)
                        .eq(Areas::getBigAreaId,model.getId())));
            }
            if(Constants.equalsInteger(labels.getType(),Constants.LabelsType.APPLICABLE_BRAND.getKey())
                    &&Constants.equalsInteger(model.getType(),Constants.LabelsType.APPLICABLE_BRAND.getKey())){
                //如果是适应品牌,则查询下级系列
                model.setChildList(getChildListbyParentId(childList,model.getId()));
            }
        }
        return list;
    }
    private List<Labels> getChildListbyParentId(List<Labels> childList, Integer id) {
        List<Labels> list = new ArrayList<>();
        if(childList!=null && childList.size()>0){
            for(Labels labels : childList){
                if(Constants.equalsInteger(labels.getParentId(),id)){
                    list.add(labels);
                }
            }
        }
        return list;
    }