<?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.AdminMapper">

    <select id="selectAll" resultType="com.example.entity.Admin">
        select `admin`.* from `admin`

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

        </where>
    </select>

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

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

</mapper>