<?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.slog.mapper.log.HandleLogMapper">

    <!--操作日志列表-校园-->
    <select id="listHandleLogForSchool" resultType="com.xhkjedu.model.slog.THandleLog" >
        select * from t_handle_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 handleip like '%${log.loginname}%')
            </if>
            <if test="log.handletime!=null and log.handletime!=0">
                and handletime>=#{log.handletime}
            </if>
            <if test="log.endtime!=null and log.endtime!=0">
                and handletime &lt;= #{log.endtime}
            </if>
            <if test="log.devicetype!=null and log.devicetype!=''">
                and devicetype=#{log.devicetype}
            </if>
            <if test="log.versionnum!=null and log.versionnum!=''">
                and versionnum=#{log.versionnum}
            </if>
            <if test="log.handleparas!=null and log.handleparas!=''">
                and (handleaction like '%${log.handleparas}%' or handlemodel like '%${log.handleparas}%')
            </if>
        </where>
        order by handleid desc
    </select>

    <!--操作日志列表-区域-->
    <select id="listHandleLogForCloud" resultType="java.util.Map" >
        select l.*,s.schoolname from t_handle_log l
            left join t_user u on l.userid=u.userid
            left join t_school s on u.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.handleip like '%${log.loginname}%')
            </if>
            <if test="log.handletime!=null and log.handletime!=0">
                and l.handletime>=#{log.handletime}
            </if>
            <if test="log.endtime!=null and log.endtime!=0">
                and l.handletime &lt;= #{log.endtime}
            </if>
            <if test="log.devicetype!=null and log.devicetype!=''">
                and l.devicetype=#{log.devicetype}
            </if>
            <if test="log.versionnum!=null and log.versionnum!=''">
                and l.versionnum=#{log.versionnum}
            </if>
            <if test="log.handleparas!=null and log.handleparas!=''">
                and (handleaction like '%${log.handleparas}%' or handlemodel like '%${log.handleparas}%')
            </if>
        </where>
        order by l.handleid desc
    </select>

</mapper>
