zj
2024-06-03 4afe73cb84c5a609662b8b4ee20693de9b86b9a3
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<?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.nq.dao.FundsTradingAccountMapper">
 
    <resultMap id="BaseResultMap" type="com.nq.pojo.FundsTradingAccount" >
        <result column="id" property="id" />
        <result column="dealer_institutions_id" property="dealerInstitutionsId" />
        <result column="dealer_institutions_name" property="dealerInstitutionsName" />
        <result column="account_name" property="accountName" />
        <result column="subaccount_number" property="subaccountNumber" />
        <result column="account_mode" property="accountMode" />
        <result column="automatic_unwind_switch" property="automaticUnwindSwitch" />
        <result column="ban_unwind_switch" property="banUnwindSwitch" />
        <result column="automatic_renewal_switch" property="automaticRenewalSwitch" />
        <result column="ban_levite" property="banLevite" />
        <result column="warning_line" property="warningLine" />
        <result column="unwind_line" property="unwindLine" />
        <result column="single_holding_ratio" property="singleHoldingRatio" />
        <result column="status" property="status" />
        <result column="add_time" property="addTime" />
        <result column="update_time" property="updateTime" />
        <result column="remarks" property="remarks" />
    </resultMap>
 
    <sql id="Base_Column_List">
                id,
                dealer_institutions_id,
                dealer_institutions_name,
                account_name,
                subaccount_number,
                account_mode,
                automatic_unwind_switch,
                ban_unwind_switch,
                automatic_renewal_switch,
                ban_levite,
                warning_line,
                unwind_line,
                single_holding_ratio,
                status,
                add_time,
                update_time,
                remarks
    </sql>
 
    <insert id="insert" useGeneratedKeys="true" keyColumn="id" keyProperty="id" parameterType="com.nq.pojo.FundsTradingAccount">
        INSERT INTO funds_trading_account
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test ='null != dealerInstitutionsId'>
                dealer_institutions_id,
            </if>
            <if test ='null != dealerInstitutionsName'>
                dealer_institutions_name,
            </if>
            <if test ='null != accountName'>
                account_name,
            </if>
            <if test ='null != subaccountNumber'>
                subaccount_number,
            </if>
            <if test ='null != accountMode'>
                account_mode,
            </if>
            <if test ='null != automaticUnwindSwitch'>
                automatic_unwind_switch,
            </if>
            <if test ='null != banUnwindSwitch'>
                ban_unwind_switch,
            </if>
            <if test ='null != automaticRenewalSwitch'>
                automatic_renewal_switch,
            </if>
            <if test ='null != banLevite'>
                ban_levite,
            </if>
            <if test ='null != warningLine'>
                warning_line,
            </if>
            <if test ='null != unwindLine'>
                unwind_line,
            </if>
            <if test ='null != singleHoldingRatio'>
                single_holding_ratio,
            </if>
            <if test ='null != status'>
                status,
            </if>
            <if test ='null != addTime'>
                add_time,
            </if>
            <if test ='null != updateTime'>
                update_time,
            </if>
            <if test ='null != remarks'>
                remarks
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test ='null != dealerInstitutionsId'>
                #{dealerInstitutionsId},
            </if>
            <if test ='null != dealerInstitutionsName'>
                #{dealerInstitutionsName},
            </if>
            <if test ='null != accountName'>
                #{accountName},
            </if>
            <if test ='null != subaccountNumber'>
                #{subaccountNumber},
            </if>
            <if test ='null != accountMode'>
                #{accountMode},
            </if>
            <if test ='null != automaticUnwindSwitch'>
                #{automaticUnwindSwitch},
            </if>
            <if test ='null != banUnwindSwitch'>
                #{banUnwindSwitch},
            </if>
            <if test ='null != automaticRenewalSwitch'>
                #{automaticRenewalSwitch},
            </if>
            <if test ='null != banLevite'>
                #{banLevite},
            </if>
            <if test ='null != warningLine'>
                #{warningLine},
            </if>
            <if test ='null != unwindLine'>
                #{unwindLine},
            </if>
            <if test ='null != singleHoldingRatio'>
                #{singleHoldingRatio},
            </if>
            <if test ='null != status'>
                #{status},
            </if>
            <if test ='null != addTime'>
                #{addTime},
            </if>
            <if test ='null != updateTime'>
                #{updateTime},
            </if>
            <if test ='null != remarks'>
                #{remarks}
            </if>
        </trim>
    </insert>
 
    <delete id="delete" >
        DELETE FROM funds_trading_account
        WHERE id = #{id}
    </delete>
 
    <update id="update" parameterType="com.nq.pojo.FundsTradingAccount">
        UPDATE funds_trading_account
        <set>
            <if test ='null != dealerInstitutionsId'>dealer_institutions_id = #{dealerInstitutionsId},</if>
            <if test ='null != dealerInstitutionsName'>dealer_institutions_name = #{dealerInstitutionsName},</if>
            <if test ='null != accountName'>account_name = #{accountName},</if>
            <if test ='null != subaccountNumber'>subaccount_number = #{subaccountNumber},</if>
            <if test ='null != accountMode'>account_mode = #{accountMode},</if>
            <if test ='null != automaticUnwindSwitch'>automatic_unwind_switch = #{automaticUnwindSwitch},</if>
            <if test ='null != banUnwindSwitch'>ban_unwind_switch = #{banUnwindSwitch},</if>
            <if test ='null != automaticRenewalSwitch'>automatic_renewal_switch = #{automaticRenewalSwitch},</if>
            <if test ='null != banLevite'>ban_levite = #{banLevite},</if>
            <if test ='null != warningLine'>warning_line = #{warningLine},</if>
            <if test ='null != unwindLine'>unwind_line = #{unwindLine},</if>
            <if test ='null != singleHoldingRatio'>single_holding_ratio = #{singleHoldingRatio},</if>
            <if test ='null != status'>status = #{status},</if>
            <if test ='null != addTime'>add_time = #{addTime},</if>
            <if test ='null != updateTime'>update_time = #{updateTime},</if>
            <if test ='null != remarks'>remarks = #{remarks}</if>
        </set>
        WHERE id = #{id}
    </update>
 
 
    <select id="load" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />
        FROM funds_trading_account
        WHERE id = #{id}
    </select>
 
    <select id="pageList" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />
        FROM funds_trading_account
        where 1=1
        <if test="keyword != null and keyword != ''">
            and  (CAST(subaccount_number AS CHAR) like CONCAT('%',#{keyword},'%') or dealer_institutions_name like CONCAT('%',#{keyword},'%') )
        </if>
        <if test="status != null">
            and status = #{status}
        </if>
        order by id desc
    </select>
 
    <select id="pageListCount" resultType="java.lang.Integer">
        SELECT count(1)
        FROM funds_trading_account
    </select>
 
    <!--查询最新交易账户编号-->
    <select id="getMaxNumber"  resultType="java.lang.Integer">
        SELECT ifnull(MAX(subaccount_number)+1,80000000) from funds_trading_account
    </select>
 
    <!--根据子账户编号查询详细信息-->
    <select id="getAccountByNumber" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />
        FROM funds_trading_account
        WHERE subaccount_number = #{subaccountNumber}
    </select>
 
</mapper>