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

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


    <select id="getList" parameterType="BizOutsourcedRecords" resultMap="BizOutsourcedRecordsResult">
        SELECT * FROM biz_outsourced_records
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            deleted = 0
            <if test="masterId != null "> AND master_id = #{masterId}</if>
            <if test="userName != null  and userName != ''"> AND user_name like concat('%', #{userName}, '%')</if>
            <if test="nickName != null  and nickName != ''"> AND nick_name like concat('%', #{nickName}, '%')</if>
            <if test="method != null  and method != ''"> AND method = #{method}</if>
            <if test="formCode != null  and formCode != ''"> AND form_code = #{formCode}</if>
            <if test="supplierName != null  and supplierName != ''"> AND supplier_name like concat('%', #{supplierName}, '%')</if>
            <if test="lotCode != null  and lotCode != ''"> AND lot_code = #{lotCode}</if>
            <if test="productDescription != null  and productDescription != ''"> AND product_description = #{productDescription}</if>
            <if test="productNum != null "> AND product_num = #{productNum}</if>
            <if test="newCarrier != null  and newCarrier != ''"> AND new_carrier = #{newCarrier}</if>
            <if test="processNames != null  and processNames != ''"> AND process_names = #{processNames}</if>
        </trim>
        order by start_time desc
    </select>

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