<?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.fizz.business.mapper.SetupTmBendforceMapper">

    <resultMap type="SetupTmBendforce" id="SetupTmBendforceResult">
        <result property="width"    column="width"    />
        <result property="rollForce"    column="roll_force"    />
        <result property="value1"    column="value1"    />
        <result property="value2"    column="value2"    />
        <result property="value3"    column="value3"    />
        <result property="value4"    column="value4"    />
        <result property="updateTime"    column="update_time"    />
        <result property="createTime"    column="create_time"    />
    </resultMap>

    <sql id="selectSetupTmBendforceVo">
        select width, roll_force, value1, value2, value3, value4, update_time, create_time from setup_tm_bendforce
    </sql>

    <select id="selectSetupTmBendforceList" parameterType="SetupTmBendforce" resultMap="SetupTmBendforceResult">
        <include refid="selectSetupTmBendforceVo"/>
        <where>
            <if test="value1 != null "> and value1 = #{value1}</if>
            <if test="value2 != null "> and value2 = #{value2}</if>
            <if test="value3 != null "> and value3 = #{value3}</if>
            <if test="value4 != null "> and value4 = #{value4}</if>
        </where>
    </select>

    <select id="selectSetupTmBendforceByWidth" parameterType="Long" resultMap="SetupTmBendforceResult">
        <include refid="selectSetupTmBendforceVo"/>
        <where>
            <if test="width != null ">and width = #{width}</if>
            <if test="rollForce != null ">and roll_force = #{rollForce}</if>
        </where>
    </select>

    <insert id="insertSetupTmBendforce" parameterType="SetupTmBendforce">
        insert into setup_tm_bendforce
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="width != null">width,</if>
            <if test="rollForce != null">roll_force,</if>
            <if test="value1 != null">value1,</if>
            <if test="value2 != null">value2,</if>
            <if test="value3 != null">value3,</if>
            <if test="value4 != null">value4,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="createTime != null">create_time,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="width != null">#{width},</if>
            <if test="rollForce != null">#{rollForce},</if>
            <if test="value1 != null">#{value1},</if>
            <if test="value2 != null">#{value2},</if>
            <if test="value3 != null">#{value3},</if>
            <if test="value4 != null">#{value4},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="createTime != null">#{createTime},</if>
        </trim>
    </insert>

    <update id="updateSetupTmBendforce" parameterType="SetupTmBendforce">
        update setup_tm_bendforce
        <trim prefix="SET" suffixOverrides=",">
            <if test="value1 != null">value1 = #{value1},</if>
            <if test="value2 != null">value2 = #{value2},</if>
            <if test="value3 != null">value3 = #{value3},</if>
            <if test="value4 != null">value4 = #{value4},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
        </trim>
        where width = #{width} and roll_force = #{rollForce}
    </update>

    <delete id="deleteSetupTmBendforceByWidth" parameterType="Long">
        delete from setup_tm_bendforce where width = #{width}
    </delete>

    <delete id="deleteSetupTmBendforceByWidths" parameterType="String">
        DELETE FROM setup_tm_bendforce
        WHERE
        <foreach item="item" index="index" collection="widths" open="(" separator=") OR (" close=")">
            width = #{widths[${index}]}
            AND roll_force = #{rollForces[${index}]}
        </foreach>
    </delete>

</mapper>