<?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.fzm.mall.server.admin.opration.mapper.FloorGoodsMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.fzm.mall.server.admin.opration.model.FloorGoods">
        <id column="id" property="id" />
        <result column="operation_floor_id" property="operationFloorId" />
        <result column="goods_id" property="goodsId" />
        <result column="display_order" property="displayOrder" />
        <result column="status" property="status" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
    </resultMap>

    <select id="listAll" resultMap="BaseResultMap">
        select f.id, f.operation_floor_id, f.goods_id, f.display_order, f.create_time, f.update_time, f.status,
               s.name, s.description, s.thumb
        from opration_floor_goods f
        left join goods_spu s on f.goods_id = s.goods_id
        where f.operation_floor_id = #{operationFloorId} and f.status = false and s.status = 1
        order by f.display_order asc, f.update_time desc
    </select>
</mapper>
