123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- <?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.GiveUserGiftRecordMapper">
- <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.record.GiveUserGiftRecord" >
- <id column="record_id" property="recordId" jdbcType="INTEGER" />
- <result column="uid" property="uid" jdbcType="BIGINT" />
- <result column="gift_id" property="giftId" jdbcType="INTEGER" />
- <result column="gift_num" property="giftNum" jdbcType="INTEGER" />
- <result column="admin_id" property="adminId" jdbcType="INTEGER" />
- <result column="type" property="type" jdbcType="INTEGER" />
- <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
- </resultMap>
- <sql id="Base_Column_List" >
- record_id, uid, gift_id, gift_num, admin_id, type, create_time
- </sql>
- <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
- select
- <include refid="Base_Column_List" />
- from give_user_gift_record
- where record_id = #{recordId,jdbcType=INTEGER}
- </select>
- <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.record.GiveUserGiftRecord" >
- <selectKey resultType="java.lang.Integer" keyProperty="recordId" order="AFTER" >
- SELECT LAST_INSERT_ID()
- </selectKey>
- insert into give_user_gift_record (uid, gift_id, gift_num,
- admin_id, type, create_time
- )
- values (#{uid,jdbcType=BIGINT}, #{giftId,jdbcType=INTEGER}, #{giftNum,jdbcType=INTEGER},
- #{adminId,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}
- )
- </insert>
- <insert id="insertSelective" parameterType="com.juxiao.xchat.module.xbd.domain.record.GiveUserGiftRecord" >
- <selectKey resultType="java.lang.Integer" keyProperty="recordId" order="AFTER" >
- SELECT LAST_INSERT_ID()
- </selectKey>
- insert into give_user_gift_record
- <trim prefix="(" suffix=")" suffixOverrides="," >
- <if test="uid != null" >
- uid,
- </if>
- <if test="giftId != null" >
- gift_id,
- </if>
- <if test="giftNum != null" >
- gift_num,
- </if>
- <if test="adminId != null" >
- admin_id,
- </if>
- <if test="type != null" >
- type,
- </if>
- <if test="createTime != null" >
- create_time,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides="," >
- <if test="uid != null" >
- #{uid,jdbcType=BIGINT},
- </if>
- <if test="giftId != null" >
- #{giftId,jdbcType=INTEGER},
- </if>
- <if test="giftNum != null" >
- #{giftNum,jdbcType=INTEGER},
- </if>
- <if test="adminId != null" >
- #{adminId,jdbcType=INTEGER},
- </if>
- <if test="type != null" >
- #{type,jdbcType=INTEGER},
- </if>
- <if test="createTime != null" >
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.juxiao.xchat.module.xbd.domain.record.GiveUserGiftRecord" >
- update give_user_gift_record
- <set >
- <if test="uid != null" >
- uid = #{uid,jdbcType=BIGINT},
- </if>
- <if test="giftId != null" >
- gift_id = #{giftId,jdbcType=INTEGER},
- </if>
- <if test="giftNum != null" >
- gift_num = #{giftNum,jdbcType=INTEGER},
- </if>
- <if test="adminId != null" >
- admin_id = #{adminId,jdbcType=INTEGER},
- </if>
- <if test="type != null" >
- type = #{type,jdbcType=INTEGER},
- </if>
- <if test="createTime != null" >
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- </set>
- where record_id = #{recordId,jdbcType=INTEGER}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.juxiao.xchat.module.xbd.domain.record.GiveUserGiftRecord" >
- update give_user_gift_record
- set uid = #{uid,jdbcType=BIGINT},
- gift_id = #{giftId,jdbcType=INTEGER},
- gift_num = #{giftNum,jdbcType=INTEGER},
- admin_id = #{adminId,jdbcType=INTEGER},
- type = #{type,jdbcType=INTEGER},
- create_time = #{createTime,jdbcType=TIMESTAMP}
- where record_id = #{recordId,jdbcType=INTEGER}
- </update>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
- delete from give_user_gift_record
- where record_id = #{recordId,jdbcType=INTEGER}
- </delete>
- <select id="selectGiftPushRecords" resultType="com.juxiao.xchat.module.xbd.vo.GiftPushRecordVO">
- SELECT u.nick, u.avatar, u.erban_no as erbanNo, g.gift_name as giftName, r.gift_num as giftNum, su.user_name as adminName, DATE_FORMAT(r.create_time,'%Y-%m-%d %H:%i:%s') as createTime
- from give_user_gift_record r
- LEFT JOIN users u on r.uid = u.uid
- LEFT JOIN gift g on g.gift_id = r.gift_id
- LEFT JOIN sys_user su on su.user_id = r.admin_id
- where 1 = 1
- <if test="erbanNo != null">
- and u.erban_no = #{erbanNo}
- </if>
- <if test="adminName != null and adminName != ''">
- and su.user_name = #{adminName}
- </if>
- <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
- and r.create_time between #{beginTime} and #{endTime}
- </if>
- order by r.create_time desc, r.uid
- </select>
- </mapper>
|