123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- <?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.HeadwearPurseRecordMapper">
- <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.record.HeadwearPurseRecord" >
- <id column="record_id" property="recordId" jdbcType="BIGINT" />
- <result column="uid" property="uid" jdbcType="BIGINT" />
- <result column="headwear_id" property="headwearId" jdbcType="BIGINT" />
- <result column="headwear_date" property="headwearDate" 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, headwear_id, headwear_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 headwear_purse_record
- where record_id = #{recordId,jdbcType=BIGINT}
- </select>
- <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.record.HeadwearPurseRecord" >
- <selectKey resultType="java.lang.Long" keyProperty="recordId" order="AFTER" >
- SELECT LAST_INSERT_ID()
- </selectKey>
- insert into headwear_purse_record (uid, headwear_id, headwear_date,
- total_gold_num, is_use, create_time
- )
- values (#{uid,jdbcType=BIGINT}, #{headwearId,jdbcType=BIGINT}, #{headwearDate,jdbcType=INTEGER},
- #{totalGoldNum,jdbcType=BIGINT}, #{isUse,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP}
- )
- </insert>
- <insert id="insertSelective" parameterType="com.juxiao.xchat.module.xbd.domain.record.HeadwearPurseRecord" >
- <selectKey resultType="java.lang.Long" keyProperty="recordId" order="AFTER" >
- SELECT LAST_INSERT_ID()
- </selectKey>
- insert into headwear_purse_record
- <trim prefix="(" suffix=")" suffixOverrides="," >
- <if test="uid != null" >
- uid,
- </if>
- <if test="headwearId != null" >
- headwear_id,
- </if>
- <if test="headwearDate != null" >
- headwear_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="headwearId != null" >
- #{headwearId,jdbcType=BIGINT},
- </if>
- <if test="headwearDate != null" >
- #{headwearDate,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.HeadwearPurseRecord" >
- update headwear_purse_record
- <set >
- <if test="uid != null" >
- uid = #{uid,jdbcType=BIGINT},
- </if>
- <if test="headwearId != null" >
- headwear_id = #{headwearId,jdbcType=BIGINT},
- </if>
- <if test="headwearDate != null" >
- headwear_date = #{headwearDate,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.HeadwearPurseRecord" >
- update headwear_purse_record
- set uid = #{uid,jdbcType=BIGINT},
- headwear_id = #{headwearId,jdbcType=BIGINT},
- headwear_date = #{headwearDate,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 headwear_purse_record
- where record_id = #{recordId,jdbcType=BIGINT}
- </delete>
- <select id="selectGiveHeadWearUsersInfoByQuery"
- resultType="com.juxiao.xchat.module.xbd.vo.GiveHeadWearUsersVO">
- select u.uid, u.erban_no as erBanNo,u.avatar , u.nick,CONCAT(u.erban_no,',',h.headwear_id) as erBanNoOrHeadWearId,h.headwear_name as headwearName, h.gold_price as goldPrice,h.headwear_id as headwearId
- from users u
- left join headwear h on 1 = 1
- where u.def_user = 1 and u.erban_no = #{erBanNo} and h.headwear_id = #{headWearId}
- </select>
- <select id="selectHeadWearDaysByCarId" resultType="java.lang.Integer">
- select ifnull(hpr.headwear_date,0) as carDate
- from users u
- LEFT JOIN headwear h on 1 = 1
- LEFT JOIN headwear_purse_record hpr on u.uid = hpr.uid and h.headwear_id = hpr.headwear_id
- where u.uid = #{uid} and h.headwear_id = #{headWearId}
- </select>
- <select id="selectHeadwearPurseRecordByUid" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from headwear_purse_record
- where uid = #{uid}
- </select>
- <select id="selectHeadWearPurseRecordByHeadWearIdOrUid" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from headwear_purse_record
- where uid = #{uid} and headwear_id = #{headWearId}
- </select>
- </mapper>
|