<?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.copy.trade.dao.RiskControlMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.copy.trade.entity.po.RiskControl">
    <result column="id" property="id" />
    <result column="created_time" property="createdTime" />
    <result column="updated_time" property="updatedTime" />
        <result column="customer_id" property="customerId" />
        <result column="follow_id" property="followId" />
        <result column="leverage" property="leverage" />
        <result column="trading_amount" property="tradingAmount" />
        <result column="trading_mode" property="tradingMode" />
        <result column="stop_loss_percentage" property="stopLossPercentage" />
        <result column="stop_profit_percentage" property="stopProfitPercentage" />
        <result column="max_copied_amount" property="maxCopiedAmount" />
    </resultMap>
    
    <update id="updateRiskControlById">
		update risk_control rc 
			set rc.leverage=#{riskControl.leverage}, 
		      rc.max_copied_amount=#{riskControl.maxCopiedAmount},
		      rc.stop_loss_percentage=#{riskControl.stopLossPercentage}, 
		      rc.stop_profit_percentage=#{riskControl.stopProfitPercentage},
		      rc.trading_mode=#{riskControl.tradingMode},
		      rc.trading_amount=#{riskControl.tradingAmount}
		where id = #{riskControl.id}
    </update>

</mapper>
