<?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.simuwang.base.mapper.ValuationTableAttributeMapper">
    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.ValuationTableAttributeDO">
        <id column="id" property="id"/>
        <result column="valuation_id" property="valuationId"/>
        <result column="subject_code" property="subjectCode"/>
        <result column="subject_name" property="subjectName"/>
        <result column="currency" property="currency"/>
        <result column="exchange_rate" property="exchangeRate"/>
        <result column="securities_amount" property="securitiesAmount"/>
        <result column="unit_cost" property="unitCost"/>
        <result column="ori_currency_cost" property="oriCurrencyCost"/>
        <result column="net_cost" property="netCost"/>
        <result column="net_cost_ratio" property="netCostRatio"/>
        <result column="market_price" property="marketPrice"/>
        <result column="ori_currency_market_value" property="oriCurrencyMarketValue"/>
        <result column="market_value" property="marketValue"/>
        <result column="market_value_ratio" property="marketValueRatio"/>
        <result column="ori_currency_increment" property="oriCurrencyIncrement"/>
        <result column="increment" property="increment"/>
        <result column="halt_info" property="haltInfo"/>
        <result column="rights_interests_info" property="rightsInterestsInfo"/>
        <result column="isvalid" property="isvalid"/>
        <result column="creatorid" property="creatorId"/>
        <result column="createtime" property="createTime"/>
        <result column="updaterid" property="updaterId"/>
        <result column="updatetime" property="updateTime"/>
    </resultMap>

    <delete id="deleteByValuationId">
        delete
        from PPW_EMAIL.valuation_table_attribute
        where valuation_id = #{valuationId}
          and isvalid = 1
    </delete>

    <insert id="batchInsert" parameterType="com.simuwang.base.pojo.dos.ValuationTableAttributeDO">
        insert into PPW_EMAIL.valuation_table_attribute(valuation_id, subject_code, subject_name, currency, exchange_rate, securities_amount,
                                                        unit_cost, ori_currency_cost, net_cost, net_cost_ratio, market_price, ori_currency_market_value,
                                                        market_value, market_value_ratio, ori_currency_increment, increment, halt_info, rights_interests_info,
                                                        isvalid, creatorid, createtime, updaterid, updatetime)
        values
        <foreach collection="itemDoList" item="itemDo" index="index" separator=",">
            (#{itemDo.valuationId},#{itemDo.subjectCode},#{itemDo.subjectName},#{itemDo.currency},#{itemDo.exchangeRate},#{itemDo.securitiesAmount},
             #{itemDo.unitCost},#{itemDo.oriCurrencyCost},#{itemDo.netCost},#{itemDo.netCostRatio},#{itemDo.marketPrice},#{itemDo.oriCurrencyMarketValue},
             #{itemDo.marketValue},#{itemDo.marketValueRatio},#{itemDo.oriCurrencyIncrement},#{itemDo.increment},#{itemDo.haltInfo},#{itemDo.rightsInterestsInfo},
            #{itemDo.isvalid}, #{itemDo.creatorId}, #{itemDo.createTime}, #{itemDo.updaterId}, #{itemDo.updateTime})
        </foreach>
    </insert>


</mapper>