<?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.nbclass.system.mapper.SysLogMapper">
  <resultMap id="BaseResultMap" type="com.nbclass.system.model.SysLog">
    <!--
      WARNING - @mbg.generated
    -->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="createtime" jdbcType="TIMESTAMP" property="createtime" />
    <result column="type" jdbcType="INTEGER" property="type" />
    <result column="operator" jdbcType="VARCHAR" property="operator" />
    <result column="ipaddr" jdbcType="VARCHAR" property="ipaddr" />
    <result column="description" jdbcType="VARCHAR" property="description" />
  </resultMap>
  
  	<delete id="deleteByIds" parameterType="java.util.List">
		delete from sys_log where id in 
	    <foreach item="item" collection="list" open="(" separator="," close=")">
			#{item}
		</foreach>
	</delete>
	
	<select id="getList" resultType="com.nbclass.system.model.SysLog" parameterType="com.nbclass.system.model.SysLog">
		select sys_log.* from sys_log where 1=1 
		<if test="type != null and type > 0">
		    AND sys_log.type = #{type}
		</if>
	  	<if test="operator != null and operator != ''">
		    AND sys_log.operator like CONCAT('%',#{operator},'%')
		</if>
	  	<if test="description != null and description != ''">
	    	AND (
	    		sys_log.operator like CONCAT('%',#{description},'%')
	    		or 
	    		sys_log.description like CONCAT('%',#{description},'%')
	    		or 
	    		sys_log.ipaddr like CONCAT('%',#{description},'%')
	    	)
	  	</if>
		order by sys_log.id desc
	</select>
  
</mapper>