SysOrgMapper.xml 61 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.xunmei.system.mapper.SysOrgMapper">
  6. <resultMap type="com.xunmei.system.api.domain.SysOrg" id="SysOrgResult">
  7. <result property="id" column="id"/>
  8. <result property="address" column="address"/>
  9. <result property="code" column="code"/>
  10. <result property="guid" column="guid"/>
  11. <result property="isLock" column="is_lock"/>
  12. <result property="manager" column="manager"/>
  13. <result property="managerPhone" column="manager_phone"/>
  14. <result property="name" column="name"/>
  15. <result property="parentId" column="parent_id"/>
  16. <result property="phone" column="phone"/>
  17. <result property="cityCode" column="city_code"/>
  18. <result property="type" column="type"/>
  19. <result property="createTime" column="create_time"/>
  20. <result property="updateTime" column="update_time"/>
  21. <result property="path" column="path"/>
  22. <result property="parentGuid" column="parent_guid"/>
  23. <result property="deleted" column="deleted"/>
  24. <result property="sort" column="sort"/>
  25. <result property="source" column="source"/>
  26. <result property="shortName" column="short_name"/>
  27. <result property="remark" column="remark"/>
  28. <result property="source" column="source"/>
  29. <result property="createBy" column="create_by"/>
  30. <result property="updateBy" column="update_by"/>
  31. <result property="treeShowParentId" column="tree_show_parent_id"/>
  32. <result property="treeShowPath" column="tree_show_path"/>
  33. </resultMap>
  34. <sql id="selectSysOrgVo">
  35. select id,
  36. address,
  37. code,
  38. guid,
  39. is_lock,
  40. manager,
  41. manager_phone,
  42. name,
  43. parent_id,
  44. phone,
  45. city_code,
  46. type,
  47. create_time,
  48. update_time,
  49. parent_guid,
  50. deleted,
  51. sort,
  52. create_by,
  53. update_by,
  54. org_extend_id,
  55. source,
  56. short_name,
  57. remark,
  58. path,
  59. tree_show_parent_id,
  60. tree_show_path
  61. from sys_org
  62. </sql>
  63. <select id="selectSysOrgList" parameterType="com.xunmei.system.api.domain.SysOrg"
  64. resultMap="SysOrgResult">
  65. <include refid="selectSysOrgVo"/>
  66. <where>
  67. <if test="address != null and address != ''">
  68. and address = #{address}
  69. </if>
  70. <if test="code != null and code != ''">
  71. and code = #{code}
  72. </if>
  73. <!-- <if test="deviceCount != null ">-->
  74. <!-- and device_count = #{deviceCount}-->
  75. <!-- </if>-->
  76. <if test="guid != null and guid != ''">
  77. and guid = #{guid}
  78. </if>
  79. <if test="isLock != null ">
  80. and is_lock = #{isLock}
  81. </if>
  82. <if test="manager != null and manager != ''">
  83. and manager = #{manager}
  84. </if>
  85. <if test="managerPhone != null and managerPhone != ''">
  86. and manager_phone = #{managerPhone}
  87. </if>
  88. <if test="name != null and name != ''">
  89. and name like concat('%', #{name}, '%')
  90. </if>
  91. <if test="parentId != null ">
  92. and parent_id = #{parentId}
  93. </if>
  94. <if test="phone != null and phone != ''">
  95. and phone = #{phone}
  96. </if>
  97. <if test="cityCode != null and cityCode != ''">
  98. and city_code = #{cityCode}
  99. </if>
  100. <!-- <if test="openYear != null ">-->
  101. <!-- and open_year = #{openYear}-->
  102. <!-- </if>-->
  103. <!-- <if test="fitYear != null ">-->
  104. <!-- and fit_year = #{fitYear}-->
  105. <!-- </if>-->
  106. <!-- <if test="floorage != null and floorage != ''">-->
  107. <!-- and floorage = #{floorage}-->
  108. <!-- </if>-->
  109. <!-- <if test="employee != null ">-->
  110. <!-- and employee = #{employee}-->
  111. <!-- </if>-->
  112. <!-- <if test="isOwnRight != null ">-->
  113. <!-- and is_own_right = #{isOwnRight}-->
  114. <!-- </if>-->
  115. <!-- <if test="isRent != null ">-->
  116. <!-- and is_rent = #{isRent}-->
  117. <!-- </if>-->
  118. <!-- <if test="isOnly != null ">-->
  119. <!-- and is_only = #{isOnly}-->
  120. <!-- </if>-->
  121. <!-- <if test="buildYear != null ">-->
  122. <!-- and build_year = #{buildYear}-->
  123. <!-- </if>-->
  124. <!-- <if test="placeType != null ">-->
  125. <!-- and place_type = #{placeType}-->
  126. <!-- </if>-->
  127. <!-- <if test="buildHeight != null ">-->
  128. <!-- and build_height = #{buildHeight}-->
  129. <!-- </if>-->
  130. <!-- <if test="social != null ">-->
  131. <!-- and social = #{social}-->
  132. <!-- </if>-->
  133. <!-- <if test="naturalEnvir != null ">-->
  134. <!-- and natural_envir = #{naturalEnvir}-->
  135. <!-- </if>-->
  136. <if test="type != null ">
  137. and type = #{type}
  138. </if>
  139. <if test="updateBy != null and updateBy != ''">
  140. and update_by like concat('%', #{updateBy}, '%')
  141. </if>
  142. <!-- <if test="modifiedId != null ">-->
  143. <!-- and modified_id = #{modifiedId}-->
  144. <!-- </if>-->
  145. <if test="path != null and path != ''">
  146. and path = #{path}
  147. </if>
  148. <!-- <if test="vid != null ">-->
  149. <!-- and vid = #{vid}-->
  150. <!-- </if>-->
  151. <!-- <if test="level != null ">-->
  152. <!-- and level = #{level}-->
  153. <!-- </if>-->
  154. <!-- <if test="oid != null and oid != ''">-->
  155. <!-- and oid = #{oid}-->
  156. <!-- </if>-->
  157. <if test="parentGuid != null and parentGuid != ''">
  158. and parent_guid = #{parentGuid}
  159. </if>
  160. <if test="deleted != null ">
  161. and deleted = #{deleted}
  162. </if>
  163. <if test="sort != null ">
  164. and sort = #{sort}
  165. </if>
  166. <!-- <if test="location != null ">-->
  167. <!-- and location = #{location}-->
  168. <!-- </if>-->
  169. </where>
  170. </select>
  171. <select id="selectSysOrgById" parameterType="Long"
  172. resultMap="SysOrgResult">
  173. <include refid="selectSysOrgVo"/>
  174. where id = #{id}
  175. </select>
  176. <select id="selectCheckSubOrgIdList" resultType="java.lang.Long">
  177. select id
  178. from sys_org
  179. where path like concat((select path from sys_org where id = #{orgId}), '%')
  180. and deleted = 0
  181. </select>
  182. <select id="findListByOrgType" resultType="java.lang.Long">
  183. select a.id
  184. from sys_org a
  185. where a.type = #{execOrgType}
  186. and a.deleted = 0
  187. and a.is_lock = 0
  188. </select>
  189. <insert id="insertSysOrg" parameterType="com.xunmei.system.api.domain.SysOrg" useGeneratedKeys="true"
  190. keyProperty="id">
  191. insert into sys_org
  192. <trim prefix="(" suffix=")" suffixOverrides=",">
  193. <if test="address != null">
  194. address,
  195. </if>
  196. <if test="code != null">
  197. code,
  198. </if>
  199. <!-- <if test="deviceCount != null">device_count,-->
  200. <!-- </if>-->
  201. <if test="guid != null">
  202. guid,
  203. </if>
  204. <if test="isLock != null">
  205. is_lock,
  206. </if>
  207. <if test="manager != null">
  208. manager,
  209. </if>
  210. <if test="managerPhone != null">
  211. manager_phone,
  212. </if>
  213. <if test="name != null">
  214. name,
  215. </if>
  216. <if test="shortName != null">
  217. short_name,
  218. </if>
  219. <if test="parentId != null">
  220. parent_id,
  221. </if>
  222. <if test="phone != null">
  223. phone,
  224. </if>
  225. <if test="cityCode != null">
  226. city_code,
  227. </if>
  228. <!-- <if test="openYear != null">open_year,-->
  229. <!-- </if>-->
  230. <!-- <if test="fitYear != null">fit_year,-->
  231. <!-- </if>-->
  232. <!-- <if test="floorage != null">floorage,-->
  233. <!-- </if>-->
  234. <!-- <if test="employee != null">employee,-->
  235. <!-- </if>-->
  236. <!-- <if test="isOwnRight != null">is_own_right,-->
  237. <!-- </if>-->
  238. <!-- <if test="isRent != null">is_rent,-->
  239. <!-- </if>-->
  240. <!-- <if test="isOnly != null">is_only,-->
  241. <!-- </if>-->
  242. <!-- <if test="buildYear != null">build_year,-->
  243. <!-- </if>-->
  244. <!-- <if test="placeType != null">place_type,-->
  245. <!-- </if>-->
  246. <!-- <if test="buildHeight != null">build_height,-->
  247. <!-- </if>-->
  248. <!-- <if test="social != null">social,-->
  249. <!-- </if>-->
  250. <!-- <if test="naturalEnvir != null">natural_envir,-->
  251. <!-- </if>-->
  252. <if test="type != null">
  253. type,
  254. </if>
  255. <if test="createTime != null">
  256. create_time,
  257. </if>
  258. <if test="updateBy != null">
  259. update_by,
  260. </if>
  261. <if test="updateTime != null">
  262. update_time,
  263. </if>
  264. <!-- <if test="modifiedId != null">modified_id,-->
  265. <!-- </if>-->
  266. <if test="path != null">
  267. path,
  268. </if>
  269. <!-- <if test="vid != null">vid,-->
  270. <!-- </if>-->
  271. <!-- <if test="level != null">level,-->
  272. <!-- </if>-->
  273. <if test="oid != null">
  274. oid,
  275. </if>
  276. <if test="parentGuid != null">
  277. parent_guid,
  278. </if>
  279. <if test="deleted != null">
  280. deleted,
  281. </if>
  282. <if test="sort != null">
  283. sort,
  284. </if>
  285. <if test="source != null">
  286. source,
  287. </if>
  288. <if test="remark != null">
  289. remark,
  290. </if>
  291. <!-- <if test="location != null">location,-->
  292. <!-- </if>-->
  293. <if test="createBy != null">
  294. create_by,
  295. </if>
  296. <if test="updateBy != null">
  297. update_by,
  298. </if>
  299. <if test="treeParentCode != null">
  300. treeParentCode,
  301. </if>
  302. <if test="treeShowPath != null">
  303. treeShowPath,
  304. </if>
  305. <if test="treeShowParentId != null">
  306. treeShowParentId,
  307. </if>
  308. <if test="affiliatedArea != null">
  309. affiliated_area,
  310. </if>
  311. <if test="affiliatedBank != null">
  312. affiliated_bank,
  313. </if>
  314. </trim>
  315. <trim prefix="values (" suffix=")" suffixOverrides=",">
  316. <if test="address != null">
  317. #{address},
  318. </if>
  319. <if test="code != null">
  320. #{code},
  321. </if>
  322. <!-- <if test="deviceCount != null">#{deviceCount},-->
  323. <!-- </if>-->
  324. <if test="guid != null">
  325. #{guid},
  326. </if>
  327. <if test="isLock != null">
  328. #{isLock},
  329. </if>
  330. <if test="manager != null">
  331. #{manager},
  332. </if>
  333. <if test="managerPhone != null">
  334. #{managerPhone},
  335. </if>
  336. <if test="name != null">
  337. #{name},
  338. </if>
  339. <if test="shortName != null">
  340. #{shortName},
  341. </if>
  342. <if test="parentId != null">
  343. #{parentId},
  344. </if>
  345. <if test="phone != null">
  346. #{phone},
  347. </if>
  348. <if test="cityCode != null">
  349. #{cityCode},
  350. </if>
  351. <!-- <if test="openYear != null">#{openYear},-->
  352. <!-- </if>-->
  353. <!-- <if test="fitYear != null">#{fitYear},-->
  354. <!-- </if>-->
  355. <!-- <if test="floorage != null">#{floorage},-->
  356. <!-- </if>-->
  357. <!-- <if test="employee != null">#{employee},-->
  358. <!-- </if>-->
  359. <!-- <if test="isOwnRight != null">#{isOwnRight},-->
  360. <!-- </if>-->
  361. <!-- <if test="isRent != null">#{isRent},-->
  362. <!-- </if>-->
  363. <!-- <if test="isOnly != null">#{isOnly},-->
  364. <!-- </if>-->
  365. <!-- <if test="buildYear != null">#{buildYear},-->
  366. <!-- </if>-->
  367. <!-- <if test="placeType != null">#{placeType},-->
  368. <!-- </if>-->
  369. <!-- <if test="buildHeight != null">#{buildHeight},-->
  370. <!-- </if>-->
  371. <!-- <if test="social != null">#{social},-->
  372. <!-- </if>-->
  373. <!-- <if test="naturalEnvir != null">#{naturalEnvir},-->
  374. <!-- </if>-->
  375. <if test="type != null">
  376. #{type},
  377. </if>
  378. <if test="createTime != null">
  379. #{createTime},
  380. </if>
  381. <if test="updateBy != null">
  382. #{updateBy},
  383. </if>
  384. <if test="updateTime != null">
  385. #{updateTime},
  386. </if>
  387. <!-- <if test="modifiedId != null">#{modifiedId},-->
  388. <!-- </if>-->
  389. <if test="path != null">
  390. #{path},
  391. </if>
  392. <!-- <if test="vid != null">#{vid},-->
  393. <!-- </if>-->
  394. <!-- <if test="level != null">#{level},-->
  395. <!-- </if>-->
  396. <!-- <if test="oid != null">#{oid},-->
  397. <!-- </if>-->
  398. <if test="parentGuid != null">
  399. #{parentGuid},
  400. </if>
  401. <if test="deleted != null">
  402. #{deleted},
  403. </if>
  404. <if test="sort != null">
  405. #{sort},
  406. </if>
  407. <if test="source != null">
  408. #{source},
  409. </if>
  410. <if test="remark != null">
  411. #{remark},
  412. </if>
  413. <!-- <if test="location != null">#{location},-->
  414. <!-- </if>-->
  415. <if test="createBy != null">
  416. #{createBy},
  417. </if>
  418. <if test="updateBy != null">
  419. #{updateBy},
  420. </if>
  421. <if test="treeParentCode != null">
  422. #{treeParentCode},
  423. </if>
  424. <if test="treeShowPath != null">
  425. #{treeShowPath},
  426. </if>
  427. <if test="treeShowParentId != null">
  428. #{treeShowParentId},
  429. </if>
  430. <if test="affiliatedArea != null">
  431. #{affiliatedArea},
  432. </if>
  433. <if test="affiliatedBank != null">
  434. #{affiliatedBank},
  435. </if>
  436. </trim>
  437. </insert>
  438. <update id="updateSysOrg" parameterType="com.xunmei.system.api.domain.SysOrg">
  439. update sys_org
  440. <trim prefix="SET" suffixOverrides=",">
  441. <if test="address != null">
  442. address =
  443. #{address},
  444. </if>
  445. <if test="code != null">
  446. code =
  447. #{code},
  448. </if>
  449. <!-- <if test="deviceCount != null">device_count =-->
  450. <!-- #{deviceCount},-->
  451. <!-- </if>-->
  452. <if test="guid != null">
  453. guid =
  454. #{guid},
  455. </if>
  456. <if test="isLock != null">
  457. is_lock =
  458. #{isLock},
  459. </if>
  460. <if test="manager != null">
  461. manager =
  462. #{manager},
  463. </if>
  464. <if test="managerPhone != null">
  465. manager_phone =
  466. #{managerPhone},
  467. </if>
  468. <if test="name != null">
  469. name =
  470. #{name},
  471. </if>
  472. <if test="shortName != null">
  473. short_name =
  474. #{shortName},
  475. </if>
  476. <if test="parentId != null">
  477. parent_id =
  478. #{parentId},
  479. </if>
  480. <if test="phone != null">
  481. phone =
  482. #{phone},
  483. </if>
  484. <if test="cityCode != null">
  485. city_code =
  486. #{cityCode},
  487. </if>
  488. <!-- <if test="openYear != null">open_year =-->
  489. <!-- #{openYear},-->
  490. <!-- </if>-->
  491. <!-- <if test="fitYear != null">fit_year =-->
  492. <!-- #{fitYear},-->
  493. <!-- </if>-->
  494. <!-- <if test="floorage != null">floorage =-->
  495. <!-- #{floorage},-->
  496. <!-- </if>-->
  497. <!-- <if test="employee != null">employee =-->
  498. <!-- #{employee},-->
  499. <!-- </if>-->
  500. <!-- <if test="isOwnRight != null">is_own_right =-->
  501. <!-- #{isOwnRight},-->
  502. <!-- </if>-->
  503. <!-- <if test="isRent != null">is_rent =-->
  504. <!-- #{isRent},-->
  505. <!-- </if>-->
  506. <!-- <if test="isOnly != null">is_only =-->
  507. <!-- #{isOnly},-->
  508. <!-- </if>-->
  509. <!-- <if test="buildYear != null">build_year =-->
  510. <!-- #{buildYear},-->
  511. <!-- </if>-->
  512. <!-- <if test="placeType != null">place_type =-->
  513. <!-- #{placeType},-->
  514. <!-- </if>-->
  515. <!-- <if test="buildHeight != null">build_height =-->
  516. <!-- #{buildHeight},-->
  517. <!-- </if>-->
  518. <!-- <if test="social != null">social =-->
  519. <!-- #{social},-->
  520. <!-- </if>-->
  521. <!-- <if test="naturalEnvir != null">natural_envir =-->
  522. <!-- #{naturalEnvir},-->
  523. <!-- </if>-->
  524. <if test="type != null">
  525. type =
  526. #{type},
  527. </if>
  528. <if test="createTime != null">
  529. create_time =
  530. #{createTime},
  531. </if>
  532. <if test="updateBy != null">
  533. update_by =
  534. #{updateBy},
  535. </if>
  536. <if test="updateTime != null">
  537. update_time =
  538. #{updateTime},
  539. </if>
  540. <!-- <if test="modifiedId != null">modified_id =-->
  541. <!-- #{modifiedId},-->
  542. <!-- </if>-->
  543. <if test="path != null">
  544. path =
  545. #{path},
  546. </if>
  547. <!-- <if test="vid != null">vid =-->
  548. <!-- #{vid},-->
  549. <!-- </if>-->
  550. <!-- <if test="level != null">level =-->
  551. <!-- #{level},-->
  552. <!-- </if>-->
  553. <!-- <if test="oid != null">oid =-->
  554. <!-- #{oid},-->
  555. <!-- </if>-->
  556. <if test="parentGuid != null">
  557. parent_guid =
  558. #{parentGuid},
  559. </if>
  560. <if test="deleted != null">
  561. deleted =
  562. #{deleted},
  563. </if>
  564. <if test="sort != null">
  565. sort =
  566. #{sort},
  567. </if>
  568. <if test="source != null">
  569. source =
  570. #{source},
  571. </if>
  572. <if test="remark != null">
  573. remark =
  574. #{remark},
  575. </if>
  576. <!-- <if test="location != null">location =-->
  577. <!-- #{location},-->
  578. <!-- </if>-->
  579. <if test="createBy != null">
  580. create_by =
  581. #{createBy},
  582. </if>
  583. <if test="updateBy != null">
  584. update_by =
  585. #{updateBy},
  586. </if>
  587. <if test="treeParentCode != null">
  588. tree_parent_code= #{treeParentCode},
  589. </if>
  590. <if test="treeShowPath != null">
  591. tree_show_path=#{treeShowPath},
  592. </if>
  593. <if test="treeShowParentId != null">
  594. tree_show_parentId=#{treeShowParentId},
  595. </if>
  596. <if test="affiliatedArea != null">
  597. affiliated_area=#{affiliatedArea},
  598. </if>
  599. <if test="affiliatedBank != null">
  600. affiliated_bank=#{affiliatedBank},
  601. </if>
  602. </trim>
  603. where id = #{id}
  604. </update>
  605. <delete id="deleteSysOrgById" parameterType="Long">
  606. delete
  607. from sys_org
  608. where id = #{id}
  609. </delete>
  610. <delete id="deleteSysOrgByIds" parameterType="String">
  611. delete from sys_org where id in
  612. <foreach item="id" collection="array" open="(" separator="," close=")">
  613. #{id}
  614. </foreach>
  615. </delete>
  616. <select id="selectSysOrgByUserId" resultType="com.xunmei.system.api.domain.SysOrg">
  617. select so.*
  618. from sys_org so
  619. inner join sys_user suo on so.id = suo.org_id
  620. where suo.id = #{userId}
  621. </select>
  622. <select id="getParentName" resultType="com.xunmei.common.core.vo.IdNameVo">
  623. select so.id,so.short_name as name,p.short_name as extra
  624. from sys_org so
  625. left join sys_org p on so.parent_id=p.id and p.deleted=0
  626. where so.id in
  627. <foreach collection="ids" item="id" separator="," open="(" close=")">
  628. #{id}
  629. </foreach>
  630. and so.deleted=0
  631. </select>
  632. <select id="selectSysOrgVoByUserId" resultType="com.xunmei.system.api.vo.SysOrgVO">
  633. select so.id as id, so.name as name, so.path as path, so.parent_id as parentId
  634. from sys_org so
  635. inner join sys_user suo on so.id = suo.org_id
  636. where suo.id = #{userId}
  637. </select>
  638. <select id="selectSysOrgVOList" resultType="com.xunmei.system.api.vo.SysOrgVO">
  639. SELECT id,
  640. `name`,
  641. if(short_name is null,`name` ,short_name) as short_name,
  642. code,
  643. guid,
  644. path,
  645. parent_id,
  646. type,
  647. tree_show_parent_id,
  648. tree_show_path,
  649. if(sort is null,0,sort) as sort
  650. FROM sys_org
  651. WHERE deleted = 0
  652. ORDER BY isnull(sort),sort, path
  653. </select>
  654. <select id="selectOrgList" resultType="com.xunmei.system.api.domain.SysOrg">
  655. select o.*,e.weather_area_code as weather_city_code from sys_org o
  656. left join sys_org_extend e on o.id = e.org_id
  657. WHERE deleted = 0
  658. <if test=" org.isLock != null">
  659. and o.is_lock =#{org.isLock}
  660. </if>
  661. <if test=" org.type != null and org.type !=''">
  662. and o.type =#{org.type}
  663. </if>
  664. <if test=" org.name != null and org.name !=''">
  665. and (o.name like concat(concat('%',#{org.name}),'%') or o.short_name like concat(concat('%',#{org.name}),'%'))
  666. </if>
  667. <if test=" org.code != null and org.code !=''">
  668. and o.code like concat(concat('%',#{org.code}),'%')
  669. </if>
  670. <!-- <if test=" org.parentId != null and org.parentId !=''">-->
  671. <!-- and o.parent_id =#{org.parentId}-->
  672. <!-- </if>-->
  673. <if test=" org.checkSub != null and org.checkSub == true">
  674. and o.path like concat(concat('%',#{org.path}),'%')
  675. </if>
  676. <if test=" org.checkSub != null and org.checkSub == false">
  677. and o.path like concat('%',#{org.path})
  678. </if>
  679. and o.name != '机关' and o.name != '各部门'
  680. ORDER BY o.is_lock, isnull(o.sort),o.sort, o.path
  681. </select>
  682. <select id="getOrgIdByTaskId" resultType="java.lang.Long">
  683. SELECT org_id
  684. FROM core_monitoring_retrieval_task cmrt
  685. WHERE id = #{taskId}
  686. </select>
  687. <select id="selectOrgTypeByIdList" resultType="java.lang.Long">
  688. select distinct type
  689. from sys_org
  690. where id in
  691. <foreach collection="orgIdList" item="item" open="(" separator="," close=")">
  692. #{item}
  693. </foreach>
  694. </select>
  695. <select id="findByOrgTypeAndParent" resultType="com.xunmei.system.api.domain.SysOrg">
  696. select c.* from sys_org c where c.type = #{orgType} and c.path like concat('%',#{path}, '%') and deleted=0
  697. </select>
  698. <select id="selectByOrgName" resultType="com.xunmei.system.api.domain.SysOrg">
  699. SELECT * FROM sys_org WHERE `name` =#{name} AND deleted=0
  700. </select>
  701. <select id="findByOrgTypesAndParent" resultType="com.xunmei.system.api.domain.SysOrg">
  702. select c.* from sys_org c where c.path like concat('%',#{path}, '%') and deleted=0
  703. and
  704. c.type in
  705. <foreach collection="types" item="type" separator="," open="(" close=")">
  706. #{type}
  707. </foreach>
  708. </select>
  709. <select id="selectNetworkNumberByPath" resultType="java.lang.Integer">
  710. SELECT COUNT(1) FROM sys_org WHERE path LIKE concat( #{orgPath}, '%') AND type=4 AND deleted=0 AND is_lock=0
  711. </select>
  712. <select id="complianceStatus" resultType="com.xunmei.system.util.OrgPhysicalDefenseConstructionExport">
  713. select
  714. sum(if((t.ga382021 + t.ga382015) > 0,1,0 )) as reachNumber,
  715. sum(if(t.ga382021 > 0,1,0)) as newReachNumber,
  716. sum(if((t.ga382015 -t.ga382021 > 0),1,0)) as oldReachNumber,
  717. IFNULL(
  718. CONCAT(
  719. ROUND( sum(if((t.ga382021 + t.ga382015) > 0,1,0 ))/ COUNT(*)* 100, 2 ),
  720. '%'
  721. ),
  722. '0%'
  723. ) AS reachRate
  724. from (
  725. select
  726. b.id as org_id,
  727. if(a.banking2021 > 0 , 1, 0) as 'ga382021',
  728. if(a.banking2015 > 0 and a.banking2021 = 0 , 1, 0 ) as 'ga382015'
  729. from sys_org b
  730. LEFT JOIN (SELECT org_id,
  731. type,
  732. sum(type = 1 and standard = 1) banking2021,
  733. sum(type = 1 and standard = 2) banking2015
  734. FROM sys_org_physical_defense_construction
  735. WHERE type = 1
  736. GROUP BY org_id) a on a.org_id = b.id
  737. where 1=1
  738. AND b.deleted = 0
  739. AND b.is_lock = 0
  740. AND b.type = 4
  741. AND a.type = 1
  742. AND b.path LIKE concat(#{orgPath}, '%')
  743. GROUP BY b.id ) t
  744. </select>
  745. <select id="rectificationStatus" resultType="java.lang.Integer">
  746. SELECT
  747. IFNULL(SUM(IF(a.standard=1,1,0)),0)
  748. FROM
  749. sys_org_physical_defense_construction a LEFT JOIN sys_org b ON a.org_id=b.id
  750. WHERE
  751. a.date_of_compliance LIKE concat(#{year}, '%')
  752. AND a.type = 1
  753. AND b.path LIKE concat(#{orgPath}, '%')
  754. </select>
  755. <select id="oldRectificationStatus" resultType="java.lang.Integer">
  756. SELECT
  757. COUNT( DISTINCT a.org_id )
  758. FROM
  759. sys_org_physical_defense_construction a
  760. INNER JOIN sys_org b ON a.org_id = b.id
  761. WHERE
  762. a.org_id IN (
  763. SELECT
  764. org_id
  765. FROM
  766. sys_org_physical_defense_construction
  767. where
  768. type = 1
  769. GROUP BY
  770. org_id
  771. HAVING
  772. (
  773. IF
  774. ( LOCATE( 1, GROUP_CONCAT( standard ))> 0, 1, 0 )+
  775. IF
  776. ( LOCATE( 2, GROUP_CONCAT( standard ))> 0, 1, 0 ))= 2
  777. AND date_of_compliance LIKE concat(#{year}, '%')
  778. )AND b.path LIKE concat(#{orgPath}, '%')
  779. </select>
  780. <select id="noRectificationStatus" resultType="java.lang.Integer">
  781. SELECT
  782. COUNT( DISTINCT org_id )
  783. FROM
  784. sys_org_physical_defense_construction a LEFT JOIN sys_org b ON a.org_id=b.id
  785. WHERE
  786. org_id IN (
  787. SELECT
  788. GROUP_CONCAT( DISTINCT org_id )
  789. FROM
  790. sys_org_physical_defense_construction
  791. where type = 1
  792. GROUP BY
  793. org_id
  794. HAVING
  795. (
  796. IF
  797. ( LOCATE( 1, GROUP_CONCAT( standard ))> 0, 1, 0 )+
  798. IF
  799. ( LOCATE( 3, GROUP_CONCAT( standard ))> 0, 1, 0 ))= 2
  800. AND date_of_compliance LIKE concat(#{year}, '%')
  801. ) AND b.path LIKE concat(#{orgPath}, '%')
  802. </select>
  803. <select id="selectConstructionDetail" resultType="com.xunmei.system.util.ConstructionDetailExport">
  804. <!-- SELECT-->
  805. <!-- a.org_id AS orgId,-->
  806. <!-- IFNULL( b.ownership, 0 ) AS ownership,-->
  807. <!-- IF-->
  808. <!-- (-->
  809. <!-- IF-->
  810. <!-- ( LOCATE( 1, GROUP_CONCAT( a.standard ))> 0, 1, 0 )+-->
  811. <!-- IF-->
  812. <!-- ( LOCATE( 2, GROUP_CONCAT( a.standard ))> 0, 1, 0 )>= 1,-->
  813. <!-- 1,-->
  814. <!-- 0-->
  815. <!-- ) AS complianceStatus,-->
  816. <!-- IFNULL(SUBSTR( a.date_of_compliance, 1, 10 ), '' ) AS complianceDate,-->
  817. <!-- IF-->
  818. <!-- (-->
  819. <!-- IF-->
  820. <!-- ( LOCATE( 1, GROUP_CONCAT( a.standard ))> 0, 1, 0 )+-->
  821. <!-- IF-->
  822. <!-- ( LOCATE( 2, GROUP_CONCAT( a.standard ))> 0, 1, 0 )>= 1,-->
  823. <!-- NULL,-->
  824. <!-- a.reason-->
  825. <!-- ) AS reason,-->
  826. <!-- IFNULL(SUBSTR( a.date_of_complete, 1, 10 ), '' ) AS completeDate,-->
  827. <!-- c.address as address,-->
  828. <!-- c.affiliated_area as city,-->
  829. <!-- c.affiliated_bank as orgName,-->
  830. <!-- c.short_name as networkName-->
  831. <!-- FROM-->
  832. <!-- sys_org c-->
  833. <!-- LEFT JOIN sys_org_physical_defense_construction a ON c.id=a.org_id-->
  834. <!-- LEFT JOIN sys_org_extend b ON a.org_id = b.org_id-->
  835. <!-- WHERE c.type=4-->
  836. <!-- and c.deleted = 0-->
  837. <!-- and c.is_lock = 0-->
  838. <!-- and a.type =1-->
  839. <!-- and c.path like concat(#{orgPath}, '%')-->
  840. <!-- GROUP BY-->
  841. <!-- a.org_id-->
  842. SELECT
  843. c.id AS orgId,
  844. IFNULL( b.ownership, 0 ) AS ownership,
  845. case when a.banking2021=1 then 2021 when a.banking2015=1 then 2015 when a.unGA38=1 then 1 else 0 end as complianceStatus,
  846. IFNULL(SUBSTR( a.date_of_compliance, 1, 10 ), '' ) AS complianceDate,
  847. IF
  848. (
  849. a.unGA38=1,
  850. a.reason,
  851. ''
  852. ) AS reason,
  853. IF( a.unGA38=1, IFNULL(SUBSTR( a.date_of_complete, 1, 10 ), '' ),'') AS completeDate,
  854. c.address as address,
  855. c.address as address,
  856. c.affiliated_area as city,
  857. c.affiliated_bank as orgName,
  858. c.short_name as networkName
  859. FROM
  860. sys_org c
  861. LEFT JOIN (select org_id,date_of_compliance,reason,date_of_complete,
  862. banking2021,
  863. if(banking2015 > 0 and banking2021 = 0, 1, 0) as banking2015,
  864. if(unGA38 >0 and banking2015 = 0 and banking2021 = 0, 1, 0) as unGA38
  865. from (SELECT org_id,Max(date_of_compliance) as date_of_compliance,reason,date_of_complete,
  866. sum(standard = 1) banking2021,
  867. sum(standard = 2) banking2015,
  868. sum(standard = 3) unGA38
  869. FROM sys_org_physical_defense_construction
  870. WHERE type = 1
  871. GROUP BY org_id) t1) a ON c.id = a.org_id
  872. LEFT JOIN sys_org_extend b ON c.id = b.org_id
  873. WHERE c.type=4
  874. and c.deleted = 0
  875. and c.is_lock = 0
  876. and c.path like concat(#{orgPath}, '%')
  877. </select>
  878. <select id="getReachNumber" resultType="java.lang.Integer">
  879. select SUM(a.size) from (select org_id,if(count(*) > 0,1,0) as size from sys_org_physical_defense_construction where standard in (1,2) and type = 1 GROUP BY org_id) a
  880. LEFT JOIN sys_org b on a.org_id = b.id
  881. where 1=1
  882. AND b.deleted = 0
  883. and b.is_lock = 0
  884. and b.type=4
  885. AND b.path LIKE concat(#{orgPath}, '%')
  886. </select>
  887. <select id="getOwnership" resultType="java.lang.Integer">
  888. SELECT
  889. IFNULL( SUM( IF ( a.ownership = 2, 1, 0 )), 0 )
  890. FROM
  891. sys_org_extend a
  892. LEFT JOIN sys_org b ON a.org_id = b.id
  893. WHERE b.type=4 and b.deleted = 0 and b.is_lock = 0 and b.path LIKE concat(#{orgPath}, '%')
  894. </select>
  895. <select id="getOutside" resultType="java.lang.Integer">
  896. SELECT
  897. IFNULL( SUM( IF ( a.outside_area = 0, 1, 0 )), 0 )
  898. FROM
  899. sys_org_extend a
  900. LEFT JOIN sys_org b ON a.org_id = b.id
  901. where
  902. 1=1
  903. and b.path LIKE concat(#{orgPath}, '%')
  904. and b.is_lock = 0
  905. and b.deleted = 0
  906. </select>
  907. <select id="getLibrary" resultType="java.util.Map">
  908. SELECT
  909. sum( a.yywd + a.zxywk ) AS total,
  910. a.one,
  911. a.two,
  912. a.three,
  913. a.four
  914. FROM
  915. (
  916. SELECT
  917. IFNULL( sum( IF ( b.type = 6, 1, 0 )), 0 ) AS yywd,
  918. IFNULL( sum( IF ( b.type = 4 AND a.business_library = 1, 1, 0 )), 0 ) AS zxywk,
  919. IFNULL( sum( IF ( a.business_library_type = 1, 1, 0 )), 0 ) AS one,
  920. IFNULL( SUM( IF ( a.business_library_type = 2, 1, 0 )), 0 ) AS two,
  921. IFNULL( SUM( IF ( a.business_library_type = 3, 1, 0 )), 0 ) AS three,
  922. IFNULL( SUM( IF ( a.business_library_type = 4, 1, 0 )), 0 ) AS four
  923. FROM
  924. sys_org b
  925. LEFT JOIN sys_org_extend a ON a.org_id = b.id
  926. WHERE
  927. b.is_lock = 0
  928. and b.path LIKE concat(#{orgPath}, '%')
  929. and b.deleted = 0
  930. AND (b.type = 4 OR b.type = 5 OR b.type = 6)
  931. ) a
  932. </select>
  933. <select id="getCollectLibrary" resultType="java.lang.Integer">
  934. SELECT
  935. SUM(
  936. IF
  937. ( a.safe_box = 1, 1, 0 ))
  938. FROM
  939. sys_org_extend a
  940. LEFT JOIN sys_org b ON a.org_id = b.id
  941. WHERE
  942. 1=1
  943. and b.path LIKE concat(#{orgPath}, '%')
  944. and b.is_lock = 0
  945. and b.deleted = 0
  946. </select>
  947. <select id="getOnLine" resultType="java.util.Map">
  948. SELECT
  949. (
  950. SELECT
  951. IFNULL( SUM( IF ( b.self_service_bank = 1, 1, 0 )), 0 ) AS onLineTotal
  952. FROM
  953. sys_org a
  954. LEFT JOIN sys_org_extend b ON a.id = b.org_id
  955. WHERE
  956. 1=1
  957. AND a.deleted = 0
  958. and a.is_lock = 0
  959. and a.path LIKE concat( #{orgPath}, '%' )) AS onLineTotal,
  960. (
  961. select SUM(a.size) from (select org_id,if(count(1) > 0,1,0) as size from sys_org_physical_defense_construction where standard =1 and type = 2 GROUP BY org_id) a
  962. LEFT JOIN sys_org b on a.org_id = b.id
  963. where 1=1
  964. AND b.deleted = 0
  965. and b.is_lock = 0
  966. AND b.path LIKE concat(#{orgPath}, '%' )) AS onLineReachNumber
  967. FROM
  968. DUAL
  969. </select>
  970. <select id="getDeparture" resultType="java.util.Map">
  971. SELECT
  972. (
  973. SELECT
  974. count( 1 )
  975. FROM
  976. sys_org
  977. WHERE
  978. type = 5
  979. AND deleted = 0
  980. AND is_lock = 0
  981. AND path LIKE concat( #{orgPath}, '%' )) AS departureTotal,
  982. (
  983. select SUM(a.size) from (select org_id,if(count(1) > 0,1,0) as size from
  984. sys_org_physical_defense_construction where standard =1 and type = 3 GROUP BY org_id) a
  985. LEFT JOIN sys_org b on a.org_id = b.id
  986. where 1=1
  987. AND b.deleted = 0
  988. and b.is_lock = 0
  989. AND b.path LIKE concat(#{orgPath}, '%' )) AS departureReachNumber
  990. FROM
  991. DUAL
  992. </select>
  993. <select id="getSelfEquipment" resultType="java.util.Map">
  994. select
  995. t.onLineThroughWalls,
  996. t.onLineLobbyImplement,
  997. t.departureThroughWalls,
  998. t.departureLobbyImplement,
  999. ( t.onLineThroughWalls + t.onLineLobbyImplement + t.departureThroughWalls + t.departureLobbyImplement ) AS selfServiceDevicesTotal
  1000. from (
  1001. select
  1002. (select IFNULL( SUM( a.lobby_equipment ), 0 ) from sys_org_extend a LEFT JOIN sys_org b on a.org_id = b.id WHERE 1=1 and b.type = 4 and b.is_lock = 0 and b.deleted = 0 and b.path LIKE concat(#{orgPath}, '%')) as onLineLobbyImplement,
  1003. (select IFNULL( SUM( a.wall_penetrating_equipment ), 0 ) from sys_org_extend a LEFT JOIN sys_org b on a.org_id = b.id WHERE 1=1 and b.type = 4 and b.is_lock = 0 and b.deleted = 0 and b.path LIKE concat(#{orgPath}, '%')) as onLineThroughWalls,
  1004. (select IFNULL( SUM( a.lobby_equipment ), 0 ) from sys_org_extend a LEFT JOIN sys_org b on a.org_id = b.id WHERE 1=1 and b.type = 5 and b.is_lock = 0 and b.deleted = 0 and b.path LIKE concat(#{orgPath}, '%')) as departureLobbyImplement,
  1005. (select IFNULL( SUM( a.wall_penetrating_equipment ), 0 ) from sys_org_extend a LEFT JOIN sys_org b on a.org_id = b.id WHERE 1=1 and b.type = 5 and b.is_lock = 0 and b.deleted = 0 and b.path LIKE concat(#{orgPath}, '%')) as departureThroughWalls
  1006. from dual
  1007. ) t
  1008. </select>
  1009. <select id="getCenterConstruction" resultType="java.util.Map">
  1010. SELECT
  1011. IFNULL(SUBSTR( b.construction_time, 1, 4 ), '' ) as centerConstructionTime,
  1012. IFNULL(SUBSTR( b.last_update_time, 1, 4 ), '' )AS transformTime,
  1013. b.platform_brand AS brand,
  1014. IFNULL( b.hd_camera_count, 0 ) AS hdCameraCount,
  1015. IFNULL( b.total_camera_count, 0 ) AS totalCameraCount
  1016. FROM
  1017. ( SELECT id FROM sys_org WHERE type = 10 and is_lock = 0 and deleted = 0 AND path LIKE concat( #{orgPath}, '%' ) ORDER BY create_time DESC LIMIT 0, 1 ) a
  1018. LEFT JOIN sys_org_extend b ON a.id = b.org_id
  1019. </select>
  1020. <select id="getCamera" resultType="java.util.Map">
  1021. SELECT
  1022. IFNULL( COUNT( a.id ), 0 ) AS cameraTotal,
  1023. IFNULL( SUM( IF ( a.definition = 1, 1, 0 )), 0 ) AS definitionNumber
  1024. FROM
  1025. sys_device a
  1026. LEFT JOIN sys_org b ON a.org_id = b.id
  1027. WHERE
  1028. a.del_flag = 0
  1029. AND a.device_type = 2
  1030. AND b.deleted = 0
  1031. and b.is_lock = 0
  1032. AND b.path LIKE concat(#{orgPath}, '%')
  1033. </select>
  1034. <select id="getRemote" resultType="java.util.Map">
  1035. SELECT
  1036. IFNULL( SUM( a.cash_adding_room ), 0 ) AS cashAddingRoom,
  1037. IFNULL( SUM( a.remote_count ), 0 ) AS remoteCount,
  1038. IFNULL( SUM( a.cash_adding_room_control_count ), 0 ) AS cashAddingRoomControlCount,
  1039. IFNULL( SUM( a.remote_control_count ), 0 ) AS remoteControlCount
  1040. FROM
  1041. ( SELECT * FROM sys_org WHERE type = 10 and is_lock = 0 and deleted = 0 AND path LIKE concat( #{orgPath}, '%' ) ORDER BY create_time DESC LIMIT 0, 1 ) b
  1042. LEFT JOIN sys_org_extend a ON a.org_id = b.id
  1043. where
  1044. 1=1
  1045. and b.type = 10
  1046. and b.deleted = 0
  1047. and b.is_lock = 0
  1048. </select>
  1049. <select id="getDuty" resultType="java.util.Map">
  1050. SELECT
  1051. IFNULL( SUM( IF ( duty_mode = 2, 1, 0 )), 0 ) AS localDutyNetworkNumber,
  1052. IFNULL( SUM( IF ( duty_mode = 1, 1, 0 )), 0 ) AS remoteDutyNetworkNumber
  1053. FROM
  1054. sys_org_extend a
  1055. LEFT JOIN sys_org b ON a.org_id = b.id
  1056. WHERE
  1057. 1=1
  1058. and b.deleted = 0
  1059. and b.is_lock = 0
  1060. and b.type = 4
  1061. and b.path LIKE concat(#{orgPath}, '%')
  1062. </select>
  1063. <select id="getCertificate" resultType="java.util.Map">
  1064. SELECT
  1065. IFNULL( SUM( a.inner_count ), 0 ) AS internalCertificateNumber,
  1066. IFNULL( SUM( a.outside_count ), 0 ) AS outsourceCertificateNumber,
  1067. IFNULL( SUM( a.inner_count )+ SUM( a.outside_count ), 0 ) AS certificateTotal,
  1068. (
  1069. SELECT
  1070. count(*)
  1071. FROM
  1072. sys_user a
  1073. LEFT JOIN sys_user_information b ON a.id = b.user_id
  1074. LEFT JOIN sys_org c ON a.org_id = c.id
  1075. WHERE
  1076. 1 = 1
  1077. AND b.dept_id = 2
  1078. AND b.certificate_work = '1'
  1079. AND a.is_manage = 'Y'
  1080. AND c.deleted = 0
  1081. and c.is_lock = 0
  1082. AND c.path LIKE concat(#{orgPath}, '%')) AS certificatePeopleNumber
  1083. FROM
  1084. sys_org_extend a
  1085. LEFT JOIN sys_org b ON a.org_id = b.id
  1086. WHERE
  1087. 1=1
  1088. AND b.deleted = 0
  1089. and b.is_lock = 0
  1090. and b.path LIKE concat(#{orgPath}, '%')
  1091. </select>
  1092. <select id="getSafe" resultType="java.lang.Integer">
  1093. SELECT
  1094. COUNT( a.id )
  1095. FROM
  1096. core_safety_task a
  1097. LEFT JOIN sys_org b ON a.org_id = b.id
  1098. LEFT JOIN core_safecheck_plan c ON a.plan_id = c.id
  1099. WHERE
  1100. a.deleted = 0
  1101. AND b.deleted = 0
  1102. and b.is_lock = 0
  1103. AND c.check_type =3
  1104. and a.org_path LIKE concat(#{orgPath}, '%')
  1105. AND a.start_time BETWEEN #{startTime} and #{endTime}
  1106. </select>
  1107. <select id="getEduNumber" resultType="java.lang.Integer">
  1108. SELECT
  1109. COUNT( a.id )
  1110. FROM
  1111. core_edu_training_task a
  1112. LEFT JOIN core_edu_training_plan b ON a.plan_id = b.id
  1113. WHERE
  1114. b.exec_org_type = 3
  1115. AND b.deleted =0
  1116. and a.org_path like concat(concat('%',#{orgPath}),'%')
  1117. AND a.training_start_date_time BETWEEN #{startTime} and #{endTime}
  1118. </select>
  1119. <select id="getEduUser" resultType="java.lang.Integer">
  1120. SELECT
  1121. COUNT( b.edu_training_task_id )
  1122. FROM
  1123. core_edu_training_task a
  1124. LEFT JOIN core_edu_training_task_to_user b ON a.id = b.edu_training_task_id
  1125. WHERE
  1126. b.type = 1 and a.org_path like concat(concat('%',#{orgPath}),'%')
  1127. </select>
  1128. <select id="getQuarterDrillNumber" resultType="java.lang.Integer">
  1129. SELECT
  1130. COUNT(a.id)
  1131. FROM
  1132. core_drill_task a
  1133. LEFT JOIN core_drill_plan b ON a.plan_id = b.id
  1134. WHERE b.exec_org_type=3
  1135. and a.org_path like concat(concat('%',#{orgPath}),'%')
  1136. AND a.drill_start_time BETWEEN #{startTime} and #{endTime}
  1137. </select>
  1138. <select id="getQuarterDrillPeopleNumber" resultType="java.lang.Integer">
  1139. SELECT
  1140. COUNT( c.drill_task_id )
  1141. FROM
  1142. core_drill_task a
  1143. LEFT JOIN core_drill_plan b ON a.plan_id = b.id
  1144. LEFT JOIN core_drill_task_to_user c ON c.drill_task_id = a.id
  1145. WHERE
  1146. b.exec_org_type = 3
  1147. and a.org_path like concat(concat('%',#{orgPath}),'%')
  1148. </select>
  1149. <select id="getQuarterAllNetworkDrillNumber" resultType="java.lang.Integer">
  1150. SELECT
  1151. COUNT(a.id)
  1152. FROM
  1153. core_drill_task a
  1154. LEFT JOIN core_drill_plan b ON a.plan_id = b.id
  1155. WHERE b.exec_org_type=4
  1156. and a.org_path like concat(concat('%',#{orgPath}),'%')
  1157. AND a.drill_start_time BETWEEN #{startTime} and #{endTime}
  1158. </select>
  1159. <select id="getQuarterAllNetworkDrillPeopleNumber" resultType="java.lang.Integer">
  1160. SELECT
  1161. COUNT( c.drill_task_id )
  1162. FROM
  1163. core_drill_task a
  1164. LEFT JOIN core_drill_plan b ON a.plan_id = b.id
  1165. LEFT JOIN core_drill_task_to_user c ON c.drill_task_id = a.id
  1166. WHERE
  1167. b.exec_org_type = 4
  1168. and a.org_path like concat(concat('%',#{orgPath}),'%')
  1169. AND a.drill_start_time BETWEEN #{startTime} and #{endTime}
  1170. </select>
  1171. <select id="getAlone" resultType="java.lang.Integer">
  1172. SELECT
  1173. COUNT( * )
  1174. FROM
  1175. sys_user_information a
  1176. LEFT JOIN sys_user b ON a.user_id = b.id
  1177. LEFT JOIN sys_org c ON b.org_id = c.id
  1178. WHERE c.deleted = 0 and c.is_lock = 0 and a.alone_dept='Y' and b.is_manage = 'Y' AND c.path LIKE concat(#{orgPath}, '%')
  1179. </select>
  1180. <select id="getManager" resultType="java.lang.Integer">
  1181. SELECT
  1182. COUNT( * )
  1183. FROM
  1184. sys_user_information a
  1185. LEFT JOIN sys_user b ON a.user_id = b.id
  1186. LEFT JOIN sys_org c ON b.org_id = c.id
  1187. WHERE
  1188. 1 = 1
  1189. AND c.deleted = 0
  1190. and c.is_lock = 0
  1191. AND a.is_full_time = #{isFull}
  1192. AND a.duties in ('1','2','3')
  1193. AND b.is_manage = 'Y'
  1194. AND c.path LIKE concat(#{orgPath}, '%')
  1195. </select>
  1196. <select id="getManagerCertificate" resultType="java.lang.Integer">
  1197. SELECT
  1198. COUNT( * )
  1199. FROM
  1200. sys_user_information a
  1201. LEFT JOIN sys_user b ON a.user_id = b.id
  1202. LEFT JOIN sys_org c ON b.org_id = c.id
  1203. WHERE
  1204. 1 = 1
  1205. AND c.deleted = 0
  1206. and c.is_lock = 0
  1207. AND a.certificate_work = 1
  1208. AND a.duties in ('1','2','3')
  1209. AND b.is_manage = 'Y'
  1210. AND c.path LIKE concat(#{orgPath}, '%')
  1211. </select>
  1212. <select id="getIsMonitor" resultType="java.lang.String">
  1213. SELECT
  1214. IF
  1215. ( COUNT( a.id ) > 0, '是', '否' )
  1216. FROM
  1217. sys_user_information a
  1218. LEFT JOIN sys_user b ON a.user_id = b.id
  1219. LEFT JOIN sys_org c ON b.org_id = c.id
  1220. WHERE
  1221. a.duties = #{duties}
  1222. and c.deleted = 0
  1223. and c.is_lock = 0
  1224. AND b.is_manage = 'Y'
  1225. AND c.path LIKE concat(#{orgPath}, '%')
  1226. </select>
  1227. <select id="getMonitorPeople" resultType="java.util.Map">
  1228. SELECT
  1229. COUNT( a.id ) AS monitorTotal,
  1230. IFNULL( SUM( IF ( a.work_type IN ( 0, 1 ), 1, 0 )), 0 ) AS innerPeople,
  1231. IFNULL( SUM( IF ( a.work_type = 2, 1, 0 )), 0 ) AS outPeople
  1232. FROM
  1233. sys_user_information a
  1234. LEFT JOIN sys_user b ON a.user_id = b.id
  1235. LEFT JOIN sys_org c ON b.org_id = c.id
  1236. WHERE
  1237. a.duties IN ( 2, 4, 5 )
  1238. AND c.deleted = 0
  1239. and c.is_lock = 0
  1240. AND b.is_manage = 'Y'
  1241. AND c.path LIKE concat(#{orgPath}, '%')
  1242. </select>
  1243. <select id="getSafeHeadToNetwork" resultType="java.lang.Integer">
  1244. SELECT
  1245. COUNT( a.id )
  1246. FROM
  1247. core_safety_book_new a
  1248. LEFT JOIN sys_org b ON a.party_b_org = b.id
  1249. WHERE
  1250. a.type = #{type}
  1251. AND a.sign_level = #{level}
  1252. AND b.deleted = 0
  1253. and b.is_lock = 0
  1254. AND b.path LIKE concat(#{orgPath}, '%')
  1255. </select>
  1256. <select id="getJointHeadToNetwork" resultType="java.lang.Integer">
  1257. SELECT
  1258. COUNT( a.id )
  1259. FROM
  1260. core_safety_book_new a
  1261. LEFT JOIN sys_org b ON a.party_a_org = b.id
  1262. WHERE
  1263. a.type = #{type}
  1264. AND a.sign_level = #{level}
  1265. AND b.path LIKE concat(#{orgPath}, '%')
  1266. </select>
  1267. <select id="getHaveSecurityNetworkNumber" resultType="java.lang.Integer">
  1268. select count(*) from sys_org a
  1269. LEFT JOIN sys_org_extend b on a.id = b.org_id
  1270. WHERE 1=1
  1271. and a.deleted = 0
  1272. and a.is_lock = 0
  1273. and a.type = 4
  1274. and b.askari = 1
  1275. and a.path LIKE concat( #{orgPath}, '%' )
  1276. </select>
  1277. <select id="getHeadSafeCheckNumber" resultType="java.lang.Integer">
  1278. SELECT
  1279. COUNT( a.id )
  1280. FROM
  1281. core_safety_task a
  1282. LEFT JOIN core_safecheck_plan b ON a.plan_id = b.id
  1283. WHERE
  1284. b.check_type = 1
  1285. AND a.org_path LIKE concat(#{orgPath}, '%')
  1286. </select>
  1287. <select id="getHeadSafeCheckNetworkNumber" resultType="java.lang.Integer">
  1288. SELECT
  1289. COUNT( DISTINCT a.org_id )
  1290. FROM
  1291. core_safety_task a
  1292. LEFT JOIN core_safecheck_plan b ON a.plan_id = b.id
  1293. LEFT JOIN sys_org c ON c.id = a.org_id
  1294. WHERE
  1295. b.check_type = 1
  1296. AND c.deleted = 0
  1297. and c.is_lock = 0
  1298. -- AND c.type = 4
  1299. AND a.org_path LIKE concat(#{orgPath}, '%')
  1300. </select>
  1301. <select id="getDangerNumber" resultType="java.util.Map">
  1302. SELECT
  1303. IFNULL( SUM( IF ( confirm_status >= 2 AND reform_status IN ( 10, 11,12,13 ), 1, 0 )), 0 ) AS foundDangerNumber,
  1304. IFNULL( SUM( IF ( reform_status = 11, 1, 0 )), 0 ) AS rectificationDangerNumber,
  1305. IFNULL(
  1306. SUM(
  1307. IF
  1308. ( confirm_status >= 2 AND reform_status IN ( 10,11,12,13 ), 1, 0 ))- SUM(
  1309. IF
  1310. ( reform_status = 11, 1, 0 )),
  1311. 0
  1312. ) AS noRectificationDangerNumber
  1313. FROM
  1314. core_question a
  1315. LEFT JOIN core_safety_task b ON a.src_task_id = b.id
  1316. LEFT JOIN core_safecheck_plan c ON c.id = b.plan_id
  1317. WHERE
  1318. src_type = 2
  1319. AND c.check_type = 1
  1320. AND b.org_path LIKE concat(#{orgPath}, '%')
  1321. </select>
  1322. <select id="selectSysOrgByPathAndType" resultType="com.xunmei.system.api.domain.SysOrg">
  1323. SELECT
  1324. *
  1325. FROM
  1326. sys_org
  1327. WHERE
  1328. is_lock=0 AND
  1329. type = #{type}
  1330. AND deleted = 0
  1331. AND is_lock = 0
  1332. <if test="path != null">
  1333. AND path LIKE concat(#{path}, '%')
  1334. </if>
  1335. ORDER BY
  1336. sort
  1337. </select>
  1338. <select id="selectOrgs" resultType="com.xunmei.system.dto.SysSelectOrgComponentDto">
  1339. SELECT
  1340. id,
  1341. type,
  1342. yewd_level,
  1343. short_name,
  1344. path,
  1345. affiliated_area,
  1346. affiliated_bank
  1347. FROM
  1348. sys_org
  1349. WHERE 1=1
  1350. AND is_lock=0
  1351. AND deleted = 0
  1352. <if test="org.orgPath != null">
  1353. AND path LIKE concat(#{org.orgPath}, '%')
  1354. </if>
  1355. <if test="org.orgType != null">
  1356. AND type = #{org.orgType}
  1357. </if>
  1358. <if test="org.orgName != null">
  1359. AND short_name LIKE concat('%',#{org.orgName}, '%')
  1360. </if>
  1361. ORDER BY
  1362. affiliated_area,affiliated_bank,sort
  1363. </select>
  1364. <select id="exportOrgExtend" resultType="com.xunmei.system.util.OrgExtendExport">
  1365. SELECT
  1366. b.id AS orgId,
  1367. b.affiliated_area AS city,
  1368. b.affiliated_bank AS affiliatedBank,
  1369. b.short_name AS shortName,
  1370. ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'sys_org_type' AND dict_value = b.type ) AS typeName,
  1371. ( CASE b.is_lock WHEN 1 THEN '停用' ELSE '正常' END ) AS status,
  1372. b.address AS address,
  1373. IFNULL(SUBSTR( a.construction_time, 1, 4 ), '' ) AS constructionTime,
  1374. IFNULL(SUBSTR( a.last_update_time, 1, 4 ), '' ) AS lastUpdateTime,
  1375. ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'org_platform_brand' AND dict_value = a.platform_brand ) AS platformBrand,
  1376. IFNULL(a.cash_adding_room,0) AS cashAddingRoom,
  1377. IFNULL(a.cash_adding_room_control_count,0) AS cashAddingRoomControlCount,
  1378. IFNULL(a.remote_count,0) AS remoteCount,
  1379. IFNULL(a.remote_control_count,0) AS remoteControlCount,
  1380. IFNULL(a.total_camera_count,0) AS totalCameraCount,
  1381. IFNULL(a.hd_camera_count,0) AS hdCameraCount,
  1382. ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'property_situation' AND dict_value = a.ownership ) AS ownerShipName,
  1383. ( CASE a.outside_area WHEN 1 THEN '区域内' WHEN 0 THEN '区域外' ELSE '' END ) AS outsideArea,
  1384. ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'duty_options' AND dict_value = a.duty_mode ) AS dutyMode,
  1385. ( CASE a.safe_box WHEN 1 THEN '是' ELSE '否' END ) AS safeBox,
  1386. ( CASE a.self_service_bank WHEN 1 THEN '是' ELSE '否' END ) AS selfServiceBank,
  1387. IF(b.type = 4,IFNULL(a.wall_penetrating_equipment,0),0) AS onLineWallPenetratingEquipment,
  1388. IF(b.type = 4,IFNULL(a.lobby_equipment,0),0) AS onLineLobbyEquipment,
  1389. IF(b.type = 5,IFNULL(a.wall_penetrating_equipment,0),0) AS departureWallPenetratingEquipment,
  1390. IF(b.type = 5,IFNULL(a.lobby_equipment,0),0) AS departureLobbyEquipment,
  1391. ( CASE a.business_library WHEN 1 THEN '是' ELSE '否' END ) AS businessLibrary,
  1392. ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'business_type' AND dict_value = a.business_library_type ) AS businessLibraryTypeName,
  1393. ( CASE a.askari WHEN 1 THEN '是' ELSE '否' END ) AS askari,
  1394. IFNULL(a.inner_count,0) AS innerCount,
  1395. IFNULL(a.outside_count,0) AS outsideCount,
  1396. ( CASE WHEN a.askari_certificate IS NULL THEN '否' ELSE '是' END ) AS isAskariCertificate,
  1397. a.askari_certificate AS askariCertificate
  1398. FROM
  1399. sys_org b
  1400. LEFT JOIN sys_org_extend a ON a.org_id = b.id
  1401. -- LEFT JOIN core_weather_city c on a.weather_area_code = c.AREAID
  1402. WHERE
  1403. b.deleted = 0
  1404. <!-- <if test="org.checkSub==true">
  1405. and b.path like concat(#{org.path},"%")
  1406. </if>
  1407. <if test="org.checkSub==false">
  1408. and b.id = #{org.parentId}
  1409. </if>-->
  1410. <if test=" org.checkSub != null and org.checkSub == true">
  1411. and b.path like concat(concat('%',#{org.path}),'%')
  1412. </if>
  1413. <if test=" org.checkSub != null and org.checkSub == false">
  1414. and b.path like concat('%',#{org.path})
  1415. </if>
  1416. <if test=" org.isLock != null ">
  1417. AND b.is_lock = #{org.isLock}
  1418. </if>
  1419. <if test="typeList != null and typeList.size > 0">
  1420. AND b.type IN
  1421. <foreach collection="typeList" item="orgType" open="(" separator="," close=")">
  1422. #{orgType}
  1423. </foreach>
  1424. </if>
  1425. order by b.affiliated_bank asc,b.is_lock asc
  1426. </select>
  1427. <select id="exportDefenseDetailExtend" resultType="com.xunmei.system.util.OrgPhysicalDefenseConstructionDetailExport">
  1428. SELECT
  1429. b.id AS orgId,
  1430. b.affiliated_area AS city,
  1431. b.affiliated_bank AS affiliatedBank,
  1432. b.short_name AS shortName,
  1433. b.type AS orgType,
  1434. ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'sys_org_type' AND dict_value = b.type ) AS typeName,
  1435. ( CASE b.is_lock WHEN 1 THEN '停用' ELSE '正常' END ) AS status,
  1436. b.address AS address,
  1437. a.type AS ga38Type,
  1438. ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'org_extend_type' AND dict_value = a.type ) AS extendTypeName,
  1439. ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'org_extend_standard' AND dict_value = a.standard ) AS standard,
  1440. IFNULL(SUBSTR( a.date_of_compliance, 1, 10 ), '' ) AS dateOfCompliance,
  1441. a.reason as reason,
  1442. IFNULL(SUBSTR( a.date_of_complete, 1, 10 ), '' ) AS dateOfComplete,
  1443. a.certificate as certificate
  1444. FROM
  1445. sys_org b
  1446. LEFT JOIN sys_org_physical_defense_construction a ON a.org_id = b.id
  1447. WHERE
  1448. b.deleted = 0
  1449. <if test=" org.checkSub != null and org.checkSub == true">
  1450. and b.path like concat(concat('%',#{org.path}),'%')
  1451. </if>
  1452. <if test=" org.checkSub != null and org.checkSub == false">
  1453. and b.path like concat('%',#{org.path})
  1454. </if>
  1455. <if test=" org.isLock != null ">
  1456. AND b.is_lock = #{org.isLock}
  1457. </if>
  1458. <if test="typeList != null and typeList.size > 0">
  1459. AND b.type IN
  1460. <foreach collection="typeList" item="orgType" open="(" separator="," close=")">
  1461. #{orgType}
  1462. </foreach>
  1463. </if>
  1464. order by b.affiliated_bank asc,b.is_lock asc
  1465. </select>
  1466. </mapper>