SysOrgMapper.xml 58 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430
  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. a.date_of_compliance 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. a.date_of_complete 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_physical_defense_construction a
  833. INNER JOIN sys_org c 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 c.path like concat(#{orgPath}, '%')
  839. GROUP BY
  840. a.org_id
  841. </select>
  842. <select id="getReachNumber" resultType="java.lang.Integer">
  843. 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
  844. LEFT JOIN sys_org b on a.org_id = b.id
  845. where 1=1
  846. AND b.deleted = 0
  847. and b.is_lock = 0
  848. AND b.path LIKE concat(#{orgPath}, '%')
  849. </select>
  850. <select id="getOwnership" resultType="java.lang.Integer">
  851. SELECT
  852. IFNULL( SUM( IF ( a.ownership = 2, 1, 0 )), 0 )
  853. FROM
  854. sys_org_extend a
  855. LEFT JOIN sys_org b ON a.org_id = b.id
  856. WHERE b.type=4 and b.deleted = 0 and b.is_lock = 0 and b.path LIKE concat(#{orgPath}, '%')
  857. </select>
  858. <select id="getOutside" resultType="java.lang.Integer">
  859. SELECT
  860. IFNULL( SUM( IF ( a.outside_area = 0, 1, 0 )), 0 )
  861. FROM
  862. sys_org_extend a
  863. LEFT JOIN sys_org b ON a.org_id = b.id
  864. where
  865. 1=1
  866. and b.path LIKE concat(#{orgPath}, '%')
  867. and b.is_lock = 0
  868. and b.deleted = 0
  869. </select>
  870. <select id="getLibrary" resultType="java.util.Map">
  871. SELECT
  872. COUNT( a.business_library_type ) AS total,
  873. IFNULL( sum( IF ( a.business_library_type = 1, 1, 0 )), 0 ) AS one,
  874. IFNULL( SUM( IF ( a.business_library_type = 2, 1, 0 )), 0 ) AS two,
  875. IFNULL( SUM( IF ( a.business_library_type = 3, 1, 0 )), 0 ) AS three,
  876. IFNULL( SUM( IF ( a.business_library_type = 4, 1, 0 )), 0 ) AS four
  877. FROM
  878. sys_org_extend a
  879. LEFT JOIN sys_org b ON a.org_id = b.id
  880. where
  881. 1=1
  882. and b.path LIKE concat(#{orgPath}, '%')
  883. and b.is_lock = 0
  884. and b.deleted = 0
  885. </select>
  886. <select id="getCollectLibrary" resultType="java.lang.Integer">
  887. SELECT
  888. SUM(
  889. IF
  890. ( a.safe_box = 1, 1, 0 ))
  891. FROM
  892. sys_org_extend a
  893. LEFT JOIN sys_org b ON a.org_id = b.id
  894. WHERE
  895. 1=1
  896. and b.path LIKE concat(#{orgPath}, '%')
  897. and b.is_lock = 0
  898. and b.deleted = 0
  899. </select>
  900. <select id="getOnLine" resultType="java.util.Map">
  901. SELECT
  902. (
  903. SELECT
  904. IFNULL( SUM( IF ( b.self_service_bank = 1, 1, 0 )), 0 ) AS onLineTotal
  905. FROM
  906. sys_org a
  907. LEFT JOIN sys_org_extend b ON a.id = b.org_id
  908. WHERE
  909. 1=1
  910. AND a.deleted = 0
  911. and a.is_lock = 0
  912. and a.path LIKE concat( #{orgPath}, '%' )) AS onLineTotal,
  913. (
  914. 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
  915. LEFT JOIN sys_org b on a.org_id = b.id
  916. where 1=1
  917. AND b.deleted = 0
  918. and b.is_lock = 0
  919. AND b.path LIKE concat(#{orgPath}, '%' )) AS onLineReachNumber
  920. FROM
  921. DUAL
  922. </select>
  923. <select id="getDeparture" resultType="java.util.Map">
  924. SELECT
  925. (
  926. SELECT
  927. count( 1 )
  928. FROM
  929. sys_org
  930. WHERE
  931. type = 5
  932. AND deleted = 0
  933. AND is_lock = 0
  934. AND path LIKE concat( #{orgPath}, '%' )) AS departureTotal,
  935. (
  936. select SUM(a.size) from (select org_id,if(count(1) > 0,1,0) as size from
  937. sys_org_physical_defense_construction where standard =1 and type = 3 GROUP BY org_id) a
  938. LEFT JOIN sys_org b on a.org_id = b.id
  939. where 1=1
  940. AND b.deleted = 0
  941. and b.is_lock = 0
  942. AND b.path LIKE concat(#{orgPath}, '%' )) AS departureReachNumber
  943. FROM
  944. DUAL
  945. </select>
  946. <select id="getSelfEquipment" resultType="java.util.Map">
  947. select
  948. t.onLineThroughWalls,
  949. t.onLineLobbyImplement,
  950. t.departureThroughWalls,
  951. t.departureLobbyImplement,
  952. ( t.onLineThroughWalls + t.onLineLobbyImplement + t.departureThroughWalls + t.departureLobbyImplement ) AS selfServiceDevicesTotal
  953. from (
  954. select
  955. (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 onLineThroughWalls,
  956. (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 onLineLobbyImplement,
  957. (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 departureThroughWalls,
  958. (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 departureLobbyImplement
  959. from dual
  960. ) t
  961. </select>
  962. <select id="getCenterConstruction" resultType="java.util.Map">
  963. SELECT
  964. IFNULL(SUBSTR( b.construction_time, 1, 4 ), '' ) as centerConstructionTime,
  965. IFNULL(SUBSTR( b.last_update_time, 1, 4 ), '' )AS transformTime,
  966. b.platform_brand AS brand,
  967. IFNULL( b.hd_camera_count, 0 ) AS hdCameraCount,
  968. IFNULL( b.total_camera_count, 0 ) AS totalCameraCount
  969. FROM
  970. ( 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
  971. LEFT JOIN sys_org_extend b ON a.id = b.org_id
  972. </select>
  973. <select id="getCamera" resultType="java.util.Map">
  974. SELECT
  975. IFNULL( COUNT( a.id ), 0 ) AS cameraTotal,
  976. IFNULL( SUM( IF ( a.definition = 1, 1, 0 )), 0 ) AS definitionNumber
  977. FROM
  978. sys_device a
  979. LEFT JOIN sys_org b ON a.org_id = b.id
  980. WHERE
  981. a.del_flag = 0
  982. AND a.device_type = 2
  983. AND b.deleted = 0
  984. and b.is_lock = 0
  985. AND b.path LIKE concat(#{orgPath}, '%')
  986. </select>
  987. <select id="getRemote" resultType="java.util.Map">
  988. SELECT
  989. IFNULL( SUM( a.cash_adding_room ), 0 ) AS cashAddingRoom,
  990. IFNULL( SUM( a.remote_count ), 0 ) AS remoteCount,
  991. IFNULL( SUM( a.cash_adding_room_control_count ), 0 ) AS cashAddingRoomControlCount,
  992. IFNULL( SUM( a.remote_control_count ), 0 ) AS remoteControlCount
  993. FROM
  994. sys_org_extend a
  995. LEFT JOIN sys_org b ON a.org_id = b.id
  996. where
  997. 1=1
  998. and b.type = 10
  999. /* and a.remote_control = 1*/
  1000. and b.deleted = 0
  1001. and b.is_lock = 0
  1002. and b.path LIKE concat(#{orgPath}, '%')
  1003. </select>
  1004. <select id="getDuty" resultType="java.util.Map">
  1005. SELECT
  1006. IFNULL( SUM( IF ( duty_mode = 2, 1, 0 )), 0 ) AS localDutyNetworkNumber,
  1007. IFNULL( SUM( IF ( duty_mode = 1, 1, 0 )), 0 ) AS remoteDutyNetworkNumber
  1008. FROM
  1009. sys_org_extend a
  1010. LEFT JOIN sys_org b ON a.org_id = b.id
  1011. WHERE
  1012. 1=1
  1013. and b.deleted = 0
  1014. and b.is_lock = 0
  1015. and b.path LIKE concat(#{orgPath}, '%')
  1016. </select>
  1017. <select id="getCertificate" resultType="java.util.Map">
  1018. SELECT
  1019. IFNULL( SUM( a.inner_count ), 0 ) AS internalCertificateNumber,
  1020. IFNULL( SUM( a.outside_count ), 0 ) AS outsourceCertificateNumber,
  1021. IFNULL( SUM( a.inner_count )+ SUM( a.outside_count ), 0 ) AS certificateTotal,
  1022. (
  1023. SELECT
  1024. count(*)
  1025. FROM
  1026. sys_user a
  1027. LEFT JOIN sys_user_information b ON a.id = b.user_id
  1028. LEFT JOIN sys_org c ON a.org_id = c.id
  1029. WHERE
  1030. 1 = 1
  1031. AND b.dept_id = 2
  1032. AND b.certificate_work = '1'
  1033. AND a.is_manage = 'Y'
  1034. AND c.deleted = 0
  1035. and c.is_lock = 0
  1036. AND c.path LIKE concat(#{orgPath}, '%')) AS certificatePeopleNumber
  1037. FROM
  1038. sys_org_extend a
  1039. LEFT JOIN sys_org b ON a.org_id = b.id
  1040. WHERE
  1041. 1=1
  1042. AND b.deleted = 0
  1043. and b.is_lock = 0
  1044. and b.path LIKE concat(#{orgPath}, '%')
  1045. </select>
  1046. <select id="getSafe" resultType="java.lang.Integer">
  1047. SELECT
  1048. COUNT( a.id )
  1049. FROM
  1050. core_safety_task a
  1051. LEFT JOIN sys_org b ON a.org_id = b.id
  1052. LEFT JOIN core_safecheck_plan c ON a.plan_id = c.id
  1053. WHERE
  1054. a.deleted = 0
  1055. AND b.deleted = 0
  1056. and b.is_lock = 0
  1057. AND c.check_type =3
  1058. and a.org_path LIKE concat(#{orgPath}, '%')
  1059. AND a.ymd_date BETWEEN #{startTime} and #{endTime}
  1060. </select>
  1061. <select id="getEduNumber" resultType="java.lang.Integer">
  1062. SELECT
  1063. COUNT( a.id )
  1064. FROM
  1065. core_edu_training_task a
  1066. LEFT JOIN core_edu_training_plan b ON a.plan_id = b.id
  1067. WHERE
  1068. b.exec_org_type = 1
  1069. AND b.deleted =0
  1070. and a.org_path like concat(concat('%',#{orgPath}),'%')
  1071. AND a.training_start_date_time BETWEEN #{startTime} and #{endTime}
  1072. </select>
  1073. <select id="getEduUser" resultType="java.lang.Integer">
  1074. SELECT
  1075. COUNT( b.edu_training_task_id )
  1076. FROM
  1077. core_edu_training_task a
  1078. LEFT JOIN core_edu_training_task_to_user b ON a.id = b.edu_training_task_id
  1079. WHERE
  1080. b.type = 1 and a.org_path like concat(concat('%',#{orgPath}),'%')
  1081. </select>
  1082. <select id="getQuarterDrillNumber" resultType="java.lang.Integer">
  1083. SELECT
  1084. COUNT(a.id)
  1085. FROM
  1086. core_drill_task a
  1087. LEFT JOIN core_drill_plan b ON a.plan_id = b.id
  1088. WHERE b.exec_org_type=1
  1089. and a.org_path like concat(concat('%',#{orgPath}),'%')
  1090. AND a.drill_start_time BETWEEN #{startTime} and #{endTime}
  1091. </select>
  1092. <select id="getQuarterDrillPeopleNumber" resultType="java.lang.Integer">
  1093. SELECT
  1094. COUNT( c.drill_task_id )
  1095. FROM
  1096. core_drill_task a
  1097. LEFT JOIN core_drill_plan b ON a.plan_id = b.id
  1098. LEFT JOIN core_drill_task_to_user c ON c.drill_task_id = a.id
  1099. WHERE
  1100. b.exec_org_type = 1
  1101. and a.org_path like concat(concat('%',#{orgPath}),'%')
  1102. </select>
  1103. <select id="getQuarterAllNetworkDrillNumber" resultType="java.lang.Integer">
  1104. SELECT
  1105. COUNT(a.id)
  1106. FROM
  1107. core_drill_task a
  1108. LEFT JOIN core_drill_plan b ON a.plan_id = b.id
  1109. WHERE b.exec_org_type=4
  1110. and a.org_path like concat(concat('%',#{orgPath}),'%')
  1111. AND a.drill_start_time BETWEEN #{startTime} and #{endTime}
  1112. </select>
  1113. <select id="getQuarterAllNetworkDrillPeopleNumber" resultType="java.lang.Integer">
  1114. SELECT
  1115. COUNT( c.drill_task_id )
  1116. FROM
  1117. core_drill_task a
  1118. LEFT JOIN core_drill_plan b ON a.plan_id = b.id
  1119. LEFT JOIN core_drill_task_to_user c ON c.drill_task_id = a.id
  1120. WHERE
  1121. b.exec_org_type = 4
  1122. and a.org_path like concat(concat('%',#{orgPath}),'%')
  1123. </select>
  1124. <select id="getAlone" resultType="java.lang.Integer">
  1125. SELECT
  1126. COUNT( * )
  1127. FROM
  1128. sys_user_information a
  1129. LEFT JOIN sys_user b ON a.user_id = b.id
  1130. LEFT JOIN sys_org c ON b.org_id = c.id
  1131. 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}, '%')
  1132. </select>
  1133. <select id="getManager" resultType="java.lang.Integer">
  1134. SELECT
  1135. COUNT( * )
  1136. FROM
  1137. sys_user_information a
  1138. LEFT JOIN sys_user b ON a.user_id = b.id
  1139. LEFT JOIN sys_org c ON b.org_id = c.id
  1140. WHERE
  1141. 1 = 1
  1142. AND c.deleted = 0
  1143. and c.is_lock = 0
  1144. AND a.is_full_time = #{isFull}
  1145. AND a.duties in ('1','2','3')
  1146. AND b.is_manage = 'Y'
  1147. AND c.path LIKE concat(#{orgPath}, '%')
  1148. </select>
  1149. <select id="getManagerCertificate" resultType="java.lang.Integer">
  1150. SELECT
  1151. COUNT( * )
  1152. FROM
  1153. sys_user_information a
  1154. LEFT JOIN sys_user b ON a.user_id = b.id
  1155. LEFT JOIN sys_org c ON b.org_id = c.id
  1156. WHERE
  1157. 1 = 1
  1158. AND c.deleted = 0
  1159. and c.is_lock = 0
  1160. AND a.certificate_work = 1
  1161. AND a.duties in ('1','2','3')
  1162. AND b.is_manage = 'Y'
  1163. AND c.path LIKE concat(#{orgPath}, '%')
  1164. </select>
  1165. <select id="getIsMonitor" resultType="java.lang.String">
  1166. SELECT
  1167. IF
  1168. ( COUNT( a.id ) > 0, '是', '否' )
  1169. FROM
  1170. sys_user_information a
  1171. LEFT JOIN sys_user b ON a.user_id = b.id
  1172. LEFT JOIN sys_org c ON b.org_id = c.id
  1173. WHERE
  1174. a.duties = #{duties}
  1175. and c.deleted = 0
  1176. and c.is_lock = 0
  1177. AND b.is_manage = 'Y'
  1178. AND c.path LIKE concat(#{orgPath}, '%')
  1179. </select>
  1180. <select id="getMonitorPeople" resultType="java.util.Map">
  1181. SELECT
  1182. COUNT( a.id ) AS monitorTotal,
  1183. IFNULL( SUM( IF ( a.work_type IN ( 0, 1 ), 1, 0 )), 0 ) AS innerPeople,
  1184. IFNULL( SUM( IF ( a.work_type = 2, 1, 0 )), 0 ) AS outPeople
  1185. FROM
  1186. sys_user_information a
  1187. LEFT JOIN sys_user b ON a.user_id = b.id
  1188. LEFT JOIN sys_org c ON b.org_id = c.id
  1189. WHERE
  1190. a.duties IN ( 2, 4, 5 )
  1191. AND c.deleted = 0
  1192. and c.is_lock = 0
  1193. AND b.is_manage = 'Y'
  1194. AND c.path LIKE concat(#{orgPath}, '%')
  1195. </select>
  1196. <select id="getSafeHeadToNetwork" resultType="java.lang.Integer">
  1197. SELECT
  1198. COUNT( a.id )
  1199. FROM
  1200. core_safety_book_new a
  1201. LEFT JOIN sys_org b ON a.party_b_org = b.id
  1202. WHERE
  1203. a.type = #{type}
  1204. AND a.sign_level = #{level}
  1205. AND b.deleted = 0
  1206. and b.is_lock = 0
  1207. AND b.path LIKE concat(#{orgPath}, '%')
  1208. </select>
  1209. <select id="getJointHeadToNetwork" resultType="java.lang.Integer">
  1210. SELECT
  1211. COUNT( a.id )
  1212. FROM
  1213. core_safety_book_new a
  1214. LEFT JOIN sys_org b ON a.party_a_org = b.id
  1215. WHERE
  1216. a.type = #{type}
  1217. AND a.sign_level = #{level}
  1218. AND b.path LIKE concat(#{orgPath}, '%')
  1219. </select>
  1220. <select id="getHaveSecurityNetworkNumber" resultType="java.lang.Integer">
  1221. select count(*) from sys_org a
  1222. LEFT JOIN sys_org_extend b on a.id = b.org_id
  1223. WHERE 1=1
  1224. and (b.inner_count > 0 or b.outside_count > 0)
  1225. and a.deleted = 0
  1226. and a.is_lock = 0
  1227. and a.path LIKE concat( #{orgPath}, '%' )
  1228. </select>
  1229. <select id="getHeadSafeCheckNumber" resultType="java.lang.Integer">
  1230. SELECT
  1231. COUNT( a.id )
  1232. FROM
  1233. core_safety_task a
  1234. LEFT JOIN core_safecheck_plan b ON a.plan_id = b.id
  1235. WHERE
  1236. b.check_type = 1
  1237. AND a.org_path LIKE concat(#{orgPath}, '%')
  1238. </select>
  1239. <select id="getHeadSafeCheckNetworkNumber" resultType="java.lang.Integer">
  1240. SELECT
  1241. COUNT( DISTINCT a.org_id )
  1242. FROM
  1243. core_safety_task a
  1244. LEFT JOIN core_safecheck_plan b ON a.plan_id = b.id
  1245. LEFT JOIN sys_org c ON c.id = a.org_id
  1246. WHERE
  1247. b.check_type = 1
  1248. AND c.deleted = 0
  1249. and c.is_lock = 0
  1250. -- AND c.type = 4
  1251. AND a.org_path LIKE concat(#{orgPath}, '%')
  1252. </select>
  1253. <select id="getDangerNumber" resultType="java.util.Map">
  1254. SELECT
  1255. IFNULL( SUM( IF ( confirm_status >= 2 AND reform_status IN ( 10, 11 ), 1, 0 )), 0 ) AS foundDangerNumber,
  1256. IFNULL( SUM( IF ( reform_status = 11, 1, 0 )), 0 ) AS rectificationDangerNumber,
  1257. IFNULL(
  1258. SUM(
  1259. IF
  1260. ( confirm_status >= 2 AND reform_status IN ( 10, 11 ), 1, 0 ))- SUM(
  1261. IF
  1262. ( reform_status = 11, 1, 0 )),
  1263. 0
  1264. ) AS noRectificationDangerNumber
  1265. FROM
  1266. core_question a
  1267. LEFT JOIN core_safety_task b ON a.src_task_id = b.id
  1268. LEFT JOIN core_safecheck_plan c ON c.id = b.plan_id
  1269. WHERE
  1270. src_type = 2
  1271. AND c.check_type = 1
  1272. AND b.org_path LIKE concat(#{orgPath}, '%')
  1273. </select>
  1274. <select id="selectSysOrgByPathAndType" resultType="com.xunmei.system.api.domain.SysOrg">
  1275. SELECT
  1276. *
  1277. FROM
  1278. sys_org
  1279. WHERE
  1280. is_lock=0 AND
  1281. type = #{type}
  1282. AND deleted = 0
  1283. AND is_lock = 0
  1284. <if test="path != null">
  1285. AND path LIKE concat(#{path}, '%')
  1286. </if>
  1287. ORDER BY
  1288. sort
  1289. </select>
  1290. <select id="selectOrgs" resultType="com.xunmei.system.api.domain.SysOrg">
  1291. SELECT
  1292. *
  1293. FROM
  1294. sys_org
  1295. WHERE 1=1
  1296. AND is_lock=0
  1297. AND deleted = 0
  1298. <if test="org.orgPath != null">
  1299. AND path LIKE concat(#{org.orgPath}, '%')
  1300. </if>
  1301. <if test="org.orgType != null">
  1302. AND type = #{org.orgType}
  1303. </if>
  1304. <if test="org.orgName != null">
  1305. AND short_name LIKE concat('%',#{org.orgName}, '%')
  1306. </if>
  1307. ORDER BY
  1308. affiliated_area,affiliated_bank,sort
  1309. </select>
  1310. <select id="exportOrgExtend" resultType="com.xunmei.system.util.OrgExtendExport">
  1311. SELECT
  1312. b.id AS orgId,
  1313. b.affiliated_area AS city,
  1314. b.affiliated_bank AS affiliatedBank,
  1315. b.short_name AS shortName,
  1316. ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'sys_org_type' AND dict_value = b.type ) AS typeName,
  1317. ( CASE b.is_lock WHEN 1 THEN '停用' ELSE '正常' END ) AS status,
  1318. b.address AS address,
  1319. IFNULL(SUBSTR( a.construction_time, 1, 4 ), '' ) AS constructionTime,
  1320. IFNULL(SUBSTR( a.last_update_time, 1, 4 ), '' ) AS lastUpdateTime,
  1321. ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'org_platform_brand' AND dict_value = a.platform_brand ) AS platformBrand,
  1322. IFNULL(a.cash_adding_room,0) AS cashAddingRoom,
  1323. IFNULL(a.cash_adding_room_control_count,0) AS cashAddingRoomControlCount,
  1324. IFNULL(a.remote_count,0) AS remoteCount,
  1325. IFNULL(a.remote_control_count,0) AS remoteControlCount,
  1326. IFNULL(a.total_camera_count,0) AS totalCameraCount,
  1327. IFNULL(a.hd_camera_count,0) AS hdCameraCount,
  1328. ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'property_situation' AND dict_value = a.ownership ) AS ownerShipName,
  1329. ( CASE a.outside_area WHEN 1 THEN '区域内' WHEN 0 THEN '区域外' ELSE '' END ) AS outsideArea,
  1330. ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'duty_options' AND dict_value = a.duty_mode ) AS dutyMode,
  1331. ( CASE a.safe_box WHEN 1 THEN '是' ELSE '否' END ) AS safeBox,
  1332. ( CASE a.self_service_bank WHEN 1 THEN '是' ELSE '否' END ) AS selfServiceBank,
  1333. IF(b.type = 4,IFNULL(a.wall_penetrating_equipment,0),0) AS onLineWallPenetratingEquipment,
  1334. IF(b.type = 4,IFNULL(a.lobby_equipment,0),0) AS onLineLobbyEquipment,
  1335. IF(b.type = 5,IFNULL(a.wall_penetrating_equipment,0),0) AS departureWallPenetratingEquipment,
  1336. IF(b.type = 5,IFNULL(a.lobby_equipment,0),0) AS departureLobbyEquipment,
  1337. ( CASE a.business_library WHEN 1 THEN '是' ELSE '否' END ) AS businessLibrary,
  1338. ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'business_type' AND dict_value = a.business_library_type ) AS businessLibraryTypeName,
  1339. ( CASE a.askari WHEN 1 THEN '是' ELSE '否' END ) AS askari,
  1340. IFNULL(a.inner_count,0) AS innerCount,
  1341. IFNULL(a.outside_count,0) AS outsideCount,
  1342. ( CASE WHEN a.askari_certificate IS NULL THEN '否' ELSE '是' END ) AS isAskariCertificate,
  1343. a.askari_certificate AS askariCertificate
  1344. FROM
  1345. sys_org b
  1346. LEFT JOIN sys_org_extend a ON a.org_id = b.id
  1347. -- LEFT JOIN core_weather_city c on a.weather_area_code = c.AREAID
  1348. WHERE
  1349. b.deleted = 0
  1350. <!-- <if test="org.checkSub==true">
  1351. and b.path like concat(#{org.path},"%")
  1352. </if>
  1353. <if test="org.checkSub==false">
  1354. and b.id = #{org.parentId}
  1355. </if>-->
  1356. <if test=" org.checkSub != null and org.checkSub == true">
  1357. and b.path like concat(concat('%',#{org.path}),'%')
  1358. </if>
  1359. <if test=" org.checkSub != null and org.checkSub == false">
  1360. and b.path like concat('%',#{org.path})
  1361. </if>
  1362. <if test=" org.isLock != null ">
  1363. AND b.is_lock = #{org.isLock}
  1364. </if>
  1365. <if test="typeList != null and typeList.size > 0">
  1366. AND b.type IN
  1367. <foreach collection="typeList" item="orgType" open="(" separator="," close=")">
  1368. #{orgType}
  1369. </foreach>
  1370. </if>
  1371. order by b.affiliated_bank asc,b.is_lock asc
  1372. </select>
  1373. <select id="exportDefenseDetailExtend" resultType="com.xunmei.system.util.OrgPhysicalDefenseConstructionDetailExport">
  1374. SELECT
  1375. b.id AS orgId,
  1376. b.affiliated_area AS city,
  1377. b.affiliated_bank AS affiliatedBank,
  1378. b.short_name AS shortName,
  1379. ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'sys_org_type' AND dict_value = b.type ) AS typeName,
  1380. ( CASE b.is_lock WHEN 1 THEN '停用' ELSE '正常' END ) AS status,
  1381. b.address AS address,
  1382. ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'org_extend_type' AND dict_value = a.type ) AS extendTypeName,
  1383. ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'org_extend_standard' AND dict_value = a.standard ) AS standard,
  1384. IFNULL(SUBSTR( a.date_of_compliance, 1, 10 ), '' ) AS dateOfCompliance,
  1385. a.reason as reason,
  1386. IFNULL(SUBSTR( a.date_of_complete, 1, 10 ), '' ) AS dateOfComplete,
  1387. a.certificate as certificate
  1388. FROM
  1389. sys_org b
  1390. LEFT JOIN sys_org_physical_defense_construction a ON a.org_id = b.id
  1391. WHERE
  1392. b.deleted = 0
  1393. <if test=" org.checkSub != null and org.checkSub == true">
  1394. and b.path like concat(concat('%',#{org.path}),'%')
  1395. </if>
  1396. <if test=" org.checkSub != null and org.checkSub == false">
  1397. and b.path like concat('%',#{org.path})
  1398. </if>
  1399. <if test=" org.isLock != null ">
  1400. AND b.is_lock = #{org.isLock}
  1401. </if>
  1402. <if test="typeList != null and typeList.size > 0">
  1403. AND b.type IN
  1404. <foreach collection="typeList" item="orgType" open="(" separator="," close=")">
  1405. #{orgType}
  1406. </foreach>
  1407. </if>
  1408. order by b.affiliated_bank asc,b.is_lock asc
  1409. </select>
  1410. </mapper>