package com.sckw.system.repository;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sckw.core.model.base.BaseModel;
import com.sckw.system.dao.KwsUserDao;
import com.sckw.system.model.KwsUser;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Set;

/**
 * @author :chenXiaoFei
 * @version :1.0
 * @description : 员工信息接口
 * @create :2025-11-04 18:37:00
 */
@Repository
public class KwsUserRepository extends ServiceImpl<KwsUserDao, KwsUser> {
    public List<KwsUser> queryByUserIds(Set<Long> userIds) {

        return list(Wrappers.<KwsUser>lambdaQuery()
                .eq(BaseModel::getDelFlag,0)
                .in(KwsUser::getId,userIds));
    }

    public KwsUser queryByAccount(String account) {
        return getOne(Wrappers.<KwsUser>lambdaQuery()
                .eq(BaseModel::getDelFlag,0)
                .eq(BaseModel::getStatus,0)
                .eq(KwsUser::getAccount,account)
                .last("limit 1"));
    }

    public KwsUser queryByUserId(Long userId) {
        return getOne(Wrappers.<KwsUser>lambdaQuery()
                .eq(BaseModel::getDelFlag,0)
                .eq(BaseModel::getStatus,0)
                .eq(KwsUser::getId,userId)
                .last("limit 1"));
    }
}
