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.KwsEntTypeDao;
import com.sckw.system.model.KwsEntType;
import org.springframework.stereotype.Repository;

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

/**
 * @author :chenXiaoFei
 * @version :1.0
 * @description : 企业类型接口
 * @create :2025-11-04 13:47:00
 */
@Repository
public class KwsEntTypeRepository extends ServiceImpl<KwsEntTypeDao, KwsEntType> {
    public List<KwsEntType> queryByEntIdsAndType(Set<Long> entIds, List<String> entTypes) {
        return list(Wrappers.<KwsEntType>lambdaQuery()
                .eq(BaseModel::getDelFlag,0)
                .eq(BaseModel::getStatus,0)
                .in(KwsEntType::getEntId, entIds)
                .in(KwsEntType::getType, entTypes));
    }

    public List<KwsEntType> queryByType(List<String> entTypes) {
        return list(Wrappers.<KwsEntType>lambdaQuery()
                .eq(BaseModel::getDelFlag,0)
                .eq(BaseModel::getStatus,0)
                .in(KwsEntType::getType, entTypes));
    }


    public List<KwsEntType> queryByType(Integer entType) {
        return list(Wrappers.<KwsEntType>lambdaQuery()
                .eq(BaseModel::getDelFlag,0)
                .eq(BaseModel::getStatus,0)
                .eq(KwsEntType::getType, entType));
    }
    public KwsEntType queryByEntId(String entId) {
        return getOne(Wrappers.<KwsEntType>lambdaQuery().eq(BaseModel::getDelFlag,0)
                .eq(KwsEntType::getEntId, entId)
                .last("limit 1"));
    }

    public List<KwsEntType> queryByEntIds(Set<Long> entIds) {
        return list(Wrappers.<KwsEntType>lambdaQuery()
                .eq(BaseModel::getDelFlag,0)
                .eq(BaseModel::getStatus,0)
                .in(KwsEntType::getEntId, entIds));
    }
}
