AmsContaactPriceMaterialMapper.xml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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.AmsContaactPriceMaterialMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.AmsContaactPriceMaterial">
  5. <id column="PRICE_MATERIAL_ID" jdbcType="DECIMAL" property="priceMaterialId" />
  6. <result column="PRICE_ID" jdbcType="DECIMAL" property="priceId" />
  7. <result column="MATERIAL_ID" jdbcType="DECIMAL" property="materialId" />
  8. </resultMap>
  9. <sql id="columns">
  10. PRICE_MATERIAL_ID, PRICE_ID, MATERIAL_ID
  11. </sql>
  12. <sql id="columns_alias">
  13. t.PRICE_MATERIAL_ID, t.PRICE_ID, t.MATERIAL_ID
  14. </sql>
  15. <sql id="select">
  16. SELECT <include refid="columns" /> FROM AMS_CONTAACT_PRICE_MATERIAL
  17. </sql>
  18. <sql id="select_alias">
  19. SELECT <include refid="columns_alias" /> FROM AMS_CONTAACT_PRICE_MATERIAL t
  20. </sql>
  21. <sql id="where">
  22. <where>
  23. <if test="priceMaterialId != null">
  24. and PRICE_MATERIAL_ID = #{priceMaterialId}
  25. </if>
  26. <if test="priceId != null">
  27. and PRICE_ID = #{priceId}
  28. </if>
  29. <if test="materialId != null">
  30. and MATERIAL_ID = #{materialId}
  31. </if>
  32. </where>
  33. </sql>
  34. <sql id="whereLike">
  35. <where>
  36. <if test="priceMaterialId != null">
  37. and PRICE_MATERIAL_ID = #{priceMaterialId}
  38. </if>
  39. <if test="priceId != null">
  40. and PRICE_ID = #{priceId}
  41. </if>
  42. <if test="materialId != null">
  43. and MATERIAL_ID = #{materialId}
  44. </if>
  45. </where>
  46. </sql>
  47. <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
  48. delete from AMS_CONTAACT_PRICE_MATERIAL
  49. where PRICE_MATERIAL_ID = #{priceMaterialId,jdbcType=DECIMAL}
  50. </delete>
  51. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  52. delete from AMS_CONTAACT_PRICE_MATERIAL
  53. where 1!=1
  54. <if test="priceId != null">
  55. or PRICE_ID = #{priceId}
  56. </if>
  57. <if test="materialId != null">
  58. or MATERIAL_ID = #{materialId}
  59. </if>
  60. </delete>
  61. <insert id="insert" parameterType="com.steerinfo.dil.model.AmsContaactPriceMaterial">
  62. insert into AMS_CONTAACT_PRICE_MATERIAL (PRICE_MATERIAL_ID, PRICE_ID, MATERIAL_ID
  63. )
  64. values (#{priceMaterialId,jdbcType=DECIMAL}, #{priceId,jdbcType=DECIMAL}, #{materialId,jdbcType=DECIMAL}
  65. )
  66. </insert>
  67. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.AmsContaactPriceMaterial">
  68. insert into AMS_CONTAACT_PRICE_MATERIAL
  69. <trim prefix="(" suffix=")" suffixOverrides=",">
  70. <if test="priceMaterialId != null">
  71. PRICE_MATERIAL_ID,
  72. </if>
  73. <if test="priceId != null">
  74. PRICE_ID,
  75. </if>
  76. <if test="materialId != null">
  77. MATERIAL_ID,
  78. </if>
  79. </trim>
  80. <trim prefix="values (" suffix=")" suffixOverrides=",">
  81. <if test="priceMaterialId != null">
  82. #{priceMaterialId,jdbcType=DECIMAL},
  83. </if>
  84. <if test="priceId != null">
  85. #{priceId,jdbcType=DECIMAL},
  86. </if>
  87. <if test="materialId != null">
  88. #{materialId,jdbcType=DECIMAL},
  89. </if>
  90. </trim>
  91. </insert>
  92. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.AmsContaactPriceMaterial">
  93. update AMS_CONTAACT_PRICE_MATERIAL
  94. set PRICE_ID = #{priceId,jdbcType=DECIMAL},
  95. MATERIAL_ID = #{materialId,jdbcType=DECIMAL}
  96. where PRICE_MATERIAL_ID = #{priceMaterialId,jdbcType=DECIMAL}
  97. </update>
  98. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.AmsContaactPriceMaterial">
  99. update AMS_CONTAACT_PRICE_MATERIAL
  100. <set>
  101. <if test="priceId != null">
  102. PRICE_ID = #{priceId,jdbcType=DECIMAL},
  103. </if>
  104. <if test="materialId != null">
  105. MATERIAL_ID = #{materialId,jdbcType=DECIMAL},
  106. </if>
  107. </set>
  108. where PRICE_MATERIAL_ID = #{priceMaterialId,jdbcType=DECIMAL}
  109. </update>
  110. <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
  111. <include refid="select" />
  112. where PRICE_MATERIAL_ID = #{priceMaterialId,jdbcType=DECIMAL}
  113. </select>
  114. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  115. <include refid="select" />
  116. <include refid="where" />
  117. </select>
  118. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  119. <include refid="select" />
  120. <include refid="whereLike" />
  121. </select>
  122. <insert id="batchInsert" parameterType="java.util.List">
  123. insert into AMS_CONTAACT_PRICE_MATERIAL
  124. (PRICE_MATERIAL_ID,
  125. PRICE_ID, MATERIAL_ID)
  126. ( <foreach collection="list" item="item" separator="union all">
  127. select
  128. #{item.priceMaterialId,jdbcType=DECIMAL},
  129. #{item.priceId,jdbcType=DECIMAL}, #{item.materialId,jdbcType=DECIMAL} from dual
  130. </foreach> )
  131. </insert>
  132. <update id="batchUpdate" parameterType="java.util.List">
  133. update AMS_CONTAACT_PRICE_MATERIAL
  134. set
  135. PRICE_MATERIAL_ID=
  136. <foreach close="end" collection="list" index="index" item="item" open="case PRICE_MATERIAL_ID" separator=" ">
  137. when #{item.priceMaterialId,jdbcType=DECIMAL} then #{item.priceMaterialId,jdbcType=DECIMAL}
  138. </foreach>
  139. ,PRICE_ID=
  140. <foreach close="end" collection="list" index="index" item="item" open="case PRICE_MATERIAL_ID" separator=" ">
  141. when #{item.priceMaterialId,jdbcType=DECIMAL} then #{item.priceId,jdbcType=DECIMAL}
  142. </foreach>
  143. ,MATERIAL_ID=
  144. <foreach close="end" collection="list" index="index" item="item" open="case PRICE_MATERIAL_ID" separator=" ">
  145. when #{item.priceMaterialId,jdbcType=DECIMAL} then #{item.materialId,jdbcType=DECIMAL}
  146. </foreach>
  147. where PRICE_MATERIAL_ID in
  148. <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
  149. #{item.priceMaterialId,jdbcType=DECIMAL}
  150. </foreach>
  151. </update>
  152. <delete id="batchDelete" parameterType="java.util.List">
  153. delete from AMS_CONTAACT_PRICE_MATERIAL
  154. where PRICE_MATERIAL_ID in
  155. <foreach close=")" collection="list" item="id" open="(" separator=",">
  156. #{id}
  157. </foreach>
  158. </delete>
  159. <!-- 友情提示!!!-->
  160. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  161. <!-- 友情提示!!!-->
  162. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  163. <select id="getMaterialName" resultType="java.util.Map" parameterType="decimal">
  164. select
  165. rm.MATERIAL_NAME "materialName",
  166. rm.MATERIAL_ID "materialId"
  167. from AMS_CONTAACT_PRICE_MATERIAL acpr
  168. left join RMS_MATERIAL RM
  169. on rm.MATERIAL_ID = acpr.MATERIAL_ID
  170. where PRICE_ID = #{priceId}
  171. </select>
  172. </mapper>