Helius
2021-06-30 02b38bb7c08d68fffc6af25e4ba00a456d96e94e
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?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.user.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>
 
    <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>
 
  <select id="getPartnerAccountByUserId" resultType="com.xzx.gc.model.admin.PartnerAccountModel">
    select *
    from xzx_partner_account
    where user_id = #{userId} and del_flag = 0
  </select>
 
    <insert id="addPartnerAccountLog">
        INSERT INTO `xzx_partner_account_log` (`account_id`, `flow_no`, `type`, `create_time`,
                                               `money`, `account_money`, `hbb`, `user_name`, `user_phone`, `role_name`, `approver_status`, `del_flag`, `old_limit`, `manage_limit`, `new_limit`, `old_limit_fix`, `manage_limit_fix`, `new_limit_fix`)
        VALUES (#{accountId}, #{flowNo}, #{type}, #{createTime}, #{money},
                              #{accountMoney}, #{hbb}, #{userName}, #{userPhone}, #{roleName}, #{approverStatus},
                #{delFlag}, #{oldLimit}, #{manageLimit}, #{newLimit}, #{oldLimitFix}, #{manageLimitFix}, #{newLimitFix})
    </insert>
 
    <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>
 
    <delete id="deletePartnerAccount">
        update xzx_partner_account
        set del_flag = #{delFlag}
        where user_id = #{userId} and del_flag = 0
    </delete>
 
    <select id="queryAccountIdByUserId" resultType="com.xzx.gc.model.admin.PartnerAccountModel">
        select *
        from xzx_partner_account
        where user_id = #{userId} and del_flag = 0
        limit 1
    </select>
 
 
    <update id="updatePackageAccount">
        update xzx_partner_account
        set overdraft_limit = #{overdraftLimit}, fixed_limit = #{fixedLimit}
        where user_id = #{userId}
    </update>
 
    <select id="queryPartnerByAccountId" resultType="com.xzx.gc.model.admin.AccountMoneyModel">
        select * from  xzx_partner_account where account=#{accountId}
    </select>
 
    <update id="updateParterAccount">
        UPDATE xzx_partner_account
        SET
            hbb = #{money}
        WHERE account = #{accountId}
    </update>
 
    <select id="queryAccountIdByAccountId" resultType="com.xzx.gc.model.admin.PartnerAccountModel">
        select * from xzx_partner_account where account=#{account} and del_flag=0 limit 1
    </select>
 
    <insert id="addPartnerAccount">
        INSERT INTO xzx_partner_account (`user_id`, `account`, `hbb`, `del_flag`, `update_time`, `partner_id`, `overdraft_limit`, `fixed_limit`, `type`)
        VALUES (#{userId}, #{account}, '0', '0', #{updateTime}, #{partnerId}, '0', '0', #{type})
    </insert>
 
    <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="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>
</mapper>