<?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.zbkj.service.dao.HomeDao">

    <select id="selectHomeType" resultType="com.zbkj.common.vo.HomeVo">
        select id, name, title, direct_url directUrl, img_url imgUrl, jump_ids jumpIds, jump_type jumpType
        from eb_home
        where del_flag = 1 and type = #{homeType} order by order_no
    </select>

    <select id="selectPageSetMealType" resultType="com.zbkj.common.response.SetMealResponse">
        select t.id cid, t.name from (
          select c.id, c.name, c.sort from eb_home h
          INNER JOIN eb_home_products hp on h.id = hp.home_id
          INNER JOIN eb_category c on h.business = c.id
          where h.del_flag = 1 and hp.del_flag = 1 and h.type = 2
          group by h.business
        ) t order by t.sort
    </select>

    <select id="selectPageSetMealFloor" resultType="com.zbkj.common.vo.HomeVo">
        select h.id, h.name, h.title, h.direct_url directUrl, h.img_url imgUrl, h.jump_ids jumpIds, h.jump_type jumpType
        from eb_home h
        where h.del_flag = 1 and h.type = 2 and h.business = #{entity.cid} order by h.order_no
    </select>

</mapper>
