SysOrgMapper.xml 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326
  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(SUM(IF(a.standard=1,1,0)) > 0 , 1, 0) as 'ga382021',
  728. if(SUM(IF(a.standard=2,1,0)) > 0 , 1, 0 ) as 'ga382015'
  729. from sys_org b
  730. LEFT JOIN sys_org_physical_defense_construction a on a.org_id = b.id
  731. where 1=1
  732. AND b.deleted = 0
  733. AND b.is_lock = 0
  734. AND b.type = 4
  735. AND a.type = 1
  736. AND b.deleted = 0
  737. AND b.path LIKE concat(#{orgPath}, '%')
  738. GROUP BY b.id ) t
  739. </select>
  740. <select id="rectificationStatus" resultType="java.lang.Integer">
  741. SELECT
  742. IFNULL(SUM(IF(a.standard=1,1,0)),0)
  743. FROM
  744. sys_org_physical_defense_construction a LEFT JOIN sys_org b ON a.org_id=b.id
  745. WHERE
  746. a.date_of_compliance LIKE concat(#{year}, '%')
  747. AND a.type = 1
  748. AND b.path LIKE concat(#{orgPath}, '%')
  749. </select>
  750. <select id="oldRectificationStatus" resultType="java.lang.Integer">
  751. SELECT
  752. COUNT( DISTINCT a.org_id )
  753. FROM
  754. sys_org_physical_defense_construction a
  755. INNER JOIN sys_org b ON a.org_id = b.id
  756. WHERE
  757. a.org_id IN (
  758. SELECT
  759. org_id
  760. FROM
  761. sys_org_physical_defense_construction
  762. where
  763. type = 1
  764. GROUP BY
  765. org_id
  766. HAVING
  767. (
  768. IF
  769. ( LOCATE( 1, GROUP_CONCAT( standard ))> 0, 1, 0 )+
  770. IF
  771. ( LOCATE( 2, GROUP_CONCAT( standard ))> 0, 1, 0 ))= 2
  772. AND date_of_compliance LIKE concat(#{year}, '%')
  773. )AND b.path LIKE concat(#{orgPath}, '%')
  774. </select>
  775. <select id="noRectificationStatus" resultType="java.lang.Integer">
  776. SELECT
  777. COUNT( DISTINCT org_id )
  778. FROM
  779. sys_org_physical_defense_construction a LEFT JOIN sys_org b ON a.org_id=b.id
  780. WHERE
  781. org_id IN (
  782. SELECT
  783. GROUP_CONCAT( DISTINCT org_id )
  784. FROM
  785. sys_org_physical_defense_construction
  786. where type = 1
  787. GROUP BY
  788. org_id
  789. HAVING
  790. (
  791. IF
  792. ( LOCATE( 1, GROUP_CONCAT( standard ))> 0, 1, 0 )+
  793. IF
  794. ( LOCATE( 3, GROUP_CONCAT( standard ))> 0, 1, 0 ))= 2
  795. AND date_of_compliance LIKE concat(#{year}, '%')
  796. ) AND b.path LIKE concat(#{orgPath}, '%')
  797. </select>
  798. <select id="selectConstructionDetail" resultType="com.xunmei.system.util.ConstructionDetailExport">
  799. SELECT
  800. a.org_id AS orgId,
  801. IFNULL( b.ownership, 0 ) AS ownership,
  802. IF
  803. (
  804. IF
  805. ( LOCATE( 1, GROUP_CONCAT( a.standard ))> 0, 1, 0 )+
  806. IF
  807. ( LOCATE( 2, GROUP_CONCAT( a.standard ))> 0, 1, 0 )>= 1,
  808. 1,
  809. 0
  810. ) AS complianceStatus,
  811. a.date_of_compliance AS complianceDate,
  812. IF
  813. (
  814. IF
  815. ( LOCATE( 1, GROUP_CONCAT( a.standard ))> 0, 1, 0 )+
  816. IF
  817. ( LOCATE( 2, GROUP_CONCAT( a.standard ))> 0, 1, 0 )>= 1,
  818. NULL,
  819. a.reason
  820. ) AS reason,
  821. a.date_of_complete AS completeDate,
  822. c.address as address,
  823. c.affiliated_area as city,
  824. c.affiliated_bank as orgName,
  825. c.short_name as networkName
  826. FROM
  827. sys_org_physical_defense_construction a
  828. INNER JOIN sys_org c ON c.id=a.org_id
  829. LEFT JOIN sys_org_extend b ON a.org_id = b.org_id
  830. WHERE c.type=4
  831. and c.deleted = 0
  832. and c.is_lock = 0
  833. and c.path like concat(#{orgPath}, '%')
  834. GROUP BY
  835. a.org_id
  836. </select>
  837. <select id="getReachNumber" resultType="java.lang.Integer">
  838. 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
  839. LEFT JOIN sys_org b on a.org_id = b.id
  840. where 1=1
  841. AND b.deleted = 0
  842. and b.is_lock = 0
  843. AND b.path LIKE concat(#{orgPath}, '%')
  844. </select>
  845. <select id="getOwnership" resultType="java.lang.Integer">
  846. SELECT
  847. IFNULL( SUM( IF ( a.ownership = 2, 1, 0 )), 0 )
  848. FROM
  849. sys_org_extend a
  850. LEFT JOIN sys_org b ON a.org_id = b.id
  851. WHERE b.type=4 and b.deleted = 0 and b.is_lock = 0 and b.path LIKE concat(#{orgPath}, '%')
  852. </select>
  853. <select id="getOutside" resultType="java.lang.Integer">
  854. SELECT
  855. IFNULL( SUM( IF ( a.outside_area = 0, 1, 0 )), 0 )
  856. FROM
  857. sys_org_extend a
  858. LEFT JOIN sys_org b ON a.org_id = b.id
  859. where
  860. 1=1
  861. and b.path LIKE concat(#{orgPath}, '%')
  862. and b.is_lock = 0
  863. and b.deleted = 0
  864. </select>
  865. <select id="getLibrary" resultType="java.util.Map">
  866. SELECT
  867. COUNT( a.business_library_type ) AS total,
  868. IFNULL( sum( IF ( a.business_library_type = 1, 1, 0 )), 0 ) AS one,
  869. IFNULL( SUM( IF ( a.business_library_type = 2, 1, 0 )), 0 ) AS two,
  870. IFNULL( SUM( IF ( a.business_library_type = 3, 1, 0 )), 0 ) AS three,
  871. IFNULL( SUM( IF ( a.business_library_type = 4, 1, 0 )), 0 ) AS four
  872. FROM
  873. sys_org_extend a
  874. LEFT JOIN sys_org b ON a.org_id = b.id
  875. where
  876. 1=1
  877. and b.path LIKE concat(#{orgPath}, '%')
  878. and b.is_lock = 0
  879. and b.deleted = 0
  880. </select>
  881. <select id="getCollectLibrary" resultType="java.lang.Integer">
  882. SELECT
  883. SUM(
  884. IF
  885. ( a.safe_box = 1, 1, 0 ))
  886. FROM
  887. sys_org_extend a
  888. LEFT JOIN sys_org b ON a.org_id = b.id
  889. WHERE
  890. 1=1
  891. and b.path LIKE concat(#{orgPath}, '%')
  892. and b.is_lock = 0
  893. and b.deleted = 0
  894. </select>
  895. <select id="getOnLine" resultType="java.util.Map">
  896. SELECT
  897. (
  898. SELECT
  899. IFNULL( SUM( IF ( b.self_service_bank = 1, 1, 0 )), 0 ) AS onLineTotal
  900. FROM
  901. sys_org a
  902. LEFT JOIN sys_org_extend b ON a.id = b.org_id
  903. WHERE
  904. 1=1
  905. AND a.deleted = 0
  906. and a.is_lock = 0
  907. and a.path LIKE concat( #{orgPath}, '%' )) AS onLineTotal,
  908. (
  909. 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
  910. LEFT JOIN sys_org b on a.org_id = b.id
  911. where 1=1
  912. AND b.deleted = 0
  913. and b.is_lock = 0
  914. AND b.path LIKE concat(#{orgPath}, '%' )) AS onLineReachNumber
  915. FROM
  916. DUAL
  917. </select>
  918. <select id="getDeparture" resultType="java.util.Map">
  919. SELECT
  920. (
  921. SELECT
  922. count( 1 )
  923. FROM
  924. sys_org
  925. WHERE
  926. type = 5
  927. AND deleted = 0
  928. AND is_lock = 0
  929. AND path LIKE concat( #{orgPath}, '%' )) AS departureTotal,
  930. (
  931. select SUM(a.size) from (select org_id,if(count(1) > 0,1,0) as size from
  932. sys_org_physical_defense_construction where standard =1 and type = 3 GROUP BY org_id) a
  933. LEFT JOIN sys_org b on a.org_id = b.id
  934. where 1=1
  935. AND b.deleted = 0
  936. and b.is_lock = 0
  937. AND b.path LIKE concat(#{orgPath}, '%' )) AS departureReachNumber
  938. FROM
  939. DUAL
  940. </select>
  941. <select id="getSelfEquipment" resultType="java.util.Map">
  942. select
  943. t.onLineThroughWalls,
  944. t.onLineLobbyImplement,
  945. t.departureThroughWalls,
  946. t.departureLobbyImplement,
  947. ( t.onLineThroughWalls + t.onLineLobbyImplement + t.departureThroughWalls + t.departureLobbyImplement ) AS selfServiceDevicesTotal
  948. from (
  949. select
  950. (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,
  951. (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,
  952. (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,
  953. (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
  954. from dual
  955. ) t
  956. </select>
  957. <select id="getCenterConstruction" resultType="java.util.Map">
  958. SELECT
  959. IFNULL(SUBSTR( b.construction_time, 1, 4 ), '' ) as centerConstructionTime,
  960. IFNULL(SUBSTR( b.last_update_time, 1, 4 ), '' )AS transformTime,
  961. b.platform_brand AS brand,
  962. IFNULL( b.hd_camera_count, 0 ) AS hdCameraCount,
  963. IFNULL( b.total_camera_count, 0 ) AS totalCameraCount
  964. FROM
  965. ( 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
  966. LEFT JOIN sys_org_extend b ON a.id = b.org_id
  967. </select>
  968. <select id="getCamera" resultType="java.util.Map">
  969. SELECT
  970. IFNULL( COUNT( a.id ), 0 ) AS cameraTotal,
  971. IFNULL( SUM( IF ( a.definition = 1, 1, 0 )), 0 ) AS definitionNumber
  972. FROM
  973. sys_device a
  974. LEFT JOIN sys_org b ON a.org_id = b.id
  975. WHERE
  976. a.del_flag = 0
  977. AND a.device_type = 2
  978. AND b.deleted = 0
  979. and b.is_lock = 0
  980. AND b.path LIKE concat(#{orgPath}, '%')
  981. </select>
  982. <select id="getRemote" resultType="java.util.Map">
  983. SELECT
  984. IFNULL( SUM( a.cash_adding_room ), 0 ) AS cashAddingRoom,
  985. IFNULL( SUM( a.remote_count ), 0 ) AS remoteCount,
  986. IFNULL( SUM( a.cash_adding_room_control_count ), 0 ) AS cashAddingRoomControlCount,
  987. IFNULL( SUM( a.remote_control_count ), 0 ) AS remoteControlCount
  988. FROM
  989. sys_org_extend a
  990. LEFT JOIN sys_org b ON a.org_id = b.id
  991. where
  992. 1=1
  993. and b.type = 10
  994. /* and a.remote_control = 1*/
  995. and b.deleted = 0
  996. and b.is_lock = 0
  997. and b.path LIKE concat(#{orgPath}, '%')
  998. </select>
  999. <select id="getDuty" resultType="java.util.Map">
  1000. SELECT
  1001. IFNULL( SUM( IF ( duty_mode = 2, 1, 0 )), 0 ) AS localDutyNetworkNumber,
  1002. IFNULL( SUM( IF ( duty_mode = 1, 1, 0 )), 0 ) AS remoteDutyNetworkNumber
  1003. FROM
  1004. sys_org_extend a
  1005. LEFT JOIN sys_org b ON a.org_id = b.id
  1006. WHERE
  1007. 1=1
  1008. and b.deleted = 0
  1009. and b.is_lock = 0
  1010. and b.path LIKE concat(#{orgPath}, '%')
  1011. </select>
  1012. <select id="getCertificate" resultType="java.util.Map">
  1013. SELECT
  1014. IFNULL( SUM( a.inner_count ), 0 ) AS internalCertificateNumber,
  1015. IFNULL( SUM( a.outside_count ), 0 ) AS outsourceCertificateNumber,
  1016. IFNULL( SUM( a.inner_count )+ SUM( a.outside_count ), 0 ) AS certificateTotal,
  1017. (
  1018. SELECT
  1019. count(*)
  1020. FROM
  1021. sys_user a
  1022. LEFT JOIN sys_user_information b ON a.id = b.user_id
  1023. LEFT JOIN sys_org c ON a.org_id = c.id
  1024. WHERE
  1025. 1 = 1
  1026. AND b.dept_id = 2
  1027. AND b.certificate_work = '1'
  1028. AND a.is_manage = 'Y'
  1029. AND c.deleted = 0
  1030. and c.is_lock = 0
  1031. AND c.path LIKE concat(#{orgPath}, '%')) AS certificatePeopleNumber
  1032. FROM
  1033. sys_org_extend a
  1034. LEFT JOIN sys_org b ON a.org_id = b.id
  1035. WHERE
  1036. 1=1
  1037. AND b.deleted = 0
  1038. and b.is_lock = 0
  1039. and b.path LIKE concat(#{orgPath}, '%')
  1040. </select>
  1041. <select id="getSafe" resultType="java.lang.Integer">
  1042. SELECT
  1043. COUNT( a.id )
  1044. FROM
  1045. core_safety_task a
  1046. LEFT JOIN sys_org b ON a.org_id = b.id
  1047. LEFT JOIN core_safecheck_plan c ON a.plan_id = c.id
  1048. WHERE
  1049. a.deleted = 0
  1050. AND b.deleted = 0
  1051. and b.is_lock = 0
  1052. AND c.check_type =3
  1053. and a.org_path LIKE concat(#{orgPath}, '%')
  1054. AND a.ymd_date BETWEEN #{startTime} and #{endTime}
  1055. </select>
  1056. <select id="getEduNumber" resultType="java.lang.Integer">
  1057. SELECT
  1058. COUNT( a.id )
  1059. FROM
  1060. core_edu_training_task a
  1061. LEFT JOIN core_edu_training_plan b ON a.plan_id = b.id
  1062. WHERE
  1063. b.exec_org_type = 1
  1064. AND b.deleted =0
  1065. and a.org_path like concat(concat('%',#{orgPath}),'%')
  1066. AND a.training_start_date_time BETWEEN #{startTime} and #{endTime}
  1067. </select>
  1068. <select id="getEduUser" resultType="java.lang.Integer">
  1069. SELECT
  1070. COUNT( b.edu_training_task_id )
  1071. FROM
  1072. core_edu_training_task a
  1073. LEFT JOIN core_edu_training_task_to_user b ON a.id = b.edu_training_task_id
  1074. WHERE
  1075. b.type = 1 and a.org_path like concat(concat('%',#{orgPath}),'%')
  1076. </select>
  1077. <select id="getQuarterDrillNumber" resultType="java.lang.Integer">
  1078. SELECT
  1079. COUNT(a.id)
  1080. FROM
  1081. core_drill_task a
  1082. LEFT JOIN core_drill_plan b ON a.plan_id = b.id
  1083. WHERE b.exec_org_type=1
  1084. and a.org_path like concat(concat('%',#{orgPath}),'%')
  1085. AND a.drill_start_time BETWEEN #{startTime} and #{endTime}
  1086. </select>
  1087. <select id="getQuarterDrillPeopleNumber" resultType="java.lang.Integer">
  1088. SELECT
  1089. COUNT( c.drill_task_id )
  1090. FROM
  1091. core_drill_task a
  1092. LEFT JOIN core_drill_plan b ON a.plan_id = b.id
  1093. LEFT JOIN core_drill_task_to_user c ON c.drill_task_id = a.id
  1094. WHERE
  1095. b.exec_org_type = 1
  1096. and a.org_path like concat(concat('%',#{orgPath}),'%')
  1097. </select>
  1098. <select id="getQuarterAllNetworkDrillNumber" resultType="java.lang.Integer">
  1099. SELECT
  1100. COUNT(a.id)
  1101. FROM
  1102. core_drill_task a
  1103. LEFT JOIN core_drill_plan b ON a.plan_id = b.id
  1104. WHERE b.exec_org_type=4
  1105. and a.org_path like concat(concat('%',#{orgPath}),'%')
  1106. AND a.drill_start_time BETWEEN #{startTime} and #{endTime}
  1107. </select>
  1108. <select id="getQuarterAllNetworkDrillPeopleNumber" resultType="java.lang.Integer">
  1109. SELECT
  1110. COUNT( c.drill_task_id )
  1111. FROM
  1112. core_drill_task a
  1113. LEFT JOIN core_drill_plan b ON a.plan_id = b.id
  1114. LEFT JOIN core_drill_task_to_user c ON c.drill_task_id = a.id
  1115. WHERE
  1116. b.exec_org_type = 4
  1117. and a.org_path like concat(concat('%',#{orgPath}),'%')
  1118. </select>
  1119. <select id="getAlone" resultType="java.lang.Integer">
  1120. SELECT
  1121. COUNT( * )
  1122. FROM
  1123. sys_user_information a
  1124. LEFT JOIN sys_user b ON a.user_id = b.id
  1125. LEFT JOIN sys_org c ON b.org_id = c.id
  1126. 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}, '%')
  1127. </select>
  1128. <select id="getManager" resultType="java.lang.Integer">
  1129. SELECT
  1130. COUNT( * )
  1131. FROM
  1132. sys_user_information a
  1133. LEFT JOIN sys_user b ON a.user_id = b.id
  1134. LEFT JOIN sys_org c ON b.org_id = c.id
  1135. WHERE
  1136. 1 = 1
  1137. AND c.deleted = 0
  1138. and c.is_lock = 0
  1139. AND a.is_full_time = #{isFull}
  1140. AND a.duties in ('1','2','3')
  1141. AND b.is_manage = 'Y'
  1142. AND c.path LIKE concat(#{orgPath}, '%')
  1143. </select>
  1144. <select id="getManagerCertificate" resultType="java.lang.Integer">
  1145. SELECT
  1146. COUNT( * )
  1147. FROM
  1148. sys_user_information a
  1149. LEFT JOIN sys_user b ON a.user_id = b.id
  1150. LEFT JOIN sys_org c ON b.org_id = c.id
  1151. WHERE
  1152. 1 = 1
  1153. AND c.deleted = 0
  1154. and c.is_lock = 0
  1155. AND a.certificate_work = 1
  1156. AND a.duties in ('1','2','3')
  1157. AND b.is_manage = 'Y'
  1158. AND c.path LIKE concat(#{orgPath}, '%')
  1159. </select>
  1160. <select id="getIsMonitor" resultType="java.lang.String">
  1161. SELECT
  1162. IF
  1163. ( COUNT( a.id ) > 0, '是', '否' )
  1164. FROM
  1165. sys_user_information a
  1166. LEFT JOIN sys_user b ON a.user_id = b.id
  1167. LEFT JOIN sys_org c ON b.org_id = c.id
  1168. WHERE
  1169. a.duties = #{duties}
  1170. and c.deleted = 0
  1171. and c.is_lock = 0
  1172. AND b.is_manage = 'Y'
  1173. AND c.path LIKE concat(#{orgPath}, '%')
  1174. </select>
  1175. <select id="getMonitorPeople" resultType="java.util.Map">
  1176. SELECT
  1177. COUNT( a.id ) AS monitorTotal,
  1178. IFNULL( SUM( IF ( a.work_type IN ( 0, 1 ), 1, 0 )), 0 ) AS innerPeople,
  1179. IFNULL( SUM( IF ( a.work_type = 2, 1, 0 )), 0 ) AS outPeople
  1180. FROM
  1181. sys_user_information a
  1182. LEFT JOIN sys_user b ON a.user_id = b.id
  1183. LEFT JOIN sys_org c ON b.org_id = c.id
  1184. WHERE
  1185. a.duties IN ( 2, 4, 5 )
  1186. AND c.deleted = 0
  1187. and c.is_lock = 0
  1188. AND b.is_manage = 'Y'
  1189. AND c.path LIKE concat(#{orgPath}, '%')
  1190. </select>
  1191. <select id="getSafeHeadToNetwork" resultType="java.lang.Integer">
  1192. SELECT
  1193. COUNT( a.id )
  1194. FROM
  1195. core_safety_book_new a
  1196. LEFT JOIN sys_org b ON a.party_b_org = b.id
  1197. WHERE
  1198. a.type = #{type}
  1199. AND a.sign_level = #{level}
  1200. AND b.deleted = 0
  1201. and b.is_lock = 0
  1202. AND b.path LIKE concat(#{orgPath}, '%')
  1203. </select>
  1204. <select id="getJointHeadToNetwork" resultType="java.lang.Integer">
  1205. SELECT
  1206. COUNT( a.id )
  1207. FROM
  1208. core_safety_book_new a
  1209. LEFT JOIN sys_org b ON a.party_a_org = b.id
  1210. WHERE
  1211. a.type = #{type}
  1212. AND a.sign_level = #{level}
  1213. AND b.path LIKE concat(#{orgPath}, '%')
  1214. </select>
  1215. <select id="getHaveSecurityNetworkNumber" resultType="java.lang.Integer">
  1216. select count(*) from sys_org a
  1217. LEFT JOIN sys_org_extend b on a.id = b.org_id
  1218. WHERE 1=1
  1219. and (b.inner_count > 0 or b.outside_count > 0)
  1220. and a.deleted = 0
  1221. and a.is_lock = 0
  1222. and a.path LIKE concat( #{orgPath}, '%' )
  1223. </select>
  1224. <select id="getHeadSafeCheckNumber" resultType="java.lang.Integer">
  1225. SELECT
  1226. COUNT( a.id )
  1227. FROM
  1228. core_safety_task a
  1229. LEFT JOIN core_safecheck_plan b ON a.plan_id = b.id
  1230. WHERE
  1231. b.check_type = 1
  1232. AND a.org_path LIKE concat(#{orgPath}, '%')
  1233. </select>
  1234. <select id="getHeadSafeCheckNetworkNumber" resultType="java.lang.Integer">
  1235. SELECT
  1236. COUNT( DISTINCT a.org_id )
  1237. FROM
  1238. core_safety_task a
  1239. LEFT JOIN core_safecheck_plan b ON a.plan_id = b.id
  1240. LEFT JOIN sys_org c ON c.id = a.org_id
  1241. WHERE
  1242. b.check_type = 1
  1243. AND c.deleted = 0
  1244. and c.is_lock = 0
  1245. -- AND c.type = 4
  1246. AND a.org_path LIKE concat(#{orgPath}, '%')
  1247. </select>
  1248. <select id="getDangerNumber" resultType="java.util.Map">
  1249. SELECT
  1250. IFNULL( SUM( IF ( confirm_status >= 2 AND reform_status IN ( 10, 11 ), 1, 0 )), 0 ) AS foundDangerNumber,
  1251. IFNULL( SUM( IF ( reform_status = 11, 1, 0 )), 0 ) AS rectificationDangerNumber,
  1252. IFNULL(
  1253. SUM(
  1254. IF
  1255. ( confirm_status >= 2 AND reform_status IN ( 10, 11 ), 1, 0 ))- SUM(
  1256. IF
  1257. ( reform_status = 11, 1, 0 )),
  1258. 0
  1259. ) AS noRectificationDangerNumber
  1260. FROM
  1261. core_question a
  1262. LEFT JOIN core_safety_task b ON a.src_task_id = b.id
  1263. LEFT JOIN core_safecheck_plan c ON c.id = b.plan_id
  1264. WHERE
  1265. src_type = 2
  1266. AND c.check_type = 1
  1267. AND b.org_path LIKE concat(#{orgPath}, '%')
  1268. </select>
  1269. <select id="selectSysOrgByPathAndType" resultType="com.xunmei.system.api.domain.SysOrg">
  1270. SELECT
  1271. *
  1272. FROM
  1273. sys_org
  1274. WHERE
  1275. is_lock=0 AND
  1276. type = #{type}
  1277. AND deleted = 0
  1278. AND is_lock = 0
  1279. <if test="path != null">
  1280. AND path LIKE concat(#{path}, '%')
  1281. </if>
  1282. ORDER BY
  1283. sort
  1284. </select>
  1285. <select id="selectOrgs" resultType="com.xunmei.system.api.domain.SysOrg">
  1286. SELECT
  1287. *
  1288. FROM
  1289. sys_org
  1290. WHERE 1=1
  1291. AND is_lock=0
  1292. AND deleted = 0
  1293. <if test="org.orgPath != null">
  1294. AND path LIKE concat(#{org.orgPath}, '%')
  1295. </if>
  1296. <if test="org.orgType != null">
  1297. AND type = #{org.orgType}
  1298. </if>
  1299. <if test="org.orgName != null">
  1300. AND short_name LIKE concat('%',#{org.orgName}, '%')
  1301. </if>
  1302. ORDER BY
  1303. affiliated_area,affiliated_bank,sort
  1304. </select>
  1305. </mapper>