ArchivesAutoMapper.xml 65 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="org.springblade.archive.mapper.ArchivesAutoMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="archivesAutoResultMap" type="org.springblade.archive.vo.ArchivesAutoVO">
  6. <result column="id" property="id"/>
  7. <result column="create_user" property="createUser"/>
  8. <result column="create_dept" property="createDept"/>
  9. <result column="create_time" property="createTime"/>
  10. <result column="update_user" property="updateUser"/>
  11. <result column="update_time" property="updateTime"/>
  12. <result column="status" property="status"/>
  13. <result column="is_deleted" property="isDeleted"/>
  14. <result column="project_id" property="projectId"/>
  15. <result column="contract_id" property="contractId"/>
  16. <result column="name" property="name"/>
  17. <result column="file_number" property="fileNumber"/>
  18. <result column="micron" property="micron"/>
  19. <result column="unit" property="unit"/>
  20. <result column="quantity" property="quantity"/>
  21. <result column="specification" property="specification"/>
  22. <result column="start_date" property="startDate"/>
  23. <result column="end_date" property="endDate"/>
  24. <result column="storage_time" property="storageTime"/>
  25. <result column="secret_level" property="secretLevel"/>
  26. <result column="carrier_type" property="carrierType"/>
  27. <result column="keywords" property="keywords"/>
  28. <result column="reviewer" property="reviewer"/>
  29. <result column="review_date" property="reviewDate"/>
  30. <result column="storage_location" property="storageLocation"/>
  31. <result column="is_archive" property="isArchive"/>
  32. <result column="remark" property="remark"/>
  33. <result column="roll_date" property="rollDate"/>
  34. <result column="rollor" property="rollor"/>
  35. <result column="node_id" property="nodeId"/>
  36. <result column="out_url" property="outUrl"/>
  37. <result column="cd_id" property="cdId"/>
  38. <result column="file_n" property="fileN"/>
  39. <result column="page_n" property="pageN"/>
  40. <result column="mileage" property="mileage"/>
  41. <result column="file_type" property="fileType"/>
  42. <result column="size" property="size"/>
  43. <result column="tree_sort" property="treeSort"/>
  44. <result column="is_open" property="isOpen"/>
  45. <result column="ischeck" property="ischeck"/>
  46. <result column="is_auto_file" property="isAutoFile"/>
  47. <result column="auto_file_sort" property="autoFileSort"/>
  48. <result column="filing_unit" property="filingUnit"/>
  49. <result column="file_size" property="fileSize"/>
  50. <result column="is_reviewed" property="isReviewed"/>
  51. </resultMap>
  52. <!-- 带文件子查询的-->
  53. <resultMap id="archivesAutoResultMap2" type="org.springblade.archive.vo.ArchivesAutoVO">
  54. <result column="id" property="id"/>
  55. <result column="create_user" property="createUser"/>
  56. <result column="create_dept" property="createDept"/>
  57. <result column="create_time" property="createTime"/>
  58. <result column="update_user" property="updateUser"/>
  59. <result column="update_time" property="updateTime"/>
  60. <result column="status" property="status"/>
  61. <result column="is_deleted" property="isDeleted"/>
  62. <result column="project_id" property="projectId"/>
  63. <result column="contract_id" property="contractId"/>
  64. <result column="name" property="name"/>
  65. <result column="file_number" property="fileNumber"/>
  66. <result column="micron" property="micron"/>
  67. <result column="unit" property="unit"/>
  68. <result column="quantity" property="quantity"/>
  69. <result column="specification" property="specification"/>
  70. <result column="start_date" property="startDate"/>
  71. <result column="end_date" property="endDate"/>
  72. <result column="storage_time" property="storageTime"/>
  73. <result column="secret_level" property="secretLevel"/>
  74. <result column="carrier_type" property="carrierType"/>
  75. <result column="keywords" property="keywords"/>
  76. <result column="reviewer" property="reviewer"/>
  77. <result column="review_date" property="reviewDate"/>
  78. <result column="storage_location" property="storageLocation"/>
  79. <result column="is_archive" property="isArchive"/>
  80. <result column="remark" property="remark"/>
  81. <result column="roll_date" property="rollDate"/>
  82. <result column="rollor" property="rollor"/>
  83. <result column="node_id" property="nodeId"/>
  84. <result column="out_url" property="outUrl"/>
  85. <result column="cd_id" property="cdId"/>
  86. <result column="file_n" property="fileN"/>
  87. <result column="page_n" property="pageN"/>
  88. <result column="mileage" property="mileage"/>
  89. <result column="file_type" property="fileType"/>
  90. <result column="size" property="size"/>
  91. <result column="tree_sort" property="treeSort"/>
  92. <result column="is_open" property="isOpen"/>
  93. <result column="ischeck" property="ischeck"/>
  94. <result column="is_auto_file" property="isAutoFile"/>
  95. <result column="auto_file_sort" property="autoFileSort"/>
  96. <result column="filing_unit" property="filingUnit"/>
  97. <result column="file_size" property="fileSize"/>
  98. <result column="is_reviewed" property="isReviewed"/>
  99. <collection property="approvalFileList" javaType="java.util.List"
  100. select="approvalFile"
  101. column="{archiveId=id}">
  102. </collection>
  103. </resultMap>
  104. <!-- 通用查询映射结果 -->
  105. <resultMap id="archiveTreeContractResultMap" type="org.springblade.manager.entity.ArchiveTreeContract">
  106. <result column="id" property="id"/>
  107. <result column="create_time" property="createTime"/>
  108. <result column="create_user" property="createUser"/>
  109. <result column="create_dept" property="createDept"/>
  110. <result column="update_user" property="updateUser"/>
  111. <result column="update_time" property="updateTime"/>
  112. <result column="status" property="status"/>
  113. <result column="is_deleted" property="isDeleted"/>
  114. <result column="project_id" property="projectId"/>
  115. <result column="contract_id" property="contractId"/>
  116. <result column="is_upload_file_display_configuration_tree" property="isUploadFileDisplayConfigurationTree"/>
  117. <result column="parent_id" property="parentId"/>
  118. <result column="ancestors" property="ancestors"/>
  119. <result column="node_name" property="nodeName"/>
  120. <result column="full_name" property="fullName"/>
  121. <result column="node_type" property="nodeType"/>
  122. <result column="post_type" property="postType"/>
  123. <result column="association_type" property="associationType"/>
  124. <result column="major_data_type" property="majorDataType"/>
  125. <result column="display_hierarchy" property="displayHierarchy"/>
  126. <result column="is_storage_node" property="isStorageNode"/>
  127. <result column="is_built_drawing" property="isBuiltDrawing"/>
  128. <result column="is_interface_node" property="isInterfaceNode"/>
  129. <result column="interface_type" property="interfaceType"/>
  130. <result column="sort" property="sort"/>
  131. <result column="tree_sort" property="treeSort"/>
  132. <result column="remark" property="remark"/>
  133. <result column="project_type" property="projectType"/>
  134. <result column="storage_type" property="storageType"/>
  135. <result column="ext_type" property="extType"/>
  136. <result column="ext_id" property="extId"/>
  137. <result column="exp_data_type" property="expDataType"/>
  138. <result column="from_id" property="fromId"/>
  139. <result column="archive_auto_type" property="archiveAutoType"/>
  140. <result column="archive_auto_node_id" property="archiveAutoNodeId"/>
  141. <result column="archive_auto_group_select" property="archiveAutoGroupSelect"/>
  142. <result column="archive_auto_group_id" property="archiveAutoGroupId"/>
  143. <result column="tree_code" property="treeCode"/>
  144. <result column="file_number_prefix" property="fileNumberPrefix"/>
  145. <result column="storage_time" property="storageTime"/>
  146. <result column="rollor" property="rollor"/>
  147. <result column="reviewer" property="reviewer"/>
  148. <result column="specification" property="specification"/>
  149. <result column="archive_name_suffix" property="archiveNameSuffix"/>
  150. <result column="ext_key_id" property="extKeyId"/>
  151. <result column="out_id" property="outId"/>
  152. </resultMap>
  153. <!-- 通用查询映射结果 -->
  154. <resultMap id="archiveFileResultMap1" type="org.springblade.business.entity.ArchiveFile">
  155. <result column="id" property="id"/>
  156. <result column="create_user" property="createUser"/>
  157. <result column="create_dept" property="createDept"/>
  158. <result column="create_time" property="createTime"/>
  159. <result column="update_user" property="updateUser"/>
  160. <result column="update_time" property="updateTime"/>
  161. <result column="status" property="status"/>
  162. <result column="is_deleted" property="isDeleted"/>
  163. <result column="project_id" property="projectId"/>
  164. <result column="contract_id" property="contractId"/>
  165. <result column="node_id" property="nodeId"/>
  166. <result column="file_number" property="fileNumber"/>
  167. <result column="file_name" property="fileName"/>
  168. <result column="file_time" property="fileTime"/>
  169. <result column="file_url" property="fileUrl"/>
  170. <result column="file_page" property="filePage"/>
  171. <result column="is_approval" property="isApproval"/>
  172. <result column="is_certification" property="isCertification"/>
  173. <result column="certification_time" property="certificationTime"/>
  174. <result column="is_need_certification" property="isNeedCertification"/>
  175. <result column="duty_user" property="dutyUser"/>
  176. <result column="pdf_file_url" property="pdfFileUrl"/>
  177. <result column="sheet_type" property="sheetType"/>
  178. <result column="sheet_source" property="sheetSource"/>
  179. <result column="drawing_no" property="drawingNo"/>
  180. <result column="cite_change_number" property="citeChangeNumber"/>
  181. <result column="e_visa_file" property="eVisaFile"/>
  182. <result column="node_ext_id" property="nodeExtId"/>
  183. <result column="file_type" property="fileType"/>
  184. <result column="archive_id" property="archiveId"/>
  185. <result column="origin_id" property="originId"/>
  186. <result column="filming_time" property="filmingTime"/>
  187. <result column="filmingor_time" property="filmingorTime"/>
  188. <result column="tag_id" property="tagId"/>
  189. <result column="pic_code" property="picCode"/>
  190. <result column="refer_code" property="referCode"/>
  191. <result column="film_code" property="filmCode"/>
  192. <result column="width" property="width"/>
  193. <result column="height" property="height"/>
  194. <result column="ftime" property="ftime"/>
  195. <result column="utime" property="utime"/>
  196. <result column="del_time" property="delTime"/>
  197. <result column="sort" property="sort"/>
  198. <result column="box_name" property="boxName"/>
  199. <result column="box_number" property="boxNumber"/>
  200. <result column="is_auto_file" property="isAutoFile"/>
  201. <result column="is_archive" property="isArchive"/>
  202. <result column="page_num" property="pageNum"/>
  203. <result column="file_size" property="fileSize"/>
  204. <result column="source_type" property="sourceType"/>
  205. <result column="is_element" property="isElement"/>
  206. <result column="pdf_page_url" property="pdfPageUrl"/>
  207. <result column="fid" property="fid"/>
  208. <result column="rectification" property="rectification"/>
  209. <result column="m_wbs_tree_contract_p_key_id" property="mWbsTreeContractPKeyId"/>
  210. <result column="u_image_classification_file_id" property="uImageClassificationFileId"/>
  211. <result column="out_id" property="outId"/>
  212. <result column="sort_num" property="sortNum"/>
  213. </resultMap>
  214. <select id="approvalFile" resultType="org.springblade.archive.vo.ArchivesAutoVO$ApprovalFile">
  215. <if test="archiveId!=null">
  216. select * from u_archive_file where archive_id = #{archiveId} and is_element = 0 order by sort
  217. </if>
  218. </select>
  219. <select id="selectArchivesAutoPage" resultMap="archivesAutoResultMap">
  220. select *
  221. from u_archives_auto
  222. where is_deleted = 0
  223. </select>
  224. <select id="selectArchivesAutoFileCount" resultType="java.lang.Integer">
  225. select count(id) from u_archives_auto u where u.is_deleted = 0
  226. <if test="vo.projectId != null and vo.projectId != ''">
  227. and u.project_id = #{vo.projectId}
  228. </if>
  229. <if test="vo.queryValue != null and vo.queryValue != ''">
  230. and (u.name like concat('%',#{vo.queryValue},'%') or u.file_number like concat('%',#{vo.queryValue},'%'))
  231. </if>
  232. <if test="vo.isAutoFile != null and vo.isAutoFile != ''">
  233. and u.is_auto_file = #{vo.isAutoFile}
  234. </if>
  235. <choose>
  236. <when test="vo.isArchive != null and vo.isArchive != ''">
  237. and u.is_archive = #{vo.isArchive}
  238. </when>
  239. <otherwise>
  240. and (u.is_archive is null or u.is_archive != 1)
  241. </otherwise>
  242. </choose>
  243. <if test="vo.isAutoFile != null and vo.isAutoFile != ''">
  244. and u.is_auto_file = #{vo.isAutoFile}
  245. </if>
  246. <if test="vo.nodeIds != null and vo.nodeIds != ''">
  247. and u.node_id in
  248. <foreach collection="vo.nodeIdArray" item="nodeId" open="(" separator="," close=")">
  249. #{nodeId}
  250. </foreach>
  251. </if>
  252. </select>
  253. <select id="selectArchivesAutoFilePage" resultMap="archivesAutoResultMap">
  254. select * from u_archives_auto u LEFT JOIN m_archive_tree_contract m ON u.node_id = m.id where u.is_deleted = 0
  255. <if test="vo.projectId != null and vo.projectId != ''">
  256. and u.project_id = #{vo.projectId}
  257. </if>
  258. <if test="vo.queryValue != null and vo.queryValue != ''">
  259. and (u.name like concat('%',#{vo.queryValue},'%') or u.file_number like concat('%',#{vo.queryValue},'%'))
  260. </if>
  261. <choose>
  262. <when test="vo.isArchive != null and vo.isArchive != ''">
  263. and u.is_archive = #{vo.isArchive}
  264. </when>
  265. <otherwise>
  266. and (u.is_archive is null or u.is_archive != 1)
  267. </otherwise>
  268. </choose>
  269. <if test="vo.isAutoFile != null and vo.isAutoFile != ''">
  270. and u.is_auto_file = #{vo.isAutoFile}
  271. </if>
  272. <if test="vo.nodeIds != null and vo.nodeIds != ''">
  273. and u.node_id in
  274. <foreach collection="vo.nodeIdArray" item="nodeId" open="(" separator="," close=")">
  275. #{nodeId}
  276. </foreach>
  277. </if>
  278. order by m.tree_sort,u.auto_file_sort is null ,u.auto_file_sort,u.file_number is null,
  279. SUBSTRING_INDEX(u.file_number, '_', 1), SUBSTRING_INDEX(u.file_number, '_', -1) + 0 ,u.create_time asc
  280. limit #{current}, #{size}
  281. </select>
  282. <select id="selectArchivesAutoFilePageZero" resultMap="archivesAutoResultMap">
  283. select * from u_archives_auto u LEFT JOIN m_archive_tree_contract m ON u.node_id = m.id
  284. where u.is_deleted = 0 and u.page_n = 0
  285. <if test="vo.projectId != null and vo.projectId != ''">
  286. and u.project_id = #{vo.projectId}
  287. </if>
  288. <if test="vo.queryValue != null and vo.queryValue != ''">
  289. and (u.name like concat('%',#{vo.queryValue},'%') or u.file_number like concat('%',#{vo.queryValue},'%'))
  290. </if>
  291. <choose>
  292. <when test="vo.isArchive != null and vo.isArchive != ''">
  293. and u.is_archive = #{vo.isArchive}
  294. </when>
  295. <otherwise>
  296. and (u.is_archive is null or u.is_archive != 1)
  297. </otherwise>
  298. </choose>
  299. <if test="vo.isAutoFile != null and vo.isAutoFile != ''">
  300. and u.is_auto_file = #{vo.isAutoFile}
  301. </if>
  302. <if test="vo.nodeIds != null and vo.nodeIds != ''">
  303. and u.node_id in
  304. <foreach collection="vo.nodeIdArray" item="nodeId" open="(" separator="," close=")">
  305. #{nodeId}
  306. </foreach>
  307. </if>
  308. order by m.tree_sort,u.auto_file_sort is null ,u.auto_file_sort,u.file_number is null,
  309. SUBSTRING_INDEX(u.file_number, '_', 1), SUBSTRING_INDEX(u.file_number, '_', -1) + 0 ,u.create_time asc
  310. limit #{current}, #{size}
  311. </select>
  312. <update id="updateArchivesAutoFileByNodeId">
  313. update u_archives_auto set node_id = #{nodeId},tree_sort = #{nodeSort} where
  314. id in
  315. <foreach collection="ids" item="id" open="(" separator="," close=")">
  316. #{id}
  317. </foreach>
  318. </update>
  319. <update id="splitArchvies">
  320. /**把未锁定案卷的文件关联去掉*/
  321. update u_archive_file
  322. set archive_id = null,
  323. is_archive=0
  324. where is_deleted = 0
  325. and archive_id in (
  326. select id
  327. from u_archives_auto
  328. where project_id = #{projectId}
  329. and is_auto_file
  330. !=1
  331. and is_deleted=0
  332. and is_lock!=1
  333. );
  334. /**把未锁定案卷去掉*/
  335. update u_archives_auto
  336. set is_deleted=1
  337. where project_id = #{projectId}
  338. and is_auto_file!=1
  339. and is_deleted=0
  340. and is_lock!=1;
  341. </update>
  342. <update id="splitArchviesByContract">
  343. update u_archive_file
  344. set archive_id = null,
  345. is_archive=0
  346. WHERE is_deleted = 0
  347. AND archive_id IN (
  348. select id
  349. from u_archives_auto
  350. where project_id = #{projectId}
  351. and is_auto_file!=1
  352. and is_deleted=0
  353. and is_lock!=1
  354. and node_id in (
  355. SELECT id FROM m_archive_tree_contract
  356. WHERE project_id = #{projectId}
  357. <if test="contractId == null">
  358. AND ( contract_id is null OR tree_code = #{treeCode} )
  359. </if>
  360. <if test="contractId != null">
  361. AND ( contract_id = #{contractId} OR tree_code = #{treeCode} )
  362. </if>
  363. )
  364. );
  365. update u_archives_auto
  366. set is_deleted=1
  367. where project_id = #{projectId}
  368. and is_auto_file!=1
  369. and is_deleted=0
  370. and is_lock!=1
  371. and node_id in (
  372. SELECT id FROM m_archive_tree_contract
  373. WHERE project_id = #{projectId}
  374. <if test="contractId == null">
  375. AND ( contract_id is null OR tree_code = #{treeCode} )
  376. </if>
  377. <if test="contractId != null">
  378. AND ( contract_id = #{contractId} OR tree_code = #{treeCode} )
  379. </if>
  380. );
  381. </update>
  382. <update id="splitArchviesByNode">
  383. update u_archive_file
  384. set archive_id = null,
  385. is_archive=0
  386. WHERE is_deleted = 0
  387. AND archive_id IN (
  388. SELECT id
  389. FROM u_archives_auto
  390. WHERE project_id = #{projectId}
  391. AND is_auto_file
  392. != 1
  393. AND is_deleted = 0
  394. AND is_lock != 1
  395. AND node_id IN (
  396. SELECT id FROM m_archive_tree_contract
  397. WHERE
  398. is_deleted = 0
  399. AND project_id = #{projectId}
  400. AND ancestors IS NOT NULL
  401. AND ancestors LIKE concat(''
  402. , #{ancestors}
  403. , '%')
  404. OR id = #{nodeId}
  405. )
  406. );
  407. update u_archives_auto
  408. set is_deleted=1
  409. where project_id = #{projectId}
  410. AND is_auto_file != 1
  411. AND is_deleted = 0
  412. AND is_lock != 1
  413. AND node_id IN (
  414. SELECT id FROM m_archive_tree_contract
  415. WHERE
  416. is_deleted = 0 AND project_id = #{projectId}
  417. AND ancestors IS NOT NULL
  418. AND ancestors LIKE concat(''
  419. , #{ancestors}
  420. , '%')
  421. OR id = #{nodeId}
  422. );
  423. </update>
  424. <select id="getFilePageUrlList" resultType="java.lang.String">
  425. select pdf_page_url
  426. from u_archive_file
  427. where is_deleted = 0 and pdf_page_url!= file_url
  428. and archive_id in (
  429. select id
  430. from u_archives_auto
  431. where project_id = #{projectId}
  432. and is_auto_file
  433. !=1
  434. and is_deleted=0
  435. and is_lock!=1
  436. )
  437. </select>
  438. <select id="getFilePageUrlListByContract" resultType="java.lang.String">
  439. select pdf_page_url
  440. from u_archive_file
  441. where is_deleted = 0 and pdf_page_url!= file_url
  442. and archive_id in (
  443. select id
  444. from u_archives_auto
  445. where project_id = #{projectId}
  446. and is_auto_file
  447. !=1
  448. and is_deleted=0
  449. and is_lock!=1
  450. and node_id in (
  451. SELECT id FROM m_archive_tree_contract
  452. WHERE is_deleted = 0
  453. AND project_id = #{projectId}
  454. AND ( contract_id = #{contractId}
  455. OR tree_code = #{treeCode} )
  456. )
  457. );
  458. </select>
  459. <select id="getFilePageUrlListByNode" resultType="java.lang.String">
  460. select pdf_page_url
  461. from u_archive_file
  462. where is_deleted = 0 and pdf_page_url!= file_url
  463. and archive_id in (
  464. SELECT id
  465. FROM u_archives_auto
  466. WHERE project_id = #{projectId}
  467. AND is_auto_file
  468. != 1
  469. AND is_deleted = 0
  470. AND is_lock != 1
  471. AND node_id IN (
  472. SELECT id FROM m_archive_tree_contract
  473. WHERE
  474. is_deleted = 0
  475. AND project_id = #{projectId}
  476. AND ancestors IS NOT NULL
  477. AND ancestors LIKE concat(''
  478. , #{ancestors}
  479. , '%')
  480. OR id = #{nodeId}
  481. )
  482. );
  483. </select>
  484. <select id="getArchivesOutUrlList" resultType="java.lang.String">
  485. select out_url
  486. from u_archives_auto
  487. where project_id = #{projectId}
  488. and is_auto_file!=1
  489. and is_deleted=0
  490. and is_lock!=1
  491. </select>
  492. <select id="getArchivesOutUrlListByContract" resultType="java.lang.String">
  493. select out_url
  494. from u_archives_auto
  495. where project_id = #{projectId}
  496. and is_auto_file!=1
  497. and is_deleted=0
  498. and is_lock!=1
  499. and node_id in (
  500. SELECT id FROM m_archive_tree_contract
  501. WHERE project_id = #{projectId}
  502. <if test="contractId == null">
  503. AND ( contract_id is null OR tree_code = #{treeCode} )
  504. </if>
  505. <if test="contractId != null">
  506. AND ( contract_id = #{contractId} OR tree_code = #{treeCode} )
  507. </if>
  508. )
  509. </select>
  510. <select id="getArchivesOutUrlListByNode" resultType="java.lang.String">
  511. select out_url
  512. from u_archives_auto
  513. where project_id = #{projectId}
  514. AND is_auto_file != 1
  515. AND is_deleted = 0
  516. AND is_lock != 1
  517. AND node_id IN (
  518. SELECT id FROM m_archive_tree_contract
  519. WHERE project_id = #{projectId}
  520. AND ancestors IS NOT NULL
  521. AND ancestors LIKE concat(''
  522. , #{ancestors}
  523. , '%')
  524. OR id = #{nodeId}
  525. )
  526. </select>
  527. <select id="getListByProjectId" resultType="org.springblade.archive.dto.ArchivesAutoDTO">
  528. select *
  529. from u_archives_auto
  530. where project_id = #{projectId} and is_deleted = 0;
  531. </select>
  532. <select id="pageByArchivesAuto" resultMap="archivesAutoResultMap">
  533. select uaa.*
  534. from m_archive_tree_contract matc left join u_archives_auto uaa on matc.id = uaa.node_id left join
  535. u_archive_file uaf on uaa.id = uaf.archive_id
  536. where uaa.is_deleted = 0 and uaa.is_archive = 1
  537. and matc.project_id = #{vo.projectId}
  538. <if test="vo.contractId != null and vo.contractId != ''">
  539. and uaa.contract_id = #{vo.contractId} and matc.contract_id = #{vo.contractId}
  540. </if>
  541. <if test="vo.searchType == 1 and vo.queryValue != null and vo.queryValue != ''">
  542. and uaa.name like concat('%',#{vo.queryValue},'%')
  543. </if>
  544. <if test="vo.searchType == 2 and vo.queryValue != null and vo.queryValue != ''">
  545. and uaf.file_name like concat('%',#{vo.queryValue},'%')
  546. </if>
  547. <if test="vo.storageTimes != null and vo.storageTimes != ''">
  548. and uaa.storage_time in
  549. <foreach collection="vo.storageTimes" item="storageTime" open="(" separator="," close=")">
  550. #{storageTime}
  551. </foreach>
  552. </if>
  553. <if test="vo.secretLevels != null and vo.secretLevels != ''">
  554. and uaa.secret_level in
  555. <foreach collection="vo.secretLevels" item="secretLevel" open="(" separator="," close=")">
  556. #{secretLevel}
  557. </foreach>
  558. </if>
  559. <if test="vo.carrierTypes != null and vo.carrierTypes != ''">
  560. and uaa.carrier_type in
  561. <foreach collection="vo.carrierTypes" item="carrierType" open="(" separator="," close=")">
  562. #{carrierType}
  563. </foreach>
  564. </if>
  565. <if test="vo.years != null and vo.years != ''">
  566. and
  567. <foreach collection="vo.years" item="year" separator=" or" open="(" close=")">
  568. #{year} BETWEEN DATE_FORMAT(uaa.start_date,'%Y') and DATE_FORMAT(uaa.end_date ,'%Y')
  569. </foreach>
  570. </if>
  571. <if test="vo.months != null and vo.months != ''">
  572. and
  573. <foreach collection="vo.months" item="month" separator=" or" open="(" close=")">
  574. #{month} BETWEEN DATE_FORMAT(uaa.start_date,'%c') and DATE_FORMAT(uaa.end_date ,'%c')
  575. </foreach>
  576. </if>
  577. GROUP BY uaa.id
  578. order by uaa.tree_sort,uaa.auto_file_sort,uaa.file_number asc
  579. </select>
  580. <select id="pageByArchivesAuto11" resultMap="archivesAutoResultMap">
  581. select uaa.*
  582. from m_archive_tree_contract matc left join u_archives_auto uaa on matc.id = uaa.node_id
  583. where uaa.is_deleted = 0 and uaa.is_archive = 1
  584. <if test="vo.queryValue != null and vo.queryValue != ''">
  585. and (uaa.name like concat('%',#{vo.queryValue},'%') or uaa.file_number like concat('%',#{vo.queryValue},'%'))
  586. </if>
  587. <if test="vo.searchType == 1 and vo.queryList != null and vo.queryList.size > 0">
  588. and (
  589. <foreach collection="vo.queryList" item="query" separator="or" >
  590. uaa.name like concat('%',#{query},'%')
  591. </foreach>
  592. )
  593. </if>
  594. and matc.project_id = #{vo.projectId}
  595. <if test="vo.contractId != null and vo.contractId != ''">
  596. and uaa.contract_id = #{vo.contractId} and matc.contract_id = #{vo.contractId}
  597. </if>
  598. <if test="vo.storageTimes != null and vo.storageTimes != ''">
  599. and uaa.storage_time in
  600. <foreach collection="vo.storageTimes" item="storageTime" open="(" separator="," close=")">
  601. #{storageTime}
  602. </foreach>
  603. </if>
  604. <if test="vo.secretLevels != null and vo.secretLevels != ''">
  605. and uaa.secret_level in
  606. <foreach collection="vo.secretLevels" item="secretLevel" open="(" separator="," close=")">
  607. #{secretLevel}
  608. </foreach>
  609. </if>
  610. <if test="vo.carrierTypes != null and vo.carrierTypes != ''">
  611. and uaa.carrier_type in
  612. <foreach collection="vo.carrierTypes" item="carrierType" open="(" separator="," close=")">
  613. #{carrierType}
  614. </foreach>
  615. </if>
  616. <if test="vo.years != null and vo.years != ''">
  617. and
  618. <foreach collection="vo.years" item="year" separator=" or" open="(" close=")">
  619. #{year} BETWEEN DATE_FORMAT(uaa.start_date,'%Y') and DATE_FORMAT(uaa.end_date ,'%Y')
  620. </foreach>
  621. </if>
  622. <if test="vo.months != null and vo.months != ''">
  623. and
  624. <foreach collection="vo.months" item="month" separator=" or" open="(" close=")">
  625. #{month} BETWEEN DATE_FORMAT(uaa.start_date,'%c') and DATE_FORMAT(uaa.end_date ,'%c')
  626. </foreach>
  627. </if>
  628. GROUP BY uaa.id
  629. order by uaa.tree_sort,uaa.auto_file_sort,uaa.file_number asc
  630. </select>
  631. <select id="pageByArchivesAuto2" resultMap="archivesAutoResultMap">
  632. select uaa.* from
  633. (SELECT id FROM m_archive_tree_contract WHERE project_id =#{vo.projectId}
  634. and 1=2
  635. <foreach collection="vo.nodeIdArray" item="nodeId">
  636. or ancestors like concat('%',#{nodeId},'%') or id = #{nodeId}
  637. </foreach>
  638. ) matc left join u_archives_auto uaa on matc.id = uaa.node_id left join u_archive_file uaf on uaa.id =
  639. uaf.archive_id
  640. where uaa.is_deleted = 0 and uaa.is_archive = 1
  641. <if test="vo.contractId != null and vo.contractId != ''">
  642. and uaa.contract_id = #{vo.contractId}
  643. </if>
  644. <if test="vo.searchType == 1 and vo.queryValue != null and vo.queryValue != ''">
  645. and uaa.name like concat('%',#{vo.queryValue},'%')
  646. </if>
  647. <if test="vo.searchType == 1 and vo.queryList != null and vo.queryList.size > 0">
  648. and (
  649. <foreach collection="vo.queryList" item="query" separator="or" >
  650. uaa.name like concat('%',#{query},'%')
  651. </foreach>
  652. )
  653. </if>
  654. <if test="vo.searchType == 2 and vo.queryValue != null and vo.queryValue != ''">
  655. and uaf.file_name like concat('%',#{vo.queryValue},'%')
  656. </if>
  657. <if test="vo.storageTimes != null and vo.storageTimes != ''">
  658. and uaa.storage_time in
  659. <foreach collection="vo.storageTimes" item="storageTime" open="(" separator="," close=")">
  660. #{storageTime}
  661. </foreach>
  662. </if>
  663. <if test="vo.secretLevels != null and vo.secretLevels != ''">
  664. and uaa.secret_level in
  665. <foreach collection="vo.secretLevels" item="secretLevel" open="(" separator="," close=")">
  666. #{secretLevel}
  667. </foreach>
  668. </if>
  669. <if test="vo.carrierTypes != null and vo.carrierTypes != ''">
  670. and uaa.carrier_type in
  671. <foreach collection="vo.carrierTypes" item="carrierType" open="(" separator="," close=")">
  672. #{carrierType}
  673. </foreach>
  674. </if>
  675. <if test="vo.years != null and vo.years != ''">
  676. and
  677. <foreach collection="vo.years" item="year" separator=" or" open="(" close=")">
  678. #{year} BETWEEN DATE_FORMAT(uaa.start_date,'%Y') and DATE_FORMAT(uaa.end_date ,'%Y')
  679. </foreach>
  680. </if>
  681. <if test="vo.months != null and vo.months != ''">
  682. and
  683. <foreach collection="vo.months" item="month" separator=" or" open="(" close=")">
  684. #{month} BETWEEN DATE_FORMAT(uaa.start_date,'%c') and DATE_FORMAT(uaa.end_date ,'%c')
  685. </foreach>
  686. </if>
  687. GROUP BY uaa.id
  688. order by uaa.tree_sort,uaa.auto_file_sort,uaa.file_number asc
  689. </select>
  690. <select id="pageByArchivesAuto22" resultMap="archivesAutoResultMap">
  691. select uaa.* from
  692. (SELECT id FROM m_archive_tree_contract WHERE project_id =#{vo.projectId}
  693. and 1=2
  694. <foreach collection="vo.nodeIdArray" item="nodeId">
  695. or ancestors like concat('%',#{nodeId},'%') or id = #{nodeId}
  696. </foreach>
  697. ) matc left join u_archives_auto uaa on matc.id = uaa.node_id
  698. where uaa.is_deleted = 0 and uaa.is_archive = 1
  699. <if test="vo.queryValue != null and vo.queryValue != ''">
  700. and (uaa.name like concat('%',#{vo.queryValue},'%') or uaa.file_number like concat('%',#{vo.queryValue},'%'))
  701. </if>
  702. <if test="vo.contractId != null and vo.contractId != ''">
  703. and uaa.contract_id = #{vo.contractId}
  704. </if>
  705. <if test="vo.storageTimes != null and vo.storageTimes != ''">
  706. and uaa.storage_time in
  707. <foreach collection="vo.storageTimes" item="storageTime" open="(" separator="," close=")">
  708. #{storageTime}
  709. </foreach>
  710. </if>
  711. <if test="vo.secretLevels != null and vo.secretLevels != ''">
  712. and uaa.secret_level in
  713. <foreach collection="vo.secretLevels" item="secretLevel" open="(" separator="," close=")">
  714. #{secretLevel}
  715. </foreach>
  716. </if>
  717. <if test="vo.carrierTypes != null and vo.carrierTypes != ''">
  718. and uaa.carrier_type in
  719. <foreach collection="vo.carrierTypes" item="carrierType" open="(" separator="," close=")">
  720. #{carrierType}
  721. </foreach>
  722. </if>
  723. <if test="vo.years != null and vo.years != ''">
  724. and
  725. <foreach collection="vo.years" item="year" separator=" or" open="(" close=")">
  726. #{year} BETWEEN DATE_FORMAT(uaa.start_date,'%Y') and DATE_FORMAT(uaa.end_date ,'%Y')
  727. </foreach>
  728. </if>
  729. <if test="vo.months != null and vo.months != ''">
  730. and
  731. <foreach collection="vo.months" item="month" separator=" or" open="(" close=")">
  732. #{month} BETWEEN DATE_FORMAT(uaa.start_date,'%c') and DATE_FORMAT(uaa.end_date ,'%c')
  733. </foreach>
  734. </if>
  735. GROUP BY uaa.id
  736. order by uaa.tree_sort,uaa.auto_file_sort,uaa.file_number asc
  737. </select>
  738. <select id="pageByArchivesAuto3" resultMap="archivesAutoResultMap">
  739. select uaa.id,uaa.name,uaa.file_number,uaa.unit,uaa.storage_time,uaa.secret_level,uaa.start_date,uaa.end_date
  740. from
  741. (SELECT id FROM m_archive_tree_contract WHERE project_id =#{vo.projectId}
  742. and ancestors like concat('%',#{vo.nodeId},'%')
  743. ) matc left join u_archives_auto uaa on matc.id = uaa.node_id
  744. where uaa.is_deleted = 0 and uaa.is_archive = 1
  745. <if test="vo.contractId != null and vo.contractId != ''">
  746. and uaa.contract_id = #{vo.contractId}
  747. </if>
  748. GROUP BY uaa.id
  749. order by uaa.tree_sort,uaa.auto_file_sort,uaa.file_number asc
  750. </select>
  751. <select id="pageByArchivesAuto4" resultMap="archivesAutoResultMap">
  752. select uaa.id from
  753. (SELECT id FROM m_archive_tree_contract WHERE project_id =#{vo.projectId}
  754. and ancestors like concat('%',#{vo.nodeId},'%')
  755. ) matc left join u_archives_auto uaa on matc.id = uaa.node_id
  756. where uaa.is_deleted = 0 and uaa.is_archive = 1
  757. <if test="vo.contractId != null and vo.contractId != ''">
  758. and uaa.contract_id = #{vo.contractId}
  759. </if>
  760. <if test="vo.searchType == 1 and vo.queryValue != null and vo.queryValue != ''">
  761. and uaa.name like concat('%',#{vo.queryValue},'%') or uaa.file_number like concat('%',#{vo.queryValue},'%')
  762. </if>
  763. <if test="vo.storageTimes != null and vo.storageTimes != ''">
  764. and uaa.storage_time in
  765. <foreach collection="vo.storageTimes" item="storageTime" open="(" separator="," close=")">
  766. #{storageTime}
  767. </foreach>
  768. </if>
  769. <if test="vo.secretLevels != null and vo.secretLevels != ''">
  770. and uaa.secret_level in
  771. <foreach collection="vo.secretLevels" item="secretLevel" open="(" separator="," close=")">
  772. #{secretLevel}
  773. </foreach>
  774. </if>
  775. <if test="vo.carrierTypes != null and vo.carrierTypes != ''">
  776. and uaa.carrier_type in
  777. <foreach collection="vo.carrierTypes" item="carrierType" open="(" separator="," close=")">
  778. #{carrierType}
  779. </foreach>
  780. </if>
  781. <if test="vo.years != null and vo.years != ''">
  782. and
  783. <foreach collection="vo.years" item="year" separator=" or" open="(" close=")">
  784. #{year} BETWEEN DATE_FORMAT(uaa.start_date,'%Y') and DATE_FORMAT(uaa.end_date ,'%Y')
  785. </foreach>
  786. </if>
  787. <if test="vo.months != null and vo.months != ''">
  788. and
  789. <foreach collection="vo.months" item="month" separator=" or" open="(" close=")">
  790. #{month} BETWEEN DATE_FORMAT(uaa.start_date,'%c') and DATE_FORMAT(uaa.end_date ,'%c')
  791. </foreach>
  792. </if>
  793. GROUP BY uaa.id
  794. order by uaa.tree_sort,uaa.auto_file_sort,uaa.file_number asc
  795. </select>
  796. <select id="pageByArchivesAuto5" resultMap="archivesAutoResultMap">
  797. select uaa.id from
  798. (SELECT id FROM m_archive_tree_contract WHERE project_id =#{vo.projectId}
  799. and ancestors like concat('%',#{vo.nodeId},'%')
  800. ) matc left join u_archives_auto uaa on matc.id = uaa.node_id left join u_archive_file uaf on uaa.id =
  801. uaf.archive_id
  802. where uaa.is_deleted = 0 and uaa.is_archive = 1
  803. <if test="vo.contractId != null and vo.contractId != ''">
  804. and uaa.contract_id = #{vo.contractId}
  805. </if>
  806. <if test="vo.searchType == 2 and vo.queryValue != null and vo.queryValue != ''">
  807. and uaf.file_name like concat('%',#{vo.queryValue},'%')
  808. </if>
  809. <if test="vo.storageTimes != null and vo.storageTimes != ''">
  810. and uaa.storage_time in
  811. <foreach collection="vo.storageTimes" item="storageTime" open="(" separator="," close=")">
  812. #{storageTime}
  813. </foreach>
  814. </if>
  815. <if test="vo.secretLevels != null and vo.secretLevels != ''">
  816. and uaa.secret_level in
  817. <foreach collection="vo.secretLevels" item="secretLevel" open="(" separator="," close=")">
  818. #{secretLevel}
  819. </foreach>
  820. </if>
  821. <if test="vo.carrierTypes != null and vo.carrierTypes != ''">
  822. and uaa.carrier_type in
  823. <foreach collection="vo.carrierTypes" item="carrierType" open="(" separator="," close=")">
  824. #{carrierType}
  825. </foreach>
  826. </if>
  827. <if test="vo.years != null and vo.years != ''">
  828. and
  829. <foreach collection="vo.years" item="year" separator=" or" open="(" close=")">
  830. #{year} BETWEEN DATE_FORMAT(uaa.start_date,'%Y') and DATE_FORMAT(uaa.end_date ,'%Y')
  831. </foreach>
  832. </if>
  833. <if test="vo.months != null and vo.months != ''">
  834. and
  835. <foreach collection="vo.months" item="month" separator=" or" open="(" close=")">
  836. #{month} BETWEEN DATE_FORMAT(uaa.start_date,'%c') and DATE_FORMAT(uaa.end_date ,'%c')
  837. </foreach>
  838. </if>
  839. GROUP BY uaa.id
  840. order by uaa.tree_sort,uaa.auto_file_sort,uaa.file_number asc
  841. </select>
  842. <select id="getArchivesCabinet" resultMap="archivesAutoResultMap">
  843. select uaa.id,uaa.name,uaa.file_number,uaa.unit from
  844. (SELECT id FROM m_archive_tree_contract WHERE project_id =#{vo.projectId}
  845. and ancestors like concat('%',#{vo.nodeId},'%')
  846. ) matc left join u_archives_auto uaa on matc.id = uaa.node_id
  847. where uaa.is_deleted = 0 and uaa.is_archive = 1
  848. <if test="vo.contractId != null and vo.contractId != ''">
  849. and uaa.contract_id = #{vo.contractId}
  850. </if>
  851. GROUP BY uaa.id
  852. order by uaa.tree_sort,uaa.auto_file_sort,uaa.file_number asc
  853. -- order by uaa.id
  854. </select>
  855. <select id="getArchivesCabinet2" resultMap="archivesAutoResultMap">
  856. select uaa.id from
  857. (SELECT id FROM m_archive_tree_contract WHERE project_id =#{vo.projectId}
  858. and ancestors like concat('%',#{vo.nodeId},'%')
  859. ) matc left join u_archives_auto uaa on matc.id = uaa.node_id
  860. where uaa.is_deleted = 0 and uaa.is_archive = 1
  861. <if test="vo.contractId != null and vo.contractId != ''">
  862. and uaa.contract_id = #{vo.contractId}
  863. </if>
  864. <if test="vo.searchType == 1 and vo.queryValue != null and vo.queryValue != ''">
  865. and uaa.name like concat('%',#{vo.queryValue},'%')
  866. </if>
  867. <if test="vo.storageTimes != null and vo.storageTimes != ''">
  868. and uaa.storage_time in
  869. <foreach collection="vo.storageTimes" item="storageTime" open="(" separator="," close=")">
  870. #{storageTime}
  871. </foreach>
  872. </if>
  873. <if test="vo.secretLevels != null and vo.secretLevels != ''">
  874. and uaa.secret_level in
  875. <foreach collection="vo.secretLevels" item="secretLevel" open="(" separator="," close=")">
  876. #{secretLevel}
  877. </foreach>
  878. </if>
  879. <if test="vo.carrierTypes != null and vo.carrierTypes != ''">
  880. and uaa.carrier_type in
  881. <foreach collection="vo.carrierTypes" item="carrierType" open="(" separator="," close=")">
  882. #{carrierType}
  883. </foreach>
  884. </if>
  885. <if test="vo.years != null and vo.years != ''">
  886. and
  887. <foreach collection="vo.years" item="year" separator=" or" open="(" close=")">
  888. #{year} BETWEEN DATE_FORMAT(uaa.start_date,'%Y') and DATE_FORMAT(uaa.end_date ,'%Y')
  889. </foreach>
  890. </if>
  891. <if test="vo.months != null and vo.months != ''">
  892. and
  893. <foreach collection="vo.months" item="month" separator=" or" open="(" close=")">
  894. #{month} BETWEEN DATE_FORMAT(uaa.start_date,'%c') and DATE_FORMAT(uaa.end_date ,'%c')
  895. </foreach>
  896. </if>
  897. GROUP BY uaa.id
  898. order by uaa.tree_sort,uaa.auto_file_sort,uaa.file_number asc
  899. -- order by uaa.id
  900. </select>
  901. <select id="getArchivesCabinet22" resultMap="archivesAutoResultMap">
  902. select uaa.id from
  903. (SELECT id FROM m_archive_tree_contract WHERE project_id =#{vo.projectId}
  904. and ancestors like concat('%',#{vo.nodeId},'%')
  905. ) matc left join u_archives_auto uaa on matc.id = uaa.node_id left join u_archive_file uaf on uaa.id =
  906. uaf.archive_id
  907. where uaa.is_deleted = 0 and uaa.is_archive = 1
  908. <if test="vo.contractId != null and vo.contractId != ''">
  909. and uaa.contract_id = #{vo.contractId}
  910. </if>
  911. <if test="vo.searchType == 1 and vo.queryValue != null and vo.queryValue != ''">
  912. and uaa.name like concat('%',#{vo.queryValue},'%')
  913. </if>
  914. <if test="vo.searchType == 2 and vo.queryValue != null and vo.queryValue != ''">
  915. and uaf.file_name like concat('%',#{vo.queryValue},'%')
  916. </if>
  917. <if test="vo.storageTimes != null and vo.storageTimes != ''">
  918. and uaa.storage_time in
  919. <foreach collection="vo.storageTimes" item="storageTime" open="(" separator="," close=")">
  920. #{storageTime}
  921. </foreach>
  922. </if>
  923. <if test="vo.secretLevels != null and vo.secretLevels != ''">
  924. and uaa.secret_level in
  925. <foreach collection="vo.secretLevels" item="secretLevel" open="(" separator="," close=")">
  926. #{secretLevel}
  927. </foreach>
  928. </if>
  929. <if test="vo.carrierTypes != null and vo.carrierTypes != ''">
  930. and uaa.carrier_type in
  931. <foreach collection="vo.carrierTypes" item="carrierType" open="(" separator="," close=")">
  932. #{carrierType}
  933. </foreach>
  934. </if>
  935. <if test="vo.years != null and vo.years != ''">
  936. and
  937. <foreach collection="vo.years" item="year" separator=" or" open="(" close=")">
  938. #{year} BETWEEN DATE_FORMAT(uaa.start_date,'%Y') and DATE_FORMAT(uaa.end_date ,'%Y')
  939. </foreach>
  940. </if>
  941. <if test="vo.months != null and vo.months != ''">
  942. and
  943. <foreach collection="vo.months" item="month" separator=" or" open="(" close=")">
  944. #{month} BETWEEN DATE_FORMAT(uaa.start_date,'%c') and DATE_FORMAT(uaa.end_date ,'%c')
  945. </foreach>
  946. </if>
  947. GROUP BY uaa.id
  948. order by uaa.tree_sort,uaa.auto_file_sort,uaa.file_number asc
  949. -- order by uaa.id
  950. </select>
  951. <select id="getAllArchiveByContractType" resultType="org.springblade.archive.vo.ArchivesAutoVO">
  952. SELECT uaa.id, matc.tree_code as 'contractType'
  953. FROM m_archive_tree_contract matc
  954. left join u_archives_auto uaa on uaa.node_id = matc.id
  955. WHERE uaa.project_id = #{projectId}
  956. and uaa.is_deleted = #{type}
  957. and uaa.is_destroy = #{type}
  958. </select>
  959. <select id="getAllArchiveAgeByContractType" resultType="java.util.Map">
  960. SELECT CASE uaa.storage_time WHEN '1' THEN '10年' WHEN '2' THEN '30年' ELSE '永久' END as name,
  961. COUNT(uaa.storage_time) as value
  962. FROM m_archive_tree_contract matc left join u_archives_auto uaa
  963. on uaa.node_id =matc.id
  964. WHERE matc.project_id =#{projectId} and uaa.is_deleted =0
  965. GROUP BY uaa.storage_time
  966. </select>
  967. <!-- 档案鉴定,档案查询-->
  968. <select id="pageByAuthenticate" resultType="org.springblade.archive.vo.ArchivesAutoVO">
  969. select uaa.id,uaa.file_number,uaa.name,uaa.file_size,CASE uaa.storage_time WHEN '1' THEN '10年' WHEN '2' THEN
  970. '30年' ELSE '永久' END as storageTimeValue
  971. from(
  972. select id from m_archive_tree_contract
  973. where project_id = #{vo.projectId} and ancestors like concat('%', #{vo.nodeId}, '%') and is_deleted = 0 or id =
  974. #{vo.nodeId}
  975. ) matc
  976. left join u_archives_auto uaa on matc.id = uaa.node_id
  977. where
  978. <if test="vo.isDeleted == 0">
  979. uaa.is_deleted = 0 and uaa.is_destroy = 0
  980. </if>
  981. <if test="vo.isDeleted == 1">
  982. uaa.is_deleted = 1 and uaa.is_destroy = 1
  983. </if>
  984. <if test="vo.storageTime != null and vo.storageTime != ''">
  985. and uaa.storage_time = #{vo.storageTime}
  986. </if>
  987. <if test="vo.filingUnit != null and vo.filingUnit != ''">
  988. and uaa.unit = #{vo.filingUnit}
  989. </if>
  990. <if test="vo.destroyUser != null and vo.destroyUser != ''">
  991. and uaa.update_user = #{vo.destroyUser}
  992. </if>
  993. <if test="vo.fileSizeValue != null and vo.fileSizeValue != ''">
  994. <if test="vo.fileSizeValue == '小于80M'">
  995. and uaa.file_size &lt; 81920
  996. </if>
  997. <if test="vo.fileSizeValue == '小于150M'">
  998. and uaa.file_size &lt; 153600
  999. </if>
  1000. <if test="vo.fileSizeValue == '小于200M'">
  1001. and uaa.file_size &lt; 204800
  1002. </if>
  1003. <if test="vo.fileSizeValue == '200M-500M'">
  1004. and uaa.file_size BETWEEN 204800 and 512000
  1005. </if>
  1006. <if test="vo.fileSizeValue == '大于500M'">
  1007. and uaa.file_size &gt; 512000
  1008. </if>
  1009. </if>
  1010. and uaa.is_archive = 1
  1011. order by uaa.tree_sort,uaa.auto_file_sort,uaa.file_number asc
  1012. </select>
  1013. <select id="getFilingUnitList" resultType="java.lang.String">
  1014. SELECT unit
  1015. FROM u_archives_auto
  1016. WHERE project_id = #{projectId}
  1017. and is_deleted = 0
  1018. AND unit is not NULL
  1019. GROUP BY unit
  1020. </select>
  1021. <select id="getCarrierTypeByDict" resultType="org.springblade.system.entity.DictBiz">
  1022. SELECT *
  1023. FROM blade_dict_biz
  1024. WHERE code = 'storage_type'
  1025. AND parent_id > 0
  1026. AND tenant_id = 000000
  1027. </select>
  1028. <select id="getUserRoleName" resultType="java.lang.String">
  1029. SELECT br.role_name
  1030. FROM blade_role br
  1031. WHERE br.id = (
  1032. SELECT role_id
  1033. FROM m_project_assignment_user
  1034. WHERE project_id = #{projectId}
  1035. AND contract_id = #{contractId}
  1036. AND user_id = #{userId}
  1037. )
  1038. </select>
  1039. <select id="getArchiveDestroyUser" resultType="org.springblade.system.user.entity.User">
  1040. SELECT id,real_name FROM blade_user WHERE id IN (SELECT uaa.update_user FROM u_archives_auto uaa
  1041. WHERE uaa.is_deleted = 1 AND uaa.is_destroy = 1 and project_id = #{projectId}
  1042. GROUP BY uaa.update_user )
  1043. </select>
  1044. <select id="getAllArchiveFileSize" resultType="java.lang.Long">
  1045. select sum(uaa.file_size) from u_archives_auto uaa WHERE uaa.project_id = #{projectId} and is_deleted = 0
  1046. </select>
  1047. <select id="getArchiveFileList" resultMap="archivesAutoResultMap2">
  1048. select *
  1049. from u_archives_auto uaa WHERE uaa.id = #{id} and is_deleted = 0
  1050. </select>
  1051. <select id="getUnitNodeByProjectId" resultType="org.springblade.manager.entity.ArchiveTreeContract">
  1052. SELECT matc1.*
  1053. FROM m_archive_tree_contract matc1
  1054. WHERE matc1.parent_id in (select id from m_archive_tree_contract
  1055. WHERE parent_id = (select id from m_archive_tree_contract WHERE parent_id = 0 and project_id = #{projectId} and is_deleted = 0)
  1056. and is_deleted = 0 and tree_code is NULL)
  1057. and matc1.is_deleted = 0
  1058. </select>
  1059. <select id="getUnitAllArchive" resultType="org.springblade.archive.vo.ArchivesAutoVO2">
  1060. select SUBSTRING_INDEX(SUBSTRING_INDEX(atc.ancestors,",",4),",",-1) as masterNode,uaa.*
  1061. from (select * from m_archive_tree_contract WHERE is_deleted = 0 and ancestors like concat('%',#{node},'%')) atc
  1062. join u_archives_auto uaa on atc.id = uaa.node_id and uaa.is_deleted = 0
  1063. </select>
  1064. <select id="batchSearchArchiveFile" resultType="org.springblade.business.entity.ArchiveFile">
  1065. select id,file_name,pdf_file_url,archive_id,project_id FROM u_archive_file
  1066. WHERE is_element = 0 and is_deleted = 0 and archive_id in
  1067. <foreach collection="ids" item="id" open="(" close=")" separator=",">
  1068. #{id}
  1069. </foreach>
  1070. </select>
  1071. <select id="searchArchiveFileByArchivesId" resultType="org.springblade.business.entity.ArchiveFile">
  1072. select * from u_archive_file where is_deleted = 0
  1073. <if test="ids != null and ids != ''">
  1074. and archive_id in
  1075. <foreach collection="ids" item="id" open="(" separator="," close=")">
  1076. #{id}
  1077. </foreach>
  1078. </if>
  1079. order by sort,create_time
  1080. </select>
  1081. <select id="getArchives" resultType="org.springblade.archive.entity.ArchivesAuto">
  1082. select id,name
  1083. from u_archives_auto
  1084. where id in
  1085. <foreach collection="ids" item="id" open="(" separator="," close=")">
  1086. #{id}
  1087. </foreach>
  1088. </select>
  1089. <select id="getUnitSecondNode" resultType="org.springblade.manager.entity.ArchiveTreeContract">
  1090. select * from m_archive_tree_contract WHERE is_deleted = 0 and parent_id = #{firstNode}
  1091. </select>
  1092. <select id="getTertiaryNode" resultType="org.springblade.manager.entity.ArchiveTreeContract">
  1093. select * from m_archive_tree_contract WHERE is_deleted = 0 and parent_id in
  1094. <foreach collection="ids" item="id" open="(" separator="," close=")">
  1095. #{id}
  1096. </foreach>
  1097. </select>
  1098. <select id="getUnitFirstNode" resultType="org.springblade.manager.entity.ArchiveTreeContract">
  1099. select * from m_archive_tree_contract WHERE is_deleted = 0 and parent_id =
  1100. (select id from m_archive_tree_contract
  1101. WHERE project_id = #{projectId} and is_deleted = 0 and parent_id = 0)
  1102. <if test="nodeType == null">
  1103. and tree_code is null
  1104. </if>
  1105. <if test="nodeType != null and nodeType != ''">
  1106. and tree_code = #{nodeType}
  1107. </if>
  1108. </select>
  1109. <select id="getUnitAllArchive2" resultType="org.springblade.archive.vo.ArchivesAutoVO2">
  1110. select
  1111. concat(matc.ancestors,',',matc.id) as ancestors,
  1112. uaa.id,uaa.name,uaa.page_n ,uaa.remark ,uaa.file_number,uaa.unit,uaa.start_date,uaa.end_date,
  1113. (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
  1114. from m_archive_tree_contract matc right join u_archives_auto uaa on matc.id = uaa.node_id
  1115. WHERE uaa.is_deleted = 0 and matc.is_deleted = 0 and uaa.is_apply = #{isApply} and matc.ancestors like concat("%",#{firstNode},"%")
  1116. order by uaa.tree_sort
  1117. </select>
  1118. <select id="getNodeArchives" resultType="org.springblade.archive.vo.ArchiveInspectVO">
  1119. select uaa.id ,uaa.file_number,uaa.name ,uaa.unit,
  1120. 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}
  1121. and aei.expert_id = #{userId}) > 0,'已抽检','未抽检') as inspectStatusName,
  1122. (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}
  1123. and aei.expert_id = #{userId} and is_pass = 1) = 1 then '合格'
  1124. 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}
  1125. and aei.expert_id = #{userId} and is_pass = 0) > 0 then '整改' else null end) as updateStatusName
  1126. from m_archive_tree_contract atc right join u_archives_auto uaa on atc.id = uaa.node_id
  1127. 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
  1128. and (atc.id =#{id} or FIND_IN_SET(#{id}, atc.ancestors))
  1129. <if test="searchValue != null and searchValue != ''">
  1130. <if test="searchType == 1">
  1131. and uaa.name like concat('%',#{searchValue},'%')
  1132. </if>
  1133. <if test="searchType == 2">
  1134. and (select COUNT(1) from u_archive_file uaf WHERE uaf.archive_id = uaa.id and uaf.file_name like concat('%',#{searchValue},'%'))
  1135. </if>
  1136. </if>
  1137. </select>
  1138. <select id="getNodeArchives2" resultType="org.springblade.archive.vo.ArchiveInspectVO">
  1139. select uaa.id ,uaa.file_number,uaa.name ,uaa.unit,
  1140. 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}
  1141. and aei.expert_id = #{userId}) > 0,'已抽检','未抽检') as inspectStatusName,
  1142. (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}
  1143. and aei.expert_id = #{userId} and is_pass = 1) = 1 then '合格'
  1144. 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}
  1145. and aei.expert_id = #{userId} and is_pass = 0) > 0 then '整改' else null end) as updateStatusName
  1146. from m_archive_tree_contract atc right join u_archives_auto uaa on atc.id = uaa.node_id
  1147. 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
  1148. and (atc.id =#{id} or FIND_IN_SET(#{id}, atc.ancestors))
  1149. <if test="userId != null">
  1150. and FIND_IN_SET(#{userId}, uaa.expert_id)
  1151. </if>
  1152. <if test="searchValue != null and searchValue != ''">
  1153. <if test="searchType == 1">
  1154. and uaa.name like concat('%',#{searchValue},'%')
  1155. </if>
  1156. <if test="searchType == 2">
  1157. and (select COUNT(1) from u_archive_file uaf WHERE uaf.archive_id = uaa.id and uaf.file_name like concat('%',#{searchValue},'%'))
  1158. </if>
  1159. </if>
  1160. </select>
  1161. <select id="getNodeAllArchive" resultType="org.springblade.archive.entity.ArchivesAuto">
  1162. select id,expert_id
  1163. from u_archives_auto where is_deleted = 0 and is_apply = 1 and node_id in
  1164. <foreach collection="ids" item="id" open="(" separator="," close=")">
  1165. #{id}
  1166. </foreach>
  1167. </select>
  1168. <select id="getUserArchiveTotal" resultType="java.lang.Integer">
  1169. SELECT COUNT(1) from u_archives_auto
  1170. WHERE project_id = #{projectId} and is_deleted = 0 and FIND_IN_SET(#{userId},expert_id)
  1171. </select>
  1172. <select id="getUserReviewedTotal" resultType="java.lang.Integer">
  1173. SELECT COUNT(1)
  1174. from (SELECT DISTINCT (archive_id)
  1175. from u_archive_expert_inspection
  1176. WHERE project_id = #{projectId}
  1177. and is_deleted = 0
  1178. and expert_id = #{userId}
  1179. and conclusion_id = #{conclusionId}
  1180. ) a
  1181. </select>
  1182. <select id="getUserInspectInfo" resultType="org.springblade.archive.vo.ExpertInspectionVO">
  1183. select aei.id,aei.archive_name ,aei.opinion , aei.archive_id,expert_name,file_id,aei.is_pass,aei.conclusion_id,
  1184. (case when unit_type = 1 then '施工' when unit_type = 2 then '监理' else '业主' end) as unitName,
  1185. (select uaf.pdf_file_url from u_archive_file uaf where uaf.id = aei.file_id) as filePdf
  1186. from u_archive_expert_inspection aei
  1187. WHERE project_id = #{projectId} and is_deleted = 0 and is_pass = 0 and conclusion_id = #{conclusionId}
  1188. <if test="userId != null">
  1189. and expert_id = #{userId}
  1190. </if>
  1191. order BY update_time DESC
  1192. </select>
  1193. <select id="getAllInspectArchive" resultType="org.springblade.archive.vo.ArchivesAutoVO3">
  1194. 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,
  1195. uaa.*
  1196. from u_archives_auto uaa WHERE project_id = #{projectId} and is_deleted = 0 and is_apply = 1
  1197. </select>
  1198. <select id="getArchiveConclusion" resultType="org.springblade.archive.entity.ArchiveConclusion">
  1199. select * from u_archive_conclusion where project_id = #{projectId} and expert_id = #{userId}
  1200. </select>
  1201. <select id="getAllArchive" resultType="org.springblade.archive.vo.ArchivesAutoVO2">
  1202. select
  1203. uaa.id,uaa.name,uaa.page_n ,uaa.remark ,uaa.file_number,
  1204. (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
  1205. from u_archives_auto uaa where id in
  1206. <foreach collection="ids" item="id" open="(" separator="," close=")">
  1207. #{id}
  1208. </foreach>
  1209. order by FIELD(uaa.id,
  1210. <foreach collection="ids" item="id" separator="," >
  1211. #{id}
  1212. </foreach>
  1213. )
  1214. </select>
  1215. <select id="getRoutingInspection" resultType="org.springblade.archive.vo.ArchiveWarningVO">
  1216. select uaf.file_name ,uaf.file_url,0 as sourceType,uaf.node_id,
  1217. (select uaa.name from u_archives_auto uaa WHERE uaa.id = uaf.archive_id) as archive_name,
  1218. (select GROUP_CONCAT(uai.opinion) from u_archive_inspection uai WHERE uai.file_id = uaf.id) as allopinion
  1219. from u_archive_file uaf join m_archive_tree_contract atc on uaf.node_id = atc.id
  1220. where uaf.project_id = #{projectId} and uaf.is_deleted = 0 and uaf.rectification = #{rec}
  1221. and atc.is_deleted = 0
  1222. and (atc.id = #{nodeId} or FIND_IN_SET(#{nodeId}, atc.ancestors))
  1223. </select>
  1224. <select id="getSpotCheck" resultType="org.springblade.archive.vo.ArchiveWarningVO">
  1225. select GROUP_CONCAT(aei.opinion) as allopinion,aei.archive_name ,aei.node_id,1 as sourceType,
  1226. (select uaf.file_name from u_archive_file uaf WHERE uaf.id = aei.file_id) as fileName,
  1227. (select uaf.file_url from u_archive_file uaf WHERE uaf.id = aei.file_id) as fileUrl
  1228. from m_archive_tree_contract atc join u_archive_expert_inspection aei on aei.node_id = atc.id
  1229. where atc.project_id = #{projectId} and atc.is_deleted = 0 and aei.is_deleted = 0 and aei.is_pass = 0
  1230. and atc.is_deleted = 0
  1231. and (atc.id = #{nodeId} or FIND_IN_SET(#{nodeId}, atc.ancestors))
  1232. GROUP by aei.file_id
  1233. </select>
  1234. <select id="getUnitAllCabinet" resultType="org.springblade.archive.vo.CabinetVO">
  1235. select uaa.id,uaa.name,uaa.file_number,uaa.unit,uaa.storage_time,uaa.secret_level,uaa.start_date,uaa.end_date
  1236. from
  1237. (SELECT id FROM m_archive_tree_contract WHERE project_id =#{projectId}
  1238. and ancestors like concat('%',#{nodeId},'%')
  1239. ) matc left join u_archives_auto uaa on matc.id = uaa.node_id
  1240. where uaa.is_deleted = 0 and uaa.is_archive = 1
  1241. GROUP BY uaa.id
  1242. order by uaa.tree_sort,uaa.auto_file_sort,uaa.file_number asc
  1243. </select>
  1244. <update id="splitFiles">
  1245. update u_archive_file set is_archive = 0 ,archive_id = null where
  1246. id in
  1247. <foreach collection="ids" item="id" open="(" separator="," close=")">
  1248. #{id}
  1249. </foreach>
  1250. </update>
  1251. <update id="batchDestroyByIds">
  1252. update u_archives_auto set is_deleted = 1 ,is_destroy = 1 ,update_user = #{userId} where
  1253. id in
  1254. <foreach collection="ids" item="id" open="(" separator="," close=")">
  1255. #{id}
  1256. </foreach>
  1257. </update>
  1258. <resultMap id="archiveAutoDtoMap" type="org.springblade.archive.entity.JiLinArchiveAutoDto">
  1259. <id column="id" property="id"></id>
  1260. <result column="project_id" property="projectId"></result>
  1261. <result column="contract_id" property="contractId"></result>
  1262. <result column="name" property="name"></result>
  1263. <result column="file_number" property="fileNumber"></result>
  1264. <result column="unit" property="unit"></result>
  1265. <result column="start_date" property="startDate"></result>
  1266. <result column="end_date" property="endDate"></result>
  1267. <result column="storage_time" property="storageTime"></result>
  1268. <result column="secret_level" property="secretLevel"></result>
  1269. <result column="real_name" property="updateUserName"></result>
  1270. <result column="update_time" property="updateUserTime"></result>
  1271. <result column="auto_file_sort" property="autoFileSort"></result>
  1272. <result column="create_time" property="createUserTime"></result>
  1273. <result column="file_n" property="fileN"></result>
  1274. <result column="rollor" property="rollor"></result>
  1275. <result column="node_id" property="nodeId"></result>
  1276. <result column="page_n" property="pageN"></result>
  1277. <result column="file_url" property="fileUrl"></result>
  1278. <result column="pdf_file_url" property="pdfFileUrl"></result>
  1279. </resultMap>
  1280. <select id="getArchiveAutoDtoList" resultMap="archiveAutoDtoMap">
  1281. 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,
  1282. 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
  1283. join u_archive_file as c on a.id=c.archive_id
  1284. where a.project_id=#{projId} and a.contract_id in
  1285. <foreach collection="dtos" item="item" open="(" separator="," close=")">
  1286. #{item.cqContractId}
  1287. </foreach>
  1288. </select>
  1289. <select id="getOutArchiveAutosByOutIds" resultMap="archivesAutoResultMap">
  1290. select *
  1291. from u_archives_auto
  1292. where project_id = #{projectId}
  1293. and is_auto_file!=1
  1294. and is_deleted=0
  1295. and
  1296. out_id in
  1297. <foreach collection="ids" item="id" open="(" separator="," close=")">
  1298. #{id}
  1299. </foreach>
  1300. </select>
  1301. <select id="selectArchivesAutoPage1" resultMap="archivesAutoResultMap">
  1302. select *
  1303. from u_archives_auto
  1304. where is_deleted = 0
  1305. </select>
  1306. <select id="getOutNodesByOutIds" resultMap="archiveTreeContractResultMap">
  1307. select id,node_name,parent_id,out_id
  1308. from m_archive_tree_contract
  1309. where project_id = #{projectId} and is_deleted = 0 and
  1310. out_id in
  1311. <foreach collection="ids" item="id" open="(" separator="," close=")">
  1312. #{id}
  1313. </foreach>
  1314. </select>
  1315. <select id="getOutArchiveFilesByOutIds" resultMap="archiveFileResultMap1">
  1316. select id,utime,out_id,pdf_page_url
  1317. from u_archive_file
  1318. where project_id = #{projectId} and is_deleted = 0 and
  1319. out_id in
  1320. <foreach collection="ids" item="id" open="(" separator="," close=")">
  1321. #{id}
  1322. </foreach>
  1323. </select>
  1324. <select id="getMetadaFileByFileIds" resultType="java.util.Map">
  1325. SELECT id,file_id
  1326. FROM u_metadata_file
  1327. WHERE file_id IN
  1328. <foreach collection="fileIds" item="fileId" open="(" close=")" separator=",">
  1329. #{fileId}
  1330. </foreach>
  1331. ORDER BY file_id, create_time DESC
  1332. </select>
  1333. </mapper>