gaoluyang
5 天以前 cdaec80a5ffa474f69e5c36f0312be3c0abf2210
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
package cn.iocoder.yudao.module.crm.dal.mysql.bidbond;
 
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.crm.controller.admin.bidbond.vo.CrmBidBondPageReqVO;
import cn.iocoder.yudao.module.crm.dal.dataobject.bidbond.CrmBidBondDO;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import org.apache.ibatis.annotations.Mapper;
 
import java.util.Collection;
import java.util.List;
 
@Mapper
public interface CrmBidBondMapper extends BaseMapperX<CrmBidBondDO> {
 
    default PageResult<CrmBidBondDO> selectPage(CrmBidBondPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CrmBidBondDO>()
                .likeIfPresent(CrmBidBondDO::getNo, reqVO.getNo())
                .eqIfPresent(CrmBidBondDO::getCustomerId, reqVO.getCustomerId())
                .likeIfPresent(CrmBidBondDO::getProjectName, reqVO.getProjectName())
                .likeIfPresent(CrmBidBondDO::getTenderNo, reqVO.getTenderNo())
                .likeIfPresent(CrmBidBondDO::getSaleOrderNo, reqVO.getSaleOrderNo())
                .eqIfPresent(CrmBidBondDO::getBidResult, reqVO.getBidResult())
                .eqIfPresent(CrmBidBondDO::getRefundStatus, reqVO.getRefundStatus())
                .geIfPresent(CrmBidBondDO::getPayDate, reqVO.getPayDateStart())
                .leIfPresent(CrmBidBondDO::getPayDate, reqVO.getPayDateEnd())
                .orderByDesc(CrmBidBondDO::getId));
    }
 
    default CrmBidBondDO selectByNo(String no) {
        return selectOne(CrmBidBondDO::getNo, no);
    }
 
    default List<CrmBidBondDO> selectListByCustomerId(Long customerId) {
        return selectList(CrmBidBondDO::getCustomerId, customerId);
    }
 
    default List<CrmBidBondDO> selectListBySaleOrderIds(Collection<Long> saleOrderIds) {
        if (saleOrderIds == null || saleOrderIds.isEmpty()) {
            return List.of();
        }
        return selectList(new LambdaQueryWrapperX<CrmBidBondDO>()
                .in(CrmBidBondDO::getSaleOrderId, saleOrderIds));
    }
 
    /**
     * 更新时显式写入可清空的字段(MyBatis-Plus updateById 会忽略 null)
     */
    default void updateByIdIncludingNulls(CrmBidBondDO updateObj) {
        update(updateObj, new LambdaUpdateWrapper<CrmBidBondDO>()
                .eq(CrmBidBondDO::getId, updateObj.getId())
                .set(CrmBidBondDO::getSaleOrderId, updateObj.getSaleOrderId())
                .set(CrmBidBondDO::getSaleOrderNo, updateObj.getSaleOrderNo())
                .set(CrmBidBondDO::getRefundAmount, updateObj.getRefundAmount())
                .set(CrmBidBondDO::getRefundDate, updateObj.getRefundDate()));
    }
 
}