<?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.technologicalProcess.mapper.BizTechnologicalProcessMapper">

    <resultMap type="cn.ezhizao.project.business.technologicalProcess.domain.BizTechnologicalProcess" id="BizTechnologicalProcessResult">
        <id column="id" property="id"/>
    </resultMap>


    <select id="getList" parameterType="BizTechnologicalProcess" resultMap="BizTechnologicalProcessResult">
        SELECT * FROM biz_technological_process
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            deleted = 0
            <if test="productShaftCategory != null  and productShaftCategory != ''"> AND product_shaft_category = #{productShaftCategory}</if>
            <if test="productShaftCategoryName != null  and productShaftCategoryName != ''"> AND product_shaft_category_name like concat('%', #{productShaftCategoryName}, '%')</if>
            <if test="productSpecification != null  and productSpecification != ''"> AND product_specification = #{productSpecification}</if>
            <if test="productDrawingNumber != null  and productDrawingNumber != ''"> AND product_drawing_number = #{productDrawingNumber}</if>
            <if test="productId != null  and productId != ''"> AND product_id = #{productId}</if>
            <if test="productDescription != null  and productDescription != ''"> AND product_description = #{productDescription}</if>
            <if test="creatorCode != null  and creatorCode != ''"> AND creator_code = #{creatorCode}</if>
            <if test="updaterCode != null  and updaterCode != ''"> AND updater_code = #{updaterCode}</if>
            <if test="tenantId != null  and tenantId != 0"> AND tenant_id = #{tenantId}</if>
            <if test="isHistory != null"> AND is_history = #{isHistory}</if>
        </trim>
    </select>

    <select id="getTechnological"  parameterType="BizTechnologicalProcess" resultMap="BizTechnologicalProcessResult">
        SELECT technology_version as Label,id as `Value` FROM biz_technological_process where deleted = 0 and product_id = #{productId} and is_history = 0
    </select>
    <delete id="physicalDelete">
        DELETE FROM biz_technological_process
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            <if test="id != null">
                id = #{id} AND
            </if>
       <!-- 删除条件为其他外键可以在这里加 -->
        </trim>
    </delete>
</mapper>
