zhangback
8 天以前 3974fad5d836431e417e99220cc07bb5b0aba331
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.ruoyi.tms.mapper.TmsQuoteItemMapper">
 
    <resultMap type="com.ruoyi.tms.domain.TmsQuoteItem" id="TmsQuoteItemResult">
        <result property="id"    column="id"    />
        <result property="quotePlanId"    column="quote_plan_id"    />
        <result property="freeName"    column="free_name"    />
        <result property="unit"    column="unit"    />
        <result property="price"    column="price"    />
        <result property="currency"    column="currency"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>
 
    <sql id="selectTmsQuoteItemVo">
        select thisTab.id, thisTab.quote_plan_id, thisTab.free_name, thisTab.unit, thisTab.price, thisTab.currency, thisTab.create_time, thisTab.update_time from tms_quote_item AS thisTab
    </sql>
    <sql id="selectTmsQuoteItemVoCount">
        select count(0) from tms_quote_item as thisTab
    </sql>
 
    <sql id="whereCondition">
        <if test="quotePlanId != null "> and thisTab.quote_plan_id = #{quotePlanId}</if>
        <if test="freeName != null  and freeName != ''"> and  thisTab.free_name like concat('%', #{freeName}, '%')</if>
        <if test="unit != null  and unit != ''"> and thisTab.unit = #{unit}</if>
        <if test="price != null "> and thisTab.price = #{price}</if>
        <if test="currency != null  and currency != ''"> and thisTab.currency = #{currency}</if>
 </sql>
 
    <!--查询-->
    <select id="selectTmsQuoteItemById" parameterType="Integer" resultMap="TmsQuoteItemResult">
        <include refid="selectTmsQuoteItemVo"/>
        where id = #{id}
    </select>
 
    <select id="selectTmsQuoteItemCount" parameterType="com.ruoyi.tms.domain.TmsQuoteItem" resultType="int">
        <include refid="selectTmsQuoteItemVoCount"/>
        <where>
            <include refid="whereCondition"/>
        </where>
    </select>
 
    <select id="selectTmsQuoteItemList" parameterType="com.ruoyi.tms.domain.TmsQuoteItem" resultMap="TmsQuoteItemResult">
        <include refid="selectTmsQuoteItemVo"/>
        <where>
            <include refid="whereCondition"/>
        </where>
        order by thisTab.id desc
    </select>
 
    <!-- 新增 -->
    <insert id="insertTmsQuoteItem" parameterType="com.ruoyi.tms.domain.TmsQuoteItem"  useGeneratedKeys="true" keyProperty="id">
        insert into tms_quote_item
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="quotePlanId != null">quote_plan_id,</if>
            <if test="freeName != null and freeName != ''">free_name,</if>
            <if test="unit != null">unit,</if>
            <if test="price != null">price,</if>
            <if test="currency != null">currency,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="quotePlanId != null">#{quotePlanId},</if>
            <if test="freeName != null and freeName != ''">#{freeName},</if>
            <if test="unit != null">#{unit},</if>
            <if test="price != null">#{price},</if>
            <if test="currency != null">#{currency},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
 
         </trim>
    </insert>
 
    <insert id="insertTmsQuoteItemBatch" parameterType="java.util.List"  useGeneratedKeys="true" keyProperty="id">
        insert into tms_quote_item
        <trim prefix="(" suffix=") values" suffixOverrides=",">
            id,quote_plan_id,free_name,unit,price,currency,
        </trim>
        <foreach item="item" index="index" collection="list" separator=",">
            <trim prefix="(" suffix=") " suffixOverrides=",">
                #{item.id},#{item.quotePlanId},#{item.freeName},#{item.unit},#{item.price},#{item.currency},
            </trim>
        </foreach>
    </insert>
 
    <!-- 修改 -->
    <update id="updateTmsQuoteItem" parameterType="com.ruoyi.tms.domain.TmsQuoteItem">
        update tms_quote_item
        <trim prefix="SET" suffixOverrides=",">
            <if test="quotePlanId != null">quote_plan_id = #{quotePlanId},</if>
            <if test="freeName != null and freeName != ''">free_name = #{freeName},</if>
            <if test="unit != null">unit = #{unit},</if>
            <if test="price != null">price = #{price},</if>
            <if test="currency != null">currency = #{currency},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>
    <!-- 修改 -->
    <update id="updateTmsQuoteItemBatch" parameterType="java.util.List">
        <foreach collection="list" item="item" index="index" separator=";">
            update tms_quote_item
            <trim prefix="SET" suffixOverrides=",">
                <if test="item.quotePlanId != null">quote_plan_id = #{item.quotePlanId},</if>
                <if test="item.freeName != null and item.freeName != ''">free_name = #{item.freeName},</if>
                <if test="item.unit != null">unit = #{item.unit},</if>
                <if test="item.price != null">price = #{item.price},</if>
                <if test="item.currency != null">currency = #{item.currency},</if>
                <if test="item.createTime != null">create_time = #{item.createTime},</if>
                <if test="item.updateTime != null">update_time = #{item.updateTime},</if>
            </trim>
        where id = #{item.id}
        </foreach>
    </update>
 
    <!--删除-->
    <delete id="deleteTmsQuoteItemById" parameterType="Integer">
        delete from tms_quote_item where id = #{id}
    </delete>
    <delete id="deleteTmsQuoteItemByIds" parameterType="Integer">
        delete from tms_quote_item where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
</mapper>