DiscountItemMapper.xml 3.5 KB
<?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="cn.runsa.crmapp.common.mapper.DiscountItemMapper" >
  <resultMap id="BaseResultMap" type="cn.runsa.crmapp.common.entity.DiscountItem" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <result column="PLCY_ID" property="plcyId" jdbcType="BIGINT" />
    <result column="PLCY_TYPE" property="plcyType" jdbcType="VARCHAR" />
    <result column="S_DISCOUNT" property="sDiscount" jdbcType="DOUBLE" />
    <result column="E_DISCOUNT" property="eDiscount" jdbcType="DOUBLE" />
    <result column="values" property="values" jdbcType="DOUBLE" />
  </resultMap>
  <insert id="insert" parameterType="cn.runsa.crmapp.common.entity.DiscountItem" >
   	insert into crm_policy_discount_item (`PLCY_ID`, `PLCY_TYPE`, `S_DISCOUNT`, 
      `E_DISCOUNT`, `values`) values
      	(#{plcyId,jdbcType=BIGINT},
      	 'DISCOUNT',
      	 #{sDiscount,jdbcType=DOUBLE}, 
      	 #{eDiscount,jdbcType=DOUBLE},
      	 0)
  </insert>
  <!--新增适用折数带 -->
  <insert id="insertDiscountItem" parameterType="java.util.List"> 
   insert into crm_policy_discount_item (`PLCY_ID`, `PLCY_TYPE`, `S_DISCOUNT`, 
      `E_DISCOUNT`, `values`) values
      <foreach collection="list" item="item" index="index" separator=",">
      	(#{item.plcyId,jdbcType=BIGINT},
      	 'DISCOUNT',
      	 #{item.sDiscount,jdbcType=DOUBLE}, 
      	 #{item.eDiscount,jdbcType=DOUBLE},
      	 0)
      </foreach>
  </insert>
  <select id="findByPlcyId" parameterType="cn.runsa.crmapp.common.entity.DiscountItem" resultMap="BaseResultMap">
  	select `PLCY_ID`, `PLCY_TYPE`, `S_DISCOUNT`, 
      `E_DISCOUNT` from
      crm_policy_discount_item 
      where PLCY_ID = #{plcyId,jdbcType=BIGINT}
  </select>
  <!-- 修改折数带的values -->
  <update id="update" parameterType="cn.runsa.crmapp.common.entity.DiscountItem">
  	update crm_policy_discount_item set 
  		`values` = #{values,jdbcType=DOUBLE}
  	where PLCY_ID = #{plcyId,jdbcType=BIGINT} AND E_DISCOUNT = #{eDiscount,jdbcType=DOUBLE}
  </update>
  <!-- 删除适用折数带 -->
  <delete id="delete" parameterType="java.lang.Long">
  	delete from crm_policy_discount_item where PLCY_ID = #{plcyId,jdbcType=BIGINT}
  </delete>
  <insert id="insertSelective" parameterType="cn.runsa.crmapp.common.entity.DiscountItem" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into crm_policy_discount_item 
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="plcyId != null" >
        `PLCY_ID`,
      </if>
      <if test="plcyType != null" >
        `PLCY_TYPE`,
      </if>
      <if test="sDiscount != null" >
        `S_DISCOUNT`,
      </if>
      <if test="eDiscount != null" >
        `E_DISCOUNT`,
      </if>
      <if test="values != null" >
        `values`,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="plcyId != null" >
        #{plcyId,jdbcType=BIGINT},
      </if>
      <if test="plcyType != null" >
        #{plcyType,jdbcType=VARCHAR},
      </if>
      <if test="sDiscount != null" >
        #{sDiscount,jdbcType=DOUBLE},
      </if>
      <if test="eDiscount != null" >
        #{eDiscount,jdbcType=DOUBLE},
      </if>
      <if test="values != null" >
        #{values,jdbcType=DOUBLE},
      </if>
    </trim>
  </insert>
</mapper>