<?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.czg.service.account.mapper.SysUserMapper">

    <select id="page" resultType="com.czg.account.vo.SysUserDetailVO">
        select a.*, b.role_id from sys_user as a
        left join sys_users_roles as b on a.id=b.user_id
        <where>
            <if test="key != null and key != ''">
                and (a.nick_name like concat('%', #{key}, '%') or a.account like concat('%', #{key}, '%'))
            </if>
            <if test="startTime != null and startTime != ''">
                and a.create_time >= #{startTime}
            </if>

            <if test="endTime != null and endTime != ''">
                and a.create_time &lt;= #{endTime}
            </if>

            <if test="status != null">
                and a.status=#{status}
            </if>
        </where>
        order by a.create_time desc
    </select>
</mapper>
