<?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.TxFundPortfolioMapper">
  <resultMap id="BaseResultMap" type="com.tanpu.fund.entity.generator.TxFundPortfolio">
    <!--@mbg.generated-->
    <!--@Table tx_fund_portfolio-->
    <id column="fund_id" jdbcType="VARCHAR" property="fundId" />
    <result column="fund_code" jdbcType="VARCHAR" property="fundCode" />
    <result column="fund_short_name" jdbcType="VARCHAR" property="fundShortName" />
    <result column="report_id" jdbcType="VARCHAR" property="reportId" />
    <result column="ann_date" jdbcType="DATE" property="annDate" />
    <result column="start_date" jdbcType="DATE" property="startDate" />
    <result column="end_date" jdbcType="DATE" property="endDate" />
    <result column="data_source" jdbcType="VARCHAR" property="dataSource" />
    <result column="is_new" jdbcType="INTEGER" property="isNew" />
    <result column="stock_value" jdbcType="DECIMAL" property="stockValue" />
    <result column="bond_value" jdbcType="DECIMAL" property="bondValue" />
    <result column="bank_value" jdbcType="DECIMAL" property="bankValue" />
    <result column="other_value" jdbcType="DECIMAL" property="otherValue" />
    <result column="return_sale" jdbcType="DECIMAL" property="returnSale" />
    <result column="settlement" jdbcType="DECIMAL" property="settlement" />
    <result column="der_invest" jdbcType="DECIMAL" property="derInvest" />
    <result column="total_value" jdbcType="DECIMAL" property="totalValue" />
    <result column="net_value" jdbcType="DECIMAL" property="netValue" />
    <result column="asset_back" jdbcType="DECIMAL" property="assetBack" />
    <result column="active_back" jdbcType="DECIMAL" property="activeBack" />
    <result column="index_invest" jdbcType="DECIMAL" property="indexInvest" />
    <result column="fund_invest" jdbcType="DECIMAL" property="fundInvest" />
    <result column="metal_invest" jdbcType="DECIMAL" property="metalInvest" />
    <result column="hk_stock" jdbcType="DECIMAL" property="hkStock" />
    <result column="S_SEG" jdbcType="BIGINT" property="sSeg" />
    <result column="S_ROW_VERSION" jdbcType="BIGINT" property="sRowVersion" />
    <result column="S_UPDATE_TIME" jdbcType="TIMESTAMP" property="sUpdateTime" />
    <result column="S_DATA_STATE" jdbcType="SMALLINT" property="sDataState" />
  </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_id, fund_code, fund_short_name, report_id, ann_date, start_date, end_date, data_source, 
    is_new, stock_value, bond_value, bank_value, other_value, return_sale, settlement, 
    der_invest, total_value, net_value, asset_back, active_back, index_invest, fund_invest, 
    metal_invest, hk_stock, S_SEG, S_ROW_VERSION, S_UPDATE_TIME, S_DATA_STATE
  </sql>
  <select id="selectByExample" parameterType="com.tanpu.fund.entity.generator.TxFundPortfolioExample" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from tx_fund_portfolio
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select 
    <include refid="Base_Column_List" />
    from tx_fund_portfolio
    where fund_id = #{fundId,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    <!--@mbg.generated-->
    delete from tx_fund_portfolio
    where fund_id = #{fundId,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.tanpu.fund.entity.generator.TxFundPortfolioExample">
    <!--@mbg.generated-->
    delete from tx_fund_portfolio
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.tanpu.fund.entity.generator.TxFundPortfolio">
    <!--@mbg.generated-->
    insert into tx_fund_portfolio (fund_id, fund_code, fund_short_name, 
      report_id, ann_date, start_date, 
      end_date, data_source, is_new, 
      stock_value, bond_value, bank_value, 
      other_value, return_sale, settlement, 
      der_invest, total_value, net_value, 
      asset_back, active_back, index_invest, 
      fund_invest, metal_invest, hk_stock, 
      S_SEG, S_ROW_VERSION, S_UPDATE_TIME, 
      S_DATA_STATE)
    values (#{fundId,jdbcType=VARCHAR}, #{fundCode,jdbcType=VARCHAR}, #{fundShortName,jdbcType=VARCHAR}, 
      #{reportId,jdbcType=VARCHAR}, #{annDate,jdbcType=DATE}, #{startDate,jdbcType=DATE}, 
      #{endDate,jdbcType=DATE}, #{dataSource,jdbcType=VARCHAR}, #{isNew,jdbcType=INTEGER}, 
      #{stockValue,jdbcType=DECIMAL}, #{bondValue,jdbcType=DECIMAL}, #{bankValue,jdbcType=DECIMAL}, 
      #{otherValue,jdbcType=DECIMAL}, #{returnSale,jdbcType=DECIMAL}, #{settlement,jdbcType=DECIMAL}, 
      #{derInvest,jdbcType=DECIMAL}, #{totalValue,jdbcType=DECIMAL}, #{netValue,jdbcType=DECIMAL}, 
      #{assetBack,jdbcType=DECIMAL}, #{activeBack,jdbcType=DECIMAL}, #{indexInvest,jdbcType=DECIMAL}, 
      #{fundInvest,jdbcType=DECIMAL}, #{metalInvest,jdbcType=DECIMAL}, #{hkStock,jdbcType=DECIMAL}, 
      #{sSeg,jdbcType=BIGINT}, #{sRowVersion,jdbcType=BIGINT}, #{sUpdateTime,jdbcType=TIMESTAMP}, 
      #{sDataState,jdbcType=SMALLINT})
  </insert>
  <insert id="insertSelective" parameterType="com.tanpu.fund.entity.generator.TxFundPortfolio">
    <!--@mbg.generated-->
    insert into tx_fund_portfolio
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="fundId != null">
        fund_id,
      </if>
      <if test="fundCode != null">
        fund_code,
      </if>
      <if test="fundShortName != null">
        fund_short_name,
      </if>
      <if test="reportId != null">
        report_id,
      </if>
      <if test="annDate != null">
        ann_date,
      </if>
      <if test="startDate != null">
        start_date,
      </if>
      <if test="endDate != null">
        end_date,
      </if>
      <if test="dataSource != null">
        data_source,
      </if>
      <if test="isNew != null">
        is_new,
      </if>
      <if test="stockValue != null">
        stock_value,
      </if>
      <if test="bondValue != null">
        bond_value,
      </if>
      <if test="bankValue != null">
        bank_value,
      </if>
      <if test="otherValue != null">
        other_value,
      </if>
      <if test="returnSale != null">
        return_sale,
      </if>
      <if test="settlement != null">
        settlement,
      </if>
      <if test="derInvest != null">
        der_invest,
      </if>
      <if test="totalValue != null">
        total_value,
      </if>
      <if test="netValue != null">
        net_value,
      </if>
      <if test="assetBack != null">
        asset_back,
      </if>
      <if test="activeBack != null">
        active_back,
      </if>
      <if test="indexInvest != null">
        index_invest,
      </if>
      <if test="fundInvest != null">
        fund_invest,
      </if>
      <if test="metalInvest != null">
        metal_invest,
      </if>
      <if test="hkStock != null">
        hk_stock,
      </if>
      <if test="sSeg != null">
        S_SEG,
      </if>
      <if test="sRowVersion != null">
        S_ROW_VERSION,
      </if>
      <if test="sUpdateTime != null">
        S_UPDATE_TIME,
      </if>
      <if test="sDataState != null">
        S_DATA_STATE,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="fundId != null">
        #{fundId,jdbcType=VARCHAR},
      </if>
      <if test="fundCode != null">
        #{fundCode,jdbcType=VARCHAR},
      </if>
      <if test="fundShortName != null">
        #{fundShortName,jdbcType=VARCHAR},
      </if>
      <if test="reportId != null">
        #{reportId,jdbcType=VARCHAR},
      </if>
      <if test="annDate != null">
        #{annDate,jdbcType=DATE},
      </if>
      <if test="startDate != null">
        #{startDate,jdbcType=DATE},
      </if>
      <if test="endDate != null">
        #{endDate,jdbcType=DATE},
      </if>
      <if test="dataSource != null">
        #{dataSource,jdbcType=VARCHAR},
      </if>
      <if test="isNew != null">
        #{isNew,jdbcType=INTEGER},
      </if>
      <if test="stockValue != null">
        #{stockValue,jdbcType=DECIMAL},
      </if>
      <if test="bondValue != null">
        #{bondValue,jdbcType=DECIMAL},
      </if>
      <if test="bankValue != null">
        #{bankValue,jdbcType=DECIMAL},
      </if>
      <if test="otherValue != null">
        #{otherValue,jdbcType=DECIMAL},
      </if>
      <if test="returnSale != null">
        #{returnSale,jdbcType=DECIMAL},
      </if>
      <if test="settlement != null">
        #{settlement,jdbcType=DECIMAL},
      </if>
      <if test="derInvest != null">
        #{derInvest,jdbcType=DECIMAL},
      </if>
      <if test="totalValue != null">
        #{totalValue,jdbcType=DECIMAL},
      </if>
      <if test="netValue != null">
        #{netValue,jdbcType=DECIMAL},
      </if>
      <if test="assetBack != null">
        #{assetBack,jdbcType=DECIMAL},
      </if>
      <if test="activeBack != null">
        #{activeBack,jdbcType=DECIMAL},
      </if>
      <if test="indexInvest != null">
        #{indexInvest,jdbcType=DECIMAL},
      </if>
      <if test="fundInvest != null">
        #{fundInvest,jdbcType=DECIMAL},
      </if>
      <if test="metalInvest != null">
        #{metalInvest,jdbcType=DECIMAL},
      </if>
      <if test="hkStock != null">
        #{hkStock,jdbcType=DECIMAL},
      </if>
      <if test="sSeg != null">
        #{sSeg,jdbcType=BIGINT},
      </if>
      <if test="sRowVersion != null">
        #{sRowVersion,jdbcType=BIGINT},
      </if>
      <if test="sUpdateTime != null">
        #{sUpdateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="sDataState != null">
        #{sDataState,jdbcType=SMALLINT},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.tanpu.fund.entity.generator.TxFundPortfolioExample" resultType="java.lang.Long">
    <!--@mbg.generated-->
    select count(*) from tx_fund_portfolio
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    <!--@mbg.generated-->
    update tx_fund_portfolio
    <set>
      <if test="record.fundId != null">
        fund_id = #{record.fundId,jdbcType=VARCHAR},
      </if>
      <if test="record.fundCode != null">
        fund_code = #{record.fundCode,jdbcType=VARCHAR},
      </if>
      <if test="record.fundShortName != null">
        fund_short_name = #{record.fundShortName,jdbcType=VARCHAR},
      </if>
      <if test="record.reportId != null">
        report_id = #{record.reportId,jdbcType=VARCHAR},
      </if>
      <if test="record.annDate != null">
        ann_date = #{record.annDate,jdbcType=DATE},
      </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.dataSource != null">
        data_source = #{record.dataSource,jdbcType=VARCHAR},
      </if>
      <if test="record.isNew != null">
        is_new = #{record.isNew,jdbcType=INTEGER},
      </if>
      <if test="record.stockValue != null">
        stock_value = #{record.stockValue,jdbcType=DECIMAL},
      </if>
      <if test="record.bondValue != null">
        bond_value = #{record.bondValue,jdbcType=DECIMAL},
      </if>
      <if test="record.bankValue != null">
        bank_value = #{record.bankValue,jdbcType=DECIMAL},
      </if>
      <if test="record.otherValue != null">
        other_value = #{record.otherValue,jdbcType=DECIMAL},
      </if>
      <if test="record.returnSale != null">
        return_sale = #{record.returnSale,jdbcType=DECIMAL},
      </if>
      <if test="record.settlement != null">
        settlement = #{record.settlement,jdbcType=DECIMAL},
      </if>
      <if test="record.derInvest != null">
        der_invest = #{record.derInvest,jdbcType=DECIMAL},
      </if>
      <if test="record.totalValue != null">
        total_value = #{record.totalValue,jdbcType=DECIMAL},
      </if>
      <if test="record.netValue != null">
        net_value = #{record.netValue,jdbcType=DECIMAL},
      </if>
      <if test="record.assetBack != null">
        asset_back = #{record.assetBack,jdbcType=DECIMAL},
      </if>
      <if test="record.activeBack != null">
        active_back = #{record.activeBack,jdbcType=DECIMAL},
      </if>
      <if test="record.indexInvest != null">
        index_invest = #{record.indexInvest,jdbcType=DECIMAL},
      </if>
      <if test="record.fundInvest != null">
        fund_invest = #{record.fundInvest,jdbcType=DECIMAL},
      </if>
      <if test="record.metalInvest != null">
        metal_invest = #{record.metalInvest,jdbcType=DECIMAL},
      </if>
      <if test="record.hkStock != null">
        hk_stock = #{record.hkStock,jdbcType=DECIMAL},
      </if>
      <if test="record.sSeg != null">
        S_SEG = #{record.sSeg,jdbcType=BIGINT},
      </if>
      <if test="record.sRowVersion != null">
        S_ROW_VERSION = #{record.sRowVersion,jdbcType=BIGINT},
      </if>
      <if test="record.sUpdateTime != null">
        S_UPDATE_TIME = #{record.sUpdateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.sDataState != null">
        S_DATA_STATE = #{record.sDataState,jdbcType=SMALLINT},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    <!--@mbg.generated-->
    update tx_fund_portfolio
    set fund_id = #{record.fundId,jdbcType=VARCHAR},
      fund_code = #{record.fundCode,jdbcType=VARCHAR},
      fund_short_name = #{record.fundShortName,jdbcType=VARCHAR},
      report_id = #{record.reportId,jdbcType=VARCHAR},
      ann_date = #{record.annDate,jdbcType=DATE},
      start_date = #{record.startDate,jdbcType=DATE},
      end_date = #{record.endDate,jdbcType=DATE},
      data_source = #{record.dataSource,jdbcType=VARCHAR},
      is_new = #{record.isNew,jdbcType=INTEGER},
      stock_value = #{record.stockValue,jdbcType=DECIMAL},
      bond_value = #{record.bondValue,jdbcType=DECIMAL},
      bank_value = #{record.bankValue,jdbcType=DECIMAL},
      other_value = #{record.otherValue,jdbcType=DECIMAL},
      return_sale = #{record.returnSale,jdbcType=DECIMAL},
      settlement = #{record.settlement,jdbcType=DECIMAL},
      der_invest = #{record.derInvest,jdbcType=DECIMAL},
      total_value = #{record.totalValue,jdbcType=DECIMAL},
      net_value = #{record.netValue,jdbcType=DECIMAL},
      asset_back = #{record.assetBack,jdbcType=DECIMAL},
      active_back = #{record.activeBack,jdbcType=DECIMAL},
      index_invest = #{record.indexInvest,jdbcType=DECIMAL},
      fund_invest = #{record.fundInvest,jdbcType=DECIMAL},
      metal_invest = #{record.metalInvest,jdbcType=DECIMAL},
      hk_stock = #{record.hkStock,jdbcType=DECIMAL},
      S_SEG = #{record.sSeg,jdbcType=BIGINT},
      S_ROW_VERSION = #{record.sRowVersion,jdbcType=BIGINT},
      S_UPDATE_TIME = #{record.sUpdateTime,jdbcType=TIMESTAMP},
      S_DATA_STATE = #{record.sDataState,jdbcType=SMALLINT}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.tanpu.fund.entity.generator.TxFundPortfolio">
    <!--@mbg.generated-->
    update tx_fund_portfolio
    <set>
      <if test="fundCode != null">
        fund_code = #{fundCode,jdbcType=VARCHAR},
      </if>
      <if test="fundShortName != null">
        fund_short_name = #{fundShortName,jdbcType=VARCHAR},
      </if>
      <if test="reportId != null">
        report_id = #{reportId,jdbcType=VARCHAR},
      </if>
      <if test="annDate != null">
        ann_date = #{annDate,jdbcType=DATE},
      </if>
      <if test="startDate != null">
        start_date = #{startDate,jdbcType=DATE},
      </if>
      <if test="endDate != null">
        end_date = #{endDate,jdbcType=DATE},
      </if>
      <if test="dataSource != null">
        data_source = #{dataSource,jdbcType=VARCHAR},
      </if>
      <if test="isNew != null">
        is_new = #{isNew,jdbcType=INTEGER},
      </if>
      <if test="stockValue != null">
        stock_value = #{stockValue,jdbcType=DECIMAL},
      </if>
      <if test="bondValue != null">
        bond_value = #{bondValue,jdbcType=DECIMAL},
      </if>
      <if test="bankValue != null">
        bank_value = #{bankValue,jdbcType=DECIMAL},
      </if>
      <if test="otherValue != null">
        other_value = #{otherValue,jdbcType=DECIMAL},
      </if>
      <if test="returnSale != null">
        return_sale = #{returnSale,jdbcType=DECIMAL},
      </if>
      <if test="settlement != null">
        settlement = #{settlement,jdbcType=DECIMAL},
      </if>
      <if test="derInvest != null">
        der_invest = #{derInvest,jdbcType=DECIMAL},
      </if>
      <if test="totalValue != null">
        total_value = #{totalValue,jdbcType=DECIMAL},
      </if>
      <if test="netValue != null">
        net_value = #{netValue,jdbcType=DECIMAL},
      </if>
      <if test="assetBack != null">
        asset_back = #{assetBack,jdbcType=DECIMAL},
      </if>
      <if test="activeBack != null">
        active_back = #{activeBack,jdbcType=DECIMAL},
      </if>
      <if test="indexInvest != null">
        index_invest = #{indexInvest,jdbcType=DECIMAL},
      </if>
      <if test="fundInvest != null">
        fund_invest = #{fundInvest,jdbcType=DECIMAL},
      </if>
      <if test="metalInvest != null">
        metal_invest = #{metalInvest,jdbcType=DECIMAL},
      </if>
      <if test="hkStock != null">
        hk_stock = #{hkStock,jdbcType=DECIMAL},
      </if>
      <if test="sSeg != null">
        S_SEG = #{sSeg,jdbcType=BIGINT},
      </if>
      <if test="sRowVersion != null">
        S_ROW_VERSION = #{sRowVersion,jdbcType=BIGINT},
      </if>
      <if test="sUpdateTime != null">
        S_UPDATE_TIME = #{sUpdateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="sDataState != null">
        S_DATA_STATE = #{sDataState,jdbcType=SMALLINT},
      </if>
    </set>
    where fund_id = #{fundId,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.tanpu.fund.entity.generator.TxFundPortfolio">
    <!--@mbg.generated-->
    update tx_fund_portfolio
    set fund_code = #{fundCode,jdbcType=VARCHAR},
      fund_short_name = #{fundShortName,jdbcType=VARCHAR},
      report_id = #{reportId,jdbcType=VARCHAR},
      ann_date = #{annDate,jdbcType=DATE},
      start_date = #{startDate,jdbcType=DATE},
      end_date = #{endDate,jdbcType=DATE},
      data_source = #{dataSource,jdbcType=VARCHAR},
      is_new = #{isNew,jdbcType=INTEGER},
      stock_value = #{stockValue,jdbcType=DECIMAL},
      bond_value = #{bondValue,jdbcType=DECIMAL},
      bank_value = #{bankValue,jdbcType=DECIMAL},
      other_value = #{otherValue,jdbcType=DECIMAL},
      return_sale = #{returnSale,jdbcType=DECIMAL},
      settlement = #{settlement,jdbcType=DECIMAL},
      der_invest = #{derInvest,jdbcType=DECIMAL},
      total_value = #{totalValue,jdbcType=DECIMAL},
      net_value = #{netValue,jdbcType=DECIMAL},
      asset_back = #{assetBack,jdbcType=DECIMAL},
      active_back = #{activeBack,jdbcType=DECIMAL},
      index_invest = #{indexInvest,jdbcType=DECIMAL},
      fund_invest = #{fundInvest,jdbcType=DECIMAL},
      metal_invest = #{metalInvest,jdbcType=DECIMAL},
      hk_stock = #{hkStock,jdbcType=DECIMAL},
      S_SEG = #{sSeg,jdbcType=BIGINT},
      S_ROW_VERSION = #{sRowVersion,jdbcType=BIGINT},
      S_UPDATE_TIME = #{sUpdateTime,jdbcType=TIMESTAMP},
      S_DATA_STATE = #{sDataState,jdbcType=SMALLINT}
    where fund_id = #{fundId,jdbcType=VARCHAR}
  </update>
  <update id="updateBatch" parameterType="java.util.List">
    <!--@mbg.generated-->
    update tx_fund_portfolio
    <trim prefix="set" suffixOverrides=",">
      <trim prefix="fund_code = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_id = #{item.fundId,jdbcType=VARCHAR} then #{item.fundCode,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="fund_short_name = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_id = #{item.fundId,jdbcType=VARCHAR} then #{item.fundShortName,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="report_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_id = #{item.fundId,jdbcType=VARCHAR} then #{item.reportId,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="ann_date = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_id = #{item.fundId,jdbcType=VARCHAR} then #{item.annDate,jdbcType=DATE}
        </foreach>
      </trim>
      <trim prefix="start_date = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_id = #{item.fundId,jdbcType=VARCHAR} then #{item.startDate,jdbcType=DATE}
        </foreach>
      </trim>
      <trim prefix="end_date = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_id = #{item.fundId,jdbcType=VARCHAR} then #{item.endDate,jdbcType=DATE}
        </foreach>
      </trim>
      <trim prefix="data_source = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_id = #{item.fundId,jdbcType=VARCHAR} then #{item.dataSource,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="is_new = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_id = #{item.fundId,jdbcType=VARCHAR} then #{item.isNew,jdbcType=INTEGER}
        </foreach>
      </trim>
      <trim prefix="stock_value = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_id = #{item.fundId,jdbcType=VARCHAR} then #{item.stockValue,jdbcType=DECIMAL}
        </foreach>
      </trim>
      <trim prefix="bond_value = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_id = #{item.fundId,jdbcType=VARCHAR} then #{item.bondValue,jdbcType=DECIMAL}
        </foreach>
      </trim>
      <trim prefix="bank_value = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_id = #{item.fundId,jdbcType=VARCHAR} then #{item.bankValue,jdbcType=DECIMAL}
        </foreach>
      </trim>
      <trim prefix="other_value = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_id = #{item.fundId,jdbcType=VARCHAR} then #{item.otherValue,jdbcType=DECIMAL}
        </foreach>
      </trim>
      <trim prefix="return_sale = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_id = #{item.fundId,jdbcType=VARCHAR} then #{item.returnSale,jdbcType=DECIMAL}
        </foreach>
      </trim>
      <trim prefix="settlement = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_id = #{item.fundId,jdbcType=VARCHAR} then #{item.settlement,jdbcType=DECIMAL}
        </foreach>
      </trim>
      <trim prefix="der_invest = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_id = #{item.fundId,jdbcType=VARCHAR} then #{item.derInvest,jdbcType=DECIMAL}
        </foreach>
      </trim>
      <trim prefix="total_value = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_id = #{item.fundId,jdbcType=VARCHAR} then #{item.totalValue,jdbcType=DECIMAL}
        </foreach>
      </trim>
      <trim prefix="net_value = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_id = #{item.fundId,jdbcType=VARCHAR} then #{item.netValue,jdbcType=DECIMAL}
        </foreach>
      </trim>
      <trim prefix="asset_back = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_id = #{item.fundId,jdbcType=VARCHAR} then #{item.assetBack,jdbcType=DECIMAL}
        </foreach>
      </trim>
      <trim prefix="active_back = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_id = #{item.fundId,jdbcType=VARCHAR} then #{item.activeBack,jdbcType=DECIMAL}
        </foreach>
      </trim>
      <trim prefix="index_invest = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_id = #{item.fundId,jdbcType=VARCHAR} then #{item.indexInvest,jdbcType=DECIMAL}
        </foreach>
      </trim>
      <trim prefix="fund_invest = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_id = #{item.fundId,jdbcType=VARCHAR} then #{item.fundInvest,jdbcType=DECIMAL}
        </foreach>
      </trim>
      <trim prefix="metal_invest = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_id = #{item.fundId,jdbcType=VARCHAR} then #{item.metalInvest,jdbcType=DECIMAL}
        </foreach>
      </trim>
      <trim prefix="hk_stock = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_id = #{item.fundId,jdbcType=VARCHAR} then #{item.hkStock,jdbcType=DECIMAL}
        </foreach>
      </trim>
      <trim prefix="S_SEG = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_id = #{item.fundId,jdbcType=VARCHAR} then #{item.sSeg,jdbcType=BIGINT}
        </foreach>
      </trim>
      <trim prefix="S_ROW_VERSION = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_id = #{item.fundId,jdbcType=VARCHAR} then #{item.sRowVersion,jdbcType=BIGINT}
        </foreach>
      </trim>
      <trim prefix="S_UPDATE_TIME = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_id = #{item.fundId,jdbcType=VARCHAR} then #{item.sUpdateTime,jdbcType=TIMESTAMP}
        </foreach>
      </trim>
      <trim prefix="S_DATA_STATE = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when fund_id = #{item.fundId,jdbcType=VARCHAR} then #{item.sDataState,jdbcType=SMALLINT}
        </foreach>
      </trim>
    </trim>
    where fund_id in
    <foreach close=")" collection="list" item="item" open="(" separator=", ">
      #{item.fundId,jdbcType=VARCHAR}
    </foreach>
  </update>
  <insert id="batchInsert" parameterType="map">
    <!--@mbg.generated-->
    insert into tx_fund_portfolio
    (fund_id, fund_code, fund_short_name, report_id, ann_date, start_date, end_date, 
      data_source, is_new, stock_value, bond_value, bank_value, other_value, return_sale, 
      settlement, der_invest, total_value, net_value, asset_back, active_back, index_invest, 
      fund_invest, metal_invest, hk_stock, S_SEG, S_ROW_VERSION, S_UPDATE_TIME, S_DATA_STATE
      )
    values
    <foreach collection="list" item="item" separator=",">
      (#{item.fundId,jdbcType=VARCHAR}, #{item.fundCode,jdbcType=VARCHAR}, #{item.fundShortName,jdbcType=VARCHAR}, 
        #{item.reportId,jdbcType=VARCHAR}, #{item.annDate,jdbcType=DATE}, #{item.startDate,jdbcType=DATE}, 
        #{item.endDate,jdbcType=DATE}, #{item.dataSource,jdbcType=VARCHAR}, #{item.isNew,jdbcType=INTEGER}, 
        #{item.stockValue,jdbcType=DECIMAL}, #{item.bondValue,jdbcType=DECIMAL}, #{item.bankValue,jdbcType=DECIMAL}, 
        #{item.otherValue,jdbcType=DECIMAL}, #{item.returnSale,jdbcType=DECIMAL}, #{item.settlement,jdbcType=DECIMAL}, 
        #{item.derInvest,jdbcType=DECIMAL}, #{item.totalValue,jdbcType=DECIMAL}, #{item.netValue,jdbcType=DECIMAL}, 
        #{item.assetBack,jdbcType=DECIMAL}, #{item.activeBack,jdbcType=DECIMAL}, #{item.indexInvest,jdbcType=DECIMAL}, 
        #{item.fundInvest,jdbcType=DECIMAL}, #{item.metalInvest,jdbcType=DECIMAL}, #{item.hkStock,jdbcType=DECIMAL}, 
        #{item.sSeg,jdbcType=BIGINT}, #{item.sRowVersion,jdbcType=BIGINT}, #{item.sUpdateTime,jdbcType=TIMESTAMP}, 
        #{item.sDataState,jdbcType=SMALLINT})
    </foreach>
  </insert>
  <insert id="insertOrUpdate" parameterType="com.tanpu.fund.entity.generator.TxFundPortfolio">
    <!--@mbg.generated-->
    insert into tx_fund_portfolio
    (fund_id, fund_code, fund_short_name, report_id, ann_date, start_date, end_date, 
      data_source, is_new, stock_value, bond_value, bank_value, other_value, return_sale, 
      settlement, der_invest, total_value, net_value, asset_back, active_back, index_invest, 
      fund_invest, metal_invest, hk_stock, S_SEG, S_ROW_VERSION, S_UPDATE_TIME, S_DATA_STATE
      )
    values
    (#{fundId,jdbcType=VARCHAR}, #{fundCode,jdbcType=VARCHAR}, #{fundShortName,jdbcType=VARCHAR}, 
      #{reportId,jdbcType=VARCHAR}, #{annDate,jdbcType=DATE}, #{startDate,jdbcType=DATE}, 
      #{endDate,jdbcType=DATE}, #{dataSource,jdbcType=VARCHAR}, #{isNew,jdbcType=INTEGER}, 
      #{stockValue,jdbcType=DECIMAL}, #{bondValue,jdbcType=DECIMAL}, #{bankValue,jdbcType=DECIMAL}, 
      #{otherValue,jdbcType=DECIMAL}, #{returnSale,jdbcType=DECIMAL}, #{settlement,jdbcType=DECIMAL}, 
      #{derInvest,jdbcType=DECIMAL}, #{totalValue,jdbcType=DECIMAL}, #{netValue,jdbcType=DECIMAL}, 
      #{assetBack,jdbcType=DECIMAL}, #{activeBack,jdbcType=DECIMAL}, #{indexInvest,jdbcType=DECIMAL}, 
      #{fundInvest,jdbcType=DECIMAL}, #{metalInvest,jdbcType=DECIMAL}, #{hkStock,jdbcType=DECIMAL}, 
      #{sSeg,jdbcType=BIGINT}, #{sRowVersion,jdbcType=BIGINT}, #{sUpdateTime,jdbcType=TIMESTAMP}, 
      #{sDataState,jdbcType=SMALLINT})
    on duplicate key update 
    fund_id = #{fundId,jdbcType=VARCHAR}, 
    fund_code = #{fundCode,jdbcType=VARCHAR}, 
    fund_short_name = #{fundShortName,jdbcType=VARCHAR}, 
    report_id = #{reportId,jdbcType=VARCHAR}, 
    ann_date = #{annDate,jdbcType=DATE}, 
    start_date = #{startDate,jdbcType=DATE}, 
    end_date = #{endDate,jdbcType=DATE}, 
    data_source = #{dataSource,jdbcType=VARCHAR}, 
    is_new = #{isNew,jdbcType=INTEGER}, 
    stock_value = #{stockValue,jdbcType=DECIMAL}, 
    bond_value = #{bondValue,jdbcType=DECIMAL}, 
    bank_value = #{bankValue,jdbcType=DECIMAL}, 
    other_value = #{otherValue,jdbcType=DECIMAL}, 
    return_sale = #{returnSale,jdbcType=DECIMAL}, 
    settlement = #{settlement,jdbcType=DECIMAL}, 
    der_invest = #{derInvest,jdbcType=DECIMAL}, 
    total_value = #{totalValue,jdbcType=DECIMAL}, 
    net_value = #{netValue,jdbcType=DECIMAL}, 
    asset_back = #{assetBack,jdbcType=DECIMAL}, 
    active_back = #{activeBack,jdbcType=DECIMAL}, 
    index_invest = #{indexInvest,jdbcType=DECIMAL}, 
    fund_invest = #{fundInvest,jdbcType=DECIMAL}, 
    metal_invest = #{metalInvest,jdbcType=DECIMAL}, 
    hk_stock = #{hkStock,jdbcType=DECIMAL}, 
    S_SEG = #{sSeg,jdbcType=BIGINT}, 
    S_ROW_VERSION = #{sRowVersion,jdbcType=BIGINT}, 
    S_UPDATE_TIME = #{sUpdateTime,jdbcType=TIMESTAMP}, 
    S_DATA_STATE = #{sDataState,jdbcType=SMALLINT}
  </insert>
  <insert id="insertOrUpdateSelective" parameterType="com.tanpu.fund.entity.generator.TxFundPortfolio">
    <!--@mbg.generated-->
    insert into tx_fund_portfolio
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="fundId != null">
        fund_id,
      </if>
      <if test="fundCode != null">
        fund_code,
      </if>
      <if test="fundShortName != null">
        fund_short_name,
      </if>
      <if test="reportId != null">
        report_id,
      </if>
      <if test="annDate != null">
        ann_date,
      </if>
      <if test="startDate != null">
        start_date,
      </if>
      <if test="endDate != null">
        end_date,
      </if>
      <if test="dataSource != null">
        data_source,
      </if>
      <if test="isNew != null">
        is_new,
      </if>
      <if test="stockValue != null">
        stock_value,
      </if>
      <if test="bondValue != null">
        bond_value,
      </if>
      <if test="bankValue != null">
        bank_value,
      </if>
      <if test="otherValue != null">
        other_value,
      </if>
      <if test="returnSale != null">
        return_sale,
      </if>
      <if test="settlement != null">
        settlement,
      </if>
      <if test="derInvest != null">
        der_invest,
      </if>
      <if test="totalValue != null">
        total_value,
      </if>
      <if test="netValue != null">
        net_value,
      </if>
      <if test="assetBack != null">
        asset_back,
      </if>
      <if test="activeBack != null">
        active_back,
      </if>
      <if test="indexInvest != null">
        index_invest,
      </if>
      <if test="fundInvest != null">
        fund_invest,
      </if>
      <if test="metalInvest != null">
        metal_invest,
      </if>
      <if test="hkStock != null">
        hk_stock,
      </if>
      <if test="sSeg != null">
        S_SEG,
      </if>
      <if test="sRowVersion != null">
        S_ROW_VERSION,
      </if>
      <if test="sUpdateTime != null">
        S_UPDATE_TIME,
      </if>
      <if test="sDataState != null">
        S_DATA_STATE,
      </if>
    </trim>
    values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="fundId != null">
        #{fundId,jdbcType=VARCHAR},
      </if>
      <if test="fundCode != null">
        #{fundCode,jdbcType=VARCHAR},
      </if>
      <if test="fundShortName != null">
        #{fundShortName,jdbcType=VARCHAR},
      </if>
      <if test="reportId != null">
        #{reportId,jdbcType=VARCHAR},
      </if>
      <if test="annDate != null">
        #{annDate,jdbcType=DATE},
      </if>
      <if test="startDate != null">
        #{startDate,jdbcType=DATE},
      </if>
      <if test="endDate != null">
        #{endDate,jdbcType=DATE},
      </if>
      <if test="dataSource != null">
        #{dataSource,jdbcType=VARCHAR},
      </if>
      <if test="isNew != null">
        #{isNew,jdbcType=INTEGER},
      </if>
      <if test="stockValue != null">
        #{stockValue,jdbcType=DECIMAL},
      </if>
      <if test="bondValue != null">
        #{bondValue,jdbcType=DECIMAL},
      </if>
      <if test="bankValue != null">
        #{bankValue,jdbcType=DECIMAL},
      </if>
      <if test="otherValue != null">
        #{otherValue,jdbcType=DECIMAL},
      </if>
      <if test="returnSale != null">
        #{returnSale,jdbcType=DECIMAL},
      </if>
      <if test="settlement != null">
        #{settlement,jdbcType=DECIMAL},
      </if>
      <if test="derInvest != null">
        #{derInvest,jdbcType=DECIMAL},
      </if>
      <if test="totalValue != null">
        #{totalValue,jdbcType=DECIMAL},
      </if>
      <if test="netValue != null">
        #{netValue,jdbcType=DECIMAL},
      </if>
      <if test="assetBack != null">
        #{assetBack,jdbcType=DECIMAL},
      </if>
      <if test="activeBack != null">
        #{activeBack,jdbcType=DECIMAL},
      </if>
      <if test="indexInvest != null">
        #{indexInvest,jdbcType=DECIMAL},
      </if>
      <if test="fundInvest != null">
        #{fundInvest,jdbcType=DECIMAL},
      </if>
      <if test="metalInvest != null">
        #{metalInvest,jdbcType=DECIMAL},
      </if>
      <if test="hkStock != null">
        #{hkStock,jdbcType=DECIMAL},
      </if>
      <if test="sSeg != null">
        #{sSeg,jdbcType=BIGINT},
      </if>
      <if test="sRowVersion != null">
        #{sRowVersion,jdbcType=BIGINT},
      </if>
      <if test="sUpdateTime != null">
        #{sUpdateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="sDataState != null">
        #{sDataState,jdbcType=SMALLINT},
      </if>
    </trim>
    on duplicate key update 
    <trim suffixOverrides=",">
      <if test="fundId != null">
        fund_id = #{fundId,jdbcType=VARCHAR},
      </if>
      <if test="fundCode != null">
        fund_code = #{fundCode,jdbcType=VARCHAR},
      </if>
      <if test="fundShortName != null">
        fund_short_name = #{fundShortName,jdbcType=VARCHAR},
      </if>
      <if test="reportId != null">
        report_id = #{reportId,jdbcType=VARCHAR},
      </if>
      <if test="annDate != null">
        ann_date = #{annDate,jdbcType=DATE},
      </if>
      <if test="startDate != null">
        start_date = #{startDate,jdbcType=DATE},
      </if>
      <if test="endDate != null">
        end_date = #{endDate,jdbcType=DATE},
      </if>
      <if test="dataSource != null">
        data_source = #{dataSource,jdbcType=VARCHAR},
      </if>
      <if test="isNew != null">
        is_new = #{isNew,jdbcType=INTEGER},
      </if>
      <if test="stockValue != null">
        stock_value = #{stockValue,jdbcType=DECIMAL},
      </if>
      <if test="bondValue != null">
        bond_value = #{bondValue,jdbcType=DECIMAL},
      </if>
      <if test="bankValue != null">
        bank_value = #{bankValue,jdbcType=DECIMAL},
      </if>
      <if test="otherValue != null">
        other_value = #{otherValue,jdbcType=DECIMAL},
      </if>
      <if test="returnSale != null">
        return_sale = #{returnSale,jdbcType=DECIMAL},
      </if>
      <if test="settlement != null">
        settlement = #{settlement,jdbcType=DECIMAL},
      </if>
      <if test="derInvest != null">
        der_invest = #{derInvest,jdbcType=DECIMAL},
      </if>
      <if test="totalValue != null">
        total_value = #{totalValue,jdbcType=DECIMAL},
      </if>
      <if test="netValue != null">
        net_value = #{netValue,jdbcType=DECIMAL},
      </if>
      <if test="assetBack != null">
        asset_back = #{assetBack,jdbcType=DECIMAL},
      </if>
      <if test="activeBack != null">
        active_back = #{activeBack,jdbcType=DECIMAL},
      </if>
      <if test="indexInvest != null">
        index_invest = #{indexInvest,jdbcType=DECIMAL},
      </if>
      <if test="fundInvest != null">
        fund_invest = #{fundInvest,jdbcType=DECIMAL},
      </if>
      <if test="metalInvest != null">
        metal_invest = #{metalInvest,jdbcType=DECIMAL},
      </if>
      <if test="hkStock != null">
        hk_stock = #{hkStock,jdbcType=DECIMAL},
      </if>
      <if test="sSeg != null">
        S_SEG = #{sSeg,jdbcType=BIGINT},
      </if>
      <if test="sRowVersion != null">
        S_ROW_VERSION = #{sRowVersion,jdbcType=BIGINT},
      </if>
      <if test="sUpdateTime != null">
        S_UPDATE_TIME = #{sUpdateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="sDataState != null">
        S_DATA_STATE = #{sDataState,jdbcType=SMALLINT},
      </if>
    </trim>
  </insert>
</mapper>