|
@@ -1,8 +1,10 @@
|
|
|
<?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.platform.yijia.dao.CouponMapper">
|
|
|
- <resultMap id="BaseResultMap" type="com.platform.yijia.pojo.Coupon">
|
|
|
- <id column="id" jdbcType="INTEGER" property="couponId" />
|
|
|
+ <!--优惠券-->
|
|
|
+ <resultMap id="BaseResultMap" type="com.platform.yijia.pojo.Coupon">
|
|
|
+ <id column="id" jdbcType="INTEGER" property="couponId" />
|
|
|
+ <result column="station_id" jdbcType="INTEGER" property="stationId" />
|
|
|
<result column="coupon_name" jdbcType="VARCHAR" property="couponName" />
|
|
|
<result column="coupon_type" jdbcType="VARCHAR" property="couponType" />
|
|
|
<result column="coupon_threshold_amt" jdbcType="DECIMAL" property="couponThresholdAmt" />
|
|
@@ -19,13 +21,19 @@
|
|
|
<result column="status" jdbcType="VARCHAR" property="status" />
|
|
|
</resultMap>
|
|
|
|
|
|
- <resultMap id="UserCouponsBaseResultMap" type="com.platform.yijia.pojo.UserCoupon">
|
|
|
- <result column="coupon_id" jdbcType="INTEGER" property="couponId" />
|
|
|
- <result column="union_id" jdbcType="VARCHAR" property="unionId" />
|
|
|
- <result column="station_id" jdbcType="INTEGER" property="stationId" />
|
|
|
- <result column="coupon_origin" jdbcType="VARCHAR" property="couponOrigin" />
|
|
|
- <result column="is_used" jdbcType="VARCHAR" property="isUsed" />
|
|
|
+ <!--用户优惠券-->
|
|
|
+ <resultMap id="UserCouponsBaseResultMap" type="com.platform.yijia.pojo.UserCoupon">
|
|
|
+ <result column="coupon_id" jdbcType="INTEGER" property="couponId" />
|
|
|
+ <result column="union_id" jdbcType="VARCHAR" property="unionId" />
|
|
|
+ <result column="get_coupon_origin" jdbcType="VARCHAR" property="getCouponOrigin" />
|
|
|
+ <result column="coupon_is_used" jdbcType="VARCHAR" property="couponIsUsed" />
|
|
|
+ <result column="coupon_no" jdbcType="VARCHAR" property="couponNo" />
|
|
|
+ <result column="coupon_is_effective" jdbcType="VARCHAR" property="couponIsEffective" />
|
|
|
+ <result column="grant_coupon_shop" jdbcType="INTEGER" property="grantCouponShop" />
|
|
|
+ <result column="get_coupon_time" jdbcType="TIMESTAMP" property="getCouponTime" />
|
|
|
+ <result column="grant_coupon_person" jdbcType="INTEGER" property="grantCouponPerson" />
|
|
|
|
|
|
+ <result column="station_id" jdbcType="INTEGER" property="stationId" />
|
|
|
<result column="coupon_name" jdbcType="VARCHAR" property="couponName" />
|
|
|
<result column="coupon_type" jdbcType="VARCHAR" property="couponType" />
|
|
|
<result column="coupon_threshold_amt" jdbcType="DECIMAL" property="couponThresholdAmt" />
|
|
@@ -40,11 +48,13 @@
|
|
|
<result column="open_platform" jdbcType="VARCHAR" property="openPlatform" />
|
|
|
<result column="grant_status" jdbcType="VARCHAR" property="grantStatus" />
|
|
|
<result column="status" jdbcType="VARCHAR" property="status" />
|
|
|
+
|
|
|
+ <result column="dept_name" jdbcType="VARCHAR" property="stationName" />
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
<sql id="Base_Column_List">
|
|
|
- id, coupon_name, coupon_type, coupon_threshold_amt, oil_type, coupon_amt, coupon_num, effective_time_type,
|
|
|
+ id, station_id, coupon_name, coupon_type, coupon_threshold_amt, oil_type, coupon_amt, coupon_num, effective_time_type,
|
|
|
effective_time_start, effective_time_end, effective_day_num, coupon_receive_num, open_platform, grant_status, status
|
|
|
</sql>
|
|
|
<!--获取加油券信息-->
|
|
@@ -65,6 +75,14 @@
|
|
|
SELECT
|
|
|
T1.union_id,
|
|
|
T1.coupon_id,
|
|
|
+ T1.coupon_is_effective,
|
|
|
+ T1.coupon_is_used,
|
|
|
+ T1.grant_coupon_shop,
|
|
|
+ T1.grant_coupon_person,
|
|
|
+ T1.get_coupon_origin,
|
|
|
+ T1.get_coupon_time,
|
|
|
+ T3.dept_name,
|
|
|
+ T2.station_id,
|
|
|
T2.oil_type,
|
|
|
T2.coupon_name,
|
|
|
T2.coupon_threshold_amt,
|
|
@@ -74,8 +92,9 @@
|
|
|
T2.effective_time_end,
|
|
|
T2.effective_day_num,
|
|
|
T2.status
|
|
|
- FROM
|
|
|
- coupon_user AS T1 LEFT JOIN coupon_info T2 ON T1.coupon_id = T2.id
|
|
|
+ FROM coupon_user AS T1
|
|
|
+ LEFT JOIN coupon_info AS T2 ON T1.coupon_id = T2.id
|
|
|
+ LEFT JOIN sys_dept AS T3 ON T2.station_id = T3.dept_id
|
|
|
<where>
|
|
|
<if test="stationId !=null and stationId !=''">
|
|
|
T1.station_id = #{stationId}
|
|
@@ -85,4 +104,74 @@
|
|
|
</if>
|
|
|
</where>
|
|
|
</select>
|
|
|
+
|
|
|
+ <!--用户获取优惠券-->
|
|
|
+ <insert id="addUserCoupon" parameterType="com.platform.yijia.pojo.UserCoupon">
|
|
|
+ INSERT INTO coupon_user
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="unionId !=null">
|
|
|
+ union_id,
|
|
|
+ </if>
|
|
|
+ <if test="couponId !=null">
|
|
|
+ coupon_id,
|
|
|
+ </if>
|
|
|
+ <if test="couponNo !=null">
|
|
|
+ coupon_no,
|
|
|
+ </if>
|
|
|
+ <if test="getCouponOrigin !=null">
|
|
|
+ get_coupon_origin,
|
|
|
+ </if>
|
|
|
+ <if test="couponIsUsed !=null">
|
|
|
+ coupon_is_used,
|
|
|
+ </if>
|
|
|
+ <if test="couponIsEffective !=null">
|
|
|
+ coupon_is_effective,
|
|
|
+ </if>
|
|
|
+ <if test="grantCouponShop !=null">
|
|
|
+ grant_coupon_shop,
|
|
|
+ </if>
|
|
|
+ <if test="getCouponTime !=null">
|
|
|
+ get_coupon_time,
|
|
|
+ </if>
|
|
|
+ <if test="grantCouponPerson !=null">
|
|
|
+ grant_coupon_person,
|
|
|
+ </if>
|
|
|
+ <if test="stationId !=null">
|
|
|
+ station_id,
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="unionId !=null">
|
|
|
+ #{unionId},
|
|
|
+ </if>
|
|
|
+ <if test="couponId !=null">
|
|
|
+ #{couponId},
|
|
|
+ </if>
|
|
|
+ <if test="couponNo !=null">
|
|
|
+ #{couponNo},
|
|
|
+ </if>
|
|
|
+ <if test="getCouponOrigin !=null">
|
|
|
+ #{getCouponOrigin},
|
|
|
+ </if>
|
|
|
+ <if test="couponIsUsed !=null">
|
|
|
+ #{couponIsUsed},
|
|
|
+ </if>
|
|
|
+ <if test="couponIsEffective !=null">
|
|
|
+ #{couponIsEffective},
|
|
|
+ </if>
|
|
|
+ <if test="grantCouponShop !=null">
|
|
|
+ #{grantCouponShop},
|
|
|
+ </if>
|
|
|
+ <if test="getCouponTime !=null">
|
|
|
+ #{getCouponTime},
|
|
|
+ </if>
|
|
|
+ <if test="grantCouponPerson !=null">
|
|
|
+ #{grantCouponPerson},
|
|
|
+ </if>
|
|
|
+ <if test="stationId !=null">
|
|
|
+ #{stationId},
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
</mapper>
|