package org.jeecg.modules.system.app.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.system.app.dto.FindResponseDTO;
import org.jeecg.modules.system.app.entity.FamilyMembers;

import java.util.List;

/**
 * @Description: 家庭成员信息表
 * @Author: jeecg-boot
 * @Date:   2025-07-07
 * @Version: V1.0
 */
public interface FamilyMembersMapper extends BaseMapper<FamilyMembers> {

    @Select("select  * from nm_family_members where  user_id = #{userId}  order by user_type asc,create_time desc")
    List<FamilyMembers> findByUserId(@Param("userId") String userId);

    @Select("select  * from nm_family_members where  user_id = #{userId} and real_name_status =1 order by user_type asc,create_time desc")
   IPage<FamilyMembers> findByPage(@Param("page") Page<FindResponseDTO> page, @Param("userId") String userId);

    @Select("select  * from nm_family_members where  user_id = #{userId} and phone =#{phone} limit 1")
    FamilyMembers findByUserIdAndPhone(String userId, String phone);
}
