<?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.njzscloud.dispose.wh.mapper.WarehouseMapper">
    <resultMap id="BaseResultMap" type="com.njzscloud.dispose.wh.pojo.result.WarehouseResult">
        <id column="id" property="id"/>
        <result column="warehouse_name" property="warehouseName"/>
        <result column="type" property="type" typeHandler="com.njzscloud.common.mp.support.handler.j.DictItemTypeHandler"/>
        <result column="station_id" property="stationId"/>
        <result column="station_name" property="stationName"/>
        <result column="location" property="location"/>
        <result column="max_capacity" property="maxCapacity"/>
        <result column="remark" property="remark"/>
        <result column="creator_id" property="creatorId"/>
        <result column="modifier_id" property="modifierId"/>
        <result column="create_time" property="createTime"/>
        <result column="modify_time" property="modifyTime"/>
        <result column="deleted" property="deleted"/>
    </resultMap>

    <sql id="Base_Column_List">
        SELECT ww.id             AS id,
               ww.warehouse_name AS warehouse_name,
               ww.type           AS type,
               ww.station_id     AS station_id,
               cs.station_name   AS station_name,
               ww.location       AS location,
               ww.max_capacity   AS max_capacity,
               ww.remark         AS remark,
               ww.creator_id     AS creator_id,
               ww.modifier_id    AS modifier_id,
               ww.create_time    AS create_time,
               ww.modify_time    AS modify_time,
               ww.deleted        AS deleted
        FROM wh_warehouse ww
                 LEFT JOIN cst_station cs ON cs.id = ww.station_id
    </sql>

    <select id="detail" resultMap="BaseResultMap">
        <include refid="Base_Column_List"/>
        WHERE ww.id = #{id}
    </select>

    <select id="paging" resultMap="BaseResultMap">
        <include refid="Base_Column_List"/>
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
        </if>
    </select>
</mapper>
