<?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="com.shkj.wms.mapper.BaseStorageMapper">

    <resultMap type="com.shkj.wms.vo.BaseStorageVo" id="BaseStorageResult">
            <result property="id" column="id"/>
            <result property="storageType" column="storage_type"/>
            <result property="storageName" column="storage_name"/>
            <result property="extend1" column="extend1"/>
            <result property="extend2" column="extend2"/>
            <result property="extend3" column="extend3"/>
            <result property="extend4" column="extend4"/>
            <result property="extend5" column="extend5"/>
            <result property="remark" column="remark"/>
            <result property="branchId" column="branch_id"/>
            <result property="isDel" column="is_del"/>
            <result property="createTime" column="create_time"/>
            <result property="createBy" column="create_by"/>
            <result property="updateTime" column="update_time"/>
            <result property="updateBy" column="update_by"/>
    </resultMap>

        <select id="queryBaseStorageList" resultMap="BaseStorageResult">
                SELECT
                    bs.*
                FROM
                    base_storage bs
                where bs.is_del = '0'
                <if test="storageType != null">
                    and bs.storage_type = #{storageType}
                </if>
                <if test="storageStatus != null">
                    and bs.storage_status = #{storageStatus}
                </if>
                <if test="storageCode != null">
                    AND LOWER(bs.storage_code) like LOWER(concat('%', #{storageCode}, '%'))
                </if>
                ${branchParams.dataScopeBranch}
                order by bs.create_time DESC
        </select>
    <select id="queryBaseStorageListA" resultMap="BaseStorageResult">
        SELECT
        bs.*
        FROM
        base_storage bs
        where bs.is_del = '0'
        <if test="storageType != null">
            and bs.storage_type = #{storageType}
        </if>
        <if test="storageStatus != null">
            and bs.storage_status = #{storageStatus}
        </if>
        AND (bs.branch_id = 2 )

        order by bs.create_time DESC
    </select>
</mapper>