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

    <resultMap type="cn.ezhizao.project.business.domain.BizStorageCode" id="BizStorageCodeResult">
        <id column="id" property="id"/>
    </resultMap>
    <select id="getList" parameterType="BizStorageCode" resultMap="BizStorageCodeResult">
        SELECT * FROM biz_storage_code
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            deleted = 0
            <if test="year != null  and year != ''"> AND year = #{year}</if>
            <if test="qcCode != null  and qcCode != ''"> AND qc_code = #{qcCode}</if>
            <if test="code != null  and code != ''"> AND code like concat('%',#{code},'%')</if>
            <if test="serialNumber != null "> AND serial_number = #{serialNumber}</if>
            <if test="isPrint != null "> AND is_print = #{isPrint}</if>
            <if test="tenantId != null and tenantId != 0 "> AND tenant_id = #{tenantId}</if>
        </trim>
        order by year, serial_number
    </select>

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