<?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.sckw.order.dao.KwpWantBuyTradingMapper">

    <insert id="insertBatch">
        insert into kwo_want_buy_trading
        <trim prefix="(" suffix=")" suffixOverrides=",">
            id,
            want_buy_id,
            trading,
            remark,
            status,
            create_by,
            create_time,
            update_by,
            update_time,
            del_flag
        </trim>
        values
        <foreach collection="list" item="item" separator=",">
            <trim prefix="(" suffix=")" suffixOverrides=",">
                #{item.id,jdbcType=BIGINT},
                #{item.wantBuyId,jdbcType=BIGINT},
                #{item.trading,jdbcType=VARCHAR},
                #{item.remark,jdbcType=VARCHAR},
                #{item.status,jdbcType=INTEGER},
                #{item.createBy,jdbcType=BIGINT},
                #{item.createTime,jdbcType=TIMESTAMP},
                #{item.updateBy,jdbcType=BIGINT},
                #{item.updateTime,jdbcType=TIMESTAMP},
                #{item.delFlag,jdbcType=INTEGER}
            </trim>
        </foreach>
    </insert>

    <select id="findWantBuyTrading" resultType="com.sckw.order.model.KwoWantBuyTrading" parameterType="com.sckw.order.model.KwoWantBuyTrading" >
        SELECT
        id, want_buy_id wantBuyId, trading, remark, status
        from kwo_want_buy_trading
        where del_flag = 0
        <if test="wantBuyId != null and wantBuyId != ''">
            and want_buy_id = #{wantBuyId, jdbcType=VARCHAR}
        </if>
    </select>
</mapper>