|  | <?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.WxCouponInjectMapper">
	<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCouponInject">
		<id column="id" jdbcType="BIGINT" property="id" />
		<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
        <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>
		<result column="name" jdbcType="VARCHAR" property="name" />
		<result column="m_user_id" jdbcType="BIGINT" property="mUserId" />
		<result column="send_type" jdbcType="INTEGER" property="sendType" />
		<result column="coupon_id" jdbcType="BIGINT" property="couponId" />
		<result column="coupon_name" jdbcType="VARCHAR" property="couponName" />
		<result column="send_time" jdbcType="TIMESTAMP" property="sendTime" />
		<result column="send_amount" jdbcType="INTEGER" property="sendAmount" />
		<result column="status" jdbcType="INTEGER" property="status" />
		<result column="error_msg" jdbcType="VARCHAR" property="errorMsg" />
		<result column="tags" jdbcType="VARCHAR" property="tags" />
		<result column="msg_id" jdbcType="BIGINT" property="msgId" />
		<result column="model_id" jdbcType="BIGINT" property="modelId" />
		<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
		<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
	</resultMap>
	<sql id="allColumns">
	    `id`,`tenant_id`,`parent_tenant_id`,`name`,`m_user_id`,`send_type`,`coupon_id`,`coupon_name`,`send_time`,`send_amount`,`status`,`error_msg`,`tags`,`msg_id`,`create_time`,`update_time`,`model_id`
	</sql>
	<sql id="dynamicWhereConditions">
	        where 1 = 1
	    
		<if test=" null != id "> 
		and `id` = #{id} 
       	
		</if>
		<if test=" null != tenantId and '' != tenantId">
			and `tenant_id` = #{tenantId}
		</if>
		<if test=" null != parentTenantId and '' != parentTenantId">
			and `parent_tenant_id` = #{parentTenantId}
		</if>
	    
		<if test=" null != name "> 
		and `name`  like concat('%', #{name},'%')
       	
		</if>    
	    
		<if test=" null != mUserId "> 
		and `m_user_id`  like concat('%', #{mUserId},'%')
       	
		</if>    
	    
		<if test=" null != sendType "> 
		and `send_type` = #{sendType} 
       	
		</if>    
	    
		<if test=" null != couponId "> 
		and `coupon_id` = #{couponId} 
       	
		</if>
		
		<if test=" null != couponName and couponName!=''">
		and `coupon_name`  like concat('%', #{couponName},'%')
       	
		</if>    
	    
		<if test=" null != sendTime "> 
		and `send_time` = #{sendTime} 
       	
		</if>
		<if test=" null != sendTimeStart and null!=sendTimeEnd ">
			and `send_time` >= #{sendTimeStart} and `send_time` <= #{sendTimeEnd}
		</if>
	    
		<if test=" null != sendAmount "> 
		and `send_amount` = #{sendAmount} 
       	
		</if>    
	    
		<if test=" null != status "> 
		and `status` = #{status} 
       	
		</if>    
	    
		<if test=" null != errorMsg "> 
		and `error_msg`  like concat('%', #{errorMsg},'%')
       	
		</if>    
	    
		<if test=" null != tags "> 
		and `tags`  like concat('%', #{tags},'%')
       	
		</if>    
	    
		<if test=" null != createTime "> 
		and `create_time` = #{createTime} 
       	
		</if>    
	    
		<if test=" null != updateTime "> 
		and `update_time` = #{updateTime} 
       	
		</if>
		<if test=" null != msgId ">
			and `msg_id` = #{msgId}
		
		</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.WxCouponInject" resultMap="BaseResultMap">
        select
        <include refid="allColumns"/>
        from wx_coupon_inject
		<include refid="dynamicWhereConditions" />
	</select>
	
	
	
	
	
	
</mapper>
 |