Helius
2021-06-16 4e51778362c2130598a4c73ec4cebe6629dbc53f
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
91
92
93
94
95
96
97
98
99
100
<?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.xzx.gc.pay.mapper.PartnerAccountMapper">
  <resultMap id="BaseResultMap" type="com.xzx.gc.entity.PartnerAccount">
    <!--
      WARNING - @mbg.generated
    -->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="user_id" jdbcType="VARCHAR" property="userId" />
    <result column="account" jdbcType="VARCHAR" property="account" />
    <result column="hbb" jdbcType="VARCHAR" property="hbb" />
    <result column="del_flag"  property="delFlag" />
    <result column="update_time" jdbcType="VARCHAR" property="updateTime" />
    <result column="partner_id" jdbcType="VARCHAR" property="partnerId" />
  </resultMap>
 
    <select id="getPartnerAccountByUserId"   resultType="com.xzx.gc.model.admin.PartnerAccountModel">
        select * from xzx_partner_account where user_id=#{userId} and del_flag=0
    </select>
 
  <update id="updatePartnerAccount">
    update xzx_partner_account set
    hbb=#{hbb}
    <if test="overdraftLimit != null and overdraftLimit != ''">
      , overdraft_limit=#{overdraftLimit}
    </if>
    where user_id=#{userId}
  </update>
 
  <update id="updateParterAccountMoney">
    UPDATE xzx_partner_account
    SET
      hbb = #{money}
    WHERE account = #{accountId}
  </update>
 
    <select id="queryPartnerByAccountId" resultType="com.xzx.gc.model.admin.AccountMoneyModel">
        select * from  xzx_partner_account where account=#{accountId}
    </select>
 
  <update id="updateReduceMoneyLimitByAccountId">
    update xzx_partner_account
    <trim prefix="set" suffixOverrides=",">
      <if test="money != null">
        hbb=cast(hbb as decimal(9,2))-#{money},
      </if>
      <if test="overdraftLimit != null">
        overdraft_limit=cast(overdraft_limit as decimal(9,2))-#{overdraftLimit} ,
      </if>
    </trim>
    where  account=#{accountId} and del_flag=0
  </update>
 
  <update id="updateReduceMoneyResetLimitByAccountId">
    update xzx_partner_account set overdraft_limit='0.00'
    <if test="money != null">
      ,hbb=cast(hbb as decimal(9,2))-#{money}
    </if>
    where  account=#{accountId} and del_flag=0
  </update>
 
 
  <update id="updateReduceMoneyByAccountId">
    update xzx_partner_account set hbb=cast(hbb as decimal(9,2))-#{money}
    where  account=#{accountId} and del_flag=0
  </update>
 
  <update id="updateReduceMoneyByPartnerId">
    update xzx_partner_account set hbb=cast(hbb as decimal(9,2))-#{money}
    where  partner_id=#{partnerId}  and del_flag=0
  </update>
 
    <update id="updateAddMoneyLimitByAccountId">
        update xzx_partner_account
        <trim prefix="set" suffixOverrides=",">
            <if test="money != null">
                hbb=cast(hbb as decimal(9,2))+#{money},
            </if>
            <if test="overdraftLimit != null">
                overdraft_limit=cast(overdraft_limit as decimal(9,2))+#{overdraftLimit},
            </if>
        </trim>
        where  account=#{accountId} and del_flag=0
    </update>
 
    <update id="updateAddMoneyResetFixLimitByAccountId">
        update xzx_partner_account set overdraft_limit=#{overdraftLimit}
        <if test="money != null">
            ,hbb=cast(hbb as decimal(9,2))+#{money}
        </if>
        where  account=#{accountId} and del_flag=0
    </update>
 
    <update id="updateAddMoneyByPartnerId">
        update xzx_partner_account set hbb=cast(hbb as decimal(9,2))+#{money}
        where  partner_id=#{partnerId} and del_flag=0
    </update>
 
 
</mapper>