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.OtherSystemUserDO;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import org.apache.ibatis.annotations.Mapper;

/**
 * 第三方系统用户信息对应 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface OtherSystemUserMapper extends BaseMapperX<OtherSystemUserDO> {

    default PageResult<OtherSystemUserDO> selectPage(OtherSystemUserPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OtherSystemUserDO>()
                .eqIfPresent(OtherSystemUserDO::getOtherSystem, reqVO.getOtherSystem())
                .eqIfPresent(OtherSystemUserDO::getUserId, reqVO.getUserId())
                .likeIfPresent(OtherSystemUserDO::getUserRealName, reqVO.getUserRealName())
                .eqIfPresent(OtherSystemUserDO::getOtherId, reqVO.getOtherId())
                .likeIfPresent(OtherSystemUserDO::getOtherName, reqVO.getOtherName())
                .eqIfPresent(OtherSystemUserDO::getOtherMobile, reqVO.getOtherMobile())
                .eqIfPresent(OtherSystemUserDO::getOtherEmail, reqVO.getOtherEmail())
                .eqIfPresent(OtherSystemUserDO::getOtherGender, reqVO.getOtherGender())
                .eqIfPresent(OtherSystemUserDO::getOtherDepartment, reqVO.getOtherDepartment())
                .eqIfPresent(OtherSystemUserDO::getOtherInfomation, reqVO.getOtherInfomation())
                .eqIfPresent(OtherSystemUserDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(OtherSystemUserDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(OtherSystemUserDO::getRemark, reqVO.getRemark())
                .orderByDesc(OtherSystemUserDO::getId));
    }

	default List<OtherSystemUserDO> selectByOtherSystemAndOtherIds(String otherSystem, List<String> otherIdList) {
		return selectList(new LambdaQueryWrapperX<OtherSystemUserDO>()
				.eq(OtherSystemUserDO::getOtherSystem, otherSystem)
				.in(OtherSystemUserDO::getOtherId, otherIdList));
	}

}