package com.zt.plat.module.qms.business.config.dal.mapper;

import java.util.*;

import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigSimpleFlowRulePageReqVO;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigSimpleFlowRuleReqVO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigSimpleFlowRuleDO;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import org.apache.ibatis.annotations.Mapper;

/**
 * LiteFlow规则配置 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface ConfigSimpleFlowRuleMapper extends BaseMapperX<ConfigSimpleFlowRuleDO> {

    default PageResult<ConfigSimpleFlowRuleDO> selectPage(ConfigSimpleFlowRulePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ConfigSimpleFlowRuleDO>()
                .likeIfPresent(ConfigSimpleFlowRuleDO::getName, reqVO.getName())
                .eqIfPresent(ConfigSimpleFlowRuleDO::getDescription, reqVO.getDescription())
                .eqIfPresent(ConfigSimpleFlowRuleDO::getData, reqVO.getData())
                .eqIfPresent(ConfigSimpleFlowRuleDO::getFlow, reqVO.getFlow())
                .eqIfPresent(ConfigSimpleFlowRuleDO::getRoute, reqVO.getRoute())
                .likeIfPresent(ConfigSimpleFlowRuleDO::getGroupName, reqVO.getGroupName())
                .eqIfPresent(ConfigSimpleFlowRuleDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(ConfigSimpleFlowRuleDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ConfigSimpleFlowRuleDO::getRemark, reqVO.getRemark())
                .orderByDesc(ConfigSimpleFlowRuleDO::getId));
    }
    
	default List<ConfigSimpleFlowRuleDO> selectList(ConfigSimpleFlowRuleReqVO reqVO) {
		return selectList(new LambdaQueryWrapperX<ConfigSimpleFlowRuleDO>()
                .likeIfPresent(ConfigSimpleFlowRuleDO::getName, reqVO.getName())
                .eqIfPresent(ConfigSimpleFlowRuleDO::getDescription, reqVO.getDescription())
                .eqIfPresent(ConfigSimpleFlowRuleDO::getData, reqVO.getData())
                .eqIfPresent(ConfigSimpleFlowRuleDO::getFlow, reqVO.getFlow())
                .eqIfPresent(ConfigSimpleFlowRuleDO::getRoute, reqVO.getRoute())
                .likeIfPresent(ConfigSimpleFlowRuleDO::getGroupName, reqVO.getGroupName())
                .eqIfPresent(ConfigSimpleFlowRuleDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(ConfigSimpleFlowRuleDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ConfigSimpleFlowRuleDO::getRemark, reqVO.getRemark())
                .orderByDesc(ConfigSimpleFlowRuleDO::getId));
	}
}