liyong
4 天以前 be5783c8a7e13bbc76d33c95643d75779cce21db
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
53
54
55
56
57
58
59
60
61
62
63
package cn.iocoder.yudao.module.mes.dal.mysql.wm.productsales;
 
import cn.hutool.core.collection.CollUtil;
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.wm.productsales.vo.MesWmProductSalesPageReqVO;
import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productsales.MesWmProductSalesDO;
import org.apache.ibatis.annotations.Mapper;
 
import java.util.List;
 
/**
 * MES 销售出库单 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface MesWmProductSalesMapper extends BaseMapperX<MesWmProductSalesDO> {
 
    default PageResult<MesWmProductSalesDO> selectPage(MesWmProductSalesPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MesWmProductSalesDO>()
                .likeIfPresent(MesWmProductSalesDO::getCode, reqVO.getCode())
                .likeIfPresent(MesWmProductSalesDO::getName, reqVO.getName())
                .eqIfPresent(MesWmProductSalesDO::getClientId, reqVO.getClientId())
                .eqIfPresent(MesWmProductSalesDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(MesWmProductSalesDO::getSalesDate, reqVO.getShipmentDate())
                .orderByDesc(MesWmProductSalesDO::getId));
    }
 
    /**
     * 分页查询(带客户权限过滤)
     */
    default PageResult<MesWmProductSalesDO> selectPage(MesWmProductSalesPageReqVO reqVO, List<Long> permittedClientIds) {
        LambdaQueryWrapperX<MesWmProductSalesDO> wrapper = new LambdaQueryWrapperX<MesWmProductSalesDO>()
                .likeIfPresent(MesWmProductSalesDO::getCode, reqVO.getCode())
                .likeIfPresent(MesWmProductSalesDO::getName, reqVO.getName())
                .eqIfPresent(MesWmProductSalesDO::getClientId, reqVO.getClientId())
                .eqIfPresent(MesWmProductSalesDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(MesWmProductSalesDO::getSalesDate, reqVO.getShipmentDate())
                .orderByDesc(MesWmProductSalesDO::getId);
        if (permittedClientIds != null) {
            if (CollUtil.isEmpty(permittedClientIds)) {
                return PageResult.empty();
            }
            wrapper.in(MesWmProductSalesDO::getClientId, permittedClientIds);
        }
        return selectPage(reqVO, wrapper);
    }
 
    default MesWmProductSalesDO selectByCode(String code) {
        return selectOne(MesWmProductSalesDO::getCode, code);
    }
 
    default MesWmProductSalesDO selectByNoticeId(Long noticeId) {
        return selectOne(MesWmProductSalesDO::getNoticeId, noticeId);
    }
 
    default List<MesWmProductSalesDO> selectListByClientId(Long clientId) {
        return selectList(MesWmProductSalesDO::getClientId, clientId);
    }
 
}