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.query.LambdaQueryWrapperX;
import com.zt.plat.module.qms.business.dic.controller.vo.*;
import com.zt.plat.module.qms.business.dic.controller.vo.DictionaryParameterPageReqVO;
import com.zt.plat.module.qms.business.dic.dal.dataobject.DictionaryParameterDO;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import org.apache.ibatis.annotations.Mapper;

/**
 * 检测参数字典 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface DictionaryParameterMapper extends BaseMapperX<DictionaryParameterDO> {

    default PageResult<DictionaryParameterDO> selectPage(DictionaryParameterPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DictionaryParameterDO>()
                .eqIfPresent(DictionaryParameterDO::getNo, reqVO.getNo())
                .likeIfPresent(DictionaryParameterDO::getName, reqVO.getName())
                .eqIfPresent(DictionaryParameterDO::getKey, reqVO.getKey())
                .eqIfPresent(DictionaryParameterDO::getUnitId, reqVO.getUnitId())
                .eqIfPresent(DictionaryParameterDO::getUnit, reqVO.getUnit())
                .eqIfPresent(DictionaryParameterDO::getDataType, reqVO.getDataType())
                .eqIfPresent(DictionaryParameterDO::getDecimalPosition, reqVO.getDecimalPosition())
                .eqIfPresent(DictionaryParameterDO::getSort, reqVO.getSort())
                .eqIfPresent(DictionaryParameterDO::getFormula, reqVO.getFormula())
                .eqIfPresent(DictionaryParameterDO::getFillingWay, reqVO.getFillingWay())
                .likeIfPresent(DictionaryParameterDO::getShortName, reqVO.getShortName())
                .eqIfPresent(DictionaryParameterDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(DictionaryParameterDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(DictionaryParameterDO::getRemark, reqVO.getRemark())
                .orderByDesc(DictionaryParameterDO::getId));
    }

}