<?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="cn.ezhizao.project.business.mapper.BizFurnaceNoInfoMapper">

    <resultMap type="cn.ezhizao.project.business.domain.BizFurnaceNoInfo" id="BizFurnaceNoInfoResult">
        <id column="id" property="id"/>
    </resultMap>


    <select id="getList" parameterType="BizFurnaceNoInfo" resultType="cn.ezhizao.project.business.domain.BizFurnaceNoInfo">
        SELECT * FROM biz_furnace_no_info
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            deleted = 0
            <if test="productionPlanNo != null  and productionPlanNo != ''"> AND production_plan_no = #{productionPlanNo}</if>
            <if test="lineNumber != null  and lineNumber != ''"> AND line_number = #{lineNumber}</if>
            <if test="factory != null  and factory != ''"> AND factory = #{factory}</if>
            <if test="furnaceNumber != null  and furnaceNumber != ''"> AND furnace_number = #{furnaceNumber}</if>
            <if test="brandNumber != null  and brandNumber != ''"> AND brand_number = #{brandNumber}</if>
            <if test="spec != null  and spec != ''"> AND spec = #{spec}</if>
            <if test="diameter != null  and diameter != ''"> AND diameter = #{diameter}</if>
            <if test="shape != null  and shape != ''"> AND shape = #{shape}</if>
            <if test="firstTechnicalRequirement != null  and firstTechnicalRequirement != ''"> AND first_technical_requirement = #{firstTechnicalRequirement}</if>
            <if test="secondTechnicalRequirement != null  and secondTechnicalRequirement != ''"> AND second_technical_requirement = #{secondTechnicalRequirement}</if>
            <if test="rawMaterialCode != null  and rawMaterialCode != ''"> AND raw_material_code = #{rawMaterialCode}</if>
            <if test="incomingDate != null  and incomingDate != ''"> AND incoming_date = #{incomingDate}</if>
            <if test="dayworkId != null  and dayworkId != 0"> AND daywork_id = #{dayworkId}</if>
        </trim>
    </select>

    <update id="removeSpecial" parameterType="java.util.List">
        UPDATE biz_furnace_no_info
        SET deleted = 1
        WHERE daywork_id IN
        <foreach collection="firstDayworkIds" item="daywork" index="index" open="(" separator="," close=")">
            #{daywork}
        </foreach>
    </update>

    <delete id="physicalDelete">
        DELETE FROM biz_furnace_no_info
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            <if test="id != null">
                id = #{id} AND
            </if>
            <!-- 删除条件为其他外键可以在这里加 -->
        </trim>
    </delete>
</mapper>
