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()));
|
}
|
|
}
|