|
@@ -0,0 +1,250 @@
|
|
|
|
+<?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.yijia.customer.mapper.CustomerCardRecordConsumptionMapper">
|
|
|
|
+
|
|
|
|
+ <resultMap type="CustomerCardRecordConsumption" id="CustomerCardRecordConsumptionResult">
|
|
|
|
+ <result property="id" column="id" />
|
|
|
|
+ <result property="orderNo" column="order_no" />
|
|
|
|
+ <result property="unionId" column="union_id" />
|
|
|
|
+ <result property="customerNo" column="customer_no" />
|
|
|
|
+ <result property="customerName" column="customer_name" />
|
|
|
|
+ <result property="usageType" column="usage_type" />
|
|
|
|
+ <result property="payType" column="pay_type" />
|
|
|
|
+ <result property="cardOilsType" column="card_oils_type" />
|
|
|
|
+ <result property="amt" column="amt" />
|
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
|
+ <result property="balance" column="balance" />
|
|
|
|
+ <result property="stationId" column="station_id" />
|
|
|
|
+ <result property="stationName" column="station_name" />
|
|
|
|
+ <result property="status" column="status" />
|
|
|
|
+ </resultMap>
|
|
|
|
+
|
|
|
|
+ <sql id="selectCustomerCardRecordConsumptionVo">
|
|
|
|
+ select id, order_no, union_id, customer_no, customer_name, usage_type, pay_type, card_oils_type, amt, create_time, balance,station_id, station_name, status from customer_card_record_consumption
|
|
|
|
+ </sql>
|
|
|
|
+
|
|
|
|
+ <select id="selectCustomerCardRecordConsumptionList" parameterType="CustomerCardRecordConsumption" resultMap="CustomerCardRecordConsumptionResult">
|
|
|
|
+ <include refid="selectCustomerCardRecordConsumptionVo"/>
|
|
|
|
+ <where>
|
|
|
|
+ <if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo}</if>
|
|
|
|
+ <if test="unionId != null and unionId != ''"> and union_id = #{unionId}</if>
|
|
|
|
+ <if test="customerNo != null and customerNo != ''"> and customer_no = #{customerNo}</if>
|
|
|
|
+ <if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
|
|
|
|
+ <if test="usageType != null and usageType != ''"> and usage_type = #{usageType}</if>
|
|
|
|
+ <if test="payType != null and payType != ''"> and pay_type = #{payType}</if>
|
|
|
|
+ <if test="cardOilsType != null and cardOilsType != ''"> and card_oils_type = #{cardOilsType}</if>
|
|
|
|
+ <if test="amt != null "> and amt = #{amt}</if>
|
|
|
|
+ <if test="balance != null "> and balance = #{balance}</if>
|
|
|
|
+ <if test="stationId != null "> and station_id = #{stationId}</if>
|
|
|
|
+ <if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
|
|
|
|
+ <if test="status != null and status != ''"> and status = #{status}</if>
|
|
|
|
+ <if test="stationIdList != null ">
|
|
|
|
+ and station_id in
|
|
|
|
+ <foreach item="item" index="index" collection="stationIdList"
|
|
|
|
+ open="(" separator="," close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
|
|
|
|
+ AND date_format(create_time,'%Y-%m-%d %H:%i:%s') >= date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
|
|
|
|
+ AND date_format(create_time,'%Y-%m-%d %H:%i:%s') <= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="selectCustomerCardRecordConsumptionById" parameterType="Long" resultMap="CustomerCardRecordConsumptionResult">
|
|
|
|
+ <include refid="selectCustomerCardRecordConsumptionVo"/>
|
|
|
|
+ where id = #{id}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <insert id="insertCustomerCardRecordConsumption" parameterType="CustomerCardRecordConsumption" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
+ insert into customer_card_record_consumption
|
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
+ <if test="orderNo != null">order_no,</if>
|
|
|
|
+ <if test="unionId != null">union_id,</if>
|
|
|
|
+ <if test="customerNo != null">customer_no,</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="balance != null">balance,</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="customerNo != null">#{customerNo},</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="balance != null">#{balance},</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>
|
|
|
|
+
|
|
|
|
+ <update id="updateCustomerCardRecordConsumption" parameterType="CustomerCardRecordConsumption">
|
|
|
|
+ update customer_card_record_consumption
|
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
|
+ <if test="orderNo != null">order_no = #{orderNo},</if>
|
|
|
|
+ <if test="unionId != null">union_id = #{unionId},</if>
|
|
|
|
+ <if test="customerNo != null">customer_no = #{customerNo},</if>
|
|
|
|
+ <if test="customerName != null">customer_name = #{customerName},</if>
|
|
|
|
+ <if test="usageType != null">usage_type = #{usageType},</if>
|
|
|
|
+ <if test="payType != null">pay_type = #{payType},</if>
|
|
|
|
+ <if test="cardOilsType != null">card_oils_type = #{cardOilsType},</if>
|
|
|
|
+ <if test="amt != null">amt = #{amt},</if>
|
|
|
|
+ <if test="createTime != null">create_time = #{createTime},</if>
|
|
|
|
+ <if test="balance != null">balance = #{balance},</if>
|
|
|
|
+ <if test="stationId != null">station_id = #{stationId},</if>
|
|
|
|
+ <if test="stationName != null">station_name = #{stationName},</if>
|
|
|
|
+ <if test="status != null">status = #{status},</if>
|
|
|
|
+ </trim>
|
|
|
|
+ where id = #{id}
|
|
|
|
+ </update>
|
|
|
|
+
|
|
|
|
+ <delete id="deleteCustomerCardRecordConsumptionById" parameterType="Long">
|
|
|
|
+ delete from customer_card_record_consumption where id = #{id}
|
|
|
|
+ </delete>
|
|
|
|
+
|
|
|
|
+ <delete id="deleteCustomerCardRecordConsumptionByIds" parameterType="String">
|
|
|
|
+ delete from customer_card_record_consumption where id in
|
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
+ #{id}
|
|
|
|
+ </foreach>
|
|
|
|
+ </delete>
|
|
|
|
+ <select id="xfAmtQuery" parameterType="CustomerCardRecordConsumption" resultMap="CustomerCardRecordConsumptionResult">
|
|
|
|
+ SELECT sum(amt) as amt from customer_card_record_consumption
|
|
|
|
+ <where>
|
|
|
|
+ <if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo}</if>
|
|
|
|
+ <if test="unionId != null and unionId != ''"> and union_id = #{unionId}</if>
|
|
|
|
+ <if test="customerNo != null and customerNo != ''"> and customer_no = #{customerNo}</if>
|
|
|
|
+ <if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
|
|
|
|
+ <if test="usageType != null and usageType != ''"> and usage_type = #{usageType}</if>
|
|
|
|
+ <if test="payType != null and payType != ''"> and pay_type = #{payType}</if>
|
|
|
|
+ <if test="cardOilsType != null and cardOilsType != ''"> and card_oils_type = #{cardOilsType}</if>
|
|
|
|
+ <if test="amt != null "> and amt = #{amt}</if>
|
|
|
|
+ <if test="balance != null "> and balance = #{balance}</if>
|
|
|
|
+ <if test="stationId != null "> and station_id = #{stationId}</if>
|
|
|
|
+ <if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
|
|
|
|
+ <if test="status != null and status != ''"> and status = #{status}</if>
|
|
|
|
+ <if test="stationIdList != null ">
|
|
|
|
+ and station_id in
|
|
|
|
+ <foreach item="item" index="index" collection="stationIdList"
|
|
|
|
+ open="(" separator="," close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
|
|
|
|
+ AND date_format(create_time,'%Y-%m-%d %H:%i:%s') >= date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
|
|
|
|
+ AND date_format(create_time,'%Y-%m-%d %H:%i:%s') <= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ </select>
|
|
|
|
+ <select id="listXdata" parameterType="CustomerCardRecordConsumption" resultMap="CustomerCardRecordConsumptionResult">
|
|
|
|
+ SELECT date_format(create_time,'%Y-%m-%d') as create_time from customer_card_record_consumption
|
|
|
|
+ <where>
|
|
|
|
+ <if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo}</if>
|
|
|
|
+ <if test="unionId != null and unionId != ''"> and union_id = #{unionId}</if>
|
|
|
|
+ <if test="customerNo != null and customerNo != ''"> and customer_no = #{customerNo}</if>
|
|
|
|
+ <if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
|
|
|
|
+ <if test="usageType != null and usageType != ''"> and usage_type = #{usageType}</if>
|
|
|
|
+ <if test="payType != null and payType != ''"> and pay_type = #{payType}</if>
|
|
|
|
+ <if test="cardOilsType != null and cardOilsType != ''"> and card_oils_type = #{cardOilsType}</if>
|
|
|
|
+ <if test="amt != null "> and amt = #{amt}</if>
|
|
|
|
+ <if test="balance != null "> and balance = #{balance}</if>
|
|
|
|
+ <if test="stationId != null "> and station_id = #{stationId}</if>
|
|
|
|
+ <if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
|
|
|
|
+ <if test="status != null and status != ''"> and status = #{status}</if>
|
|
|
|
+ <if test="stationIdList != null ">
|
|
|
|
+ and station_id in
|
|
|
|
+ <foreach item="item" index="index" collection="stationIdList"
|
|
|
|
+ open="(" separator="," close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
|
|
|
|
+ AND date_format(create_time,'%Y-%m-%d %H:%i:%s') >= date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
|
|
|
|
+ AND date_format(create_time,'%Y-%m-%d %H:%i:%s') <= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ union
|
|
|
|
+ SELECT date_format(create_time,'%Y-%m-%d') as create_time from customer_card_record_recharge
|
|
|
|
+ <where>
|
|
|
|
+ <if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo}</if>
|
|
|
|
+ <if test="unionId != null and unionId != ''"> and union_id = #{unionId}</if>
|
|
|
|
+ <if test="customerNo != null and customerNo != ''"> and customer_no = #{customerNo}</if>
|
|
|
|
+ <if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
|
|
|
|
+ <if test="usageType != null and usageType != ''"> and usage_type = #{usageType}</if>
|
|
|
|
+ <if test="payType != null and payType != ''"> and pay_type = #{payType}</if>
|
|
|
|
+ <if test="cardOilsType != null and cardOilsType != ''"> and card_oils_type = #{cardOilsType}</if>
|
|
|
|
+ <if test="amt != null "> and amt = #{amt}</if>
|
|
|
|
+ <if test="balance != null "> and balance = #{balance}</if>
|
|
|
|
+ <if test="stationId != null "> and station_id = #{stationId}</if>
|
|
|
|
+ <if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
|
|
|
|
+ <if test="status != null and status != ''"> and status = #{status}</if>
|
|
|
|
+ <if test="stationIdList != null ">
|
|
|
|
+ and station_id in
|
|
|
|
+ <foreach item="item" index="index" collection="stationIdList"
|
|
|
|
+ open="(" separator="," close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
|
|
|
|
+ AND date_format(create_time,'%Y-%m-%d %H:%i:%s') >= date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
|
|
|
|
+ AND date_format(create_time,'%Y-%m-%d %H:%i:%s') <= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ order by date_format(create_time,'%Y-%m-%d')
|
|
|
|
+ </select>
|
|
|
|
+ <select id="listQydataXF" parameterType="CustomerCardRecordConsumption" resultMap="CustomerCardRecordConsumptionResult">
|
|
|
|
+ SELECT date_format(create_time,'%Y-%m-%d') as create_time,sum(amt) as amt
|
|
|
|
+ from customer_card_record_consumption
|
|
|
|
+ <where>
|
|
|
|
+ <if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo}</if>
|
|
|
|
+ <if test="unionId != null and unionId != ''"> and union_id = #{unionId}</if>
|
|
|
|
+ <if test="customerNo != null and customerNo != ''"> and customer_no = #{customerNo}</if>
|
|
|
|
+ <if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
|
|
|
|
+ <if test="usageType != null and usageType != ''"> and usage_type = #{usageType}</if>
|
|
|
|
+ <if test="payType != null and payType != ''"> and pay_type = #{payType}</if>
|
|
|
|
+ <if test="cardOilsType != null and cardOilsType != ''"> and card_oils_type = #{cardOilsType}</if>
|
|
|
|
+ <if test="amt != null "> and amt = #{amt}</if>
|
|
|
|
+ <if test="balance != null "> and balance = #{balance}</if>
|
|
|
|
+ <if test="stationId != null "> and station_id = #{stationId}</if>
|
|
|
|
+ <if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
|
|
|
|
+ <if test="status != null and status != ''"> and status = #{status}</if>
|
|
|
|
+ <if test="stationIdList != null ">
|
|
|
|
+ and station_id in
|
|
|
|
+ <foreach item="item" index="index" collection="stationIdList"
|
|
|
|
+ open="(" separator="," close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
|
|
|
|
+ AND date_format(create_time,'%Y-%m-%d %H:%i:%s') >= date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
|
|
|
|
+ AND date_format(create_time,'%Y-%m-%d %H:%i:%s') <= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ GROUP BY date_format(create_time,'%Y-%m-%d')
|
|
|
|
+ </select>
|
|
|
|
+</mapper>
|