<?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.order.mapper.BizArchiveInputDetailProcessMapper">

    <resultMap type="cn.ezhizao.project.business.order.domain.BizArchiveInputDetailProcess" id="BizArchiveInputDetailProcessResult">
        <id column="id" property="id"/>
    </resultMap>


    <select id="getList" parameterType="BizArchiveInputDetailProcess" resultMap="BizArchiveInputDetailProcessResult">
        SELECT t1.*, t2.name as task_type_detail_name FROM biz_archive_input_detail_process t1
        left join biz_task_type_detail t2 on t2.id = t1.task_type_detail_id
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            t1.deleted = 0
            <if test="amount != null "> AND t1.amount = #{amount}</if>
            <if test="companyId != null "> AND t1.company_id = #{companyId}</if>
            <if test="contractId != null "> AND t1.contract_id = #{contractId}</if>
            <if test="contractDetailId != null "> AND t1.contract_detail_id = #{contractDetailId}</if>
        </trim>
    </select>

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