<?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.SetupTensionStraightenerMapper">

    <resultMap type="com.fizz.business.domain.SetupTensionStraightener" id="SetupTensionStraightenerResult">
        <result property="steelGrade"    column="steel_grade"    />
        <result property="thick"    column="thick"    />
        <result property="yieldStren"    column="yield_stren"    />
        <result property="value1"    column="value1"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectSetupTensionStraightenerVo">
        select steel_grade, thick, yield_stren, value1, create_time, update_time from setup_tension_straightener
    </sql>

    <select id="selectList" parameterType="com.fizz.business.domain.SetupTensionStraightener" resultMap="SetupTensionStraightenerResult">
        <include refid="selectSetupTensionStraightenerVo"/>
        <where>
            <if test="steelGrade != null  and steelGrade != ''"> and steel_grade like concat('%', #{steelGrade}, '%')</if>
            <if test="thick != null "> and thick = #{thick}</if>
            <if test="yieldStren != null "> and yield_stren = #{yieldStren}</if>
        </where>
    </select>

    <select id="selectByKey" resultMap="SetupTensionStraightenerResult">
        <include refid="selectSetupTensionStraightenerVo"/>
        where steel_grade = #{steelGrade} and thick = #{thick} and yield_stren = #{yieldStren}
    </select>

    <insert id="insert" parameterType="com.fizz.business.domain.SetupTensionStraightener">
        insert into setup_tension_straightener
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="steelGrade != null and steelGrade != ''">steel_grade,</if>
            <if test="thick != null">thick,</if>
            <if test="yieldStren != null">yield_stren,</if>
            <if test="value1 != null">value1,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="steelGrade != null and steelGrade != ''">#{steelGrade},</if>
            <if test="thick != null">#{thick},</if>
            <if test="yieldStren != null">#{yieldStren},</if>
            <if test="value1 != null">#{value1},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>

    <update id="updateByKey" parameterType="com.fizz.business.domain.SetupTensionStraightener">
        update setup_tension_straightener
        <trim prefix="SET" suffixOverrides=",">
            <if test="value1 != null">value1 = #{value1},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where steel_grade = #{steelGrade} and thick = #{thick} and yield_stren = #{yieldStren}
    </update>

    <delete id="deleteByKey">
        delete from setup_tension_straightener where steel_grade = #{steelGrade} and thick = #{thick} and yield_stren = #{yieldStren}
    </delete>
</mapper>
