zhangback
2025-11-14 c2e20ac680e03cb26cf7c00f573f0cb917afaece
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
<?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.TmsQuotePlanMapper">
 
    <resultMap type="com.ruoyi.tms.domain.TmsQuotePlan" id="TmsQuotePlanResult">
        <result property="id"    column="id"    />
        <result property="systemCode"    column="system_code"    />
        <result property="planName"    column="plan_name"    />
        <result property="customerId"    column="customer_id"    />
        <result property="customerName"    column="customer_name"    />
        <result property="projectId"    column="project_id"    />
        <result property="projectName"    column="project_name"    />
        <result property="contractId"    column="contract_id"    />
        <result property="contractName"    column="contract_name"    />
        <result property="effectiveDate"    column="effective_date"    />
        <result property="expiryDate"    column="expiry_date"    />
        <result property="status"    column="status"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
        <result property="planType"    column="plan_type"    />
    </resultMap>
 
    <sql id="selectTmsQuotePlanVo">
        select thisTab.id, thisTab.system_code, thisTab.plan_name, thisTab.customer_id, thisTab.customer_name, thisTab.project_id, thisTab.project_name, thisTab.contract_id, thisTab.contract_name, thisTab.effective_date, thisTab.expiry_date, thisTab.status, thisTab.create_by, thisTab.create_time, thisTab.update_by, thisTab.update_time, thisTab.remark, thisTab.plan_type from tms_quote_plan AS thisTab
    </sql>
    <sql id="selectTmsQuotePlanVoCount">
        select count(0) from tms_quote_plan as thisTab
    </sql>
 
    <sql id="whereCondition">
        <if test="systemCode != null  and systemCode != ''"> and thisTab.system_code = #{systemCode}</if>
        <if test="planName != null  and planName != ''"> and  thisTab.plan_name like concat('%', #{planName}, '%')</if>
        <if test="customerId != null "> and thisTab.customer_id = #{customerId}</if>
        <if test="customerName != null  and customerName != ''"> and  thisTab.customer_name like concat('%', #{customerName}, '%')</if>
        <if test="projectId != null "> and thisTab.project_id = #{projectId}</if>
        <if test="projectName != null  and projectName != ''"> and  thisTab.project_name like concat('%', #{projectName}, '%')</if>
        <if test="contractId != null "> and thisTab.contract_id = #{contractId}</if>
        <if test="contractName != null  and contractName != ''"> and  thisTab.contract_name like concat('%', #{contractName}, '%')</if>
        <if test="effectiveDate != null "> and thisTab.effective_date = #{effectiveDate}</if>
        <if test="expiryDate != null "> and thisTab.expiry_date = #{expiryDate}</if>
        <if test="status != null "> and thisTab.status = #{status}</if>
        <if test="planType != null "> and thisTab.plan_type = #{planType}</if>
    </sql>
 
    <!--查询-->
    <select id="selectTmsQuotePlanById" parameterType="Integer" resultMap="TmsQuotePlanResult">
        <include refid="selectTmsQuotePlanVo"/>
        where id = #{id}
    </select>
 
    <select id="selectTmsQuotePlanCount" parameterType="com.ruoyi.tms.domain.TmsQuotePlan" resultType="int">
        <include refid="selectTmsQuotePlanVoCount"/>
        <where>
            <include refid="whereCondition"/>
        </where>
    </select>
 
 
    <select id="selectTmsQuotePlanList" parameterType="com.ruoyi.tms.domain.TmsQuotePlan" resultMap="TmsQuotePlanResult">
        <include refid="selectTmsQuotePlanVo"/>
        <where>
            <include refid="whereCondition"/>
        </where>
        order by thisTab.id desc
    </select>
 
    <!-- 新增 -->
    <insert id="insertTmsQuotePlan" parameterType="com.ruoyi.tms.domain.TmsQuotePlan"  useGeneratedKeys="true" keyProperty="id">
        insert into tms_quote_plan
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="systemCode != null and systemCode != ''">system_code,</if>
            <if test="planName != null and planName != ''">plan_name,</if>
            <if test="customerId != null">customer_id,</if>
            <if test="customerName != null and customerName != ''">customer_name,</if>
            <if test="projectId != null">project_id,</if>
            <if test="projectName != null and projectName != ''">project_name,</if>
            <if test="contractId != null">contract_id,</if>
            <if test="contractName != null and contractName != ''">contract_name,</if>
            <if test="effectiveDate != null">effective_date,</if>
            <if test="expiryDate != null">expiry_date,</if>
            <if test="status != null">status,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
            <if test="planType != null">plan_type,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="systemCode != null and systemCode != ''">#{systemCode},</if>
            <if test="planName != null and planName != ''">#{planName},</if>
            <if test="customerId != null">#{customerId},</if>
            <if test="customerName != null and customerName != ''">#{customerName},</if>
            <if test="projectId != null">#{projectId},</if>
            <if test="projectName != null and projectName != ''">#{projectName},</if>
            <if test="contractId != null">#{contractId},</if>
            <if test="contractName != null and contractName != ''">#{contractName},</if>
            <if test="effectiveDate != null">#{effectiveDate},</if>
            <if test="expiryDate != null">#{expiryDate},</if>
            <if test="status != null">#{status},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
            <if test="planType != null">#{planType},</if>
        </trim>
    </insert>
 
    <insert id="insertTmsQuotePlanBatch" parameterType="java.util.List"  useGeneratedKeys="true" keyProperty="id">
        insert into tms_quote_plan
        <trim prefix="(" suffix=") values" suffixOverrides=",">
            id,system_code,plan_name,customer_id,customer_name,project_id,project_name,contract_id,contract_name,effective_date,expiry_date,status,create_by,create_time,update_by,update_time,remark,plan_type,
        </trim>
        <foreach item="item" index="index" collection="list" separator=",">
            <trim prefix="(" suffix=") " suffixOverrides=",">
                #{item.id},#{item.systemCode},#{item.planName},#{item.customerId},#{item.customerName},#{item.projectId},#{item.projectName},#{item.contractId},#{item.contractName},#{item.effectiveDate},#{item.expiryDate},#{item.status},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.remark},#{item.planType},
            </trim>
        </foreach>
    </insert>
 
    <!-- 修改 -->
    <update id="updateTmsQuotePlan" parameterType="com.ruoyi.tms.domain.TmsQuotePlan">
        update tms_quote_plan
        <trim prefix="SET" suffixOverrides=",">
            <if test="systemCode != null and systemCode != ''">system_code = #{systemCode},</if>
            <if test="planName != null and planName != ''">plan_name = #{planName},</if>
            <if test="customerId != null">customer_id = #{customerId},</if>
            <if test="customerName != null and customerName != ''">customer_name = #{customerName},</if>
            <if test="projectId != null">project_id = #{projectId},</if>
            <if test="projectName != null and projectName != ''">project_name = #{projectName},</if>
            <if test="contractId != null">contract_id = #{contractId},</if>
            <if test="contractName != null and contractName != ''">contract_name = #{contractName},</if>
            <if test="effectiveDate != null">effective_date = #{effectiveDate},</if>
            <if test="expiryDate != null">expiry_date = #{expiryDate},</if>
            <if test="status != null">status = #{status},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="planType != null">plan_type = #{planType},</if>
        </trim>
        where id = #{id}
    </update>
    <!-- 修改 -->
    <update id="updateTmsQuotePlanBatch" parameterType="java.util.List">
        <foreach collection="list" item="item" index="index" separator=";">
            update tms_quote_plan
            <trim prefix="SET" suffixOverrides=",">
                <if test="item.systemCode != null and item.systemCode != ''">system_code = #{item.systemCode},</if>
                <if test="item.planName != null and item.planName != ''">plan_name = #{item.planName},</if>
                <if test="item.customerId != null">customer_id = #{item.customerId},</if>
                <if test="item.customerName != null and item.customerName != ''">customer_name = #{item.customerName},</if>
                <if test="item.projectId != null">project_id = #{item.projectId},</if>
                <if test="item.projectName != null and item.projectName != ''">project_name = #{item.projectName},</if>
                <if test="item.contractId != null">contract_id = #{item.contractId},</if>
                <if test="item.contractName != null and item.contractName != ''">contract_name = #{item.contractName},</if>
                <if test="item.effectiveDate != null">effective_date = #{item.effectiveDate},</if>
                <if test="item.expiryDate != null">expiry_date = #{item.expiryDate},</if>
                <if test="item.status != null">status = #{item.status},</if>
                <if test="item.createBy != null">create_by = #{item.createBy},</if>
                <if test="item.createTime != null">create_time = #{item.createTime},</if>
                <if test="item.updateBy != null">update_by = #{item.updateBy},</if>
                <if test="item.updateTime != null">update_time = #{item.updateTime},</if>
                <if test="item.remark != null">remark = #{item.remark},</if>
                <if test="item.planType != null">plan_type = #{item.planType},</if>
            </trim>
            where id = #{item.id}
        </foreach>
    </update>
 
    <!--删除-->
    <delete id="deleteTmsQuotePlanById" parameterType="Integer">
        delete from tms_quote_plan where id = #{id}
    </delete>
    <delete id="deleteTmsQuotePlanByIds" parameterType="Integer">
        delete from tms_quote_plan where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
</mapper>