<?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.PosActionLogMapper">
	<resultMap id="BaseResultMap" type="com.iformall.domain.po.PosActionLog">
		<id column="id" jdbcType="BIGINT" property="id" />
		<result column="url" jdbcType="VARCHAR" property="url" />
		<result column="ip" jdbcType="VARCHAR" property="ip" />
		<result column="method" jdbcType="VARCHAR" property="method" />
		<result column="start_time" jdbcType="BIGINT" property="startTime" />
		<result column="end_time" jdbcType="BIGINT" property="endTime" />
		<result column="cost_time" jdbcType="INTEGER" property="costTime" />
		<result column="req_json" jdbcType="VARCHAR" property="reqJson" />
		<result column="res_json" jdbcType="VARCHAR" property="resJson" />
	</resultMap>
	
	<sql id="allColumns">
	    `id`,`url`,`ip`,`method`,`start_time`,`end_time`,`cost_time`,`req_json`,`res_json` 
	</sql>

	<sql id="dynamicWhereConditions">
	        where 1 = 1
		<if test=" null != id ">
		    and `id` = #{id}
		</if>    
		<if test=" null != url ">
		    and `url`  like concat('%', #{url},'%')
		</if>    
		<if test=" null != ip ">
		    and `ip`  like concat('%', #{ip},'%')
		</if>    
		<if test=" null != method ">
		    and `method`  like concat('%', #{method},'%')
		</if>    
		<if test=" null != startTime ">
		    and `start_time` = #{startTime}
		</if>    
		<if test=" null != endTime ">
		    and `end_time` = #{endTime}
		</if>    
		<if test=" null != costTime ">
		    and `cost_time` = #{costTime}
		</if>    
		<if test=" null != reqJson ">
		    and `req_json`  like concat('%', #{reqJson},'%')
		</if>    
		<if test=" null != resJson ">
		    and `res_json`  like concat('%', #{resJson},'%')
		</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.PosActionLog" resultMap="BaseResultMap">
		select <include refid="allColumns" /> from pos_action_log
		<include refid="dynamicWhereConditions" />
	</select>
	
	
	
	
	
	
</mapper>
