| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381 |
- <?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.archive.mapper.ArchivesAutoMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="archivesAutoResultMap" type="org.springblade.archive.vo.ArchivesAutoVO">
- <result column="id" property="id"/>
- <result column="create_user" property="createUser"/>
- <result column="create_dept" property="createDept"/>
- <result column="create_time" property="createTime"/>
- <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="project_id" property="projectId"/>
- <result column="contract_id" property="contractId"/>
- <result column="name" property="name"/>
- <result column="file_number" property="fileNumber"/>
- <result column="micron" property="micron"/>
- <result column="unit" property="unit"/>
- <result column="quantity" property="quantity"/>
- <result column="specification" property="specification"/>
- <result column="start_date" property="startDate"/>
- <result column="end_date" property="endDate"/>
- <result column="storage_time" property="storageTime"/>
- <result column="secret_level" property="secretLevel"/>
- <result column="carrier_type" property="carrierType"/>
- <result column="keywords" property="keywords"/>
- <result column="reviewer" property="reviewer"/>
- <result column="review_date" property="reviewDate"/>
- <result column="storage_location" property="storageLocation"/>
- <result column="is_archive" property="isArchive"/>
- <result column="remark" property="remark"/>
- <result column="roll_date" property="rollDate"/>
- <result column="rollor" property="rollor"/>
- <result column="node_id" property="nodeId"/>
- <result column="out_url" property="outUrl"/>
- <result column="cd_id" property="cdId"/>
- <result column="file_n" property="fileN"/>
- <result column="page_n" property="pageN"/>
- <result column="mileage" property="mileage"/>
- <result column="file_type" property="fileType"/>
- <result column="size" property="size"/>
- <result column="tree_sort" property="treeSort"/>
- <result column="is_open" property="isOpen"/>
- <result column="ischeck" property="ischeck"/>
- <result column="is_auto_file" property="isAutoFile"/>
- <result column="auto_file_sort" property="autoFileSort"/>
- <result column="filing_unit" property="filingUnit"/>
- <result column="file_size" property="fileSize"/>
- <result column="is_reviewed" property="isReviewed"/>
- </resultMap>
- <!-- 带文件子查询的-->
- <resultMap id="archivesAutoResultMap2" type="org.springblade.archive.vo.ArchivesAutoVO">
- <result column="id" property="id"/>
- <result column="create_user" property="createUser"/>
- <result column="create_dept" property="createDept"/>
- <result column="create_time" property="createTime"/>
- <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="project_id" property="projectId"/>
- <result column="contract_id" property="contractId"/>
- <result column="name" property="name"/>
- <result column="file_number" property="fileNumber"/>
- <result column="micron" property="micron"/>
- <result column="unit" property="unit"/>
- <result column="quantity" property="quantity"/>
- <result column="specification" property="specification"/>
- <result column="start_date" property="startDate"/>
- <result column="end_date" property="endDate"/>
- <result column="storage_time" property="storageTime"/>
- <result column="secret_level" property="secretLevel"/>
- <result column="carrier_type" property="carrierType"/>
- <result column="keywords" property="keywords"/>
- <result column="reviewer" property="reviewer"/>
- <result column="review_date" property="reviewDate"/>
- <result column="storage_location" property="storageLocation"/>
- <result column="is_archive" property="isArchive"/>
- <result column="remark" property="remark"/>
- <result column="roll_date" property="rollDate"/>
- <result column="rollor" property="rollor"/>
- <result column="node_id" property="nodeId"/>
- <result column="out_url" property="outUrl"/>
- <result column="cd_id" property="cdId"/>
- <result column="file_n" property="fileN"/>
- <result column="page_n" property="pageN"/>
- <result column="mileage" property="mileage"/>
- <result column="file_type" property="fileType"/>
- <result column="size" property="size"/>
- <result column="tree_sort" property="treeSort"/>
- <result column="is_open" property="isOpen"/>
- <result column="ischeck" property="ischeck"/>
- <result column="is_auto_file" property="isAutoFile"/>
- <result column="auto_file_sort" property="autoFileSort"/>
- <result column="filing_unit" property="filingUnit"/>
- <result column="file_size" property="fileSize"/>
- <result column="is_reviewed" property="isReviewed"/>
- <collection property="approvalFileList" javaType="java.util.List"
- select="approvalFile"
- column="{archiveId=id}">
- </collection>
- </resultMap>
- <!-- 通用查询映射结果 -->
- <resultMap id="archiveTreeContractResultMap" type="org.springblade.manager.entity.ArchiveTreeContract">
- <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="project_id" property="projectId"/>
- <result column="contract_id" property="contractId"/>
- <result column="is_upload_file_display_configuration_tree" property="isUploadFileDisplayConfigurationTree"/>
- <result column="parent_id" property="parentId"/>
- <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="tree_sort" property="treeSort"/>
- <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="tree_code" property="treeCode"/>
- <result column="file_number_prefix" property="fileNumberPrefix"/>
- <result column="storage_time" property="storageTime"/>
- <result column="rollor" property="rollor"/>
- <result column="reviewer" property="reviewer"/>
- <result column="specification" property="specification"/>
- <result column="archive_name_suffix" property="archiveNameSuffix"/>
- <result column="ext_key_id" property="extKeyId"/>
- <result column="out_id" property="outId"/>
- </resultMap>
- <!-- 通用查询映射结果 -->
- <resultMap id="archiveFileResultMap1" type="org.springblade.business.entity.ArchiveFile">
- <result column="id" property="id"/>
- <result column="create_user" property="createUser"/>
- <result column="create_dept" property="createDept"/>
- <result column="create_time" property="createTime"/>
- <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="project_id" property="projectId"/>
- <result column="contract_id" property="contractId"/>
- <result column="node_id" property="nodeId"/>
- <result column="file_number" property="fileNumber"/>
- <result column="file_name" property="fileName"/>
- <result column="file_time" property="fileTime"/>
- <result column="file_url" property="fileUrl"/>
- <result column="file_page" property="filePage"/>
- <result column="is_approval" property="isApproval"/>
- <result column="is_certification" property="isCertification"/>
- <result column="certification_time" property="certificationTime"/>
- <result column="is_need_certification" property="isNeedCertification"/>
- <result column="duty_user" property="dutyUser"/>
- <result column="pdf_file_url" property="pdfFileUrl"/>
- <result column="sheet_type" property="sheetType"/>
- <result column="sheet_source" property="sheetSource"/>
- <result column="drawing_no" property="drawingNo"/>
- <result column="cite_change_number" property="citeChangeNumber"/>
- <result column="e_visa_file" property="eVisaFile"/>
- <result column="node_ext_id" property="nodeExtId"/>
- <result column="file_type" property="fileType"/>
- <result column="archive_id" property="archiveId"/>
- <result column="origin_id" property="originId"/>
- <result column="filming_time" property="filmingTime"/>
- <result column="filmingor_time" property="filmingorTime"/>
- <result column="tag_id" property="tagId"/>
- <result column="pic_code" property="picCode"/>
- <result column="refer_code" property="referCode"/>
- <result column="film_code" property="filmCode"/>
- <result column="width" property="width"/>
- <result column="height" property="height"/>
- <result column="ftime" property="ftime"/>
- <result column="utime" property="utime"/>
- <result column="del_time" property="delTime"/>
- <result column="sort" property="sort"/>
- <result column="box_name" property="boxName"/>
- <result column="box_number" property="boxNumber"/>
- <result column="is_auto_file" property="isAutoFile"/>
- <result column="is_archive" property="isArchive"/>
- <result column="page_num" property="pageNum"/>
- <result column="file_size" property="fileSize"/>
- <result column="source_type" property="sourceType"/>
- <result column="is_element" property="isElement"/>
- <result column="pdf_page_url" property="pdfPageUrl"/>
- <result column="fid" property="fid"/>
- <result column="rectification" property="rectification"/>
- <result column="m_wbs_tree_contract_p_key_id" property="mWbsTreeContractPKeyId"/>
- <result column="u_image_classification_file_id" property="uImageClassificationFileId"/>
- <result column="out_id" property="outId"/>
- <result column="sort_num" property="sortNum"/>
- </resultMap>
- <select id="approvalFile" resultType="org.springblade.archive.vo.ArchivesAutoVO$ApprovalFile">
- <if test="archiveId!=null">
- select * from u_archive_file where archive_id = #{archiveId} and is_element = 0 order by sort
- </if>
- </select>
- <select id="selectArchivesAutoPage" resultMap="archivesAutoResultMap">
- select *
- from u_archives_auto
- where is_deleted = 0
- </select>
- <select id="selectArchivesAutoFileCount" resultType="java.lang.Integer">
- select count(id) from u_archives_auto u where u.is_deleted = 0
- <if test="vo.projectId != null and vo.projectId != ''">
- and u.project_id = #{vo.projectId}
- </if>
- <if test="vo.queryValue != null and vo.queryValue != ''">
- and (u.name like concat('%',#{vo.queryValue},'%') or u.file_number like concat('%',#{vo.queryValue},'%'))
- </if>
- <if test="vo.isAutoFile != null and vo.isAutoFile != ''">
- and u.is_auto_file = #{vo.isAutoFile}
- </if>
- <choose>
- <when test="vo.isArchive != null and vo.isArchive != ''">
- and u.is_archive = #{vo.isArchive}
- </when>
- <otherwise>
- and (u.is_archive is null or u.is_archive != 1)
- </otherwise>
- </choose>
- <if test="vo.isAutoFile != null and vo.isAutoFile != ''">
- and u.is_auto_file = #{vo.isAutoFile}
- </if>
- <if test="vo.nodeIds != null and vo.nodeIds != ''">
- and u.node_id in
- <foreach collection="vo.nodeIdArray" item="nodeId" open="(" separator="," close=")">
- #{nodeId}
- </foreach>
- </if>
- </select>
- <select id="selectArchivesAutoFilePage" resultMap="archivesAutoResultMap">
- select * from u_archives_auto u LEFT JOIN m_archive_tree_contract m ON u.node_id = m.id where u.is_deleted = 0
- <if test="vo.projectId != null and vo.projectId != ''">
- and u.project_id = #{vo.projectId}
- </if>
- <if test="vo.queryValue != null and vo.queryValue != ''">
- and (u.name like concat('%',#{vo.queryValue},'%') or u.file_number like concat('%',#{vo.queryValue},'%'))
- </if>
- <choose>
- <when test="vo.isArchive != null and vo.isArchive != ''">
- and u.is_archive = #{vo.isArchive}
- </when>
- <otherwise>
- and (u.is_archive is null or u.is_archive != 1)
- </otherwise>
- </choose>
- <if test="vo.isAutoFile != null and vo.isAutoFile != ''">
- and u.is_auto_file = #{vo.isAutoFile}
- </if>
- <if test="vo.nodeIds != null and vo.nodeIds != ''">
- and u.node_id in
- <foreach collection="vo.nodeIdArray" item="nodeId" open="(" separator="," close=")">
- #{nodeId}
- </foreach>
- </if>
- order by m.tree_sort,u.auto_file_sort is null ,u.auto_file_sort,u.file_number is null,
- SUBSTRING_INDEX(u.file_number, '_', 1), SUBSTRING_INDEX(u.file_number, '_', -1) + 0 ,u.create_time asc
- limit #{current}, #{size}
- </select>
- <select id="selectArchivesAutoFilePageZero" resultMap="archivesAutoResultMap">
- select * from u_archives_auto u LEFT JOIN m_archive_tree_contract m ON u.node_id = m.id
- where u.is_deleted = 0 and u.page_n = 0
- <if test="vo.projectId != null and vo.projectId != ''">
- and u.project_id = #{vo.projectId}
- </if>
- <if test="vo.queryValue != null and vo.queryValue != ''">
- and (u.name like concat('%',#{vo.queryValue},'%') or u.file_number like concat('%',#{vo.queryValue},'%'))
- </if>
- <choose>
- <when test="vo.isArchive != null and vo.isArchive != ''">
- and u.is_archive = #{vo.isArchive}
- </when>
- <otherwise>
- and (u.is_archive is null or u.is_archive != 1)
- </otherwise>
- </choose>
- <if test="vo.isAutoFile != null and vo.isAutoFile != ''">
- and u.is_auto_file = #{vo.isAutoFile}
- </if>
- <if test="vo.nodeIds != null and vo.nodeIds != ''">
- and u.node_id in
- <foreach collection="vo.nodeIdArray" item="nodeId" open="(" separator="," close=")">
- #{nodeId}
- </foreach>
- </if>
- order by m.tree_sort,u.auto_file_sort is null ,u.auto_file_sort,u.file_number is null,
- SUBSTRING_INDEX(u.file_number, '_', 1), SUBSTRING_INDEX(u.file_number, '_', -1) + 0 ,u.create_time asc
- limit #{current}, #{size}
- </select>
- <update id="updateArchivesAutoFileByNodeId">
- update u_archives_auto set node_id = #{nodeId},tree_sort = #{nodeSort} where
- id in
- <foreach collection="ids" item="id" open="(" separator="," close=")">
- #{id}
- </foreach>
- </update>
- <update id="splitArchvies">
- /**把未锁定案卷的文件关联去掉*/
- update u_archive_file
- set archive_id = null,
- is_archive=0
- where is_deleted = 0
- and archive_id in (
- select id
- from u_archives_auto
- where project_id = #{projectId}
- and is_auto_file
- !=1
- and is_deleted=0
- and is_lock!=1
- );
- /**把未锁定案卷去掉*/
- update u_archives_auto
- set is_deleted=1
- where project_id = #{projectId}
- and is_auto_file!=1
- and is_deleted=0
- and is_lock!=1;
- </update>
- <update id="splitArchviesByContract">
- update u_archive_file
- set archive_id = null,
- is_archive=0
- WHERE is_deleted = 0
- AND archive_id IN (
- select id
- from u_archives_auto
- where project_id = #{projectId}
- and is_auto_file!=1
- and is_deleted=0
- and is_lock!=1
- and node_id in (
- SELECT id FROM m_archive_tree_contract
- WHERE project_id = #{projectId}
- <if test="contractId == null">
- AND ( contract_id is null OR tree_code = #{treeCode} )
- </if>
- <if test="contractId != null">
- AND ( contract_id = #{contractId} OR tree_code = #{treeCode} )
- </if>
- )
- );
- update u_archives_auto
- set is_deleted=1
- where project_id = #{projectId}
- and is_auto_file!=1
- and is_deleted=0
- and is_lock!=1
- and node_id in (
- SELECT id FROM m_archive_tree_contract
- WHERE project_id = #{projectId}
- <if test="contractId == null">
- AND ( contract_id is null OR tree_code = #{treeCode} )
- </if>
- <if test="contractId != null">
- AND ( contract_id = #{contractId} OR tree_code = #{treeCode} )
- </if>
- );
- </update>
- <update id="splitArchviesByNode">
- update u_archive_file
- set archive_id = null,
- is_archive=0
- WHERE is_deleted = 0
- AND archive_id IN (
- SELECT id
- FROM u_archives_auto
- WHERE project_id = #{projectId}
- AND is_auto_file
- != 1
- AND is_deleted = 0
- AND is_lock != 1
- AND node_id IN (
- SELECT id FROM m_archive_tree_contract
- WHERE
- is_deleted = 0
- AND project_id = #{projectId}
- AND ancestors IS NOT NULL
- AND ancestors LIKE concat(''
- , #{ancestors}
- , '%')
- OR id = #{nodeId}
- )
- );
- update u_archives_auto
- set is_deleted=1
- where project_id = #{projectId}
- AND is_auto_file != 1
- AND is_deleted = 0
- AND is_lock != 1
- AND node_id IN (
- SELECT id FROM m_archive_tree_contract
- WHERE
- is_deleted = 0 AND project_id = #{projectId}
- AND ancestors IS NOT NULL
- AND ancestors LIKE concat(''
- , #{ancestors}
- , '%')
- OR id = #{nodeId}
- );
- </update>
- <select id="getFilePageUrlList" resultType="java.lang.String">
- select pdf_page_url
- from u_archive_file
- where is_deleted = 0 and pdf_page_url!= file_url
- and archive_id in (
- select id
- from u_archives_auto
- where project_id = #{projectId}
- and is_auto_file
- !=1
- and is_deleted=0
- and is_lock!=1
- )
- </select>
- <select id="getFilePageUrlListByContract" resultType="java.lang.String">
- select pdf_page_url
- from u_archive_file
- where is_deleted = 0 and pdf_page_url!= file_url
- and archive_id in (
- select id
- from u_archives_auto
- where project_id = #{projectId}
- and is_auto_file
- !=1
- and is_deleted=0
- and is_lock!=1
- and node_id in (
- SELECT id FROM m_archive_tree_contract
- WHERE is_deleted = 0
- AND project_id = #{projectId}
- AND ( contract_id = #{contractId}
- OR tree_code = #{treeCode} )
- )
- );
- </select>
- <select id="getFilePageUrlListByNode" resultType="java.lang.String">
- select pdf_page_url
- from u_archive_file
- where is_deleted = 0 and pdf_page_url!= file_url
- and archive_id in (
- SELECT id
- FROM u_archives_auto
- WHERE project_id = #{projectId}
- AND is_auto_file
- != 1
- AND is_deleted = 0
- AND is_lock != 1
- AND node_id IN (
- SELECT id FROM m_archive_tree_contract
- WHERE
- is_deleted = 0
- AND project_id = #{projectId}
- AND ancestors IS NOT NULL
- AND ancestors LIKE concat(''
- , #{ancestors}
- , '%')
- OR id = #{nodeId}
- )
- );
- </select>
- <select id="getArchivesOutUrlList" resultType="java.lang.String">
- select out_url
- from u_archives_auto
- where project_id = #{projectId}
- and is_auto_file!=1
- and is_deleted=0
- and is_lock!=1
- </select>
- <select id="getArchivesOutUrlListByContract" resultType="java.lang.String">
- select out_url
- from u_archives_auto
- where project_id = #{projectId}
- and is_auto_file!=1
- and is_deleted=0
- and is_lock!=1
- and node_id in (
- SELECT id FROM m_archive_tree_contract
- WHERE project_id = #{projectId}
- <if test="contractId == null">
- AND ( contract_id is null OR tree_code = #{treeCode} )
- </if>
- <if test="contractId != null">
- AND ( contract_id = #{contractId} OR tree_code = #{treeCode} )
- </if>
- )
- </select>
- <select id="getArchivesOutUrlListByNode" resultType="java.lang.String">
- select out_url
- from u_archives_auto
- where project_id = #{projectId}
- AND is_auto_file != 1
- AND is_deleted = 0
- AND is_lock != 1
- AND node_id IN (
- SELECT id FROM m_archive_tree_contract
- WHERE project_id = #{projectId}
- AND ancestors IS NOT NULL
- AND ancestors LIKE concat(''
- , #{ancestors}
- , '%')
- OR id = #{nodeId}
- )
- </select>
- <select id="getListByProjectId" resultType="org.springblade.archive.dto.ArchivesAutoDTO">
- select *
- from u_archives_auto
- where project_id = #{projectId} and is_deleted = 0;
- </select>
- <select id="pageByArchivesAuto" resultMap="archivesAutoResultMap">
- select uaa.*
- from m_archive_tree_contract matc left join u_archives_auto uaa on matc.id = uaa.node_id left join
- u_archive_file uaf on uaa.id = uaf.archive_id
- where uaa.is_deleted = 0 and uaa.is_archive = 1
- and matc.project_id = #{vo.projectId}
- <if test="vo.contractId != null and vo.contractId != ''">
- and uaa.contract_id = #{vo.contractId} and matc.contract_id = #{vo.contractId}
- </if>
- <if test="vo.searchType == 1 and vo.queryValue != null and vo.queryValue != ''">
- and uaa.name like concat('%',#{vo.queryValue},'%')
- </if>
- <if test="vo.searchType == 2 and vo.queryValue != null and vo.queryValue != ''">
- and uaf.file_name like concat('%',#{vo.queryValue},'%')
- </if>
- <if test="vo.storageTimes != null and vo.storageTimes != ''">
- and uaa.storage_time in
- <foreach collection="vo.storageTimes" item="storageTime" open="(" separator="," close=")">
- #{storageTime}
- </foreach>
- </if>
- <if test="vo.secretLevels != null and vo.secretLevels != ''">
- and uaa.secret_level in
- <foreach collection="vo.secretLevels" item="secretLevel" open="(" separator="," close=")">
- #{secretLevel}
- </foreach>
- </if>
- <if test="vo.carrierTypes != null and vo.carrierTypes != ''">
- and uaa.carrier_type in
- <foreach collection="vo.carrierTypes" item="carrierType" open="(" separator="," close=")">
- #{carrierType}
- </foreach>
- </if>
- <if test="vo.years != null and vo.years != ''">
- and
- <foreach collection="vo.years" item="year" separator=" or" open="(" close=")">
- #{year} BETWEEN DATE_FORMAT(uaa.start_date,'%Y') and DATE_FORMAT(uaa.end_date ,'%Y')
- </foreach>
- </if>
- <if test="vo.months != null and vo.months != ''">
- and
- <foreach collection="vo.months" item="month" separator=" or" open="(" close=")">
- #{month} BETWEEN DATE_FORMAT(uaa.start_date,'%c') and DATE_FORMAT(uaa.end_date ,'%c')
- </foreach>
- </if>
- GROUP BY uaa.id
- order by uaa.tree_sort,uaa.auto_file_sort,uaa.file_number asc
- </select>
- <select id="pageByArchivesAuto11" resultMap="archivesAutoResultMap">
- select uaa.*
- from m_archive_tree_contract matc left join u_archives_auto uaa on matc.id = uaa.node_id
- where uaa.is_deleted = 0 and uaa.is_archive = 1
- <if test="vo.queryValue != null and vo.queryValue != ''">
- and (uaa.name like concat('%',#{vo.queryValue},'%') or uaa.file_number like concat('%',#{vo.queryValue},'%'))
- </if>
- <if test="vo.searchType == 1 and vo.queryList != null and vo.queryList.size > 0">
- and (
- <foreach collection="vo.queryList" item="query" separator="or" >
- uaa.name like concat('%',#{query},'%')
- </foreach>
- )
- </if>
- and matc.project_id = #{vo.projectId}
- <if test="vo.contractId != null and vo.contractId != ''">
- and uaa.contract_id = #{vo.contractId} and matc.contract_id = #{vo.contractId}
- </if>
- <if test="vo.storageTimes != null and vo.storageTimes != ''">
- and uaa.storage_time in
- <foreach collection="vo.storageTimes" item="storageTime" open="(" separator="," close=")">
- #{storageTime}
- </foreach>
- </if>
- <if test="vo.secretLevels != null and vo.secretLevels != ''">
- and uaa.secret_level in
- <foreach collection="vo.secretLevels" item="secretLevel" open="(" separator="," close=")">
- #{secretLevel}
- </foreach>
- </if>
- <if test="vo.carrierTypes != null and vo.carrierTypes != ''">
- and uaa.carrier_type in
- <foreach collection="vo.carrierTypes" item="carrierType" open="(" separator="," close=")">
- #{carrierType}
- </foreach>
- </if>
- <if test="vo.years != null and vo.years != ''">
- and
- <foreach collection="vo.years" item="year" separator=" or" open="(" close=")">
- #{year} BETWEEN DATE_FORMAT(uaa.start_date,'%Y') and DATE_FORMAT(uaa.end_date ,'%Y')
- </foreach>
- </if>
- <if test="vo.months != null and vo.months != ''">
- and
- <foreach collection="vo.months" item="month" separator=" or" open="(" close=")">
- #{month} BETWEEN DATE_FORMAT(uaa.start_date,'%c') and DATE_FORMAT(uaa.end_date ,'%c')
- </foreach>
- </if>
- GROUP BY uaa.id
- order by uaa.tree_sort,uaa.auto_file_sort,uaa.file_number asc
- </select>
- <select id="pageByArchivesAuto2" resultMap="archivesAutoResultMap">
- select uaa.* from
- (SELECT id FROM m_archive_tree_contract WHERE project_id =#{vo.projectId}
- and 1=2
- <foreach collection="vo.nodeIdArray" item="nodeId">
- or ancestors like concat('%',#{nodeId},'%') or id = #{nodeId}
- </foreach>
- ) matc left join u_archives_auto uaa on matc.id = uaa.node_id left join u_archive_file uaf on uaa.id =
- uaf.archive_id
- where uaa.is_deleted = 0 and uaa.is_archive = 1
- <if test="vo.contractId != null and vo.contractId != ''">
- and uaa.contract_id = #{vo.contractId}
- </if>
- <if test="vo.searchType == 1 and vo.queryValue != null and vo.queryValue != ''">
- and uaa.name like concat('%',#{vo.queryValue},'%')
- </if>
- <if test="vo.searchType == 1 and vo.queryList != null and vo.queryList.size > 0">
- and (
- <foreach collection="vo.queryList" item="query" separator="or" >
- uaa.name like concat('%',#{query},'%')
- </foreach>
- )
- </if>
- <if test="vo.searchType == 2 and vo.queryValue != null and vo.queryValue != ''">
- and uaf.file_name like concat('%',#{vo.queryValue},'%')
- </if>
- <if test="vo.storageTimes != null and vo.storageTimes != ''">
- and uaa.storage_time in
- <foreach collection="vo.storageTimes" item="storageTime" open="(" separator="," close=")">
- #{storageTime}
- </foreach>
- </if>
- <if test="vo.secretLevels != null and vo.secretLevels != ''">
- and uaa.secret_level in
- <foreach collection="vo.secretLevels" item="secretLevel" open="(" separator="," close=")">
- #{secretLevel}
- </foreach>
- </if>
- <if test="vo.carrierTypes != null and vo.carrierTypes != ''">
- and uaa.carrier_type in
- <foreach collection="vo.carrierTypes" item="carrierType" open="(" separator="," close=")">
- #{carrierType}
- </foreach>
- </if>
- <if test="vo.years != null and vo.years != ''">
- and
- <foreach collection="vo.years" item="year" separator=" or" open="(" close=")">
- #{year} BETWEEN DATE_FORMAT(uaa.start_date,'%Y') and DATE_FORMAT(uaa.end_date ,'%Y')
- </foreach>
- </if>
- <if test="vo.months != null and vo.months != ''">
- and
- <foreach collection="vo.months" item="month" separator=" or" open="(" close=")">
- #{month} BETWEEN DATE_FORMAT(uaa.start_date,'%c') and DATE_FORMAT(uaa.end_date ,'%c')
- </foreach>
- </if>
- GROUP BY uaa.id
- order by uaa.tree_sort,uaa.auto_file_sort,uaa.file_number asc
- </select>
- <select id="pageByArchivesAuto22" resultMap="archivesAutoResultMap">
- select uaa.* from
- (SELECT id FROM m_archive_tree_contract WHERE project_id =#{vo.projectId}
- and 1=2
- <foreach collection="vo.nodeIdArray" item="nodeId">
- or ancestors like concat('%',#{nodeId},'%') or id = #{nodeId}
- </foreach>
- ) matc left join u_archives_auto uaa on matc.id = uaa.node_id
- where uaa.is_deleted = 0 and uaa.is_archive = 1
- <if test="vo.queryValue != null and vo.queryValue != ''">
- and (uaa.name like concat('%',#{vo.queryValue},'%') or uaa.file_number like concat('%',#{vo.queryValue},'%'))
- </if>
- <if test="vo.contractId != null and vo.contractId != ''">
- and uaa.contract_id = #{vo.contractId}
- </if>
- <if test="vo.storageTimes != null and vo.storageTimes != ''">
- and uaa.storage_time in
- <foreach collection="vo.storageTimes" item="storageTime" open="(" separator="," close=")">
- #{storageTime}
- </foreach>
- </if>
- <if test="vo.secretLevels != null and vo.secretLevels != ''">
- and uaa.secret_level in
- <foreach collection="vo.secretLevels" item="secretLevel" open="(" separator="," close=")">
- #{secretLevel}
- </foreach>
- </if>
- <if test="vo.carrierTypes != null and vo.carrierTypes != ''">
- and uaa.carrier_type in
- <foreach collection="vo.carrierTypes" item="carrierType" open="(" separator="," close=")">
- #{carrierType}
- </foreach>
- </if>
- <if test="vo.years != null and vo.years != ''">
- and
- <foreach collection="vo.years" item="year" separator=" or" open="(" close=")">
- #{year} BETWEEN DATE_FORMAT(uaa.start_date,'%Y') and DATE_FORMAT(uaa.end_date ,'%Y')
- </foreach>
- </if>
- <if test="vo.months != null and vo.months != ''">
- and
- <foreach collection="vo.months" item="month" separator=" or" open="(" close=")">
- #{month} BETWEEN DATE_FORMAT(uaa.start_date,'%c') and DATE_FORMAT(uaa.end_date ,'%c')
- </foreach>
- </if>
- GROUP BY uaa.id
- order by uaa.tree_sort,uaa.auto_file_sort,uaa.file_number asc
- </select>
- <select id="pageByArchivesAuto3" resultMap="archivesAutoResultMap">
- select uaa.id,uaa.name,uaa.file_number,uaa.unit,uaa.storage_time,uaa.secret_level,uaa.start_date,uaa.end_date
- from
- (SELECT id FROM m_archive_tree_contract WHERE project_id =#{vo.projectId}
- and ancestors like concat('%',#{vo.nodeId},'%')
- ) matc left join u_archives_auto uaa on matc.id = uaa.node_id
- where uaa.is_deleted = 0 and uaa.is_archive = 1
- <if test="vo.contractId != null and vo.contractId != ''">
- and uaa.contract_id = #{vo.contractId}
- </if>
- GROUP BY uaa.id
- order by uaa.tree_sort,uaa.auto_file_sort,uaa.file_number asc
- </select>
- <select id="pageByArchivesAuto4" resultMap="archivesAutoResultMap">
- select uaa.id from
- (SELECT id FROM m_archive_tree_contract WHERE project_id =#{vo.projectId}
- and ancestors like concat('%',#{vo.nodeId},'%')
- ) matc left join u_archives_auto uaa on matc.id = uaa.node_id
- where uaa.is_deleted = 0 and uaa.is_archive = 1
- <if test="vo.contractId != null and vo.contractId != ''">
- and uaa.contract_id = #{vo.contractId}
- </if>
- <if test="vo.searchType == 1 and vo.queryValue != null and vo.queryValue != ''">
- and uaa.name like concat('%',#{vo.queryValue},'%') or uaa.file_number like concat('%',#{vo.queryValue},'%')
- </if>
- <if test="vo.storageTimes != null and vo.storageTimes != ''">
- and uaa.storage_time in
- <foreach collection="vo.storageTimes" item="storageTime" open="(" separator="," close=")">
- #{storageTime}
- </foreach>
- </if>
- <if test="vo.secretLevels != null and vo.secretLevels != ''">
- and uaa.secret_level in
- <foreach collection="vo.secretLevels" item="secretLevel" open="(" separator="," close=")">
- #{secretLevel}
- </foreach>
- </if>
- <if test="vo.carrierTypes != null and vo.carrierTypes != ''">
- and uaa.carrier_type in
- <foreach collection="vo.carrierTypes" item="carrierType" open="(" separator="," close=")">
- #{carrierType}
- </foreach>
- </if>
- <if test="vo.years != null and vo.years != ''">
- and
- <foreach collection="vo.years" item="year" separator=" or" open="(" close=")">
- #{year} BETWEEN DATE_FORMAT(uaa.start_date,'%Y') and DATE_FORMAT(uaa.end_date ,'%Y')
- </foreach>
- </if>
- <if test="vo.months != null and vo.months != ''">
- and
- <foreach collection="vo.months" item="month" separator=" or" open="(" close=")">
- #{month} BETWEEN DATE_FORMAT(uaa.start_date,'%c') and DATE_FORMAT(uaa.end_date ,'%c')
- </foreach>
- </if>
- GROUP BY uaa.id
- order by uaa.tree_sort,uaa.auto_file_sort,uaa.file_number asc
- </select>
- <select id="pageByArchivesAuto5" resultMap="archivesAutoResultMap">
- select uaa.id from
- (SELECT id FROM m_archive_tree_contract WHERE project_id =#{vo.projectId}
- and ancestors like concat('%',#{vo.nodeId},'%')
- ) matc left join u_archives_auto uaa on matc.id = uaa.node_id left join u_archive_file uaf on uaa.id =
- uaf.archive_id
- where uaa.is_deleted = 0 and uaa.is_archive = 1
- <if test="vo.contractId != null and vo.contractId != ''">
- and uaa.contract_id = #{vo.contractId}
- </if>
- <if test="vo.searchType == 2 and vo.queryValue != null and vo.queryValue != ''">
- and uaf.file_name like concat('%',#{vo.queryValue},'%')
- </if>
- <if test="vo.storageTimes != null and vo.storageTimes != ''">
- and uaa.storage_time in
- <foreach collection="vo.storageTimes" item="storageTime" open="(" separator="," close=")">
- #{storageTime}
- </foreach>
- </if>
- <if test="vo.secretLevels != null and vo.secretLevels != ''">
- and uaa.secret_level in
- <foreach collection="vo.secretLevels" item="secretLevel" open="(" separator="," close=")">
- #{secretLevel}
- </foreach>
- </if>
- <if test="vo.carrierTypes != null and vo.carrierTypes != ''">
- and uaa.carrier_type in
- <foreach collection="vo.carrierTypes" item="carrierType" open="(" separator="," close=")">
- #{carrierType}
- </foreach>
- </if>
- <if test="vo.years != null and vo.years != ''">
- and
- <foreach collection="vo.years" item="year" separator=" or" open="(" close=")">
- #{year} BETWEEN DATE_FORMAT(uaa.start_date,'%Y') and DATE_FORMAT(uaa.end_date ,'%Y')
- </foreach>
- </if>
- <if test="vo.months != null and vo.months != ''">
- and
- <foreach collection="vo.months" item="month" separator=" or" open="(" close=")">
- #{month} BETWEEN DATE_FORMAT(uaa.start_date,'%c') and DATE_FORMAT(uaa.end_date ,'%c')
- </foreach>
- </if>
- GROUP BY uaa.id
- order by uaa.tree_sort,uaa.auto_file_sort,uaa.file_number asc
- </select>
- <select id="getArchivesCabinet" resultMap="archivesAutoResultMap">
- select uaa.id,uaa.name,uaa.file_number,uaa.unit from
- (SELECT id FROM m_archive_tree_contract WHERE project_id =#{vo.projectId}
- and ancestors like concat('%',#{vo.nodeId},'%')
- ) matc left join u_archives_auto uaa on matc.id = uaa.node_id
- where uaa.is_deleted = 0 and uaa.is_archive = 1
- <if test="vo.contractId != null and vo.contractId != ''">
- and uaa.contract_id = #{vo.contractId}
- </if>
- GROUP BY uaa.id
- order by uaa.tree_sort,uaa.auto_file_sort,uaa.file_number asc
- -- order by uaa.id
- </select>
- <select id="getArchivesCabinet2" resultMap="archivesAutoResultMap">
- select uaa.id from
- (SELECT id FROM m_archive_tree_contract WHERE project_id =#{vo.projectId}
- and ancestors like concat('%',#{vo.nodeId},'%')
- ) matc left join u_archives_auto uaa on matc.id = uaa.node_id
- where uaa.is_deleted = 0 and uaa.is_archive = 1
- <if test="vo.contractId != null and vo.contractId != ''">
- and uaa.contract_id = #{vo.contractId}
- </if>
- <if test="vo.searchType == 1 and vo.queryValue != null and vo.queryValue != ''">
- and uaa.name like concat('%',#{vo.queryValue},'%')
- </if>
- <if test="vo.storageTimes != null and vo.storageTimes != ''">
- and uaa.storage_time in
- <foreach collection="vo.storageTimes" item="storageTime" open="(" separator="," close=")">
- #{storageTime}
- </foreach>
- </if>
- <if test="vo.secretLevels != null and vo.secretLevels != ''">
- and uaa.secret_level in
- <foreach collection="vo.secretLevels" item="secretLevel" open="(" separator="," close=")">
- #{secretLevel}
- </foreach>
- </if>
- <if test="vo.carrierTypes != null and vo.carrierTypes != ''">
- and uaa.carrier_type in
- <foreach collection="vo.carrierTypes" item="carrierType" open="(" separator="," close=")">
- #{carrierType}
- </foreach>
- </if>
- <if test="vo.years != null and vo.years != ''">
- and
- <foreach collection="vo.years" item="year" separator=" or" open="(" close=")">
- #{year} BETWEEN DATE_FORMAT(uaa.start_date,'%Y') and DATE_FORMAT(uaa.end_date ,'%Y')
- </foreach>
- </if>
- <if test="vo.months != null and vo.months != ''">
- and
- <foreach collection="vo.months" item="month" separator=" or" open="(" close=")">
- #{month} BETWEEN DATE_FORMAT(uaa.start_date,'%c') and DATE_FORMAT(uaa.end_date ,'%c')
- </foreach>
- </if>
- GROUP BY uaa.id
- order by uaa.tree_sort,uaa.auto_file_sort,uaa.file_number asc
- -- order by uaa.id
- </select>
- <select id="getArchivesCabinet22" resultMap="archivesAutoResultMap">
- select uaa.id from
- (SELECT id FROM m_archive_tree_contract WHERE project_id =#{vo.projectId}
- and ancestors like concat('%',#{vo.nodeId},'%')
- ) matc left join u_archives_auto uaa on matc.id = uaa.node_id left join u_archive_file uaf on uaa.id =
- uaf.archive_id
- where uaa.is_deleted = 0 and uaa.is_archive = 1
- <if test="vo.contractId != null and vo.contractId != ''">
- and uaa.contract_id = #{vo.contractId}
- </if>
- <if test="vo.searchType == 1 and vo.queryValue != null and vo.queryValue != ''">
- and uaa.name like concat('%',#{vo.queryValue},'%')
- </if>
- <if test="vo.searchType == 2 and vo.queryValue != null and vo.queryValue != ''">
- and uaf.file_name like concat('%',#{vo.queryValue},'%')
- </if>
- <if test="vo.storageTimes != null and vo.storageTimes != ''">
- and uaa.storage_time in
- <foreach collection="vo.storageTimes" item="storageTime" open="(" separator="," close=")">
- #{storageTime}
- </foreach>
- </if>
- <if test="vo.secretLevels != null and vo.secretLevels != ''">
- and uaa.secret_level in
- <foreach collection="vo.secretLevels" item="secretLevel" open="(" separator="," close=")">
- #{secretLevel}
- </foreach>
- </if>
- <if test="vo.carrierTypes != null and vo.carrierTypes != ''">
- and uaa.carrier_type in
- <foreach collection="vo.carrierTypes" item="carrierType" open="(" separator="," close=")">
- #{carrierType}
- </foreach>
- </if>
- <if test="vo.years != null and vo.years != ''">
- and
- <foreach collection="vo.years" item="year" separator=" or" open="(" close=")">
- #{year} BETWEEN DATE_FORMAT(uaa.start_date,'%Y') and DATE_FORMAT(uaa.end_date ,'%Y')
- </foreach>
- </if>
- <if test="vo.months != null and vo.months != ''">
- and
- <foreach collection="vo.months" item="month" separator=" or" open="(" close=")">
- #{month} BETWEEN DATE_FORMAT(uaa.start_date,'%c') and DATE_FORMAT(uaa.end_date ,'%c')
- </foreach>
- </if>
- GROUP BY uaa.id
- order by uaa.tree_sort,uaa.auto_file_sort,uaa.file_number asc
- -- order by uaa.id
- </select>
- <select id="getAllArchiveByContractType" resultType="org.springblade.archive.vo.ArchivesAutoVO">
- SELECT uaa.id, matc.tree_code as 'contractType'
- FROM m_archive_tree_contract matc
- left join u_archives_auto uaa on uaa.node_id = matc.id
- WHERE uaa.project_id = #{projectId}
- and uaa.is_deleted = #{type}
- and uaa.is_destroy = #{type}
- </select>
- <select id="getAllArchiveAgeByContractType" resultType="java.util.Map">
- SELECT CASE uaa.storage_time WHEN '1' THEN '10年' WHEN '2' THEN '30年' ELSE '永久' END as name,
- COUNT(uaa.storage_time) as value
- FROM m_archive_tree_contract matc left join u_archives_auto uaa
- on uaa.node_id =matc.id
- WHERE matc.project_id =#{projectId} and uaa.is_deleted =0
- GROUP BY uaa.storage_time
- </select>
- <!-- 档案鉴定,档案查询-->
- <select id="pageByAuthenticate" resultType="org.springblade.archive.vo.ArchivesAutoVO">
- select uaa.id,uaa.file_number,uaa.name,uaa.file_size,CASE uaa.storage_time WHEN '1' THEN '10年' WHEN '2' THEN
- '30年' ELSE '永久' END as storageTimeValue
- from(
- select id from m_archive_tree_contract
- where project_id = #{vo.projectId} and ancestors like concat('%', #{vo.nodeId}, '%') and is_deleted = 0 or id =
- #{vo.nodeId}
- ) matc
- left join u_archives_auto uaa on matc.id = uaa.node_id
- where
- <if test="vo.isDeleted == 0">
- uaa.is_deleted = 0 and uaa.is_destroy = 0
- </if>
- <if test="vo.isDeleted == 1">
- uaa.is_deleted = 1 and uaa.is_destroy = 1
- </if>
- <if test="vo.storageTime != null and vo.storageTime != ''">
- and uaa.storage_time = #{vo.storageTime}
- </if>
- <if test="vo.filingUnit != null and vo.filingUnit != ''">
- and uaa.unit = #{vo.filingUnit}
- </if>
- <if test="vo.destroyUser != null and vo.destroyUser != ''">
- and uaa.update_user = #{vo.destroyUser}
- </if>
- <if test="vo.fileSizeValue != null and vo.fileSizeValue != ''">
- <if test="vo.fileSizeValue == '小于80M'">
- and uaa.file_size < 81920
- </if>
- <if test="vo.fileSizeValue == '小于150M'">
- and uaa.file_size < 153600
- </if>
- <if test="vo.fileSizeValue == '小于200M'">
- and uaa.file_size < 204800
- </if>
- <if test="vo.fileSizeValue == '200M-500M'">
- and uaa.file_size BETWEEN 204800 and 512000
- </if>
- <if test="vo.fileSizeValue == '大于500M'">
- and uaa.file_size > 512000
- </if>
- </if>
- and uaa.is_archive = 1
- order by uaa.tree_sort,uaa.auto_file_sort,uaa.file_number asc
- </select>
- <select id="getFilingUnitList" resultType="java.lang.String">
- SELECT unit
- FROM u_archives_auto
- WHERE project_id = #{projectId}
- and is_deleted = 0
- AND unit is not NULL
- GROUP BY unit
- </select>
- <select id="getCarrierTypeByDict" resultType="org.springblade.system.entity.DictBiz">
- SELECT *
- FROM blade_dict_biz
- WHERE code = 'storage_type'
- AND parent_id > 0
- AND tenant_id = 000000
- </select>
- <select id="getUserRoleName" resultType="java.lang.String">
- SELECT br.role_name
- FROM blade_role br
- WHERE br.id = (
- SELECT role_id
- FROM m_project_assignment_user
- WHERE project_id = #{projectId}
- AND contract_id = #{contractId}
- AND user_id = #{userId}
- )
- </select>
- <select id="getArchiveDestroyUser" resultType="org.springblade.system.user.entity.User">
- SELECT id,real_name FROM blade_user WHERE id IN (SELECT uaa.update_user FROM u_archives_auto uaa
- WHERE uaa.is_deleted = 1 AND uaa.is_destroy = 1 and project_id = #{projectId}
- GROUP BY uaa.update_user )
- </select>
- <select id="getAllArchiveFileSize" resultType="java.lang.Long">
- select sum(uaa.file_size) from u_archives_auto uaa WHERE uaa.project_id = #{projectId} and is_deleted = 0
- </select>
- <select id="getArchiveFileList" resultMap="archivesAutoResultMap2">
- select *
- from u_archives_auto uaa WHERE uaa.id = #{id} and is_deleted = 0
- </select>
- <select id="getUnitNodeByProjectId" resultType="org.springblade.manager.entity.ArchiveTreeContract">
- SELECT matc1.*
- FROM m_archive_tree_contract matc1
- WHERE matc1.parent_id in (select id from m_archive_tree_contract
- WHERE parent_id = (select id from m_archive_tree_contract WHERE parent_id = 0 and project_id = #{projectId} and is_deleted = 0)
- and is_deleted = 0 and tree_code is NULL)
- and matc1.is_deleted = 0
- </select>
- <select id="getUnitAllArchive" resultType="org.springblade.archive.vo.ArchivesAutoVO2">
- select SUBSTRING_INDEX(SUBSTRING_INDEX(atc.ancestors,",",4),",",-1) as masterNode,uaa.*
- from (select * from m_archive_tree_contract WHERE is_deleted = 0 and ancestors like concat('%',#{node},'%')) atc
- join u_archives_auto uaa on atc.id = uaa.node_id and uaa.is_deleted = 0
- </select>
- <select id="batchSearchArchiveFile" resultType="org.springblade.business.entity.ArchiveFile">
- select id,file_name,pdf_file_url,archive_id,project_id FROM u_archive_file
- WHERE is_element = 0 and is_deleted = 0 and archive_id in
- <foreach collection="ids" item="id" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </select>
- <select id="searchArchiveFileByArchivesId" resultType="org.springblade.business.entity.ArchiveFile">
- select * from u_archive_file where is_deleted = 0
- <if test="ids != null and ids != ''">
- and archive_id in
- <foreach collection="ids" item="id" open="(" separator="," close=")">
- #{id}
- </foreach>
- </if>
- order by sort,create_time
- </select>
- <select id="getArchives" resultType="org.springblade.archive.entity.ArchivesAuto">
- select id,name
- from u_archives_auto
- where id in
- <foreach collection="ids" item="id" open="(" separator="," close=")">
- #{id}
- </foreach>
- </select>
- <select id="getUnitSecondNode" resultType="org.springblade.manager.entity.ArchiveTreeContract">
- select * from m_archive_tree_contract WHERE is_deleted = 0 and parent_id = #{firstNode}
- </select>
- <select id="getTertiaryNode" resultType="org.springblade.manager.entity.ArchiveTreeContract">
- select * from m_archive_tree_contract WHERE is_deleted = 0 and parent_id in
- <foreach collection="ids" item="id" open="(" separator="," close=")">
- #{id}
- </foreach>
- </select>
- <select id="getUnitFirstNode" resultType="org.springblade.manager.entity.ArchiveTreeContract">
- select * from m_archive_tree_contract WHERE is_deleted = 0 and parent_id =
- (select id from m_archive_tree_contract
- WHERE project_id = #{projectId} and is_deleted = 0 and parent_id = 0)
- <if test="nodeType == null">
- and tree_code is null
- </if>
- <if test="nodeType != null and nodeType != ''">
- and tree_code = #{nodeType}
- </if>
- </select>
- <select id="getUnitAllArchive2" resultType="org.springblade.archive.vo.ArchivesAutoVO2">
- select
- concat(matc.ancestors,',',matc.id) as ancestors,
- uaa.id,uaa.name,uaa.page_n ,uaa.remark ,uaa.file_number,uaa.unit,uaa.start_date,uaa.end_date,
- (select bdb.dict_value from blade_dict_biz bdb WHERE bdb.is_sealed = 0 and bdb.code = 'storage_period' and bdb.dict_key = uaa.storage_time limit 1 ) as storageTimeValue
- from m_archive_tree_contract matc right join u_archives_auto uaa on matc.id = uaa.node_id
- WHERE uaa.is_deleted = 0 and matc.is_deleted = 0 and uaa.is_apply = #{isApply} and matc.ancestors like concat("%",#{firstNode},"%")
- order by uaa.tree_sort
- </select>
- <select id="getNodeArchives" resultType="org.springblade.archive.vo.ArchiveInspectVO">
- select uaa.id ,uaa.file_number,uaa.name ,uaa.unit,
- if((select count(1) from u_archive_expert_inspection aei where aei.is_deleted =0 and aei.archive_id = uaa.id and aei.conclusion_id = #{conclusionId}
- and aei.expert_id = #{userId}) > 0,'已抽检','未抽检') as inspectStatusName,
- (CASE when (select count(1) from u_archive_expert_inspection aei where aei.is_deleted =0 and aei.archive_id = uaa.id and aei.conclusion_id = #{conclusionId}
- and aei.expert_id = #{userId} and is_pass = 1) = 1 then '合格'
- when (select count(1) from u_archive_expert_inspection aei where aei.is_deleted =0 and aei.archive_id = uaa.id and aei.conclusion_id = #{conclusionId}
- and aei.expert_id = #{userId} and is_pass = 0) > 0 then '整改' else null end) as updateStatusName
- from m_archive_tree_contract atc right join u_archives_auto uaa on atc.id = uaa.node_id
- WHERE uaa.is_apply = 1 and uaa.project_id = #{projectId} and atc.project_id = #{projectId} and atc.is_deleted = 0 and uaa.is_deleted =0
- and (atc.id =#{id} or FIND_IN_SET(#{id}, atc.ancestors))
- <if test="searchValue != null and searchValue != ''">
- <if test="searchType == 1">
- and uaa.name like concat('%',#{searchValue},'%')
- </if>
- <if test="searchType == 2">
- and (select COUNT(1) from u_archive_file uaf WHERE uaf.archive_id = uaa.id and uaf.file_name like concat('%',#{searchValue},'%'))
- </if>
- </if>
- </select>
- <select id="getNodeArchives2" resultType="org.springblade.archive.vo.ArchiveInspectVO">
- select uaa.id ,uaa.file_number,uaa.name ,uaa.unit,
- if((select count(1) from u_archive_expert_inspection aei where aei.is_deleted =0 and aei.archive_id = uaa.id and aei.conclusion_id = #{conclusionId}
- and aei.expert_id = #{userId}) > 0,'已抽检','未抽检') as inspectStatusName,
- (CASE when (select count(1) from u_archive_expert_inspection aei where aei.is_deleted =0 and aei.archive_id = uaa.id and aei.conclusion_id = #{conclusionId}
- and aei.expert_id = #{userId} and is_pass = 1) = 1 then '合格'
- when (select count(1) from u_archive_expert_inspection aei where aei.is_deleted =0 and aei.archive_id = uaa.id and aei.conclusion_id = #{conclusionId}
- and aei.expert_id = #{userId} and is_pass = 0) > 0 then '整改' else null end) as updateStatusName
- from m_archive_tree_contract atc right join u_archives_auto uaa on atc.id = uaa.node_id
- WHERE uaa.is_apply = 1 and uaa.project_id = #{projectId} and atc.project_id = #{projectId} and atc.is_deleted = 0 and uaa.is_deleted =0
- and (atc.id =#{id} or FIND_IN_SET(#{id}, atc.ancestors))
- <if test="userId != null">
- and FIND_IN_SET(#{userId}, uaa.expert_id)
- </if>
- <if test="searchValue != null and searchValue != ''">
- <if test="searchType == 1">
- and uaa.name like concat('%',#{searchValue},'%')
- </if>
- <if test="searchType == 2">
- and (select COUNT(1) from u_archive_file uaf WHERE uaf.archive_id = uaa.id and uaf.file_name like concat('%',#{searchValue},'%'))
- </if>
- </if>
- </select>
- <select id="getNodeAllArchive" resultType="org.springblade.archive.entity.ArchivesAuto">
- select id,expert_id
- from u_archives_auto where is_deleted = 0 and is_apply = 1 and node_id in
- <foreach collection="ids" item="id" open="(" separator="," close=")">
- #{id}
- </foreach>
- </select>
- <select id="getUserArchiveTotal" resultType="java.lang.Integer">
- SELECT COUNT(1) from u_archives_auto
- WHERE project_id = #{projectId} and is_deleted = 0 and FIND_IN_SET(#{userId},expert_id)
- </select>
- <select id="getUserReviewedTotal" resultType="java.lang.Integer">
- SELECT COUNT(1)
- from (SELECT DISTINCT (archive_id)
- from u_archive_expert_inspection
- WHERE project_id = #{projectId}
- and is_deleted = 0
- and expert_id = #{userId}
- and conclusion_id = #{conclusionId}
- ) a
- </select>
- <select id="getUserInspectInfo" resultType="org.springblade.archive.vo.ExpertInspectionVO">
- select aei.id,aei.archive_name ,aei.opinion , aei.archive_id,expert_name,file_id,aei.is_pass,aei.conclusion_id,
- (case when unit_type = 1 then '施工' when unit_type = 2 then '监理' else '业主' end) as unitName,
- (select uaf.pdf_file_url from u_archive_file uaf where uaf.id = aei.file_id) as filePdf
- from u_archive_expert_inspection aei
- WHERE project_id = #{projectId} and is_deleted = 0 and is_pass = 0 and conclusion_id = #{conclusionId}
- <if test="userId != null">
- and expert_id = #{userId}
- </if>
- order BY update_time DESC
- </select>
- <select id="getAllInspectArchive" resultType="org.springblade.archive.vo.ArchivesAutoVO3">
- SELECT (case when contract_id is null then '3' when contract_id = -1 then '3' else (SELECT contract_type from m_contract_info mci WHERE mci.id = uaa.contract_id) end) as unitType,
- uaa.*
- from u_archives_auto uaa WHERE project_id = #{projectId} and is_deleted = 0 and is_apply = 1
- </select>
- <select id="getArchiveConclusion" resultType="org.springblade.archive.entity.ArchiveConclusion">
- select * from u_archive_conclusion where project_id = #{projectId} and expert_id = #{userId}
- </select>
- <select id="getAllArchive" resultType="org.springblade.archive.vo.ArchivesAutoVO2">
- select
- uaa.id,uaa.name,uaa.page_n ,uaa.remark ,uaa.file_number,
- (select bdb.dict_value from blade_dict_biz bdb WHERE bdb.is_sealed = 0 and bdb.code = 'storage_period' and bdb.dict_key = uaa.storage_time limit 1 ) as storageTimeValue
- from u_archives_auto uaa where id in
- <foreach collection="ids" item="id" open="(" separator="," close=")">
- #{id}
- </foreach>
- order by FIELD(uaa.id,
- <foreach collection="ids" item="id" separator="," >
- #{id}
- </foreach>
- )
- </select>
- <select id="getRoutingInspection" resultType="org.springblade.archive.vo.ArchiveWarningVO">
- select uaf.file_name ,uaf.file_url,0 as sourceType,uaf.node_id,
- (select uaa.name from u_archives_auto uaa WHERE uaa.id = uaf.archive_id) as archive_name,
- (select GROUP_CONCAT(uai.opinion) from u_archive_inspection uai WHERE uai.file_id = uaf.id) as allopinion
- from u_archive_file uaf join m_archive_tree_contract atc on uaf.node_id = atc.id
- where uaf.project_id = #{projectId} and uaf.is_deleted = 0 and uaf.rectification = #{rec}
- and atc.is_deleted = 0
- and (atc.id = #{nodeId} or FIND_IN_SET(#{nodeId}, atc.ancestors))
- </select>
- <select id="getSpotCheck" resultType="org.springblade.archive.vo.ArchiveWarningVO">
- select GROUP_CONCAT(aei.opinion) as allopinion,aei.archive_name ,aei.node_id,1 as sourceType,
- (select uaf.file_name from u_archive_file uaf WHERE uaf.id = aei.file_id) as fileName,
- (select uaf.file_url from u_archive_file uaf WHERE uaf.id = aei.file_id) as fileUrl
- from m_archive_tree_contract atc join u_archive_expert_inspection aei on aei.node_id = atc.id
- where atc.project_id = #{projectId} and atc.is_deleted = 0 and aei.is_deleted = 0 and aei.is_pass = 0
- and atc.is_deleted = 0
- and (atc.id = #{nodeId} or FIND_IN_SET(#{nodeId}, atc.ancestors))
- GROUP by aei.file_id
- </select>
- <select id="getUnitAllCabinet" resultType="org.springblade.archive.vo.CabinetVO">
- select uaa.id,uaa.name,uaa.file_number,uaa.unit,uaa.storage_time,uaa.secret_level,uaa.start_date,uaa.end_date
- from
- (SELECT id FROM m_archive_tree_contract WHERE project_id =#{projectId}
- and ancestors like concat('%',#{nodeId},'%')
- ) matc left join u_archives_auto uaa on matc.id = uaa.node_id
- where uaa.is_deleted = 0 and uaa.is_archive = 1
- GROUP BY uaa.id
- order by uaa.tree_sort,uaa.auto_file_sort,uaa.file_number asc
- </select>
- <update id="splitFiles">
- update u_archive_file set is_archive = 0 ,archive_id = null where
- id in
- <foreach collection="ids" item="id" open="(" separator="," close=")">
- #{id}
- </foreach>
- </update>
- <update id="batchDestroyByIds">
- update u_archives_auto set is_deleted = 1 ,is_destroy = 1 ,update_user = #{userId} where
- id in
- <foreach collection="ids" item="id" open="(" separator="," close=")">
- #{id}
- </foreach>
- </update>
- <resultMap id="archiveAutoDtoMap" type="org.springblade.archive.entity.JiLinArchiveAutoDto">
- <id column="id" property="id"></id>
- <result column="project_id" property="projectId"></result>
- <result column="contract_id" property="contractId"></result>
- <result column="name" property="name"></result>
- <result column="file_number" property="fileNumber"></result>
- <result column="unit" property="unit"></result>
- <result column="start_date" property="startDate"></result>
- <result column="end_date" property="endDate"></result>
- <result column="storage_time" property="storageTime"></result>
- <result column="secret_level" property="secretLevel"></result>
- <result column="real_name" property="updateUserName"></result>
- <result column="update_time" property="updateUserTime"></result>
- <result column="auto_file_sort" property="autoFileSort"></result>
- <result column="create_time" property="createUserTime"></result>
- <result column="file_n" property="fileN"></result>
- <result column="rollor" property="rollor"></result>
- <result column="node_id" property="nodeId"></result>
- <result column="page_n" property="pageN"></result>
- <result column="file_url" property="fileUrl"></result>
- <result column="pdf_file_url" property="pdfFileUrl"></result>
- </resultMap>
- <select id="getArchiveAutoDtoList" resultMap="archiveAutoDtoMap">
- select a.id,a.project_id,a.contract_id,a.name,a.file_number,a.unit,a.start_date,a.end_date,a.storage_time,a.secret_level,b.real_name,a.update_time,
- a.auto_file_sort,a.create_time,a.file_n,a.rollor,a.node_id,a.page_n ,c.file_url,c.pdf_file_url from u_archives_auto as a join blade_user as b on a.update_user=b.id
- join u_archive_file as c on a.id=c.archive_id
- where a.project_id=#{projId} and a.contract_id in
- <foreach collection="dtos" item="item" open="(" separator="," close=")">
- #{item.cqContractId}
- </foreach>
- </select>
- <select id="getOutArchiveAutosByOutIds" resultMap="archivesAutoResultMap">
- select *
- from u_archives_auto
- where project_id = #{projectId}
- and is_auto_file!=1
- and is_deleted=0
- and
- out_id in
- <foreach collection="ids" item="id" open="(" separator="," close=")">
- #{id}
- </foreach>
- </select>
- <select id="selectArchivesAutoPage1" resultMap="archivesAutoResultMap">
- select *
- from u_archives_auto
- where is_deleted = 0
- </select>
- <select id="getOutNodesByOutIds" resultMap="archiveTreeContractResultMap">
- select id,node_name,parent_id,out_id
- from m_archive_tree_contract
- where project_id = #{projectId} and is_deleted = 0 and
- out_id in
- <foreach collection="ids" item="id" open="(" separator="," close=")">
- #{id}
- </foreach>
- </select>
- <select id="getOutArchiveFilesByOutIds" resultMap="archiveFileResultMap1">
- select id,utime,out_id,pdf_page_url
- from u_archive_file
- where project_id = #{projectId} and is_deleted = 0 and
- out_id in
- <foreach collection="ids" item="id" open="(" separator="," close=")">
- #{id}
- </foreach>
- </select>
- <select id="getMetadaFileByFileIds" resultType="java.util.Map">
- SELECT id,file_id
- FROM u_metadata_file
- WHERE file_id IN
- <foreach collection="fileIds" item="fileId" open="(" close=")" separator=",">
- #{fileId}
- </foreach>
- ORDER BY file_id, create_time DESC
- </select>
- </mapper>
|