|
@@ -0,0 +1,128 @@
|
|
|
|
+<?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="beilv.cardpurchaserecord.mapper.CardPurchaseRecordMapper">
|
|
|
|
+
|
|
|
|
+ <resultMap type="CardPurchaseRecord" id="CardPurchaseRecordResult">
|
|
|
|
+ <result property="id" column="id" />
|
|
|
|
+ <result property="userId" column="user_id" />
|
|
|
|
+ <result property="cardId" column="card_id" />
|
|
|
|
+ <result property="cardName" column="card_name" />
|
|
|
|
+ <result property="price" column="price" />
|
|
|
|
+ <result property="paymentTime" column="payment_time" />
|
|
|
|
+ <result property="refundTime" column="refund_time" />
|
|
|
|
+ <result property="paymentWay" column="payment_way" />
|
|
|
|
+ <result property="state" column="state" />
|
|
|
|
+ <result property="notes" column="notes" />
|
|
|
|
+ <result property="version" column="version" />
|
|
|
|
+ <result property="createBy" column="create_by" />
|
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
|
+ <result property="updateBy" column="update_by" />
|
|
|
|
+ <result property="updateTime" column="update_time" />
|
|
|
|
+ <result property="userName" column="username" />
|
|
|
|
+ <result property="realName" column="real_name" />
|
|
|
|
+ <result property="mobile" column="mobile" />
|
|
|
|
+ </resultMap>
|
|
|
|
+
|
|
|
|
+ <sql id="selectCardPurchaseRecordVo">
|
|
|
|
+ select a.id, a.user_id, a.card_id, a.card_name, a.price, a.payment_time, a.refund_time, a.payment_way, a.state, a.notes, a.version, a.create_by, a.create_time, a.update_by, a.update_time from card_purchase_record a
|
|
|
|
+ </sql>
|
|
|
|
+
|
|
|
|
+ <select id="selectCardPurchaseRecordList" parameterType="CardPurchaseRecord" resultMap="CardPurchaseRecordResult">
|
|
|
|
+ select a.id, a.user_id, a.card_id, a.card_name, a.price, a.payment_time, a.refund_time, a.payment_way, a.state, a.notes, a.version, a.create_by, a.create_time, a.update_by, a.update_time,
|
|
|
|
+ b.username,b.real_name,b.mobile
|
|
|
|
+ from card_purchase_record a
|
|
|
|
+ left join sys_member b on a.user_id = b.id
|
|
|
|
+ <where>
|
|
|
|
+ <if test="userId != null and userId != ''"> and user_id = #{userId}</if>
|
|
|
|
+ <if test="cardId != null and cardId != ''"> and card_id = #{cardId}</if>
|
|
|
|
+ <if test="cardName != null and cardName != ''"> and card_name like concat('%', #{cardName}, '%')</if>
|
|
|
|
+ <if test="price != null "> and price = #{price}</if>
|
|
|
|
+ <if test="paymentTime != null "> and payment_time = #{paymentTime}</if>
|
|
|
|
+ <if test="refundTime != null "> and refund_time = #{refundTime}</if>
|
|
|
|
+ <if test="paymentWay != null and paymentWay != ''"> and payment_way = #{paymentWay}</if>
|
|
|
|
+ <if test="state != null and state != ''"> and state = #{state}</if>
|
|
|
|
+ <if test="notes != null and notes != ''"> and notes = #{notes}</if>
|
|
|
|
+ <if test="version != null and version != ''"> and version = #{version}</if>
|
|
|
|
+ <if test="realName != null and realName != ''"> and b.real_name like concat('%', #{realName}, '%')</if>
|
|
|
|
+ <if test="mobile != null and mobile != ''"> and b.mobile like concat('%', #{mobile}, '%')</if>
|
|
|
|
+ </where>
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="selectCardPurchaseRecordById" parameterType="Long" resultMap="CardPurchaseRecordResult">
|
|
|
|
+ <include refid="selectCardPurchaseRecordVo"/>
|
|
|
|
+ where id = #{id}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <insert id="insertCardPurchaseRecord" parameterType="CardPurchaseRecord">
|
|
|
|
+ insert into card_purchase_record
|
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
+ <if test="id != null">id,</if>
|
|
|
|
+ <if test="userId != null">user_id,</if>
|
|
|
|
+ <if test="cardId != null">card_id,</if>
|
|
|
|
+ <if test="cardName != null">card_name,</if>
|
|
|
|
+ <if test="price != null">price,</if>
|
|
|
|
+ <if test="paymentTime != null">payment_time,</if>
|
|
|
|
+ <if test="refundTime != null">refund_time,</if>
|
|
|
|
+ <if test="paymentWay != null">payment_way,</if>
|
|
|
|
+ <if test="state != null">state,</if>
|
|
|
|
+ <if test="notes != null">notes,</if>
|
|
|
|
+ <if test="version != null">version,</if>
|
|
|
|
+ <if test="createBy != null">create_by,</if>
|
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
|
+ <if test="updateBy != null">update_by,</if>
|
|
|
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
|
+ </trim>
|
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
+ <if test="id != null">#{id},</if>
|
|
|
|
+ <if test="userId != null">#{userId},</if>
|
|
|
|
+ <if test="cardId != null">#{cardId},</if>
|
|
|
|
+ <if test="cardName != null">#{cardName},</if>
|
|
|
|
+ <if test="price != null">#{price},</if>
|
|
|
|
+ <if test="paymentTime != null">#{paymentTime},</if>
|
|
|
|
+ <if test="refundTime != null">#{refundTime},</if>
|
|
|
|
+ <if test="paymentWay != null">#{paymentWay},</if>
|
|
|
|
+ <if test="state != null">#{state},</if>
|
|
|
|
+ <if test="notes != null">#{notes},</if>
|
|
|
|
+ <if test="version != null">#{version},</if>
|
|
|
|
+ <if test="createBy != null">#{createBy},</if>
|
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
|
+ <if test="updateBy != null">#{updateBy},</if>
|
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
|
+ </trim>
|
|
|
|
+ </insert>
|
|
|
|
+
|
|
|
|
+ <update id="updateCardPurchaseRecord" parameterType="CardPurchaseRecord">
|
|
|
|
+ update card_purchase_record
|
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
|
+ <if test="userId != null">user_id = #{userId},</if>
|
|
|
|
+ <if test="cardId != null">card_id = #{cardId},</if>
|
|
|
|
+ <if test="cardName != null">card_name = #{cardName},</if>
|
|
|
|
+ <if test="price != null">price = #{price},</if>
|
|
|
|
+ <if test="paymentTime != null">payment_time = #{paymentTime},</if>
|
|
|
|
+ <if test="refundTime != null">refund_time = #{refundTime},</if>
|
|
|
|
+ <if test="paymentWay != null">payment_way = #{paymentWay},</if>
|
|
|
|
+ <if test="state != null">state = #{state},</if>
|
|
|
|
+ <if test="notes != null">notes = #{notes},</if>
|
|
|
|
+ <if test="version != null">version = #{version},</if>
|
|
|
|
+ <if test="createBy != null">create_by = #{createBy},</if>
|
|
|
|
+ <if test="createTime != null">create_time = #{createTime},</if>
|
|
|
|
+ <if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
|
+ </trim>
|
|
|
|
+ where id = #{id}
|
|
|
|
+ </update>
|
|
|
|
+
|
|
|
|
+ <delete id="deleteCardPurchaseRecordById" parameterType="Long">
|
|
|
|
+ delete from card_purchase_record where id = #{id}
|
|
|
|
+ </delete>
|
|
|
|
+
|
|
|
|
+ <delete id="deleteCardPurchaseRecordByIds" parameterType="String">
|
|
|
|
+ delete from card_purchase_record where id in
|
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
+ #{id}
|
|
|
|
+ </foreach>
|
|
|
|
+ </delete>
|
|
|
|
+
|
|
|
|
+</mapper>
|