<?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.iformall.mapper.SysMonitorMapper">
	<resultMap id="BaseResultMap" type="com.iformall.domain.po.SysMonitor">
		<id column="id" jdbcType="BIGINT" property="id" />
        <result column="name" jdbcType="VARCHAR" property="name" />
		<result column="url" jdbcType="VARCHAR" property="url" />
		<result column="type" jdbcType="INTEGER" property="type" />
        <result column="deploy" jdbcType="INTEGER" property="deploy" />
        <result column="enable" jdbcType="INTEGER" property="enable" />
		<result column="err_msg" jdbcType="VARCHAR" property="errMsg" />
	</resultMap>
	
	<sql id="allColumns">
	    `id`,`name`,`url`,`type`,`deploy`,`enable`,`err_msg`
	</sql>

	<sql id="dynamicWhereConditions">
	        where 1 = 1
		<if test=" null != id ">
		    and `id` = #{id}
		</if>
        <if test=" null != name ">
            and `name` = #{name}
        </if>
        <if test=" null != url ">
		    and `url` = #{url}
		</if>    
		<if test=" null != type ">
		    and `type` = #{type}
		</if>
        <if test=" null != deploy ">
            and `deploy` = #{deploy}
        </if>
        <if test=" null != enable ">
            and `enable` = #{enable}
        </if>
        <if test=" null != errMsg ">
		    and `err_msg`  like concat('%', #{errMsg},'%')
		</if>    
		<if test=" null != ids ">
		 	and id in  
			<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
			#{idItem}
			</foreach>
		</if>		
		<if test=" null != sortColumns"> order by ${sortColumns} </if>
	</sql>
	
	<select id="findList" parameterType="com.iformall.domain.po.SysMonitor" resultMap="BaseResultMap">
		select <include refid="allColumns" /> from sys_monitor
		<include refid="dynamicWhereConditions" />
	</select>
	
	
	
	
	
	
</mapper>
