AttCwsBaseCrrctDao.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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.AttCwsBaseCrrctDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.AttCwsBaseCrrct" id="attCwsBaseCrrctResultMap">
  5. <result property="guid" column="GUID"/>
  6. <result property="cwsCode" column="CWS_CODE"/>
  7. <result property="cwsName" column="CWS_NAME"/>
  8. <result property="cwsLong" column="CWS_LONG"/>
  9. <result property="cwsLat" column="CWS_LAT"/>
  10. <result property="cwsLoc" column="CWS_LOC"/>
  11. <result property="engType" column="ENG_TYPE"/>
  12. <result property="wasuType" column="WASU_TYPE"/>
  13. <result property="wasuRang" column="WASU_RANG"/>
  14. <result property="desWasuScal" column="DES_WASU_SCAL"/>
  15. <result property="desWasuPop" column="DES_WASU_POP"/>
  16. <result property="engStat" column="ENG_STAT"/>
  17. <result property="startDate" column="START_DATE"/>
  18. <result property="compDate" column="COMP_DATE"/>
  19. <result property="note" column="NOTE"/>
  20. <result property="effDate" column="EFF_DATE"/>
  21. <result property="exprDate" column="EXPR_DATE"/>
  22. <result property="addvcd" column="ADDVCD"/>
  23. <result property="centerXGd" column="CENTER_X_GD"/>
  24. <result property="centerYGd" column="CENTER_Y_GD"/>
  25. <result property="edtrPesr" column="EDTR_PESR"/>
  26. <result property="uptm" column="UPTM"/>
  27. <result property="compYear" column="COMP_YEAR"/>
  28. </resultMap>
  29. <sql id="table_columns">
  30. GUID ,
  31. CWS_CODE ,
  32. CWS_NAME ,
  33. CWS_LONG ,
  34. CWS_LAT ,
  35. CWS_LOC ,
  36. ENG_TYPE ,
  37. WASU_TYPE ,
  38. WASU_RANG ,
  39. DES_WASU_SCAL ,
  40. DES_WASU_POP ,
  41. ENG_STAT ,
  42. TO_CHAR(START_DATE,'YYYY-MM-DD HH24:MI:SS') START_DATE,
  43. TO_CHAR(COMP_DATE,'YYYY-MM-DD') COMP_DATE,
  44. TO_CHAR(COMP_DATE,'YYYY') COMP_YEAR,
  45. NOTE ,
  46. TO_CHAR(EFF_DATE,'YYYY-MM-DD HH24:MI:SS') EFF_DATE,
  47. TO_CHAR(EXPR_DATE,'YYYY-MM-DD HH24:MI:SS') EXPR_DATE,
  48. ADDVCD ,
  49. CENTER_X_GD ,
  50. CENTER_Y_GD ,
  51. EDTR_PESR ,
  52. TO_CHAR(UPTM,'YYYY-MM-DD HH24:MI:SS') UPTM
  53. </sql>
  54. <sql id="table_columns2">
  55. GUID ,
  56. CWS_CODE ,
  57. CWS_NAME ,
  58. CWS_LONG ,
  59. CWS_LAT ,
  60. CWS_LOC ,
  61. ENG_TYPE ,
  62. WASU_TYPE ,
  63. WASU_RANG ,
  64. DES_WASU_SCAL ,
  65. DES_WASU_POP ,
  66. ENG_STAT ,
  67. START_DATE ,
  68. COMP_DATE ,
  69. NOTE ,
  70. EFF_DATE ,
  71. EXPR_DATE ,
  72. ADDVCD ,
  73. CENTER_X_GD ,
  74. CENTER_Y_GD ,
  75. EDTR_PESR ,
  76. UPTM
  77. </sql>
  78. <sql id="entity_properties">
  79. #{guid},
  80. #{cwsCode},
  81. #{cwsName},
  82. #{cwsLong},
  83. #{cwsLat},
  84. #{cwsLoc},
  85. #{engType},
  86. #{wasuType},
  87. #{wasuRang},
  88. #{desWasuScal},
  89. #{desWasuPop},
  90. #{engStat},
  91. TO_DATE(#{startDate},'YYYY-MM-DD HH24:MI:SS') ,
  92. TO_DATE(#{compDate},'YYYY-MM-DD'),
  93. #{note},
  94. TO_DATE(#{effDate},'YYYY-MM-DD HH24:MI:SS') ,
  95. TO_DATE(#{exprDate},'YYYY-MM-DD HH24:MI:SS') ,
  96. #{addvcd},
  97. #{centerXGd},
  98. #{centerYGd},
  99. #{edtrPesr},
  100. TO_DATE(#{uptm},'YYYY-MM-DD HH24:MI:SS')
  101. </sql>
  102. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  103. <sql id="page_where">
  104. <trim prefix="where" prefixOverrides="and | or ">
  105. <if test="guid != null and guid != ''">and GUID = #{guid}</if>
  106. <if test="cwsCode != null and cwsCode != ''">and CWS_CODE = #{cwsCode}</if>
  107. <if test="cwsName != null and cwsName != ''">and CWS_NAME = #{cwsName}</if>
  108. <if test="cwsLong != null and cwsLong != ''">and CWS_LONG = #{cwsLong}</if>
  109. <if test="cwsLat != null and cwsLat != ''">and CWS_LAT = #{cwsLat}</if>
  110. <if test="cwsLoc != null and cwsLoc != ''">and CWS_LOC = #{cwsLoc}</if>
  111. <if test="engType != null and engType != ''">and ENG_TYPE = #{engType}</if>
  112. <if test="wasuType != null and wasuType != ''">and WASU_TYPE = #{wasuType}</if>
  113. <if test="wasuRang != null and wasuRang != ''">and WASU_RANG = #{wasuRang}</if>
  114. <if test="desWasuScal != null and desWasuScal != ''">and DES_WASU_SCAL = #{desWasuScal}</if>
  115. <if test="desWasuPop != null and desWasuPop != ''">and DES_WASU_POP = #{desWasuPop}</if>
  116. <if test="engStat != null and engStat != ''">and ENG_STAT = #{engStat}</if>
  117. <if test="startDate != null and startDate != ''">and START_DATE = TO_DATE(#{startDate},'YYYY-MM-DD
  118. HH24:MI:SS')
  119. </if>
  120. <if test="compDate != null and compDate != ''">and COMP_DATE = TO_DATE(#{compDate},'YYYY-MM-DD')</if>
  121. <if test="note != null and note != ''">and NOTE = #{note}</if>
  122. <if test="effDate != null and effDate != ''">and EFF_DATE = TO_DATE(#{effDate},'YYYY-MM-DD HH24:MI:SS')</if>
  123. <if test="exprDate != null and exprDate != ''">and EXPR_DATE = TO_DATE(#{exprDate},'YYYY-MM-DD
  124. HH24:MI:SS')
  125. </if>
  126. <if test="addvcd != null and addvcd != ''">and ADDVCD = #{addvcd}</if>
  127. <if test="centerXGd != null and centerXGd != ''">and CENTER_X_GD = #{centerXGd}</if>
  128. <if test="centerYGd != null and centerYGd != ''">and CENTER_Y_GD = #{centerYGd}</if>
  129. <if test="edtrPesr != null and edtrPesr != ''">and EDTR_PESR = #{edtrPesr}</if>
  130. <if test="uptm != null and uptm != ''">and UPTM = TO_DATE(#{uptm},'YYYY-MM-DD HH24:MI:SS')</if>
  131. </trim>
  132. </sql>
  133. <select id="get" resultMap="attCwsBaseCrrctResultMap" parameterType="String">
  134. select
  135. <include refid="table_columns"/>
  136. from att_cws_base_crrct where GUID = #{id}
  137. </select>
  138. <select id="getBy" resultMap="attCwsBaseCrrctResultMap">
  139. select
  140. <include refid="table_columns"/>
  141. from att_cws_base_crrct
  142. <include refid="page_where"/>
  143. </select>
  144. <select id="findAll" resultMap="attCwsBaseCrrctResultMap">
  145. select
  146. <include refid="table_columns"/>
  147. from att_cws_base_crrct
  148. </select>
  149. <select id="findList" resultMap="attCwsBaseCrrctResultMap">
  150. select
  151. <include refid="table_columns"/>
  152. from att_cws_base_crrct
  153. <include refid="page_where"/>
  154. ORDER BY GUID
  155. </select>
  156. <select id="selectCount" resultType="int">
  157. select count(GUID) from att_cws_base_crrct
  158. <include refid="page_where"/>
  159. </select>
  160. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttCwsBaseCrrct">
  161. insert into att_cws_base_crrct(
  162. <include refid="table_columns2"/>
  163. )
  164. values (
  165. <include refid="entity_properties"/>
  166. )
  167. </insert>
  168. <delete id="delete" parameterType="java.lang.String">
  169. delete from att_cws_base_crrct where GUID = #{id}
  170. </delete>
  171. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttCwsBaseCrrct">
  172. delete from att_cws_base_crrct
  173. <include refid="page_where"/>
  174. </delete>
  175. <update id="deleteInFlag" parameterType="java.lang.String">
  176. update att_cws_base_crrct set flag_valid = 0 where GUID = #{id}
  177. </update>
  178. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttCwsBaseCrrct">
  179. update att_cws_base_crrct
  180. <trim prefix="set" suffixOverrides=",">
  181. <if test="guid != null and guid != ''">GUID = #{guid},</if>
  182. <if test="cwsCode != null and cwsCode != ''">CWS_CODE = #{cwsCode},</if>
  183. <if test="cwsName != null and cwsName != ''">CWS_NAME = #{cwsName},</if>
  184. <if test="cwsLong != null and cwsLong != ''">CWS_LONG = #{cwsLong},</if>
  185. <if test="cwsLat != null and cwsLat != ''">CWS_LAT = #{cwsLat},</if>
  186. <if test="cwsLoc != null and cwsLoc != ''">CWS_LOC = #{cwsLoc},</if>
  187. <if test="engType != null and engType != ''">ENG_TYPE = #{engType},</if>
  188. <if test="wasuType != null and wasuType != ''">WASU_TYPE = #{wasuType},</if>
  189. <if test="wasuRang != null and wasuRang != ''">WASU_RANG = #{wasuRang},</if>
  190. <if test="desWasuScal != null and desWasuScal != ''">DES_WASU_SCAL = #{desWasuScal},</if>
  191. <if test="desWasuPop != null and desWasuPop != ''">DES_WASU_POP = #{desWasuPop},</if>
  192. <if test="engStat != null and engStat != ''">ENG_STAT = #{engStat},</if>
  193. <if test="startDate != null and startDate != ''">START_DATE = TO_DATE(#{startDate},'YYYY-MM-DD
  194. HH24:MI:SS'),
  195. </if>
  196. <if test="compDate != null and compDate != ''">COMP_DATE = TO_DATE(#{compDate},'YYYY-MM-DD'),</if>
  197. <if test="note != null and note != ''">NOTE = #{note},</if>
  198. <if test="effDate != null and effDate != ''">EFF_DATE = TO_DATE(#{effDate},'YYYY-MM-DD HH24:MI:SS'),</if>
  199. <if test="exprDate != null and exprDate != ''">EXPR_DATE = TO_DATE(#{exprDate},'YYYY-MM-DD HH24:MI:SS'),
  200. </if>
  201. <if test="addvcd != null and addvcd != ''">ADDVCD = #{addvcd},</if>
  202. <if test="centerXGd != null and centerXGd != ''">CENTER_X_GD = #{centerXGd},</if>
  203. <if test="centerYGd != null and centerYGd != ''">CENTER_Y_GD = #{centerYGd},</if>
  204. <if test="edtrPesr != null and edtrPesr != ''">EDTR_PESR = #{edtrPesr},</if>
  205. <if test="uptm != null and uptm != ''">UPTM = TO_DATE(#{uptm},'YYYY-MM-DD HH24:MI:SS'),</if>
  206. </trim>
  207. <where>GUID = #{guid}</where>
  208. </update>
  209. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttCwsBaseCrrct">
  210. update att_cws_base_crrct
  211. <trim prefix="set" suffixOverrides=",">
  212. <if test="guid != null and guid != ''">GUID = #{guid},</if>
  213. <if test="cwsCode != null and cwsCode != ''">CWS_CODE = #{cwsCode},</if>
  214. <if test="cwsName != null and cwsName != ''">CWS_NAME = #{cwsName},</if>
  215. <if test="cwsLong != null and cwsLong != ''">CWS_LONG = #{cwsLong},</if>
  216. <if test="cwsLat != null and cwsLat != ''">CWS_LAT = #{cwsLat},</if>
  217. <if test="cwsLoc != null and cwsLoc != ''">CWS_LOC = #{cwsLoc},</if>
  218. <if test="engType != null and engType != ''">ENG_TYPE = #{engType},</if>
  219. <if test="wasuType != null and wasuType != ''">WASU_TYPE = #{wasuType},</if>
  220. <if test="wasuRang != null and wasuRang != ''">WASU_RANG = #{wasuRang},</if>
  221. <if test="desWasuScal != null and desWasuScal != ''">DES_WASU_SCAL = #{desWasuScal},</if>
  222. <if test="desWasuPop != null and desWasuPop != ''">DES_WASU_POP = #{desWasuPop},</if>
  223. <if test="engStat != null and engStat != ''">ENG_STAT = #{engStat},</if>
  224. <if test="startDate != null and startDate != ''">START_DATE = TO_DATE(#{startDate},'YYYY-MM-DD
  225. HH24:MI:SS'),
  226. </if>
  227. <if test="compDate != null and compDate != ''">COMP_DATE = TO_DATE(#{compDate},'YYYY-MM-DD'),</if>
  228. <if test="note != null and note != ''">NOTE = #{note},</if>
  229. <if test="effDate != null and effDate != ''">EFF_DATE = TO_DATE(#{effDate},'YYYY-MM-DD HH24:MI:SS'),</if>
  230. <if test="exprDate != null and exprDate != ''">EXPR_DATE = TO_DATE(#{exprDate},'YYYY-MM-DD HH24:MI:SS'),
  231. </if>
  232. <if test="addvcd != null and addvcd != ''">ADDVCD = #{addvcd},</if>
  233. <if test="centerXGd != null and centerXGd != ''">CENTER_X_GD = #{centerXGd},</if>
  234. <if test="centerYGd != null and centerYGd != ''">CENTER_Y_GD = #{centerYGd},</if>
  235. <if test="edtrPesr != null and edtrPesr != ''">EDTR_PESR = #{edtrPesr},</if>
  236. <if test="uptm != null and uptm != ''">UPTM = TO_DATE(#{uptm},'YYYY-MM-DD HH24:MI:SS'),</if>
  237. </trim>
  238. <include refid="page_where"/>
  239. </update>
  240. <!-- 其他自定义SQL -->
  241. <select id="getCrrctByPersId" resultType="cn.com.goldenwater.dcproj.model.AttCwsBase" parameterType="string">
  242. SELECT <include refid="table_columns" /> FROM ATT_CWS_BASE_CRRCT
  243. WHERE CWS_CODE=#{cwsCode} AND EDTR_PESR IN
  244. (SELECT B.PERSID FROM BIS_INSP_ALL_RLATION A LEFT JOIN BIS_INSP_ALL_RLATION B ON A.ID=B.ID WHERE A.PERSID=#{persId})
  245. order by uptm desc
  246. </select>
  247. </mapper>