package com.usky.eg.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.usky.eg.domain.SysPerson;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 人员信息表 Mapper
 */
@Mapper
public interface SysPersonMapper extends BaseMapper<SysPerson> {

    /**
     * 查询所有有效的人脸数据（face_base不为空且face_status=0）
     */
    @Select("SELECT id, full_name, face_base, face_name, card_num FROM sys_person WHERE face_base IS NOT NULL AND face_base != '' AND face_status = 0")
    List<SysPerson> selectAllValidFace();

    /**
     * 按人员ID批量查询关联用户ID（sys_user_person）
     */
    List<Map<String, Object>> selectUserIdsByPersonIds(@Param("personIds") List<Integer> personIds);
}
