AttCwsBaseCrrctDao.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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. DATE_FORMAT(START_DATE,'%Y-%m-%d %H:%i:%s') START_DATE,
  43. DATE_FORMAT(COMP_DATE,'%Y-%m-%d') COMP_DATE,
  44. DATE_FORMAT(COMP_DATE,'%Y') COMP_YEAR,
  45. NOTE ,
  46. DATE_FORMAT(EFF_DATE,'%Y-%m-%d %H:%i:%s') EFF_DATE,
  47. DATE_FORMAT(EXPR_DATE,'%Y-%m-%d %H:%i:%s') EXPR_DATE,
  48. ADDVCD ,
  49. CENTER_X_GD ,
  50. CENTER_Y_GD ,
  51. EDTR_PESR ,
  52. DATE_FORMAT(UPTM,'%Y-%m-%d %H:%i:%s') 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. STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s') ,
  92. STR_TO_DATE(#{compDate},'%Y-%m-%d'),
  93. #{note},
  94. STR_TO_DATE(#{effDate},'%Y-%m-%d %H:%i:%s') ,
  95. STR_TO_DATE(#{exprDate},'%Y-%m-%d %H:%i:%s') ,
  96. #{addvcd},
  97. #{centerXGd},
  98. #{centerYGd},
  99. #{edtrPesr},
  100. STR_TO_DATE(#{uptm},'%Y-%m-%d %H:%i:%s')
  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 = STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
  118. </if>
  119. <if test="compDate != null and compDate != ''">and COMP_DATE = STR_TO_DATE(#{compDate},'%Y-%m-%d')</if>
  120. <if test="note != null and note != ''">and NOTE = #{note}</if>
  121. <if test="effDate != null and effDate != ''">and EFF_DATE = STR_TO_DATE(#{effDate},'%Y-%m-%d %H:%i:%s')</if>
  122. <if test="exprDate != null and exprDate != ''">and EXPR_DATE = STR_TO_DATE(#{exprDate},'%Y-%m-%d %H:%i:%s')
  123. </if>
  124. <if test="addvcd != null and addvcd != ''">and ADDVCD = #{addvcd}</if>
  125. <if test="centerXGd != null and centerXGd != ''">and CENTER_X_GD = #{centerXGd}</if>
  126. <if test="centerYGd != null and centerYGd != ''">and CENTER_Y_GD = #{centerYGd}</if>
  127. <if test="edtrPesr != null and edtrPesr != ''">and EDTR_PESR = #{edtrPesr}</if>
  128. <if test="uptm != null and uptm != ''">and UPTM = STR_TO_DATE(#{uptm},'%Y-%m-%d %H:%i:%s')</if>
  129. </trim>
  130. </sql>
  131. <select id="get" resultMap="attCwsBaseCrrctResultMap" parameterType="String">
  132. select
  133. <include refid="table_columns"/>
  134. from att_cws_base_crrct where GUID = #{id}
  135. </select>
  136. <select id="getBy" resultMap="attCwsBaseCrrctResultMap">
  137. select
  138. <include refid="table_columns"/>
  139. from att_cws_base_crrct
  140. <include refid="page_where"/>
  141. </select>
  142. <select id="findAll" resultMap="attCwsBaseCrrctResultMap">
  143. select
  144. <include refid="table_columns"/>
  145. from att_cws_base_crrct
  146. </select>
  147. <select id="findList" resultMap="attCwsBaseCrrctResultMap">
  148. select
  149. <include refid="table_columns"/>
  150. from att_cws_base_crrct
  151. <include refid="page_where"/>
  152. ORDER BY GUID
  153. </select>
  154. <select id="selectCount" resultType="int">
  155. select count(GUID) from att_cws_base_crrct
  156. <include refid="page_where"/>
  157. </select>
  158. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttCwsBaseCrrct">
  159. insert into att_cws_base_crrct(
  160. <include refid="table_columns2"/>
  161. )
  162. values (
  163. <include refid="entity_properties"/>
  164. )
  165. </insert>
  166. <delete id="delete" parameterType="java.lang.String">
  167. delete from att_cws_base_crrct where GUID = #{id}
  168. </delete>
  169. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttCwsBaseCrrct">
  170. delete from att_cws_base_crrct
  171. <include refid="page_where"/>
  172. </delete>
  173. <update id="deleteInFlag" parameterType="java.lang.String">
  174. update att_cws_base_crrct set flag_valid = 0 where GUID = #{id}
  175. </update>
  176. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttCwsBaseCrrct">
  177. update att_cws_base_crrct
  178. <trim prefix="set" suffixOverrides=",">
  179. <if test="guid != null and guid != ''">GUID = #{guid},</if>
  180. <if test="cwsCode != null and cwsCode != ''">CWS_CODE = #{cwsCode},</if>
  181. <if test="cwsName != null and cwsName != ''">CWS_NAME = #{cwsName},</if>
  182. <if test="cwsLong != null and cwsLong != ''">CWS_LONG = #{cwsLong},</if>
  183. <if test="cwsLat != null and cwsLat != ''">CWS_LAT = #{cwsLat},</if>
  184. <if test="cwsLoc != null and cwsLoc != ''">CWS_LOC = #{cwsLoc},</if>
  185. <if test="engType != null and engType != ''">ENG_TYPE = #{engType},</if>
  186. <if test="wasuType != null and wasuType != ''">WASU_TYPE = #{wasuType},</if>
  187. <if test="wasuRang != null and wasuRang != ''">WASU_RANG = #{wasuRang},</if>
  188. <if test="desWasuScal != null and desWasuScal != ''">DES_WASU_SCAL = #{desWasuScal},</if>
  189. <if test="desWasuPop != null and desWasuPop != ''">DES_WASU_POP = #{desWasuPop},</if>
  190. <if test="engStat != null and engStat != ''">ENG_STAT = #{engStat},</if>
  191. <if test="startDate != null and startDate != ''">START_DATE = STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s'),
  192. </if>
  193. <if test="compDate != null and compDate != ''">COMP_DATE = STR_TO_DATE(#{compDate},'%Y-%m-%d'),</if>
  194. <if test="note != null and note != ''">NOTE = #{note},</if>
  195. <if test="effDate != null and effDate != ''">EFF_DATE = STR_TO_DATE(#{effDate},'%Y-%m-%d %H:%i:%s'),</if>
  196. <if test="exprDate != null and exprDate != ''">EXPR_DATE = STR_TO_DATE(#{exprDate},'%Y-%m-%d %H:%i:%s'),
  197. </if>
  198. <if test="addvcd != null and addvcd != ''">ADDVCD = #{addvcd},</if>
  199. <if test="centerXGd != null and centerXGd != ''">CENTER_X_GD = #{centerXGd},</if>
  200. <if test="centerYGd != null and centerYGd != ''">CENTER_Y_GD = #{centerYGd},</if>
  201. <if test="edtrPesr != null and edtrPesr != ''">EDTR_PESR = #{edtrPesr},</if>
  202. <if test="uptm != null and uptm != ''">UPTM = STR_TO_DATE(#{uptm},'%Y-%m-%d %H:%i:%s'),</if>
  203. </trim>
  204. <where>GUID = #{guid}</where>
  205. </update>
  206. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttCwsBaseCrrct">
  207. update att_cws_base_crrct
  208. <trim prefix="set" suffixOverrides=",">
  209. <if test="guid != null and guid != ''">GUID = #{guid},</if>
  210. <if test="cwsCode != null and cwsCode != ''">CWS_CODE = #{cwsCode},</if>
  211. <if test="cwsName != null and cwsName != ''">CWS_NAME = #{cwsName},</if>
  212. <if test="cwsLong != null and cwsLong != ''">CWS_LONG = #{cwsLong},</if>
  213. <if test="cwsLat != null and cwsLat != ''">CWS_LAT = #{cwsLat},</if>
  214. <if test="cwsLoc != null and cwsLoc != ''">CWS_LOC = #{cwsLoc},</if>
  215. <if test="engType != null and engType != ''">ENG_TYPE = #{engType},</if>
  216. <if test="wasuType != null and wasuType != ''">WASU_TYPE = #{wasuType},</if>
  217. <if test="wasuRang != null and wasuRang != ''">WASU_RANG = #{wasuRang},</if>
  218. <if test="desWasuScal != null and desWasuScal != ''">DES_WASU_SCAL = #{desWasuScal},</if>
  219. <if test="desWasuPop != null and desWasuPop != ''">DES_WASU_POP = #{desWasuPop},</if>
  220. <if test="engStat != null and engStat != ''">ENG_STAT = #{engStat},</if>
  221. <if test="startDate != null and startDate != ''">START_DATE = STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%S'),
  222. </if>
  223. <if test="compDate != null and compDate != ''">COMP_DATE = STR_TO_DATE(#{compDate},'%Y-%m-%d'),</if>
  224. <if test="note != null and note != ''">NOTE = #{note},</if>
  225. <if test="effDate != null and effDate != ''">EFF_DATE = STR_TO_DATE(#{effDate},'%Y-%m-%d %H:%i:%s'),</if>
  226. <if test="exprDate != null and exprDate != ''">EXPR_DATE = STR_TO_DATE(#{exprDate},'%Y-%m-%d %H:%i:%s'),
  227. </if>
  228. <if test="addvcd != null and addvcd != ''">ADDVCD = #{addvcd},</if>
  229. <if test="centerXGd != null and centerXGd != ''">CENTER_X_GD = #{centerXGd},</if>
  230. <if test="centerYGd != null and centerYGd != ''">CENTER_Y_GD = #{centerYGd},</if>
  231. <if test="edtrPesr != null and edtrPesr != ''">EDTR_PESR = #{edtrPesr},</if>
  232. <if test="uptm != null and uptm != ''">UPTM = STR_TO_DATE(#{uptm},'%Y-%m-%d %H:%i:%s'),</if>
  233. </trim>
  234. <include refid="page_where"/>
  235. </update>
  236. <!-- 其他自定义SQL -->
  237. <select id="getCrrctByPersId" resultType="cn.com.goldenwater.dcproj.model.AttCwsBase" parameterType="string">
  238. SELECT <include refid="table_columns" /> FROM ATT_CWS_BASE_CRRCT
  239. WHERE CWS_CODE=#{cwsCode} AND EDTR_PESR IN
  240. (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})
  241. order by uptm desc
  242. </select>
  243. </mapper>