SysOrgMapper.xml 58 KB

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