Insert data if and only if there is no duplicate data in the mysql database
P粉883278265
P粉883278265 2023-09-13 18:17:33
0
1
336

<insert id="insertStockOrderAbusingList" parameterType="java.util.List">
    INSERT IGNORE INTO iruda_trade.stock_order_abusing (
        market_day,
        uid,
        stock_account_id,
        order_number,
        symbol,
        conclusion_quantity,
        order_type,
        created_at
    ) VALUES
    <foreach collection="list" item="item" index="index" separator=",">
    (
            #{item.transactionDate},
            #{item.uid},
            #{item.stockAccountId},
            #{item.transactionNumber},
            #{item.symbol},
            #{item.filledVolume},
            #{item.transactionType},
            #{item.clientTimeStamp}
     )
     </foreach>
</insert>

I'm trying to insert data into mySQL DB. If the transactionDate, transactionNumber and uid in the parameters are also the same as the market_day, order_number, uid in the stock_order_abusing table column, then there will be no insertion or the insertion should be ignored. There is no pk (primary key) to compare. All methods in Google tell me that there should be primary key to prevent duplicate insertion. Is there any way to solve this problem?

P粉883278265
P粉883278265

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!