package shop.alien.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import shop.alien.entity.store.TagCategory;
import shop.alien.entity.store.vo.StoreMenuVo;
import shop.alien.entity.store.vo.TagCategoryVo;

import java.util.List;

/**
 * 标签 Mapper 接口
 */
public interface TagCategoryMapper extends BaseMapper<TagCategory> {

    /**
     * 获取菜单
     *
     * @param businessSection  门店id
     * @return List<StoreMenuVo>
     */
    //"图片类型, 0:其他, 1:入口图, 2:相册, 3:菜品, 4:环境, 5:价目表, 6:推荐菜, 7:菜单, 8:用户评论, 9:商家申诉, 10:商家头像, 11:店铺轮播图"
    @Select("select tc.*, tbr.business_section,tbr.business_section_name, case when tc.label_type = 'infrastructure' then '基础设施' when tc.label_type = 'storeIntroduction' then '门店介绍' else '基础设施' end as label_name from tag_business_relation tbr left join tag_category tc on tc.id = tbr.tag_id and tc.delete_flag =0  where tbr.business_section  = #{businessSection} and tbr.delete_flag = 0 order by tc.tag_sort")
    List<TagCategoryVo> getBusinessRelationTagList(@Param("businessSection") Integer businessSection);
}
