4 天以前 06321d70dd7617fdc7d475b190e629143fec3263
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
package cn.iocoder.yudao.module.mes.dal.mysql.pro.pallet;
 
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.mes.controller.admin.pro.pallet.vo.MesProPalletPageReqVO;
import cn.iocoder.yudao.module.mes.dal.dataobject.pro.pallet.MesProPalletDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
 
import java.util.List;
 
/**
 * MES 托盘码 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface MesProPalletMapper extends BaseMapperX<MesProPalletDO> {
 
    default MesProPalletDO selectByCode(String code) {
        return selectOne(MesProPalletDO::getCode, code);
    }
 
    default List<MesProPalletDO> selectListByBatchId(Long batchId) {
        return selectList(MesProPalletDO::getBatchId, batchId);
    }
 
    default PageResult<MesProPalletDO> selectPage(MesProPalletPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MesProPalletDO>()
                .likeIfPresent(MesProPalletDO::getCode, reqVO.getCode())
                .eqIfPresent(MesProPalletDO::getBatchId, reqVO.getBatchId())
                .likeIfPresent(MesProPalletDO::getBatchCode, reqVO.getBatchCode())
                .eqIfPresent(MesProPalletDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(MesProPalletDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MesProPalletDO::getId));
    }
 
    /**
     * 查询批次内托盘最大序号(包含已逻辑删除记录,保证序号不回退、码值唯一)
     *
     * @param batchId 批次编号
     * @return 最大托盘序号,无记录返回 0
     */
    @Select("SELECT IFNULL(MAX(pallet_no), 0) FROM mes_pro_pallet WHERE batch_id = #{batchId}")
    Integer selectMaxPalletNo(@Param("batchId") Long batchId);
 
}