BisInspRsvrPblmMendDao.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  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.BisInspRsvrPblmMendDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspRsvrPblmMend" id="bisInspRsvrPblmMendResultMap">
  5. <result property="id" column="ID" />
  6. <result property="year" column="YEAR" />
  7. <result property="mnth" column="MNTH" />
  8. <result property="rgstrId" column="RGSTR_ID" />
  9. <result property="rsCode" column="RS_CODE" />
  10. <result property="rsName" column="RS_NAME" />
  11. <result property="adCode" column="AD_CODE" />
  12. <result property="proName" column="PRO_NAME" />
  13. <result property="cityName" column="CITY_NAME" />
  14. <result property="countyName" column="COUNTY_NAME" />
  15. <result property="damRegCode" column="DAM_REG_CODE" />
  16. <result property="engScal" column="ENG_SCAL" />
  17. <result property="safeComment" column="SAFE_COMMENT" />
  18. <result property="unit" column="UNIT" />
  19. <result property="pblmType" column="PBLM_TYPE" />
  20. <result property="pblmOption" column="PBLM_OPTION" />
  21. <result property="pblmDesc" column="PBLM_DESC" />
  22. <result property="pblmLevl" column="PBLM_LEVL" />
  23. <result property="attach" column="ATTACH" />
  24. <result property="pblmSn" column="PBLM_SN" />
  25. <result property="rectConc" column="RECT_CONC" />
  26. <result property="rectMsrs" column="RECT_MSRS" />
  27. <result property="revwInfo" column="REVW_INFO" />
  28. <result property="intm" column="INTM" />
  29. <result property="uptm" column="UPTM" />
  30. <result property="revwRectConc" column="REVW_RECT_CONC"/>
  31. <result property="realPlanDt" column="REAL_PLAN_DT"/>
  32. <result property="revwRectPblm" column="REVW_RECT_PBLM"/>
  33. <result property="revwState" column="REVW_STATE"/>
  34. <result property="auditConc" column="AUDIT_CONC"/>
  35. <result property="auditNote" column="AUDIT_NOTE"/>
  36. <result property="column1" column="COLUMN1"/>
  37. <result property="column2" column="COLUMN2"/>
  38. </resultMap>
  39. <sql id="table_columns">
  40. ID,
  41. YEAR,
  42. MNTH,
  43. RGSTR_ID,
  44. RS_CODE,
  45. RS_NAME,
  46. AD_CODE,
  47. PRO_NAME,
  48. CITY_NAME,
  49. COUNTY_NAME,
  50. DAM_REG_CODE,
  51. ENG_SCAL,
  52. SAFE_COMMENT,
  53. UNIT,
  54. PBLM_TYPE,
  55. PBLM_OPTION,
  56. PBLM_DESC,
  57. PBLM_LEVL,
  58. ATTACH,
  59. PBLM_SN,
  60. RECT_CONC,
  61. RECT_MSRS,
  62. REVW_INFO,
  63. INTM,
  64. UPTM,
  65. REVW_RECT_CONC,
  66. REAL_PLAN_DT,
  67. REVW_RECT_PBLM,
  68. REVW_STATE,
  69. AUDIT_CONC,
  70. AUDIT_NOTE,
  71. COLUMN1,
  72. COLUMN2
  73. </sql>
  74. <sql id="entity_properties">
  75. #{id},
  76. #{year},
  77. #{mnth},
  78. #{rgstrId},
  79. #{rsCode},
  80. #{rsName},
  81. #{adCode},
  82. #{proName},
  83. #{cityName},
  84. #{countyName},
  85. #{damRegCode},
  86. #{engScal},
  87. #{safeComment},
  88. #{unit},
  89. #{pblmType},
  90. #{pblmOption},
  91. #{pblmDesc},
  92. #{pblmLevl},
  93. #{attach},
  94. #{pblmSn},
  95. #{rectConc},
  96. #{rectMsrs},
  97. #{revwInfo},
  98. #{intm},
  99. #{uptm},
  100. #{revwRectConc},
  101. #{realPlanDt},
  102. #{revwRectPblm},
  103. #{revwState},
  104. #{auditConc},
  105. #{auditNote},
  106. #{column1},
  107. #{column2}
  108. </sql>
  109. <sql id="table_columns_batch">
  110. ID,
  111. YEAR,
  112. MNTH,
  113. RGSTR_ID,
  114. RS_CODE,
  115. RS_NAME,
  116. AD_CODE,
  117. PRO_NAME,
  118. CITY_NAME,
  119. COUNTY_NAME,
  120. DAM_REG_CODE,
  121. ENG_SCAL,
  122. SAFE_COMMENT,
  123. UNIT,
  124. PBLM_TYPE,
  125. PBLM_OPTION,
  126. PBLM_DESC,
  127. PBLM_LEVL,
  128. ATTACH,
  129. PBLM_SN,
  130. RECT_CONC,
  131. RECT_MSRS,
  132. REVW_INFO,
  133. AUDIT_CONC,
  134. AUDIT_NOTE
  135. </sql>
  136. <sql id="entity_properties_batch">
  137. #{item.id},
  138. #{item.year},
  139. #{item.mnth},
  140. #{item.rgstrId},
  141. #{item.rsCode},
  142. #{item.rsName},
  143. #{item.adCode},
  144. #{item.proName},
  145. #{item.cityName},
  146. #{item.countyName},
  147. #{item.damRegCode},
  148. #{item.engScal},
  149. #{item.safeComment},
  150. #{item.unit},
  151. #{item.pblmType},
  152. #{item.pblmOption},
  153. #{item.pblmDesc},
  154. #{item.pblmLevl},
  155. #{item.attach},
  156. #{item.pblmSn},
  157. #{item.rectConc},
  158. #{item.rectMsrs},
  159. #{item.revwInfo},
  160. #{item.auditConc},
  161. #{item.auditNote}
  162. </sql>
  163. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  164. <sql id="page_where">
  165. <trim prefix="where" prefixOverrides="and | or ">
  166. <if test="year != null and year != ''">and YEAR = #{year}</if>
  167. <if test="mnth != null and mnth != ''">and MNTH = #{mnth}</if>
  168. <if test="rgstrId != null and rgstrId != ''">and RGSTR_ID = #{rgstrId}</if>
  169. <if test="rsCode != null and rsCode != ''">and RS_CODE = #{rsCode}</if>
  170. <if test="rsName != null and rsName != ''">and RS_NAME = #{rsName}</if>
  171. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  172. <if test="proName != null and proName != ''">and PRO_NAME = #{proName}</if>
  173. <if test="cityName != null and cityName != ''">and CITY_NAME = #{cityName}</if>
  174. <if test="countyName != null and countyName != ''">and COUNTY_NAME = #{countyName}</if>
  175. <if test="damRegCode != null and damRegCode != ''">and DAM_REG_CODE = #{damRegCode}</if>
  176. <if test="engScal != null and engScal != ''">and ENG_SCAL = #{engScal}</if>
  177. <if test="safeComment != null and safeComment != ''">and SAFE_COMMENT = #{safeComment}</if>
  178. <if test="unit != null and unit != ''">and UNIT = #{unit}</if>
  179. <if test="pblmType != null and pblmType != ''">and PBLM_TYPE = #{pblmType}</if>
  180. <if test="pblmOption != null and pblmOption != ''">and PBLM_OPTION = #{pblmOption}</if>
  181. <if test="pblmDesc != null and pblmDesc != ''">and PBLM_DESC = #{pblmDesc}</if>
  182. <if test="pblmLevl != null and pblmLevl != ''">and PBLM_LEVL = #{pblmLevl}</if>
  183. <if test="attach != null and attach != ''">and ATTACH = #{attach}</if>
  184. <if test="pblmSn != null and pblmSn != ''">and PBLM_SN = #{pblmSn}</if>
  185. <if test="rectConc != null and rectConc != ''">and RECT_CONC = #{rectConc}</if>
  186. <if test="rectMsrs != null and rectMsrs != ''">and RECT_MSRS = #{rectMsrs}</if>
  187. <if test="revwInfo != null and revwInfo != ''">and REVW_INFO = #{revwInfo}</if>
  188. <if test="intm != null">and INTM = #{intm}</if>
  189. <if test="uptm != null">and UPTM = #{uptm}</if>
  190. <if test="revwRectConc != null">and REVW_RECT_CONC = #{revwRectConc}</if>
  191. <if test="realPlanDt != null">and REAL_PLAN_DT = #{realPlanDt}</if>
  192. <if test="revwRectPblm != null and revwRectPblm != ''">and REVW_RECT_PBLM = #{revwRectPblm}</if>
  193. <if test="revwState != null and revwState != ''">and REVW_STATE = #{revwState}</if>
  194. <if test="auditConc != null and auditConc != ''">and AUDIT_CONC = #{auditConc}</if>
  195. <if test="auditNote != null and auditNote != ''">and AUDIT_NOTE = #{auditNote}</if>
  196. <if test="column1 != null and column1 != ''">and COLUMN1 = #{column1}</if>
  197. <if test="column2 != null and column2 != ''">and COLUMN2 = #{column2}</if>
  198. and to_char(intm,'yyyy')=to_char(sysdate,'yyyy')
  199. </trim>
  200. </sql>
  201. <select id="get" resultMap="bisInspRsvrPblmMendResultMap" parameterType="String" >
  202. select <include refid="table_columns" /> from BIS_INSP_RSVR_PBLM_MEND where ID = #{id}
  203. </select>
  204. <select id="getBy" resultMap="bisInspRsvrPblmMendResultMap">
  205. select <include refid="table_columns" /> from BIS_INSP_RSVR_PBLM_MEND <include refid="page_where" />
  206. </select>
  207. <select id="findAll" resultMap="bisInspRsvrPblmMendResultMap">
  208. select <include refid="table_columns" /> from BIS_INSP_RSVR_PBLM_MEND
  209. </select>
  210. <select id="findList" resultMap="bisInspRsvrPblmMendResultMap">
  211. select <include refid="table_columns" /> from BIS_INSP_RSVR_PBLM_MEND <include refid="page_where" />
  212. </select>
  213. <select id="selectCount" resultType="int" >
  214. select count(ID) from BIS_INSP_RSVR_PBLM_MEND <include refid="page_where" />
  215. </select>
  216. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspRsvrPblmMend">
  217. insert into BIS_INSP_RSVR_PBLM_MEND( <include refid="table_columns" /> )
  218. values ( <include refid="entity_properties" /> )
  219. </insert>
  220. <delete id="delete" parameterType="java.lang.String">
  221. delete from BIS_INSP_RSVR_PBLM_MEND where ID = #{id}
  222. </delete>
  223. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspRsvrPblmMend">
  224. delete from BIS_INSP_RSVR_PBLM_MEND <include refid="page_where" />
  225. </delete>
  226. <update id="deleteInFlag" parameterType="java.lang.String">
  227. update BIS_INSP_RSVR_PBLM_MEND set flag_valid = 0 where>ID = #{id}
  228. </update>
  229. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspRsvrPblmMend">
  230. update BIS_INSP_RSVR_PBLM_MEND
  231. <trim prefix="set" suffixOverrides=",">
  232. <if test="year != null and year != ''">YEAR = #{year},</if>
  233. <if test="mnth != null and mnth != ''">MNTH = #{mnth},</if>
  234. <if test="rgstrId != null and rgstrId != ''">RGSTR_ID = #{rgstrId},</if>
  235. <if test="rsCode != null and rsCode != ''">RS_CODE = #{rsCode},</if>
  236. <if test="rsName != null and rsName != ''">RS_NAME = #{rsName},</if>
  237. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  238. <if test="proName != null and proName != ''">PRO_NAME = #{proName},</if>
  239. <if test="cityName != null and cityName != ''">CITY_NAME = #{cityName},</if>
  240. <if test="countyName != null and countyName != ''">COUNTY_NAME = #{countyName},</if>
  241. <if test="damRegCode != null and damRegCode != ''">DAM_REG_CODE = #{damRegCode},</if>
  242. <if test="engScal != null and engScal != ''">ENG_SCAL = #{engScal},</if>
  243. <if test="safeComment != null and safeComment != ''">SAFE_COMMENT = #{safeComment},</if>
  244. <if test="unit != null and unit != ''">UNIT = #{unit},</if>
  245. <if test="pblmType != null and pblmType != ''">PBLM_TYPE = #{pblmType},</if>
  246. <if test="pblmOption != null and pblmOption != ''">PBLM_OPTION = #{pblmOption},</if>
  247. <if test="pblmDesc != null and pblmDesc != ''">PBLM_DESC = #{pblmDesc},</if>
  248. <if test="pblmLevl != null and pblmLevl != ''">PBLM_LEVL = #{pblmLevl},</if>
  249. <if test="attach != null and attach != ''">ATTACH = #{attach},</if>
  250. <if test="pblmSn != null and pblmSn != ''">PBLM_SN = #{pblmSn},</if>
  251. <if test="rectConc != null and rectConc != ''">RECT_CONC = #{rectConc},</if>
  252. <if test="rectMsrs != null and rectMsrs != ''">RECT_MSRS = #{rectMsrs},</if>
  253. <if test="revwInfo != null and revwInfo != ''">REVW_INFO = #{revwInfo},</if>
  254. <if test="intm != null">INTM = #{intm},</if>
  255. <if test="uptm != null">UPTM = #{uptm},</if>
  256. <if test="revwRectConc != null">REVW_RECT_CONC = #{revwRectConc},</if>
  257. <if test="realPlanDt != null">REAL_PLAN_DT = #{realPlanDt},</if>
  258. <if test="revwRectPblm != null and revwRectPblm != ''">REVW_RECT_PBLM = #{revwRectPblm},</if>
  259. <if test="revwState != null and revwState != ''">REVW_STATE = #{revwState},</if>
  260. <if test="auditConc != null and auditConc != ''">AUDIT_CONC = #{auditConc},</if>
  261. <if test="auditNote != null and auditNote != ''">AUDIT_NOTE = #{auditNote},</if>
  262. <if test="column1 != null and column1 != ''">COLUMN1 = #{column1},</if>
  263. <if test="column2 != null and column2 != ''">COLUMN2 = #{column2},</if>
  264. </trim>
  265. <include refid="page_where" />
  266. </update>
  267. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspRsvrPblmMend">
  268. update BIS_INSP_RSVR_PBLM_MEND
  269. <include refid="updateParam"/>
  270. <where>ID = #{id}</where>
  271. </update>
  272. <sql id="updateParamMwrBatch">
  273. <trim prefix="set" suffixOverrides=",">
  274. <if test="item.rectConc != null and item.rectConc != ''">RECT_CONC = #{item.rectConc},</if>
  275. <if test="item.rectMsrs != null and item.rectMsrs != ''">RECT_MSRS = #{item.rectMsrs},</if>
  276. <if test="item.revwInfo != null and item.revwInfo != ''">REVW_INFO = #{item.revwInfo},</if>
  277. <if test="item.auditConc != null and item.auditConc != ''">AUDIT_CONC = #{item.auditConc},</if>
  278. <if test="item.auditNote != null and item.auditNote != ''">AUDIT_NOTE = #{item.auditNote},</if>
  279. </trim>
  280. </sql>
  281. <sql id="updateParamMwr">
  282. <trim prefix="set" suffixOverrides=",">
  283. <if test="rectConc != null and rectConc != ''">RECT_CONC = #{rectConc},</if>
  284. <if test="rectMsrs != null and rectMsrs != ''">RECT_MSRS = #{rectMsrs},</if>
  285. <if test="revwInfo != null and revwInfo != ''">REVW_INFO = #{revwInfo},</if>
  286. <if test="auditConc != null and auditConc != ''">AUDIT_CONC = #{auditConc},</if>
  287. <if test="auditNote != null and auditNote != ''">AUDIT_NOTE = #{auditNote},</if>
  288. </trim>
  289. </sql>
  290. <sql id="updateParam">
  291. <trim prefix="set" suffixOverrides=",">
  292. <if test="year != null and year != ''">YEAR = #{year},</if>
  293. <if test="mnth != null and mnth != ''">MNTH = #{mnth},</if>
  294. <if test="rgstrId != null and rgstrId != ''">RGSTR_ID = #{rgstrId},</if>
  295. <if test="rsCode != null and rsCode != ''">RS_CODE = #{rsCode},</if>
  296. <if test="rsName != null and rsName != ''">RS_NAME = #{rsName},</if>
  297. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  298. <if test="proName != null and proName != ''">PRO_NAME = #{proName},</if>
  299. <if test="cityName != null and cityName != ''">CITY_NAME = #{cityName},</if>
  300. <if test="countyName != null and countyName != ''">COUNTY_NAME = #{countyName},</if>
  301. <if test="damRegCode != null and damRegCode != ''">DAM_REG_CODE = #{damRegCode},</if>
  302. <if test="engScal != null and engScal != ''">ENG_SCAL = #{engScal},</if>
  303. <if test="safeComment != null and safeComment != ''">SAFE_COMMENT = #{safeComment},</if>
  304. <if test="unit != null and unit != ''">UNIT = #{unit},</if>
  305. <if test="pblmType != null and pblmType != ''">PBLM_TYPE = #{pblmType},</if>
  306. <if test="pblmOption != null and pblmOption != ''">PBLM_OPTION = #{pblmOption},</if>
  307. <if test="pblmDesc != null and pblmDesc != ''">PBLM_DESC = #{pblmDesc},</if>
  308. <if test="pblmLevl != null and pblmLevl != ''">PBLM_LEVL = #{pblmLevl},</if>
  309. <if test="attach != null and attach != ''">ATTACH = #{attach},</if>
  310. <if test="pblmSn != null and pblmSn != ''">PBLM_SN = #{pblmSn},</if>
  311. <if test="rectConc != null and rectConc != ''">RECT_CONC = #{rectConc},</if>
  312. <if test="rectMsrs != null and rectMsrs != ''">RECT_MSRS = #{rectMsrs},</if>
  313. <if test="revwInfo != null and revwInfo != ''">REVW_INFO = #{revwInfo},</if>
  314. <if test="isRect != null and isRect != ''">IS_RECT = #{isRect},</if>
  315. <if test="intm != null">INTM = #{intm},</if>
  316. <if test="uptm != null">UPTM = #{uptm},</if>
  317. <if test="revwRectConc != null">REVW_RECT_CONC = #{revwRectConc},</if>
  318. <if test="realPlanDt != null">REAL_PLAN_DT = #{realPlanDt},</if>
  319. <if test="revwRectPblm != null and revwRectPblm != ''">REVW_RECT_PBLM = #{revwRectPblm},</if>
  320. <if test="revwState != null and revwState != ''">REVW_STATE = #{revwState},</if>
  321. <if test="auditConc != null and auditConc != ''">AUDIT_CONC = #{auditConc},</if>
  322. <if test="auditNote != null and auditNote != ''">AUDIT_NOTE = #{auditNote},</if>
  323. <if test="column1 != null and column1 != ''">COLUMN1 = #{column1},</if>
  324. <if test="column2 != null and column2 != ''">COLUMN2 = #{column2},</if>
  325. </trim>
  326. </sql>
  327. <!-- 其他自定义SQL -->
  328. <insert id="insertRsvrBatch" parameterType="java.util.Map">
  329. <foreach collection="bisInspRsvrPblmMends" separator=";" item="item">
  330. merge into BIS_INSP_RSVR_PBLM_MEND a
  331. using ( select #{item.id} as id from dual) b
  332. on (a.id=b.id)
  333. when matched then
  334. update
  335. <include refid="updateParamMwrBatch"/>
  336. when not matched then
  337. insert (<include refid="table_columns_batch" />)
  338. VALUES (<include refid="entity_properties_batch" />)
  339. </foreach>
  340. </insert>
  341. <insert id="insertRsvr" parameterType="java.util.Map">
  342. merge into BIS_INSP_RSVR_PBLM_MEND a
  343. using ( select #{id} as id from dual) b
  344. on (a.id=b.id)
  345. when matched then
  346. update
  347. <include refid="updateParamMwr"/>
  348. when not matched then
  349. insert (<include refid="table_columns" />)
  350. VALUES (<include refid="entity_properties" />)
  351. </insert>
  352. <select id="findRsvrPblmList" resultMap="bisInspRsvrPblmMendResultMap" parameterType="cn.com.goldenwater.dcproj.param.BisInspRsvrPblmMendParam">
  353. SELECT t.* FROM BIS_INSP_RSVR_PBLM_MEND t LEFT JOIN ATT_AD_X_BASE b ON t.ad_code = b.AD_CODE
  354. WHERE 1=1 and to_char(t.intm,'yyyy')=to_char(sysdate,'yyyy')
  355. <if test="year != null and year != ''">
  356. AND t.YEAR = #{year}
  357. </if>
  358. <if test="mnth != null and mnth != ''">
  359. AND t.MNTH = #{mnth}
  360. </if>
  361. <if test="adCode != null and adCode != ''">
  362. AND t.AD_CODE like CONCAT(#{adCode},'%')
  363. </if>
  364. <if test="relCode != null and relCode != ''">
  365. AND t.AD_CODE like CONCAT(#{relCode},'%')
  366. </if>
  367. <if test="rsName != null and rsName != ''">
  368. AND t.RS_NAME like CONCAT('%',CONCAT(#{rsName},'%'))
  369. </if>
  370. <if test="pblmType != null and pblmType != ''">
  371. AND t.PBLM_TYPE like CONCAT('%',CONCAT(#{pblmType},'%'))
  372. </if>
  373. <if test="pblmOption != null and pblmOption != ''">
  374. AND t.PBLM_OPTION like CONCAT('%',CONCAT(#{pblmOption},'%'))
  375. </if>
  376. <if test="pblmLevl != null and pblmLevl != ''">
  377. AND t.PBLM_LEVL = #{pblmLevl}
  378. </if>
  379. <if test="rectConc != null and rectConc != ''">
  380. AND t.RECT_CONC = #{rectConc}
  381. </if>
  382. <if test="adName != null and adName != ''">
  383. AND b.AD_FULL_NAME like concat('%',concat(#{adName},'%'))
  384. </if>
  385. <if test="startTime !=null and startTime !=''">
  386. AND t.intm &gt;= TO_DATE(#{startTime},'YYYY-MM-DD HH24:mi:ss')
  387. </if>
  388. <if test="endTime !=null and endTime !=''">
  389. AND t.intm &lt;= TO_DATE(#{endTime},'YYYY-MM-DD HH24:mi:ss')
  390. </if>
  391. </select>
  392. <update id="updateRevwInfo">
  393. update BIS_INSP_RSVR_PBLM_MEND set REVW_INFO = #{revwInfo} where ID = #{id}
  394. </update>
  395. </mapper>