<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.mapper.PatientMapper">

    <select id="selectAll" resultType="com.example.entity.Patient">
        select `patient`.* from `patient`

        <where>
			<if test="name != null and name != ''">
				and `patient`.`name` like concat ('%', #{name}, '%')
			</if>
        </where>
    </select>

    <select id="selectById" resultType="com.example.entity.Patient">
        select * from patient where id = #{id}
    </select>

    <delete id="deleteById">
        delete from patient where id = #{id}
    </delete>

</mapper> 