123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- <?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.users.OfficialGoldRecordMapper">
- <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.users.OfficialGoldRecord" >
- <id column="record_id" property="recordId" jdbcType="INTEGER" />
- <result column="uid" property="uid" jdbcType="BIGINT" />
- <result column="gold_num" property="goldNum" jdbcType="BIGINT" />
- <result column="type" property="type" jdbcType="TINYINT" />
- <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
- <result column="admin_id " property="adminId" jdbcType="INTEGER" />
- <result column="remark" property="remark" jdbcType="VARCHAR"/>
- </resultMap>
- <sql id="Base_Column_List" >
- record_id, uid, gold_num, type, create_time, admin_id
- </sql>
- <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
- select
- <include refid="Base_Column_List" />
- from official_gold_record
- where record_id = #{recordId,jdbcType=INTEGER}
- </select>
- <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.users.OfficialGoldRecord" >
- <selectKey resultType="java.lang.Integer" keyProperty="recordId" order="AFTER" >
- SELECT LAST_INSERT_ID()
- </selectKey>
- insert into official_gold_record (uid, gold_num, type,
- create_time, admin_id,remark)
- values (#{uid,jdbcType=BIGINT}, #{goldNum,jdbcType=BIGINT}, #{type,jdbcType=TINYINT},
- #{createTime,jdbcType=TIMESTAMP}, #{adminId,jdbcType=INTEGER},#{remark,jdbcType=VARCHAR})
- </insert>
- <insert id="insertSelective" parameterType="com.juxiao.xchat.module.xbd.domain.users.OfficialGoldRecord" >
- <selectKey resultType="java.lang.Integer" keyProperty="recordId" order="AFTER" >
- SELECT LAST_INSERT_ID()
- </selectKey>
- insert into official_gold_record
- <trim prefix="(" suffix=")" suffixOverrides="," >
- <if test="uid != null" >
- uid,
- </if>
- <if test="goldNum != null" >
- gold_num,
- </if>
- <if test="type != null" >
- type,
- </if>
- <if test="createTime != null" >
- create_time,
- </if>
- <if test="adminId != null" >
- admin_id,
- </if>
- <if test="remark != null" >
- remark,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides="," >
- <if test="uid != null" >
- #{uid,jdbcType=BIGINT},
- </if>
- <if test="goldNum != null" >
- #{goldNum,jdbcType=BIGINT},
- </if>
- <if test="type != null" >
- #{type,jdbcType=TINYINT},
- </if>
- <if test="createTime != null" >
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="adminId != null" >
- #{adminId,jdbcType=INTEGER},
- </if>
- <if test="remark != null" >
- #{remark,jdbcType=VARCHAR},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.juxiao.xchat.module.xbd.domain.users.OfficialGoldRecord" >
- update official_gold_record
- <set >
- <if test="uid != null" >
- uid = #{uid,jdbcType=BIGINT},
- </if>
- <if test="goldNum != null" >
- gold_num = #{goldNum,jdbcType=BIGINT},
- </if>
- <if test="type != null" >
- type = #{type,jdbcType=TINYINT},
- </if>
- <if test="createTime != null" >
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="adminId != null">
- admin_id = #{adminId, jdbcType=INTEGER},
- </if>
- <if test="remark != null">
- remark = #{adminId, jdbcType=VARCHAR},
- </if>
- </set>
- where record_id = #{recordId,jdbcType=INTEGER}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.juxiao.xchat.module.xbd.domain.users.OfficialGoldRecord" >
- update official_gold_record
- set uid = #{uid,jdbcType=BIGINT},
- gold_num = #{goldNum,jdbcType=BIGINT},
- type = #{type,jdbcType=TINYINT},
- create_time = #{createTime,jdbcType=TIMESTAMP},
- admin_id = #{adminId, jdbcType=INTEGER},
- remark = #{remark, jdbcType=VARCHAR}
- where record_id = #{recordId,jdbcType=INTEGER}
- </update>
- <select id="selectByUidOrType" resultType="com.juxiao.xchat.module.xbd.domain.users.OfficialGoldRecord">
- select record_id as recordId,uid,gold_num as goldNum,type,create_time as createTime,admin_id as adminId
- from official_gold_record
- where uid = #{uid} and type = #{type}
- </select>
- <select id="selectByOfficialGoldRecord" resultType="com.juxiao.xchat.module.xbd.vo.GiveGoldRecordVO">
- SELECT
- o.record_id as recordId,
- o.gold_num as goldNum,
- o.type,
- o.uid,
- o.create_time as createTime,
- o.admin_id as adminId,
- u.nick,
- u.erban_no as erbanNo,
- u.phone,
- u.avatar,
- su.user_name as adminName,
- o.remark
- FROM
- official_gold_record o
- LEFT JOIN users u ON o.uid = u.uid
- LEFT JOIN sys_user su ON su.user_id = o.admin_Id
- <include refid="record_sql"/>
- ORDER BY o.create_time DESC
- </select>
- <select id="sumChargeTotal" resultType="java.lang.Long">
- SELECT ifnull(SUM(o.gold_num),0)
- FROM
- official_gold_record o
- LEFT JOIN users u ON o.uid = u.uid
- LEFT JOIN sys_user su ON su.user_id = o.admin_Id
- <include refid="record_sql"/>
- </select>
- <sql id="record_sql">
- <where>
- <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
- AND o.create_time between #{beginTime} and #{endTime}
- </if>
- <if test="erBanNo != null">
- AND u.erban_no = #{erBanNo}
- </if>
- <if test="type != null">
- AND o.type = #{type}
- </if>
- <if test="adminName != null and adminName != ''">
- AND su.user_name = #{adminName}
- </if>
- </where>
- </sql>
- </mapper>
|