<?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.chinaitop.depot.intelligent.grainsituation.mapper.TemperImportMapper" >
    <select id="getNameId" parameterType="java.util.Map" resultType="java.util.HashMap">
        SELECT
        org_id depotid
        FROM
        org_info
        WHERE org_name = #{depotName}
    </select>
    <select id="getEnumId" parameterType="java.util.Map" resultType="java.util.HashMap">
        SELECT
        enumId
        FROM
        basic_enum
        WHERE
        parentId = #{parentId}
        AND enumName = #{enumName}
    </select>
    <select id="getEnumChildId" parameterType="java.util.Map" resultType="java.util.HashMap">
        SELECT
        enumId
        FROM
        basic_enum
        WHERE
        parentId = (
        SELECT
        enumId
        FROM
        basic_enum
        WHERE
        parentId = #{parentId}
        AND gbCode = (
        SELECT
        substr(enumCode, 1, 1)
        FROM
        basic_enum
        WHERE
        parentId = #{parentId}
        AND enumName = #{enumName}
        )
        )
        AND enumName = #{enumName}
    </select>
    <select id="getStorehouseId" parameterType="java.util.Map" resultType="java.util.HashMap">
        SELECT
        storehouse_id storehouseid,
        storehouse_code storehouse
        FROM
        basic_storehouse
        WHERE del_flag = 1
        AND depot_id = #{depotId}
        AND storehouse_name = #{storehouseName}
    </select>
    <select id="getWarehouseId" parameterType="java.util.Map" resultType="java.util.HashMap">
        SELECT
        whouse.warehouse_id warehouseId,
        warehouse_code house
        FROM
        basic_warehouse whouse
        LEFT JOIN basic_storehouse shouse ON shouse.storehouse_id = whouse.storehouse_id
        WHERE whouse.del_flag = 1
        AND shouse.del_flag = 1
        AND whouse.warehouse_name = #{warehouseName}
        AND shouse.storehouse_id = #{storehouseId}
    </select>
</mapper>