|
|
|
|
@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO;
|
|
|
|
|
import cn.iocoder.yudao.module.common.dal.dataobject.moldrepair.MoldRepairDO;
|
|
|
|
|
import cn.iocoder.yudao.module.common.dal.dataobject.moldrepair.MoldRepairLineDO;
|
|
|
|
|
import cn.iocoder.yudao.module.common.dal.dataobject.moldticketresults.MoldTicketResultsDO;
|
|
|
|
|
import cn.iocoder.yudao.module.erp.controller.admin.mold.vo.MoldBrandTreeRespVO;
|
|
|
|
|
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
|
|
|
|
|
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductUnitDO;
|
|
|
|
|
import cn.iocoder.yudao.module.common.dal.mysql.mold.MoldBrandMapper;
|
|
|
|
|
@ -24,7 +25,6 @@ import cn.iocoder.yudao.module.common.controller.admin.moldticketmanagement.enum
|
|
|
|
|
import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
|
|
|
|
|
import cn.iocoder.yudao.module.erp.service.product.ErpProductUnitService;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
@ -317,4 +317,35 @@ public class MoldBrandServiceImpl implements MoldBrandService {
|
|
|
|
|
private void deleteMoldBrandProductByBrandId(Long brandId) {
|
|
|
|
|
moldBrandProductMapper.deleteByBrandId(brandId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<MoldBrandTreeRespVO> getMoldBrandTree() {
|
|
|
|
|
// 1. 查询所有模具类型
|
|
|
|
|
List<MoldBrandDO> allMoldBrands = moldBrandMapper.selectList();
|
|
|
|
|
|
|
|
|
|
// 2. 构建树形结构
|
|
|
|
|
return buildMoldBrandTree(allMoldBrands);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 构建树形结构
|
|
|
|
|
*/
|
|
|
|
|
private List<MoldBrandTreeRespVO> buildMoldBrandTree(List<MoldBrandDO> allMoldBrands) {
|
|
|
|
|
return allMoldBrands.stream()
|
|
|
|
|
.map(this::convertToTreeRespVO)
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
private MoldBrandTreeRespVO convertToTreeRespVO(MoldBrandDO moldBrand) {
|
|
|
|
|
// 使用BeanUtils或手动设置属性
|
|
|
|
|
MoldBrandTreeRespVO respVO = new MoldBrandTreeRespVO();
|
|
|
|
|
|
|
|
|
|
// 复制公共属性(假设MoldBrandRespVO有对应的方法)
|
|
|
|
|
BeanUtils.copyProperties(moldBrand, respVO);
|
|
|
|
|
|
|
|
|
|
// 设置树状结构属性
|
|
|
|
|
respVO.setChildren(new ArrayList<>()); // 空子节点
|
|
|
|
|
respVO.setLeaf(true); // 叶子节点
|
|
|
|
|
return respVO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|