WrSwsBDao.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  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.WrSwsBDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.WrSwsB" id="wrSwsBResultMap">
  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="swsCd" column="SWS_CD"/>
  10. <result property="swsNm" column="SWS_NM"/>
  11. <result property="swsTp" column="SWS_TP"/>
  12. <result property="watA" column="WAT_A"/>
  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="wsCond" column="WS_COND"/>
  18. <result property="wsObj" column="WS_OBJ"/>
  19. <result property="dywsPp" column="DYWS_PP"/>
  20. <result property="dywsW" column="DYWS_W"/>
  21. <result property="ddwsW" column="DDWS_W"/>
  22. <result property="whsManCd" column="WHS_MAN_CD"/>
  23. <result property="whsApprCd" column="WHS_APPR_CD"/>
  24. <result property="emCd" column="EM_CD"/>
  25. <result property="ts" column="TS"/>
  26. <result property="nt" column="NT"/>
  27. <result property="monG" column="MON_G"/>
  28. <result property="repPer" column="REP_PER"/>
  29. <result property="isuse" column="ISUSE"/>
  30. <result property="firProA" column="FIR_PRO_A"/>
  31. <result property="secProA" column="SEC_PRO_A"/>
  32. <result property="norProA" column="NOR_PRO_A"/>
  33. <result property="isEmg" column="IS_EMG"/>
  34. </resultMap>
  35. <sql id="table_columns">
  36. LGTD ,
  37. LTTD ,
  38. LGTDPC ,
  39. LTTDPC ,
  40. SWS_CD ,
  41. SWS_NM ,
  42. SWS_TP ,
  43. WAT_A ,
  44. WQ_GOAL ,
  45. CONS_COND ,
  46. TO_CHAR(PUT_PROD_TM,'YYYY-MM-DD HH24:MI:SS') PUT_PROD_TM,
  47. RUN_COND ,
  48. WS_COND ,
  49. WS_OBJ ,
  50. DYWS_PP ,
  51. DYWS_W ,
  52. DDWS_W ,
  53. WHS_MAN_CD ,
  54. WHS_APPR_CD ,
  55. EM_CD ,
  56. TO_CHAR(TS,'YYYY-MM-DD HH24:MI:SS') TS,
  57. NT ,
  58. MON_G ,
  59. REP_PER ,
  60. ISUSE ,
  61. FIR_PRO_A ,
  62. SEC_PRO_A ,
  63. NOR_PRO_A ,
  64. IS_EMG ,ad_Code
  65. </sql>
  66. <sql id="table_columns2">
  67. LGTD ,
  68. LTTD ,
  69. LGTDPC ,
  70. LTTDPC ,
  71. SWS_CD ,
  72. SWS_NM ,
  73. SWS_TP ,
  74. WAT_A ,
  75. WQ_GOAL ,
  76. CONS_COND ,
  77. PUT_PROD_TM ,
  78. RUN_COND ,
  79. WS_COND ,
  80. WS_OBJ ,
  81. DYWS_PP ,
  82. DYWS_W ,
  83. DDWS_W ,
  84. WHS_MAN_CD ,
  85. WHS_APPR_CD ,
  86. EM_CD ,
  87. TS ,
  88. NT ,
  89. MON_G ,
  90. REP_PER ,
  91. ISUSE ,
  92. FIR_PRO_A ,
  93. SEC_PRO_A ,
  94. NOR_PRO_A ,
  95. IS_EMG
  96. </sql>
  97. <sql id="entity_properties">
  98. #{lgtd},
  99. #{lttd},
  100. #{lgtdpc},
  101. #{lttdpc},
  102. #{swsCd},
  103. #{swsNm},
  104. #{swsTp},
  105. #{watA},
  106. #{wqGoal},
  107. #{consCond},
  108. TO_DATE(#{putProdTm},'YYYY-MM-DD HH24:MI:SS') ,
  109. #{runCond},
  110. #{wsCond},
  111. #{wsObj},
  112. #{dywsPp},
  113. #{dywsW},
  114. #{ddwsW},
  115. #{whsManCd},
  116. #{whsApprCd},
  117. #{emCd},
  118. TO_DATE(#{ts},'YYYY-MM-DD HH24:MI:SS') ,
  119. #{nt},
  120. #{monG},
  121. #{repPer},
  122. #{isuse},
  123. #{firProA},
  124. #{secProA},
  125. #{norProA},
  126. #{isEmg},#{adCode}
  127. </sql>
  128. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  129. <sql id="page_where">
  130. <trim prefix="where" prefixOverrides="and | or ">
  131. <if test="lgtd != null and lgtd != ''">and LGTD = #{lgtd}</if>
  132. <if test="lttd != null and lttd != ''">and LTTD = #{lttd}</if>
  133. <if test="lgtdpc != null and lgtdpc != ''">and LGTDPC = #{lgtdpc}</if>
  134. <if test="lttdpc != null and lttdpc != ''">and LTTDPC = #{lttdpc}</if>
  135. <if test="swsCd != null and swsCd != ''">and SWS_CD LIKE #{swsCd}||'%'</if>
  136. <if test="swsNm != null and swsNm != ''">and SWS_NM LIKE '%'||#{swsNm}||'%'</if>
  137. <if test="swsTp != null and swsTp != ''">and SWS_TP = #{swsTp}</if>
  138. <if test="watA != null and watA != ''">and WAT_A = #{watA}</if>
  139. <if test="wqGoal != null and wqGoal != ''">and WQ_GOAL = #{wqGoal}</if>
  140. <if test="consCond != null and consCond != ''">and CONS_COND = #{consCond}</if>
  141. <if test="putProdTm != null and putProdTm != ''">and PUT_PROD_TM = TO_DATE(#{putProdTm},'YYYY-MM-DD
  142. HH24:MI:SS')
  143. </if>
  144. <if test="runCond != null and runCond != ''">and RUN_COND = #{runCond}</if>
  145. <if test="wsCond != null and wsCond != ''">and WS_COND = #{wsCond}</if>
  146. <if test="wsObj != null and wsObj != ''">and WS_OBJ = #{wsObj}</if>
  147. <if test="dywsPp != null and dywsPp != ''">and DYWS_PP = #{dywsPp}</if>
  148. <if test="dywsW != null and dywsW != ''">and DYWS_W = #{dywsW}</if>
  149. <if test="ddwsW != null and ddwsW != ''">and DDWS_W = #{ddwsW}</if>
  150. <if test="whsManCd != null and whsManCd != ''">and WHS_MAN_CD = #{whsManCd}</if>
  151. <if test="whsApprCd != null and whsApprCd != ''">and WHS_APPR_CD = #{whsApprCd}</if>
  152. <if test="emCd != null and emCd != ''">and EM_CD = #{emCd}</if>
  153. <if test="ts != null and ts != ''">and TS = TO_DATE(#{ts},'YYYY-MM-DD HH24:MI:SS')</if>
  154. <if test="nt != null and nt != ''">and NT = #{nt}</if>
  155. <if test="monG != null and monG != ''">and MON_G = #{monG}</if>
  156. <if test="repPer != null and repPer != ''">and REP_PER = #{repPer}</if>
  157. <if test="isuse != null and isuse != ''">and ISUSE = #{isuse}</if>
  158. <if test="firProA != null and firProA != ''">and FIR_PRO_A = #{firProA}</if>
  159. <if test="secProA != null and secProA != ''">and SEC_PRO_A = #{secProA}</if>
  160. <if test="norProA != null and norProA != ''">and NOR_PRO_A = #{norProA}</if>
  161. <if test="isEmg != null and isEmg != ''">and IS_EMG = #{isEmg}</if>
  162. <if test="adCode != null and adCode != ''">and ad_Code like '${adCode}%'</if>
  163. <if test="province != null and province != ''">and sws_cd like '${province}%'</if>
  164. </trim>
  165. </sql>
  166. <select id="get" resultMap="wrSwsBResultMap" parameterType="String">
  167. select
  168. <include refid="table_columns"/>
  169. from WR_SWS_B where SWS_CD = #{id}
  170. </select>
  171. <select id="getBy" resultMap="wrSwsBResultMap">
  172. select
  173. <include refid="table_columns"/>
  174. from WR_SWS_B
  175. <include refid="page_where"/>
  176. </select>
  177. <select id="findAll" resultMap="wrSwsBResultMap">
  178. select
  179. <include refid="table_columns"/>
  180. from WR_SWS_B
  181. </select>
  182. <select id="findList" resultMap="wrSwsBResultMap">
  183. select
  184. <include refid="table_columns"/>
  185. from WR_SWS_B
  186. <include refid="page_where"/>
  187. order by SWS_CD
  188. </select>
  189. <select id="selectCount" resultType="int">
  190. select count(SWS_CD) from WR_SWS_B
  191. <include refid="page_where"/>
  192. </select>
  193. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.WrSwsB">
  194. insert into WR_SWS_B(
  195. <include refid="table_columns2"/>
  196. )
  197. values (
  198. <include refid="entity_properties"/>
  199. )
  200. </insert>
  201. <delete id="delete" parameterType="java.lang.String">
  202. delete from WR_SWS_B where SWS_CD = #{id}
  203. </delete>
  204. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.WrSwsB">
  205. delete from WR_SWS_B
  206. <include refid="page_where"/>
  207. </delete>
  208. <update id="deleteInFlag" parameterType="java.lang.String">
  209. update WR_SWS_B set flag_valid = 0 where SWS_CD = #{id}
  210. </update>
  211. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.WrSwsB">
  212. update WR_SWS_B
  213. <trim prefix="set" suffixOverrides=",">
  214. <if test="lgtd != null and lgtd != ''">LGTD = #{lgtd},</if>
  215. <if test="lttd != null and lttd != ''">LTTD = #{lttd},</if>
  216. <if test="lgtdpc != null and lgtdpc != ''">LGTDPC = #{lgtdpc},</if>
  217. <if test="lttdpc != null and lttdpc != ''">LTTDPC = #{lttdpc},</if>
  218. <if test="swsNm != null and swsNm != ''">SWS_NM=#{swsNm},</if>
  219. <if test="swsTp != null and swsTp != ''">SWS_TP = #{swsTp},</if>
  220. <if test="watA != null and watA != ''">WAT_A = #{watA},</if>
  221. <if test="wqGoal != null and wqGoal != ''">WQ_GOAL = #{wqGoal},</if>
  222. <if test="consCond != null and consCond != ''">CONS_COND = #{consCond},</if>
  223. <if test="putProdTm != null and putProdTm != ''">PUT_PROD_TM = TO_DATE(#{putProdTm},'YYYY-MM-DD
  224. HH24:MI:SS'),
  225. </if>
  226. <if test="runCond != null and runCond != ''">RUN_COND = #{runCond},</if>
  227. <if test="wsCond != null and wsCond != ''">WS_COND = #{wsCond},</if>
  228. <if test="wsObj != null and wsObj != ''">WS_OBJ = #{wsObj},</if>
  229. <if test="dywsPp != null and dywsPp != ''">DYWS_PP = #{dywsPp},</if>
  230. <if test="dywsW != null and dywsW != ''">DYWS_W = #{dywsW},</if>
  231. <if test="ddwsW != null and ddwsW != ''">DDWS_W = #{ddwsW},</if>
  232. <if test="whsManCd != null and whsManCd != ''">WHS_MAN_CD = #{whsManCd},</if>
  233. <if test="whsApprCd != null and whsApprCd != ''">WHS_APPR_CD = #{whsApprCd},</if>
  234. <if test="emCd != null and emCd != ''">EM_CD = #{emCd},</if>
  235. <if test="ts != null and ts != ''">TS = TO_DATE(#{ts},'YYYY-MM-DD HH24:MI:SS'),</if>
  236. <if test="nt != null and nt != ''">NT = #{nt},</if>
  237. <if test="monG != null and monG != ''">MON_G = #{monG},</if>
  238. <if test="repPer != null and repPer != ''">REP_PER = #{repPer},</if>
  239. <if test="isuse != null and isuse != ''">ISUSE = #{isuse},</if>
  240. <if test="firProA != null and firProA != ''">FIR_PRO_A = #{firProA},</if>
  241. <if test="secProA != null and secProA != ''">SEC_PRO_A = #{secProA},</if>
  242. <if test="norProA != null and norProA != ''">NOR_PRO_A = #{norProA},</if>
  243. <if test="isEmg != null and isEmg != ''">IS_EMG = #{isEmg},</if>
  244. </trim>
  245. <where>SWS_CD = #{swsCd}</where>
  246. </update>
  247. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.WrSwsB">
  248. update WR_SWS_B
  249. <trim prefix="set" suffixOverrides=",">
  250. <if test="lgtd != null and lgtd != ''">LGTD = #{lgtd},</if>
  251. <if test="lttd != null and lttd != ''">LTTD = #{lttd},</if>
  252. <if test="lgtdpc != null and lgtdpc != ''">LGTDPC = #{lgtdpc},</if>
  253. <if test="lttdpc != null and lttdpc != ''">LTTDPC = #{lttdpc},</if>
  254. <if test="swsCd != null and swsCd != ''">SWS_CD = #{swsCd},</if>
  255. <if test="swsNm != null and swsNm != ''">SWS_NM = #{swsNm},</if>
  256. <if test="swsTp != null and swsTp != ''">SWS_TP = #{swsTp},</if>
  257. <if test="watA != null and watA != ''">WAT_A = #{watA},</if>
  258. <if test="wqGoal != null and wqGoal != ''">WQ_GOAL = #{wqGoal},</if>
  259. <if test="consCond != null and consCond != ''">CONS_COND = #{consCond},</if>
  260. <if test="putProdTm != null and putProdTm != ''">PUT_PROD_TM = TO_DATE(#{putProdTm},'YYYY-MM-DD
  261. HH24:MI:SS'),
  262. </if>
  263. <if test="runCond != null and runCond != ''">RUN_COND = #{runCond},</if>
  264. <if test="wsCond != null and wsCond != ''">WS_COND = #{wsCond},</if>
  265. <if test="wsObj != null and wsObj != ''">WS_OBJ = #{wsObj},</if>
  266. <if test="dywsPp != null and dywsPp != ''">DYWS_PP = #{dywsPp},</if>
  267. <if test="dywsW != null and dywsW != ''">DYWS_W = #{dywsW},</if>
  268. <if test="ddwsW != null and ddwsW != ''">DDWS_W = #{ddwsW},</if>
  269. <if test="whsManCd != null and whsManCd != ''">WHS_MAN_CD = #{whsManCd},</if>
  270. <if test="whsApprCd != null and whsApprCd != ''">WHS_APPR_CD = #{whsApprCd},</if>
  271. <if test="emCd != null and emCd != ''">EM_CD = #{emCd},</if>
  272. <if test="ts != null and ts != ''">TS = TO_DATE(#{ts},'YYYY-MM-DD HH24:MI:SS'),</if>
  273. <if test="nt != null and nt != ''">NT = #{nt},</if>
  274. <if test="monG != null and monG != ''">MON_G = #{monG},</if>
  275. <if test="repPer != null and repPer != ''">REP_PER = #{repPer},</if>
  276. <if test="isuse != null and isuse != ''">ISUSE = #{isuse},</if>
  277. <if test="firProA != null and firProA != ''">FIR_PRO_A = #{firProA},</if>
  278. <if test="secProA != null and secProA != ''">SEC_PRO_A = #{secProA},</if>
  279. <if test="norProA != null and norProA != ''">NOR_PRO_A = #{norProA},</if>
  280. <if test="isEmg != null and isEmg != ''">IS_EMG = #{isEmg},</if>
  281. </trim>
  282. <include refid="page_where"/>
  283. </update>
  284. <!-- 其他自定义SQL -->
  285. <select id="getMaxCwsCode" resultType="string" parameterType="string">
  286. SELECT MAX(SWS_CD) FROM WR_SWS_B WHERE SWS_CD LIKE #{adCode}||'%'
  287. </select>
  288. </mapper>