|
@@ -0,0 +1,121 @@
|
|
|
+<?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.CustomerCardUseRecordMapper">
|
|
|
+
|
|
|
+ <resultMap type="CustomerCardUseRecord" id="CustomerCardUseRecordResult">
|
|
|
+ <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="presentAmt" column="present_amt" />
|
|
|
+ <result property="balance" column="balance" />
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
+ <result property="stationId" column="station_id" />
|
|
|
+ <result property="stationName" column="station_name" />
|
|
|
+ <result property="status" column="status" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectCustomerCardUseRecordVo">
|
|
|
+ select id, order_no, union_id, customer_no, customer_name, usage_type, pay_type, card_oils_type, amt, present_amt, balance, create_time, station_id, station_name, status from customer_card_use_record
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectCustomerCardUseRecordList" parameterType="CustomerCardUseRecord" resultMap="CustomerCardUseRecordResult">
|
|
|
+ <include refid="selectCustomerCardUseRecordVo"/>
|
|
|
+ <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="presentAmt != null "> and present_amt = #{presentAmt}</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>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectCustomerCardUseRecordById" parameterType="Long" resultMap="CustomerCardUseRecordResult">
|
|
|
+ <include refid="selectCustomerCardUseRecordVo"/>
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertCustomerCardUseRecord" parameterType="CustomerCardUseRecord" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ 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="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="presentAmt != null">present_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="presentAmt != null">#{presentAmt},</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="updateCustomerCardUseRecord" parameterType="CustomerCardUseRecord">
|
|
|
+ update customer_card_use_record
|
|
|
+ <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="presentAmt != null">present_amt = #{presentAmt},</if>
|
|
|
+ <if test="balance != null">balance = #{balance},</if>
|
|
|
+ <if test="createTime != null">create_time = #{createTime},</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="deleteCustomerCardUseRecordById" parameterType="Long">
|
|
|
+ delete from customer_card_use_record where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteCustomerCardUseRecordByIds" parameterType="String">
|
|
|
+ delete from customer_card_use_record where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+</mapper>
|