严智鑫
2025-06-13 d14cdaf28222bfef468185e34de7c823f1436b19
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
package com.mes.model.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.mes.model.entity.Account;
import com.mes.model.entity.Machine;
import com.mes.model.entity.PlcType;
import com.mes.model.entity.ProtocolType;
import com.mes.model.mapper.AccountMapper;
import com.mes.model.mapper.MachineMapper;
import com.mes.model.mapper.PlcTypeMapper;
import com.mes.model.mapper.ProtocolTypeMapper;
import com.mes.model.service.AccountService;
import com.mes.model.service.MachineService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.ArrayList;
import java.util.List;
 
/**
 * <p>
 * 账户表 服务实现类
 * </p>
 *
 * @author yanzhixin
 * @since 2024-09-03
 */
@Slf4j
@Service
public class MachineServiceImpl extends MPJBaseServiceImpl<MachineMapper, Machine> implements MachineService {
    @Autowired
    private PlcTypeMapper plcTypeMapper;
    @Autowired
    private ProtocolTypeMapper protocolTypeMapper;
    public List<Machine> getMachineConfig() {
        List<Machine> machineConfig = baseMapper.selectList(null);
        for (int i=0;i<machineConfig.size();i++) {
            PlcType plcType=plcTypeMapper.selectOne(new QueryWrapper<PlcType>().lambda()
                    .eq(PlcType::getId,machineConfig.get(i).getPlcTypeId()));
            ProtocolType protocolType=protocolTypeMapper.selectOne(new QueryWrapper<ProtocolType>().lambda()
                    .eq(ProtocolType::getId,machineConfig.get(i).getProtocolTypeId()));
            machineConfig.get(i).setPlcType(plcType);
            machineConfig.get(i).setProtocolType(protocolType);
        }
        return machineConfig;
    }
 
}