| | |
| | | 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(); |
| | | } |
| | | } |
| | | } |
| | | |