| | |
| | | import com.doumee.dao.business.model.Goods; |
| | | import com.doumee.dao.business.model.Labels; |
| | | import com.doumee.dao.web.response.LabelsResponse; |
| | | import com.doumee.service.business.AreasService; |
| | | import com.doumee.service.business.LabelsService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import io.swagger.models.auth.In; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | private AreasMapper areasMapper; |
| | | |
| | | @Autowired |
| | | private AreasService areasService; |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | |
| | | @Autowired |
| | |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | labels.setCreator(user.getId()); |
| | | labels.setCreateDate(new Date()); |
| | | labels.setEditor(user.getId()); |
| | | labels.setEditDate(labels.getCreateDate()); |
| | | labels.setIsdeleted(Constants.ZERO); |
| | | labels.setStatus(Constants.ZERO); |
| | | /* if(labels.getParentId()!=null){ |
| | |
| | | areasMapper.update(null,new UpdateWrapper<Areas>().lambda() |
| | | .set(Areas::getBigAreaId,labels.getId()) |
| | | .in(Areas::getId,labels.getAreaIdList())); |
| | | areasService.cacheData(); |
| | | } |
| | | return labels.getId(); |
| | | } |
| | |
| | | labels.setEditDate(new Date()); |
| | | labels.setEditor(user.getId()); |
| | | labelsMapper.updateById(labels); |
| | | if(query!=null && Constants.equalsInteger(query.getType(),Constants.LabelsType.BIG_AREA.getKey())){ |
| | | int num = areasMapper.update(null, new UpdateWrapper<Areas>().lambda() |
| | | .set(Areas::getBigAreaId, null) |
| | | .eq(Areas::getBigAreaId, labels.getId())); |
| | | if(num>0){ |
| | | areasService.cacheData(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | Labels labels=new Labels(); |
| | | ids.stream().forEach(s->{ |
| | | int num =0; |
| | | for(Integer s : ids){ |
| | | labels.setId(s); |
| | | labels.setIsdeleted(Constants.ONE); |
| | | labels.setEditDate(new Date()); |
| | | labels.setEditor(user.getId()); |
| | | labelsMapper.updateById(labels); |
| | | }); |
| | | num += areasMapper.update(null, new UpdateWrapper<Areas>().lambda() |
| | | .set(Areas::getBigAreaId, null) |
| | | .eq(Areas::getBigAreaId, labels.getId())); |
| | | } |
| | | if(num>0){ |
| | | areasService.cacheData(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | labelsMapper.updateById(labels); |
| | | if(Constants.equalsInteger(model.getType(),Constants.LabelsType.BIG_AREA.getKey())){ |
| | | //先清空原来所有绑定的数据 |
| | | areasMapper.update(null, new UpdateWrapper<Areas>().lambda() |
| | | int num = areasMapper.update(null, new UpdateWrapper<Areas>().lambda() |
| | | .set(Areas::getBigAreaId, null) |
| | | .eq(Areas::getBigAreaId, labels.getId())); |
| | | if( labels.getAreaIdList()!=null |
| | | &&labels.getAreaIdList().size()>0){ |
| | | //设置最新绑定的数据 |
| | | areasMapper.update(null, new UpdateWrapper<Areas>().lambda() |
| | | num += areasMapper.update(null, new UpdateWrapper<Areas>().lambda() |
| | | .set(Areas::getBigAreaId, labels.getId()) |
| | | .in(Areas::getId, labels.getAreaIdList())); |
| | | } |
| | | if(num>0){ |
| | | areasService.cacheData(); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | queryWrapper.selectAll(Labels.class); |
| | | queryWrapper.select("(select name from labels where id=t.PARENT_ID) as parentName"); |
| | | if(Constants.equalsInteger(pageWrap.getModel().getType(),Constants.LabelsType.HOMEZHUANQU.getKey())){ |
| | | queryWrapper.select("(select count(g.id) from goods g where g.isdeleted=0 and g.ZHUANQU_IDS like concat('%[',t.id,']%') ) as goodsNum"); |
| | | } |
| | | if(Constants.equalsInteger(pageWrap.getModel().getType(),Constants.LabelsType.APPLICABLE_BRAND.getKey())){ |
| | | queryWrapper.select("(select count(g.id) from goods g where g.isdeleted=0 and g.BRAND_IDS like concat('%[',t.id,']%') ) as goodsNum"); |
| | | } |
| | | if(Constants.equalsInteger(pageWrap.getModel().getType(),Constants.LabelsType.SERIES_BRAND.getKey())){ |
| | | queryWrapper.select("(select count(g.id) from goods g where g.isdeleted=0 and g.SERIAL_IDS like concat('%[',t.id,']%') ) as goodsNum"); |
| | | } |
| | | queryWrapper.like(StringUtils.isNotBlank(pageWrap.getModel().getName()),Labels::getName,pageWrap.getModel().getName()); |
| | | queryWrapper.eq(pageWrap.getModel().getParentId()!=null,Labels::getParentId,pageWrap.getModel().getParentId()); |
| | | queryWrapper.eq(pageWrap.getModel().getType()!=null,Labels::getType,pageWrap.getModel().getType()); |
| | |
| | | IPage<Labels> result = labelsJoinMapper.selectJoinPage(page,Labels.class, queryWrapper); |
| | | /* String resourcePath=systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode();*/ |
| | | if(org.apache.commons.collections.CollectionUtils.isNotEmpty(result.getRecords())){ |
| | | String path = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode() |
| | | + systemDictDataBiz.queryByCode(Constants.OSS,Constants.LABELS_IMG).getCode(); |
| | | for(Labels model:result.getRecords()){ |
| | | if(model.getParentId()==null){ |
| | | model.setTypeLevel(0); |
| | | }else{ |
| | | model.setTypeLevel(1); |
| | | } |
| | | if(StringUtils.isNotBlank(model.getImgurl())){ |
| | | model.setImgFullurl(path + model.getImgurl()); |
| | | } |
| | | if(Constants.equalsInteger(model.getType(),Constants.LabelsType.BIG_AREA.getKey())){ |
| | | //如果是大区信息,查询所有绑定额省份信息 |
| | | model.setAreaList(areasMapper.selectList(new LambdaQueryWrapper<Areas>() |