BisInspUnwtRgstrDao.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  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.BisInspUnwtRgstrDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspUnwtRgstr" id="bisInspUnwtRgstrResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="objId" column="OBJ_ID"/>
  7. <result property="nm" column="NM"/>
  8. <result property="adCode" column="AD_CODE"/>
  9. <result property="adName" column="AD_NAME"/>
  10. <result property="loc" column="LOC"/>
  11. <result property="state" column="STATE"/>
  12. <result property="synState" column="SYN_STATE"/>
  13. <result property="centerX" column="CENTER_X"/>
  14. <result property="centerY" column="CENTER_Y"/>
  15. <result property="gdX" column="GD_X"/>
  16. <result property="gdY" column="GD_Y"/>
  17. <result property="intm" column="INTM"/>
  18. <result property="uptm" column="UPTM"/>
  19. <result property="dataStat" column="DATA_STAT"/>
  20. </resultMap>
  21. <sql id="table_columns">
  22. ID,
  23. OBJ_ID,
  24. NM,
  25. AD_CODE,
  26. AD_NAME,
  27. LOC,
  28. STATE,
  29. SYN_STATE,
  30. CENTER_X,
  31. CENTER_Y,
  32. GD_X,
  33. GD_Y,
  34. INTM,
  35. UPTM,
  36. DATA_STAT
  37. </sql>
  38. <sql id="entity_properties">
  39. #{id},
  40. #{objId},
  41. #{nm},
  42. #{adCode},
  43. #{adName},
  44. #{loc},
  45. #{state},
  46. #{synState},
  47. #{centerX},
  48. #{centerY},
  49. #{gdX},
  50. #{gdY},
  51. #{intm},
  52. #{uptm},
  53. #{dataStat}
  54. </sql>
  55. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  56. <sql id="page_where">
  57. <trim prefix="where" prefixOverrides="and | or ">
  58. <if test="objId != null and objId != ''">
  59. and OBJ_ID = #{objId}
  60. </if>
  61. <if test="nm != null and nm != ''">
  62. and NM = #{nm}
  63. </if>
  64. <if test="adCode != null and adCode != ''">
  65. and AD_CODE = #{adCode}
  66. </if>
  67. <if test="adName != null and adName != ''">
  68. and AD_NAME = #{adName}
  69. </if>
  70. <if test="loc != null and loc != ''">
  71. and LOC = #{loc}
  72. </if>
  73. <if test="state != null and state != ''">
  74. and STATE = #{state}
  75. </if>
  76. <if test="synState != null and synState != ''">
  77. and SYN_STATE = #{synState}
  78. </if>
  79. <if test="centerX != null and centerX != ''">
  80. and CENTER_X = #{centerX}
  81. </if>
  82. <if test="centerY != null and centerY != ''">
  83. and CENTER_Y = #{centerY}
  84. </if>
  85. <if test="gdX != null and gdX != ''">
  86. and GD_X = #{gdX}
  87. </if>
  88. <if test="gdY != null and gdY != ''">
  89. and GD_Y = #{gdY}
  90. </if>
  91. <if test="intm != null">
  92. and INTM = #{intm}
  93. </if>
  94. <if test="uptm != null">
  95. and UPTM = #{uptm}
  96. </if>
  97. <if test="dataStat != null and dataStat != ''">
  98. and DATA_STAT = #{dataStat}
  99. </if>
  100. and DATA_STAT='0'
  101. </trim>
  102. </sql>
  103. <select id="get" resultMap="bisInspUnwtRgstrResultMap" parameterType="String">
  104. select
  105. <include refid="table_columns"/>
  106. from BIS_INSP_UNWT_RGSTR where ID = #{id}
  107. </select>
  108. <select id="getBy" resultMap="bisInspUnwtRgstrResultMap">
  109. select
  110. <include refid="table_columns"/>
  111. from BIS_INSP_UNWT_RGSTR
  112. <include refid="page_where"/>
  113. </select>
  114. <select id="findAll" resultMap="bisInspUnwtRgstrResultMap">
  115. select
  116. <include refid="table_columns"/>
  117. from BIS_INSP_UNWT_RGSTR
  118. </select>
  119. <select id="findList" resultMap="bisInspUnwtRgstrResultMap">
  120. select
  121. <include refid="table_columns"/>
  122. from BIS_INSP_UNWT_RGSTR
  123. <include refid="page_where"/>
  124. </select>
  125. <select id="selectCount" resultType="int">
  126. select count(ID) from BIS_INSP_UNWT_RGSTR
  127. <include refid="page_where"/>
  128. </select>
  129. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspUnwtRgstr">
  130. insert into BIS_INSP_UNWT_RGSTR(
  131. <include refid="table_columns"/>
  132. )
  133. values (
  134. <include refid="entity_properties"/>
  135. )
  136. </insert>
  137. <delete id="delete" parameterType="java.lang.String">
  138. update BIS_INSP_UNWT_RGSTR set DATA_STAT='9' where ID = #{id}
  139. </delete>
  140. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspUnwtRgstr">
  141. update BIS_INSP_UNWT_RGSTR set DATA_STAT='9'
  142. <include refid="page_where"/>
  143. </delete>
  144. <update id="deleteInFlag" parameterType="java.lang.String">
  145. update BIS_INSP_UNWT_RGSTR set DATA_STAT = '9' where ID = #{id}
  146. </update>
  147. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspUnwtRgstr">
  148. update BIS_INSP_UNWT_RGSTR
  149. <trim prefix="set" suffixOverrides=",">
  150. <if test="objId != null and objId != ''">OBJ_ID
  151. = #{objId},
  152. </if>
  153. <if test="nm != null and nm != ''">NM
  154. = #{nm},
  155. </if>
  156. <if test="adCode != null and adCode != ''">AD_CODE
  157. = #{adCode},
  158. </if>
  159. <if test="adName != null and adName != ''">AD_NAME
  160. = #{adName},
  161. </if>
  162. <if test="loc != null and loc != ''">LOC
  163. = #{loc},
  164. </if>
  165. <if test="state != null and state != ''">STATE
  166. = #{state},
  167. </if>
  168. <if test="synState != null and synState != ''">SYN_STATE
  169. = #{synState},
  170. </if>
  171. <if test="centerX != null and centerX != ''">CENTER_X
  172. = #{centerX},
  173. </if>
  174. <if test="centerY != null and centerY != ''">CENTER_Y
  175. = #{centerY},
  176. </if>
  177. <if test="gdX != null and gdX != ''">GD_X
  178. = #{gdX},
  179. </if>
  180. <if test="gdY != null and gdY != ''">GD_Y
  181. = #{gdY},
  182. </if>
  183. <if test="intm != null">INTM
  184. = #{intm},
  185. </if>
  186. <if test="uptm != null">UPTM
  187. = #{uptm},
  188. </if>
  189. <if test="dataStat != null and dataStat != ''">DATA_STAT
  190. = #{dataStat},
  191. </if>
  192. </trim>
  193. <where>ID = #{id}</where>
  194. </update>
  195. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspUnwtRgstr">
  196. update BIS_INSP_UNWT_RGSTR
  197. <trim prefix="set" suffixOverrides=",">
  198. <if test="objId != null and objId != ''">OBJ_ID
  199. = #{objId},
  200. </if>
  201. <if test="nm != null and nm != ''">NM
  202. = #{nm},
  203. </if>
  204. <if test="adCode != null and adCode != ''">AD_CODE
  205. = #{adCode},
  206. </if>
  207. <if test="adName != null and adName != ''">AD_NAME
  208. = #{adName},
  209. </if>
  210. <if test="loc != null and loc != ''">LOC
  211. = #{loc},
  212. </if>
  213. <if test="state != null and state != ''">STATE
  214. = #{state},
  215. </if>
  216. <if test="synState != null and synState != ''">SYN_STATE
  217. = #{synState},
  218. </if>
  219. <if test="centerX != null and centerX != ''">CENTER_X
  220. = #{centerX},
  221. </if>
  222. <if test="centerY != null and centerY != ''">CENTER_Y
  223. = #{centerY},
  224. </if>
  225. <if test="gdX != null and gdX != ''">GD_X
  226. = #{gdX},
  227. </if>
  228. <if test="gdY != null and gdY != ''">GD_Y
  229. = #{gdY},
  230. </if>
  231. <if test="intm != null">INTM
  232. = #{intm},
  233. </if>
  234. <if test="uptm != null">UPTM
  235. = #{uptm},
  236. </if>
  237. <if test="dataStat != null and dataStat != ''">DATA_STAT
  238. = #{dataStat},
  239. </if>
  240. </trim>
  241. <include refid="page_where"/>
  242. </update>
  243. <update id="updateByObjId" parameterType="cn.com.goldenwater.dcproj.model.BisInspUnwtRgstr">
  244. update BIS_INSP_UNWT_RGSTR
  245. <trim prefix="set" suffixOverrides=",">
  246. <if test="nm != null and nm != ''">NM
  247. = #{nm},
  248. </if>
  249. <if test="adCode != null and adCode != ''">AD_CODE
  250. = #{adCode},
  251. </if>
  252. <if test="adName != null and adName != ''">AD_NAME
  253. = #{adName},
  254. </if>
  255. <if test="loc != null and loc != ''">LOC
  256. = #{loc},
  257. </if>
  258. <if test="state != null and state != ''">STATE
  259. = #{state},
  260. </if>
  261. <if test="synState != null and synState != ''">SYN_STATE
  262. = #{synState},
  263. </if>
  264. <if test="centerX != null and centerX != ''">CENTER_X
  265. = #{centerX},
  266. </if>
  267. <if test="centerY != null and centerY != ''">CENTER_Y
  268. = #{centerY},
  269. </if>
  270. <if test="gdX != null and gdX != ''">GD_X
  271. = #{gdX},
  272. </if>
  273. <if test="gdY != null and gdY != ''">GD_Y
  274. = #{gdY},
  275. </if>
  276. <if test="intm != null">INTM
  277. = #{intm},
  278. </if>
  279. <if test="uptm != null">UPTM
  280. = #{uptm},
  281. </if>
  282. <if test="dataStat != null and dataStat != ''">DATA_STAT
  283. = #{dataStat},
  284. </if>
  285. </trim>
  286. where OBJ_ID= #{objId}
  287. </update>
  288. <!-- 其他自定义SQL -->
  289. <select id="findPageList" resultType="cn.com.goldenwater.dcproj.dto.BisInspUnwtRgstrDto">
  290. SELECT * FROM (
  291. select
  292. A.CODE, A.ID AS NODE_ID, A.NM, A.PTYPE, IA.PNM AS GROUP_NAME,
  293. B.ID AS RGSTR_ID, (CASE WHEN B.STATE IS NULL THEN '0' ELSE B.STATE END) STATE,
  294. B.GD_X AS LGTD,B.GD_Y LTTD,AW.AD_FULL_NAME,
  295. B.ID,
  296. B.OBJ_ID,
  297. B.AD_CODE,
  298. B.AD_NAME,
  299. B.LOC,
  300. B.SYN_STATE,
  301. B.CENTER_X,
  302. B.CENTER_Y,
  303. B.GD_X,
  304. B.GD_Y,
  305. B.INTM,
  306. B.UPTM,
  307. B.DATA_STAT
  308. FROM BIS_INSP_ALL_OBJ A
  309. JOIN BIS_INSP_UNWT_RGSTR B ON A.OBJ_ID=B.OBJ_ID
  310. LEFT JOIN BIS_INSP_ALL IA ON A.ID = IA.ID
  311. LEFT JOIN ATT_AD_BASE AW ON B.AD_CODE = AW.AD_CODE
  312. where B.DATA_STAT='0'
  313. <if test="adCodes ==null or adCodes ==''">
  314. <choose>
  315. <when test='isAll =="1"'>
  316. </when>
  317. <otherwise>
  318. and
  319. A.Id in (
  320. select distinct id from (
  321. SELECT P.id FROM BIS_INSP_ALL P START WITH P.PID IN (SELECT id FROM BIS_INSP_ALL_RLATION A
  322. WHERE A.PERSID = #{presId} and TYPE = #{pType} and length(id) in (3,6,9))
  323. CONNECT BY P.PID = PRIOR P.ID
  324. union all
  325. SELECT P.id FROM BIS_INSP_ALL P where p.id in (SELECT id FROM BIS_INSP_ALL_RLATION A
  326. WHERE A.PERSID =#{presId} and TYPE = #{pType} and length(id)=12 )
  327. )
  328. )
  329. </otherwise>
  330. </choose>
  331. </if>
  332. <if test="adCodes !=null and adCodes !=''">
  333. and
  334. <foreach item="item" index="index" collection="adCodes.split(',')" open="(" separator="or" close=")">
  335. b.ad_code like concat('${item}','%')
  336. </foreach>
  337. </if>
  338. ) A
  339. <where>
  340. <if test="id !=null and id !=''">and NODE_ID like '${id}%'</if>
  341. <if test="plnaId !=null and plnaId !=''">and NODE_ID like '${plnaId}%'</if>
  342. <if test="groupId != null and groupId != ''">and NODE_ID like '${groupId}%'</if>
  343. <if test="code !=null and code !=''">and code = #{code}</if>
  344. <if test="nm !=null and nm !=''">and nm like '%${nm}%'</if>
  345. <if test="state !=null and state !=''">and STATE in (${state})</if>
  346. <if test="adName != null and adName != ''">and AD_NAME like '%${adName}%'</if>
  347. <if test="sttm != null and sttm != ''">and Intm &gt;= TO_DATE(#{sttm},'YYYY-MM-DD')</if>
  348. <if test="entm != null and entm != ''">and Intm &lt; To_DATE(#{entm},'yyyy-MM-dd') + 1</if>
  349. </where>
  350. order by NODE_ID asc
  351. <if test="orderBy != null and orderBy != ''">
  352. ,nlssort(nm,'NLS_SORT=SCHINESE_PINYIN_M')
  353. </if>
  354. </select>
  355. </mapper>