123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.steerinfo.dil.mapper.AmsContaactPriceMaterialMapper">
- <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.AmsContaactPriceMaterial">
- <id column="PRICE_MATERIAL_ID" jdbcType="DECIMAL" property="priceMaterialId" />
- <result column="PRICE_ID" jdbcType="DECIMAL" property="priceId" />
- <result column="MATERIAL_ID" jdbcType="DECIMAL" property="materialId" />
- </resultMap>
- <sql id="columns">
- PRICE_MATERIAL_ID, PRICE_ID, MATERIAL_ID
- </sql>
- <sql id="columns_alias">
- t.PRICE_MATERIAL_ID, t.PRICE_ID, t.MATERIAL_ID
- </sql>
- <sql id="select">
- SELECT <include refid="columns" /> FROM AMS_CONTAACT_PRICE_MATERIAL
- </sql>
- <sql id="select_alias">
- SELECT <include refid="columns_alias" /> FROM AMS_CONTAACT_PRICE_MATERIAL t
- </sql>
- <sql id="where">
- <where>
- <if test="priceMaterialId != null">
- and PRICE_MATERIAL_ID = #{priceMaterialId}
- </if>
- <if test="priceId != null">
- and PRICE_ID = #{priceId}
- </if>
- <if test="materialId != null">
- and MATERIAL_ID = #{materialId}
- </if>
- </where>
- </sql>
- <sql id="whereLike">
- <where>
- <if test="priceMaterialId != null">
- and PRICE_MATERIAL_ID = #{priceMaterialId}
- </if>
- <if test="priceId != null">
- and PRICE_ID = #{priceId}
- </if>
- <if test="materialId != null">
- and MATERIAL_ID = #{materialId}
- </if>
- </where>
- </sql>
- <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
- delete from AMS_CONTAACT_PRICE_MATERIAL
- where PRICE_MATERIAL_ID = #{priceMaterialId,jdbcType=DECIMAL}
- </delete>
- <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
- delete from AMS_CONTAACT_PRICE_MATERIAL
- where 1!=1
- <if test="priceId != null">
- or PRICE_ID = #{priceId}
- </if>
- <if test="materialId != null">
- or MATERIAL_ID = #{materialId}
- </if>
- </delete>
- <insert id="insert" parameterType="com.steerinfo.dil.model.AmsContaactPriceMaterial">
- insert into AMS_CONTAACT_PRICE_MATERIAL (PRICE_MATERIAL_ID, PRICE_ID, MATERIAL_ID
- )
- values (#{priceMaterialId,jdbcType=DECIMAL}, #{priceId,jdbcType=DECIMAL}, #{materialId,jdbcType=DECIMAL}
- )
- </insert>
- <insert id="insertSelective" parameterType="com.steerinfo.dil.model.AmsContaactPriceMaterial">
- insert into AMS_CONTAACT_PRICE_MATERIAL
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="priceMaterialId != null">
- PRICE_MATERIAL_ID,
- </if>
- <if test="priceId != null">
- PRICE_ID,
- </if>
- <if test="materialId != null">
- MATERIAL_ID,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="priceMaterialId != null">
- #{priceMaterialId,jdbcType=DECIMAL},
- </if>
- <if test="priceId != null">
- #{priceId,jdbcType=DECIMAL},
- </if>
- <if test="materialId != null">
- #{materialId,jdbcType=DECIMAL},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.AmsContaactPriceMaterial">
- update AMS_CONTAACT_PRICE_MATERIAL
- set PRICE_ID = #{priceId,jdbcType=DECIMAL},
- MATERIAL_ID = #{materialId,jdbcType=DECIMAL}
- where PRICE_MATERIAL_ID = #{priceMaterialId,jdbcType=DECIMAL}
- </update>
- <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.AmsContaactPriceMaterial">
- update AMS_CONTAACT_PRICE_MATERIAL
- <set>
- <if test="priceId != null">
- PRICE_ID = #{priceId,jdbcType=DECIMAL},
- </if>
- <if test="materialId != null">
- MATERIAL_ID = #{materialId,jdbcType=DECIMAL},
- </if>
- </set>
- where PRICE_MATERIAL_ID = #{priceMaterialId,jdbcType=DECIMAL}
- </update>
- <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
- <include refid="select" />
- where PRICE_MATERIAL_ID = #{priceMaterialId,jdbcType=DECIMAL}
- </select>
- <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- <include refid="select" />
- <include refid="where" />
- </select>
- <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- <include refid="select" />
- <include refid="whereLike" />
- </select>
- <insert id="batchInsert" parameterType="java.util.List">
- insert into AMS_CONTAACT_PRICE_MATERIAL
- (PRICE_MATERIAL_ID,
- PRICE_ID, MATERIAL_ID)
- ( <foreach collection="list" item="item" separator="union all">
- select
- #{item.priceMaterialId,jdbcType=DECIMAL},
- #{item.priceId,jdbcType=DECIMAL}, #{item.materialId,jdbcType=DECIMAL} from dual
- </foreach> )
- </insert>
- <update id="batchUpdate" parameterType="java.util.List">
- update AMS_CONTAACT_PRICE_MATERIAL
- set
- PRICE_MATERIAL_ID=
- <foreach close="end" collection="list" index="index" item="item" open="case PRICE_MATERIAL_ID" separator=" ">
- when #{item.priceMaterialId,jdbcType=DECIMAL} then #{item.priceMaterialId,jdbcType=DECIMAL}
- </foreach>
- ,PRICE_ID=
- <foreach close="end" collection="list" index="index" item="item" open="case PRICE_MATERIAL_ID" separator=" ">
- when #{item.priceMaterialId,jdbcType=DECIMAL} then #{item.priceId,jdbcType=DECIMAL}
- </foreach>
- ,MATERIAL_ID=
- <foreach close="end" collection="list" index="index" item="item" open="case PRICE_MATERIAL_ID" separator=" ">
- when #{item.priceMaterialId,jdbcType=DECIMAL} then #{item.materialId,jdbcType=DECIMAL}
- </foreach>
- where PRICE_MATERIAL_ID in
- <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
- #{item.priceMaterialId,jdbcType=DECIMAL}
- </foreach>
- </update>
- <delete id="batchDelete" parameterType="java.util.List">
- delete from AMS_CONTAACT_PRICE_MATERIAL
- where PRICE_MATERIAL_ID in
- <foreach close=")" collection="list" item="id" open="(" separator=",">
- #{id}
- </foreach>
- </delete>
- <!-- 友情提示!!!-->
- <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
- <!-- 友情提示!!!-->
- <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
- <select id="getMaterialName" resultType="java.util.Map" parameterType="decimal">
- select
- rm.MATERIAL_NAME "materialName",
- rm.MATERIAL_ID "materialId"
- from AMS_CONTAACT_PRICE_MATERIAL acpr
- left join RMS_MATERIAL RM
- on rm.MATERIAL_ID = acpr.MATERIAL_ID
- where PRICE_ID = #{priceId}
- </select>
- </mapper>
|