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

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


    <select id="getList" parameterType="BizTaksStockStorageRetrieval" resultMap="BizTaksStockStorageRetrievalResult">
        SELECT t1.*,t2.dept_name,t3.nick_name as storager_name FROM biz_taks_stock_storage_retrieval t1 left join sys_dept t2 on t1.dept_id = t2.dept_id
        left join sys_user t3 on t1.storager_id = t3.user_id
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            t1.deleted = 0 and t1.take_stock_period_id = #{takeStockPeriodId}
            <if test="productDescription != null  and productDescription != ''"> AND t1.product_description = #{productDescription}</if>
            <if test="drawingNumber != null  and drawingNumber != ''"> AND t1.drawing_number = #{drawingNumber}</if>
            <if test="lotCode != null  and lotCode != ''"> AND t1.lot_code = #{lotCode}</if>
            <if test="technologyVersion != null  and technologyVersion != ''"> AND t1.technology_version = #{technologyVersion}</if>
            <if test="storageNum != null "> AND t1.storage_num = #{storageNum}</if>
            <if test="status != null "> AND t1.status = #{status}</if>
            <if test="retrievalLotCode != null  and retrievalLotCode != ''"> AND t1.retrieval_lot_code = #{retrievalLotCode}</if>
            <if test="retrievalTime != null "> AND t1.retrieval_time = #{retrievalTime}</if>
        </trim>
    </select>

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