package com.fuint.repository.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.fuint.repository.model.MtTableInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 餐桌信息 Mapper 接口
 *
 * Created by pzg
 * CopyRight https://www.fuint.cn
 */
public interface MtTableInfoMapper extends BaseMapper<MtTableInfo> {



    //根据分类id查询
    @Select("SELECT * FROM mt_table_info WHERE category_id = #{categoryId} AND delete_flag = 0")
    List<MtTableInfo> findByCategoryId(@Param("categoryId") Long categoryId);


    /**
     * 检查指定条件的记录是否存在
     * @param queryWrapper 查询条件
     * @return 是否存在符合条件的记录
     */
    @Select("SELECT 1 FROM mt_table_info ${ew.customSqlSegment} LIMIT 1")
    Boolean exists(@Param(Constants.WRAPPER) Wrapper<MtTableInfo> queryWrapper);
}