|
- <?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.WxVtwoActivityGrantOrderMapper">
-
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxVtwoActivityGrantOrder">
- <id property="id" column="id" jdbcType="BIGINT"/>
- <result property="tenantId" column="tenant_id" jdbcType="VARCHAR"/>
- <result property="parentTenantId" column="parent_tenant_id" jdbcType="VARCHAR"/>
- <result property="grantId" column="grant_id" jdbcType="BIGINT"/>
- <result property="activityId" column="activity_id" jdbcType="BIGINT"/>
- <result property="orderId" column="order_id" jdbcType="BIGINT"/>
- <result property="isAmount" column="is_amount" jdbcType="SMALLINT"/>
- <result property="status" column="status" jdbcType="SMALLINT"/>
- </resultMap>
-
- <sql id="allColumns">
- id,tenant_id,parent_tenant_id,
- grant_id,activity_id,order_id,
- is_amount, status
- </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 != grantId ">
- and `grant_id` = #{grantId}
- </if>
- <if test=" null != activityId ">
- and `activity_id` = #{activityId}
- </if>
- <if test=" null != orderId ">
- and `order_id` = #{orderId}
- </if>
-
- <if test=" null != status ">
- and `status` = #{status}
- </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.WxVtwoActivityGrantOrder" resultMap="BaseResultMap">
- select <include refid="allColumns" /> from wx_vtwo_activity_grant_order
- <include refid="dynamicWhereConditions" />
- </select>
-
- <select id="findOrderNoList" parameterType="java.util.HashMap" resultType="com.iformall.domain.po.WxVtwoActivityGrantOrder">
- select go.order_id,o.order_no,go.is_amount
- from wx_vtwo_activity_grant_order go
- left join wx_vtwo_activity_order o on o.id = go.order_id
- where go.grant_id = #{grantId} and go.tenant_id=#{tenantId}
- </select>
-
- <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- select <include refid="allColumns" /> from wx_vtwo_activity_grant_order
- where id = #{id} and tenant_id=#{tenantId}
- </select>
- <select id="findOrderIdList" parameterType="com.iformall.domain.po.WxVtwoActivityGrantOrder" resultType="java.lang.Long">
- select order_id from wx_vtwo_activity_grant_order
- <include refid="dynamicWhereConditions" />
- </select>
-
- <insert id="insertList" parameterType="java.util.List">
- insert into wx_vtwo_activity_grant_order
- (id,
- grant_id,activity_id,order_id,
- is_amount)
- values
- <foreach collection="grantOrderList" item="item" index="index" separator=",">
- (#{item.id,jdbcType=BIGINT},
- #{item.grantId,jdbcType=BIGINT},#{item.activityId,jdbcType=BIGINT},#{item.orderId,jdbcType=BIGINT},
- #{item.isAmount,jdbcType=SMALLINT})
- </foreach>
- </insert>
- </mapper>
|