<?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.WxParkMapper">
    <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxPark">
        <id column="id" jdbcType="BIGINT" property="id"/>
        <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
        <result column="img_url" jdbcType="VARCHAR" property="imgUrl"/>
        <result column="addr" jdbcType="VARCHAR" property="addr"/>
        <result column="number" jdbcType="INTEGER" property="number"/>
        <result column="entry_exit" jdbcType="INTEGER" property="entryExit"/>
        <result column="stop_fee" jdbcType="VARCHAR" property="stopFee"/>
        <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
        <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
        <result column="park_id" jdbcType="VARCHAR" property="parkId"/>
        <result column="parking_id" jdbcType="VARCHAR" property="parkingId"/>
        <result column="vendor_type" jdbcType="INTEGER" property="vendorType"/>
        <result column="vendor_params" jdbcType="VARCHAR" property="vendorParams"/>
    </resultMap>

    <sql id="allColumns">
	    `id`,`tenant_id`,`img_url`,`addr`,`number`,`entry_exit`,`stop_fee`,`create_date`,`update_date`,`park_id`,`parking_id`,`vendor_type`,`vendor_params`
	</sql>

    <sql id="dynamicWhereConditions">
        where 1 = 1

        <if test=" null != id ">
            and `id` = #{id}
        </if>

        <if test=" null != tenantId ">
            and `tenant_id` = #{tenantId}
        </if>

        <if test=" null != imgUrl ">
            and `imgUrl` like concat('%', #{imgUrl},'%')
        </if>

        <if test=" null != addr ">
            and `addr` like concat('%', #{addr},'%')
        </if>

        <if test=" null != number ">
            and `number` = #{number}
        </if>

        <if test=" null != entryExit ">
            and `entry_exit` = #{entryExit}
        </if>

        <if test=" null != stopFee ">
            and `stop_fee` = #{stopFee}
        </if>

        <if test=" null != createDate ">
            and `create_date` = #{createDate}
        </if>

        <if test=" null != updateDate ">
            and `update_date` = #{updateDate}
        </if>

        <if test=" null != parkId ">
            and `park_id` = #{parkId}
        </if>

        <if test=" null != parkingId ">
            and `parking_id` = #{parkingId}
        </if>

        <if test=" null != vendorType ">
            and `vendor_type` = #{vendorType}
        </if>

        <if test=" null != vendorParams ">
            and `vendor_params` like concat('%', #{vendorParams},'%')
        </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.WxPark" resultMap="BaseResultMap">
        select
        <include refid="allColumns"/>
        from wx_park
        <include refid="dynamicWhereConditions"/>
    </select>


</mapper>
