AmsContractOtherPriceMapper.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  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="com.steerinfo.dil.mapper.AmsContractOtherPriceMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.AmsContractOtherPrice">
  5. <id column="PRICE_ID" jdbcType="DECIMAL" property="priceId" />
  6. <result column="PRICE_TYPE" jdbcType="VARCHAR" property="priceType" />
  7. <result column="PRICE_VALUE" jdbcType="DECIMAL" property="priceValue" />
  8. <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
  9. <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
  10. <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
  11. <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
  12. <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
  13. <result column="DELETED" jdbcType="DECIMAL" property="deleted" />
  14. </resultMap>
  15. <sql id="columns">
  16. PRICE_ID, PRICE_TYPE, PRICE_VALUE, INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME,
  17. UPDATE_TIME, INSERT_UPDATE_REMARK, DELETED
  18. </sql>
  19. <sql id="columns_alias">
  20. t.PRICE_ID, t.PRICE_TYPE, t.PRICE_VALUE, t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME,
  21. t.UPDATE_TIME, t.INSERT_UPDATE_REMARK, t.DELETED
  22. </sql>
  23. <sql id="select">
  24. SELECT <include refid="columns"/> FROM AMS_CONTRACT_OTHER_PRICE
  25. </sql>
  26. <sql id="select_alias">
  27. SELECT <include refid="columns_alias"/> FROM AMS_CONTRACT_OTHER_PRICE t
  28. </sql>
  29. <sql id="where">
  30. <where>
  31. <if test="priceId != null">
  32. and PRICE_ID = #{priceId}
  33. </if>
  34. <if test="priceType != null and priceType != ''">
  35. and PRICE_TYPE = #{priceType}
  36. </if>
  37. <if test="priceValue != null">
  38. and PRICE_VALUE = #{priceValue}
  39. </if>
  40. <if test="insertUsername != null and insertUsername != ''">
  41. and INSERT_USERNAME = #{insertUsername}
  42. </if>
  43. <if test="insertTime != null">
  44. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  45. </if>
  46. <if test="updateUsername != null and updateUsername != ''">
  47. and UPDATE_USERNAME = #{updateUsername}
  48. </if>
  49. <if test="updateTime != null">
  50. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  51. </if>
  52. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  53. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  54. </if>
  55. <if test="deleted != null">
  56. and DELETED = #{deleted}
  57. </if>
  58. </where>
  59. </sql>
  60. <sql id="whereLike">
  61. <where>
  62. <if test="priceId != null">
  63. and PRICE_ID = #{priceId}
  64. </if>
  65. <if test="priceType != null and priceType != ''">
  66. and PRICE_TYPE LIKE '%${priceType}%'
  67. </if>
  68. <if test="priceValue != null">
  69. and PRICE_VALUE = #{priceValue}
  70. </if>
  71. <if test="insertUsername != null and insertUsername != ''">
  72. and INSERT_USERNAME LIKE '%${insertUsername}%'
  73. </if>
  74. <if test="insertTime != null">
  75. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  76. </if>
  77. <if test="updateUsername != null and updateUsername != ''">
  78. and UPDATE_USERNAME LIKE '%${updateUsername}%'
  79. </if>
  80. <if test="updateTime != null">
  81. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  82. </if>
  83. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  84. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  85. </if>
  86. <if test="deleted != null">
  87. and DELETED = #{deleted}
  88. </if>
  89. </where>
  90. </sql>
  91. <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
  92. delete from AMS_CONTRACT_OTHER_PRICE
  93. where PRICE_ID = #{priceId,jdbcType=DECIMAL}
  94. </delete>
  95. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  96. delete from AMS_CONTRACT_OTHER_PRICE
  97. where 1!=1
  98. <if test="priceType != null and priceType != ''">
  99. or PRICE_TYPE = #{priceType}
  100. </if>
  101. <if test="priceValue != null">
  102. or PRICE_VALUE = #{priceValue}
  103. </if>
  104. <if test="insertUsername != null and insertUsername != ''">
  105. or INSERT_USERNAME = #{insertUsername}
  106. </if>
  107. <if test="insertTime != null">
  108. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  109. </if>
  110. <if test="updateUsername != null and updateUsername != ''">
  111. or UPDATE_USERNAME = #{updateUsername}
  112. </if>
  113. <if test="updateTime != null">
  114. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  115. </if>
  116. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  117. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  118. </if>
  119. <if test="deleted != null">
  120. or DELETED = #{deleted}
  121. </if>
  122. </delete>
  123. <insert id="insert" parameterType="com.steerinfo.dil.model.AmsContractOtherPrice">
  124. insert into AMS_CONTRACT_OTHER_PRICE (PRICE_ID, PRICE_TYPE, PRICE_VALUE,
  125. INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME,
  126. UPDATE_TIME, INSERT_UPDATE_REMARK, DELETED
  127. )
  128. values (#{priceId,jdbcType=DECIMAL}, #{priceType,jdbcType=VARCHAR}, #{priceValue,jdbcType=DECIMAL},
  129. #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR},
  130. #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR}, #{deleted,jdbcType=DECIMAL}
  131. )
  132. </insert>
  133. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.AmsContractOtherPrice">
  134. insert into AMS_CONTRACT_OTHER_PRICE
  135. <trim prefix="(" suffix=")" suffixOverrides=",">
  136. <if test="priceId != null">
  137. PRICE_ID,
  138. </if>
  139. <if test="priceType != null">
  140. PRICE_TYPE,
  141. </if>
  142. <if test="priceValue != null">
  143. PRICE_VALUE,
  144. </if>
  145. <if test="insertUsername != null">
  146. INSERT_USERNAME,
  147. </if>
  148. <if test="insertTime != null">
  149. INSERT_TIME,
  150. </if>
  151. <if test="updateUsername != null">
  152. UPDATE_USERNAME,
  153. </if>
  154. <if test="updateTime != null">
  155. UPDATE_TIME,
  156. </if>
  157. <if test="insertUpdateRemark != null">
  158. INSERT_UPDATE_REMARK,
  159. </if>
  160. <if test="deleted != null">
  161. DELETED,
  162. </if>
  163. </trim>
  164. <trim prefix="values (" suffix=")" suffixOverrides=",">
  165. <if test="priceId != null">
  166. #{priceId,jdbcType=DECIMAL},
  167. </if>
  168. <if test="priceType != null">
  169. #{priceType,jdbcType=VARCHAR},
  170. </if>
  171. <if test="priceValue != null">
  172. #{priceValue,jdbcType=DECIMAL},
  173. </if>
  174. <if test="insertUsername != null">
  175. #{insertUsername,jdbcType=VARCHAR},
  176. </if>
  177. <if test="insertTime != null">
  178. #{insertTime,jdbcType=TIMESTAMP},
  179. </if>
  180. <if test="updateUsername != null">
  181. #{updateUsername,jdbcType=VARCHAR},
  182. </if>
  183. <if test="updateTime != null">
  184. #{updateTime,jdbcType=TIMESTAMP},
  185. </if>
  186. <if test="insertUpdateRemark != null">
  187. #{insertUpdateRemark,jdbcType=VARCHAR},
  188. </if>
  189. <if test="deleted != null">
  190. #{deleted,jdbcType=DECIMAL},
  191. </if>
  192. </trim>
  193. </insert>
  194. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.AmsContractOtherPrice">
  195. update AMS_CONTRACT_OTHER_PRICE
  196. set PRICE_TYPE = #{priceType,jdbcType=VARCHAR},
  197. PRICE_VALUE = #{priceValue,jdbcType=DECIMAL},
  198. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  199. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  200. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  201. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  202. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  203. DELETED = #{deleted,jdbcType=DECIMAL}
  204. where PRICE_ID = #{priceId,jdbcType=DECIMAL}
  205. </update>
  206. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.AmsContractOtherPrice">
  207. update AMS_CONTRACT_OTHER_PRICE
  208. <set>
  209. <if test="priceType != null">
  210. PRICE_TYPE = #{priceType,jdbcType=VARCHAR},
  211. </if>
  212. <if test="priceValue != null">
  213. PRICE_VALUE = #{priceValue,jdbcType=DECIMAL},
  214. </if>
  215. <if test="insertUsername != null">
  216. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  217. </if>
  218. <if test="insertTime != null">
  219. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  220. </if>
  221. <if test="updateUsername != null">
  222. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  223. </if>
  224. <if test="updateTime != null">
  225. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  226. </if>
  227. <if test="insertUpdateRemark != null">
  228. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  229. </if>
  230. <if test="deleted != null">
  231. DELETED = #{deleted,jdbcType=DECIMAL},
  232. </if>
  233. </set>
  234. where PRICE_ID = #{priceId,jdbcType=DECIMAL}
  235. </update>
  236. <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
  237. <include refid="select"/>
  238. where PRICE_ID = #{priceId,jdbcType=DECIMAL}
  239. </select>
  240. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  241. <include refid="select"/>
  242. <include refid="where"/>
  243. </select>
  244. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  245. <include refid="select"/>
  246. <include refid="whereLike"/>
  247. </select>
  248. <insert id="batchInsert" parameterType="java.util.List">
  249. insert into AMS_CONTRACT_OTHER_PRICE
  250. (PRICE_ID,
  251. PRICE_TYPE, PRICE_VALUE, INSERT_USERNAME,
  252. INSERT_TIME, UPDATE_USERNAME,
  253. UPDATE_TIME, INSERT_UPDATE_REMARK,
  254. DELETED)
  255. ( <foreach collection="list" item="item" separator="union all">
  256. select
  257. #{item.priceId,jdbcType=DECIMAL},
  258. #{item.priceType,jdbcType=VARCHAR}, #{item.priceValue,jdbcType=DECIMAL}, #{item.insertUsername,jdbcType=VARCHAR},
  259. #{item.insertTime,jdbcType=TIMESTAMP}, #{item.updateUsername,jdbcType=VARCHAR},
  260. #{item.updateTime,jdbcType=TIMESTAMP}, #{item.insertUpdateRemark,jdbcType=VARCHAR},
  261. #{item.deleted,jdbcType=DECIMAL} from dual
  262. </foreach> )
  263. </insert>
  264. <update id="batchUpdate" parameterType="java.util.List">
  265. update AMS_CONTRACT_OTHER_PRICE
  266. set
  267. PRICE_ID=
  268. <foreach collection="list" item="item" index="index" separator=" " open="case PRICE_ID" close="end">
  269. when #{item.priceId,jdbcType=DECIMAL} then #{item.priceId,jdbcType=DECIMAL}
  270. </foreach>
  271. ,PRICE_TYPE=
  272. <foreach collection="list" item="item" index="index" separator=" " open="case PRICE_ID" close="end">
  273. when #{item.priceId,jdbcType=DECIMAL} then #{item.priceType,jdbcType=VARCHAR}
  274. </foreach>
  275. ,PRICE_VALUE=
  276. <foreach collection="list" item="item" index="index" separator=" " open="case PRICE_ID" close="end">
  277. when #{item.priceId,jdbcType=DECIMAL} then #{item.priceValue,jdbcType=DECIMAL}
  278. </foreach>
  279. ,INSERT_USERNAME=
  280. <foreach collection="list" item="item" index="index" separator=" " open="case PRICE_ID" close="end">
  281. when #{item.priceId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  282. </foreach>
  283. ,INSERT_TIME=
  284. <foreach collection="list" item="item" index="index" separator=" " open="case PRICE_ID" close="end">
  285. when #{item.priceId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  286. </foreach>
  287. ,UPDATE_USERNAME=
  288. <foreach collection="list" item="item" index="index" separator=" " open="case PRICE_ID" close="end">
  289. when #{item.priceId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  290. </foreach>
  291. ,UPDATE_TIME=
  292. <foreach collection="list" item="item" index="index" separator=" " open="case PRICE_ID" close="end">
  293. when #{item.priceId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  294. </foreach>
  295. ,INSERT_UPDATE_REMARK=
  296. <foreach collection="list" item="item" index="index" separator=" " open="case PRICE_ID" close="end">
  297. when #{item.priceId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  298. </foreach>
  299. ,DELETED=
  300. <foreach collection="list" item="item" index="index" separator=" " open="case PRICE_ID" close="end">
  301. when #{item.priceId,jdbcType=DECIMAL} then #{item.deleted,jdbcType=DECIMAL}
  302. </foreach>
  303. where PRICE_ID in
  304. <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
  305. #{item.priceId,jdbcType=DECIMAL}
  306. </foreach>
  307. </update>
  308. <delete id="batchDelete" parameterType="java.util.List">
  309. delete from AMS_CONTRACT_OTHER_PRICE
  310. where PRICE_ID in
  311. <foreach collection="list" item="id" open="(" close=")" separator=",">
  312. #{id}
  313. </foreach>
  314. </delete>
  315. <!-- 友情提示!!!-->
  316. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  317. <!-- 得到最大id -->
  318. <select id="selectMaxId" resultType="DECIMAL">
  319. SELECT MAX(PRICE_ID)
  320. FROM AMS_CONTRACT_OTHER_PRICE
  321. </select>
  322. <sql id="orderByInsertTime">
  323. <if test="orderField != null and orderField != ''">
  324. order by "${orderField}"
  325. <if test="orderType != null and orderType != ''">
  326. ${orderType}
  327. </if>
  328. </if>
  329. <if test="orderField == null ">
  330. order by "insertTime" desc
  331. </if>
  332. </sql>
  333. <!-- 展示港口装卸费列表 -->
  334. <select id="getLoadUnloadPriceList" parameterType="java.util.Map" resultType="java.util.Map">
  335. SELECT *
  336. FROM (
  337. SELECT acop.INSERT_TIME as "insertTime",
  338. acop.PRICE_ID as "priceId",
  339. acop.PRICE_TYPE as "priceType",
  340. acop.PRICE_VALUE as "priceValue",
  341. acop.UPDATE_TIME as "updateTime"
  342. FROM AMS_CONTRACT_OTHER_PRICE acop
  343. WHERE DELETED = 0
  344. )
  345. <where>
  346. <if test="priceType!= null">
  347. and
  348. <foreach collection="priceType" item="item" open="(" separator="," close=")">
  349. "priceType" in #{item}
  350. </foreach>
  351. </if>
  352. <if test="priceValue!= null">
  353. and
  354. <foreach collection="priceValue" item="item" open="(" separator="," close=")">
  355. "priceValue" in #{item}
  356. </foreach>
  357. </if>
  358. <if test="updateTime!= null">
  359. and
  360. <foreach collection="updateTime" item="item" open="(" separator="," close=")">
  361. "updateTime" in to_date('${item}','yyyy-mm-dd hh24:mi:ss')
  362. </foreach>
  363. </if>
  364. </where>
  365. <include refid="orderByInsertTime"></include>
  366. </select>
  367. <!-- 得到修改渲染 -->
  368. <select id="selectLoadUnloadPriceToUpdate" parameterType="DECIMAL" resultType="java.util.Map">
  369. SELECT PRICE_TYPE as "priceType",
  370. PRICE_VALUE as "priceValue"
  371. FROM AMS_CONTRACT_OTHER_PRICE
  372. WHERE PRICE_ID = #{priceId}
  373. </select>
  374. </mapper>