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
<?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.order.mapper.AccountMapper">
 
    <resultMap id="AccountMap" type="com.xzx.gc.model.user.AccountVo">
        <result column="account_id" jdbcType="VARCHAR" property="accountId"/>
        <result column="account_name" jdbcType="VARCHAR" property="accountName"/>
        <result column="user_id" jdbcType="VARCHAR" property="userId"/>
        <result column="pay_password" jdbcType="VARCHAR" property="payPassword"/>
        <result column="freeze_money" jdbcType="VARCHAR" property="freezeMoney"/>
        <result column="withdraw_money" jdbcType="VARCHAR" property="withdrawMoney"/>
        <result column="overdraft_limit" jdbcType="VARCHAR" property="overdraftLimit"/>
        <result column="lock_time" jdbcType="VARCHAR" property="lockTime"/>
        <result column="fixed_limit"  property="fixedLimit"/>
        <result column="adjust_flag"  property="adjustFlag"/>
    </resultMap>
 
    <!-- 回收员支付环保金  订单创建人入账 -->
    <update id="updateMyMoneyByOrder" parameterType="map">
        update xzx_account_info
        set money = cast((cast(money as DECIMAL(9,2))+#{money}) as CHAR),update_time=now()
        where user_id=#{userId} and del_flag=0 and is_prohibit='0'
    </update>
 
    <update id="updateMyScoreByOrder" parameterType="map">
        update xzx_account_info
        set collect_score = cast((cast(collect_score as DECIMAL(9,2))+#{money}) as CHAR),update_time=now()
        where user_id=#{userId} and del_flag=0 and is_prohibit='0'
    </update>
 
    <!-- 回收员的透支金额减少 -->
    <update id="updateLimitByOrder" parameterType="map">
        update xzx_account_info
        set overdraft_limit = cast((cast(overdraft_limit as DECIMAL(9,2))+#{money}) as CHAR),update_time=now()
        where user_id=#{userId} and del_flag=0 and is_prohibit='0'
    </update>
 
    <!-- 回收员的透支金额减少 -->
    <update id="updateMoneyAndLimit" parameterType="map">
        update xzx_account_info
        set money = cast((cast(money as DECIMAL(9,2))+#{money}) as CHAR),
        overdraft_limit = cast(#{limit} as CHAR),update_time=now()
        where user_id=#{userId} and del_flag=0 and is_prohibit='0'
    </update>
 
 
    <!-- 我的环保金 -->
    <select id="queryMyMoney" parameterType="map" resultMap="AccountMap">
        SELECT a.account_id,a.account_name,a.freeze_money,a.money,a.pay_password,
        a.withdraw_money,a.overdraft_limit,a.lock_time,a.fixed_limit,a.adjust_flag,a.user_id
        FROM xzx_account_info a
        where del_flag=0 and is_prohibit='0'
        <if test="userId!=null and userId!=''">
            and a.user_id=#{userId}
        </if>
    </select>
 
 
    <update id="updateAccountMoneyDouble">
        update `xzx_account_info` set money=#{money}
        where account_id=#{accountId}
    </update>
 
 
 
 
 
    <insert id="addCuserAccountRole">
        INSERT INTO xzx_account_info(`account_id`,`account_name`, `user_id`, `pay_password`, `money`, `freeze_money`,
                                     `withdraw_money`, `overdraft_limit`, `lock_time`,`fixed_limit`)
        VALUES (#{id}, #{phone}, #{userId}, NULL, '0', '0', '0', #{money}, NULL,#{money})
    </insert>
 
    <select id="getAccountByUserId" resultType="com.xzx.gc.model.admin.UserAccountModel">
        select *
        from xzx_account_info
        where user_id = #{userId} and del_flag = 0
    </select>
 
    <update id="updateUserAccount">
        update xzx_account_info set
        money=#{money}
 
        <if test="overdraftLimit != null and overdraftLimit != ''">
            ,  overdraft_limit=#{overdraftLimit}
        </if>
 
        where account_id=#{accountId}
    </update>
 
 
    <select id="selectAccountInfoByUserId" resultType="com.xzx.gc.entity.AccountInfo">
        select * from xzx_account_info where user_id=#{userId}
    </select>
</mapper>