|
- <?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.WxPressBatchItemMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxPressBatchItem">
- <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="press_batch_id" jdbcType="BIGINT" property="pressBatchId" />
- <result column="coupon_id" jdbcType="BIGINT" property="couponId"/>
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
- <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
- <result column="press_batch_status" jdbcType="INTEGER" property="pressBatchStatus"/>
- </resultMap>
-
-
- <sql id="allColumns">
- `id`, `tenant_id`, `parent_tenant_id`, `press_batch_id`, `coupon_id`, `create_date`,`update_date`,`press_batch_status`
- </sql>
-
- <sql id="dynamicWhereConditions">
- where `tenant_id` = #{tenantId}
-
- <if test=" null != id ">
- and `id` = #{id}
- </if>
-
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
-
- <if test=" null != pressBatchId">
- and `press_batch_id` = #{pressBatchId}
- </if>
-
- <if test=" null != couponId">
- and `coupon_id` = #{couponId}
- </if>
-
- <if test=" null != pressBatchStatus">
- and `press_batch_status` = #{pressBatchStatus}
- </if>
-
- <if test=" null != ids ">
- and `id` in
- <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- </if>
-
- </sql>
-
- <select id="findList" parameterType="com.iformall.domain.po.WxPressBatchItem" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_press_batch_item
- <include refid="dynamicWhereConditions"/>
- <if test=" null != sortColumns">order by ${sortColumns}</if>
- </select>
-
- <select id="getBatchIdList" parameterType="java.util.HashMap" resultType="Long">
- select distinct press_batch_id from wx_press_batch_item where `tenant_id` = #{tenantId}
- <if test=" null != pressBatchStatus">
- and `press_batch_status` = #{pressBatchStatus}
- </if>
- <if test=" null != couponIds ">
- and `coupon_id` in
- <foreach collection="couponIds" index="index" item="cIdItem" open="(" separator="," close=")">
- #{cIdItem}
- </foreach>
- </if>
- </select>
-
- <select id="getById" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_press_batch_item
- where `id` = #{id}
- and tenant_id=#{tenantId}
- </select>
-
- <update id="updateWxPressBatchStatus" parameterType="com.iformall.domain.po.WxPressBatchItem" >
- update wx_press_batch_item set press_batch_status = #{pressBatchStatus} where `press_batch_id` = #{pressBatchId} and tenant_id=#{tenantId}
- </update>
-
- <delete id= "deleteItem" parameterType="com.iformall.domain.po.WxPressBatchItem" >
- delete from wx_press_batch_item where `id` = #{id} and tenant_id=#{tenantId}
- </delete>
-
- <delete id= "deleteAllItem" parameterType="com.iformall.domain.po.WxPressBatchItem" >
- delete from wx_press_batch_item where `press_batch_id` = #{pressBatchId} and tenant_id=#{tenantId}
- </delete>
-
- <select id="getCouponIds" parameterType="java.util.HashMap" resultType="Long">
- select coupon_id from wx_press_batch_item where tenant_id=#{tenantId}
- <if test=" null != pressBatchId">
- and `press_batch_id` = #{pressBatchId}
- </if>
- <if test=" null != pressBatchStatus">
- and `press_batch_status` = #{pressBatchStatus}
- </if>
- </select>
-
- </mapper>
|