package com.zt.plat.module.qms.common.data.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.common.data.controller.vo.DataCollectionFieldPageReqVO;
import com.zt.plat.module.qms.common.data.dal.dataobject.DataCollectionFieldDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 数据集字段 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface DataCollectionFieldMapper extends BaseMapperX<DataCollectionFieldDO> {

    default PageResult<DataCollectionFieldDO> selectPage(DataCollectionFieldPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DataCollectionFieldDO>()
                .eqIfPresent(DataCollectionFieldDO::getDataCollectionId, reqVO.getDataCollectionId())
                .likeIfPresent(DataCollectionFieldDO::getFieldName, reqVO.getFieldName())
                .eqIfPresent(DataCollectionFieldDO::getFieldKey, reqVO.getFieldKey())
                .eqIfPresent(DataCollectionFieldDO::getFieldType, reqVO.getFieldType())
                .eqIfPresent(DataCollectionFieldDO::getCancelFlag, reqVO.getCancelFlag())
                .eqIfPresent(DataCollectionFieldDO::getSortNo, reqVO.getSortNo())
                .eqIfPresent(DataCollectionFieldDO::getCustomConfig, reqVO.getCustomConfig())
                .eqIfPresent(DataCollectionFieldDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .eqIfPresent(DataCollectionFieldDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(DataCollectionFieldDO::getCreateTime, reqVO.getCreateTime())
                .orderByAsc(DataCollectionFieldDO::getSortNo));
    }

}