From 23855599412c4d61b38d78f0f3abd3430a48b5b1 Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期三, 25 六月 2025 11:51:38 +0800
Subject: [PATCH] Merge branch 'mdc_hyjs_master'

---
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DocInfoMapper.xml |  156 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 156 insertions(+), 0 deletions(-)

diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DocInfoMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DocInfoMapper.xml
new file mode 100644
index 0000000..99ce988
--- /dev/null
+++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DocInfoMapper.xml
@@ -0,0 +1,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>

--
Gitblit v1.9.3