<?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="org.springblade.modules.business.mapper.FacilityMapper">

    <select id="selectFacilityPage" resultType="org.springblade.modules.business.vo.FacilityVO">
        select * from t_facility where is_delete = 0
    </select>

    <select id="selectGoods" resultType="org.springblade.modules.mall.vo.GoodsInfoVO">
        SELECT
            gi.id,
            gi.goods_name,
            gi.goods_cover,
            fcw.goods_store totalStock,
            fcw.discount,
            fcw.sale_price,
            fcw.id cargoWayId,
            fcw.cargo_no cargoWayNo
        FROM
            t_facility_cargo_way fcw
                JOIN t_goods_info gi ON fcw.goods_id = gi.id
        where fcw.facility_id = #{deviceId}
        <if test="cargoWayId != null">
            and fcw.id = #{cargoWayId}
        </if>
    </select>

</mapper>
