123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402 |
- <?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.springblade.manager.mapper.ArchiveTreeMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="archiveTreeResultMap" type="org.springblade.manager.entity.ArchiveTree">
- <result column="id" property="id"/>
- <result column="create_time" property="createTime"/>
- <result column="create_user" property="createUser"/>
- <result column="create_dept" property="createDept"/>
- <result column="update_user" property="updateUser"/>
- <result column="update_time" property="updateTime"/>
- <result column="status" property="status"/>
- <result column="is_deleted" property="isDeleted"/>
- <result column="parent_id" property="parentId"/>
- <result column="project_id" property="projectId"/>
- <result column="ancestors" property="ancestors"/>
- <result column="node_name" property="nodeName"/>
- <result column="full_name" property="fullName"/>
- <result column="node_type" property="nodeType"/>
- <result column="post_type" property="postType"/>
- <result column="association_type" property="associationType"/>
- <result column="major_data_type" property="majorDataType"/>
- <result column="display_hierarchy" property="displayHierarchy"/>
- <result column="is_storage_node" property="isStorageNode"/>
- <result column="is_built_drawing" property="isBuiltDrawing"/>
- <result column="is_interface_node" property="isInterfaceNode"/>
- <result column="interface_type" property="interfaceType"/>
- <result column="sort" property="sort"/>
- <result column="remark" property="remark"/>
- <result column="project_type" property="projectType"/>
- <result column="storage_type" property="storageType"/>
- <result column="ext_type" property="extType"/>
- <result column="ext_id" property="extId"/>
- <result column="exp_data_type" property="expDataType"/>
- <result column="from_id" property="fromId"/>
- <result column="archive_auto_type" property="archiveAutoType"/>
- <result column="archive_auto_node_id" property="archiveAutoNodeId"/>
- <result column="archive_auto_group_select" property="archiveAutoGroupSelect"/>
- <result column="archive_auto_group_id" property="archiveAutoGroupId"/>
- <result column="is_upload_file_display_configuration_tree" property="isUploadFileDisplayConfigurationTree"/>
- </resultMap>
- <resultMap id="ArchiveTreeVOResultMap" type="org.springblade.manager.vo.ArchiveTreeVO2">
- <id column="id" property="id"/>
- <result column="parent_id" property="parentId"/>
- <result column="project_id" property="projectId"/>
- <result column="title" property="title"/>
- <result column="value" property="value"/>
- <result column="key" property="key"/>
- <result column="has_children" property="hasChildren"/>
- <result column="displayHierarchy" property="displayHierarchy"/>
- <result column="majorDataType" property="majorDataType"/>
- <result column="isStorageNode" property="isStorageNode"/>
- <result column="isDisplayTree" property="isDisplayTree"/>
- <result column="isStorageNode" property="isStorageNode"/>
- <result column="isBuiltDrawing" property="isBuiltDrawing"/>
- <result column="association_type" property="associationType"/>
- <result column="exp_data_type" property="expDataType"/>
- <result column="postType" property="postType"/>
- <result column="project_type" property="projectType"/>
- <result column="storage_type" property="storageType"/>
- <result column="ext_type" property="extType"/>
- <result column="ext_id" property="extId"/>
- <result column="from_id" property="fromId"/>
- <result column="archive_auto_type" property="archiveAutoType"/>
- <result column="archive_auto_node_id" property="archiveAutoNodeId"/>
- <result column="archive_auto_group_id" property="archiveAutoGroupId"/>
- <result column="archive_auto_group_select" property="archiveAutoGroupSelect"/>
- <result column="is_interface_node" property="isInterfaceNode"/>
- <result column="interface_type" property="interfaceType"/>
- <result column="sort" property="sort"/>
- </resultMap>
- <resultMap id="treeNodeResultMap" type="org.springblade.manager.vo.TreeNodeVO2">
- <id column="id" property="id"/>
- <result column="parent_id" property="parentId"/>
- <result column="title" property="title"/>
- <result column="value" property="value"/>
- <result column="key" property="key"/>
- <result column="has_children" property="hasChildren"/>
- <result column="displayHierarchy" property="displayHierarchy"/>
- <result column="majorDataType" property="majorDataType"/>
- <result column="isStorageNode" property="isStorageNode"/>
- <result column="isDisplayTree" property="isDisplayTree"/>
- <result column="isStorageNode" property="isStorageNode"/>
- <result column="isBuiltDrawing" property="isBuiltDrawing"/>
- <result column="project_type" property="projectType"/>
- <result column="storage_type" property="storageType"/>
- <result column="ext_type" property="extType"/>
- <result column="ext_id" property="extId"/>
- <result column="archive_auto_type" property="archiveAutoType"/>
- <result column="archive_auto_node_id" property="archiveAutoNodeId"/>
- <result column="postType" property="postType"/>
- </resultMap>
- <resultMap id="getAllSonNodeforGroupViewResultMap" type="org.springblade.manager.vo.ArchiveTreeAutoRuleVO">
- <id column="id" property="nodeId"/>
- <result column="parent_id" property="parentId"/>
- <result column="node_name" property="nodeName"/>
- <result column="archive_auto_type" property="archiveAutoType"/>
- <result column="archive_auto_node_id" property="archiveAutoNodeId"/>
- <result column="archive_auto_group_id" property="archiveAutoGroupId"/>
- <result column="archive_auto_group_select" property="archiveAutoGroupSelect"/>
- </resultMap>
- <update id="updateBatch">
- UPDATE m_archive_tree
- SET is_upload_file_display_configuration_tree = 1
- WHERE id IN
- <foreach item="diffRent" collection="diffRent" open="(" close=")" separator=",">
- #{diffRent}
- </foreach>
- AND is_deleted = 0
- AND status = 1
- </update>
- <update id="updateBatch2">
- UPDATE m_archive_tree
- SET is_upload_file_display_configuration_tree = 0
- WHERE id IN
- <foreach item="diffRent" collection="diffRent" open="(" close=")" separator=",">
- #{diffRent}
- </foreach>
- AND is_deleted = 0
- AND status = 1
- </update>
- <update id="updateBatch3">
- UPDATE m_archive_tree
- SET is_upload_file_display_configuration_tree = 0
- WHERE node_type = 2
- AND is_deleted = 0
- AND status = 1
- </update>
- <select id="lazyTree" resultMap="treeNodeResultMap">
- SELECT
- d.id,
- d.parent_id,
- d.node_name AS title,
- d.id AS "value",
- d.id AS "key",
- d.major_data_type AS "majorDataType",
- d.display_hierarchy AS "displayHierarchy",
- d.is_storage_node AS "isStorageNode",
- d.post_type AS postType,
- d.project_type,
- d.storage_type,
- d.ext_type,
- d.ext_id,
- d.archive_auto_type,
- d.archive_auto_node_id,
- (SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_archive_tree WHERE parent_id = d.id and is_deleted = 0)
- AS "has_children"
- FROM
- m_archive_tree d
- WHERE
- d.parent_id = #{parentId} AND d.is_deleted = 0
- <if test="tenantId!=null and tenantId!=''">
- AND d.tenant_id = #{tenantId}
- </if>
- ORDER BY d.sort
- </select>
- <select id="tree" resultMap="treeNodeResultMap">
- SELECT
- id,
- parent_id,
- node_name AS title,
- id AS "value",
- id AS "key",
- major_data_type AS "majorDataType",
- display_hierarchy AS "displayHierarchy",
- is_storage_node AS "isStorageNode",
- is_upload_file_display_configuration_tree AS "isDisplayTree",
- is_built_drawing AS "isBuiltDrawing",
- post_type AS postType,
- project_type,
- storage_type,
- ext_type,
- ext_id,
- archive_auto_type,
- archive_auto_node_id,
- FROM m_archive_tree
- WHERE is_deleted = 0
- <if test=" tenantId!=null and tenantId!='' ">
- AND tenant_id = #{tenantId}
- </if>
- <if test=" disPlayTree!=null and disPlayTree!='' ">
- AND is_upload_file_display_configuration_tree = 1
- </if>
- <if test=" nodeType !=null and nodeType !='' ">
- /*根节点=0 关联电子原生文件=1 数字化上传文件=2*/
- AND node_type in (0,#{nodeType})
- </if>
- OR parent_id = 0
- ORDER BY sort
- </select>
- <select id="lazyTree2" resultMap="ArchiveTreeVOResultMap">
- SELECT
- d.id,
- d.project_id,
- d.parent_id,
- d.node_name AS title,
- d.id AS "value",
- d.id AS "key",
- d.major_data_type AS "majorDataType",
- d.display_hierarchy AS "displayHierarchy",
- d.is_storage_node AS "isStorageNode",
- d.post_type AS postType,
- d.node_type AS nodeType,
- d.project_type,
- d.storage_type,
- d.association_type,
- d.ext_type,
- d.ext_id,
- d.exp_data_type,
- d.archive_auto_type,
- d.archive_auto_node_id,
- d.archive_auto_group_select,
- d.archive_auto_group_id,
- d.is_interface_node,
- d.interface_type,
- d.sort,
- (SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_archive_tree WHERE parent_id = d.id and is_deleted = 0)
- AS "has_children"
- FROM
- m_archive_tree d
- WHERE
- d.parent_id = #{parentId} AND d.is_deleted = 0 AND project_id = #{projectId}
- <if test="tenantId!=null and tenantId!=''">
- AND d.tenant_id = #{tenantId}
- </if>
- ORDER BY d.sort
- </select>
- <select id="tree2" resultMap="ArchiveTreeVOResultMap">
- SELECT
- id,
- project_id,
- parent_id,
- node_name AS title,
- id AS "value",
- id AS "key",
- major_data_type AS "majorDataType",
- display_hierarchy AS "displayHierarchy",
- is_storage_node AS "isStorageNode",
- is_upload_file_display_configuration_tree AS "isDisplayTree",
- is_built_drawing AS "isBuiltDrawing",
- post_type AS postType,
- node_type AS nodeType,
- project_type,
- storage_type,
- association_type,
- from_id,
- ext_type,
- ext_id,
- exp_data_type,
- archive_auto_type,
- archive_auto_node_id,
- archive_auto_group_select,
- archive_auto_group_id,
- is_interface_node,
- interface_type,
- sort,
- ( SELECT CASE WHEN count( 1 ) > 0 THEN 1 ELSE 0 END FROM m_archive_tree t2 WHERE t2.parent_id = t1 .id and
- t2.node_type in (0, #{nodeType})) AS "has_children"
- FROM m_archive_tree t1
- WHERE is_deleted = 0 AND project_id = #{projectId}
- <if test=" tenantId!=null and tenantId!='' ">
- AND tenant_id = #{tenantId}
- </if>
- <if test=" disPlayTree!=null and disPlayTree!='' ">
- AND is_upload_file_display_configuration_tree = 1
- </if>
- <if test=" nodeType !=null and nodeType !='' ">
- /*根节点=0 关联电子原生文件=1 数字化上传文件=2*/
- AND node_type in (0,#{nodeType})
- </if>
- OR (parent_id = 0 and is_deleted = 0 AND project_id = #{projectId})
- ORDER BY sort
- </select>
- <update id="updateAllSonNodeIdsForArchiveAutoRule">
- <if test="archiveAutoType ==1 ">
- update m_archive_tree
- set
- archive_auto_node_id = #{archiveAutoNodeId}
- where
- is_deleted = 0 and ancestors like concat('', #{ancestors}, '%');
- </if>
- update m_archive_tree
- set
- archive_auto_type= #{archiveAutoType}
- <if test="archiveAutoType ==2 ">
- ,archive_auto_group_id=#{archiveAutoGroupId},
- archive_auto_group_select=0
- </if>
- where
- is_deleted = 0 and ancestors like concat('', #{ancestors}, '%')
- /*最高并卷规则不能覆盖 分类并卷规则,单独组卷规则*/
- <if test="archiveAutoType ==1 ">
- and (archive_auto_type != 2 and archive_auto_type != 3 or archive_auto_type is null)
- </if>
- /*分类并卷规则不能覆盖单独组卷规则*/
- <if test="archiveAutoType ==2 ">
- and (archive_auto_type != 3 or archive_auto_type is null)
- </if>
- </update>
- <update id="removeAllSonNodeforTypeIsNUll">
- update m_archive_tree
- set archive_auto_type = null,
- archive_auto_group_select =NULL
- where is_deleted = 0
- and ancestors like concat('', #{ancestors}, '%')
- and archive_auto_type = 1
- and archive_auto_node_id is NULL
- or id = #{nodeId};
- </update>
- <update id="removeAllSonNodeIdsForArchiveAutoRule_1">
- update m_archive_tree
- set archive_auto_node_id = NULL
- where is_deleted = 0
- and ancestors like concat('', #{ancestors}, '%')
- or id = #{nodeId};
- update m_archive_tree
- set archive_auto_type = NULL,
- archive_auto_group_select =NULL
- where is_deleted = 0
- and ancestors like concat('', #{ancestors}, '%')
- /*取消规则 只取消规则与自己一致的*/
- and archive_auto_type = #{archiveAutoType}
- or id = #{nodeId};
- </update>
- <update id="removeAllSonNodeIdsForArchiveAutoRule_3">
- update m_archive_tree
- set
- /*取消规则 恢复默认规则 不需要设置为null,如果最高并卷节点取消规则,archive_auto_node_id会为空,相当于无规则不会进到自动组卷流程*/
- archive_auto_type = 1,
- archive_auto_group_select =NULL
- where is_deleted = 0
- and ancestors like concat('', #{ancestors}, '%')
- /*取消规则 只取消规则与自己一致的*/
- and archive_auto_type = #{archiveAutoType}
- or id = #{nodeId};
- </update>
- <update id="removeAllSonNodeIdsForArchiveAutoRule_2">
- /*取消单个节点的分类并卷规则*/
- update m_archive_tree
- set
- /*取消规则 恢复默认规则 不需要设置为null,如果最高并卷节点取消规则,archive_auto_node_id会为空,相当于无规则不会进到自动组卷流程*/
- archive_auto_type = 1,
- archive_auto_group_id = NULL,
- archive_auto_group_select =NULL
- where is_deleted = 0
- and ancestors like concat('', #{ancestors}, '%')
- /*取消规则 只取消规则与自己一致的*/
- and archive_auto_type = #{archiveAutoType}
- or id = #{nodeId};
- </update>
- <update id="removeNodeForArchiveAutoRule_Group">
- /**取消同一组的分类并卷规则*/
- update m_archive_tree
- set archive_auto_type = 1,
- archive_auto_group_id = NULL,
- archive_auto_group_select =NULL
- where is_deleted = 0
- and archive_auto_group_id = #{archiveAutoGroupId}
- </update>
- <select id="getAllSonNodeforGroupView" resultMap="getAllSonNodeforGroupViewResultMap">
- SELECT id,
- parent_id,
- node_name,
- archive_auto_type,
- archive_auto_node_id,
- archive_auto_group_id,
- archive_auto_group_select
- FROM m_archive_tree
- where is_deleted = 0
- and ancestors like concat('', #{ancestors}, '%')
- and (archive_auto_type !=3 or archive_auto_type is null)
- and id not in (
- select id from m_archive_tree where archive_auto_type = 2 and archive_auto_group_id
- != #{groupId}
- )
- or id=#{bigNodeID}
- order by ancestors asc, sort asc
- </select>
- </mapper>
|