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

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


    <select id="getList" parameterType="BizOutsourcedOrder" resultMap="BizOutsourcedOrderResult">
        SELECT * FROM biz_outsourced_order
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            deleted = 0 and is_submit = 1
            <if test="supplierId != null and supplierId != ''"> AND supplier_id = #{supplierId}</if>
            <if test="formCode != null and formCode != ''"> AND form_code LIKE CONCAT('%', #{formCode}, '%')</if>
            <if test="formStartDate != null"> AND form_date &gt;= DATE_FORMAT(#{formStartDate}, '%Y-%m-%d')</if>
            <if test="formEndDate != null"> AND form_date &lt;= DATE_FORMAT(#{formEndDate}, '%Y-%m-%d')</if>
            <if test="settlementType != null and settlementType != ''"> AND settlement_type = #{settlementType}</if>
            <if test="deliveryMethod != null and deliveryMethod != ''"> AND delivery_method = #{deliveryMethod}</if>
            <if test="packagingMethod != null and packagingMethod != ''"> AND packaging_method = #{packagingMethod}</if>
        </trim>
    </select>

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