123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381 |
- <?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.ChargeRecordMapper">
- <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.record.ChargeRecord" >
- <id column="charge_record_id" property="chargeRecordId" jdbcType="VARCHAR" />
- <result column="uid" property="uid" jdbcType="BIGINT" />
- <result column="room_uid" property="roomUid" jdbcType="BIGINT" />
- <result column="pingxx_charge_id" property="pingxxChargeId" jdbcType="VARCHAR" />
- <result column="charge_prod_id" property="chargeProdId" jdbcType="VARCHAR" />
- <result column="channel" property="channel" jdbcType="VARCHAR" />
- <result column="buss_type" property="bussType" jdbcType="TINYINT" />
- <result column="charge_status" property="chargeStatus" jdbcType="TINYINT" />
- <result column="charge_status_desc" property="chargeStatusDesc" jdbcType="VARCHAR" />
- <result column="amount" property="amount" jdbcType="BIGINT" />
- <result column="total_gold" property="totalGold" jdbcType="BIGINT" />
- <result column="client_ip" property="clientIp" jdbcType="VARCHAR" />
- <result column="wx_pub_openid" property="wxPubOpenid" jdbcType="VARCHAR" />
- <result column="subject" property="subject" jdbcType="VARCHAR" />
- <result column="body" property="body" jdbcType="VARCHAR" />
- <result column="extra" property="extra" jdbcType="VARCHAR" />
- <result column="metadata" property="metadata" jdbcType="VARCHAR" />
- <result column="charge_desc" property="chargeDesc" jdbcType="VARCHAR" />
- <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
- <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
- </resultMap>
- <resultMap id="QueryResultMap" type="com.juxiao.xchat.module.xbd.vo.ChargeRecordVO" >
- <id column="charge_record_id" property="chargeRecordId" jdbcType="VARCHAR" />
- <result column="pingxx_charge_id" property="pingxxChargeId" jdbcType="VARCHAR" />
- <result column="channel" property="channel" jdbcType="VARCHAR" />
- <result column="buss_type" property="bussType" jdbcType="TINYINT" />
- <result column="charge_status" property="chargeStatus" jdbcType="TINYINT" />
- <result column="amount" property="amount" jdbcType="BIGINT" />
- <result column="total_gold" property="totalGold" jdbcType="BIGINT" />
- <result column="client_ip" property="clientIp" jdbcType="VARCHAR" />
- <result column="subject" property="subject" jdbcType="VARCHAR" />
- <result column="charge_desc" property="chargeDesc" jdbcType="VARCHAR" />
- <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
- <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
- <result column="os" property="os" jdbcType="VARCHAR" />
- <result column="uid" property="uid" jdbcType="BIGINT" />
- <result column="erban_no" property="erbanNo" jdbcType="BIGINT" />
- <result column="phone" property="phone" jdbcType="VARCHAR" />
- <result column="nick" property="nick" jdbcType="VARCHAR" />
- <result column="gender" property="gender"/>
- </resultMap>
- <sql id="Base_Column_List" >
- charge_record_id, uid, room_uid, pingxx_charge_id, charge_prod_id, channel, buss_type,
- charge_status, charge_status_desc, amount, total_gold, client_ip, wx_pub_openid,
- subject, body, extra, metadata, charge_desc, create_time, update_time
- </sql>
- <sql id="Query_Column_List" >
- c.charge_record_id as charge_record_id, c.pingxx_charge_id as pingxx_charge_id, c.channel as channel,c.buss_type as buss_type,
- c.charge_status as charge_status, c.amount as amount, c.total_gold as total_gold, c.client_ip as client_ip,
- c.subject as subject,c.charge_desc as charge_desc, c.create_time as create_time, c.update_time as update_time,
- u.uid as uid,u.erban_no as erban_no,u.phone as phone ,u.nick as nick,u.os as os,u.gender as gender
- </sql>
- <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
- select
- <include refid="Base_Column_List" />
- from charge_record
- where charge_record_id = #{chargeRecordId,jdbcType=VARCHAR}
- </select>
- <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.record.ChargeRecord" >
- insert into charge_record (charge_record_id, uid, room_uid,
- pingxx_charge_id, charge_prod_id, channel,
- buss_type, charge_status, charge_status_desc,
- amount, total_gold, client_ip,
- wx_pub_openid, subject, body,
- extra, metadata, charge_desc,
- create_time, update_time)
- values (#{chargeRecordId,jdbcType=VARCHAR}, #{uid,jdbcType=BIGINT}, #{roomUid,jdbcType=BIGINT},
- #{pingxxChargeId,jdbcType=VARCHAR}, #{chargeProdId,jdbcType=VARCHAR}, #{channel,jdbcType=VARCHAR},
- #{bussType,jdbcType=TINYINT}, #{chargeStatus,jdbcType=TINYINT}, #{chargeStatusDesc,jdbcType=VARCHAR},
- #{amount,jdbcType=BIGINT}, #{totalGold,jdbcType=BIGINT}, #{clientIp,jdbcType=VARCHAR},
- #{wxPubOpenid,jdbcType=VARCHAR}, #{subject,jdbcType=VARCHAR}, #{body,jdbcType=VARCHAR},
- #{extra,jdbcType=VARCHAR}, #{metadata,jdbcType=VARCHAR}, #{chargeDesc,jdbcType=VARCHAR},
- #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
- </insert>
- <insert id="insertSelective" parameterType="com.juxiao.xchat.module.xbd.domain.record.ChargeRecord" >
- insert into charge_record
- <trim prefix="(" suffix=")" suffixOverrides="," >
- <if test="chargeRecordId != null" >
- charge_record_id,
- </if>
- <if test="uid != null" >
- uid,
- </if>
- <if test="roomUid != null" >
- room_uid,
- </if>
- <if test="pingxxChargeId != null" >
- pingxx_charge_id,
- </if>
- <if test="chargeProdId != null" >
- charge_prod_id,
- </if>
- <if test="channel != null" >
- channel,
- </if>
- <if test="bussType != null" >
- buss_type,
- </if>
- <if test="chargeStatus != null" >
- charge_status,
- </if>
- <if test="chargeStatusDesc != null" >
- charge_status_desc,
- </if>
- <if test="amount != null" >
- amount,
- </if>
- <if test="totalGold != null" >
- total_gold,
- </if>
- <if test="clientIp != null" >
- client_ip,
- </if>
- <if test="wxPubOpenid != null" >
- wx_pub_openid,
- </if>
- <if test="subject != null" >
- subject,
- </if>
- <if test="body != null" >
- body,
- </if>
- <if test="extra != null" >
- extra,
- </if>
- <if test="metadata != null" >
- metadata,
- </if>
- <if test="chargeDesc != null" >
- charge_desc,
- </if>
- <if test="createTime != null" >
- create_time,
- </if>
- <if test="updateTime != null" >
- update_time,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides="," >
- <if test="chargeRecordId != null" >
- #{chargeRecordId,jdbcType=VARCHAR},
- </if>
- <if test="uid != null" >
- #{uid,jdbcType=BIGINT},
- </if>
- <if test="roomUid != null" >
- #{roomUid,jdbcType=BIGINT},
- </if>
- <if test="pingxxChargeId != null" >
- #{pingxxChargeId,jdbcType=VARCHAR},
- </if>
- <if test="chargeProdId != null" >
- #{chargeProdId,jdbcType=VARCHAR},
- </if>
- <if test="channel != null" >
- #{channel,jdbcType=VARCHAR},
- </if>
- <if test="bussType != null" >
- #{bussType,jdbcType=TINYINT},
- </if>
- <if test="chargeStatus != null" >
- #{chargeStatus,jdbcType=TINYINT},
- </if>
- <if test="chargeStatusDesc != null" >
- #{chargeStatusDesc,jdbcType=VARCHAR},
- </if>
- <if test="amount != null" >
- #{amount,jdbcType=BIGINT},
- </if>
- <if test="totalGold != null" >
- #{totalGold,jdbcType=BIGINT},
- </if>
- <if test="clientIp != null" >
- #{clientIp,jdbcType=VARCHAR},
- </if>
- <if test="wxPubOpenid != null" >
- #{wxPubOpenid,jdbcType=VARCHAR},
- </if>
- <if test="subject != null" >
- #{subject,jdbcType=VARCHAR},
- </if>
- <if test="body != null" >
- #{body,jdbcType=VARCHAR},
- </if>
- <if test="extra != null" >
- #{extra,jdbcType=VARCHAR},
- </if>
- <if test="metadata != null" >
- #{metadata,jdbcType=VARCHAR},
- </if>
- <if test="chargeDesc != null" >
- #{chargeDesc,jdbcType=VARCHAR},
- </if>
- <if test="createTime != null" >
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="updateTime != null" >
- #{updateTime,jdbcType=TIMESTAMP},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.juxiao.xchat.module.xbd.domain.record.ChargeRecord" >
- update charge_record
- <set >
- <if test="uid != null" >
- uid = #{uid,jdbcType=BIGINT},
- </if>
- <if test="roomUid != null" >
- room_uid = #{roomUid,jdbcType=BIGINT},
- </if>
- <if test="pingxxChargeId != null" >
- pingxx_charge_id = #{pingxxChargeId,jdbcType=VARCHAR},
- </if>
- <if test="chargeProdId != null" >
- charge_prod_id = #{chargeProdId,jdbcType=VARCHAR},
- </if>
- <if test="channel != null" >
- channel = #{channel,jdbcType=VARCHAR},
- </if>
- <if test="bussType != null" >
- buss_type = #{bussType,jdbcType=TINYINT},
- </if>
- <if test="chargeStatus != null" >
- charge_status = #{chargeStatus,jdbcType=TINYINT},
- </if>
- <if test="chargeStatusDesc != null" >
- charge_status_desc = #{chargeStatusDesc,jdbcType=VARCHAR},
- </if>
- <if test="amount != null" >
- amount = #{amount,jdbcType=BIGINT},
- </if>
- <if test="totalGold != null" >
- total_gold = #{totalGold,jdbcType=BIGINT},
- </if>
- <if test="clientIp != null" >
- client_ip = #{clientIp,jdbcType=VARCHAR},
- </if>
- <if test="wxPubOpenid != null" >
- wx_pub_openid = #{wxPubOpenid,jdbcType=VARCHAR},
- </if>
- <if test="subject != null" >
- subject = #{subject,jdbcType=VARCHAR},
- </if>
- <if test="body != null" >
- body = #{body,jdbcType=VARCHAR},
- </if>
- <if test="extra != null" >
- extra = #{extra,jdbcType=VARCHAR},
- </if>
- <if test="metadata != null" >
- metadata = #{metadata,jdbcType=VARCHAR},
- </if>
- <if test="chargeDesc != null" >
- charge_desc = #{chargeDesc,jdbcType=VARCHAR},
- </if>
- <if test="createTime != null" >
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="updateTime != null" >
- update_time = #{updateTime,jdbcType=TIMESTAMP},
- </if>
- </set>
- where charge_record_id = #{chargeRecordId,jdbcType=VARCHAR}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.juxiao.xchat.module.xbd.domain.record.ChargeRecord" >
- update charge_record
- set uid = #{uid,jdbcType=BIGINT},
- room_uid = #{roomUid,jdbcType=BIGINT},
- pingxx_charge_id = #{pingxxChargeId,jdbcType=VARCHAR},
- charge_prod_id = #{chargeProdId,jdbcType=VARCHAR},
- channel = #{channel,jdbcType=VARCHAR},
- buss_type = #{bussType,jdbcType=TINYINT},
- charge_status = #{chargeStatus,jdbcType=TINYINT},
- charge_status_desc = #{chargeStatusDesc,jdbcType=VARCHAR},
- amount = #{amount,jdbcType=BIGINT},
- total_gold = #{totalGold,jdbcType=BIGINT},
- client_ip = #{clientIp,jdbcType=VARCHAR},
- wx_pub_openid = #{wxPubOpenid,jdbcType=VARCHAR},
- subject = #{subject,jdbcType=VARCHAR},
- body = #{body,jdbcType=VARCHAR},
- extra = #{extra,jdbcType=VARCHAR},
- metadata = #{metadata,jdbcType=VARCHAR},
- charge_desc = #{chargeDesc,jdbcType=VARCHAR},
- create_time = #{createTime,jdbcType=TIMESTAMP},
- update_time = #{updateTime,jdbcType=TIMESTAMP}
- where charge_record_id = #{chargeRecordId,jdbcType=VARCHAR}
- </update>
- <select id="selectByChargeTotal" resultType="java.math.BigDecimal">
- select sum(c.amount)
- from charge_record c LEFT JOIN users u ON c.uid=u.uid
- <where>
- <include refid="Query_where"></include>
- </where>
- </select>
- <select id="selectUsersByGender" resultType="com.juxiao.xchat.module.xbd.vo.ChargeRecordVO">
- select u.gender as gender, COUNT(DISTINCT c.uid) as num
- from charge_record c LEFT JOIN users u ON c.uid=u.uid
- <where>
- <include refid="Query_where"></include>
- </where>
- group BY u.gender
- </select>
- <select id="selectChargeRecordByQuery" resultMap="QueryResultMap">
- select
- <include refid="Query_Column_List" />
- from charge_record c LEFT JOIN users u ON c.uid=u.uid
- <where>
- <include refid="Query_where"></include>
- </where>
- ORDER BY c.create_time DESC
- </select>
- <sql id="Query_where">
- u.def_user!='3'
- <if test="erbanNo!= null">
- AND u.erban_no=#{erbanNo}
- </if>
- <if test="osType != null and osType != ''">
- AND u.os=#{osType}
- </if>
- <if test="recordId != null and recordId != ''">
- and c.charge_record_id = #{recordId}
- </if>
- <if test="pingxxId != null and pingxxId != ''">
- and c.pingxx_charge_id = #{pingxxId}
- </if>
- <if test="gender != null">
- AND u.gender=#{gender}
- </if>
- <if test="chargeType != null and chargeType != ''">
- AND c.charge_prod_id=#{chargeType}
- </if>
- <if test="beginTime != null and beginTime != ''">
- AND c.create_time >= #{beginTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND c.create_time <= #{endTime}
- </if>
- <if test="payStatus != null">
- AND c.charge_status=#{payStatus}
- </if>
- <if test="payChannel != null and payChannel != ''">
- AND c.channel=#{payChannel}
- </if>
- <choose >
- <when test="goldChargeType == 1" >
- and not c.charge_prod_id in ('exchange','company')
- </when>
- <when test="goldChargeType == 2" >
- and c.charge_prod_id = 'exchange'
- </when>
- <when test="goldChargeType == 3" >
- and c.charge_prod_id = 'company'
- </when>
- </choose>
- </sql>
- <select id="selectChargeAccessData" resultType="com.juxiao.xchat.module.xbd.vo.ChargeAccessData">
- select sum(amount) / 100 as total, DATE_FORMAT(update_time,'%Y-%m-%d') as date
- from charge_record
- where charge_status = 2 and channel <![CDATA[ <> ]]> 'exchange' and date_format(update_time, '%Y%m' ) = date_format(curdate( ) , '%Y%m' )
- group by date
- </select>
- </mapper>
|