doum
15 小时以前 25538c1063d1e9a2d8dac1b813d43e7d8fb18e3f
server/dmmall_service/src/main/java/com/doumee/service/business/impl/LabelsServiceImpl.java
@@ -10,6 +10,8 @@
import com.doumee.core.utils.Constants;
import com.doumee.core.utils.Utils;
import com.doumee.dao.business.AreasMapper;
import com.doumee.dao.business.GoodsMapper;
import com.doumee.dao.business.GoodsorderMapper;
import com.doumee.dao.business.LabelsMapper;
import com.doumee.dao.business.join.GoodsAdminJoinMapper;
import com.doumee.dao.business.join.LabelsJoinMapper;
@@ -62,7 +64,7 @@
    private SystemDictDataBiz systemDictDataBiz;
    @Autowired
    private GoodsAdminJoinMapper goodsAdminJoinMapper;
    private GoodsMapper goodsMapper;
    @Override
    @Transactional
@@ -91,6 +93,18 @@
                        .in(Constants.equalsInteger(labels.getType(),Constants.LabelsType.YUN_FEE.getKey()),Areas::getId,labels.getAreaIdList())
                        .in(Constants.equalsInteger(labels.getType(),Constants.LabelsType.BIG_AREA.getKey()),Areas::getId,labels.getAreaIdList()));
            areasService.cacheData();
        }
        if(Constants.equalsInteger(labels.getType(),Constants.LabelsType.HOMEZHUANQU.getKey())){
            String ids = "["+labels.getId()+"],";
//            goodsMapper.update(null,new UpdateWrapper<Goods>().lambda()
//                    .setSql("zhuanqu_Ids =REPLACE(zhuanqu_Ids, '"+ids+"', '')"));
            if( labels.getApplyIdList()!=null){
                labels.getApplyIdList().stream().map(String::valueOf).collect(Collectors.joining(","));
//                List<Goods> goods = goodsMapper.selectList(new QueryWrapper<Goods>().lambda().in(Goods::getId,labels.getApplyIdList() ));
                goodsMapper.update(null,new UpdateWrapper<Goods>().lambda()
                        .setSql("zhuanqu_Ids =concat(ifnull(zhuanqu_Ids,''), '"+ids+"' )")
                        .in(Goods::getId,labels.getApplyIdList() ));
            }
        }
        return labels.getId();
    }
@@ -205,6 +219,17 @@
                areasService.cacheData();
            }
        }
        if(Constants.equalsInteger(labels.getType(),Constants.LabelsType.HOMEZHUANQU.getKey())){
            String ids = "["+labels.getId()+"],";
            goodsMapper.update(null,new UpdateWrapper<Goods>().lambda()
                    .setSql("zhuanqu_Ids =REPLACE(zhuanqu_Ids, '"+ids+"', '')"));
            if( labels.getApplyIdList()!=null){
                labels.getApplyIdList().stream().map(String::valueOf).collect(Collectors.joining(","));
                goodsMapper.update(null,new UpdateWrapper<Goods>().lambda()
                        .setSql("zhuanqu_Ids =concat(ifnull(zhuanqu_Ids,''), '"+ids+"' )")
                        .in(Goods::getId,labels.getApplyIdList() ));
            }
        }
    }