<?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.yeshi.fanli.dao.mybatis.ExtractWeiXinRecordMapper">
|
<resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.ExtractWeiXinRecord">
|
<id column="aer_id" property="id" jdbcType="BIGINT"/>
|
<result column="aer_uid" property="uid" jdbcType="BIGINT"/>
|
<result column="aer_open_id" property="openId" jdbcType="VARCHAR"/>
|
<result column="aer_union_id" property="unionId" jdbcType="VARCHAR"/>
|
<result column="aer_money" property="money" jdbcType="DECIMAL"/>
|
<result column="aer_billno" property="billno" jdbcType="VARCHAR"/>
|
<result column="aer_detailno" property="detailno" jdbcType="VARCHAR"/>
|
<result column="aer_status" property="status" jdbcType="VARCHAR"/>
|
<result column="aer_send_time" property="sendTime" jdbcType="TIMESTAMP"/>
|
<result column="aer_rcv_time" property="rcvTime" jdbcType="TIMESTAMP"/>
|
<result column="aer_send_type" property="sendType" jdbcType="VARCHAR"/>
|
<result column="aer_hb_type" property="hbType" jdbcType="VARCHAR"/>
|
<result column="aer_total_num" property="totalNum" jdbcType="INTEGER"/>
|
<result column="aer_type" property="type" jdbcType="INTEGER"/>
|
<result column="aer_create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
<result column="aer_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
</resultMap>
|
<sql id="Base_Column_List">aer_id,aer_uid,aer_open_id,aer_union_id,aer_money,aer_billno,aer_detailno,aer_status,aer_send_time,aer_rcv_time,aer_send_type,aer_hb_type,aer_total_num,aer_type,aer_create_time,aer_update_time</sql>
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
|
<include refid="Base_Column_List"/>from yeshi_ec_extract_weixin_record where aer_id = #{id,jdbcType=BIGINT}
|
</select>
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_extract_weixin_record where aer_id = #{id,jdbcType=BIGINT}</delete>
|
<insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.ExtractWeiXinRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_extract_weixin_record (aer_id,aer_uid,aer_open_id,aer_union_id,aer_money,aer_billno,aer_detailno,aer_status,aer_send_time,aer_rcv_time,aer_send_type,aer_hb_type,aer_total_num,aer_type,aer_create_time,aer_update_time) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{openId,jdbcType=VARCHAR},#{unionId,jdbcType=VARCHAR},#{money,jdbcType=DECIMAL},#{billno,jdbcType=VARCHAR},#{detailno,jdbcType=VARCHAR},#{status,jdbcType=VARCHAR},#{sendTime,jdbcType=TIMESTAMP},#{rcvTime,jdbcType=TIMESTAMP},#{sendType,jdbcType=VARCHAR},#{hbType,jdbcType=VARCHAR},#{totalNum,jdbcType=INTEGER},#{type,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
|
<insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.ExtractWeiXinRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_extract_weixin_record
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">aer_id,</if>
|
<if test="uid != null">aer_uid,</if>
|
<if test="openId != null">aer_open_id,</if>
|
<if test="unionId != null">aer_union_id,</if>
|
<if test="money != null">aer_money,</if>
|
<if test="billno != null">aer_billno,</if>
|
<if test="detailno != null">aer_detailno,</if>
|
<if test="status != null">aer_status,</if>
|
<if test="sendTime != null">aer_send_time,</if>
|
<if test="rcvTime != null">aer_rcv_time,</if>
|
<if test="sendType != null">aer_send_type,</if>
|
<if test="hbType != null">aer_hb_type,</if>
|
<if test="totalNum != null">aer_total_num,</if>
|
<if test="type != null">aer_type,</if>
|
<if test="createTime != null">aer_create_time,</if>
|
<if test="updateTime != null">aer_update_time,</if>
|
</trim>values
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">#{id,jdbcType=BIGINT},</if>
|
<if test="uid != null">#{uid,jdbcType=BIGINT},</if>
|
<if test="openId != null">#{openId,jdbcType=VARCHAR},</if>
|
<if test="unionId != null">#{unionId,jdbcType=VARCHAR},</if>
|
<if test="money != null">#{money,jdbcType=DECIMAL},</if>
|
<if test="billno != null">#{billno,jdbcType=VARCHAR},</if>
|
<if test="detailno != null">#{detailno,jdbcType=VARCHAR},</if>
|
<if test="status != null">#{status,jdbcType=VARCHAR},</if>
|
<if test="sendTime != null">#{sendTime,jdbcType=TIMESTAMP},</if>
|
<if test="rcvTime != null">#{rcvTime,jdbcType=TIMESTAMP},</if>
|
<if test="sendType != null">#{sendType,jdbcType=VARCHAR},</if>
|
<if test="hbType != null">#{hbType,jdbcType=VARCHAR},</if>
|
<if test="totalNum != null">#{totalNum,jdbcType=INTEGER},</if>
|
<if test="type != null">#{type,jdbcType=INTEGER},</if>
|
<if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
<if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
|
</trim>
|
</insert>
|
<update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.ExtractWeiXinRecord">update yeshi_ec_extract_weixin_record set aer_uid = #{uid,jdbcType=BIGINT},aer_open_id = #{openId,jdbcType=VARCHAR},aer_union_id = #{unionId,jdbcType=VARCHAR},aer_money = #{money,jdbcType=DECIMAL},aer_billno = #{billno,jdbcType=VARCHAR},aer_detailno = #{detailno,jdbcType=VARCHAR},aer_status = #{status,jdbcType=VARCHAR},aer_send_time = #{sendTime,jdbcType=TIMESTAMP},aer_rcv_time = #{rcvTime,jdbcType=TIMESTAMP},aer_send_type = #{sendType,jdbcType=VARCHAR},aer_hb_type = #{hbType,jdbcType=VARCHAR},aer_total_num = #{totalNum,jdbcType=INTEGER},aer_type = #{type,jdbcType=INTEGER},aer_create_time = #{createTime,jdbcType=TIMESTAMP},aer_update_time = #{updateTime,jdbcType=TIMESTAMP} where aer_id = #{id,jdbcType=BIGINT}</update>
|
<update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.ExtractWeiXinRecord">update yeshi_ec_extract_weixin_record
|
<set>
|
<if test="uid != null">aer_uid=#{uid,jdbcType=BIGINT},</if>
|
<if test="openId != null">aer_open_id=#{openId,jdbcType=VARCHAR},</if>
|
<if test="unionId != null">aer_union_id=#{unionId,jdbcType=VARCHAR},</if>
|
<if test="money != null">aer_money=#{money,jdbcType=DECIMAL},</if>
|
<if test="billno != null">aer_billno=#{billno,jdbcType=VARCHAR},</if>
|
<if test="detailno != null">aer_detailno=#{detailno,jdbcType=VARCHAR},</if>
|
<if test="status != null">aer_status=#{status,jdbcType=VARCHAR},</if>
|
<if test="sendTime != null">aer_send_time=#{sendTime,jdbcType=TIMESTAMP},</if>
|
<if test="rcvTime != null">aer_rcv_time=#{rcvTime,jdbcType=TIMESTAMP},</if>
|
<if test="sendType != null">aer_send_type=#{sendType,jdbcType=VARCHAR},</if>
|
<if test="hbType != null">aer_hb_type=#{hbType,jdbcType=VARCHAR},</if>
|
<if test="totalNum != null">aer_total_num=#{totalNum,jdbcType=INTEGER},</if>
|
<if test="type != null">aer_type=#{type,jdbcType=INTEGER},</if>
|
<if test="createTime != null">aer_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
|
<if test="updateTime != null">aer_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
|
</set> where aer_id = #{id,jdbcType=BIGINT}
|
</update>
|
|
<select id="getValidUsers" resultType="Long">
|
SELECT DISTINCT A.uid
|
FROM (SELECT t.uid,d.`aer_uid` AS existUid,cc.aer_uid FROM (
|
<foreach collection="list" item="item" index="index">
|
<if test="index != 0">UNION</if> SELECT #{item} AS uid
|
</foreach>
|
)t
|
LEFT JOIN `yeshi_ec_extract_weixin_record` d ON d.aer_uid = t.uid
|
LEFT JOIN (SELECT DISTINCT d.aer_uid FROM `yeshi_ec_extract_weixin_record` d
|
WHERE IF(d.`aer_status` = 'RECEIVED',d.`aer_create_time` <![CDATA[<=]]> #{receivedDate}, FALSE)
|
OR IF(d.`aer_status` = 'REFUND',d.`aer_create_time` <![CDATA[<=]]> #{refundDate}, FALSE)
|
ORDER BY d.`aer_create_time` DESC
|
)cc ON cc.aer_uid = t.uid
|
WHERE IF (d.`aer_uid` IS NULL,TRUE, IFNULL(cc.aer_uid,FALSE)))A
|
</select>
|
|
<select id="getByOpenIdAndType" resultMap="BaseResultMap">
|
SELECT * FROM `yeshi_ec_extract_weixin_record` d
|
WHERE d.`aer_open_id` = #{openId} AND d.`aer_type` = #{type}
|
AND d.`aer_status`<![CDATA[<>]]> 'RECEIVED' AND d.`aer_status`<![CDATA[<>]]> 'REFUND'
|
ORDER BY d.`aer_create_time` DESC
|
LIMIT 1
|
</select>
|
|
</mapper>
|