BisInspStstnDao.xml 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="cn.com.goldenwater.dcproj.dao.BisInspStstnDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspStstn" id="bisInspStstnResultMap">
  5. <result property="sceneScore" column="SCENE_SCORE"/>
  6. <result property="safTotal" column="SAF_TOTAL"/>
  7. <result property="tmprTotal" column="TMPR_TOTAL"/>
  8. <result property="sceneTotal" column="SCENE_TOTAL"/>
  9. <result property="persId" column="PERS_ID"/>
  10. <result property="actualScore" column="ACTUAL_SCORE"/>
  11. <result property="total" column="TOTAL"/>
  12. <result property="safScore" column="SAF_SCORE"/>
  13. <result property="tmprScore" column="TMPR_SCORE"/>
  14. <result property="id" column="ID"/>
  15. <result property="ststnId" column="STSTN_ID"/>
  16. <result property="objId" column="OBJ_ID"/>
  17. <result property="nm" column="NM"/>
  18. <result property="adCode" column="AD_CODE"/>
  19. <result property="adName" column="AD_NAME"/>
  20. <result property="loc" column="LOC"/>
  21. <result property="prjcType" column="PRJC_TYPE"/>
  22. <result property="cost" column="COST"/>
  23. <result property="costYear" column="COST_YEAR"/>
  24. <result property="mgr" column="MGR"/>
  25. <result property="owner" column="OWNER"/>
  26. <result property="quality" column="QUALITY"/>
  27. <result property="design" column="DESIGN"/>
  28. <result property="supervisor" column="SUPERVISOR"/>
  29. <result property="build" column="BUILD"/>
  30. <result property="prjcPers" column="PRJC_PERS"/>
  31. <result property="prjcPresTel" column="PRJC_PRES_TEL"/>
  32. <result property="state" column="STATE"/>
  33. <result property="sceneState" column="SCENE_STATE"/>
  34. <result property="tmprState" column="TMPR_STATE"/>
  35. <result property="safState" column="SAF_STATE"/>
  36. <result property="pbState" column="PB_STATE"/>
  37. <result property="pbTotal" column="PB_TOTAL"/>
  38. <result property="pbScore" column="PB_SCORE"/>
  39. <result property="standardScore" column="STANDARD_SCORE"/>
  40. <result property="standardTotal" column="STANDARD_TOTAL"/>
  41. <result property="centerX" column="CENTER_X"/>
  42. <result property="centerY" column="CENTER_Y"/>
  43. <result property="gdX" column="GD_X"/>
  44. <result property="gdY" column="GD_Y"/>
  45. <result property="note" column="NOTE"/>
  46. <result property="intm" column="INTM"/>
  47. <result property="uptm" column="UPTM"/>
  48. <result property="dataStat" column="DATA_STAT"/>
  49. </resultMap>
  50. <sql id="table_columns">
  51. SCENE_SCORE,
  52. SAF_TOTAL,
  53. TMPR_TOTAL,
  54. SCENE_TOTAL,
  55. PERS_ID,
  56. ACTUAL_SCORE,
  57. TOTAL,
  58. SAF_SCORE,
  59. TMPR_SCORE,
  60. ID,
  61. STSTN_ID,
  62. OBJ_ID,
  63. NM,
  64. AD_CODE,
  65. AD_NAME,
  66. LOC,
  67. PRJC_TYPE,
  68. COST,
  69. COST_YEAR,
  70. MGR,
  71. OWNER,
  72. QUALITY,
  73. DESIGN,
  74. SUPERVISOR,
  75. BUILD,
  76. PRJC_PERS,
  77. PRJC_PRES_TEL,
  78. STATE,
  79. SCENE_STATE,
  80. TMPR_STATE,
  81. SAF_STATE,
  82. PB_STATE,
  83. PB_TOTAL,
  84. PB_SCORE,
  85. STANDARD_SCORE,
  86. CENTER_X,
  87. CENTER_Y,
  88. GD_X,
  89. GD_Y,
  90. NOTE,
  91. INTM,
  92. UPTM,
  93. DATA_STAT
  94. </sql>
  95. <sql id="entity_properties">
  96. #{sceneScore},
  97. #{safTotal},
  98. #{tmprTotal},
  99. #{sceneTotal},
  100. #{persId},
  101. #{actualScore},
  102. #{total},
  103. #{safScore},
  104. #{tmprScore},
  105. #{id},
  106. #{ststnId},
  107. #{objId},
  108. #{nm},
  109. #{adCode},
  110. #{adName},
  111. #{loc},
  112. #{prjcType},
  113. #{cost},
  114. #{costYear},
  115. #{mgr},
  116. #{owner},
  117. #{quality},
  118. #{design},
  119. #{supervisor},
  120. #{build},
  121. #{prjcPers},
  122. #{prjcPresTel},
  123. #{state},
  124. #{sceneState},
  125. #{tmprState},
  126. #{safState},
  127. #{pbState},
  128. #{pbTotal},
  129. #{pbScore},
  130. #{standardScore},
  131. #{centerX},
  132. #{centerY},
  133. #{gdX},
  134. #{gdY},
  135. #{note},
  136. #{intm},
  137. #{uptm},
  138. #{dataStat}
  139. </sql>
  140. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  141. <sql id="page_where">
  142. <trim prefix="where" prefixOverrides="and | or ">
  143. <if test="sceneScore != null and sceneScore != ''">
  144. and SCENE_SCORE = #{sceneScore}
  145. </if>
  146. <if test="safTotal != null and safTotal != ''">
  147. and SAF_TOTAL = #{safTotal}
  148. </if>
  149. <if test="tmprTotal != null and tmprTotal != ''">
  150. and TMPR_TOTAL = #{tmprTotal}
  151. </if>
  152. <if test="sceneTotal != null and sceneTotal != ''">
  153. and SCENE_TOTAL = #{sceneTotal}
  154. </if>
  155. <if test="persId != null and persId != ''">
  156. and PERS_ID = #{persId}
  157. </if>
  158. <if test="actualScore != null and actualScore != ''">
  159. and ACTUAL_SCORE = #{actualScore}
  160. </if>
  161. <if test="total != null and total != ''">
  162. and TOTAL = #{total}
  163. </if>
  164. <if test="safScore != null and safScore != ''">
  165. and SAF_SCORE = #{safScore}
  166. </if>
  167. <if test="tmprScore != null and tmprScore != ''">
  168. and TMPR_SCORE = #{tmprScore}
  169. </if>
  170. <if test="ststnId != null and ststnId != ''">
  171. and STSTN_ID = #{ststnId}
  172. </if>
  173. <if test="objId != null and objId != ''">
  174. and OBJ_ID = #{objId}
  175. </if>
  176. <if test="nm != null and nm != ''">
  177. and NM = #{nm}
  178. </if>
  179. <if test="adCode != null and adCode != ''">
  180. and AD_CODE = #{adCode}
  181. </if>
  182. <if test="adName != null and adName != ''">
  183. and AD_NAME = #{adName}
  184. </if>
  185. <if test="loc != null and loc != ''">
  186. and LOC = #{loc}
  187. </if>
  188. <if test="prjcType != null and prjcType != ''">
  189. and PRJC_TYPE = #{prjcType}
  190. </if>
  191. <if test="cost != null and cost != ''">
  192. and COST = #{cost}
  193. </if>
  194. <if test="costYear != null and costYear != ''">
  195. and COST_YEAR = #{costYear}
  196. </if>
  197. <if test="mgr != null and mgr != ''">
  198. and MGR = #{mgr}
  199. </if>
  200. <if test="owner != null and owner != ''">
  201. and OWNER = #{owner}
  202. </if>
  203. <if test="quality != null and quality != ''">
  204. and QUALITY = #{quality}
  205. </if>
  206. <if test="design != null and design != ''">
  207. and DESIGN = #{design}
  208. </if>
  209. <if test="supervisor != null and supervisor != ''">
  210. and SUPERVISOR = #{supervisor}
  211. </if>
  212. <if test="build != null and build != ''">
  213. and BUILD = #{build}
  214. </if>
  215. <if test="prjcPers != null and prjcPers != ''">
  216. and PRJC_PERS = #{prjcPers}
  217. </if>
  218. <if test="prjcPresTel != null and prjcPresTel != ''">
  219. and PRJC_PRES_TEL = #{prjcPresTel}
  220. </if>
  221. <if test="state != null and state != ''">
  222. and STATE = #{state}
  223. </if>
  224. <if test="sceneState != null and sceneState != ''">
  225. and SCENE_STATE = #{sceneState}
  226. </if>
  227. <if test="tmprState != null and tmprState != ''">
  228. and TMPR_STATE = #{tmprState}
  229. </if>
  230. <if test="safState != null and safState != ''">
  231. and SAF_STATE = #{safState}
  232. </if>
  233. <if test="centerX != null and centerX != ''">
  234. and CENTER_X = #{centerX}
  235. </if>
  236. <if test="centerY != null and centerY != ''">
  237. and CENTER_Y = #{centerY}
  238. </if>
  239. <if test="gdX != null and gdX != ''">
  240. and GD_X = #{gdX}
  241. </if>
  242. <if test="gdY != null and gdY != ''">
  243. and GD_Y = #{gdY}
  244. </if>
  245. <if test="note != null and note != ''">
  246. and NOTE = #{note}
  247. </if>
  248. <if test="intm != null">
  249. and INTM = #{intm}
  250. </if>
  251. <if test="uptm != null">
  252. and UPTM = #{uptm}
  253. </if>
  254. <if test="dataStat != null and dataStat != ''">
  255. and DATA_STAT = #{dataStat}
  256. </if>
  257. and DATA_STAT='0'
  258. </trim>
  259. </sql>
  260. <select id="get" resultMap="bisInspStstnResultMap" parameterType="String">
  261. select
  262. <include refid="table_columns"/>
  263. from BIS_INSP_STSTN where ID = #{id}
  264. </select>
  265. <select id="getBy" resultMap="bisInspStstnResultMap">
  266. select
  267. <include refid="table_columns"/>
  268. from BIS_INSP_STSTN
  269. <include refid="page_where"/>
  270. </select>
  271. <select id="findAll" resultMap="bisInspStstnResultMap">
  272. select
  273. <include refid="table_columns"/>
  274. from BIS_INSP_STSTN
  275. </select>
  276. <select id="findList" resultMap="bisInspStstnResultMap">
  277. select
  278. <include refid="table_columns"/>
  279. from BIS_INSP_STSTN
  280. <include refid="page_where"/>
  281. </select>
  282. <select id="selectCount" resultType="int">
  283. select count(ID) from BIS_INSP_STSTN
  284. <include refid="page_where"/>
  285. </select>
  286. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspStstn">
  287. insert into BIS_INSP_STSTN(
  288. <include refid="table_columns"/>
  289. )
  290. values (
  291. <include refid="entity_properties"/>
  292. )
  293. </insert>
  294. <delete id="delete" parameterType="java.lang.String">
  295. update BIS_INSP_STSTN set DATA_STAT='9' where ID = #{id}
  296. </delete>
  297. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspStstn">
  298. update BIS_INSP_STSTN set DATA_STAT='9'
  299. <include refid="page_where"/>
  300. </delete>
  301. <update id="deleteInFlag" parameterType="java.lang.String">
  302. update BIS_INSP_STSTN set DATA_STAT = '9' where ID = #{id}
  303. </update>
  304. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspStstn">
  305. update BIS_INSP_STSTN
  306. <trim prefix="set" suffixOverrides=",">
  307. <if test="sceneScore != null and sceneScore != ''">SCENE_SCORE
  308. = #{sceneScore},
  309. </if>
  310. <if test="safTotal != null and safTotal != ''">SAF_TOTAL
  311. = #{safTotal},
  312. </if>
  313. <if test="tmprTotal != null and tmprTotal != ''">TMPR_TOTAL
  314. = #{tmprTotal},
  315. </if>
  316. <if test="sceneTotal != null and sceneTotal != ''">SCENE_TOTAL
  317. = #{sceneTotal},
  318. </if>
  319. <if test="persId != null and persId != ''">PERS_ID
  320. = #{persId},
  321. </if>
  322. <if test="actualScore != null and actualScore != ''">ACTUAL_SCORE
  323. = #{actualScore},
  324. </if>
  325. <if test="total != null and total != ''">TOTAL
  326. = #{total},
  327. </if>
  328. <if test="safScore != null and safScore != ''">SAF_SCORE
  329. = #{safScore},
  330. </if>
  331. <if test="tmprScore != null and tmprScore != ''">TMPR_SCORE
  332. = #{tmprScore},
  333. </if>
  334. <if test="ststnId != null and ststnId != ''">STSTN_ID
  335. = #{ststnId},
  336. </if>
  337. <if test="objId != null and objId != ''">OBJ_ID
  338. = #{objId},
  339. </if>
  340. <if test="nm != null and nm != ''">NM
  341. = #{nm},
  342. </if>
  343. <if test="adCode != null and adCode != ''">AD_CODE
  344. = #{adCode},
  345. </if>
  346. <if test="adName != null and adName != ''">AD_NAME
  347. = #{adName},
  348. </if>
  349. <if test="loc != null and loc != ''">LOC
  350. = #{loc},
  351. </if>
  352. <if test="prjcType != null and prjcType != ''">PRJC_TYPE
  353. = #{prjcType},
  354. </if>
  355. <if test="cost != null and cost != ''">COST
  356. = #{cost},
  357. </if>
  358. <if test="costYear != null and costYear != ''">COST_YEAR
  359. = #{costYear},
  360. </if>
  361. <if test="mgr != null and mgr != ''">MGR
  362. = #{mgr},
  363. </if>
  364. <if test="owner != null and owner != ''">OWNER
  365. = #{owner},
  366. </if>
  367. <if test="quality != null and quality != ''">QUALITY
  368. = #{quality},
  369. </if>
  370. <if test="design != null and design != ''">DESIGN
  371. = #{design},
  372. </if>
  373. <if test="supervisor != null and supervisor != ''">SUPERVISOR
  374. = #{supervisor},
  375. </if>
  376. <if test="build != null and build != ''">BUILD
  377. = #{build},
  378. </if>
  379. <if test="prjcPers != null and prjcPers != ''">PRJC_PERS
  380. = #{prjcPers},
  381. </if>
  382. <if test="prjcPresTel != null and prjcPresTel != ''">PRJC_PRES_TEL
  383. = #{prjcPresTel},
  384. </if>
  385. <if test="state != null and state != ''">STATE
  386. = #{state},
  387. </if>
  388. <if test="sceneState != null and sceneState != ''">SCENE_STATE
  389. = #{sceneState},
  390. </if>
  391. <if test="tmprState != null and tmprState != ''">TMPR_STATE
  392. = #{tmprState},
  393. </if>
  394. <if test="safState != null and safState != ''">SAF_STATE
  395. = #{safState},
  396. </if>
  397. <if test="pbState != null and pbState != ''">PB_STATE = #{pbState},</if>
  398. <if test="pbTotal != null and pbTotal != ''">PB_TOTAL = #{pbTotal},</if>
  399. <if test="pbScore != null and pbScore != ''">PB_SCORE = #{pbScore},</if>
  400. <if test="standardScore != null and standardScore != ''">STANDARD_SCORE = #{standardScore},</if>
  401. <if test="centerX != null and centerX != ''">CENTER_X
  402. = #{centerX},
  403. </if>
  404. <if test="centerY != null and centerY != ''">CENTER_Y
  405. = #{centerY},
  406. </if>
  407. <if test="gdX != null and gdX != ''">GD_X
  408. = #{gdX},
  409. </if>
  410. <if test="gdY != null and gdY != ''">GD_Y
  411. = #{gdY},
  412. </if>
  413. <if test="note != null and note != ''">NOTE
  414. = #{note},
  415. </if>
  416. <if test="intm != null">INTM
  417. = #{intm},
  418. </if>
  419. <if test="uptm != null">UPTM
  420. = #{uptm},
  421. </if>
  422. <if test="dataStat != null and dataStat != ''">DATA_STAT
  423. = #{dataStat},
  424. </if>
  425. </trim>
  426. <where>ID = #{id}</where>
  427. </update>
  428. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspStstn">
  429. update BIS_INSP_STSTN
  430. <trim prefix="set" suffixOverrides=",">
  431. <if test="sceneScore != null and sceneScore != ''">SCENE_SCORE
  432. = #{sceneScore},
  433. </if>
  434. <if test="safTotal != null and safTotal != ''">SAF_TOTAL
  435. = #{safTotal},
  436. </if>
  437. <if test="tmprTotal != null and tmprTotal != ''">TMPR_TOTAL
  438. = #{tmprTotal},
  439. </if>
  440. <if test="sceneTotal != null and sceneTotal != ''">SCENE_TOTAL
  441. = #{sceneTotal},
  442. </if>
  443. <if test="persId != null and persId != ''">PERS_ID
  444. = #{persId},
  445. </if>
  446. <if test="actualScore != null and actualScore != ''">ACTUAL_SCORE
  447. = #{actualScore},
  448. </if>
  449. <if test="total != null and total != ''">TOTAL
  450. = #{total},
  451. </if>
  452. <if test="safScore != null and safScore != ''">SAF_SCORE
  453. = #{safScore},
  454. </if>
  455. <if test="tmprScore != null and tmprScore != ''">TMPR_SCORE
  456. = #{tmprScore},
  457. </if>
  458. <if test="ststnId != null and ststnId != ''">STSTN_ID
  459. = #{ststnId},
  460. </if>
  461. <if test="objId != null and objId != ''">OBJ_ID
  462. = #{objId},
  463. </if>
  464. <if test="nm != null and nm != ''">NM
  465. = #{nm},
  466. </if>
  467. <if test="adCode != null and adCode != ''">AD_CODE
  468. = #{adCode},
  469. </if>
  470. <if test="adName != null and adName != ''">AD_NAME
  471. = #{adName},
  472. </if>
  473. <if test="loc != null and loc != ''">LOC
  474. = #{loc},
  475. </if>
  476. <if test="prjcType != null and prjcType != ''">PRJC_TYPE
  477. = #{prjcType},
  478. </if>
  479. <if test="cost != null and cost != ''">COST
  480. = #{cost},
  481. </if>
  482. <if test="costYear != null and costYear != ''">COST_YEAR
  483. = #{costYear},
  484. </if>
  485. <if test="mgr != null and mgr != ''">MGR
  486. = #{mgr},
  487. </if>
  488. <if test="owner != null and owner != ''">OWNER
  489. = #{owner},
  490. </if>
  491. <if test="quality != null and quality != ''">QUALITY
  492. = #{quality},
  493. </if>
  494. <if test="design != null and design != ''">DESIGN
  495. = #{design},
  496. </if>
  497. <if test="supervisor != null and supervisor != ''">SUPERVISOR
  498. = #{supervisor},
  499. </if>
  500. <if test="build != null and build != ''">BUILD
  501. = #{build},
  502. </if>
  503. <if test="prjcPers != null and prjcPers != ''">PRJC_PERS
  504. = #{prjcPers},
  505. </if>
  506. <if test="prjcPresTel != null and prjcPresTel != ''">PRJC_PRES_TEL
  507. = #{prjcPresTel},
  508. </if>
  509. <if test="state != null and state != ''">STATE
  510. = #{state},
  511. </if>
  512. <if test="sceneState != null and sceneState != ''">SCENE_STATE
  513. = #{sceneState},
  514. </if>
  515. <if test="tmprState != null and tmprState != ''">TMPR_STATE
  516. = #{tmprState},
  517. </if>
  518. <if test="safState != null and safState != ''">SAF_STATE
  519. = #{safState},
  520. </if>
  521. <if test="pbState != null and pbState != ''">PB_STATE = #{pbState},</if>
  522. <if test="pbTotal != null and pbTotal != ''">PB_TOTAL = #{pbTotal},</if>
  523. <if test="pbScore != null and pbScore != ''">PB_SCORE = #{pbScore},</if>
  524. <if test="standardScore != null and standardScore != ''">STANDARD_SCORE = #{standardScore},</if>
  525. <if test="centerX != null and centerX != ''">CENTER_X
  526. = #{centerX},
  527. </if>
  528. <if test="centerY != null and centerY != ''">CENTER_Y
  529. = #{centerY},
  530. </if>
  531. <if test="gdX != null and gdX != ''">GD_X
  532. = #{gdX},
  533. </if>
  534. <if test="gdY != null and gdY != ''">GD_Y
  535. = #{gdY},
  536. </if>
  537. <if test="note != null and note != ''">NOTE
  538. = #{note},
  539. </if>
  540. <if test="intm != null">INTM
  541. = #{intm},
  542. </if>
  543. <if test="uptm != null">UPTM
  544. = #{uptm},
  545. </if>
  546. <if test="dataStat != null and dataStat != ''">DATA_STAT
  547. = #{dataStat},
  548. </if>
  549. </trim>
  550. <include refid="page_where"/>
  551. </update>
  552. <!-- 其他自定义SQL -->
  553. <select id="findStstnPage" resultType="cn.com.goldenwater.dcproj.dto.BisInspStstnDto">
  554. SELECT * FROM (
  555. select
  556. A.CODE, A.CODE as baseId, A.ID nodeId, A.NM, A.ptype,
  557. ia.pnm groupName, aw.AD_FULL_NAME,
  558. B.ID, B.id as rgstrId,
  559. (case when b.STATE is null then '0' else b.state end) STATE,
  560. B.SCENE_SCORE,
  561. B.SAF_TOTAL,
  562. B.TMPR_TOTAL,
  563. B.SCENE_TOTAL,
  564. B.PERS_ID,
  565. B.ACTUAL_SCORE,
  566. B.TOTAL AS STANDARD_TOTAL,
  567. 100 AS TOTAL,
  568. B.SAF_SCORE,
  569. B.TMPR_SCORE,
  570. B.STSTN_ID,
  571. B.OBJ_ID,
  572. B.AD_CODE,
  573. B.AD_NAME,
  574. B.LOC,
  575. B.PRJC_TYPE,
  576. B.COST,
  577. B.COST_YEAR,
  578. B.MGR,
  579. B.OWNER,
  580. B.QUALITY,
  581. B.DESIGN,
  582. B.SUPERVISOR,
  583. B.BUILD,
  584. B.PRJC_PERS,
  585. B.PRJC_PRES_TEL,
  586. B.SCENE_STATE,
  587. B.TMPR_STATE,
  588. B.SAF_STATE,
  589. B.PB_STATE,
  590. B.PB_TOTAL,
  591. B.PB_SCORE,
  592. IFNULL(B.STANDARD_SCORE, B.ACTUAL_SCORE) STANDARD_SCORE,
  593. B.CENTER_X,
  594. B.CENTER_Y,
  595. B.GD_X,
  596. B.GD_Y,
  597. B.NOTE,
  598. B.INTM,
  599. B.UPTM
  600. FROM BIS_INSP_ALL_OBJ A
  601. JOIN BIS_INSP_STSTN B ON A.OBJ_ID=B.OBJ_ID
  602. LEFT JOIN BIS_INSP_ALL IA ON A.ID = IA.ID
  603. LEFT JOIN ATT_AD_BASE AW ON B.AD_CODE = AW.AD_CODE
  604. where A.ptype= #{pType}
  605. <if test="adCodes ==null or adCodes ==''">
  606. <choose>
  607. <when test='isAll =="1"'>
  608. </when>
  609. <otherwise>
  610. and
  611. A.Id in (
  612. select distinct w.id from (
  613. SELECT P.id FROM BIS_INSP_ALL P
  614. WHERE FIND_IN_SET(P.id, getSubNodes_bis_insp_all( (SELECT group_concat(A.id) FROM BIS_INSP_ALL_RLATION A
  615. WHERE A.PERSID = #{presId} and A.TYPE = #{pType} and length(A.id) in (3,6,9) group by A.PERSID ),0,0) ) &gt; 0
  616. union all
  617. SELECT P.id FROM BIS_INSP_ALL P where p.id in (SELECT id FROM BIS_INSP_ALL_RLATION A
  618. WHERE A.PERSID =#{presId} and TYPE = #{pType} and length(id)=12 )
  619. )w
  620. )
  621. </otherwise>
  622. </choose>
  623. </if>
  624. <if test="adCodes !=null and adCodes !=''">
  625. and
  626. <foreach item="item" index="index" collection="adCodes.split(',')" open="(" separator="or" close=")">
  627. b.ad_code like concat('${item}','%')
  628. </foreach>
  629. </if>
  630. ) A WHERE a.PTYPE=#{pType}
  631. <if test="plnaId !=null and plnaId !=''">and a.nodeId like '${plnaId}%'</if>
  632. <if test="id !=null and id !=''">and a.nodeId like '${id}%'</if>
  633. <if test="state !=null and state !=''">and STATE in (${state})</if>
  634. <if test="rsName !=null and rsName !=''">and a.nm like '%${rsName}%'</if>
  635. <if test="nm !=null and nm !=''">and a.nm like '%${nm}%'</if>
  636. <if test="code !=null and code !=''">and a.code = #{code}</if>
  637. <if test="adName != null and adName != ''">and a.AD_FULL_NAME like '%${adName}%'</if>
  638. <if test="sttm != null and sttm != ''">and a.Intm&gt;= STR_TO_DATE(#{sttm},'%Y-%m-%d')</if>
  639. <if test="entm != null and entm != ''">and a.Intm &lt; DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') ,INTERVAL 1 DAY)</if>
  640. <if test="groupId != null and groupId != ''">and a.nodeId = #{groupId}</if>
  641. order by nodeId asc
  642. <if test="orderBy != null and orderBy != ''">
  643. ,CONVERT( nm USING gbk ) COLLATE gbk_chinese_ci ASC
  644. </if>
  645. </select>
  646. <select id="getListByInspGroupIdObjType" resultType="cn.com.goldenwater.dcproj.model.BisInspStstn"
  647. parameterType="cn.com.goldenwater.dcproj.param.PagePersObjParam">
  648. <!-- 获取督察对象 -->
  649. select
  650. T.AD_CODE, T.AD_NAME, T.CENTER_X, T.CENTER_Y,
  651. T.GD_X, T.GD_Y, T.LOC, T.ID, T.ID AS RGSTR_ID,
  652. C.ID groupId, C.PNM groupName, B.NM
  653. FROM BIS_INSP_STSTN T
  654. LEFT JOIN BIS_INSP_ALL_OBJ B ON T.OBJ_ID = B.OBJ_ID
  655. LEFT JOIN BIS_INSP_ALL C ON B.ID = C.ID
  656. where B.ptype = #{objType}
  657. <if test='isAll == "0"'>and B.ID = #{inspGroupId}</if>
  658. <if test='isAll == "1"'>and B.ID LIKE '${inspGroupId}%'</if>
  659. <if test="adCode != null and adCode != ''">and t.AD_CODE like '${adCode}%'</if>
  660. <if test="wtdstNm != null and wtdstNm != ''">and B.NM like '%${wtdstNm}%'</if>
  661. <choose>
  662. <when test="province != null and province != ''">
  663. and B.AD_CODE LIKE '${province}%'
  664. </when>
  665. <otherwise>
  666. and B.AD_CODE is null
  667. </otherwise>
  668. </choose>
  669. </select>
  670. </mapper>