admin
2020-05-20 98b1a0affd69bbe63223c21fdd2c404e8bedfccb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?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.PayInfoMapper">
    <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.PayInfo">
        <id column="id" property="id" jdbcType="BIGINT" />
        <result column="state" property="state" jdbcType="INTEGER" />
        <result column="info" property="info" jdbcType="VARCHAR" />
        <result column="biz_no" property="bizno" jdbcType="VARCHAR" />
        <result column="orderId" property="orderId" jdbcType="VARCHAR" />
        <result column="createtime" property="createtime" jdbcType="DATE" />
        <result column="ordertime" property="ordertime" jdbcType="VARCHAR" />
        <association property="extract" column="eid"
            resultMap="com.yeshi.fanli.dao.mybatis.ExtractMapper.BaseResultMap" />
    </resultMap>
    <sql id="Base_Column_List">id,eid,state,info,biz_no,orderId,createtime,ordertime</sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_payinfo where id = #{id,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_payinfo where id = #{id,jdbcType=BIGINT}</delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.PayInfo"
        useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_payinfo
        (id,eid,state,info,biz_no,orderId,createtime,ordertime) values
        (#{id,jdbcType=BIGINT},#{extract.id,jdbcType=BIGINT},#{state,jdbcType=INTEGER},#{info,jdbcType=VARCHAR},#{bizno,jdbcType=VARCHAR},#{orderId,jdbcType=VARCHAR},#{createtime,jdbcType=DATE},#{ordertime,jdbcType=VARCHAR})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.PayInfo"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_payinfo
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="extract != null">eid,</if>
            <if test="state != null">state,</if>
            <if test="info != null">info,</if>
            <if test="bizno != null">biz_no,</if>
            <if test="orderId != null">orderId,</if>
            <if test="createtime != null">createtime,</if>
            <if test="ordertime != null">ordertime,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="extract != null">#{extract.id,jdbcType=BIGINT},</if>
            <if test="state != null">#{state,jdbcType=INTEGER},</if>
            <if test="info != null">#{info,jdbcType=VARCHAR},</if>
            <if test="bizno != null">#{bizno,jdbcType=VARCHAR},</if>
            <if test="orderId != null">#{orderId,jdbcType=VARCHAR},</if>
            <if test="createtime != null">#{createtime,jdbcType=DATE},</if>
            <if test="ordertime != null">#{ordertime,jdbcType=VARCHAR},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.PayInfo">update
        yeshi_ec_payinfo set eid = #{extract.id,jdbcType=BIGINT},state =
        #{state,jdbcType=INTEGER},info = #{info,jdbcType=VARCHAR},biz_no =
        #{bizno,jdbcType=VARCHAR},orderId =
        #{orderId,jdbcType=VARCHAR},createtime =
        #{createtime,jdbcType=DATE},ordertime = #{ordertime,jdbcType=VARCHAR}
        where id = #{id,jdbcType=BIGINT}</update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.PayInfo">
        update yeshi_ec_payinfo
        <set>
            <if test="extract != null">eid=#{extract.id,jdbcType=BIGINT},</if>
            <if test="state != null">state=#{state,jdbcType=INTEGER},</if>
            <if test="info != null">info=#{info,jdbcType=VARCHAR},</if>
            <if test="bizno != null">biz_no=#{bizno,jdbcType=VARCHAR},</if>
            <if test="orderId != null">orderId=#{orderId,jdbcType=VARCHAR},</if>
            <if test="createtime != null">createtime=#{createtime,jdbcType=DATE},</if>
            <if test="ordertime != null">ordertime=#{ordertime,jdbcType=VARCHAR},</if>
        </set>
        where id = #{id,jdbcType=BIGINT}
    </update>
    
    <select id="getListbyExtractId" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_payinfo where state=1 AND eid = #{eid,jdbcType=BIGINT}
    </select>
    
    <select id="sumMoneyByUid" resultType="java.lang.Double" parameterType="java.lang.Long">
       <!--  统计个人提现成功金额  -->
         SELECT COALESCE(SUM(ex.`money`),0) FROM `yeshi_ec_payinfo` p 
             LEFT JOIN `yeshi_ec_extract` ex ON p.`eid`=ex.`id` 
         WHERE p.`state` = 1 AND ex.uid = #{uid}
    </select>
    
</mapper>