package com.zt.plat.module.base.dal.dao.businessrule;

import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.base.dal.dataobject.businessrule.BusinessRuleDO;
import org.apache.ibatis.annotations.Mapper;
import com.zt.plat.module.base.controller.admin.businessrule.vo.*;

/**
 * 业务规则 Mapper
 *
 * @author yangxiaofeng
 */
@Mapper
public interface BusinessRuleMapper extends BaseMapperX<BusinessRuleDO> {

    default PageResult<BusinessRuleDO> selectPage(BusinessRulePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BusinessRuleDO>()
                .eqIfPresent(BusinessRuleDO::getStatusValue, reqVO.getStatusValue())
                .eqIfPresent(BusinessRuleDO::getTypeValue, reqVO.getTypeValue())
                .eqIfPresent(BusinessRuleDO::getCode, reqVO.getCode())
                .likeIfPresent(BusinessRuleDO::getName, reqVO.getName())
                .orderByDesc(BusinessRuleDO::getId));
    }

}