P15GEN2\59518
2025-10-10 9f6890646993d16260d4201d613c092132856127
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
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sql PUBLIC "sqllist" "sqllist.dtd" >
 
<sqllist>
    <dataSpace name="dataio-load">
 
        <sql name="getIOTasks">
            <![CDATA[
            select distinct task_name from sys_io
            order by task_name asc;
            ]]>
        </sql>
 
        <sql name="getIOTaskLastUpdateTime">
            <![CDATA[
            select max(last_update_time) from sys_io
            where task_name = '@{taskName}'
            ]]>
        </sql>
 
        <sql name="getIOMappingsLastUpdateTime">
            <![CDATA[
            select max(last_update_time) from sys_io_mapping_field
            where parent_id = '@{mappingId}'
            ]]>
        </sql>
 
        <sql name="getMappingListByParentId">
            <![CDATA[
            select max(last_update_time) from sys_io_mapping_field
            where parent_id = '@{mappingId}';
            ]]>
        </sql>
 
        <sql name="getDataIOTemplate">
            <![CDATA[
            select * from sys_dataio_template
            order by groupCode, stageCode asc, orderno asc;
            ]]>
        </sql>
 
        <sql name="getIOList">
            <![CDATA[
            select * from sys_dataio
            order by groupCode, stageCode asc, orderno asc;
            ]]>
        </sql>
 
        <sql name="getIOListByDataName">
            <![CDATA[
            select * from sys_dataio
            where dataName = '@{dataName}'
            order by stageCode asc, orderno asc;
            ]]>
        </sql>
 
        <sql name="getMappingSetList">
            <![CDATA[
            select * from sys_io_mapping;
            ]]>
        </sql>
 
        <sql name="getOneMappingSet">
            <![CDATA[
            select * from sys_io_mapping where id = '@{id}' ;
            ]]>
        </sql>
 
        <sql name="getIOWorkflowByParentId">
            <![CDATA[
            select *, sys_io_action.id as actionId from sys_io_workflow
            left join sys_io_action on sys_io_action.name = sys_io_workflow.action_name
            where sys_io_workflow.parent_id = '@{parent_id}'
            order by order_no asc;
            ]]>
        </sql>
 
        <sql name="getIOWorkflowByName">
            <![CDATA[
            select *, sys_io_action.id as actionId from sys_io_workflow
            left join sys_io_action on sys_io_action.name = sys_io_workflow.action_name
            where sys_io_workflow.workflow_name = '@{workflow_name}'
            order by order_no asc;
            ]]>
        </sql>
 
    </dataSpace>
 
    <dataSpace name="dataio-exec">
 
        <sql name="getBatchCount">
            select count(1) from @{fromTable} where @{dynamicFilter} @{orderBy}
        </sql>
 
        <sql name="batchSelectFromTable">
            select @{selectFromFieldNames} from @{fromTable} where @{dynamicFilter} @{orderBy}
        </sql>
 
        <sql name="dropToTableIfExists">
            <![CDATA[
            DROP TABLE IF EXISTS @{toTable};
            ]]>
        </sql>
        <sql name="checkTableExists">
            <![CDATA[
            SELECT COUNT(*) as table_exists FROM information_schema.tables WHERE table_name = '@{table_name}';
            ]]>
        </sql>
 
        <sql name="getTableFieldMeta">
            <![CDATA[
            SELECT COLUMN_name as field_name, DATA_type as field_type,
            ifnull(CHARACTER_MAXIMUM_LENGTH, concat(numeric_precision, ',', numeric_scale)) field_length
            FROM information_schema.columns WHERE table_name = '@{table_name}' and table_schema = '@{schema}';
            ]]>
        </sql>
 
        <sql name="addField">
            ALTER TABLE  @{table_name}
            @{fieldSegment}
        </sql>
 
        <sql name="modifyField">
            ALTER TABLE  @{table_name}
            @{fieldSegment}
        </sql>
 
        <sql name="deleteField">
            ALTER TABLE  @{table_name}
             @{fieldSegment}
        </sql>
 
        <sql name="createToTable">
            <![CDATA[
            CREATE TABLE @{toTable} (
                @{toFieldCreateMetas}
            );
            ]]>
        </sql>
 
        <sql name="getFieldMappingSetNoData">
            <![CDATA[
            select * from sys_mappingset where 1 <> 1
            ]]>
        </sql>
 
        <sql name="getFieldMappingNoData">
            <![CDATA[
            select * from sys_mapping where 1 <> 1
            ]]>
        </sql>
 
        <sql name="getFieldDisplayNoData">
            <![CDATA[
            select * from sys_field where 1 <> 1
            ]]>
        </sql>
 
        <sql name="emptyToTable">
          <![CDATA[
              truncate table @{toTable}
          ]]>
        </sql>
 
        <sql name="deleteToTableByFilter">
            delete from @{toTable} where @{filterFieldValues}
        </sql>
 
        <sql name="transferAll">
            <![CDATA[
                insert into @{toTable} (@{insertToFieldNames})
                select @{insertFromFieldNames} from @{fromTable}
                where io_batch_id = '@{ioBatchId}'
            ]]>
        </sql>
 
        <sql name="transferTempAll">
            <![CDATA[
                insert into @{toTable} (@{insertToFieldNames})
                select @{insertFromToTempFieldNames} from @{toTempTable}
                where io_batch_id = '@{ioBatchId}'
            ]]>
        </sql>
 
        <sql name="hardDeleteToTableNotExists">
            <![CDATA[
                delete from @{toTable} where not exists (
                    select 1 from @{fromTable} where @{keyFieldPairs}
                ) and @{filterFieldValues}
            ]]>
        </sql>
 
        <sql name="softDeleteToTableNotExists">
            <![CDATA[
                update @{toTable} set delflag = 'T' where not exists (
                    select 1 from @{fromTable} where @{keyFieldPairs}
                ) and @{filterFieldValues}
            ]]>
        </sql>
 
        <sql name="updateToTableExists">
            <![CDATA[
                update @{toTable} inner join @{fromTable} on @{keyFieldPairs}
                set @{updateFieldPairs}
            ]]>
        </sql>
 
        <sql name="insertToTableAppend">
            <![CDATA[
                insert into @{toTable} (@{insertToFieldNames})
                select @{insertFromFieldNames} from @{fromTable} where not exists (
                    select 1 from @{toTable} where @{keyFieldPairs}
                )
            ]]>
        </sql>
 
    </dataSpace>
 
</sqllist>