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

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


    <select id="getList" parameterType="BizLotTechnologicalProcessDetail" resultMap="BizTechnologicalAmendDetailResult">
        SELECT * FROM biz_lot_technological_process_detail
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            deleted = 0
            <if test="lotTechnologicalProcessId != null">AND lot_technological_process_id = #{lotTechnologicalProcessId}</if>

        </trim>
    </select>

    <select id="getProcessList" parameterType="BizLotTechnologicalProcessDetail" resultMap="BizTechnologicalAmendDetailResult">
        SELECT * FROM biz_lot_technological_process_detail
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            deleted = 0
            <if test="tenantId != null" > AND tenant_id = #{tenantId}</if>
            <if test="technologicalProcessId != null">AND lot_technological_process_id = #{technologicalProcessId}</if>
            <if test="processStepNumber != null  and processStepNumber!=''">AND process_step_number > #{processStepNumber}</if>
            <if test="keyword != null  and keyword != ''">AND (process_key LIKE concat('%', #{keyword}, '%')or
                process_alias LIKE concat('%', #{keyword}, '%'))
            </if>
        </trim>
        order by process_step_number
    </select>




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