严智鑫
2024-05-07 b365a0879edc787655b908b0dbb65b5e966bb23b
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
package com.mes.downglassinfo.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mes.downglassinfo.entity.DownGlassInfo;
import com.mes.downglassinfo.entity.DownGlassTask;
import com.mes.downglassinfo.mapper.DownGlassInfoMapper;
import com.mes.downglassinfo.service.DownGlassInfoService;
import com.mes.downglassinfo.service.DownGlassTaskService;
import com.mes.downworkstation.entity.DownWorkstation;
import com.mes.downworkstation.mapper.DownWorkstationMapper;
import com.mes.downworkstation.service.DownWorkstationService;
import com.mes.downworkstation.service.DownWorkstationTaskService;
import com.mes.tools.WebSocketServer;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
@Service
public class DownGlassInfoServiceImpl extends ServiceImpl<DownGlassInfoMapper, DownGlassInfo> implements DownGlassInfoService {
 
    // 根据流程卡号查询最大序号
    @Override
    public Integer getMaxSequenceByFlowCardId(String flowCardId) {
        LambdaQueryWrapper<DownGlassInfo> lambdaQueryWrapper = Wrappers.lambdaQuery();
        lambdaQueryWrapper.eq(DownGlassInfo::getFlowCardId, flowCardId)
                .select(DownGlassInfo::getSequence)
                .orderByDesc(DownGlassInfo::getSequence)
                .last("LIMIT 1");
 
        DownGlassInfo downGlassInfo = baseMapper.selectOne(lambdaQueryWrapper);
        return downGlassInfo != null ? downGlassInfo.getSequence() : 0;
    }
 
 
    @Override
    public void insertDownGlassInfo(DownGlassInfo downGlassInfo) {
        baseMapper.insert(downGlassInfo);
    }
 
 
}