吉安感知网项目-后端
linwei
2026-02-05 08d4bb2bf4bfadc9ab5fcf6b0a2bfb543d22b2a0
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
<?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="org.sxkj.gd.orderdata.mapper.GdSupplyDemandMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="gdSupplyDemandResultMap" type="org.sxkj.gd.orderdata.entity.GdSupplyDemandEntity">
        <result column="id" property="id"/>
        <result column="demand_name" property="demandName"/>
        <result column="demand_type" property="demandType"/>
        <result column="contact_person" property="contactPerson"/>
        <result column="contact_phone" property="contactPhone"/>
        <result column="contact_email" property="contactEmail"/>
        <result column="demand_status" property="demandStatus"/>
        <result column="update_cycle" property="updateCycle"/>
        <result column="apply_basis" property="applyBasis"/>
        <result column="share_type" property="shareType"/>
        <result column="application_scene" property="applicationScene"/>
        <result column="responsible_dept_id" property="responsibleDeptId"/>
        <result column="apply_target_dept_id" property="applyTargetDeptId"/>
        <result column="data_source" property="dataSource"/>
        <result column="demand_info" property="demandInfo"/>
        <result column="area_code" property="areaCode"/>
        <result column="create_user" property="createUser"/>
        <result column="create_dept" property="createDept"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="status" property="status"/>
        <result column="is_deleted" property="isDeleted"/>
    </resultMap>
 
    <resultMap id="gdSupplyDemandVOResultMap" type="org.sxkj.gd.orderdata.vo.GdSupplyDemandVO" extends="gdSupplyDemandResultMap"/>
 
    <sql id="gdSupplyDemandCondition">
        <if test="param.id != null">
            AND id = #{param.id}
        </if>
        <if test="param.demandName != null and param.demandName != ''">
            AND demand_name = #{param.demandName}
        </if>
        <if test="param.demandType != null and param.demandType != ''">
            AND demand_type = #{param.demandType}
        </if>
        <if test="param.contactPerson != null and param.contactPerson != ''">
            AND contact_person = #{param.contactPerson}
        </if>
        <if test="param.contactPhone != null and param.contactPhone != ''">
            AND contact_phone = #{param.contactPhone}
        </if>
        <if test="param.contactEmail != null and param.contactEmail != ''">
            AND contact_email = #{param.contactEmail}
        </if>
        <if test="param.demandStatus != null and param.demandStatus != ''">
            AND demand_status = #{param.demandStatus}
        </if>
        <if test="param.updateCycle != null and param.updateCycle != ''">
            AND update_cycle = #{param.updateCycle}
        </if>
        <if test="param.applyBasis != null and param.applyBasis != ''">
            AND apply_basis = #{param.applyBasis}
        </if>
        <if test="param.shareType != null and param.shareType != ''">
            AND share_type = #{param.shareType}
        </if>
        <if test="param.applicationScene != null and param.applicationScene != ''">
            AND application_scene = #{param.applicationScene}
        </if>
        <if test="param.responsibleDeptId != null and param.responsibleDeptId != ''">
            AND responsible_dept_id = #{param.responsibleDeptId}
        </if>
        <if test="param.applyTargetDeptId != null and param.applyTargetDeptId != ''">
            AND apply_target_dept_id = #{param.applyTargetDeptId}
        </if>
        <if test="param.dataSource != null and param.dataSource != ''">
            AND data_source = #{param.dataSource}
        </if>
        <if test="param.demandInfo != null and param.demandInfo != ''">
            AND demand_info = #{param.demandInfo}
        </if>
        <if test="param.areaCode != null and param.areaCode != ''">
            AND area_code = #{param.areaCode}
        </if>
        <if test="param.createUser != null">
            AND create_user = #{param.createUser}
        </if>
        <if test="param.createDept != null">
            AND create_dept = #{param.createDept}
        </if>
        <if test="param.createTime != null">
            AND create_time = #{param.createTime}
        </if>
        <if test="param.updateUser != null">
            AND update_user = #{param.updateUser}
        </if>
        <if test="param.updateTime != null">
            AND update_time = #{param.updateTime}
        </if>
        <if test="param.status != null and param.status != ''">
            AND status = #{param.status}
        </if>
    </sql>
 
    <select id="selectGdSupplyDemandList" resultMap="gdSupplyDemandResultMap">
        select * from ja_gd_supply_demand
        <where>
            is_deleted = 0
            <include refid="gdSupplyDemandCondition"/>
        </where>
    </select>
 
    <select id="selectGdSupplyDemandDetail" resultMap="gdSupplyDemandResultMap">
        select * from ja_gd_supply_demand
        <where>
            is_deleted = 0
            <include refid="gdSupplyDemandCondition"/>
            <if test="deptIdList != null and deptIdList.size > 0">
                AND (
                    create_dept IN
                    <foreach collection="deptIdList" item="deptId" open="(" separator="," close=")">
                        #{deptId}
                    </foreach>
                    OR apply_target_dept_id IN
                    <foreach collection="deptIdList" item="deptId" open="(" separator="," close=")">
                        #{deptId}
                    </foreach>
                )
            </if>
        </where>
        limit 1
    </select>
 
    <select id="selectGdSupplyDemandPage" resultMap="gdSupplyDemandVOResultMap">
        select * from ja_gd_supply_demand
        <where>
            is_deleted = 0
            <if test="param.demandName != null and param.demandName != ''">
                AND demand_name LIKE CONCAT('%', #{param.demandName}, '%')
            </if>
            <if test="param.demandStatus != null and param.demandStatus != ''">
                AND demand_status = #{param.demandStatus}
            </if>
            <if test="param.deptList != null and param.deptList.size > 0">
                AND (
                    create_dept IN
                    <foreach collection="param.deptList" item="deptId" open="(" separator="," close=")">
                        #{deptId}
                    </foreach>
                    OR apply_target_dept_id IN
                    <foreach collection="param.deptList" item="deptId" open="(" separator="," close=")">
                        #{deptId}
                    </foreach>
                )
            </if>
        </where>
    </select>
 
    <insert id="insertGdSupplyDemand" useGeneratedKeys="true" keyProperty="id">
        insert into ja_gd_supply_demand (
            demand_name,
            demand_type,
            contact_person,
            contact_phone,
            contact_email,
            demand_status,
            update_cycle,
            apply_basis,
            share_type,
            application_scene,
            responsible_dept_id,
            apply_target_dept_id,
            data_source,
            demand_info,
            area_code,
            create_user,
            create_dept,
            update_user
        ) values (
            #{demandName},
            #{demandType},
            #{contactPerson},
            #{contactPhone},
            #{contactEmail},
            #{demandStatus},
            #{updateCycle},
            #{applyBasis},
            #{shareType},
            #{applicationScene},
            #{responsibleDeptId},
            #{applyTargetDeptId},
            #{dataSource},
            #{demandInfo},
            #{areaCode},
            #{createUser},
            #{createDept},
            #{updateUser}
        )
    </insert>
 
    <update id="updateGdSupplyDemand">
        update ja_gd_supply_demand
        <set>
            <if test="demandName != null">
                demand_name = #{demandName},
            </if>
            <if test="demandType != null">
                demand_type = #{demandType},
            </if>
            <if test="contactPerson != null">
                contact_person = #{contactPerson},
            </if>
            <if test="contactPhone != null">
                contact_phone = #{contactPhone},
            </if>
            <if test="contactEmail != null">
                contact_email = #{contactEmail},
            </if>
            <if test="demandStatus != null">
                demand_status = #{demandStatus},
            </if>
            <if test="updateCycle != null">
                update_cycle = #{updateCycle},
            </if>
            <if test="applyBasis != null">
                apply_basis = #{applyBasis},
            </if>
            <if test="shareType != null">
                share_type = #{shareType},
            </if>
            <if test="applicationScene != null">
                application_scene = #{applicationScene},
            </if>
            <if test="responsibleDeptId != null">
                responsible_dept_id = #{responsibleDeptId},
            </if>
            <if test="applyTargetDeptId != null">
                apply_target_dept_id = #{applyTargetDeptId},
            </if>
            <if test="dataSource != null">
                data_source = #{dataSource},
            </if>
            <if test="demandInfo != null">
                demand_info = #{demandInfo},
            </if>
            <if test="areaCode != null">
                area_code = #{areaCode},
            </if>
            <if test="updateUser != null">
                update_user = #{updateUser},
            </if>
            <if test="status != null">
                status = #{status},
            </if>
        </set>
        where id = #{id}
    </update>
 
    <select id="exportGdSupplyDemand" resultType="org.sxkj.gd.orderdata.excel.GdSupplyDemandExcel">
        SELECT * FROM ja_gd_supply_demand ${ew.customSqlSegment}
    </select>
 
</mapper>