package com.doumee.service.business.impl;
|
|
import com.doumee.biz.system.SystemDictDataBiz;
|
import com.doumee.core.constants.ResponseStatus;
|
import com.doumee.core.exception.BusinessException;
|
import com.doumee.core.model.LoginUserInfo;
|
import com.doumee.core.model.PageData;
|
import com.doumee.core.model.PageWrap;
|
import com.doumee.core.utils.Constants;
|
import com.doumee.core.utils.PinYinUtil;
|
import com.doumee.core.utils.Utils;
|
import com.doumee.dao.business.CateAttrMapper;
|
import com.doumee.dao.business.CateParamMapper;
|
import com.doumee.dao.business.CategoryMapper;
|
import com.doumee.dao.business.model.*;
|
import com.doumee.service.business.CategoryService;
|
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 org.apache.shiro.SecurityUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
import org.springframework.util.CollectionUtils;
|
|
import java.util.*;
|
|
/**
|
* 品类信息表Service实现
|
* @author 江蹄蹄
|
* @date 2023/05/12 13:58
|
*/
|
@Service
|
public class CategoryServiceImpl implements CategoryService {
|
|
@Autowired
|
private CategoryMapper categoryMapper;
|
|
@Autowired
|
private CateParamMapper cateParamMapper;
|
|
@Autowired
|
private CateAttrMapper cateAttrMapper;
|
|
@Autowired
|
private CateBudgetMapper cateBudgetMapper;
|
|
@Autowired
|
private SystemDictDataBiz systemDictDataBiz;
|
|
@Override
|
public Integer create(Category category) {
|
LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
|
if(categoryMapper.selectCount(new QueryWrapper<Category>().eq("ISDELETED",Constants.ZERO).eq("name",category.getName()))>0){
|
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"【"+category.getName()+"】已存在");
|
};
|
category.setStatus(Constants.ZERO);
|
category.setCreateDate(new Date());
|
category.setCreator(user.getId());
|
category.setIsdeleted(Constants.ZERO);
|
//处理拼音问题
|
category.setPinyin(PinYinUtil.getFullSpell(category.getName()));
|
category.setShortPinyin(PinYinUtil.getFirstSpell(category.getName()));
|
categoryMapper.insert(category);
|
List<CateParam> paramList = category.getParamList();
|
if(!Objects.isNull(paramList)&¶mList.size()> Constants.ZERO){
|
for (int i = 0; i < paramList.size(); i++) {
|
CateParam cateParam = paramList.get(i);
|
cateParam.setCreator(user.getId());
|
cateParam.setCreateDate(new Date());
|
cateParam.setIsdeleted(Constants.ZERO);
|
cateParam.setSortnum(i+Constants.ONE);
|
cateParam.setStatus(Constants.ZERO);
|
cateParam.setCategoryId(category.getId());
|
cateParamMapper.insert(cateParam);
|
}
|
}
|
List<CateAttr> attrFirst = category.getAttrFirstList();
|
if(!Objects.isNull(attrFirst)&&attrFirst.size()> Constants.ZERO){
|
for (int i = 0; i < attrFirst.size(); i++) {
|
CateAttr cateAttr = attrFirst.get(i);
|
cateAttr.setCreator(user.getId());
|
cateAttr.setCreateDate(new Date());
|
cateAttr.setIsdeleted(Constants.ZERO);
|
cateAttr.setSortnum(i+Constants.ONE);
|
cateAttr.setStatus(Constants.ZERO);
|
cateAttr.setCategoryId(category.getId());
|
cateAttr.setType(Constants.ZERO);
|
cateAttrMapper.insert(cateAttr);
|
}
|
}
|
List<CateAttr> attrSecond = category.getAttrSecondList();
|
if(!Objects.isNull(attrSecond)&&attrSecond.size()> Constants.ZERO){
|
for (int i = 0; i < attrSecond.size(); i++) {
|
CateAttr cateAttr = attrSecond.get(i);
|
cateAttr.setCreator(user.getId());
|
cateAttr.setCreateDate(new Date());
|
cateAttr.setIsdeleted(Constants.ZERO);
|
cateAttr.setSortnum(i+Constants.ONE);
|
cateAttr.setStatus(Constants.ZERO);
|
cateAttr.setCategoryId(category.getId());
|
cateAttr.setType(Constants.ONE);
|
cateAttrMapper.insert(cateAttr);
|
}
|
}
|
List<CateBudget> budgetList = category.getBudgetList();
|
if(!Objects.isNull(budgetList)&&budgetList.size()> Constants.ZERO){
|
for (int i = 0; i < budgetList.size(); i++) {
|
CateBudget cateBudget = budgetList.get(i);
|
cateBudget.setCreator(user.getId());
|
cateBudget.setCreateDate(new Date());
|
cateBudget.setIsdeleted(Constants.ZERO);
|
cateBudget.setSortnum(i+Constants.ONE);
|
cateBudget.setStatus(Constants.ZERO);
|
cateBudget.setCategoryId(category.getId());
|
cateBudgetMapper.insert(cateBudget);
|
}
|
}
|
return category.getId();
|
}
|
|
|
@Override
|
public Integer companyCreate(Category category) {
|
LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
|
if(categoryMapper.selectCount(new QueryWrapper<Category>().eq("ISDELETED",Constants.ZERO)
|
.eq("COMPANY_ID",user.getCompanyId()).eq("name",category.getName()))>0){
|
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"【"+category.getName()+"】已存在");
|
};
|
category.setStatus(Constants.ZERO);
|
category.setCreateDate(new Date());
|
category.setCreator(user.getId());
|
category.setIsdeleted(Constants.ZERO);
|
//处理拼音问题
|
category.setPinyin(PinYinUtil.getFullSpell(category.getName()));
|
category.setShortPinyin(PinYinUtil.getFirstSpell(category.getName()));
|
categoryMapper.insert(category);
|
List<CateParam> paramList = category.getParamList();
|
if(!Objects.isNull(paramList)&¶mList.size()> Constants.ZERO){
|
for (int i = 0; i < paramList.size(); i++) {
|
CateParam cateParam = paramList.get(i);
|
cateParam.setCreator(user.getId());
|
cateParam.setCreateDate(new Date());
|
cateParam.setIsdeleted(Constants.ZERO);
|
cateParam.setSortnum(i+Constants.ONE);
|
cateParam.setStatus(Constants.ZERO);
|
cateParam.setCategoryId(category.getId());
|
cateParamMapper.insert(cateParam);
|
}
|
}
|
List<CateBudget> budgetList = category.getBudgetList();
|
if(!Objects.isNull(budgetList)&&budgetList.size()> Constants.ZERO){
|
for (int i = 0; i < budgetList.size(); i++) {
|
CateBudget cateBudget = budgetList.get(i);
|
cateBudget.setCreator(user.getId());
|
cateBudget.setCreateDate(new Date());
|
cateBudget.setIsdeleted(Constants.ZERO);
|
cateBudget.setSortnum(i+Constants.ONE);
|
cateBudget.setStatus(Constants.ZERO);
|
cateBudget.setCategoryId(category.getId());
|
cateBudgetMapper.insert(cateBudget);
|
}
|
}
|
return category.getId();
|
}
|
|
|
|
@Override
|
public void deleteById(Integer id) {
|
Category category = categoryMapper.selectById(id);
|
if(Objects.isNull(category)){
|
throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到对象信息");
|
}
|
category.setIsdeleted(Constants.ONE);
|
categoryMapper.updateById(category);
|
}
|
|
|
|
@Override
|
public void delete(Category category) {
|
UpdateWrapper<Category> deleteWrapper = new UpdateWrapper<>(category);
|
categoryMapper.delete(deleteWrapper);
|
}
|
|
@Override
|
public void deleteByIdInBatch(List<Integer> ids) {
|
if (CollectionUtils.isEmpty(ids)) {
|
return;
|
}
|
categoryMapper.deleteBatchIds(ids);
|
}
|
|
@Override
|
public void updateById(Category category) {
|
LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
|
if(categoryMapper.selectCount(new QueryWrapper<Category>().eq("ISDELETED",Constants.ZERO).ne("id",category.getId()).eq("name",category.getName()))>0){
|
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"【"+category.getName()+"】已存在");
|
};
|
category.setStatus(Constants.ZERO);
|
category.setEditDate(new Date());
|
category.setEditor(user.getId());
|
category.setIsdeleted(Constants.ZERO);
|
//处理拼音问题
|
category.setPinyin(PinYinUtil.getFullSpell(category.getName()));
|
category.setShortPinyin(PinYinUtil.getFirstSpell(category.getName()));
|
categoryMapper.updateById(category);
|
//处理属性1数据
|
cateParamMapper.delete(new QueryWrapper<CateParam>().eq("CATEGORY_ID",category.getId()));
|
List<CateParam> paramList = category.getParamList();
|
if(!Objects.isNull(paramList)&¶mList.size()> Constants.ZERO){
|
for (int i = 0; i < paramList.size(); i++) {
|
CateParam cateParam = paramList.get(i);
|
cateParam.setCreator(user.getId());
|
cateParam.setCreateDate(new Date());
|
cateParam.setIsdeleted(Constants.ZERO);
|
cateParam.setSortnum(i+Constants.ONE);
|
cateParam.setStatus(Constants.ZERO);
|
cateParam.setCategoryId(category.getId());
|
cateParamMapper.insert(cateParam);
|
}
|
}
|
|
this.dealCateAttr(category.getAttrFirstList(),Constants.ZERO,category.getId(),user);
|
this.dealCateAttr(category.getAttrSecondList(),Constants.ONE,category.getId(),user);
|
// cateAttrMapper.delete(new QueryWrapper<CateAttr>().eq("CATEGORY_ID",category.getId()));
|
// List<CateAttr> attrFirst = category.getAttrFirstList();
|
// if(!Objects.isNull(attrFirst)&&attrFirst.size()> Constants.ZERO){
|
// for (int i = 0; i < attrFirst.size(); i++) {
|
// CateAttr cateAttr = attrFirst.get(i);
|
// cateAttr.setCreator(user.getId());
|
// cateAttr.setCreateDate(new Date());
|
// cateAttr.setIsdeleted(Constants.ZERO);
|
// cateAttr.setSortnum(i+Constants.ONE);
|
// cateAttr.setStatus(Constants.ZERO);
|
// cateAttr.setCategoryId(category.getId());
|
// cateAttr.setType(Constants.ZERO);
|
// cateAttrMapper.insert(cateAttr);
|
// }
|
// }
|
// List<CateAttr> attrSecond = category.getAttrSecondList();
|
// if(!Objects.isNull(attrSecond)&&attrSecond.size()> Constants.ZERO){
|
// for (int i = 0; i < attrSecond.size(); i++) {
|
// CateAttr cateAttr = attrSecond.get(i);
|
// cateAttr.setCreator(user.getId());
|
// cateAttr.setCreateDate(new Date());
|
// cateAttr.setIsdeleted(Constants.ZERO);
|
// cateAttr.setSortnum(i+Constants.ONE);
|
// cateAttr.setStatus(Constants.ZERO);
|
// cateAttr.setCategoryId(category.getId());
|
// cateAttr.setType(Constants.ONE);
|
// cateAttrMapper.insert(cateAttr);
|
// }
|
// }
|
|
cateBudgetMapper.delete(new QueryWrapper<CateBudget>().eq("CATEGORY_ID",category.getId()));
|
List<CateBudget> budgetList = category.getBudgetList();
|
if(!Objects.isNull(budgetList)&&budgetList.size()> Constants.ZERO){
|
for (int i = 0; i < budgetList.size(); i++) {
|
CateBudget cateBudget = budgetList.get(i);
|
cateBudget.setCreator(user.getId());
|
cateBudget.setCreateDate(new Date());
|
cateBudget.setIsdeleted(Constants.ZERO);
|
cateBudget.setSortnum(i+Constants.ONE);
|
cateBudget.setStatus(Constants.ZERO);
|
cateBudget.setCategoryId(category.getId());
|
cateBudgetMapper.insert(cateBudget);
|
}
|
}
|
}
|
|
|
@Override
|
public void companyUpdateById(Category category) {
|
LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
|
if(categoryMapper.selectCount(new QueryWrapper<Category>().eq("ISDELETED",Constants.ZERO).ne("id",category.getId()).eq("name",category.getName()))>0){
|
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"【"+category.getName()+"】已存在");
|
};
|
category.setStatus(Constants.ZERO);
|
category.setEditDate(new Date());
|
category.setEditor(user.getId());
|
category.setIsdeleted(Constants.ZERO);
|
//处理拼音问题
|
category.setPinyin(PinYinUtil.getFullSpell(category.getName()));
|
category.setShortPinyin(PinYinUtil.getFirstSpell(category.getName()));
|
categoryMapper.updateById(category);
|
//处理属性配置
|
cateParamMapper.delete(new QueryWrapper<CateParam>().eq("CATEGORY_ID",category.getId()));
|
List<CateParam> paramList = category.getParamList();
|
if(!Objects.isNull(paramList)&¶mList.size()> Constants.ZERO){
|
for (int i = 0; i < paramList.size(); i++) {
|
CateParam cateParam = paramList.get(i);
|
cateParam.setCreator(user.getId());
|
cateParam.setCreateDate(new Date());
|
cateParam.setIsdeleted(Constants.ZERO);
|
cateParam.setSortnum(i+Constants.ONE);
|
cateParam.setStatus(Constants.ZERO);
|
cateParam.setCategoryId(category.getId());
|
cateParamMapper.insert(cateParam);
|
}
|
}
|
cateBudgetMapper.delete(new QueryWrapper<CateBudget>().eq("CATEGORY_ID",category.getId()));
|
List<CateBudget> budgetList = category.getBudgetList();
|
if(!Objects.isNull(budgetList)&&budgetList.size()> Constants.ZERO){
|
for (int i = 0; i < budgetList.size(); i++) {
|
CateBudget cateBudget = budgetList.get(i);
|
cateBudget.setCreator(user.getId());
|
cateBudget.setCreateDate(new Date());
|
cateBudget.setIsdeleted(Constants.ZERO);
|
cateBudget.setSortnum(i+Constants.ONE);
|
cateBudget.setStatus(Constants.ZERO);
|
cateBudget.setCategoryId(category.getId());
|
cateBudgetMapper.insert(cateBudget);
|
}
|
}
|
}
|
|
|
public void dealCateAttr(List<CateAttr> cateAttrList,Integer type,Integer categoryId,LoginUserInfo user){
|
List<CateAttr> oldCateAttrList = cateAttrMapper.selectList(new QueryWrapper<CateAttr>().eq("ISDELETED",Constants.ZERO).eq("CATEGORY_ID",categoryId).eq("TYPE",type));
|
List<CateAttr> addCateAttr = new ArrayList<>();
|
List<CateAttr> updCateAttr = new ArrayList<>();
|
List<CateAttr> delCateAttr = new ArrayList<>();
|
for (CateAttr oldCateAttr:oldCateAttrList) {
|
Boolean flag = false;
|
for (CateAttr cateAttr:cateAttrList) {
|
if(oldCateAttr.getName().equals(cateAttr.getName())){
|
updCateAttr.add(oldCateAttr);
|
flag = true;
|
break;
|
}
|
}
|
if(!flag){
|
delCateAttr.add(oldCateAttr);
|
}
|
}
|
CateAttr maxCateAttr = cateAttrMapper.selectOne(new QueryWrapper<CateAttr>().eq("ISDELETED",Constants.ZERO).eq("CATEGORY_ID",categoryId).eq("TYPE",type).orderByDesc(" SORTNUM ").last(" limit 1 "));
|
Integer nextSortNum = 0;
|
if(!Objects.isNull(maxCateAttr)){
|
nextSortNum = maxCateAttr.getSortnum();
|
}
|
//处理新增数据
|
for (CateAttr cateAttr:cateAttrList) {
|
Boolean flag = false;
|
for (CateAttr oldCateAttr:oldCateAttrList) {
|
if(cateAttr.getName().equals(oldCateAttr.getName())){
|
flag = true;
|
break;
|
}
|
}
|
if(!flag){
|
nextSortNum = nextSortNum + 1;
|
cateAttr.setCreator(user.getId());
|
cateAttr.setCreateDate(new Date());
|
cateAttr.setIsdeleted(Constants.ZERO);
|
cateAttr.setSortnum(nextSortNum);
|
cateAttr.setStatus(Constants.ZERO);
|
cateAttr.setCategoryId(categoryId);
|
cateAttr.setType(type);
|
addCateAttr.add(cateAttr);
|
}
|
}
|
addCateAttr.forEach(i->{
|
cateAttrMapper.insert(i);
|
});
|
delCateAttr.forEach(i->{
|
i.setIsdeleted(Constants.ONE);
|
i.setEditDate(new Date());
|
i.setEditor(user.getId());
|
cateAttrMapper.updateById(i);
|
});
|
}
|
|
@Override
|
public void updateDisableById(Category category) {
|
LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
|
category.setEditDate(new Date());
|
category.setEditor(user.getId());
|
categoryMapper.updateById(category);
|
}
|
|
@Override
|
public void updateByIdInBatch(List<Category> categorys) {
|
if (CollectionUtils.isEmpty(categorys)) {
|
return;
|
}
|
for (Category category: categorys) {
|
this.updateById(category);
|
}
|
}
|
|
@Override
|
public Category findById(Integer id) {
|
Category category = categoryMapper.selectById(id);
|
String prefixUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.FILE_DIR).getCode()
|
+ systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.PROJECTS).getCode();
|
category.setPrefixUrl(prefixUrl);
|
category.setParamList(cateParamMapper.selectList(new QueryWrapper<CateParam>().eq("CATEGORY_ID",id).eq("ISDELETED",Constants.ZERO).orderByAsc(" SORTNUM ")));
|
category.setAttrFirstList(cateAttrMapper.selectList(new QueryWrapper<CateAttr>().eq("TYPE",Constants.ZERO).eq("ISDELETED",Constants.ZERO).eq("CATEGORY_ID",id).orderByAsc(" SORTNUM ")));
|
category.setAttrSecondList(cateAttrMapper.selectList(new QueryWrapper<CateAttr>().eq("TYPE",Constants.ONE).eq("ISDELETED",Constants.ZERO).eq("CATEGORY_ID",id).orderByAsc(" SORTNUM ")));
|
category.setBudgetList(cateBudgetMapper.selectList(new QueryWrapper<CateBudget>().eq("CATEGORY_ID",id).eq("ISDELETED",Constants.ZERO).orderByAsc(" SORTNUM ")));
|
return category;
|
}
|
|
@Override
|
public Category findOne(Category category) {
|
QueryWrapper<Category> wrapper = new QueryWrapper<>(category);
|
return categoryMapper.selectOne(wrapper);
|
}
|
|
@Override
|
public List<Category> findList(Category category) {
|
QueryWrapper<Category> wrapper = new QueryWrapper<>(category)
|
.eq("STATUS",Constants.ZERO)
|
.eq("ISDELETED",Constants.ZERO)
|
.orderByAsc(" SORTNUM ");
|
List<Category> list = categoryMapper.selectList(wrapper);
|
String prefixUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.FILE_DIR).getCode()
|
+ systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.PROJECTS).getCode();
|
for (Category c:list) {
|
c.setPrefixUrl(prefixUrl);
|
c.setAttrFirstList(cateAttrMapper.selectList(new QueryWrapper<CateAttr>().eq("TYPE",Constants.ZERO).eq("ISDELETED",Constants.ZERO).eq("CATEGORY_ID",c.getId()).orderByAsc(" SORTNUM ")));
|
c.setAttrSecondList(cateAttrMapper.selectList(new QueryWrapper<CateAttr>().eq("TYPE",Constants.ONE).eq("ISDELETED",Constants.ZERO).eq("CATEGORY_ID",c.getId()).orderByAsc(" SORTNUM ")));
|
c.setBudgetList(cateBudgetMapper.selectList(new QueryWrapper<CateBudget>().eq("CATEGORY_ID",c.getId()).orderByAsc(" SORTNUM ")));
|
}
|
return list;
|
}
|
|
@Override
|
public List<Category> findListForGoods(Integer goodsId) {
|
QueryWrapper<Category> wrapper = new QueryWrapper<Category>()
|
.eq("STATUS",Constants.ZERO)
|
.eq("ISDELETED",Constants.ZERO)
|
.orderByAsc(" SORTNUM ");
|
List<Category> list = categoryMapper.selectList(wrapper);
|
String prefixUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.FILE_DIR).getCode()
|
+ systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.PROJECTS).getCode();
|
for (Category c:list) {
|
c.setPrefixUrl(prefixUrl);
|
c.setAttrFirstList(cateAttrMapper.selectList(new QueryWrapper<CateAttr>().eq("TYPE",Constants.ZERO).eq("ISDELETED",Constants.ZERO).eq("CATEGORY_ID",c.getId()).orderByAsc(" SORTNUM ")));
|
c.setAttrSecondList(cateAttrMapper.selectList(new QueryWrapper<CateAttr>().eq("TYPE",Constants.ONE).eq("ISDELETED",Constants.ZERO).eq("CATEGORY_ID",c.getId()).orderByAsc(" SORTNUM ")));
|
c.setParamList(cateParamMapper.selectList(new QueryWrapper<CateParam>()
|
.select(" * , ( select gp.VAL from goods_param gp where gp.GOODS_ID = "+goodsId+" and gp.PRAMA_ID = cate_param.id limit 1 ) as val ")
|
.eq("CATEGORY_ID",c.getId()).orderByAsc(" SORTNUM ")));
|
}
|
return list;
|
}
|
|
|
|
@Override
|
public PageData<Category> findPage(PageWrap<Category> pageWrap) {
|
IPage<Category> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
|
QueryWrapper<Category> queryWrapper = new QueryWrapper<>();
|
Utils.MP.blankToNull(pageWrap.getModel());
|
queryWrapper.lambda().eq(Category::getIsdeleted, Constants.ZERO);
|
if (pageWrap.getModel().getName() != null) {
|
queryWrapper.lambda().like(Category::getName, pageWrap.getModel().getName());
|
}
|
if (pageWrap.getModel().getStatus() != null) {
|
queryWrapper.lambda().eq(Category::getStatus, pageWrap.getModel().getStatus());
|
}
|
queryWrapper.lambda().orderByAsc(Category::getSortnum);
|
IPage<Category> categoryIPage = categoryMapper.selectPage(page, queryWrapper);
|
String prefixUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.FILE_DIR).getCode()
|
+ systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.PROJECTS).getCode();
|
categoryIPage.getRecords().forEach(i->{
|
i.setPrefixUrl(prefixUrl);
|
});
|
return PageData.from(categoryIPage);
|
}
|
|
@Override
|
public long count(Category category) {
|
QueryWrapper<Category> wrapper = new QueryWrapper<>(category);
|
return categoryMapper.selectCount(wrapper);
|
}
|
|
|
/**********************************************************************************/
|
|
@Override
|
public List<Category> companyFindList(Category category) {
|
LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
|
QueryWrapper<Category> wrapper = new QueryWrapper<>(category)
|
.eq("STATUS",Constants.ZERO)
|
.eq("COMPANY_ID",user.getCompanyId())
|
.eq("ISDELETED",Constants.ZERO)
|
.orderByAsc(" SORTNUM ");
|
List<Category> list = categoryMapper.selectList(wrapper);
|
String prefixUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.FILE_DIR).getCode()
|
+ systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.PROJECTS).getCode();
|
for (Category c:list) {
|
c.setPrefixUrl(prefixUrl);
|
c.setBudgetList(cateBudgetMapper.selectList(new QueryWrapper<CateBudget>().eq("STATUS",Constants.ZERO).eq("CATEGORY_ID",c.getId()).orderByAsc(" SORTNUM ")));
|
c.setParamList(cateParamMapper.selectList(new QueryWrapper<CateParam>().eq("STATUS",Constants.ZERO).eq("CATEGORY_ID",c.getId()).orderByAsc("SORTNUM")));
|
}
|
return list;
|
}
|
|
|
|
}
|