f2a99ec763ef8245f12a58ad48b4e5ecc6f9835f.svn-base 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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.WrGwsBDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.WrGwsB" id="wrGwsBResultMap">
  5. <result property="lgtd" column="LGTD"/>
  6. <result property="lttd" column="LTTD"/>
  7. <result property="lgtdpc" column="LGTDPC"/>
  8. <result property="lttdpc" column="LTTDPC"/>
  9. <result property="gwsCd" column="GWS_CD"/>
  10. <result property="gwsNm" column="GWS_NM"/>
  11. <result property="gwsA" column="GWS_A"/>
  12. <result property="rangDesc" column="RANG_DESC"/>
  13. <result property="wqGoal" column="WQ_GOAL"/>
  14. <result property="consCond" column="CONS_COND"/>
  15. <result property="putProdTm" column="PUT_PROD_TM"/>
  16. <result property="runCond" column="RUN_COND"/>
  17. <result property="avgExpYd" column="AVG_EXP_YD"/>
  18. <result property="wsObj" column="WS_OBJ"/>
  19. <result property="desInt" column="DES_INT"/>
  20. <result property="permInt" column="PERM_INT"/>
  21. <result property="whsManCd" column="WHS_MAN_CD"/>
  22. <result property="whsApprCd" column="WHS_APPR_CD"/>
  23. <result property="adCode" column="AD_CODE"/>
  24. <result property="ts" column="TS"/>
  25. <result property="nt" column="NT"/>
  26. <result property="reportFrquency" column="REPORT_FRQUENCY"/>
  27. <result property="isuse" column="ISUSE"/>
  28. <result property="monG" column="MON_G"/>
  29. <result property="isEmg" column="IS_EMG"/>
  30. </resultMap>
  31. <sql id="table_columns">
  32. LGTD ,
  33. LTTD ,
  34. LGTDPC ,
  35. LTTDPC ,
  36. GWS_CD ,
  37. GWS_NM ,
  38. GWS_A ,
  39. RANG_DESC ,
  40. WQ_GOAL ,
  41. CONS_COND ,
  42. DATE_FORMAT(PUT_PROD_TM,'%Y-%m-%d %T') PUT_PROD_TM,
  43. RUN_COND ,
  44. AVG_EXP_YD ,
  45. WS_OBJ ,
  46. DES_INT ,
  47. PERM_INT ,
  48. WHS_MAN_CD ,
  49. WHS_APPR_CD ,
  50. DATE_FORMAT(TS,'%Y-%m-%d %T') TS,
  51. NT ,
  52. REPORT_FRQUENCY ,
  53. ISUSE ,
  54. MON_G ,
  55. IS_EMG ,AD_CODE
  56. </sql>
  57. <sql id="table_columns2">
  58. LGTD ,
  59. LTTD ,
  60. LGTDPC ,
  61. LTTDPC ,
  62. GWS_CD ,
  63. GWS_NM ,
  64. GWS_A ,
  65. RANG_DESC ,
  66. WQ_GOAL ,
  67. CONS_COND ,
  68. PUT_PROD_TM ,
  69. RUN_COND ,
  70. AVG_EXP_YD ,
  71. WS_OBJ ,
  72. DES_INT ,
  73. PERM_INT ,
  74. WHS_MAN_CD ,
  75. WHS_APPR_CD ,
  76. TS ,
  77. NT ,
  78. REPORT_FRQUENCY ,
  79. ISUSE ,
  80. MON_G ,
  81. IS_EMG ,AD_CODE
  82. </sql>
  83. <sql id="entity_properties">
  84. #{lgtd},
  85. #{lttd},
  86. #{lgtdpc},
  87. #{lttdpc},
  88. #{gwsCd},
  89. #{gwsNm},
  90. #{gwsA},
  91. #{rangDesc},
  92. #{wqGoal},
  93. #{consCond},
  94. STR_TO_DATE(#{putProdTm},'%Y-%m-%d %T') ,
  95. #{runCond},
  96. #{avgExpYd},
  97. #{wsObj},
  98. #{desInt},
  99. #{permInt},
  100. #{whsManCd},
  101. #{whsApprCd},
  102. STR_TO_DATE(#{ts},'%Y-%m-%d %T') ,
  103. #{nt},
  104. #{reportFrquency},
  105. #{isuse},
  106. #{monG},
  107. #{isEmg},#{adCode}
  108. </sql>
  109. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  110. <sql id="page_where">
  111. <trim prefix="where" prefixOverrides="and | or ">
  112. <if test="lgtd != null and lgtd != ''">and LGTD = #{lgtd}</if>
  113. <if test="lttd != null and lttd != ''">and LTTD = #{lttd}</if>
  114. <if test="lgtdpc != null and lgtdpc != ''">and LGTDPC = #{lgtdpc}</if>
  115. <if test="lttdpc != null and lttdpc != ''">and LTTDPC = #{lttdpc}</if>
  116. <if test="gwsCd != null and gwsCd != ''">and GWS_CD LIKE CONCAT(#{gwsCd}, '%')</if>
  117. <if test="gwsNm != null and gwsNm != ''">and GWS_NM LIKE CONCAT('%', #{gwsNm}, '%')</if>
  118. <if test="gwsA != null and gwsA != ''">and GWS_A = #{gwsA}</if>
  119. <if test="rangDesc != null and rangDesc != ''">and RANG_DESC = #{rangDesc}</if>
  120. <if test="wqGoal != null and wqGoal != ''">and WQ_GOAL = #{wqGoal}</if>
  121. <if test="consCond != null and consCond != ''">and CONS_COND = #{consCond}</if>
  122. <if test="putProdTm != null and putProdTm != ''">and PUT_PROD_TM = STR_TO_DATE(#{putProdTm},'%Y-%m-%d %T')
  123. </if>
  124. <if test="runCond != null and runCond != ''">and RUN_COND = #{runCond}</if>
  125. <if test="avgExpYd != null and avgExpYd != ''">and AVG_EXP_YD = #{avgExpYd}</if>
  126. <if test="wsObj != null and wsObj != ''">and WS_OBJ = #{wsObj}</if>
  127. <if test="desInt != null and desInt != ''">and DES_INT = #{desInt}</if>
  128. <if test="permInt != null and permInt != ''">and PERM_INT = #{permInt}</if>
  129. <if test="whsManCd != null and whsManCd != ''">and WHS_MAN_CD = #{whsManCd}</if>
  130. <if test="whsApprCd != null and whsApprCd != ''">and WHS_APPR_CD = #{whsApprCd}</if>
  131. <if test="ts != null and ts != ''">and TS = STR_TO_DATE(#{ts},'%Y-%m-%d %T')</if>
  132. <if test="nt != null and nt != ''">and NT = #{nt}</if>
  133. <if test="reportFrquency != null and reportFrquency != ''">and REPORT_FRQUENCY = #{reportFrquency}</if>
  134. <if test="isuse != null and isuse != ''">and ISUSE = #{isuse}</if>
  135. <if test="monG != null and monG != ''">and MON_G = #{monG}</if>
  136. <if test="isEmg != null and isEmg != ''">and IS_EMG = #{isEmg}</if>
  137. <if test="adCode != null and adCode != ''">and ad_Code like '${adCode}%'</if>
  138. </trim>
  139. </sql>
  140. <select id="get" resultMap="wrGwsBResultMap" parameterType="String">
  141. select
  142. <include refid="table_columns"/>
  143. from WR_GWS_B where GWS_CD = #{id}
  144. </select>
  145. <select id="getBy" resultMap="wrGwsBResultMap">
  146. select
  147. <include refid="table_columns"/>
  148. from WR_GWS_B
  149. <include refid="page_where"/>
  150. </select>
  151. <select id="findAll" resultMap="wrGwsBResultMap">
  152. select
  153. <include refid="table_columns"/>
  154. from WR_GWS_B
  155. </select>
  156. <select id="findList" resultMap="wrGwsBResultMap">
  157. select
  158. <include refid="table_columns"/>
  159. from WR_GWS_B
  160. <include refid="page_where"/>
  161. order by GWS_CD
  162. </select>
  163. <select id="selectCount" resultType="int">
  164. select count(GWS_CD) from WR_GWS_B
  165. <include refid="page_where"/>
  166. </select>
  167. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.WrGwsB">
  168. insert into WR_GWS_B(
  169. <include refid="table_columns2"/>
  170. )
  171. values (
  172. <include refid="entity_properties"/>
  173. )
  174. </insert>
  175. <delete id="delete" parameterType="java.lang.String">
  176. delete from WR_GWS_B where GWS_CD = #{id}
  177. </delete>
  178. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.WrGwsB">
  179. delete from WR_GWS_B
  180. <include refid="page_where"/>
  181. </delete>
  182. <update id="deleteInFlag" parameterType="java.lang.String">
  183. update WR_GWS_B set flag_valid = 0 where GWS_CD = #{id}
  184. </update>
  185. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.WrGwsB">
  186. update WR_GWS_B
  187. <trim prefix="set" suffixOverrides=",">
  188. <if test="lgtd != null and lgtd != ''">LGTD = #{lgtd},</if>
  189. <if test="lttd != null and lttd != ''">LTTD = #{lttd},</if>
  190. <if test="lgtdpc != null and lgtdpc != ''">LGTDPC = #{lgtdpc},</if>
  191. <if test="lttdpc != null and lttdpc != ''">LTTDPC = #{lttdpc},</if>
  192. <if test="gwsNm != null and gwsNm != ''">GWS_NM = #{gwsNm},</if>
  193. <if test="gwsA != null and gwsA != ''">GWS_A = #{gwsA},</if>
  194. <if test="rangDesc != null and rangDesc != ''">RANG_DESC = #{rangDesc},</if>
  195. <if test="wqGoal != null and wqGoal != ''">WQ_GOAL = #{wqGoal},</if>
  196. <if test="consCond != null and consCond != ''">CONS_COND = #{consCond},</if>
  197. <if test="putProdTm != null and putProdTm != ''">PUT_PROD_TM = STR_TO_DATE(#{putProdTm},'%Y-%m-%d %T'),
  198. </if>
  199. <if test="runCond != null and runCond != ''">RUN_COND = #{runCond},</if>
  200. <if test="avgExpYd != null and avgExpYd != ''">AVG_EXP_YD = #{avgExpYd},</if>
  201. <if test="wsObj != null and wsObj != ''">WS_OBJ = #{wsObj},</if>
  202. <if test="desInt != null and desInt != ''">DES_INT = #{desInt},</if>
  203. <if test="permInt != null and permInt != ''">PERM_INT = #{permInt},</if>
  204. <if test="whsManCd != null and whsManCd != ''">WHS_MAN_CD = #{whsManCd},</if>
  205. <if test="whsApprCd != null and whsApprCd != ''">WHS_APPR_CD = #{whsApprCd},</if>
  206. <if test="ts != null and ts != ''">TS = STR_TO_DATE(#{ts},'%Y-%m-%d %T'),</if>
  207. <if test="nt != null and nt != ''">NT = #{nt},</if>
  208. <if test="reportFrquency != null and reportFrquency != ''">REPORT_FRQUENCY = #{reportFrquency},</if>
  209. <if test="isuse != null and isuse != ''">ISUSE = #{isuse},</if>
  210. <if test="monG != null and monG != ''">MON_G = #{monG},</if>
  211. <if test="isEmg != null and isEmg != ''">IS_EMG = #{isEmg},</if>
  212. <if test="adCode != null and adCode != ''">ad_Code = #{adCode},</if>
  213. </trim>
  214. <where>GWS_CD = #{gwsCd}</where>
  215. </update>
  216. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.WrGwsB">
  217. update WR_GWS_B
  218. <trim prefix="set" suffixOverrides=",">
  219. <if test="lgtd != null and lgtd != ''">LGTD = #{lgtd},</if>
  220. <if test="lttd != null and lttd != ''">LTTD = #{lttd},</if>
  221. <if test="lgtdpc != null and lgtdpc != ''">LGTDPC = #{lgtdpc},</if>
  222. <if test="lttdpc != null and lttdpc != ''">LTTDPC = #{lttdpc},</if>
  223. <if test="gwsCd != null and gwsCd != ''">GWS_CD = #{gwsCd},</if>
  224. <if test="gwsNm != null and gwsNm != ''">GWS_NM = #{gwsNm},</if>
  225. <if test="gwsA != null and gwsA != ''">GWS_A = #{gwsA},</if>
  226. <if test="rangDesc != null and rangDesc != ''">RANG_DESC = #{rangDesc},</if>
  227. <if test="wqGoal != null and wqGoal != ''">WQ_GOAL = #{wqGoal},</if>
  228. <if test="consCond != null and consCond != ''">CONS_COND = #{consCond},</if>
  229. <if test="putProdTm != null and putProdTm != ''">PUT_PROD_TM = STR_TO_DATE(#{putProdTm},'%Y-%m-%d %T'),
  230. </if>
  231. <if test="runCond != null and runCond != ''">RUN_COND = #{runCond},</if>
  232. <if test="avgExpYd != null and avgExpYd != ''">AVG_EXP_YD = #{avgExpYd},</if>
  233. <if test="wsObj != null and wsObj != ''">WS_OBJ = #{wsObj},</if>
  234. <if test="desInt != null and desInt != ''">DES_INT = #{desInt},</if>
  235. <if test="permInt != null and permInt != ''">PERM_INT = #{permInt},</if>
  236. <if test="whsManCd != null and whsManCd != ''">WHS_MAN_CD = #{whsManCd},</if>
  237. <if test="whsApprCd != null and whsApprCd != ''">WHS_APPR_CD = #{whsApprCd},</if>
  238. <if test="ts != null and ts != ''">TS = STR_TO_DATE(#{ts},'%Y-%m-%d %T'),</if>
  239. <if test="nt != null and nt != ''">NT = #{nt},</if>
  240. <if test="reportFrquency != null and reportFrquency != ''">REPORT_FRQUENCY = #{reportFrquency},</if>
  241. <if test="isuse != null and isuse != ''">ISUSE = #{isuse},</if>
  242. <if test="monG != null and monG != ''">MON_G = #{monG},</if>
  243. <if test="isEmg != null and isEmg != ''">IS_EMG = #{isEmg},</if>
  244. </trim>
  245. <include refid="page_where"/>
  246. </update>
  247. <!-- 其他自定义SQL -->
  248. <select id="getMaxGwsCode" resultType="string" parameterType="string">
  249. SELECT MAX(GWS_CD) FROM WR_GWS_B WHERE GWS_CD LIKE CONCAT(#{adCode}, '%')
  250. </select>
  251. </mapper>