<?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.xunmei.system.mapper.UserMapper">

    <select id="selectPage" resultType="com.xunmei.system.api.domain.User">
        select *
        from t_user
    </select>

    <select id="checkUserNameUnique" resultType="com.xunmei.system.api.domain.User"
            parameterType="java.lang.String">
        select id, username
        from t_user
        where username = #{userName}
          and deleted = '0'
        limit 1
    </select>
    <select id="selectPageData" resultType="com.xunmei.system.vo.user.UserPageVo">
        select * from t_user u
        <where>
            <if test="request.username != null and request.username != ''">
                and u.username like concat('%', #{request.username}, '%')
            </if>
            <if test="request.phone != null and request.phone != ''">
                and u.phone like concat('%', #{request.phone}, '%')
            </if>
        </where>
    </select>

</mapper> 