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 { default PageResult selectPage(CrmBidBondPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() .likeIfPresent(CrmBidBondDO::getNo, reqVO.getNo()) .eqIfPresent(CrmBidBondDO::getCustomerId, reqVO.getCustomerId()) .likeIfPresent(CrmBidBondDO::getProjectName, reqVO.getProjectName()) .likeIfPresent(CrmBidBondDO::getTenderNo, reqVO.getTenderNo()) .likeIfPresent(CrmBidBondDO::getQuotationNo, reqVO.getQuotationNo()) .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 selectListByCustomerId(Long customerId) { return selectList(CrmBidBondDO::getCustomerId, customerId); } default CrmBidBondDO selectByQuotationId(Long quotationId) { return selectOne(CrmBidBondDO::getQuotationId, quotationId); } default List selectListBySaleOrderIds(Collection saleOrderIds) { if (saleOrderIds == null || saleOrderIds.isEmpty()) { return List.of(); } return selectList(new LambdaQueryWrapperX() .in(CrmBidBondDO::getSaleOrderId, saleOrderIds)); } /** * 更新时显式写入可清空的字段(MyBatis-Plus updateById 会忽略 null) */ default void updateByIdIncludingNulls(CrmBidBondDO updateObj) { update(updateObj, new LambdaUpdateWrapper() .eq(CrmBidBondDO::getId, updateObj.getId()) .set(CrmBidBondDO::getSaleOrderId, updateObj.getSaleOrderId()) .set(CrmBidBondDO::getSaleOrderNo, updateObj.getSaleOrderNo()) .set(CrmBidBondDO::getQuotationId, updateObj.getQuotationId()) .set(CrmBidBondDO::getQuotationNo, updateObj.getQuotationNo()) .set(CrmBidBondDO::getQuotationRound, updateObj.getQuotationRound()) .set(CrmBidBondDO::getRefundAmount, updateObj.getRefundAmount()) .set(CrmBidBondDO::getRefundDate, updateObj.getRefundDate())); } }