<?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.devplatform.admin.modules.sys.dao.SysLogDao">
  <select id="queryPageList" parameterType="Object" resultType="com.devplatform.admin.modules.sys.bean.SysLogEntity">
    select t1.*
    from sys_log t1
    where 1=1
    <if test="model.username!=null and model.username!=''">
      and INSTR(t1.username, #{model.username})
    </if>
    <if test="model.operation!=null and model.operation!=''">
      and INSTR(t1.operation, #{model.operation})
    </if>
    <if test="model.orgId != null and model.orgId != ''">
      and t1.org_id = #{model.orgId}
    </if>
    <if test="model.startTime != null and model.startTime != ''">
      and t1.create_date &gt;= #{model.startTime}
    </if>
    <if test="model.endTime != null and model.endTime != ''">
      and t1.create_date &lt;= #{model.endTime}
    </if>
    <if test="model.stationId != null and model.stationId != ''">
      and t1.station_id = #{model.stationId}
    </if>
    <if test="model.sort != null and model.sort != '' and model.order != null and model.order != ''">
      ORDER BY ${model.sort} ${model.order}
    </if>
    <if test="model.sort == null or model.sort == '' or model.order == null or model.order == ''">
      ORDER BY t1.create_date DESC
    </if>
  </select>
</mapper>