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

    <select id="selectForProTable" resultType="com.dlink.model.User">
        select
        a.*
        from
        dlink_user a
        <where>
            1=1
            <if test='param.username!=null and param.username!=""'>
                and a.username like "%${param.username}%"
            </if>
            <if test='param.nickname!=null and param.nickname!=""'>
                and a.nickname like "%${param.nickname}%"
            </if>
            <if test='param.createTime!=null and param.createTime!=""'>
                and a.create_time <![CDATA[>=]]> str_to_date( #{param.createTime},'%Y-%m-%d %H:%i:%s')
            </if>
            <if test='param.updateTime!=null and param.updateTime!=""'>
                and a.update_time <![CDATA[>=]]> str_to_date( #{param.updateTime},'%Y-%m-%d %H:%i:%s')
            </if>
            <if test='ew.sqlSegment!=null and ew.sqlSegment!="" and !ew.sqlSegment.startsWith(" ORDER BY")'>
                and
            </if>
            <if test='ew.sqlSegment!=null and ew.sqlSegment!=""'>
                ${ew.sqlSegment}
            </if>
        </where>
    </select>
</mapper>
