BisInspWagajsBdgDao.xml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  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.BisInspWagajsBdgDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspWagajsBdg" id="bisInspWagajsBdgResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="objId" column="OBJ_ID"/>
  7. <result property="objCode" column="OBJ_CODE"/>
  8. <result property="gateName" column="GATE_NAME"/>
  9. <result property="adCode" column="AD_CODE"/>
  10. <result property="gateType" column="GATE_TYPE"/>
  11. <result property="gateFlow" column="GATE_FLOW"/>
  12. <result property="engScal" column="ENG_SCAL"/>
  13. <result property="engSta" column="ENG_STA"/>
  14. <result property="buidTimeYear" column="BUID_TIME_YEAR"/>
  15. <result property="buidTimeMon" column="BUID_TIME_MON"/>
  16. <result property="staTimeYear" column="STA_TIME_YEAR"/>
  17. <result property="staTimeMon" column="STA_TIME_MON"/>
  18. <result property="location" column="LOCATION"/>
  19. <result property="gateAdmName" column="GATE_ADM_NAME"/>
  20. <result property="gateAdmOrg" column="GATE_ADM_ORG"/>
  21. <result property="centerX" column="CENTER_X"/>
  22. <result property="centerY" column="CENTER_Y"/>
  23. <result property="gdX" column="GD_X"/>
  24. <result property="gdY" column="GD_Y"/>
  25. <result property="note" column="NOTE"/>
  26. <result property="state" column="STATE"/>
  27. <result property="dataStat" column="DATA_STAT"/>
  28. <result property="dmamStat" column="DMAM_STAT"/>
  29. <result property="persId" column="PERS_ID"/>
  30. <result property="groupId" column="GROUP_ID"/>
  31. <result property="intm" column="INTM"/>
  32. <result property="uptm" column="UPTM"/>
  33. </resultMap>
  34. <sql id="table_columns">
  35. ID,
  36. OBJ_ID,
  37. OBJ_CODE,
  38. GATE_NAME,
  39. AD_CODE,
  40. GATE_TYPE,
  41. GATE_FLOW,
  42. ENG_SCAL,
  43. ENG_STA,
  44. BUID_TIME_YEAR,
  45. BUID_TIME_MON,
  46. STA_TIME_YEAR,
  47. STA_TIME_MON,
  48. LOCATION,
  49. GATE_ADM_NAME,
  50. GATE_ADM_ORG,
  51. CENTER_X,
  52. CENTER_Y,
  53. GD_X,
  54. GD_Y,
  55. NOTE,
  56. STATE,
  57. DATA_STAT,
  58. DMAM_STAT,
  59. PERS_ID,
  60. GROUP_ID,
  61. INTM,
  62. UPTM
  63. </sql>
  64. <sql id="entity_properties">
  65. #{id},
  66. #{objId},
  67. #{objCode},
  68. #{gateName},
  69. #{adCode},
  70. #{gateType},
  71. #{gateFlow},
  72. #{engScal},
  73. #{engSta},
  74. #{buidTimeYear},
  75. #{buidTimeMon},
  76. #{staTimeYear},
  77. #{staTimeMon},
  78. #{location},
  79. #{gateAdmName},
  80. #{gateAdmOrg},
  81. #{centerX},
  82. #{centerY},
  83. #{gdX},
  84. #{gdY},
  85. #{note},
  86. #{state},
  87. #{dataStat},
  88. #{dmamStat},
  89. #{persId},
  90. #{groupId},
  91. #{intm},
  92. #{uptm}
  93. </sql>
  94. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  95. <sql id="page_where">
  96. <trim prefix="where" prefixOverrides="and | or ">
  97. <if test="objId != null and objId != ''">
  98. and OBJ_ID = #{objId}
  99. </if>
  100. <if test="objCode != null and objCode != ''">
  101. and OBJ_CODE = #{objCode}
  102. </if>
  103. <if test="gateName != null and gateName != ''">
  104. and GATE_NAME = #{gateName}
  105. </if>
  106. <if test="adCode != null and adCode != ''">
  107. and AD_CODE = #{adCode}
  108. </if>
  109. <if test="gateType != null and gateType != ''">
  110. and GATE_TYPE = #{gateType}
  111. </if>
  112. <if test="gateFlow != null and gateFlow != ''">
  113. and GATE_FLOW = #{gateFlow}
  114. </if>
  115. <if test="engScal != null and engScal != ''">
  116. and ENG_SCAL = #{engScal}
  117. </if>
  118. <if test="engSta != null and engSta != ''">
  119. and ENG_STA = #{engSta}
  120. </if>
  121. <if test="buidTimeYear != null and buidTimeYear != ''">
  122. and BUID_TIME_YEAR = #{buidTimeYear}
  123. </if>
  124. <if test="buidTimeMon != null and buidTimeMon != ''">
  125. and BUID_TIME_MON = #{buidTimeMon}
  126. </if>
  127. <if test="staTimeYear != null and staTimeYear != ''">
  128. and STA_TIME_YEAR = #{staTimeYear}
  129. </if>
  130. <if test="staTimeMon != null and staTimeMon != ''">
  131. and STA_TIME_MON = #{staTimeMon}
  132. </if>
  133. <if test="location != null and location != ''">
  134. and LOCATION = #{location}
  135. </if>
  136. <if test="gateAdmName != null and gateAdmName != ''">
  137. and GATE_ADM_NAME = #{gateAdmName}
  138. </if>
  139. <if test="gateAdmOrg != null and gateAdmOrg != ''">
  140. and GATE_ADM_ORG = #{gateAdmOrg}
  141. </if>
  142. <if test="centerX != null and centerX != ''">
  143. and CENTER_X = #{centerX}
  144. </if>
  145. <if test="centerY != null and centerY != ''">
  146. and CENTER_Y = #{centerY}
  147. </if>
  148. <if test="gdX != null and gdX != ''">
  149. and GD_X = #{gdX}
  150. </if>
  151. <if test="gdY != null and gdY != ''">
  152. and GD_Y = #{gdY}
  153. </if>
  154. <if test="note != null and note != ''">
  155. and NOTE = #{note}
  156. </if>
  157. <if test="state != null and state != ''">
  158. and STATE = #{state}
  159. </if>
  160. <if test="dataStat != null and dataStat != ''">
  161. and DATA_STAT = #{dataStat}
  162. </if>
  163. <if test="dmamStat != null and dmamStat != ''">
  164. and DMAM_STAT = #{dmamStat}
  165. </if>
  166. <if test="persId != null and persId != ''">
  167. and PERS_ID = #{persId}
  168. </if>
  169. <if test="groupId != null and groupId != ''">
  170. and GROUP_ID = #{groupId}
  171. </if>
  172. <if test="intm != null">
  173. and INTM = #{intm}
  174. </if>
  175. <if test="uptm != null">
  176. and UPTM = #{uptm}
  177. </if>
  178. and DATA_STAT='0'
  179. </trim>
  180. </sql>
  181. <select id="get" resultMap="bisInspWagajsBdgResultMap" parameterType="String">
  182. select
  183. B.ID,
  184. B.OBJ_ID,
  185. B.OBJ_CODE,
  186. B.GATE_NAME,
  187. B.AD_CODE,
  188. AW.AD_NAME,
  189. AW.AD_FULL_NAME,
  190. B.GATE_TYPE,
  191. B.GATE_FLOW,
  192. B.ENG_SCAL,
  193. B.ENG_STA,
  194. B.BUID_TIME_YEAR,
  195. B.BUID_TIME_MON,
  196. B.STA_TIME_YEAR,
  197. B.STA_TIME_MON,
  198. B.LOCATION,
  199. B.GATE_ADM_NAME,
  200. B.GATE_ADM_ORG,
  201. B.CENTER_X,
  202. B.CENTER_Y,
  203. B.GD_X,
  204. B.GD_Y,
  205. B.NOTE,
  206. B.STATE,
  207. B.DATA_STAT,
  208. B.DMAM_STAT,
  209. B.PERS_ID,
  210. B.GROUP_ID,
  211. B.INTM,
  212. B.UPTM
  213. from BIS_INSP_WAGAJS_BDG B
  214. LEFT JOIN ATT_AD_BASE AW ON B.AD_CODE = AW.AD_CODE
  215. where B.ID = #{id}
  216. </select>
  217. <select id="getBy" resultMap="bisInspWagajsBdgResultMap">
  218. select
  219. <include refid="table_columns"/>
  220. from BIS_INSP_WAGAJS_BDG
  221. <include refid="page_where"/>
  222. </select>
  223. <select id="findAll" resultMap="bisInspWagajsBdgResultMap">
  224. select
  225. <include refid="table_columns"/>
  226. from BIS_INSP_WAGAJS_BDG
  227. </select>
  228. <select id="findList" resultMap="bisInspWagajsBdgResultMap">
  229. select
  230. <include refid="table_columns"/>
  231. from BIS_INSP_WAGAJS_BDG
  232. <include refid="page_where"/>
  233. </select>
  234. <select id="selectCount" resultType="int">
  235. select count(ID) from BIS_INSP_WAGAJS_BDG
  236. <include refid="page_where"/>
  237. </select>
  238. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspWagajsBdg">
  239. insert into BIS_INSP_WAGAJS_BDG(
  240. <include refid="table_columns"/>
  241. )
  242. values (
  243. <include refid="entity_properties"/>
  244. )
  245. </insert>
  246. <delete id="delete" parameterType="java.lang.String">
  247. update BIS_INSP_WAGAJS_BDG set DATA_STAT='9' where ID = #{id}
  248. </delete>
  249. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspWagajsBdg">
  250. update BIS_INSP_WAGAJS_BDG set DATA_STAT='9'
  251. <include refid="page_where"/>
  252. </delete>
  253. <update id="deleteInFlag" parameterType="java.lang.String">
  254. update BIS_INSP_WAGAJS_BDG set DATA_STAT = '9' where ID = #{id}
  255. </update>
  256. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspWagajsBdg">
  257. update BIS_INSP_WAGAJS_BDG
  258. <trim prefix="set" suffixOverrides=",">
  259. <if test="objId != null and objId != ''">OBJ_ID
  260. = #{objId},
  261. </if>
  262. <if test="objCode != null and objCode != ''">OBJ_CODE
  263. = #{objCode},
  264. </if>
  265. <if test="gateName != null and gateName != ''">GATE_NAME
  266. = #{gateName},
  267. </if>
  268. <if test="adCode != null and adCode != ''">AD_CODE
  269. = #{adCode},
  270. </if>
  271. <if test="gateType != null and gateType != ''">GATE_TYPE
  272. = #{gateType},
  273. </if>
  274. <if test="gateFlow != null and gateFlow != ''">GATE_FLOW
  275. = #{gateFlow},
  276. </if>
  277. <if test="engScal != null and engScal != ''">ENG_SCAL
  278. = #{engScal},
  279. </if>
  280. <if test="engSta != null and engSta != ''">ENG_STA
  281. = #{engSta},
  282. </if>
  283. <if test="buidTimeYear != null and buidTimeYear != ''">BUID_TIME_YEAR
  284. = #{buidTimeYear},
  285. </if>
  286. <if test="buidTimeMon != null and buidTimeMon != ''">BUID_TIME_MON
  287. = #{buidTimeMon},
  288. </if>
  289. <if test="staTimeYear != null and staTimeYear != ''">STA_TIME_YEAR
  290. = #{staTimeYear},
  291. </if>
  292. <if test="staTimeMon != null and staTimeMon != ''">STA_TIME_MON
  293. = #{staTimeMon},
  294. </if>
  295. <if test="location != null and location != ''">LOCATION
  296. = #{location},
  297. </if>
  298. <if test="gateAdmName != null and gateAdmName != ''">GATE_ADM_NAME
  299. = #{gateAdmName},
  300. </if>
  301. <if test="gateAdmOrg != null and gateAdmOrg != ''">GATE_ADM_ORG
  302. = #{gateAdmOrg},
  303. </if>
  304. <if test="centerX != null and centerX != ''">CENTER_X
  305. = #{centerX},
  306. </if>
  307. <if test="centerY != null and centerY != ''">CENTER_Y
  308. = #{centerY},
  309. </if>
  310. <if test="gdX != null and gdX != ''">GD_X
  311. = #{gdX},
  312. </if>
  313. <if test="gdY != null and gdY != ''">GD_Y
  314. = #{gdY},
  315. </if>
  316. <if test="note != null and note != ''">NOTE
  317. = #{note},
  318. </if>
  319. <if test="state != null and state != ''">STATE
  320. = #{state},
  321. </if>
  322. <if test="dataStat != null and dataStat != ''">DATA_STAT
  323. = #{dataStat},
  324. </if>
  325. <if test="dmamStat != null and dmamStat != ''">DMAM_STAT
  326. = #{dmamStat},
  327. </if>
  328. <if test="persId != null and persId != ''">PERS_ID
  329. = #{persId},
  330. </if>
  331. <if test="groupId != null and groupId != ''">GROUP_ID
  332. = #{groupId},
  333. </if>
  334. <if test="intm != null">INTM
  335. = #{intm},
  336. </if>
  337. <if test="uptm != null">UPTM
  338. = #{uptm},
  339. </if>
  340. </trim>
  341. <where>ID = #{id}</where>
  342. </update>
  343. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspWagajsBdg">
  344. update BIS_INSP_WAGAJS_BDG
  345. <trim prefix="set" suffixOverrides=",">
  346. <if test="objId != null and objId != ''">OBJ_ID
  347. = #{objId},
  348. </if>
  349. <if test="objCode != null and objCode != ''">OBJ_CODE
  350. = #{objCode},
  351. </if>
  352. <if test="gateName != null and gateName != ''">GATE_NAME
  353. = #{gateName},
  354. </if>
  355. <if test="adCode != null and adCode != ''">AD_CODE
  356. = #{adCode},
  357. </if>
  358. <if test="gateType != null and gateType != ''">GATE_TYPE
  359. = #{gateType},
  360. </if>
  361. <if test="gateFlow != null and gateFlow != ''">GATE_FLOW
  362. = #{gateFlow},
  363. </if>
  364. <if test="engScal != null and engScal != ''">ENG_SCAL
  365. = #{engScal},
  366. </if>
  367. <if test="engSta != null and engSta != ''">ENG_STA
  368. = #{engSta},
  369. </if>
  370. <if test="buidTimeYear != null and buidTimeYear != ''">BUID_TIME_YEAR
  371. = #{buidTimeYear},
  372. </if>
  373. <if test="buidTimeMon != null and buidTimeMon != ''">BUID_TIME_MON
  374. = #{buidTimeMon},
  375. </if>
  376. <if test="staTimeYear != null and staTimeYear != ''">STA_TIME_YEAR
  377. = #{staTimeYear},
  378. </if>
  379. <if test="staTimeMon != null and staTimeMon != ''">STA_TIME_MON
  380. = #{staTimeMon},
  381. </if>
  382. <if test="location != null and location != ''">LOCATION
  383. = #{location},
  384. </if>
  385. <if test="gateAdmName != null and gateAdmName != ''">GATE_ADM_NAME
  386. = #{gateAdmName},
  387. </if>
  388. <if test="gateAdmOrg != null and gateAdmOrg != ''">GATE_ADM_ORG
  389. = #{gateAdmOrg},
  390. </if>
  391. <if test="centerX != null and centerX != ''">CENTER_X
  392. = #{centerX},
  393. </if>
  394. <if test="centerY != null and centerY != ''">CENTER_Y
  395. = #{centerY},
  396. </if>
  397. <if test="gdX != null and gdX != ''">GD_X
  398. = #{gdX},
  399. </if>
  400. <if test="gdY != null and gdY != ''">GD_Y
  401. = #{gdY},
  402. </if>
  403. <if test="note != null and note != ''">NOTE
  404. = #{note},
  405. </if>
  406. <if test="state != null and state != ''">STATE
  407. = #{state},
  408. </if>
  409. <if test="dataStat != null and dataStat != ''">DATA_STAT
  410. = #{dataStat},
  411. </if>
  412. <if test="dmamStat != null and dmamStat != ''">DMAM_STAT
  413. = #{dmamStat},
  414. </if>
  415. <if test="persId != null and persId != ''">PERS_ID
  416. = #{persId},
  417. </if>
  418. <if test="groupId != null and groupId != ''">GROUP_ID
  419. = #{groupId},
  420. </if>
  421. <if test="intm != null">INTM
  422. = #{intm},
  423. </if>
  424. <if test="uptm != null">UPTM
  425. = #{uptm},
  426. </if>
  427. </trim>
  428. <include refid="page_where"/>
  429. </update>
  430. <!-- 其他自定义SQL -->
  431. <select id="findPageList" resultType="cn.com.goldenwater.dcproj.dto.BisInspWagajsBdgDto">
  432. SELECT * FROM (
  433. select
  434. A.CODE, A.ID nodeId, A.NM, A.ptype, ia.pnm groupName,
  435. B.id as rgstrId, (case when b.STATE is null then '0' else b.state end) STATE,
  436. B.ID,
  437. B.OBJ_ID,
  438. B.OBJ_CODE,
  439. B.GATE_NAME,
  440. B.AD_CODE,
  441. AW.AD_NAME,
  442. AW.AD_FULL_NAME,
  443. B.GATE_TYPE,
  444. B.GATE_FLOW,
  445. B.ENG_SCAL,
  446. B.ENG_STA,
  447. B.BUID_TIME_YEAR,
  448. B.BUID_TIME_MON,
  449. B.STA_TIME_YEAR,
  450. B.STA_TIME_MON,
  451. B.LOCATION,
  452. B.GATE_ADM_NAME,
  453. B.GATE_ADM_ORG,
  454. B.CENTER_X,
  455. B.CENTER_Y,
  456. B.GD_X,
  457. B.GD_Y,
  458. B.NOTE,
  459. B.DATA_STAT,
  460. B.DMAM_STAT,
  461. B.PERS_ID,
  462. B.GROUP_ID,
  463. B.INTM,
  464. B.UPTM
  465. FROM BIS_INSP_ALL_OBJ A
  466. JOIN BIS_INSP_WAGAJS_BDG B ON A.OBJ_ID=B.OBJ_ID
  467. LEFT JOIN BIS_INSP_ALL IA ON A.ID = IA.ID
  468. LEFT JOIN ATT_AD_BASE AW ON B.AD_CODE = AW.AD_CODE
  469. where A.ptype = #{pType}
  470. and B.DATA_STAT= '0'
  471. <if test="adCodes ==null or adCodes ==''">
  472. <choose>
  473. <when test='isAll =="1"'>
  474. </when>
  475. <otherwise>
  476. and
  477. A.Id in (
  478. select distinct w.id from (
  479. SELECT P.id FROM BIS_INSP_ALL P
  480. WHERE FIND_IN_SET(P.id, getSubNodes_bis_insp_all( (SELECT group_concat(A.id) FROM BIS_INSP_ALL_RLATION A
  481. WHERE A.PERSID = #{presId} and A.TYPE = #{pType} and length(A.id) in (3,6,9) group by A.PERSID ),0,0) ) &gt; 0
  482. union all
  483. SELECT P.id FROM BIS_INSP_ALL P where p.id in (SELECT id FROM BIS_INSP_ALL_RLATION A
  484. WHERE A.PERSID =#{presId} and TYPE = #{pType} and length(id)=12 )
  485. ) w
  486. )
  487. </otherwise>
  488. </choose>
  489. </if>
  490. <if test="adCodes !=null and adCodes !=''">
  491. and
  492. <foreach item="item" index="index" collection="adCodes.split(',')" open="(" separator="or" close=")">
  493. b.ad_code like concat('${item}','%')
  494. </foreach>
  495. </if>
  496. ) A
  497. <where>
  498. <if test="id !=null and id !=''">and nodeId like '${id}%'</if>
  499. <if test="plnaId !=null and plnaId !=''">and nodeId like '${plnaId}%'</if>
  500. <if test="groupId != null and groupId != ''">and nodeId like '${groupId}%'</if>
  501. <if test="code !=null and code !=''">and code = #{code}</if>
  502. <if test="nm !=null and nm !=''">and nm like '%${nm}%'</if>
  503. <if test="rsName !=null and rsName !=''">and nm like '%${rsName}%'</if>
  504. <if test="engScal !=null and engScal !=''">and ENG_SCAL IN (${engScal})</if>
  505. <if test="state !=null and state !=''">and STATE in (${state})</if>
  506. <if test="adName != null and adName != ''">and AD_NAME like '%${adName}%'</if>
  507. <if test="sttm != null and sttm != ''">and INTM &gt;= STR_TO_DATE(#{sttm},'%Y-%m-%d')</if>
  508. <if test="entm != null and entm != ''">and INTM &lt; DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') ,INTERVAL 1 DAY)</if>
  509. </where>
  510. order by nodeId asc
  511. <if test="orderBy != null and orderBy != ''">
  512. ,CONVERT( nm USING gbk ) COLLATE gbk_chinese_ci ASC
  513. </if>
  514. </select>
  515. </mapper>