BisInspVill2021RgstrDao.xml 12 KB

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