package cn.iocoder.yudao.module.crm.dal.mysql.cancellation; 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.cancellation.vo.CrmCancellationPageReqVO; import cn.iocoder.yudao.module.crm.dal.dataobject.cancellation.CrmCancellationDO; import org.apache.ibatis.annotations.Mapper; import java.util.List; @Mapper public interface CrmCancellationMapper extends BaseMapperX { default PageResult selectPage(CrmCancellationPageReqVO reqVO) { return selectPage(reqVO, buildQuery(reqVO)); } default List selectList(CrmCancellationPageReqVO reqVO) { return selectList(buildQuery(reqVO)); } default CrmCancellationDO selectByCancellationNo(String cancellationNo) { return selectOne(new LambdaQueryWrapperX() .eq(CrmCancellationDO::getCancellationNo, cancellationNo)); } private LambdaQueryWrapperX buildQuery(CrmCancellationPageReqVO reqVO) { return new LambdaQueryWrapperX() .likeIfPresent(CrmCancellationDO::getCancellationNo, reqVO.getCancellationNo()) .eqIfPresent(CrmCancellationDO::getCustomerId, reqVO.getCustomerId()) .eqIfPresent(CrmCancellationDO::getCancellationType, reqVO.getCancellationType()) .eqIfPresent(CrmCancellationDO::getAuditStatus, reqVO.getAuditStatus()) .orderByDesc(CrmCancellationDO::getId); } }