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

/**
 * 第三方系统与业务字典对应 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface OtherDictionaryBusinessMapper extends BaseMapperX<OtherDictionaryBusinessDO> {

    default PageResult<OtherDictionaryBusinessDO> selectPage(OtherDictionaryBusinessPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OtherDictionaryBusinessDO>()
                .eqIfPresent(OtherDictionaryBusinessDO::getOtherSystem, reqVO.getOtherSystem())
                .eqIfPresent(OtherDictionaryBusinessDO::getDictionaryBusinessId, reqVO.getDictionaryBusinessId())
                .eqIfPresent(OtherDictionaryBusinessDO::getDictionaryBusinessKey, reqVO.getDictionaryBusinessKey())
                .eqIfPresent(OtherDictionaryBusinessDO::getOtherId, reqVO.getOtherId())
                .eqIfPresent(OtherDictionaryBusinessDO::getOtherKey, reqVO.getOtherKey())
                .eqIfPresent(OtherDictionaryBusinessDO::getOtherValue, reqVO.getOtherValue())
                .likeIfPresent(OtherDictionaryBusinessDO::getOtherName, reqVO.getOtherName())
                .eqIfPresent(OtherDictionaryBusinessDO::getOtherInfomation, reqVO.getOtherInfomation())
                .eqIfPresent(OtherDictionaryBusinessDO::getOtherSort, reqVO.getOtherSort())
                .eqIfPresent(OtherDictionaryBusinessDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(OtherDictionaryBusinessDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(OtherDictionaryBusinessDO::getRemark, reqVO.getRemark())
                .orderByDesc(OtherDictionaryBusinessDO::getId));
    }

	default List<OtherDictionaryBusinessDO> selectByOtherSystem(String otherSystem) {
		return selectList(new LambdaQueryWrapperX<OtherDictionaryBusinessDO>()
				.eq(OtherDictionaryBusinessDO::getOtherSystem, otherSystem));
	}

}