SysOrgMapper.xml 62 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526
  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. affiliated_bank,
  650. affiliated_area,
  651. if(sort is null,0,sort) as sort
  652. FROM sys_org
  653. WHERE deleted = 0
  654. ORDER BY isnull(sort),sort, path
  655. </select>
  656. <select id="selectOrgList" resultType="com.xunmei.system.api.domain.SysOrg">
  657. select o.*,e.weather_area_code as weather_city_code from sys_org o
  658. left join sys_org_extend e on o.id = e.org_id
  659. WHERE deleted = 0
  660. <if test=" org.isLock != null">
  661. and o.is_lock =#{org.isLock}
  662. </if>
  663. <if test=" org.type != null and org.type !=''">
  664. and o.type =#{org.type}
  665. </if>
  666. <if test=" org.name != null and org.name !=''">
  667. and (o.name like concat(concat('%',#{org.name}),'%') or o.short_name like concat(concat('%',#{org.name}),'%'))
  668. </if>
  669. <if test=" org.code != null and org.code !=''">
  670. and o.code like concat(concat('%',#{org.code}),'%')
  671. </if>
  672. <!-- <if test=" org.parentId != null and org.parentId !=''">-->
  673. <!-- and o.parent_id =#{org.parentId}-->
  674. <!-- </if>-->
  675. <if test=" org.checkSub != null and org.checkSub == true">
  676. and o.path like concat(concat('%',#{org.path}),'%')
  677. </if>
  678. <if test=" org.checkSub != null and org.checkSub == false">
  679. and o.path like concat('%',#{org.path})
  680. </if>
  681. and o.name != '机关' and o.name != '各部门'
  682. ORDER BY o.affiliated_area desc,o.affiliated_bank desc, o.is_lock, isnull(o.sort),o.sort, o.path
  683. </select>
  684. <select id="getOrgIdByTaskId" resultType="java.lang.Long">
  685. SELECT org_id
  686. FROM core_monitoring_retrieval_task cmrt
  687. WHERE id = #{taskId}
  688. </select>
  689. <select id="selectOrgTypeByIdList" resultType="java.lang.Long">
  690. select distinct type
  691. from sys_org
  692. where id in
  693. <foreach collection="orgIdList" item="item" open="(" separator="," close=")">
  694. #{item}
  695. </foreach>
  696. </select>
  697. <select id="findByOrgTypeAndParent" resultType="com.xunmei.system.api.domain.SysOrg">
  698. select c.* from sys_org c where c.type = #{orgType} and c.path like concat('%',#{path}, '%') and deleted=0
  699. </select>
  700. <select id="selectByOrgName" resultType="com.xunmei.system.api.domain.SysOrg">
  701. SELECT * FROM sys_org WHERE `name` =#{name} AND deleted=0
  702. </select>
  703. <select id="findByOrgTypesAndParent" resultType="com.xunmei.system.api.domain.SysOrg">
  704. select c.* from sys_org c where c.path like concat('%',#{path}, '%') and deleted=0
  705. and
  706. c.type in
  707. <foreach collection="types" item="type" separator="," open="(" close=")">
  708. #{type}
  709. </foreach>
  710. </select>
  711. <select id="selectNetworkNumberByPath" resultType="java.lang.Integer">
  712. SELECT COUNT(1) FROM sys_org WHERE path LIKE concat( #{orgPath}, '%') AND type=4 AND deleted=0 AND is_lock=0
  713. </select>
  714. <select id="complianceStatus" resultType="com.xunmei.system.util.OrgPhysicalDefenseConstructionExport">
  715. select
  716. sum(if((t.ga382021 + t.ga382015) > 0,1,0 )) as reachNumber,
  717. sum(if(t.ga382021 > 0,1,0)) as newReachNumber,
  718. sum(if((t.ga382015 -t.ga382021 > 0),1,0)) as oldReachNumber,
  719. IFNULL(
  720. CONCAT(
  721. ROUND( sum(if((t.ga382021 + t.ga382015) > 0,1,0 ))/ COUNT(*)* 100, 2 ),
  722. '%'
  723. ),
  724. '0%'
  725. ) AS reachRate
  726. from (
  727. select
  728. b.id as org_id,
  729. if(a.banking2021 > 0 , 1, 0) as 'ga382021',
  730. if(a.banking2015 > 0 and a.banking2021 = 0 , 1, 0 ) as 'ga382015'
  731. from sys_org b
  732. LEFT JOIN (SELECT org_id,
  733. type,
  734. sum(type = 1 and standard = 1) banking2021,
  735. sum(type = 1 and standard = 2) banking2015
  736. FROM sys_org_physical_defense_construction
  737. WHERE type = 1
  738. GROUP BY org_id) a on a.org_id = b.id
  739. where 1=1
  740. AND b.deleted = 0
  741. AND b.is_lock = 0
  742. AND b.type = 4
  743. AND a.type = 1
  744. AND b.path LIKE concat(#{orgPath}, '%')
  745. GROUP BY b.id ) t
  746. </select>
  747. <select id="rectificationStatus" resultType="java.lang.Integer">
  748. SELECT
  749. IFNULL(SUM(IF(a.standard=1,1,0)),0)
  750. FROM
  751. sys_org_physical_defense_construction a LEFT JOIN sys_org b ON a.org_id=b.id
  752. WHERE
  753. a.date_of_compliance LIKE concat(#{year}, '%')
  754. AND a.type = 1
  755. AND b.path LIKE concat(#{orgPath}, '%')
  756. </select>
  757. <select id="oldRectificationStatus" resultType="java.lang.Integer">
  758. SELECT
  759. COUNT( DISTINCT a.org_id )
  760. FROM
  761. sys_org_physical_defense_construction a
  762. INNER JOIN sys_org b ON a.org_id = b.id
  763. WHERE
  764. a.org_id IN (
  765. SELECT
  766. org_id
  767. FROM
  768. sys_org_physical_defense_construction
  769. where
  770. type = 1
  771. GROUP BY
  772. org_id
  773. HAVING
  774. (
  775. IF
  776. ( LOCATE( 1, GROUP_CONCAT( standard ))> 0, 1, 0 )+
  777. IF
  778. ( LOCATE( 2, GROUP_CONCAT( standard ))> 0, 1, 0 ))= 2
  779. AND date_of_compliance LIKE concat(#{year}, '%')
  780. )AND b.path LIKE concat(#{orgPath}, '%')
  781. </select>
  782. <select id="noRectificationStatus" resultType="java.lang.Integer">
  783. SELECT
  784. COUNT( DISTINCT org_id )
  785. FROM
  786. sys_org_physical_defense_construction a LEFT JOIN sys_org b ON a.org_id=b.id
  787. WHERE
  788. org_id IN (
  789. SELECT
  790. GROUP_CONCAT( DISTINCT org_id )
  791. FROM
  792. sys_org_physical_defense_construction
  793. where type = 1
  794. GROUP BY
  795. org_id
  796. HAVING
  797. (
  798. IF
  799. ( LOCATE( 1, GROUP_CONCAT( standard ))> 0, 1, 0 )+
  800. IF
  801. ( LOCATE( 3, GROUP_CONCAT( standard ))> 0, 1, 0 ))= 2
  802. AND date_of_compliance LIKE concat(#{year}, '%')
  803. ) AND b.path LIKE concat(#{orgPath}, '%')
  804. </select>
  805. <select id="selectConstructionDetail" resultType="com.xunmei.system.util.ConstructionDetailExport">
  806. <!-- SELECT-->
  807. <!-- a.org_id AS orgId,-->
  808. <!-- IFNULL( b.ownership, 0 ) AS ownership,-->
  809. <!-- IF-->
  810. <!-- (-->
  811. <!-- IF-->
  812. <!-- ( LOCATE( 1, GROUP_CONCAT( a.standard ))> 0, 1, 0 )+-->
  813. <!-- IF-->
  814. <!-- ( LOCATE( 2, GROUP_CONCAT( a.standard ))> 0, 1, 0 )>= 1,-->
  815. <!-- 1,-->
  816. <!-- 0-->
  817. <!-- ) AS complianceStatus,-->
  818. <!-- IFNULL(SUBSTR( a.date_of_compliance, 1, 10 ), '' ) AS complianceDate,-->
  819. <!-- IF-->
  820. <!-- (-->
  821. <!-- IF-->
  822. <!-- ( LOCATE( 1, GROUP_CONCAT( a.standard ))> 0, 1, 0 )+-->
  823. <!-- IF-->
  824. <!-- ( LOCATE( 2, GROUP_CONCAT( a.standard ))> 0, 1, 0 )>= 1,-->
  825. <!-- NULL,-->
  826. <!-- a.reason-->
  827. <!-- ) AS reason,-->
  828. <!-- IFNULL(SUBSTR( a.date_of_complete, 1, 10 ), '' ) AS completeDate,-->
  829. <!-- c.address as address,-->
  830. <!-- c.affiliated_area as city,-->
  831. <!-- c.affiliated_bank as orgName,-->
  832. <!-- c.short_name as networkName-->
  833. <!-- FROM-->
  834. <!-- sys_org c-->
  835. <!-- LEFT JOIN sys_org_physical_defense_construction a ON c.id=a.org_id-->
  836. <!-- LEFT JOIN sys_org_extend b ON a.org_id = b.org_id-->
  837. <!-- WHERE c.type=4-->
  838. <!-- and c.deleted = 0-->
  839. <!-- and c.is_lock = 0-->
  840. <!-- and a.type =1-->
  841. <!-- and c.path like concat(#{orgPath}, '%')-->
  842. <!-- GROUP BY-->
  843. <!-- a.org_id-->
  844. SELECT
  845. c.id AS orgId,
  846. IFNULL( b.ownership, 0 ) AS ownership,
  847. case when a.banking2021=1 then 2021 when a.banking2015=1 then 2015 when a.unGA38=1 then 1 else 0 end as complianceStatus,
  848. IFNULL(SUBSTR( a.date_of_compliance, 1, 10 ), '' ) AS complianceDate,
  849. IF
  850. (
  851. a.unGA38=1,
  852. a.reason,
  853. ''
  854. ) AS reason,
  855. IF( a.unGA38=1, IFNULL(SUBSTR( a.date_of_complete, 1, 10 ), '' ),'') AS completeDate,
  856. c.address as address,
  857. c.address as address,
  858. c.affiliated_area as city,
  859. c.affiliated_bank as orgName,
  860. c.short_name as networkName
  861. FROM
  862. sys_org c
  863. LEFT JOIN (select org_id,date_of_compliance,reason,date_of_complete,
  864. banking2021,
  865. if(banking2015 > 0 and banking2021 = 0, 1, 0) as banking2015,
  866. if(unGA38 >0 and banking2015 = 0 and banking2021 = 0, 1, 0) as unGA38
  867. from (SELECT org_id,Max(date_of_compliance) as date_of_compliance,reason,date_of_complete,
  868. sum(standard = 1) banking2021,
  869. sum(standard = 2) banking2015,
  870. sum(standard = 3) unGA38
  871. FROM sys_org_physical_defense_construction
  872. WHERE type = 1
  873. GROUP BY org_id) t1) a ON c.id = a.org_id
  874. LEFT JOIN sys_org_extend b ON c.id = b.org_id
  875. WHERE c.type=4
  876. and c.deleted = 0
  877. and c.is_lock = 0
  878. and c.path like concat(#{orgPath}, '%')
  879. ORDER BY
  880. FIND_IN_SET( c.affiliated_bank, #{findInSetOrder} ),
  881. c.is_lock,
  882. isnull( c.sort ),
  883. c.sort,
  884. c.short_name
  885. </select>
  886. <select id="getReachNumber" resultType="java.lang.Integer">
  887. 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
  888. LEFT JOIN sys_org b on a.org_id = b.id
  889. where 1=1
  890. AND b.deleted = 0
  891. and b.is_lock = 0
  892. and b.type=4
  893. AND b.path LIKE concat(#{orgPath}, '%')
  894. </select>
  895. <select id="getOwnership" resultType="java.lang.Integer">
  896. SELECT
  897. IFNULL( SUM( IF ( a.ownership = 2, 1, 0 )), 0 )
  898. FROM
  899. sys_org_extend a
  900. LEFT JOIN sys_org b ON a.org_id = b.id
  901. WHERE b.type=4 and b.deleted = 0 and b.is_lock = 0 and b.path LIKE concat(#{orgPath}, '%')
  902. </select>
  903. <select id="getOutside" resultType="java.lang.Integer">
  904. SELECT
  905. IFNULL( SUM( IF ( a.outside_area = 0, 1, 0 )), 0 )
  906. FROM
  907. sys_org_extend a
  908. LEFT JOIN sys_org b ON a.org_id = b.id
  909. where
  910. 1=1
  911. and b.path LIKE concat(#{orgPath}, '%')
  912. and b.is_lock = 0
  913. and b.deleted = 0
  914. </select>
  915. <select id="getLibrary" resultType="java.util.Map">
  916. SELECT
  917. sum( a.yywd + a.zxywk ) AS total,
  918. a.one,
  919. a.two,
  920. a.three,
  921. a.four
  922. FROM
  923. (
  924. SELECT
  925. IFNULL( sum( IF ( b.type = 6, 1, 0 )), 0 ) AS yywd,
  926. IFNULL( sum( IF ( b.type = 4 AND a.business_library = 1, 1, 0 )), 0 ) AS zxywk,
  927. IFNULL( sum( IF ( a.business_library_type = 1, 1, 0 )), 0 ) AS one,
  928. IFNULL( SUM( IF ( a.business_library_type = 2, 1, 0 )), 0 ) AS two,
  929. IFNULL( SUM( IF ( a.business_library_type = 3, 1, 0 )), 0 ) AS three,
  930. IFNULL( SUM( IF ( a.business_library_type = 4, 1, 0 )), 0 ) AS four
  931. FROM
  932. sys_org b
  933. LEFT JOIN sys_org_extend a ON a.org_id = b.id
  934. WHERE
  935. b.is_lock = 0
  936. and b.path LIKE concat(#{orgPath}, '%')
  937. and b.deleted = 0
  938. AND (b.type = 4 OR b.type = 5 OR b.type = 6)
  939. ) a
  940. </select>
  941. <select id="getCollectLibrary" resultType="java.lang.Integer">
  942. SELECT
  943. SUM(
  944. IF
  945. ( a.safe_box = 1, 1, 0 ))
  946. FROM
  947. sys_org_extend a
  948. LEFT JOIN sys_org b ON a.org_id = b.id
  949. WHERE
  950. 1=1
  951. and b.path LIKE concat(#{orgPath}, '%')
  952. and b.is_lock = 0
  953. and b.deleted = 0
  954. </select>
  955. <select id="getOnLine" resultType="java.util.Map">
  956. SELECT
  957. (
  958. SELECT
  959. IFNULL( SUM( IF ( b.self_service_bank = 1, 1, 0 )), 0 ) AS onLineTotal
  960. FROM
  961. sys_org a
  962. LEFT JOIN sys_org_extend b ON a.id = b.org_id
  963. WHERE
  964. 1=1
  965. AND a.deleted = 0
  966. and a.is_lock = 0
  967. and a.path LIKE concat( #{orgPath}, '%' )) AS onLineTotal,
  968. (
  969. 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
  970. LEFT JOIN sys_org b on a.org_id = b.id
  971. where 1=1
  972. AND b.deleted = 0
  973. and b.is_lock = 0
  974. AND b.path LIKE concat(#{orgPath}, '%' )) AS onLineReachNumber
  975. FROM
  976. DUAL
  977. </select>
  978. <select id="getDeparture" resultType="java.util.Map">
  979. SELECT
  980. (
  981. SELECT
  982. count( 1 )
  983. FROM
  984. sys_org
  985. WHERE
  986. type = 5
  987. AND deleted = 0
  988. AND is_lock = 0
  989. AND path LIKE concat( #{orgPath}, '%' )) AS departureTotal,
  990. (
  991. select SUM(a.size) from (select org_id,if(count(1) > 0,1,0) as size from
  992. sys_org_physical_defense_construction where standard =1 and type = 3 GROUP BY org_id) a
  993. LEFT JOIN sys_org b on a.org_id = b.id
  994. where 1=1
  995. AND b.deleted = 0
  996. and b.is_lock = 0
  997. AND b.path LIKE concat(#{orgPath}, '%' )) AS departureReachNumber
  998. FROM
  999. DUAL
  1000. </select>
  1001. <select id="getSelfEquipment" resultType="java.util.Map">
  1002. select
  1003. t.onLineThroughWalls,
  1004. t.onLineLobbyImplement,
  1005. t.departureThroughWalls,
  1006. t.departureLobbyImplement,
  1007. ( t.onLineThroughWalls + t.onLineLobbyImplement + t.departureThroughWalls + t.departureLobbyImplement ) AS selfServiceDevicesTotal
  1008. from (
  1009. select
  1010. (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,
  1011. (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,
  1012. (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,
  1013. (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
  1014. from dual
  1015. ) t
  1016. </select>
  1017. <select id="getCenterConstruction" resultType="java.util.Map">
  1018. SELECT
  1019. IFNULL(SUBSTR( b.construction_time, 1, 4 ), '' ) as centerConstructionTime,
  1020. IFNULL(SUBSTR( b.last_update_time, 1, 4 ), '' )AS transformTime,
  1021. b.platform_brand AS brand,
  1022. IFNULL( b.hd_camera_count, 0 ) AS hdCameraCount,
  1023. IFNULL( b.total_camera_count, 0 ) AS totalCameraCount
  1024. FROM
  1025. ( 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
  1026. LEFT JOIN sys_org_extend b ON a.id = b.org_id
  1027. </select>
  1028. <select id="getCamera" resultType="java.util.Map">
  1029. SELECT
  1030. IFNULL( COUNT( a.id ), 0 ) AS cameraTotal,
  1031. IFNULL( SUM( IF ( a.definition = 1, 1, 0 )), 0 ) AS definitionNumber
  1032. FROM
  1033. sys_device a
  1034. LEFT JOIN sys_org b ON a.org_id = b.id
  1035. WHERE
  1036. a.del_flag = 0
  1037. AND a.device_type = 2
  1038. AND b.deleted = 0
  1039. and b.is_lock = 0
  1040. AND b.path LIKE concat(#{orgPath}, '%')
  1041. </select>
  1042. <select id="getRemote" resultType="java.util.Map">
  1043. SELECT
  1044. IFNULL( SUM( a.cash_adding_room ), 0 ) AS cashAddingRoom,
  1045. IFNULL( SUM( a.remote_count ), 0 ) AS remoteCount,
  1046. IFNULL( SUM( a.cash_adding_room_control_count ), 0 ) AS cashAddingRoomControlCount,
  1047. IFNULL( SUM( a.remote_control_count ), 0 ) AS remoteControlCount
  1048. FROM
  1049. ( 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
  1050. LEFT JOIN sys_org_extend a ON a.org_id = b.id
  1051. where
  1052. 1=1
  1053. and b.type = 10
  1054. and b.deleted = 0
  1055. and b.is_lock = 0
  1056. </select>
  1057. <select id="getDuty" resultType="java.util.Map">
  1058. SELECT
  1059. IFNULL( SUM( IF ( duty_mode = 2, 1, 0 )), 0 ) AS localDutyNetworkNumber,
  1060. IFNULL( SUM( IF ( duty_mode = 1, 1, 0 )), 0 ) AS remoteDutyNetworkNumber
  1061. FROM
  1062. sys_org_extend a
  1063. LEFT JOIN sys_org b ON a.org_id = b.id
  1064. WHERE
  1065. 1=1
  1066. and b.deleted = 0
  1067. and b.is_lock = 0
  1068. and b.type = 4
  1069. and b.path LIKE concat(#{orgPath}, '%')
  1070. </select>
  1071. <select id="getCertificate" resultType="java.util.Map">
  1072. SELECT
  1073. IFNULL( SUM( a.inner_count ), 0 ) AS internalCertificateNumber,
  1074. IFNULL( SUM( a.outside_count ), 0 ) AS outsourceCertificateNumber,
  1075. IFNULL( SUM( a.inner_count )+ SUM( a.outside_count ), 0 ) AS certificateTotal,
  1076. (
  1077. SELECT
  1078. count(*)
  1079. FROM
  1080. sys_user a
  1081. LEFT JOIN sys_user_information b ON a.id = b.user_id
  1082. LEFT JOIN sys_org c ON a.org_id = c.id
  1083. WHERE
  1084. 1 = 1
  1085. AND b.dept_id = 2
  1086. AND b.certificate_work = '1'
  1087. AND a.is_manage = 'Y'
  1088. AND c.deleted = 0
  1089. and c.is_lock = 0
  1090. AND c.path LIKE concat(#{orgPath}, '%')) AS certificatePeopleNumber
  1091. FROM
  1092. sys_org_extend a
  1093. LEFT JOIN sys_org b ON a.org_id = b.id
  1094. WHERE
  1095. 1=1
  1096. AND b.deleted = 0
  1097. and b.is_lock = 0
  1098. and b.path LIKE concat(#{orgPath}, '%')
  1099. </select>
  1100. <select id="getSafe" resultType="java.lang.Integer">
  1101. SELECT
  1102. COUNT( a.id )
  1103. FROM
  1104. core_safety_task a
  1105. LEFT JOIN sys_org b ON a.org_id = b.id
  1106. LEFT JOIN core_safecheck_plan c ON a.plan_id = c.id
  1107. WHERE
  1108. a.deleted = 0
  1109. AND b.deleted = 0
  1110. and b.is_lock = 0
  1111. AND c.check_type =3
  1112. AND a.`status` =3
  1113. and a.org_path LIKE concat(#{orgPath}, '%')
  1114. AND a.start_time BETWEEN #{startTime} and #{endTime}
  1115. </select>
  1116. <select id="getEduNumber" resultType="java.lang.Integer">
  1117. SELECT
  1118. COUNT( a.id )
  1119. FROM
  1120. core_edu_training_task a
  1121. LEFT JOIN sys_org c ON a.org_id = c.id
  1122. WHERE
  1123. c.type =3
  1124. AND a.`status`=2
  1125. and a.org_path like concat(concat('%',#{orgPath}),'%')
  1126. AND a.training_start_date_time BETWEEN #{startTime} and #{endTime}
  1127. </select>
  1128. <select id="getEduUser" resultType="java.lang.Integer">
  1129. SELECT
  1130. COUNT( b.edu_training_task_id )
  1131. FROM
  1132. core_edu_training_task a
  1133. LEFT JOIN core_edu_training_task_to_user b ON a.id = b.edu_training_task_id
  1134. WHERE
  1135. b.type = 1 and a.org_path like concat(concat('%',#{orgPath}),'%')
  1136. </select>
  1137. <select id="getQuarterDrillNumber" resultType="java.lang.Integer">
  1138. SELECT
  1139. COUNT(a.id)
  1140. FROM
  1141. core_drill_task a
  1142. -- LEFT JOIN core_drill_plan b ON a.plan_id = b.id
  1143. LEFT JOIN sys_org c ON a.org_id = c.id
  1144. WHERE c.type=3
  1145. AND a.`status`=2
  1146. and a.org_path like concat(concat('%',#{orgPath}),'%')
  1147. AND a.drill_start_time BETWEEN #{startTime} and #{endTime}
  1148. </select>
  1149. <select id="getQuarterDrillPeopleNumber" resultType="java.lang.Integer">
  1150. SELECT
  1151. COUNT( c.drill_task_id )
  1152. FROM
  1153. core_drill_task a
  1154. LEFT JOIN core_drill_plan b ON a.plan_id = b.id
  1155. LEFT JOIN core_drill_task_to_user c ON c.drill_task_id = a.id
  1156. WHERE
  1157. b.exec_org_type = 3
  1158. and a.org_path like concat(concat('%',#{orgPath}),'%')
  1159. </select>
  1160. <select id="getQuarterAllNetworkDrillNumber" resultType="java.lang.Integer">
  1161. SELECT
  1162. COUNT(a.id)
  1163. FROM
  1164. core_drill_task a
  1165. LEFT JOIN core_drill_plan b ON a.plan_id = b.id
  1166. WHERE b.exec_org_type=4
  1167. and a.`status`=2
  1168. and a.org_path like concat(concat('%',#{orgPath}),'%')
  1169. AND a.drill_start_time BETWEEN #{startTime} and #{endTime}
  1170. </select>
  1171. <select id="getQuarterAllNetworkDrillPeopleNumber" resultType="java.lang.Integer">
  1172. SELECT
  1173. COUNT( c.drill_task_id )
  1174. FROM
  1175. core_drill_task a
  1176. LEFT JOIN core_drill_plan b ON a.plan_id = b.id
  1177. LEFT JOIN core_drill_task_to_user c ON c.drill_task_id = a.id
  1178. WHERE
  1179. b.exec_org_type = 4
  1180. and a.org_path like concat(concat('%',#{orgPath}),'%')
  1181. AND a.drill_start_time BETWEEN #{startTime} and #{endTime}
  1182. </select>
  1183. <select id="getAlone" resultType="java.lang.Integer">
  1184. select count(*) from sys_org_extend a
  1185. LEFT JOIN sys_org b on a.org_id = b.id where a.alone_dept = 'Y' and b.path LIKE concat(#{orgPath}, '%')
  1186. </select>
  1187. <select id="getManager" resultType="java.lang.Integer">
  1188. SELECT
  1189. COUNT( * )
  1190. FROM
  1191. sys_user_information a
  1192. LEFT JOIN sys_user b ON a.user_id = b.id
  1193. LEFT JOIN sys_org c ON b.org_id = c.id
  1194. WHERE
  1195. 1 = 1
  1196. AND c.deleted = 0
  1197. and c.is_lock = 0
  1198. AND a.is_full_time = #{isFull}
  1199. AND a.duties in ('1','2','3')
  1200. AND b.is_manage = 'Y'
  1201. AND c.path LIKE concat(#{orgPath}, '%')
  1202. </select>
  1203. <select id="getManagerCertificate" resultType="java.lang.Integer">
  1204. SELECT
  1205. COUNT( * )
  1206. FROM
  1207. sys_user_information a
  1208. LEFT JOIN sys_user b ON a.user_id = b.id
  1209. LEFT JOIN sys_org c ON b.org_id = c.id
  1210. WHERE
  1211. 1 = 1
  1212. AND c.deleted = 0
  1213. and c.is_lock = 0
  1214. AND a.certificate_work = 1
  1215. AND a.duties in ('1','2','3')
  1216. AND b.is_manage = 'Y'
  1217. AND c.path LIKE concat(#{orgPath}, '%')
  1218. </select>
  1219. <select id="getIsMonitor" resultType="java.lang.String">
  1220. SELECT
  1221. IF
  1222. ( COUNT( a.id ) > 0, '是', '否' )
  1223. FROM
  1224. sys_user_information a
  1225. LEFT JOIN sys_user b ON a.user_id = b.id
  1226. LEFT JOIN sys_org c ON b.org_id = c.id
  1227. WHERE
  1228. a.duties = #{duties}
  1229. and c.deleted = 0
  1230. and c.is_lock = 0
  1231. AND b.is_manage = 'Y'
  1232. AND c.path LIKE concat(#{orgPath}, '%')
  1233. </select>
  1234. <select id="getMonitorPeople" resultType="java.util.Map">
  1235. SELECT
  1236. COUNT( a.id ) AS monitorTotal,
  1237. IFNULL( SUM( IF ( a.work_type IN ( 0, 1 ), 1, 0 )), 0 ) AS innerPeople,
  1238. IFNULL( SUM( IF ( a.work_type = 2, 1, 0 )), 0 ) AS outPeople
  1239. FROM
  1240. sys_user_information a
  1241. LEFT JOIN sys_user b ON a.user_id = b.id
  1242. LEFT JOIN sys_org c ON b.org_id = c.id
  1243. WHERE
  1244. a.duties IN ( 2, 4, 5 )
  1245. AND c.deleted = 0
  1246. and c.is_lock = 0
  1247. AND b.is_manage = 'Y'
  1248. AND c.path LIKE concat(#{orgPath}, '%')
  1249. </select>
  1250. <select id="getSafeHeadToNetwork" resultType="java.lang.Integer">
  1251. SELECT
  1252. COUNT( a.id )
  1253. FROM
  1254. core_safety_book_new a
  1255. LEFT JOIN sys_org b ON a.party_b_org = b.id
  1256. WHERE
  1257. a.type = #{type}
  1258. AND a.sign_level = #{level}
  1259. AND b.deleted = 0
  1260. and b.is_lock = 0
  1261. AND b.path LIKE concat(#{orgPath}, '%')
  1262. </select>
  1263. <select id="getJointHeadToNetwork" resultType="java.lang.Integer">
  1264. SELECT
  1265. COUNT( a.id )
  1266. FROM
  1267. core_safety_book_new a
  1268. LEFT JOIN sys_org b ON a.party_a_org = b.id
  1269. WHERE
  1270. a.type = #{type}
  1271. AND a.sign_level = #{level}
  1272. AND b.path LIKE concat(#{orgPath}, '%')
  1273. </select>
  1274. <select id="getHaveSecurityNetworkNumber" resultType="java.lang.Integer">
  1275. select count(*) from sys_org a
  1276. LEFT JOIN sys_org_extend b on a.id = b.org_id
  1277. WHERE 1=1
  1278. and a.deleted = 0
  1279. and a.is_lock = 0
  1280. and a.type = 4
  1281. and b.askari = 1
  1282. and a.path LIKE concat( #{orgPath}, '%' )
  1283. </select>
  1284. <select id="getHeadSafeCheckNumber" resultType="java.lang.Integer">
  1285. SELECT
  1286. count(a.id)
  1287. FROM
  1288. core_safety_task a
  1289. LEFT JOIN core_safecheck_plan b ON a.plan_id = b.id
  1290. WHERE
  1291. b.check_type = 4
  1292. AND b.plan_create_org_id != b.plan_of_org_id
  1293. AND a.`status` =3
  1294. AND a.ymd_year =#{year}
  1295. AND a.check_org_id =#{orgId}
  1296. </select>
  1297. <select id="getHeadSafeCheckNetworkNumber" resultType="java.lang.Integer">
  1298. SELECT
  1299. COUNT( DISTINCT a.org_id )
  1300. FROM
  1301. core_safety_task a
  1302. LEFT JOIN core_safecheck_plan b ON a.plan_id = b.id
  1303. -- LEFT JOIN sys_org c ON c.id = a.org_id
  1304. WHERE
  1305. b.check_type = 4
  1306. AND b.plan_create_org_id != b.plan_of_org_id
  1307. AND a.`status` =3
  1308. -- AND c.deleted = 0
  1309. -- and c.is_lock = 0
  1310. -- AND c.type = 4
  1311. AND a.ymd_year =#{year}
  1312. AND a.check_org_id =#{orgId}
  1313. </select>
  1314. <select id="getDangerNumber" resultType="java.util.Map">
  1315. SELECT
  1316. IFNULL( SUM( IF ( confirm_status >= 2 AND reform_status IN ( 10, 11,12,13 ), 1, 0 )), 0 ) AS foundDangerNumber,
  1317. IFNULL( SUM( IF ( reform_status = 11, 1, 0 )), 0 ) AS rectificationDangerNumber,
  1318. IFNULL(
  1319. SUM(
  1320. IF
  1321. ( confirm_status >= 2 AND reform_status IN ( 10,11,12,13 ), 1, 0 ))- SUM(
  1322. IF
  1323. ( reform_status = 11, 1, 0 )),
  1324. 0
  1325. ) AS noRectificationDangerNumber
  1326. FROM
  1327. core_question a
  1328. LEFT JOIN core_safety_task b ON a.src_task_id = b.id
  1329. LEFT JOIN core_safecheck_plan c ON c.id = b.plan_id
  1330. WHERE
  1331. src_type = 2
  1332. AND c.check_type = 4
  1333. AND c.plan_create_org_id != c.plan_of_org_id
  1334. AND b.ymd_year =#{year}
  1335. AND b.check_org_id =#{orgId}
  1336. </select>
  1337. <select id="selectSysOrgByPathAndType" resultType="com.xunmei.system.api.domain.SysOrg">
  1338. SELECT
  1339. *
  1340. FROM
  1341. sys_org
  1342. WHERE
  1343. is_lock=0 AND
  1344. type = #{type}
  1345. AND deleted = 0
  1346. <if test="path != null">
  1347. AND path LIKE concat(#{path}, '%')
  1348. </if>
  1349. ORDER BY
  1350. sort
  1351. </select>
  1352. <select id="selectOrgByPathAndType" resultType="com.xunmei.system.api.domain.SysOrg">
  1353. SELECT
  1354. *
  1355. FROM
  1356. sys_org
  1357. WHERE
  1358. type = #{type}
  1359. AND deleted = 0
  1360. <if test="path != null">
  1361. AND path LIKE concat(#{path}, '%')
  1362. </if>
  1363. ORDER BY
  1364. sort
  1365. </select>
  1366. <select id="selectOrgs" resultType="com.xunmei.system.dto.SysSelectOrgComponentDto">
  1367. SELECT
  1368. id,
  1369. type,
  1370. yewd_level,
  1371. short_name,
  1372. path,
  1373. affiliated_area,
  1374. affiliated_bank
  1375. FROM
  1376. sys_org
  1377. WHERE 1=1
  1378. AND is_lock=0
  1379. AND deleted = 0
  1380. <if test="org.orgPath != null">
  1381. AND path LIKE concat(#{org.orgPath}, '%')
  1382. </if>
  1383. <if test="org.orgType != null">
  1384. AND type = #{org.orgType}
  1385. </if>
  1386. <if test="org.orgName != null">
  1387. AND short_name LIKE concat('%',#{org.orgName}, '%')
  1388. </if>
  1389. ORDER BY
  1390. affiliated_area,affiliated_bank,sort
  1391. </select>
  1392. <select id="exportOrgExtend" resultType="com.xunmei.system.util.OrgExtendExport">
  1393. SELECT
  1394. b.id AS orgId,
  1395. b.affiliated_area AS city,
  1396. b.affiliated_bank AS affiliatedBank,
  1397. b.short_name AS shortName,
  1398. ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'sys_org_type' AND dict_value = b.type ) AS typeName,
  1399. ( CASE b.is_lock WHEN 1 THEN '停用' ELSE '正常' END ) AS status,
  1400. b.address AS address,
  1401. IFNULL(SUBSTR( a.construction_time, 1, 4 ), '' ) AS constructionTime,
  1402. IFNULL(SUBSTR( a.last_update_time, 1, 4 ), '' ) AS lastUpdateTime,
  1403. ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'org_platform_brand' AND dict_value = a.platform_brand ) AS platformBrand,
  1404. IFNULL(a.cash_adding_room,0) AS cashAddingRoom,
  1405. IFNULL(a.cash_adding_room_control_count,0) AS cashAddingRoomControlCount,
  1406. IFNULL(a.remote_count,0) AS remoteCount,
  1407. IFNULL(a.remote_control_count,0) AS remoteControlCount,
  1408. IFNULL(a.total_camera_count,0) AS totalCameraCount,
  1409. IFNULL(a.hd_camera_count,0) AS hdCameraCount,
  1410. ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'property_situation' AND dict_value = a.ownership ) AS ownerShipName,
  1411. ( CASE a.outside_area WHEN 1 THEN '区域内' WHEN 0 THEN '区域外' ELSE '' END ) AS outsideArea,
  1412. ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'duty_options' AND dict_value = a.duty_mode ) AS dutyMode,
  1413. ( CASE a.safe_box WHEN 1 THEN '是' ELSE '否' END ) AS safeBox,
  1414. ( CASE a.self_service_bank WHEN 1 THEN '是' ELSE '否' END ) AS selfServiceBank,
  1415. IF(b.type = 4,IFNULL(a.wall_penetrating_equipment,0),0) AS onLineWallPenetratingEquipment,
  1416. IF(b.type = 4,IFNULL(a.lobby_equipment,0),0) AS onLineLobbyEquipment,
  1417. IF(b.type = 5,IFNULL(a.wall_penetrating_equipment,0),0) AS departureWallPenetratingEquipment,
  1418. IF(b.type = 5,IFNULL(a.lobby_equipment,0),0) AS departureLobbyEquipment,
  1419. ( CASE a.business_library WHEN 1 THEN '是' ELSE '否' END ) AS businessLibrary,
  1420. ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'business_type' AND dict_value = a.business_library_type ) AS businessLibraryTypeName,
  1421. ( CASE a.askari WHEN 1 THEN '是' ELSE '否' END ) AS askari,
  1422. IFNULL(a.inner_count,0) AS innerCount,
  1423. IFNULL(a.outside_count,0) AS outsideCount,
  1424. ( CASE WHEN a.askari_certificate IS NULL THEN '否' ELSE '是' END ) AS isAskariCertificate,
  1425. a.askari_certificate AS askariCertificate
  1426. FROM
  1427. sys_org b
  1428. LEFT JOIN sys_org_extend a ON a.org_id = b.id
  1429. -- LEFT JOIN core_weather_city c on a.weather_area_code = c.AREAID
  1430. WHERE
  1431. b.deleted = 0
  1432. <!-- <if test="org.checkSub==true">
  1433. and b.path like concat(#{org.path},"%")
  1434. </if>
  1435. <if test="org.checkSub==false">
  1436. and b.id = #{org.parentId}
  1437. </if>-->
  1438. <if test=" org.checkSub != null and org.checkSub == true">
  1439. and b.path like concat(concat('%',#{org.path}),'%')
  1440. </if>
  1441. <if test=" org.checkSub != null and org.checkSub == false">
  1442. and b.path like concat('%',#{org.path})
  1443. </if>
  1444. <if test=" org.isLock != null ">
  1445. AND b.is_lock = #{org.isLock}
  1446. </if>
  1447. <if test="typeList != null and typeList.size > 0">
  1448. AND b.type IN
  1449. <foreach collection="typeList" item="orgType" open="(" separator="," close=")">
  1450. #{orgType}
  1451. </foreach>
  1452. </if>
  1453. ORDER BY
  1454. FIND_IN_SET( b.affiliated_bank, #{findInSetOrder} ),
  1455. b.is_lock,
  1456. isnull( b.sort ),
  1457. b.sort,
  1458. b.short_name
  1459. </select>
  1460. <select id="exportDefenseDetailExtend" resultType="com.xunmei.system.util.OrgPhysicalDefenseConstructionDetailExport">
  1461. SELECT
  1462. b.id AS orgId,
  1463. b.affiliated_area AS city,
  1464. b.affiliated_bank AS affiliatedBank,
  1465. b.short_name AS shortName,
  1466. b.type AS orgType,
  1467. ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'sys_org_type' AND dict_value = b.type ) AS typeName,
  1468. ( CASE b.is_lock WHEN 1 THEN '停用' ELSE '正常' END ) AS status,
  1469. b.address AS address,
  1470. a.type AS ga38Type,
  1471. ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'org_extend_type' AND dict_value = a.type ) AS extendTypeName,
  1472. ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'org_extend_standard' AND dict_value = a.standard ) AS standard,
  1473. IFNULL(SUBSTR( a.date_of_compliance, 1, 10 ), '' ) AS dateOfCompliance,
  1474. a.reason as reason,
  1475. IFNULL(SUBSTR( a.date_of_complete, 1, 10 ), '' ) AS dateOfComplete,
  1476. a.certificate as certificate
  1477. FROM
  1478. sys_org b
  1479. LEFT JOIN sys_org_physical_defense_construction a ON a.org_id = b.id
  1480. WHERE
  1481. b.deleted = 0
  1482. <if test=" org.checkSub != null and org.checkSub == true">
  1483. and b.path like concat(concat('%',#{org.path}),'%')
  1484. </if>
  1485. <if test=" org.checkSub != null and org.checkSub == false">
  1486. and b.path like concat('%',#{org.path})
  1487. </if>
  1488. <if test=" org.isLock != null ">
  1489. AND b.is_lock = #{org.isLock}
  1490. </if>
  1491. <if test="typeList != null and typeList.size > 0">
  1492. AND b.type IN
  1493. <foreach collection="typeList" item="orgType" open="(" separator="," close=")">
  1494. #{orgType}
  1495. </foreach>
  1496. </if>
  1497. ORDER BY
  1498. FIND_IN_SET( b.affiliated_bank, #{findInSetOrder} ),
  1499. b.is_lock,
  1500. isnull( b.sort ),
  1501. b.sort,
  1502. b.short_name
  1503. </select>
  1504. </mapper>