<?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.xhkjedu.sapi.mapper.system.UserLogMapper">
    <!-- 登录日志列表 -->
    <select id="listLog" resultType="com.xhkjedu.sapi.model.system.TUserLog" >
        select * from t_user_log
        <where>
            <if test="log.schoolid!=null">
                and schoolid=#{log.schoolid}
            </if>
            <if test="log.loginname!=null and log.loginname!=''">
                and (loginname like '%${log.loginname}%' or username like '%${log.loginname}%'
                or logip like '%${log.loginname}%')
            </if>
            <if test="log.logtime!=null and log.logtime!=0">
                and logtime>=#{log.logtime}
            </if>
            <if test="log.endtime!=null and log.endtime!=0">
                and logtime &lt;= #{log.endtime}
            </if>
            <if test="log.ultype!=null and log.ultype!=''">
                and ultype=#{log.ultype}
            </if>
            <if test="log.versionnum!=null and log.versionnum!=''">
                and versionnum=#{log.versionnum}
            </if>
        </where>
        order by ulid desc
    </select>

    <!--区域登录列表-->
    <select id="listLogQy" resultType="java.util.Map" >
        select l.*,s.schoolname from t_user_log l left join t_school s on l.schoolid=s.schoolid
        <where>
            <if test="log.schoolid!=null">
                and l.schoolid=#{log.schoolid}
            </if>
            <if test="log.loginname!=null and log.loginname!=''">
                and (l.loginname like '%${log.loginname}%' or l.username like '%${log.loginname}%'
                or l.logip like '%${log.loginname}%')
            </if>
            <if test="log.logtime!=null and log.logtime!=0">
                and l.logtime>=#{log.logtime}
            </if>
            <if test="log.endtime!=null and log.endtime!=0">
                and l.logtime &lt;= #{log.endtime}
            </if>
            <if test="log.ultype!=null and log.ultype!=''">
                and l.ultype=#{log.ultype}
            </if>
            <if test="log.versionnum!=null and log.versionnum!=''">
                and l.versionnum=#{log.versionnum}
            </if>
        </where>
        order by l.ulid desc
    </select>
</mapper>
