zj
2024-06-03 a15e4f9fa2c34c4f4bd69f924c77e72a4c80e5ec
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
<?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.FundsLeverMapper">
 
    <resultMap id="BaseResultMap" type="com.nq.pojo.FundsLever" >
        <result column="id" property="id" />
        <result column="cycle_type" property="cycleType" />
        <result column="lever" property="lever" />
        <result column="manage_rate" property="manageRate" />
        <result column="single_holding_ratio" property="singleHoldingRatio" />
        <result column="status" property="status" />
        <result column="add_time" property="addTime" />
        <result column="update_time" property="updateTime" />
    </resultMap>
 
    <sql id="Base_Column_List">
                id,
                cycle_type,
                lever,
                manage_rate,
                single_holding_ratio,
                status,
                add_time,
                update_time
    </sql>
 
    <insert id="insert" useGeneratedKeys="true" keyColumn="id" keyProperty="id" parameterType="com.nq.pojo.FundsLever">
        INSERT INTO funds_lever
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test ='null != cycleType'>
                cycle_type,
            </if>
            <if test ='null != lever'>
                lever,
            </if>
            <if test ='null != manageRate'>
                manage_rate,
            </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>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test ='null != cycleType'>
                #{cycleType},
            </if>
            <if test ='null != lever'>
                #{lever},
            </if>
            <if test ='null != manageRate'>
                #{manageRate},
            </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>
        </trim>
    </insert>
 
    <delete id="delete" >
        DELETE FROM funds_lever
        WHERE id = #{id}
    </delete>
 
    <update id="update" parameterType="com.nq.pojo.FundsLever">
        UPDATE funds_lever
        <set>
            <if test ='null != cycleType'>cycle_type = #{cycleType},</if>
            <if test ='null != lever'>lever = #{lever},</if>
            <if test ='null != manageRate'>manage_rate = #{manageRate},</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>
        </set>
        WHERE id = #{id}
    </update>
 
 
    <select id="load" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />
        FROM funds_lever
        WHERE id = #{id}
    </select>
 
    <select id="pageList" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />
        FROM funds_lever
        order by cycle_type asc,lever asc
    </select>
 
    <select id="pageListCount" resultType="java.lang.Integer">
        SELECT count(1)
        FROM funds_lever
    </select>
 
    <!--查询配资类型杠杆-->
    <select id="getFundsTypeList" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />
        FROM funds_lever
        where status =1
        and cycle_type = #{cycleType}
        order by cycle_type asc,lever asc
    </select>
 
    <!--查询杠杆费率-->
    <select id="getLeverRateInfo" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />
        FROM funds_lever
        WHERE lever = #{lever} and cycle_type = #{cycleType}
        limit 1
    </select>
 
</mapper>