TxIndustryDistributionMapper.xml 14.7 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="com.tanpu.fund.mapper.generator.TxIndustryDistributionMapper">
  <resultMap id="BaseResultMap" type="com.tanpu.fund.entity.generator.TxIndustryDistribution">
    <!--@mbg.generated-->
    <!--@Table tx_industry_distribution-->
    <id column="fund_code" jdbcType="INTEGER" property="fundCode" />
    <id column="start_date" jdbcType="DATE" property="startDate" />
    <id column="end_date" jdbcType="DATE" property="endDate" />
    <id column="industry_code" jdbcType="VARCHAR" property="industryCode" />
    <result column="industry_name" jdbcType="VARCHAR" property="industryName" />
    <result column="market_value" jdbcType="DECIMAL" property="marketValue" />
    <result column="proportion" jdbcType="DECIMAL" property="proportion" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--@mbg.generated-->
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <!--@mbg.generated-->
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    fund_code, start_date, end_date, industry_code, industry_name, market_value, proportion
  </sql>
  <select id="selectByExample" parameterType="com.tanpu.fund.entity.generator.TxIndustryDistributionExample" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from tx_industry_distribution
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="map" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select 
    <include refid="Base_Column_List" />
    from tx_industry_distribution
    where fund_code = #{fundCode,jdbcType=INTEGER}
      and start_date = #{startDate,jdbcType=DATE}
      and end_date = #{endDate,jdbcType=DATE}
      and industry_code = #{industryCode,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="map">
    <!--@mbg.generated-->
    delete from tx_industry_distribution
    where fund_code = #{fundCode,jdbcType=INTEGER}
      and start_date = #{startDate,jdbcType=DATE}
      and end_date = #{endDate,jdbcType=DATE}
      and industry_code = #{industryCode,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.tanpu.fund.entity.generator.TxIndustryDistributionExample">
    <!--@mbg.generated-->
    delete from tx_industry_distribution
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.tanpu.fund.entity.generator.TxIndustryDistribution">
    <!--@mbg.generated-->
    insert into tx_industry_distribution (fund_code, start_date, end_date, 
      industry_code, industry_name, market_value, 
      proportion)
    values (#{fundCode,jdbcType=INTEGER}, #{startDate,jdbcType=DATE}, #{endDate,jdbcType=DATE}, 
      #{industryCode,jdbcType=VARCHAR}, #{industryName,jdbcType=VARCHAR}, #{marketValue,jdbcType=DECIMAL}, 
      #{proportion,jdbcType=DECIMAL})
  </insert>
  <insert id="insertSelective" parameterType="com.tanpu.fund.entity.generator.TxIndustryDistribution">
    <!--@mbg.generated-->
    insert into tx_industry_distribution
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="fundCode != null">
        fund_code,
      </if>
      <if test="startDate != null">
        start_date,
      </if>
      <if test="endDate != null">
        end_date,
      </if>
      <if test="industryCode != null">
        industry_code,
      </if>
      <if test="industryName != null">
        industry_name,
      </if>
      <if test="marketValue != null">
        market_value,
      </if>
      <if test="proportion != null">
        proportion,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="fundCode != null">
        #{fundCode,jdbcType=INTEGER},
      </if>
      <if test="startDate != null">
        #{startDate,jdbcType=DATE},
      </if>
      <if test="endDate != null">
        #{endDate,jdbcType=DATE},
      </if>
      <if test="industryCode != null">
        #{industryCode,jdbcType=VARCHAR},
      </if>
      <if test="industryName != null">
        #{industryName,jdbcType=VARCHAR},
      </if>
      <if test="marketValue != null">
        #{marketValue,jdbcType=DECIMAL},
      </if>
      <if test="proportion != null">
        #{proportion,jdbcType=DECIMAL},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.tanpu.fund.entity.generator.TxIndustryDistributionExample" resultType="java.lang.Long">
    <!--@mbg.generated-->
    select count(*) from tx_industry_distribution
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    <!--@mbg.generated-->
    update tx_industry_distribution
    <set>
      <if test="record.fundCode != null">
        fund_code = #{record.fundCode,jdbcType=INTEGER},
      </if>
      <if test="record.startDate != null">
        start_date = #{record.startDate,jdbcType=DATE},
      </if>
      <if test="record.endDate != null">
        end_date = #{record.endDate,jdbcType=DATE},
      </if>
      <if test="record.industryCode != null">
        industry_code = #{record.industryCode,jdbcType=VARCHAR},
      </if>
      <if test="record.industryName != null">
        industry_name = #{record.industryName,jdbcType=VARCHAR},
      </if>
      <if test="record.marketValue != null">
        market_value = #{record.marketValue,jdbcType=DECIMAL},
      </if>
      <if test="record.proportion != null">
        proportion = #{record.proportion,jdbcType=DECIMAL},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    <!--@mbg.generated-->
    update tx_industry_distribution
    set fund_code = #{record.fundCode,jdbcType=INTEGER},
      start_date = #{record.startDate,jdbcType=DATE},
      end_date = #{record.endDate,jdbcType=DATE},
      industry_code = #{record.industryCode,jdbcType=VARCHAR},
      industry_name = #{record.industryName,jdbcType=VARCHAR},
      market_value = #{record.marketValue,jdbcType=DECIMAL},
      proportion = #{record.proportion,jdbcType=DECIMAL}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.tanpu.fund.entity.generator.TxIndustryDistribution">
    <!--@mbg.generated-->
    update tx_industry_distribution
    <set>
      <if test="industryName != null">
        industry_name = #{industryName,jdbcType=VARCHAR},
      </if>
      <if test="marketValue != null">
        market_value = #{marketValue,jdbcType=DECIMAL},
      </if>
      <if test="proportion != null">
        proportion = #{proportion,jdbcType=DECIMAL},
      </if>
    </set>
    where fund_code = #{fundCode,jdbcType=INTEGER}
      and start_date = #{startDate,jdbcType=DATE}
      and end_date = #{endDate,jdbcType=DATE}
      and industry_code = #{industryCode,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.tanpu.fund.entity.generator.TxIndustryDistribution">
    <!--@mbg.generated-->
    update tx_industry_distribution
    set industry_name = #{industryName,jdbcType=VARCHAR},
      market_value = #{marketValue,jdbcType=DECIMAL},
      proportion = #{proportion,jdbcType=DECIMAL}
    where fund_code = #{fundCode,jdbcType=INTEGER}
      and start_date = #{startDate,jdbcType=DATE}
      and end_date = #{endDate,jdbcType=DATE}
      and industry_code = #{industryCode,jdbcType=VARCHAR}
  </update>
  <update id="updateBatch" parameterType="java.util.List">
    <!--@mbg.generated-->
    update tx_industry_distribution
    <trim prefix="set" suffixOverrides=",">
      <trim prefix="industry_name = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_code = #{item.fundCode,jdbcType=INTEGER} then #{item.industryName,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="market_value = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_code = #{item.fundCode,jdbcType=INTEGER} then #{item.marketValue,jdbcType=DECIMAL}
        </foreach>
      </trim>
      <trim prefix="proportion = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_code = #{item.fundCode,jdbcType=INTEGER} then #{item.proportion,jdbcType=DECIMAL}
        </foreach>
      </trim>
    </trim>
    where fund_code in
    <foreach close=")" collection="list" item="item" open="(" separator=", ">
      #{item.fundCode,jdbcType=INTEGER}
    </foreach>
  </update>
  <insert id="batchInsert" parameterType="map">
    <!--@mbg.generated-->
    insert into tx_industry_distribution
    (fund_code, start_date, end_date, industry_code, industry_name, market_value, proportion
      )
    values
    <foreach collection="list" item="item" separator=",">
      (#{item.fundCode,jdbcType=INTEGER}, #{item.startDate,jdbcType=DATE}, #{item.endDate,jdbcType=DATE}, 
        #{item.industryCode,jdbcType=VARCHAR}, #{item.industryName,jdbcType=VARCHAR}, #{item.marketValue,jdbcType=DECIMAL}, 
        #{item.proportion,jdbcType=DECIMAL})
    </foreach>
  </insert>
  <insert id="insertOrUpdate" parameterType="com.tanpu.fund.entity.generator.TxIndustryDistribution">
    <!--@mbg.generated-->
    insert into tx_industry_distribution
    (fund_code, start_date, end_date, industry_code, industry_name, market_value, proportion
      )
    values
    (#{fundCode,jdbcType=INTEGER}, #{startDate,jdbcType=DATE}, #{endDate,jdbcType=DATE}, 
      #{industryCode,jdbcType=VARCHAR}, #{industryName,jdbcType=VARCHAR}, #{marketValue,jdbcType=DECIMAL}, 
      #{proportion,jdbcType=DECIMAL})
    on duplicate key update 
    fund_code = #{fundCode,jdbcType=INTEGER}, 
    start_date = #{startDate,jdbcType=DATE}, 
    end_date = #{endDate,jdbcType=DATE}, 
    industry_code = #{industryCode,jdbcType=VARCHAR}, 
    industry_name = #{industryName,jdbcType=VARCHAR}, 
    market_value = #{marketValue,jdbcType=DECIMAL}, 
    proportion = #{proportion,jdbcType=DECIMAL}
  </insert>
  <insert id="insertOrUpdateSelective" parameterType="com.tanpu.fund.entity.generator.TxIndustryDistribution">
    <!--@mbg.generated-->
    insert into tx_industry_distribution
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="fundCode != null">
        fund_code,
      </if>
      <if test="startDate != null">
        start_date,
      </if>
      <if test="endDate != null">
        end_date,
      </if>
      <if test="industryCode != null">
        industry_code,
      </if>
      <if test="industryName != null">
        industry_name,
      </if>
      <if test="marketValue != null">
        market_value,
      </if>
      <if test="proportion != null">
        proportion,
      </if>
    </trim>
    values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="fundCode != null">
        #{fundCode,jdbcType=INTEGER},
      </if>
      <if test="startDate != null">
        #{startDate,jdbcType=DATE},
      </if>
      <if test="endDate != null">
        #{endDate,jdbcType=DATE},
      </if>
      <if test="industryCode != null">
        #{industryCode,jdbcType=VARCHAR},
      </if>
      <if test="industryName != null">
        #{industryName,jdbcType=VARCHAR},
      </if>
      <if test="marketValue != null">
        #{marketValue,jdbcType=DECIMAL},
      </if>
      <if test="proportion != null">
        #{proportion,jdbcType=DECIMAL},
      </if>
    </trim>
    on duplicate key update 
    <trim suffixOverrides=",">
      <if test="fundCode != null">
        fund_code = #{fundCode,jdbcType=INTEGER},
      </if>
      <if test="startDate != null">
        start_date = #{startDate,jdbcType=DATE},
      </if>
      <if test="endDate != null">
        end_date = #{endDate,jdbcType=DATE},
      </if>
      <if test="industryCode != null">
        industry_code = #{industryCode,jdbcType=VARCHAR},
      </if>
      <if test="industryName != null">
        industry_name = #{industryName,jdbcType=VARCHAR},
      </if>
      <if test="marketValue != null">
        market_value = #{marketValue,jdbcType=DECIMAL},
      </if>
      <if test="proportion != null">
        proportion = #{proportion,jdbcType=DECIMAL},
      </if>
    </trim>
  </insert>
</mapper>