package cn.iocoder.yudao.module.asset.dal.mysql.returnorder;

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.asset.controller.admin.returnorder.vo.ReturnOrderPageReqVO;
import cn.iocoder.yudao.module.asset.dal.dataobject.returnorder.ReturnOrderDO;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface ReturnOrderMapper extends BaseMapperX<ReturnOrderDO> {

    default PageResult<ReturnOrderDO> selectPage(ReturnOrderPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ReturnOrderDO>()
                .likeIfPresent(ReturnOrderDO::getOrderCode, reqVO.getOrderCode())
                .likeIfPresent(ReturnOrderDO::getContractCode, reqVO.getContractCode())
                .likeIfPresent(ReturnOrderDO::getCustomerName, reqVO.getCustomerName())
                .eqIfPresent(ReturnOrderDO::getStatus, reqVO.getStatus())
                .eqIfPresent(ReturnOrderDO::getReturnReason, reqVO.getReturnReason())
                .betweenIfPresent(ReturnOrderDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ReturnOrderDO::getId));
    }

}
