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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
| <?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="prvncFtpFileDAOImpl">
| <insert id="insertFileData2Table" parameterType="String">
| $value$
| </insert>
| <insert id="insertFileData2TableFailed" parameterType="String">
| $value$
| </insert>
|
| <select id="calltaskfunction" parameterType="Map">
| { call ${functionname}()}
| </select>
|
| <!--
|
| <select id="calltaskfunctionwithparam" parameterMap="Map">
| { call ${functionname}(?,?)}
| </select>
| -->
|
| <insert id="addFtpItem" parameterType="Map">
| insert into saop_ftp_task(taskid,
| taskname,
| file_name,
| u_or_d,
| tnum,
| taskcron,
| errphone,
| fileseq,
| upnull,
| preflag,
| prefunction,
| afterflag,
| afterfunction,
| deal_class)
| values(#{taskId},
| #{taskName},
| #{fileName},
| #{uOrD},
| #{tNum},
| #{taskCron},
| #{errPhone},
| #{fileSeq},
| #{upNull},
| #{preFlag},
| #{preFunction},
| #{afterFlag},
| #{afterFunction},
| #{dealClass}
| )
| </insert>
|
|
|
| <select id="queryTaskDetailInfo" parameterType="long"
| resultType="Map">
| select * from CEP_FTP_TASKDETAIL
| where detailid=#{value}
| </select>
| <select id="queryFtpUserInfo" parameterType="long" resultType="Map">
| select ftp_userid,machine_id,username,pwd,ip,port,
| state,
| to_char(update_date,'yyyy-mm-dd hh24:mi:ss') updatedate,
| to_char(create_date,'yyyy-mm-dd hh24:mi:ss') createdate,
| remark
| from CEP_FTP_TASKUSER
| where ftp_userid=#{value}
| </select>
|
|
| <select id="execConfigSql" parameterType="String" resultType="String">
| $value$
| </select>
|
|
| <select id="queryFtpItemsCount" parameterType="Map"
| resultType="Integer">
| SELECT count(1)
| FROM SAOP_FTP_TASK A
| WHERE A.STATE = 'A'
|
| </select>
| <!-- 查询文件下载上传列表(配置项) -->
| <select id="queryFtpItems" parameterType="Map" resultType="Map">
| <![CDATA[
| select * from (
| SELECT rownum as rn,A.TASKID,
| A.TASKNAME,
| A.FILE_NAME,
| A.U_OR_D,
| A.RUN_STATE,
| A.RUN_FLAG,
| A.TNUM,
| A.TASKCRON,
| A.ERRPHONE,
| A.FILESEQ,
| A.UPNULL,
| A.PREFLAG,
| A.PREFUNCTION,
| A.AFTERFLAG,
| A.AFTERFUNCTION,
| A.DEAL_CLASS,
| A.CREATE_DATE
| FROM SAOP_FTP_TASK A
| WHERE A.STATE = 'A') A1
| where A1.rn > ((TO_NUMBER(#{curPage}) -1) * TO_NUMBER(#{pageSize})) AND A1.rn <= (TO_NUMBER(#{curPage}) * TO_NUMBER(#{pageSize}))
| ]]>
| </select>
| <select id="newCreateTaskId" resultType="long">
| <![CDATA[
| SELECT seq_cep_taskid.NEXTVAL AS taskId from dual
| ]]>
| </select>
|
| <!-- 根据taskId 查询FtpItem 信息 -->
| <select id="queryFtpItemByTaskId" parameterType="Map"
| resultType="Map">
| SELECT A.TASKID,
| A.TASKNAME,
| A.FILE_NAME,
| A.U_OR_D,
| A.RUN_STATE,
| A.RUN_FLAG,
| A.TNUM,
| A.TASKCRON,
| A.ERRPHONE,
| A.FILESEQ,
| A.UPNULL,
| A.PREFLAG,
| A.PREFUNCTION,
| A.AFTERFLAG,
| A.AFTERFUNCTION,
| A.DEAL_CLASS,
| A.CREATE_DATE
| FROM SAOP_FTP_TASK A
| WHERE A.STATE = 'A'
| and A.TASKID = #{taskId}
| </select>
| <!-- 根据任务名称搜素 -->
| <select id="searchFtpItemByTaskName" parameterType="Map"
| resultType="Map">
| <![CDATA[
| SELECT A.TASKID,
| A.TASKNAME,
| A.FILE_NAME,
| A.U_OR_D,
| A.RUN_STATE,
| A.RUN_FLAG,
| A.TNUM,
| A.TASKCRON,
| A.ERRPHONE,
| A.FILESEQ,
| A.UPNULL,
| A.PREFLAG,
| A.PREFUNCTION,
| A.AFTERFLAG,
| A.AFTERFUNCTION,
| A.DEAL_CLASS,
| A.CREATE_DATE
| FROM SAOP_FTP_TASK A
| WHERE A.STATE = 'A'
| and A.TASKNAME like '%' || #{taskName} || '%'
| and rownum < 1000
| ]]>
| </select>
| <!-- 修改ftp配置信息 -->
| <update id="updateFtpItemByTaskId" parameterType="Map">
| update saop_ftp_task sft
| set update_date = sysdate
| <if test="taskName !=null and taskName != ''">,sft.taskname = #{taskName}
| </if>
| <if test="fileName !=null and fileName != ''">,sft.file_name = #{fileName}
| </if>
| <if test="uOrD !=null and uOrD != ''">,sft.u_or_d = #{uOrD}</if>
| <if test="runState !=null and runState != ''">,sft.run_state = #{runState}
| </if>
| <if test="runFlag !=null and runFlag != ''">,sft.run_flag = #{runFlag}</if>
| <if test="tNum !=null and tNum != ''">,sft.tnum = #{tNum}</if>
| <if test="taskCron !=null and taskCron != ''">,sft.taskcron = #{taskCron}
| </if>
| <if test="errPhone !=null and errPhone != ''">,sft.errphone = #{errPhone}
| </if>
| <if test="fileSeq !=null and fileSeq != ''">,sft.fileseq = #{fileSeq}</if>
| <if test="upNull !=null and upNull != ''">,sft.upnull = #{upNull}</if>
| <if test="preFlag !=null and preFlag != ''">,sft.preflag = #{preFlag}</if>
| <if test="preFunction !=null and preFunction != ''">,sft.prefunction = #{preFunction}
| </if>
| <if test="afterFlag !=null and afterFlag != ''">,sft.afterflag = #{afterFlag} </if>
| <if test="afterFunction !=null and afterFunction != ''">,sft.afterfunction = #{afterFunction}
| </if>
| <if test="dealClass !=null and dealClass != ''">,sft.deal_class = #{dealClass}
| </if>
| where sft.state = 'A'
| and sft.taskid = #{taskId}
| </update>
|
| <!-- 修改ftp配置信息 -->
| <update id="updateFtpItemRunState" parameterType="Map">
| update
| saop_ftp_task sft
| set update_date = sysdate,sft.run_state= #{runState}
| where sft.run_state = #{oldRunState}
| </update>
|
| <!-- 删除ftp配置信息 -->
| <update id="deleteFtpItemByTaskId" parameterType="Map">
| update
| saop_ftp_task sft
| set sft.state = 'R'
| where sft.state = 'A'
| and sft.taskid in
| <foreach collection="taskIds" open="(" close=")"
| separator="," item="item">
| #{item}
| </foreach>
| </update>
| <!-- 根据taskids 获取将要操作的ftp配置信息 -->
| <select id="queryFtpItemsByTaskIds" parameterType="Map" resultType="Map">
| SELECT
| A.TASKID,
| A.TASKNAME,
| A.FILE_NAME,
| A.U_OR_D,
| A.RUN_STATE,
| A.RUN_FLAG,
| A.TNUM,
| A.TASKCRON,
| A.ERRPHONE,
| A.FILESEQ,
| A.UPNULL,
| A.PREFLAG,
| A.PREFUNCTION,
| A.AFTERFLAG,
| A.AFTERFUNCTION,
| A.DEAL_CLASS
| FROM SAOP_FTP_TASK A
| WHERE A.STATE = 'A'
| AND A.TASKID in
| <foreach open="(" close=")"
| separator="," collection="taskIds" item="item">
| #{item}
| </foreach>
| </select>
| <!-- 查询FTPItem的属性信息 -->
| <select id="queryFtpItemAttrsByTaskId" parameterType="Map"
| resultType="Map">
| SELECT A.TASKID, A.ITEM_SPEC_ID, A.VALUE
| FROM SAOP_FTP_TASK_ATTR A
| WHERE A.TASKID = #{taskId}
| </select>
| <!-- 保存FTPItem的属性信息 -->
| <insert id="addFtpItemAttrs" parameterType="Map">
| insert into
| SAOP_FTP_TASK_ATTR(taskid,item_spec_id,value)
| values(#{taskId},#{itemSpecId},#{value})
| </insert>
| <!-- 查询没有下载过的文件名 -->
| <select id="queryFileNamesWithOutFtpLog" parameterType="Map"
| resultType="Map">
| <![CDATA[
| SELECT #{fileNames} AS fileNames FROM DUAL
| where #{fileNames} not in
| (select sfl.file_name from saop_ftp_log sfl where sfl.taskId = #{taskId})
| ]]>
| </select>
|
| <insert id="addDownloadFileName" parameterType="Map">
| <selectKey keyProperty="logid" resultType="long">
| <![CDATA[
| SELECT seq_cep_taskid.NEXTVAL AS logid from dual
| ]]>
| </selectKey>
| insert into saop_ftp_log(
| log_id,
| taskid,
| file_name,
| tfs_file_name
| )
| values(
| #{logid},
| #{taskId},
| #{fileName},
| #{tfsFileName}
| )
| </insert>
|
|
| <select id="queryItemSpec" parameterType="Map" resultType="Map">
| select a.item_spec_cd, a.domain, a.name, a.describe, a.create_date
| from saop_ftp_item_spec a
| where a.status_cd = '0'
| <if test="domain != null and domain !='' "> and a.domain = #{domain}</if>
| <if test="name != null and name !='' "> and a.name = #{name}</if>
| <if test="itemSpecCd != null and itemSpecCd !='' "> and a.item_spec_cd = #{itemSpecCd}
| </if>
| </select>
|
| </mapper>
|
|