package com.xindazhou.business.dal.mysql.agreement;

import com.xindazhou.framework.common.pojo.PageResult;
import com.xindazhou.framework.mybatis.core.mapper.BaseMapperX;
import com.xindazhou.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.xindazhou.business.controller.admin.agreement.vo.AgreementPageReqVO;
import com.xindazhou.business.dal.dataobject.agreement.AgreementDO;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface AgreementMapper extends BaseMapperX<AgreementDO> {

    default PageResult<AgreementDO> selectPage(AgreementPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AgreementDO>()
                .likeIfPresent(AgreementDO::getName, reqVO.getName())
                .eqIfPresent(AgreementDO::getType, reqVO.getType())
                .eqIfPresent(AgreementDO::getStatus, reqVO.getStatus())
                .orderByDesc(AgreementDO::getCreateTime));
    }

}

