<?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.WxMerchantPowerBillConfigMapper">
	<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxMerchantPowerBillConfig">
		
		<id column="id" jdbcType="BIGINT" property="id"/>
		<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
		<result column="merchant_id" jdbcType="BIGINT" property="merchantId"/>
		<result column="merchant_name" jdbcType="VARCHAR" property="merchantName"/>
		<result column="merchant_type" jdbcType="INTEGER" property="merchantType"/>
		<result column="build_way" jdbcType="INTEGER" property="buildWay"/>
		<result column="price" jdbcType="VARCHAR" property="price"/>
		<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
		<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
	
	</resultMap>
	
	<sql id="allColumns">
       		`id`,`tenant_id`,`merchant_id`,`merchant_name`,`merchant_type`,`build_way`,`price`,`create_date`,`update_date`
    </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 != merchantName and ''!=merchantName">
			and `merchant_name` like concat('%', #{merchantName},'%')
		</if>
		
		<if test=" null != merchantType ">
			and `merchant_type` = #{merchantType}
		</if>
		
		<if test=" null != buildWay ">
			and `build_way` = #{buildWay}
		</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.KwBox" resultMap="BaseResultMap">
		select
		<include refid="allColumns"/>
		from wx_merchant_power_bill_config
		<include refid="dynamicWhereConditions"/>
	</select>

</mapper>
