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

import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.qms.business.dic.controller.vo.DictionaryProjectPageReqVO;
import com.zt.plat.module.qms.business.dic.dal.dataobject.DictionaryProjectDO;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;

/**
 * 检测项目字典 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface DictionaryProjectMapper extends BaseMapperX<DictionaryProjectDO> {

    default PageResult<DictionaryProjectDO> selectPage(DictionaryProjectPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DictionaryProjectDO>()
                .eqIfPresent(DictionaryProjectDO::getCode, reqVO.getCode())
                .likeIfPresent(DictionaryProjectDO::getName, reqVO.getName())
                .likeIfPresent(DictionaryProjectDO::getSimpleName, reqVO.getSimpleName())
                .likeIfPresent(DictionaryProjectDO::getShowName, reqVO.getShowName())
                .eqIfPresent(DictionaryProjectDO::getKey, reqVO.getKey())
                .eqIfPresent(DictionaryProjectDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(DictionaryProjectDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(DictionaryProjectDO::getRemark, reqVO.getRemark())
                .orderByDesc(DictionaryProjectDO::getId));
    }
    
    default List<DictionaryProjectDO> selectList(DictionaryProjectPageReqVO reqVO) {
    	return selectList(new LambdaQueryWrapperX<DictionaryProjectDO>()
                .eqIfPresent(DictionaryProjectDO::getCode, reqVO.getCode())
                .likeIfPresent(DictionaryProjectDO::getName, reqVO.getName())
                .likeIfPresent(DictionaryProjectDO::getSimpleName, reqVO.getSimpleName())
                .likeIfPresent(DictionaryProjectDO::getShowName, reqVO.getShowName())
                .eqIfPresent(DictionaryProjectDO::getKey, reqVO.getKey())
                .eqIfPresent(DictionaryProjectDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(DictionaryProjectDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(DictionaryProjectDO::getRemark, reqVO.getRemark())
                .orderByAsc(DictionaryProjectDO::getId));
    }

}