<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "https://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!--namespace 命名空间：1、与Java接口发生关联  2、为XML中内容提供一个唯一的路径-->
<mapper namespace="com.iwe3.langchain4j.mapper.AppointmentMapper">
    <resultMap id="appmap" type="AppointmentEntity" autoMapping="true">
        <result column="id_card" property="idCard"/>
        <result column="doctor_name" property="doctorName"/>
    </resultMap>
    <select id="getOne" resultMap="appmap">
        select * from appointment
        <where>
            <if test="r.userName != null">
                and username = #{r.userName}
            </if>
            <if test="r.idcard != null">
                and id_card = #{r.idcard}
            </if>
            <if test="r.department != null">
                and department = #{r.department}
            </if>
            <if test="r.date != null">
                and date = #{r.date}
            </if>
            <if test="r.time != null">
                and time = #{r.time}
            </if>
            <if test="r.doctorName != null">
                and doctor_name = #{r.doctorName}
            </if>
        </where>
    </select>

</mapper>