123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351 |
- <?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.ElectronicMembershipCardMapper">
- <!--储蓄卡返回结果-->
- <resultMap id="CardBaseResultMap" type="com.platform.yijia.pojo.CustomerElectronicCard">
- <id column="id" jdbcType="INTEGER" property="id" />
- <result column="union_id" jdbcType="VARCHAR" property="unionId" />
- <result column="blog_openid" jdbcType="VARCHAR" property="blogOpenid" />
- <result column="customer_no" jdbcType="VARCHAR" property="customerNo" />
- <result column="customer_name" jdbcType="VARCHAR" property="customerName" />
- <result column="amt" jdbcType="DECIMAL" property="amt" />
- <result column="card_oils_type" jdbcType="VARCHAR" property="cardOilsType" />
- <result column="station_id" jdbcType="INTEGER" property="stationId" />
- <result column="station_name" jdbcType="VARCHAR" property="stationName" />
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
- <result column="recently_time" jdbcType="TIMESTAMP" property="recentlyTime" />
- </resultMap>
- <!--储蓄卡使用记录返回结果-->
- <resultMap id="CardRecordBaseResultMap" type="com.platform.yijia.pojo.CustomerCardUseRecord">
- <id column="id" jdbcType="INTEGER" property="id" />
- <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
- <result column="union_id" jdbcType="VARCHAR" property="unionId" />
- <result column="customer_name" jdbcType="VARCHAR" property="customerName" />
- <result column="usage_type" jdbcType="VARCHAR" property="usageType" />
- <result column="pay_type" jdbcType="VARCHAR" property="payType" />
- <result column="card_oils_type" jdbcType="VARCHAR" property="cardOilsType" />
- <result column="amt" jdbcType="DECIMAL" property="amt" />
- <result column="present_amt" jdbcType="DECIMAL" property="presentAmt" />
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
- <result column="station_id" jdbcType="INTEGER" property="stationId" />
- <result column="station_name" jdbcType="VARCHAR" property="stationName" />
- <result column="status" jdbcType="VARCHAR" property="status" />
- </resultMap>
- <!--储蓄卡充值规则返回结果-->
- <resultMap id="CardSettingBaseResultMap" type="com.platform.yijia.pojo.CustomerCardSetting">
- <id column="id" jdbcType="INTEGER" property="id" />
- <result column="card_oils_type" jdbcType="VARCHAR" property="cardOilsType" />
- <result column="discount_time" jdbcType="VARCHAR" property="discountTime" />
- <result column="present_scale" jdbcType="VARCHAR" property="presentScale" />
- <result column="is_discount_coupon" jdbcType="VARCHAR" property="isDiscountCoupon" />
- <result column="enjoy_integral_multiple" jdbcType="DATE" property="enjoyIntegralMultiple" />
- <result column="station_id" jdbcType="INTEGER" property="stationId" />
- <result column="station_name" jdbcType="VARCHAR" property="stationName" />
- <result column="create_time" jdbcType="VARCHAR" property="createTime" />
- <collection property="customerCardSettingDetailList" resultMap="CardSettingDetailResultMap"/>
- </resultMap>
- <!--储蓄卡充值规则明细表-->
- <resultMap id="CardSettingDetailResultMap" type="com.platform.yijia.pojo.CustomerCardSettingDetail">
- <id column="cardSettingDetailId" jdbcType="INTEGER" property="cardSettingDetailId" />
- <result column="parent_id" jdbcType="INTEGER" property="parentId"/>
- <result column="setting_rule_type" jdbcType="VARCHAR" property="settingRuleType" />
- <result column="discount_amt_term" jdbcType="DECIMAL" property="discountAmtTerm" />
- <result column="present_amt" jdbcType="DECIMAL" property="presentAmt"/>
- </resultMap>
- <!--查询油站电子会员卡(储蓄卡)充值设置规则-->
- <select id="getCardRechargeSettingList" parameterType="com.platform.yijia.pojo.CustomerCardSetting" resultMap="CardSettingBaseResultMap">
- SELECT
- T1.id,
- T1.card_oils_type,
- T1.discount_time,
- T1.present_scale,
- T1.is_discount_coupon,
- T1.enjoy_integral_multiple,
- T1.station_id,
- T1.station_name,
- T1.create_time,
- T2.id AS cardSettingDetailId,
- T2.parent_id,
- T2.setting_rule_type,
- T2.discount_amt_term,
- T2.present_amt
- FROM
- customer_card_setting AS T1 LEFT JOIN customer_card_setting_detail AS T2 ON T1.id = T2.parent_id
- <where>
- <if test="stationId !=null">
- T1.station_id = #{stationId}
- </if>
- <if test="cardOilsType !=null">
- AND T1.card_oils_type = #{cardOilsType}
- </if>
- </where>
- <if test="orderBy !=null and orderBy !=''">
- ORDER BY discount_amt_term ${orderBy}
- </if>
- </select>
- <!--查询客户充值的订单信息-->
- <select id="getCardRecordByOrderNo" parameterType="com.platform.yijia.pojo.CustomerCardUseRecord" resultMap="CardRecordBaseResultMap">
- SELECT
- id,
- order_no,
- union_id,
- customer_name,
- usage_type,
- pay_type,
- card_oils_type,
- amt,
- present_amt,
- create_time,
- station_id,
- station_name,
- status
- FROM
- customer_card_use_record
- <where>
- <if test=" orderNo !=null and orderNo !=''">
- order_no = #{orderNo}
- </if>
- </where>
- </select>
- <!--根据订单号更新用户充值记录的状态-->
- <update id="updateCardRecordStatusByOrderNo" parameterType="com.platform.yijia.pojo.CustomerElectronicCard">
- UPDATE
- customer_card_use_record
- <set>
- <if test="status !=null">
- status = #{status}
- </if>
- </set>
- <where>
- <if test=" orderNo !=null and orderNo !=''">
- order_no = #{orderNo}
- </if>
- </where>
- </update>
- <!--插入用户电子会员卡的使用记录-->
- <insert id="insetCardUseRecord" parameterType="com.platform.yijia.pojo.CustomerCardUseRecord">
- INSERT INTO
- customer_card_use_record
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="orderNo !=null">
- order_no,
- </if>
- <if test="unionId !=null">
- union_id,
- </if>
- <if test="customerName !=null">
- customer_name,
- </if>
- <if test="usageType !=null">
- usage_type,
- </if>
- <if test="payType !=null">
- pay_type,
- </if>
- <if test="cardOilsType !=null">
- card_oils_type,
- </if>
- <if test="amt !=null">
- amt,
- </if>
- <if test="presentAmt !=null">
- present_amt,
- </if>
- <if test="createTime !=null">
- create_time,
- </if>
- <if test="stationId !=null">
- station_id,
- </if>
- <if test="stationName !=null">
- station_name,
- </if>
- <if test="status !=null">
- status,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="orderNo !=null">
- #{orderNo},
- </if>
- <if test="unionId !=null">
- #{unionId},
- </if>
- <if test="customerName !=null">
- #{customerName},
- </if>
- <if test="usageType !=null">
- #{usageType},
- </if>
- <if test="payType !=null">
- #{payType},
- </if>
- <if test="cardOilsType !=null">
- #{cardOilsType},
- </if>
- <if test="amt !=null">
- #{amt},
- </if>
- <if test="presentAmt !=null">
- #{presentAmt},
- </if>
- <if test="createTime !=null">
- #{createTime},
- </if>
- <if test="stationId !=null">
- #{stationId},
- </if>
- <if test="stationName !=null">
- #{stationName},
- </if>
- <if test="status !=null">
- #{status},
- </if>
- </trim>
- </insert>
- <!--查询客户电子会员卡的使用记录-->
- <select id="getCardUseRecordList" resultMap="CardRecordBaseResultMap" parameterType="com.platform.yijia.pojo.CustomerCardUseRecord">
- SELECT
- id,
- order_no,
- union_id,
- customer_name,
- usage_type,
- pay_type,
- card_oils_type,
- amt,
- present_amt,
- create_time,
- station_id,
- station_name,
- status
- FROM
- customer_card_use_record
- <where>
- status ="1"
- <if test=" usageType !=null and usageType !=''">
- AND usage_type = #{usageType}
- </if>
- <if test="stationId !=null and stationId !=''">
- AND station_id = #{stationId}
- </if>
- <if test="unionId !=null and unionId !=''">
- AND union_id = #{unionId}
- </if>
- </where>
- ORDER BY create_time DESC
- </select>
- <!--查询用户所拥有的储蓄卡-->
- <select id="getElectronicCardList" resultMap="CardBaseResultMap" parameterType="com.platform.yijia.pojo.CustomerElectronicCard">
- SELECT
- id,
- union_id,
- blog_openid,
- customer_no,
- customer_name,
- amt,
- card_oils_type,
- station_id,
- station_name,
- create_time,
- recently_time
- FROM
- customer_electronic_card
- <where>
- <if test="stationId !=null and stationId !=''">
- station_id = #{stationId}
- </if>
- <if test="unionId !=null and unionId !=''">
- AND union_id = #{unionId}
- </if>
- <if test="cardOilsType !=null and cardOilsType !=''">
- AND card_oils_type = #{cardOilsType}
- </if>
- </where>
- </select>
- <!--获取用户用要充值电子会员卡(储蓄卡)信息-->
- <select id="getElectronicCardInfo" resultMap="CardBaseResultMap" parameterType="com.platform.yijia.pojo.CustomerElectronicCard">
- SELECT
- id,
- union_id,
- blog_openid,
- customer_no,
- customer_name,
- amt,
- card_oils_type,
- station_id,
- station_name,
- create_time,
- recently_time
- FROM
- customer_electronic_card
- <where>
- <if test="id !=null and id !=''">
- id = #{id}
- </if>
- </where>
- </select>
- <!--更新用户的电子会员卡的信息-->
- <update id="updateElectronicCardInfo" parameterType="com.platform.yijia.pojo.CustomerElectronicCard">
- UPDATE
- customer_electronic_card
- <set>
- <if test="amt !=null">
- amt = #{amt},
- </if>
- <if test="recentlyTime !=null">
- recently_time = #{recentlyTime}
- </if>
- </set>
- <where>
- <if test="id !=null and id != ''">
- id = #{id}
- </if>
- </where>
- </update>
- <!--根据unionId更新用户的电子会员卡的信息-->
- <update id="updateElectronicCardInfoByUnionId" parameterType="com.platform.yijia.pojo.CustomerElectronicCard">
- UPDATE customer_electronic_card
- <set>
- <if test="amt !=null">
- amt = #{amt},
- </if>
- <if test="recentlyTime !=null">
- recently_time = #{recentlyTime}
- </if>
- </set>
- <where>
- <if test="unionId !=null and unionId != ''">
- union_id = #{unionId}
- </if>
- </where>
- </update>
- <!--查询油站的会员卡启用标识 (1、启动 2,停用)-->
- <select id="getStationCardEnabledFlag" parameterType="Integer" resultType="String">
- SELECT
- card_enabled_flag AS cardEnabledFlag
- FROM
- station_pay
- <where>
- <if test="stationId !='' and stationId != null" >
- station_id = #{stationId}
- </if>
- </where>
- </select>
- </mapper>
|