|
- <?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.WxCouponOrderMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCouponOrder">
- <id column="id" jdbcType="BIGINT" property="id" />
- <result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
- <result column="coupon_id" jdbcType="BIGINT" property="couponId" />
- <result column="coupon_type" jdbcType="INTEGER" property="couponType" />
- <result column="c_user_id" jdbcType="BIGINT" property="cUserId" />
- <result column="owner_id" jdbcType="BIGINT" property="ownerId" />
- <result column="b_user_id" jdbcType="BIGINT" property="bUserId" />
- <result column="order_id" jdbcType="BIGINT" property="orderId" />
- <result column="expired_time" jdbcType="TIMESTAMP" property="expiredTime" />
- <result column="coupon_order_status" jdbcType="INTEGER" property="couponOrderStatus" />
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
- <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
- <result column="coupon_price" jdbcType="INTEGER" property="couponPrice" />
- </resultMap>
-
- <sql id="allColumns">
- `id`,`tenant_id`,`coupon_id`,`coupon_type`,`c_user_id`,`owner_id`,`b_user_id`,`order_id`,`expired_time`,`coupon_order_status`,`create_date`,`update_date`,`coupon_price`
- </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 != couponId ">
- and `coupon_id` = #{couponId}
- </if>
-
- <if test=" null != couponType ">
- and `coupon_type` = #{couponType}
- </if>
-
- <if test=" null != cUserId ">
- and `c_user_id` = #{cUserId}
- </if>
-
- <if test=" null != ownerId ">
- and `owner_id` = #{ownerId}
- </if>
-
- <if test=" null != bUserId ">
- and `b_user_id` = #{bUserId}
- </if>
-
- <if test=" null != orderId ">
- and `order_id` = #{orderId}
- </if>
-
- <if test=" null != expiredTime ">
- and `expired_time` = #{expiredTime}
- </if>
-
- <if test=" null != couponOrderStatus ">
- and `coupon_order_status` = #{couponOrderStatus}
- </if>
-
- <if test=" null != createDate ">
- and `create_date` = #{createDate}
- </if>
-
- <if test=" null != updateDate ">
- and `update_date` = #{updateDate}
- </if>
-
- <if test=" null != couponPrice ">
- and `coupon_price` = #{couponPrice}
- </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.WxCouponOrder" resultMap="BaseResultMap">
- select <include refid="allColumns" /> from wx_coupon_order
- <include refid="dynamicWhereConditions" />
- </select>
-
- <select id="countList" parameterType="com.iformall.domain.po.WxCouponOrder" resultType="java.lang.Integer">
- select count(*) from wx_coupon_order
- <include refid="dynamicWhereConditions" />
- </select>
-
- <select id="dayCountCarList" parameterType="hashmap" resultType="java.lang.Integer">
- select count(*) from wx_coupon_order
- <where>
- <if test=" null != tenantId ">
- and `tenant_id` = #{tenantId}
- </if>
-
- <if test=" null != couponId ">
- and `coupon_id` = #{couponId}
- </if>
-
- <if test=" null != cUserId ">
- and `c_user_id` = #{cUserId}
- </if>
- and date(`create_date`) = curdate()
- </where>
- </select>
-
- <select id="findCountByDateLimit" resultType="java.lang.Integer">
- select COUNT(*) FROM wx_coupon_order
- where tenant_id = #{tenantId}
- and create_date >= #{startTime}
- and create_date <= #{endTime}
- </select>
-
- <select id="couponDataMap" resultType="com.iformall.domain.vo.MarkingCouponDataReportVo" parameterType="hashmap">
- SELECT DATE_FORMAT(create_date,'%m/%d') as createTime,
- COUNT(DISTINCT c_user_id) as couponUserCount,
- count(*) as couponCount,
- (select Count(*)
- from wx_coupon_order c
- where coupon_order_status=1
- AND DATE_FORMAT(create_date,'%m/%d')=createTime
- AND tenant_id=#{tenantId}
- AND c.update_date >= #{startTime}
- AND c.update_date <= #{endTime}) as verifyCount,
- (select Count(DISTINCT c_user_id)
- from wx_coupon_order d
- where coupon_order_status=1
- AND DATE_FORMAT(create_date,'%m/%d')=createTime
- AND tenant_id=#{tenantId}
- AND d.update_date >= #{startTime}
- AND d.update_date <= #{endTime}) as verifyUserCount
- from wx_coupon_order
- where tenant_id=#{tenantId}
- AND create_date >= #{startTime}
- AND create_date <= #{endTime}
- GROUP BY createTime
- </select>
-
- <select id="couponDataList" resultType="com.iformall.domain.vo.MarkingCouponDataReportVo" parameterType="hashmap">
- SELECT DATE_FORMAT(wx_coupon_order.create_date,'%Y-%m-%d') as createTime,wx_coupon_order.coupon_id as couponId
- ,COUNT(DISTINCT c_user_id) as couponUserCount,count(*) as couponCount
- ,(select Count(coupon_id) from wx_coupon_order c
- where coupon_order_status=1
- and DATE_FORMAT(create_date,'%Y-%m-%d')=createTime
- and tenant_id=#{tenantId}
- and c.coupon_id=couponId
- <if test="startTime != null">
- and c.update_date >= #{startTime}
- </if>
- <if test="endTime != null">
- and c.update_date <= #{endTime}
- </if>
- ) as verifyCount
- ,(select Count(DISTINCT c_user_id) from wx_coupon_order d
- where coupon_order_status=1
- and d.coupon_id=couponId
- and DATE_FORMAT(create_date,'%Y-%m-%d')=createTime
- and tenant_id=#{tenantId}
- and d.coupon_id=couponId
- <if test="startTime != null">
- and d.update_date >= #{startTime}
- </if>
- <if test="endTime != null">
- and d.update_date <= #{endTime}
- </if>
- ) as verifyUserCount
- from wx_coupon_order
- join wx_coupon on wx_coupon_order.coupon_id=wx_coupon.id
- where wx_coupon_order.tenant_id=#{tenantId}
- <if test="startTime != null">
- and wx_coupon_order.create_date >= #{startTime}
- </if>
- <if test="endTime != null">
- and wx_coupon_order.create_date <= #{endTime}
- </if>
- <if test="couponType != null">
- and wx_coupon.type = #{couponType}
- </if>
- <if test="couponTitle != null">
- and wx_coupon.title like concat('%', #{couponTitle},'%')
- </if>
- GROUP BY createTime,couponId
- order by createTime desc
- </select>
-
- <select id="touchUsersReportList" resultType="com.iformall.domain.vo.TouchUsersReportVo" parameterType="hashmap">
- SELECT DATE_FORMAT(create_date,'%Y-%m-%d') as xTime
- ,COUNT(DISTINCT c_user_id) as userCount,count(*) as couponCount
- ,(select Count(*) from wx_coupon_order c
- where coupon_order_status=1
- and DATE_FORMAT(create_date,'%Y-%m-%d')=xTime
- and tenant_id=#{tenantId}
- <if test="startTime != null">
- and c.update_date >= #{startTime}
- </if>
- <if test="endTime != null">
- and c.update_date <= #{endTime}
- </if>
- )
- as verifyCount
- ,(select Count(DISTINCT c_user_id) from wx_coupon_order d
- where coupon_order_status=1
- and DATE_FORMAT(create_date,'%Y-%m-%d')=xTime
- and tenant_id=#{tenantId}
- <if test="startTime != null">
- and d.update_date >= #{startTime}
- </if>
- <if test="endTime != null">
- and d.update_date <= #{endTime}
- </if>
- )
- as verifyUserCount
- from wx_coupon_order
- where tenant_id=#{tenantId}
- <if test="startTime != null">
- AND create_date >= #{startTime}
- </if>
- <if test="endTime != null">
- and create_date <= #{endTime}
- </if>
- GROUP BY xTime
- order by xTime desc
- </select>
-
-
- <select id="queryForSceneRepotyHistoryVerified" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap">
- select DATE_FORMAT(update_date,'%Y-%m-%d') xTime, count(c.id) triggerCount
- from wx_coupon_order c
- where c.tenant_id = #{tenantId}
- and c.coupon_order_status = 1
- <if test=" null != startTime and null != endTime">
- and c.update_date BETWEEN #{startTime} and #{endTime}
- </if>
- group by xTime
- </select>
-
- <select id="findVerifiedCountByCUser" resultType="java.lang.Integer">
- select COUNT(*) FROM wx_coupon_order
- where c_user_id = #{cUserId}
- and update_date >= #{startTime}
- and update_date <= #{endTime}
- and coupon_order_status = 1
- </select>
-
- <select id="findOrderedCountByCUser" resultType="java.lang.Integer">
- select COUNT(*) FROM wx_coupon_order
- where c_user_id = #{cUserId}
- and create_date >= #{startTime}
- and create_date <= #{endTime}
- </select>
-
- <select id="findVerifiedCount" resultType="java.lang.Integer">
- select COUNT(*) FROM wx_coupon_order
- where tenant_id = #{tenantId}
- and update_date >= #{startTime}
- and update_date <= #{endTime}
- and coupon_order_status = 1
- </select>
-
- <select id="findOrderedCount" resultType="java.lang.Integer">
- select COUNT(*) FROM wx_coupon_order
- where tenant_id = #{tenantId}
- and create_date >= #{startTime}
- and create_date <= #{endTime}
- </select>
-
- <select id="queryPriceTotalGroup" resultType="com.iformall.domain.vo.CUserDateAmountVo" >
- SELECT DATE_FORMAT(create_date,'%Y-%m-%d') as xTime,IFNULL(SUM(coupon_price),0) as price from wx_coupon_order
- where tenant_id=#{tenantId} AND create_date >= #{startTime} and create_date < #{endTime} GROUP BY xTime
- </select>
-
- <select id="queryPriceTotal" resultType="java.lang.Integer" >
- SELECT IFNULL(SUM(coupon_price),0) from wx_coupon_order
- where tenant_id=#{tenantId} AND create_date >= #{startTime} and create_date < #{endTime}
- </select>
-
- <update id="offExpiredCouponOrderByValidDate">
- update wx_coupon_order SET coupon_order_status = 2, update_date = now()
- where expired_time < now() and coupon_price = 0 and coupon_order_status = 0
- </update>
-
- <select id="findExpiredCouponOrderByValidDate" parameterType="com.iformall.domain.po.WxCouponOrder" resultMap="BaseResultMap">
- select <include refid="allColumns" /> from wx_coupon_order
- where expired_time < now() and coupon_price > 0 and coupon_order_status = 0
- </select>
-
-
-
-
-
-
-
-
- <resultMap id="BVoResultMap" type="com.iformall.domain.vo.WxCouponOrderBVo">
- <id column="id" jdbcType="BIGINT" property="id" />
- <result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
- <result column="coupon_id" jdbcType="BIGINT" property="couponId" />
- <result column="coupon_type" jdbcType="INTEGER" property="couponType" />
- <result column="c_user_id" jdbcType="BIGINT" property="cUserId" />
- <result column="owner_id" jdbcType="BIGINT" property="ownerId" />
- <result column="b_user_id" jdbcType="BIGINT" property="bUserId" />
- <result column="order_id" jdbcType="BIGINT" property="orderId" />
- <result column="expired_time" jdbcType="TIMESTAMP" property="expiredTime" />
- <result column="coupon_order_status" jdbcType="INTEGER" property="couponOrderStatus" />
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
- <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
- <result column="coupon_price" jdbcType="INTEGER" property="couponPrice" />
-
- <result column="type" jdbcType="INTEGER" property="type" />
- <result column="title" jdbcType="VARCHAR" property="title" />
- <result column="sale_price" jdbcType="INTEGER" property="salePrice" />
- <result column="use_price" jdbcType="INTEGER" property="usePrice" />
- <result column="price" jdbcType="INTEGER" property="price" />
-
- <result column="name" jdbcType="VARCHAR" property="bUserName" />
- <result column="bphone" jdbcType="VARCHAR" property="bUserPhone" />
- <result column="phone" jdbcType="VARCHAR" property="cUserPhone" />
- <result column="merchant_name" jdbcType="VARCHAR" property="merchantName" />
-
- <collection column="{productId=coupon_id}" property="merchantVoList"
- ofType="com.iformall.domain.vo.WxMerchantVo"
- javaType="java.util.List"
- select="com.iformall.mapper.WxCouponMerchantMapper.findMerchantNameList" >
- </collection>
- </resultMap>
-
- <sql id="allAdminCouponOrderListColumns">
- co.id,co.tenant_id,co.coupon_id,co.coupon_type,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,
- c.title,c.sale_price,c.use_price,c.price,c.unit,
- (case when com.mc=1 then
- (select m.name from wx_merchant m, wx_coupon_merchant cm
- where m.id = cm.merchant_id and cm.product_id=co.coupon_id) else '[多商户通用]' end) as merchant_name
- </sql>
-
- <sql id="allAdminCouponOrderDetailColumns">
- co.id,co.tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,
- c.type,c.title,c.sale_price,c.use_price,c.price,c.unit,
- bu.name, bu.phone as bphone,
- cu.phone,
- m.name as merchant_name
- </sql>
-
- <select id="findListOfAdmin" parameterType="com.iformall.domain.vo.WxCouponOrderBVo" resultMap="BVoResultMap">
- select <include refid="allAdminCouponOrderListColumns" />
- from
- wx_coupon_order co,
- wx_coupon c,
- (select tco.id as tcoid,
- (select count(*) from wx_coupon_merchant tcm
- where tcm.product_id = tco.coupon_id
- and tcm.status = 0) as mc
- from wx_coupon_order tco) com
- where com.tcoid = co.id
- and c.id = co.coupon_id
- <if test=" null != tenantId ">
- and co.tenant_id = #{tenantId}
- </if>
-
- <if test=" null != couponOrderStatus ">
- and co.coupon_order_status = #{couponOrderStatus}
- </if>
-
- <if test=" null != merchantName ">
- and (case when com.mc=1 then
- (select m.name from wx_merchant m, wx_coupon_merchant cm
- where m.id = cm.merchant_id and cm.product_id=co.coupon_id) else '[多商户通用]' end)
- like concat('%', #{merchantName},'%')
- </if>
-
- <if test="startDate != null">
- AND co.create_date > #{startDate,jdbcType=TIMESTAMP}
- </if>
-
- <if test="endDate != null">
- AND co.create_date < #{endDate,jdbcType=TIMESTAMP}
- </if>
-
- <if test=" null != sortColumns"> order by ${sortColumns} </if>
-
- </select>
-
-
- <select id="findDetailOfAdmin" parameterType="java.lang.Long" resultMap="BVoResultMap">
- select <include refid="allAdminCouponOrderDetailColumns" />
- from wx_coupon_merchant cm,
- (select tco.id as tcoid,
- (select count(*) from wx_coupon_merchant tcm
- where tcm.product_id = tco.coupon_id
- and tcm.status = 0) as mc
- from wx_coupon_order tco) com,
- wx_coupon c,
- wx_c_user cu,
- wx_merchant m,
- wx_coupon_order co
- left join wx_merchant_b_user bu on co.b_user_id = bu.id
- where co.id = #{id}
- and com.mc = 1
- and com.tcoid = co.id
- and cm.product_id = c.id
- and cm.status = 0
- and c.id = co.coupon_id
- and cu.id = co.c_user_id
- and m.id = cm.merchant_id
- </select>
-
- <sql id="allBUserVerifiedCouponOrderColumns">
- co.id,co.tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,
- c.type,c.title,c.sale_price,c.use_price,c.price,c.unit,
- bu.name,
- cu.phone
- </sql>
-
- <sql id="allBUserOrderedCouponOrderColumns">
- co.id,co.tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,
- c.type,c.title,c.sale_price,c.use_price,c.price,c.unit,
- cu.phone
- </sql>
-
-
- <select id="findListOfOrderedByDateForBUser" parameterType="map" resultMap="BVoResultMap">
- select <include refid="allBUserOrderedCouponOrderColumns" />
- from wx_coupon_order co,wx_coupon c,wx_c_user cu,wx_coupon_merchant cm,
- (select tco.id as tcoid,
- (select count(*) from wx_coupon_merchant tcm
- where tcm.product_id = tco.coupon_id
- and tcm.status = 0) as mc
- from wx_coupon_order tco) com
- where com.mc = 1
- and com.tcoid = co.id
- and cm.merchant_id = #{merchantId}
- and cm.product_id = c.id
- and cm.status = 0
- and co.coupon_id = c.id
- and cu.id = co.c_user_id
- <if test="startDate != null">
- AND co.create_date > #{startDate,jdbcType=TIMESTAMP}
- </if>
- <if test="endDate != null">
- AND co.create_date < #{endDate,jdbcType=TIMESTAMP}
- </if>
- order by co.create_date desc
-
- </select>
-
- <select id="findListOfVerifiedByDateForBUser" parameterType="map" resultMap="BVoResultMap">
- select <include refid="allBUserVerifiedCouponOrderColumns" />
- from wx_coupon_order co,wx_coupon c,wx_c_user cu,wx_merchant_b_user bu
- where co.coupon_id = c.id
- and cu.id = co.c_user_id
- and bu.id = co.b_user_id
- and bu.merchant_id = #{merchantId}
- <if test="startDate != null">
- AND co.update_date > #{startDate,jdbcType=TIMESTAMP}
- </if>
- <if test="endDate != null">
- AND co.update_date < #{endDate,jdbcType=TIMESTAMP}
- </if>
- AND co.coupon_order_status = '1'
- order by co.update_date desc
- </select>
-
- <sql id="allCouponOrderColumns">
- co.id,co.tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price
- </sql>
-
- <select id="findListOfOrderedByDate" parameterType="map" resultMap="BaseResultMap">
- select <include refid="allCouponOrderColumns" />
- from wx_coupon_order co,wx_coupon_merchant cm,
- (select tco.id as tcoid,
- (select count(*) from wx_coupon_merchant tcm
- where tcm.product_id = tco.coupon_id and
- and tcm.status = 0)
- as mc
- from wx_coupon_order tco) com
- where com.mc = 1
- and com.tcoid = co.id
- and cm.status = 0
- and cm.merchant_id = #{merchantId}
- and cm.product_id = co.coupon_id
- <if test="startDate != null">
- AND co.create_date > #{startDate,jdbcType=TIMESTAMP}
- </if>
- <if test="endDate != null">
- AND co.create_date < #{endDate,jdbcType=TIMESTAMP}
- </if>
- </select>
-
- <select id="findListOfVerifiedByDate" parameterType="map" resultMap="BaseResultMap">
- select <include refid="allCouponOrderColumns" />
- from wx_coupon_order co, wx_merchant_b_user mbu
- where mbu.id = co.b_user_id
- and mbu.merchant_id = #{merchantId}
- <if test="startDate != null">
- AND co.update_date > #{startDate,jdbcType=TIMESTAMP}
- </if>
- <if test="endDate != null">
- AND co.update_date < #{endDate,jdbcType=TIMESTAMP}
- </if>
- AND co.coupon_order_status = '1'
- </select>
-
-
-
- <sql id="allCUserCouponOrderListColumns">
- co.id,co.coupon_id,co.coupon_type,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,
- c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.price,c.unit
- </sql>
-
- <sql id="allCUserCouponOrderDetailColumns">
- co.id,co.tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,
- c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.price,c.unit,c.detail,c.remark
- </sql>
-
- <resultMap id="CVoResultMap" type="com.iformall.domain.vo.WxCouponOrderCVo">
- <id column="id" jdbcType="BIGINT" property="id" />
- <result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
- <result column="coupon_id" jdbcType="BIGINT" property="couponId" />
- <result column="coupon_type" jdbcType="INTEGER" property="couponType" />
- <result column="c_user_id" jdbcType="BIGINT" property="cUserId" />
- <result column="owner_id" jdbcType="BIGINT" property="ownerId" />
- <result column="b_user_id" jdbcType="BIGINT" property="bUserId" />
- <result column="order_id" jdbcType="BIGINT" property="orderId" />
- <result column="expired_time" jdbcType="TIMESTAMP" property="expiredTime" />
- <result column="coupon_order_status" jdbcType="INTEGER" property="couponOrderStatus" />
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
- <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
- <result column="coupon_price" jdbcType="INTEGER" property="couponPrice" />
-
- <result column="type" jdbcType="INTEGER" property="type" />
- <result column="cover_img" jdbcType="VARCHAR" property="coverImg" />
- <result column="title" jdbcType="VARCHAR" property="title" />
- <result column="sub_title" jdbcType="VARCHAR" property="subTitle" />
- <result column="sale_price" jdbcType="INTEGER" property="salePrice" />
- <result column="use_price" jdbcType="INTEGER" property="usePrice" />
- <result column="detail" jdbcType="VARCHAR" property="detail" />
- <result column="price" jdbcType="INTEGER" property="price" />
- <result column="unit" jdbcType="INTEGER" property="unit" />
- <result column="remark" jdbcType="VARCHAR" property="remark" />
-
- <collection column="{productId=coupon_id}" property="merchantVoList"
- ofType="com.iformall.domain.vo.WxMerchantVo"
- javaType="java.util.List"
- select="com.iformall.mapper.WxCouponMerchantMapper.findMerchantVoList" >
- </collection>
- </resultMap>
-
-
- <select id="findListOfCUser" parameterType="com.iformall.domain.vo.WxCouponOrderCVo" resultMap="CVoResultMap">
- select <include refid="allCUserCouponOrderListColumns" />
- from wx_coupon_order co,wx_coupon c
- where 1=1
- and co.coupon_id = c.id
- and co.coupon_type != 5 and co.coupon_type != 7
- <if test="cUserId != null">
- and co.c_user_id = #{cUserId}
- </if>
- <if test="ownerId != null">
- and co.owner_id = #{ownerId}
- </if>
- <if test="tenantId != null">
- and co.tenant_id = #{tenantId}
- </if>
- <if test="couponOrderStatus != null">
- AND co.coupon_order_status = #{couponOrderStatus}
- </if>
- <if test=" null != sortColumns"> order by ${sortColumns} </if>
- </select>
-
-
-
-
- <select id="findDetailOfCUser" parameterType="java.lang.Long" resultMap="CVoResultMap">
- select <include refid="allCUserCouponOrderDetailColumns" />
- from wx_coupon_order co,wx_coupon c
- where co.coupon_id = c.id
- and co.id = #{id}
- </select>
-
- <sql id="allCUserCouponOrderCarListColumns">
- co.id,co.coupon_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,
- c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.price,c.unit,
- json_extract(car.vendor_params,'$.id') as coupon_free_id
- </sql>
-
- <resultMap id="CCarVoResultMap" type="com.iformall.domain.vo.WxCouponOrderCarCVo">
-
- <id column="id" jdbcType="BIGINT" property="id" />
- <result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
- <result column="coupon_id" jdbcType="BIGINT" property="couponId" />
- <result column="coupon_type" jdbcType="INTEGER" property="couponType" />
- <result column="c_user_id" jdbcType="BIGINT" property="cUserId" />
- <result column="owner_id" jdbcType="BIGINT" property="ownerId" />
- <result column="b_user_id" jdbcType="BIGINT" property="bUserId" />
- <result column="order_id" jdbcType="BIGINT" property="orderId" />
- <result column="expired_time" jdbcType="TIMESTAMP" property="expiredTime" />
- <result column="coupon_order_status" jdbcType="INTEGER" property="couponOrderStatus" />
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
- <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
- <result column="coupon_price" jdbcType="INTEGER" property="couponPrice" />
-
- <result column="type" jdbcType="INTEGER" property="type" />
- <result column="cover_img" jdbcType="VARCHAR" property="coverImg" />
- <result column="title" jdbcType="VARCHAR" property="title" />
- <result column="sub_title" jdbcType="VARCHAR" property="subTitle" />
- <result column="sale_price" jdbcType="INTEGER" property="salePrice" />
- <result column="use_price" jdbcType="INTEGER" property="usePrice" />
- <result column="detail" jdbcType="VARCHAR" property="detail" />
- <result column="price" jdbcType="INTEGER" property="price" />
- <result column="remark" jdbcType="VARCHAR" property="remark" />
-
- <result column="coupon_free_id" jdbcType="INTEGER" property="couponFreeId"/>
-
- </resultMap>
-
-
- <select id="findCarListOfCUser" parameterType="com.iformall.domain.vo.WxCouponOrderCarCVo" resultMap="CCarVoResultMap">
- select <include refid="allCUserCouponOrderCarListColumns" />
- from wx_coupon_order co, wx_coupon c, wx_coupon_car car
- where co.coupon_id = c.id
- and co.coupon_id = car.id
- and c.type = 5
- <if test="cUserId != null">
- and co.c_user_id = #{cUserId}
- </if>
- <if test="tenantId != null">
- and co.tenant_id = #{tenantId}
- </if>
- <if test="id != null">
- and co.id = #{id}
- </if>
- <if test="couponOrderStatus != null">
- AND co.coupon_order_status = #{couponOrderStatus}
- </if>
- <if test=" null != sortColumns"> order by ${sortColumns} </if>
- </select>
-
- <resultMap id="CCardVoResultMap" type="com.iformall.domain.vo.WxCardCVo">
- <id column="id" jdbcType="BIGINT" property="id" />
- <result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
- <result column="coupon_id" jdbcType="BIGINT" property="couponId" />
- <result column="coupon_type" jdbcType="INTEGER" property="couponType" />
- <result column="c_user_id" jdbcType="BIGINT" property="cUserId" />
- <result column="owner_id" jdbcType="BIGINT" property="ownerId" />
- <result column="b_user_id" jdbcType="BIGINT" property="bUserId" />
- <result column="order_id" jdbcType="BIGINT" property="orderId" />
- <result column="expired_time" jdbcType="TIMESTAMP" property="expiredTime" />
- <result column="coupon_order_status" jdbcType="INTEGER" property="couponOrderStatus" />
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
- <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
-
- <result column="cover_img" jdbcType="VARCHAR" property="coverImg" />
- <result column="title" jdbcType="VARCHAR" property="title" />
- <result column="sub_title" jdbcType="VARCHAR" property="subTitle" />
- <result column="detail" jdbcType="VARCHAR" property="detail" />
- <result column="unit" jdbcType="INTEGER" property="unit" />
- <result column="remark" jdbcType="VARCHAR" property="remark" />
-
- <result column="amount" jdbcType="INTEGER" property="amount" />
- <result column="remaining_amount" jdbcType="INTEGER" property="remainingAmount" />
-
- <collection column="{productId=coupon_id}" property="merchantVoList"
- ofType="com.iformall.domain.vo.WxMerchantVo"
- javaType="java.util.List"
- select="com.iformall.mapper.WxCouponMerchantMapper.findMerchantVoList" >
- </collection>
- <collection column="{cardId=id}" property="cardSpendList"
- ofType="com.iformall.domain.po.WxCardSpend"
- javaType="java.util.List"
- select="com.iformall.mapper.WxCardSpendMapper.findList" >
- </collection>
- </resultMap>
-
- <sql id="allCUserCardListColumns">
- co.id,co.tenant_id,co.coupon_id,co.coupon_type,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,
- c.cover_img,c.title,c.sub_title,c.detail,c.unit,c.remark,
- a.amount,a.remaining_amount
- </sql>
-
- <sql id="allCUserCardDetailColumns">
- co.id,co.tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,
- c.cover_img,c.title,c.sub_title,c.sale_price,c.price,c.unit,c.detail,c.remark,
- a.amount,a.remaining_amount
- </sql>
-
-
- <select id="findCardListOfCUser" parameterType="com.iformall.domain.vo.WxCardCVo" resultMap="CCardVoResultMap">
- select <include refid="allCUserCardListColumns" />
- from wx_coupon_order co
- inner join wx_coupon c on co.coupon_id = c.id
- inner join wx_card_info a on co.id=a.id
- where 1=1
- and co.coupon_type = 7
- <if test="tenantId != null">
- and co.tenant_id = #{tenantId}
- </if>
- <if test="cUserId != null">
- and co.c_user_id = #{cUserId}
- </if>
- <if test="ownerId != null">
- and co.owner_id = #{ownerId}
- </if>
- <if test="couponOrderStatus != null">
- and co.coupon_order_status = #{couponOrderStatus}
- </if>
- <if test=" null != sortColumns"> order by ${sortColumns} </if>
- </select>
-
- <select id="findCardDetailOfCUser" parameterType="java.lang.Long" resultMap="CCardVoResultMap">
- select <include refid="allCUserCardDetailColumns" />
- from wx_coupon_order co,wx_coupon c, wx_card_info a
- where co.coupon_id = c.id and co.id = a.id
- and co.id = #{id}
- </select>
-
- </mapper>
|