BisInspFloodqhDao.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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.BisInspFloodqhDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspFloodqh" id="bisInspFloodqhResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="objId" column="OBJ_ID"/>
  7. <result property="nm" column="NM"/>
  8. <result property="floodType" column="FLOOD_TYPE"/>
  9. <result property="adCode" column="AD_CODE"/>
  10. <result property="adName" column="AD_NAME"/>
  11. <result property="loc" column="LOC"/>
  12. <result property="centerX" column="CENTER_X"/>
  13. <result property="centerY" column="CENTER_Y"/>
  14. <result property="gdX" column="GD_X"/>
  15. <result property="gdY" column="GD_Y"/>
  16. <result property="state" column="STATE"/>
  17. <result property="caseState" column="CASE_STATE"/>
  18. <result property="intm" column="INTM"/>
  19. <result property="uptm" column="UPTM"/>
  20. <result property="dataStat" column="DATA_STAT"/>
  21. </resultMap>
  22. <sql id="table_columns">
  23. ID,
  24. OBJ_ID,
  25. NM,
  26. FLOOD_TYPE,
  27. AD_CODE,
  28. AD_NAME,
  29. LOC,
  30. CENTER_X,
  31. CENTER_Y,
  32. GD_X,
  33. GD_Y,
  34. STATE,
  35. CASE_STATE,
  36. INTM,
  37. UPTM,
  38. DATA_STAT
  39. </sql>
  40. <sql id="entity_properties">
  41. #{id},
  42. #{objId},
  43. #{nm},
  44. #{floodType},
  45. #{adCode},
  46. #{adName},
  47. #{loc},
  48. #{centerX},
  49. #{centerY},
  50. #{gdX},
  51. #{gdY},
  52. #{state},
  53. #{caseState},
  54. #{intm},
  55. #{uptm},
  56. #{dataStat}
  57. </sql>
  58. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  59. <sql id="page_where">
  60. <trim prefix="where" prefixOverrides="and | or ">
  61. <if test="objId != null and objId != ''">
  62. and OBJ_ID = #{objId}
  63. </if>
  64. <if test="nm != null and nm != ''">
  65. and NM = #{nm}
  66. </if>
  67. <if test="floodType != null and floodType != ''">
  68. and FLOOD_TYPE = #{floodType}
  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="loc != null and loc != ''">
  77. and LOC = #{loc}
  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="state != null and state != ''">
  92. and STATE = #{state}
  93. </if>
  94. <if test="caseState != null and caseState != ''">
  95. and CASE_STATE = #{caseState}
  96. </if>
  97. <if test="intm != null">
  98. and INTM = #{intm}
  99. </if>
  100. <if test="uptm != null">
  101. and UPTM = #{uptm}
  102. </if>
  103. <if test="dataStat != null and dataStat != ''">
  104. and DATA_STAT = #{dataStat}
  105. </if>
  106. and DATA_STAT='0'
  107. </trim>
  108. </sql>
  109. <select id="get" resultMap="bisInspFloodqhResultMap" parameterType="String">
  110. select
  111. <include refid="table_columns"/>
  112. from BIS_INSP_FLOODQH where ID = #{id}
  113. </select>
  114. <select id="getBy" resultMap="bisInspFloodqhResultMap">
  115. select
  116. <include refid="table_columns"/>
  117. from BIS_INSP_FLOODQH
  118. <include refid="page_where"/>
  119. </select>
  120. <select id="findAll" resultMap="bisInspFloodqhResultMap">
  121. select
  122. <include refid="table_columns"/>
  123. from BIS_INSP_FLOODQH
  124. </select>
  125. <select id="findList" resultMap="bisInspFloodqhResultMap">
  126. select
  127. <include refid="table_columns"/>
  128. from BIS_INSP_FLOODQH
  129. <include refid="page_where"/>
  130. </select>
  131. <select id="selectCount" resultType="int">
  132. select count(ID) from BIS_INSP_FLOODQH
  133. <include refid="page_where"/>
  134. </select>
  135. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspFloodqh">
  136. insert into BIS_INSP_FLOODQH(
  137. <include refid="table_columns"/>
  138. )
  139. values (
  140. <include refid="entity_properties"/>
  141. )
  142. </insert>
  143. <delete id="delete" parameterType="java.lang.String">
  144. update BIS_INSP_FLOODQH set DATA_STAT='9' where ID = #{id}
  145. </delete>
  146. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspFloodqh">
  147. update BIS_INSP_FLOODQH set DATA_STAT='9'
  148. <include refid="page_where"/>
  149. </delete>
  150. <update id="deleteInFlag" parameterType="java.lang.String">
  151. update BIS_INSP_FLOODQH set DATA_STAT = '9' where ID = #{id}
  152. </update>
  153. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspFloodqh">
  154. update BIS_INSP_FLOODQH
  155. <trim prefix="set" suffixOverrides=",">
  156. <if test="objId != null and objId != ''">OBJ_ID
  157. = #{objId},
  158. </if>
  159. <if test="nm != null and nm != ''">NM
  160. = #{nm},
  161. </if>
  162. <if test="floodType != null and floodType != ''">FLOOD_TYPE
  163. = #{floodType},
  164. </if>
  165. <if test="adCode != null and adCode != ''">AD_CODE
  166. = #{adCode},
  167. </if>
  168. <if test="adName != null and adName != ''">AD_NAME
  169. = #{adName},
  170. </if>
  171. <if test="loc != null and loc != ''">LOC
  172. = #{loc},
  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="state != null and state != ''">STATE
  187. = #{state},
  188. </if>
  189. <if test="caseState != null and caseState != ''">CASE_STATE
  190. = #{caseState},
  191. </if>
  192. <if test="intm != null">INTM
  193. = #{intm},
  194. </if>
  195. <if test="uptm != null">UPTM
  196. = #{uptm},
  197. </if>
  198. <if test="dataStat != null and dataStat != ''">DATA_STAT
  199. = #{dataStat},
  200. </if>
  201. </trim>
  202. <where>ID = #{id}</where>
  203. </update>
  204. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspFloodqh">
  205. update BIS_INSP_FLOODQH
  206. <trim prefix="set" suffixOverrides=",">
  207. <if test="objId != null and objId != ''">OBJ_ID
  208. = #{objId},
  209. </if>
  210. <if test="nm != null and nm != ''">NM
  211. = #{nm},
  212. </if>
  213. <if test="floodType != null and floodType != ''">FLOOD_TYPE
  214. = #{floodType},
  215. </if>
  216. <if test="adCode != null and adCode != ''">AD_CODE
  217. = #{adCode},
  218. </if>
  219. <if test="adName != null and adName != ''">AD_NAME
  220. = #{adName},
  221. </if>
  222. <if test="loc != null and loc != ''">LOC
  223. = #{loc},
  224. </if>
  225. <if test="centerX != null and centerX != ''">CENTER_X
  226. = #{centerX},
  227. </if>
  228. <if test="centerY != null and centerY != ''">CENTER_Y
  229. = #{centerY},
  230. </if>
  231. <if test="gdX != null and gdX != ''">GD_X
  232. = #{gdX},
  233. </if>
  234. <if test="gdY != null and gdY != ''">GD_Y
  235. = #{gdY},
  236. </if>
  237. <if test="state != null and state != ''">STATE
  238. = #{state},
  239. </if>
  240. <if test="caseState != null and caseState != ''">CASE_STATE
  241. = #{caseState},
  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="dataStat != null and dataStat != ''">DATA_STAT
  250. = #{dataStat},
  251. </if>
  252. </trim>
  253. <include refid="page_where"/>
  254. </update>
  255. <!-- 其他自定义SQL -->
  256. <select id="findPageList" resultType="cn.com.goldenwater.dcproj.dto.BisInspFloodqhDto">
  257. SELECT * FROM (
  258. select
  259. A.CODE, A.ID nodeId, A.ptype,
  260. aw.AD_CODE as baseId, ia.pnm groupName,
  261. B.id as rgstrId, (case when b.STATE is null then '0' else b.state end) STATE,
  262. B.ID,
  263. B.OBJ_ID,
  264. B.NM,
  265. B.FLOOD_TYPE,
  266. B.AD_CODE,
  267. B.AD_NAME,
  268. B.LOC,
  269. B.CENTER_X,
  270. B.CENTER_Y,
  271. B.GD_X,
  272. B.GD_Y,
  273. B.CASE_STATE,
  274. B.INTM,
  275. B.UPTM,
  276. B.DATA_STAT
  277. FROM BIS_INSP_ALL_OBJ A
  278. JOIN BIS_INSP_FLOODQH B ON A.OBJ_ID=B.OBJ_ID
  279. LEFT JOIN BIS_INSP_ALL IA ON A.ID = IA.ID
  280. LEFT JOIN ATT_AD_BASE AW ON B.AD_CODE = AW.AD_CODE
  281. where A.ptype= #{pType}
  282. <if test="adCodes ==null or adCodes ==''">
  283. <choose>
  284. <when test='isAll =="1"'>
  285. </when>
  286. <otherwise>
  287. <if test="groupIds != null and groupIds.length &gt; 0">
  288. <foreach collection="groupIds" index="index" item="gId" separator=" OR " open="and (" close=")">
  289. A.id like '${gId}%'
  290. </foreach>
  291. </if>
  292. </otherwise>
  293. </choose>
  294. </if>
  295. <if test="adCodes !=null and adCodes !=''">
  296. and
  297. <foreach item="item" index="index" collection="adCodes.split(',')" open="(" separator="or" close=")">
  298. b.ad_code like concat('${item}','%')
  299. </foreach>
  300. </if>
  301. ) A
  302. <where>
  303. <if test="id !=null and id !=''">and nodeId like '${id}%'</if>
  304. <if test="plnaId !=null and plnaId !=''">and nodeId like '${plnaId}%'</if>
  305. <if test="groupId != null and groupId != ''">and nodeId like '${groupId}%'</if>
  306. <if test="code !=null and code !=''">and code = #{code}</if>
  307. <if test="nm !=null and nm !=''">and nm like '%${nm}%'</if>
  308. <if test="state !=null and state !=''">and STATE in (${state})</if>
  309. <if test="adName != null and adName != ''">and AD_NAME like '%${adName}%'</if>
  310. <if test="sttm != null and sttm != ''">and Intm &gt;= STR_TO_DATE(#{sttm},'%Y-%m-%d')</if>
  311. <if test="entm != null and entm != ''">and Intm &lt; DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') ,INTERVAL 1 DAY)</if>
  312. </where>
  313. order by nodeId asc
  314. <if test="orderBy != null and orderBy != ''">
  315. ,CONVERT( nm USING gbk ) COLLATE gbk_chinese_ci ASC
  316. </if>
  317. </select>
  318. </mapper>