package com.yc.ship.module.otc.dal.mysql.cooperate;

import com.yc.ship.framework.common.pojo.PageResult;
import com.yc.ship.framework.mybatis.core.mapper.BaseMapperX;
import com.yc.ship.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yc.ship.module.otc.controller.admin.cooperate.vo.CooperatePageReqVO;
import com.yc.ship.module.otc.dal.dataobject.cooperate.CooperateDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 合作旅行社 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface CooperateMapper extends BaseMapperX<CooperateDO> {

    default PageResult<CooperateDO> selectPage(CooperatePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CooperateDO>()
                .likeIfPresent(CooperateDO::getName, reqVO.getName())
                .eqIfPresent(CooperateDO::getContactPerson, reqVO.getContactPerson())
                .eqIfPresent(CooperateDO::getContactPhone, reqVO.getContactPhone())
                .eqIfPresent(CooperateDO::getContactAddress, reqVO.getContactAddress())
                .eqIfPresent(CooperateDO::getRegion, reqVO.getRegion())
                .betweenIfPresent(CooperateDO::getStartDate, reqVO.getStartDate())
                .betweenIfPresent(CooperateDO::getEndDate, reqVO.getEndDate())
                .eqIfPresent(CooperateDO::getBackAccount, reqVO.getBackAccount())
                .eqIfPresent(CooperateDO::getTaxNumber, reqVO.getTaxNumber())
                .eqIfPresent(CooperateDO::getPhone, reqVO.getPhone())
                .eqIfPresent(CooperateDO::getInterbankNumber, reqVO.getInterbankNumber())
                .betweenIfPresent(CooperateDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CooperateDO::getId));
    }

}
