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
| <?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.jeecg.modules.dnc.mapper.DocInfoMapper">
| <select id="findDocExtList" parameterType="String" resultType="org.jeecg.modules.dnc.entity.DocInfo">
| SELECT
| u.doc_id,
| r.classification_id,
| CONVERT(VARCHAR(500),
| CONCAT(
| u.doc_name COLLATE Chinese_PRC_CI_AS,
| '.' COLLATE Chinese_PRC_CI_AS,
| u.doc_suffix COLLATE Chinese_PRC_CI_AS
| )
| ) AS doc_name, -- 统一排序规则并显式转换类型
| u.doc_alias,
| u.doc_code,
| u.doc_suffix,
| r.attribution_type,
| r.attribution_id,
| u.doc_status,
| u.doc_dispatch_status,
| u.publish_file_id,
| u.publish_version,
| u.description,
| u.CREATE_TIME,
| u.create_by,
| u.UPDATE_TIME,
| u.update_by,
| (CASE WHEN o.doc_id IS NULL THEN 1 ELSE 2 END) AS pullStatus,
| o.create_by AS pullUser
| FROM (
| SELECT classification_id, doc_id, attribution_type, attribution_id
| FROM nc_doc_relative
| WHERE delete_flag = 0
| ) r
| INNER JOIN (
| SELECT *
| FROM nc_doc_info
| WHERE delete_flag = 0
| ) u ON r.doc_id = u.doc_id
| LEFT JOIN (
| SELECT doc_id, create_by
| FROM nc_file_operate
| WHERE delete_flag = 0
| ) o ON u.doc_id = o.doc_id
| ${ew.customSqlSegment}
| </select>
|
|
| <select id="findDeviceDocExtList" parameterType="String" resultType="org.jeecg.modules.dnc.entity.DocInfo">
| select
| u.doc_id
| ,r.classification_id
| , CONVERT(VARCHAR(500),
| CONCAT(
| u.doc_name COLLATE Chinese_PRC_CI_AS,
| '.' COLLATE Chinese_PRC_CI_AS,
| u.doc_suffix COLLATE Chinese_PRC_CI_AS
| )
| ) AS doc_name -- 统一排序规则并显式转换类型
| ,u.doc_alias
| ,u.doc_code
| ,u.doc_suffix
| ,r.attribution_type
| ,r.attribution_id
| ,u.doc_status
| ,u.publish_file_id
| ,u.publish_version
| ,u.doc_dispatch_status
| ,u.description
| ,u.CREATE_TIME
| ,u.create_by
| ,u.UPDATE_TIME
| ,u.update_by
| ,(case when o.doc_id is null then 1 else 2 end) as pullStatus
| ,o.create_by as pullUser
| ,(case when t.sync_flag is null then 2 else t.sync_flag end) as syncStatus
| from (select classification_id, doc_id,attribution_type,attribution_id from nc_doc_relative where delete_flag=0) r
| inner join
| (select * from nc_doc_info where delete_flag=0) u
| on r.doc_id = u.doc_id
| left join (select doc_id, create_by from nc_file_operate where delete_flag=0) o
| on u.doc_id=o.doc_id
| left join (select distinct file_id, doc_id, device_id, sync_flag from nc_to_equipment_lists where delete_flag = 0) t
| on u.doc_id=t.doc_id and u.publish_file_id=t.file_id and r.attribution_id=t.device_id
| ${ew.customSqlSegment}
| </select>
|
| <select id="findByAttrAndDocName" parameterType="Map" resultType="org.jeecg.modules.dnc.entity.DocInfo">
| select r.doc_id
| ,r.attribution_id
| ,r.attribution_type
| ,r.classification_id
| ,d.doc_name
| ,d.doc_alias
| ,d.doc_code
| ,d.doc_suffix
| ,d.doc_status
| ,d.publish_file_id
| ,d.publish_version
| ,d.description
| from (select classification_id, doc_id,attribution_type,attribution_id from nc_doc_relative where delete_flag=0 and attribution_type=#{attrType} and attribution_id=#{attrId}) r
| inner join nc_doc_info d
| on r.doc_id=d.doc_id
| where d.delete_flag=0 and d.doc_name=#{docName}
| </select>
|
| <select id="getByDocAttrAndDocId" parameterType="Map" resultType="org.jeecg.modules.dnc.entity.DocInfo">
| select r.doc_id
| ,r.attribution_id
| ,r.attribution_type
| ,r.classification_id
| ,d.doc_name
| ,d.doc_alias
| ,d.doc_code
| ,d.doc_suffix
| ,d.doc_status
| ,d.publish_file_id
| ,d.publish_version
| ,d.description
| ,d.doc_dispatch_status
| from (select classification_id, doc_id,attribution_type,attribution_id from nc_doc_relative
| where delete_flag=0 and doc_id=#{docId} and attribution_type=#{attrType} and attribution_id=#{attrId}) r
| inner join nc_doc_info d
| on r.doc_id=d.doc_id
| where d.delete_flag=0
| </select>
|
| <select id="getByDocId" parameterType="String" resultType="org.jeecg.modules.dnc.entity.DocInfo">
| select r.doc_id
| ,r.attribution_id
| ,r.attribution_type
| ,r.classification_id
| ,d.doc_name
| ,d.doc_alias
| ,d.doc_code
| ,d.doc_suffix
| ,d.doc_status
| ,d.publish_file_id
| ,d.publish_version
| ,d.description
| from (select classification_id, doc_id,attribution_type,attribution_id from nc_doc_relative
| where delete_flag=0 and doc_id=#{docId}) r
| inner join nc_doc_info d
| on r.doc_id=d.doc_id
| where d.delete_flag=0
| </select>
|
|
| <update id="deleteByDocAttr" parameterType="Map">
| update nc_doc_info
| set delete_flag=1
| where doc_id in (select distinct doc_id from nc_doc_relative
| where attribution_type = #{attrType} and attribution_id=#{attrId})
| </update>
| </mapper>
|
|