新火炬后端单体项目初始化代码
zhangherong
2025-06-12 6abc1a2fb78003bb1ea6283d813b8ccc0bcd9b2b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package org.jeecg.modules.base.service.impl;
 
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.base.entity.ProductionLineWarehouseClient;
import org.jeecg.modules.base.mapper.FactoryModelMapper;
import org.jeecg.modules.base.mapper.ProductionLineWarehouseClientMapper;
import org.jeecg.modules.base.service.IProductionLineWarehouseClientService;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
 
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
 
/**
 * @Description: 线边库服务对象
 * @Author: jeecg-boot
 * @Date:   2023-01-28
 * @Version: V1.0
 */
@Service
public class ProductionLineWarehouseClientServiceImpl extends ServiceImpl<ProductionLineWarehouseClientMapper, ProductionLineWarehouseClient> implements IProductionLineWarehouseClientService {
 
    @Autowired
    private ProductionLineWarehouseClientMapper productionLineWarehouseClientMapper;
    @Autowired
    private FactoryModelMapper factoryModelMapper;
 
    @Override
    public List<ProductionLineWarehouseClient> selectByMainId(String mainId) {
        return productionLineWarehouseClientMapper.selectByMainId(mainId);
    }
 
    @Override
    public Page<Map<String, Object>> getFactoryList(Page<Map<String, Object>> page, Integer version, String parentId, List<String> ids) {
        return page.setRecords(baseMapper.getFactoryList(page,version,getAllChild(parentId),ids));
    }
    public List<String> getAllChild(String parentId){
        List<String> list = factoryModelMapper.getAllChildrenIdByParentId(parentId);
        CopyOnWriteArrayList<String> cowList = new CopyOnWriteArrayList<>();
        cowList.addAll(list);
        if(CollectionUtils.isNotEmpty(cowList)){
            cowList.forEach(str->{
                cowList.addAll(getAllChild(str));
            });
        }
        cowList.add(parentId);
        return cowList;
    }
}