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
<?xml version="1.0" encoding="UTF-8" ?>
    
<sqls>
    <dataSpace name="help">
 
        <sql name="setDirectionFieldLabel">
            update help_direction_field set label = (
                select max(label_chinese) from sys_data_property 
                where sys_data_property.dataname = lower(help_direction_field.table_id)
                    and lower(help_direction_field.name) = sys_data_property.field_name
            )
            where label is null and help_direction_field.table_id = '@{tableName}'
        </sql>
            
        <sql name="setDirectionFieldLabelOnTableName">
            update help_direction_field set label = (
                select max(label_chinese) from sys_data_field
                where sys_data_field.dataname = lower(help_direction_field.table_id)
                    and lower(help_direction_field.name) = sys_data_field.field_name
            )
            where label is null and lower(help_direction_field.table_id) = '@{tableName}'
        </sql>    
            
        <sql name="setFieldCommentFromDB">
            update help_direction_field 
            set TITLE = (
                SELECT comments FROM (@{commentTable}) commentTable
                WHERE commentTable.table_name = help_direction_field.table_id 
                    and help_direction_field.name = commentTable.column_name 
            )
            where table_id = '@{tableName}' and title is null 
                and exists ( 
                    SELECT 1 FROM (@{commentTable}) commentTable
                    WHERE lower(commentTable.table_name) = '@{tableName}' 
                        and help_direction_field.name = commentTable.column_name )
        </sql>    
        
        <sql name="setDirectionFieldLabel_id">
            update help_direction_field set label = '主键'
            where name = 'id' and label is null
        </sql>
        
        <sql name="setDirectionFieldLabel_stateCode">
            update help_direction_field set label = '状态编码'
            where name = 'state_code' and label is null
        </sql>
        
        <sql name="setDirectionFieldLabel_stateDetailCode">
            update help_direction_field set label = '明细状态编码'
            where name = 'state_detail_code' and label is null
        </sql>
        
        <sql name="setDirectionFieldLabel_creatorId">
            update help_direction_field set label = '创建人ID'
            where name = 'creator_id' and label is null
        </sql>
        
        <sql name="getDirectionOutline">
            select help_direction_table.id, help_direction_table.parent_id as parent_id, 
                help_direction_table.name, help_direction_table.title, help_direction_table.order_no
            from help_direction_outline 
            right join help_direction_table on help_direction_outline.id = help_direction_table.parent_id
            union all 
            select help_direction_outline.id, help_direction_outline.parent_id,
                code, help_direction_outline.title, order_no
            from help_direction_outline
            order by parent_id, order_no, name
        </sql>
            
    </dataSpace>        
</sqls>