123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- <?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.juxiao.xchat.module.xbd.mapper.record.GiftCarPurseRecordMapper">
- <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.record.GiftCarPurseRecord" >
- <id column="record_id" property="recordId" jdbcType="BIGINT" />
- <result column="uid" property="uid" jdbcType="BIGINT" />
- <result column="car_id" property="carId" jdbcType="BIGINT" />
- <result column="car_date" property="carDate" jdbcType="INTEGER" />
- <result column="total_gold_num" property="totalGoldNum" jdbcType="BIGINT" />
- <result column="is_use" property="isUse" jdbcType="TINYINT" />
- <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
- </resultMap>
- <sql id="Base_Column_List" >
- record_id, uid, car_id, car_date, total_gold_num, is_use, create_time
- </sql>
- <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
- select
- <include refid="Base_Column_List" />
- from gift_car_purse_record
- where record_id = #{recordId,jdbcType=BIGINT}
- </select>
- <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.record.GiftCarPurseRecord" >
- <selectKey resultType="java.lang.Long" keyProperty="recordId" order="AFTER" >
- SELECT LAST_INSERT_ID()
- </selectKey>
- insert into gift_car_purse_record (uid, car_id, car_date,
- total_gold_num, is_use, create_time
- )
- values (#{uid,jdbcType=BIGINT}, #{carId,jdbcType=BIGINT}, #{carDate,jdbcType=INTEGER},
- #{totalGoldNum,jdbcType=BIGINT}, #{isUse,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP}
- )
- </insert>
- <insert id="insertSelective" parameterType="com.juxiao.xchat.module.xbd.domain.record.GiftCarPurseRecord" >
- <selectKey resultType="java.lang.Long" keyProperty="recordId" order="AFTER" >
- SELECT LAST_INSERT_ID()
- </selectKey>
- insert into gift_car_purse_record
- <trim prefix="(" suffix=")" suffixOverrides="," >
- <if test="uid != null" >
- uid,
- </if>
- <if test="carId != null" >
- car_id,
- </if>
- <if test="carDate != null" >
- car_date,
- </if>
- <if test="totalGoldNum != null" >
- total_gold_num,
- </if>
- <if test="isUse != null" >
- is_use,
- </if>
- <if test="createTime != null" >
- create_time,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides="," >
- <if test="uid != null" >
- #{uid,jdbcType=BIGINT},
- </if>
- <if test="carId != null" >
- #{carId,jdbcType=BIGINT},
- </if>
- <if test="carDate != null" >
- #{carDate,jdbcType=INTEGER},
- </if>
- <if test="totalGoldNum != null" >
- #{totalGoldNum,jdbcType=BIGINT},
- </if>
- <if test="isUse != null" >
- #{isUse,jdbcType=TINYINT},
- </if>
- <if test="createTime != null" >
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.juxiao.xchat.module.xbd.domain.record.GiftCarPurseRecord" >
- update gift_car_purse_record
- <set >
- <if test="uid != null" >
- uid = #{uid,jdbcType=BIGINT},
- </if>
- <if test="carId != null" >
- car_id = #{carId,jdbcType=BIGINT},
- </if>
- <if test="carDate != null" >
- car_date = #{carDate,jdbcType=INTEGER},
- </if>
- <if test="totalGoldNum != null" >
- total_gold_num = #{totalGoldNum,jdbcType=BIGINT},
- </if>
- <if test="isUse != null" >
- is_use = #{isUse,jdbcType=TINYINT},
- </if>
- <if test="createTime != null" >
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- </set>
- where record_id = #{recordId,jdbcType=BIGINT}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.juxiao.xchat.module.xbd.domain.record.GiftCarPurseRecord" >
- update gift_car_purse_record
- set uid = #{uid,jdbcType=BIGINT},
- car_id = #{carId,jdbcType=BIGINT},
- car_date = #{carDate,jdbcType=INTEGER},
- total_gold_num = #{totalGoldNum,jdbcType=BIGINT},
- is_use = #{isUse,jdbcType=TINYINT},
- create_time = #{createTime,jdbcType=TIMESTAMP}
- where record_id = #{recordId,jdbcType=BIGINT}
- </update>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
- delete from gift_car_purse_record
- where record_id = #{recordId,jdbcType=BIGINT}
- </delete>
- <select id="selectGiveCarUsersInfoByQuery" resultType="com.juxiao.xchat.module.xbd.vo.GiveCarUsersVO">
- select u.uid, u.erban_no as erBanNo,u.avatar , u.nick,CONCAT(u.erban_no,',',gc.car_id) as erBanNoOrCarId,gc.car_name as carName, gc.gold_price as goldPrice,gc.car_id as carId
- from users u
- left join gift_car gc on 1 = 1
- where u.def_user = 1
- and u.erban_no = #{erBanNo} and gc.car_id = #{carId}
- </select>
- <select id="selectCarDaysByCarId" resultType="java.lang.Integer">
- select ifnull(gcpr.car_date,0) as carDate
- from users u
- LEFT JOIN gift_car gc on 1 = 1
- LEFT JOIN gift_car_purse_record gcpr on u.uid = gcpr.uid and gc.car_id = gcpr.car_id
- where u.uid = #{uid} and gc.car_id = #{carId}
- </select>
- <select id="selectGiftCarPurseRecordByUid" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from gift_car_purse_record
- where uid = #{uid}
- </select>
- <select id="selectGiftCarPurseRecordByCarIdOrUid" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from gift_car_purse_record
- where uid = #{uid} and car_id = #{carId}
- </select>
- </mapper>
|