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

    <resultMap type="cn.ezhizao.project.business.domain.BizOutsourcedOrderDetail" id="BizOutsourcedOrderDetailResult">
        <id column="id" property="id"/>
        <result property="dayworkId" column="daywork_id"/>
        <association property="processNames" column="id" select="getProcessNames"/>
        <association property="receiptNum" column="id" select="getReceiptNum"/>
        <association property="furnaceNumber" column="daywork_id" select="getFurnaceNumber"/>
        <association property="planType" javaType="java.lang.String" column="production_plan_detail_id" select="getPlanType" />
        <collection property="processes" ofType="cn.ezhizao.project.business.domain.BizOutsourcedOrderDetailProcess" column="id" select="getProcess"/>
        <collection property="finishedProcesses" ofType="cn.ezhizao.project.business.domain.BizOutsourcedOrderDetailProcess" column="id" select="getFinishedProcess"/>
        <collection property="returnReceiptDetailList" column="id" ofType="cn.ezhizao.project.business.domain.BizReturnReceiptDetail" select="getReturnReceiptDetailList"/>
    </resultMap>
    <resultMap type="cn.ezhizao.project.business.domain.BizOutsourcedOrderDetail" id="BizOutsourcedOrderDetailTurnoverResult">
        <id column="id" property="id"/>
        <result property="dayworkId" column="daywork_id"/>
        <association property="processNames" column="id" select="getProcessNames"/>
        <association property="receiptNum" column="id" select="getReceiptNum"/>
        <association property="furnaceNumber" column="daywork_id" select="getFurnaceNumber"/>
        <association property="planType" javaType="java.lang.String" column="production_plan_detail_id" select="getPlanType" />
    </resultMap>
    <resultMap type="cn.ezhizao.project.business.domain.BizOutsourcedOrderDetail" id="BizOutsourcedOrderDetailInnerResult">
        <id column="id" property="id"/>
        <result property="dayworkId" column="daywork_id"/>
        <association property="processNames" column="id" select="getProcessNames"/>
        <association property="receiptNum" column="id" select="getReceiptNum"/>
        <association property="furnaceNumber" column="daywork_id" select="getFurnaceNumber"/>
        <association property="dayworkItemId" column="daywork_id" select="getDayworkItemId"/>
        <association property="technologicalProcessDetailId" column="daywork_id" select="getTechnologicalProcessDetailId"/>
        <association property="processId" column="daywork_id" select="getProcessId"/>
        <association property="processAlias" column="daywork_id" select="getProcessAlias"/>
        <association property="hasNextInfo" column="{id=id,dayworkId=daywork_id}" select="getNextInfo"/>
        <association property="isPackage" column="{masterId=master_id,dayworkId=daywork_id}" select="getPackage"/>
        <collection property="processes" ofType="cn.ezhizao.project.business.domain.BizOutsourcedOrderDetailProcess" column="id" select="getProcess"/>
        <collection property="finishedProcesses" ofType="cn.ezhizao.project.business.domain.BizOutsourcedOrderDetailProcess" column="id" select="getFinishedProcess"/>
        <collection property="returnReceiptDetailList" column="id" ofType="cn.ezhizao.project.business.domain.BizReturnReceiptDetail" select="getReturnReceiptDetailList"/>
    </resultMap>

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

    <select id="getPlanType" resultType="java.lang.String">
        SELECT plan_type FROM biz_production_plan_detail
        WHERE id = #{production_plan_detail_id}
    </select>

    <select id="getFinishedReturnList" parameterType="BizOutsourcedOrderDetail" resultMap="BizOutsourcedOrderDetailTurnoverResult">
        SELECT DISTINCT
        t1.daywork_id,
        t1.master_id,
        t1.id,
        t1.lot_code,
        t1.lot_id,
        t3.form_date,
        t3.form_code as returnFormCode,
        t1.supplier_name,
        t1.supplier_id,
        t1.product_description,
        t2.dept_name AS productionDeptName,
        t1.production_carrier,
<!--        (select GROUP_CONCAT(carrier_code SEPARATOR ',') from biz_daywork_carrier where is_changed = 0
and deleted = 0 and daywork_id = t1.daywork_id and process_inspection_id = 0) as new_carrier_name,-->
        t1.product_id,
        t1.production_dept_id,
        t1.packaging_method AS packagingMethod,
        t4.production_plan_detail_id,
        t4.technological_process_id,
        t4.dept_id
<!--        (select id from biz_daywork_item where daywork_id = t1.daywork_id and deleted = 0 order by process_step_number desc limit 1)
 as dayworkItemId,-->
<!--        (select status from biz_process_inspecion t where t.daywork_id = t1.daywork_id and t.type = 'outsourcedInspector'
 and t1.id = t.outsource_order_detail_id and t.deleted = 0 order by t.create_time desc limit 1) as inspectionStatus,-->
<!--        (-->
<!--        SELECT-->
<!--        audit_num-->
<!--        FROM-->
<!--        biz_return_receipt_detail-->
<!--        WHERE-->
<!--        t1.id = biz_return_receipt_detail.outsource_detail_id-->
<!--        AND biz_return_receipt_detail.deleted = 0-->
<!--        ORDER BY-->
<!--        biz_return_receipt_detail.process_step_number DESC-->
<!--        LIMIT 1-->
<!--        ) AS auditNum,-->
<!--        (-->
<!--        SELECT-->
<!--        biz_return_receipt.remark-->
<!--        FROM-->
<!--        biz_return_receipt left join biz_return_receipt_detail on biz_return_receipt.id = biz_return_receipt_detail.master_id-->
<!--        WHERE-->
<!--        biz_return_receipt.id = t3.master_id-->
<!--        AND biz_return_receipt_detail.deleted = 0-->
<!--        LIMIT 1-->
<!--        ) AS remark-->
        FROM
        biz_outsourced_order_detail t1
        LEFT JOIN sys_dept t2 ON t2.dept_id = t1.production_dept_id
        LEFT JOIN biz_return_receipt_detail t3 ON t3.outsource_detail_id = t1.id
        left join biz_daywork t4 on t4.id = t1.daywork_id
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            t1.deleted = 0 and t3.deleted = 0 and t3.is_audit = 1
            <!-- 且未完成最后一道序 -->
<!--            and t4.status &lt; 2-->
            <if test="tenantId != null and tenantId != 0 "> AND t1.tenant_id = #{tenantId}</if>
            <if test="returnFormCode != null  and returnFormCode != ''"> AND t3.form_code like concat('%', #{returnFormCode}, '%')</if>
            <if test="productDescription != null "> AND t1.product_description like concat('%', #{productDescription}, '%')</if>
            <if test="supplierName != null  and supplierName != ''"> AND t1.supplier_name like concat('%', #{supplierName}, '%')</if>
            <if test="newCarrierName != null  and newCarrierName != '' ">
                    AND case when t1.production_dept_id = 0 then t1.new_carrier_name like concat('%', #{newCarrierName}, '%') else t1.production_carrier like concat('%', #{newCarrierName}, '%') END
            </if>
            <if test="lotCode != null  and lotCode != ''"> AND t1.lot_code like concat('%', #{lotCode}, '%')</if>
            <if test="formCode != null"> AND t3.form_code like concat('%', #{formCode}, '%')</if>
            <if test="startTime != null ">AND t3.form_date &gt;= #{startTime}</if>
            <if test="endTime != null ">AND t3.form_date &lt;= #{endTime}</if>
            <if test="statusValue == 1">AND t1.production_dept_id = 0</if>
            <if test="statusValue == 2">AND t1.production_dept_id != 0</if>
            <if test="inspectionStatus != null and inspectionStatus != -1">AND (select t.status from biz_process_inspecion t where t.daywork_id = t1.daywork_id and t.type = 'outsourcedInspector' and t.deleted = 0 and t1.id = t.outsource_order_detail_id  order by t.create_time desc limit 1) = #{inspectionStatus}</if>
            <if test="inspectionStatus != null and inspectionStatus == -1">  AND NOT EXISTS (
                SELECT 1
                FROM biz_process_inspecion t
                WHERE t.daywork_id = t1.daywork_id
                and t.type = 'outsourcedInspector' and t1.id = t.outsource_order_detail_id and t.deleted = 0
                )</if>
            <if test="flags != null and flags.size() > 0">
                AND
                <foreach collection="flags" item="flag" separator=" OR " open="(" close=")">
                    <if test="flag != null and flag == 2"> t4.is_amend= 1</if>
                    <if test="flag != null and flag == 1"> t4.is_waste_recycling= 1</if>
                    <if test="flag != null and flag == 4"> t4.is_superaddition= 1</if>
<!--                    <if test="flag != null and flag == 0"> t4.is_waste= 1</if>-->
                    <if test="flag != null and flag == 3"> t4.is_waste_recycling= 0 and t4.is_amend = 0 and t4.is_superaddition = 0 </if>
                    <!--                    t1.is_waste_recycling = #{flag} OR t1.is_waste = #{flag} OR t1.is_amend = #{flag}-->
                </foreach>
            </if>
        </trim>
        ORDER BY t3.create_time DESC
    </select>
    <select id="getDayworkItemId" resultType="long">
        SELECT id FROM biz_daywork_item WHERE daywork_id = #{dayworkId} AND deleted = 0 ORDER BY process_step_number DESC, create_time DESC LIMIT 1
    </select>
    <select id="getList" parameterType="BizOutsourcedOrderDetail" resultMap="BizOutsourcedOrderDetailResult">
        SELECT t1.*,t2.is_waste_recycling,t2.is_waste,t2.is_amend,t2.is_superaddition FROM biz_outsourced_order_detail t1
        left join biz_lot t2 on t1.lot_id = t2.id
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            t1.deleted = 0 and t2.deleted = 0
            <if test="masterId != null "> AND t1.master_id = #{masterId}</if>
            <if test="formCode != null  and formCode != ''"> AND t1.form_code = #{formCode}</if>
            <if test="formDate != null "> AND t1.form_date = #{formDate}</if>
            <if test="supplierName != null  and supplierName != ''"> AND t1.supplier_name like concat('%', #{supplierName}, '%')</if>
            <if test="deliveryMethod != null "> AND t1.delivery_method = #{deliveryMethod}</if>
            <if test="packagingMethod != null  and packagingMethod != ''"> AND t1.packaging_method = #{packagingMethod}</if>
            <if test="productDescription != null  and productDescription != ''"> AND t1.product_description = #{productDescription}</if>
            <if test="technologyVersion != null  and technologyVersion != ''"> AND t1.technology_version = #{technologyVersion}</if>
            <if test="originalCarrier != null  and originalCarrier != ''"> AND t1.original_carrier = #{originalCarrier}</if>
            <if test="originalCarrierCount != null "> AND t1.original_carrier_count = #{originalCarrierCount}</if>
            <if test="newCarrier != null  and newCarrier != ''"> AND t1.new_carrier = #{newCarrier}</if>
            <if test="newCarrierCount != null "> AND t1.new_carrier_count = #{newCarrierCount}</if>
        </trim>
    </select>
    <select id="getTechnologicalProcessDetailId" resultType="long">
        select technological_process_detail_id from biz_daywork_item where deleted = 0 and daywork_id = #{dayworkId} order by process_step_number desc, create_time desc limit 1
    </select>
    <select id="getProcessId" resultType="long">
        select process_id from biz_daywork_item where deleted = 0 and daywork_id = #{dayworkId} order by process_step_number desc, create_time desc limit 1
    </select>
    <select id="getProcessAlias" resultType="String">
        select t2.process_alias from biz_daywork_item t1 left join biz_process t2 on t1.process_id = t2.id where t1.deleted = 0 and t1.daywork_id = #{dayworkId} order by t1.process_step_number desc, t1.create_time desc limit 1
    </select>
    <select id="getInnerList" parameterType="BizOutsourcedOrderDetail" resultMap="BizOutsourcedOrderDetailInnerResult">
        SELECT t1.*,t2.is_waste_recycling,t2.is_waste,t2.is_amend,t2.is_superaddition FROM biz_outsourced_order_detail t1
        left join biz_lot t2 on t1.lot_id = t2.id
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            t1.deleted = 0 and t2.deleted = 0
            <if test="masterId != null "> AND t1.master_id = #{masterId}</if>
            <if test="formCode != null  and formCode != ''"> AND t1.form_code = #{formCode}</if>
            <if test="formDate != null "> AND t1.form_date = #{formDate}</if>
            <if test="supplierName != null  and supplierName != ''"> AND t1.supplier_name like concat('%', #{supplierName}, '%')</if>
            <if test="deliveryMethod != null "> AND t1.delivery_method = #{deliveryMethod}</if>
            <if test="packagingMethod != null  and packagingMethod != ''"> AND t1.packaging_method = #{packagingMethod}</if>
            <if test="productDescription != null  and productDescription != ''"> AND t1.product_description = #{productDescription}</if>
            <if test="technologyVersion != null  and technologyVersion != ''"> AND t1.technology_version = #{technologyVersion}</if>
            <if test="originalCarrier != null  and originalCarrier != ''"> AND t1.original_carrier = #{originalCarrier}</if>
            <if test="originalCarrierCount != null "> AND t1.original_carrier_count = #{originalCarrierCount}</if>
            <if test="newCarrier != null  and newCarrier != ''"> AND t1.new_carrier = #{newCarrier}</if>
            <if test="newCarrierCount != null "> AND t1.new_carrier_count = #{newCarrierCount}</if>
        </trim>
    </select>
    <select id="getPackage" resultType="integer">
        select count(1) from biz_daywork_item_examine where deleted = 0 and dept_id = (select outsource_dept_id from biz_outsourced_order where deleted = 0 and id = #{masterId}) and daywork_id = #{dayworkId}
    </select>
    <select id="getListForReceipt" parameterType="BizOutsourcedOrderDetail" resultMap="BizOutsourcedOrderDetailResult">
        SELECT
        t1.*
        FROM biz_outsourced_order_detail t1 left join biz_outsourced_order t2 on t1.master_id = t2.id
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            t1.deleted = 0 and t2.deleted = 0 and t2.is_submit = 1
            <if test="existingOutsourceDetailIds != null and existingOutsourceDetailIds.size > 0">
                AND t1.id NOT IN
                <foreach collection="existingOutsourceDetailIds" index="index" item="id" separator="," open="(" close=")">
                    #{id,jdbcType=BIGINT}
                </foreach>
            </if>
            <if test="notFinishedDetailIds != null and notFinishedDetailIds.size > 0">
                AND t1.id NOT IN
                <foreach collection="notFinishedDetailIds" index="index" item="id" separator="," open="(" close=")">
                    #{id,jdbcType=BIGINT}
                </foreach>
            </if>
            <if test="alreadyAddedDetailIds != null and alreadyAddedDetailIds.size > 0">
                AND t1.id NOT IN
                <foreach collection="alreadyAddedDetailIds" index="index" item="id" separator="," open="(" close=")">
                    #{id,jdbcType=BIGINT}
                </foreach>
            </if>
            <if test="productDescription != null  and productDescription != ''"> AND t1.product_description LIKE CONCAT('%', #{productDescription}, '%')</if>
            <if test="lotCode != null "> AND t1.lot_code LIKE CONCAT('%', #{lotCode}, '%')</if>
            <if test="originalCarrier != null "> AND t1.original_carrier LIKE CONCAT('%', #{originalCarrier}, '%')</if>
            <if test="newCarrier != null "> AND t1.new_carrier_name LIKE CONCAT('%', #{newCarrier}, '%')</if>
            <if test="supplierId != null "> AND t1.supplier_id = #{supplierId}</if>
            <if test="tenantId != null and tenantId != 0 "> AND t1.tenant_id = #{tenantId}</if>
        </trim>
    </select>
    <select id="getListForAllReceipt" parameterType="BizOutsourcedOrderDetail" resultMap="BizOutsourcedOrderDetailResult">
        SELECT
        t1.*
        FROM biz_outsourced_order_detail t1
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            t1.deleted = 0
            <if test="existingOutsourceDetailIds != null and existingOutsourceDetailIds.size > 0">
                AND t1.id NOT IN
                <foreach collection="existingOutsourceDetailIds" index="index" item="id" separator="," open="(" close=")">
                    #{id,jdbcType=BIGINT}
                </foreach>
            </if>
            <if test="alreadyAddedDetailIds != null and alreadyAddedDetailIds.size > 0">
                AND t1.id NOT IN
                <foreach collection="alreadyAddedDetailIds" index="index" item="id" separator="," open="(" close=")">
                    #{id,jdbcType=BIGINT}
                </foreach>
            </if>
            <if test="productDescription != null  and productDescription != ''"> AND t1.product_description LIKE CONCAT('%', #{productDescription}, '%')</if>
            <if test="lotCode != null "> AND t1.lot_code LIKE CONCAT('%', #{lotCode}, '%')</if>
            <if test="originalCarrier != null "> AND t1.original_carrier LIKE CONCAT('%', #{originalCarrier}, '%')</if>
            <if test="newCarrier != null "> AND t1.new_carrier_name LIKE CONCAT('%', #{newCarrier}, '%')</if>
            <if test="supplierId != null "> AND t1.supplier_id = #{supplierId}</if>
        </trim>
    </select>
    <select id="getNextInfo" resultType="boolean">
        SELECT CASE WHEN COUNT(1) > 1 THEN true ELSE false END as hasNextInfo
        FROM biz_daywork_item
        WHERE daywork_id = #{dayworkId}
        AND deleted = 0
        AND outsource_detail_id = #{id}
    </select>
    <select id="getFinishedOutsourceDetailList" parameterType="BizOutsourcedOrderDetail" resultMap="BizOutsourcedOrderDetailResult">
        SELECT distinct t1.id,t1.lot_code,t1.product_description,t1.original_carrier,t1.new_carrier,t1.create_time,t1.daywork_id,t1.supplier_name,
        (select form_date from biz_return_receipt_detail where biz_return_receipt_detail.outsource_detail_id = t1.id and biz_return_receipt_detail.deleted = 0 and t1.deleted = 0 limit 1) as form_date
        FROM biz_outsourced_order_detail t1 left join biz_outsourced_order_detail_process t2 on t1.id = t2.detail_id
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            t1.deleted = 0
            <if test="formCode != null  and formCode != ''"> AND t1.form_code = #{formCode}</if>
            <if test="startTime != null "> AND (
                SELECT brrd.form_date
                FROM biz_return_receipt_detail brrd
                WHERE brrd.outsource_detail_id = t1.id
                AND brrd.deleted = 0
                AND t1.deleted = 0
                LIMIT 1
                ) > #{startTime}</if>
            <if test="endTime != null "> AND (
                SELECT brrd.form_date
                FROM biz_return_receipt_detail brrd
                WHERE brrd.outsource_detail_id = t1.id
                AND brrd.deleted = 0
                AND t1.deleted = 0
                LIMIT 1
                ) &lt; #{endTime}</if>
            <if test="notFinishedDetailIds != null and notFinishedDetailIds.size > 0">
                AND t1.id NOT IN
                <foreach collection="notFinishedDetailIds" index="index" item="id" separator="," open="(" close=")">
                    #{id,jdbcType=BIGINT}
                </foreach>
            </if>
            <if test="supplierName != null  and supplierName != ''"> AND t1.supplier_name like concat('%', #{supplierName}, '%')</if>
            <if test="lotCode != null "> AND t1.lot_code like concat('%', #{lotCode}, '%')</if>
            <if test="packagingMethod != null  and packagingMethod != ''"> AND t1.packaging_method = #{packagingMethod}</if>
            <if test="productDescription != null  and productDescription != ''"> AND t1.product_description like concat('%', #{productDescription}, '%')</if>
            <if test="technologyVersion != null  and technologyVersion != ''"> AND t1.technology_version = #{technologyVersion}</if>
            <if test="originalCarrier != null  and originalCarrier != ''"> AND t1.original_carrier = #{originalCarrier}</if>
            <if test="originalCarrierCount != null "> AND t1.original_carrier_count = #{originalCarrierCount}</if>
            <if test="newCarrier != null  and newCarrier != ''"> AND t1.new_carrier = #{newCarrier}</if>
            <if test="newCarrierCount != null "> AND t1.new_carrier_count = #{newCarrierCount}</if>
        </trim>
        order by t1.create_time desc
    </select>


<!-- 根据批次号和发出单号查询biz_outsourced_order_detail表中production_dept_id为0并且根据biz_outsourced_order_detail的id查询biz_return_receipt_detail表中不存或status=0的记录，返回结果集
-->
    <select id="getOutsourceDetailList" parameterType="BizOutsourcedOrderDetail" resultMap="BizOutsourcedOrderDetailResult">
        SELECT t1.*
        FROM biz_outsourced_order_detail t1 left join biz_return_receipt_detail t2 on t1.id = t2.outsource_detail_id
        LEFT JOIN  biz_task_stock_lot t3 on t1.lot_id = t3.lot_id
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            t1.deleted = 0 and t1.production_dept_id = 0 and t3.status >2 and t3.deleted = 0 and t3.
            <if test="outsourceFormNo != null  and outsourceFormNo != ''"> AND t1.form_code = #{outsourceFormNo}</if>
            <if test="lotCode != null "> AND t1.lot_code like concat('%', #{lotCode}, '%')</if>
        </trim>
        order by t1.create_time ASC
    </select>

    <select id="getProcessNames" resultType="String">
        SELECT
        GROUP_CONCAT(t.process_alias order by t.process_step_number asc)
        FROM biz_outsourced_order_detail_process t
        WHERE t.detail_id = #{id} and deleted = 0
    </select>


    <select id="getFurnaceNumber" resultType="String">
        SELECT furnace_number
        FROM biz_furnace_no_info t1
        WHERE t1.daywork_id = #{daywork_id} and t1.deleted = 0
    </select>

    <select id="getReceiptNum" resultType="Integer">
        SELECT t1.qualified_num as receiptNum
        FROM biz_outsourced_order_detail_process t1
        WHERE t1.detail_id = #{id} order by t1.process_step_number desc limit 1
    </select>
    <select id="getReturnReceiptDetailList" resultType="cn.ezhizao.project.business.domain.BizReturnReceiptDetail">
        select * from biz_return_receipt_detail
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            deleted = 0
            <if test="id != null"> AND outsource_detail_id = #{id}</if>
        </trim>
        order by process_step_number
    </select>
    <select id="getProcess" resultMap="BizOutsourcedOrderDetailProcessResult">
        SELECT distinct t1.* FROM biz_outsourced_order_detail_process t1
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            t1.deleted = 0
            <if test="id != null"> AND t1.detail_id = #{id}</if>
        </trim>
        order by t1.process_step_number asc
    </select>
    <select id="getFinishedProcess" resultMap="BizOutsourcedOrderDetailProcessResult">
        SELECT distinct t1.*,t2.id as returnReceiptDetailId FROM biz_outsourced_order_detail_process t1 left join biz_return_receipt_detail t2 on t1.daywork_id = t2.daywork_id and t1.process_step_number = t2.process_step_number
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            t1.deleted = 0 and t2.deleted = 0
            <if test="id != null"> AND t1.detail_id = #{id}</if>
        </trim>
        order by t1.process_step_number asc
    </select>

    <update id="removeByMasterIds" parameterType="java.util.List">
        UPDATE biz_outsourced_order_detail set deleted = 1
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            master_id in
            <foreach collection="ids" item="masterId" open="(" separator="," close=")">
                #{masterId}
            </foreach>
        </trim>
    </update>

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