package cn.ysk.cashier.mybatis.mapper;

import cn.ysk.cashier.mybatis.entity.TbCallQueue;
import cn.ysk.cashier.mybatis.vo.CallRecordVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Select;

/**
* @author Administrator
* @description 针对表【tb_call_queue】的数据库操作Mapper
* @createDate 2024-09-12 15:34:30
* @Entity cn.ysk.cashier.mybatis.entity.TbCallQueue
*/
public interface TbCallQueueMapper extends BaseMapper<TbCallQueue> {

    @Select("select a.*, b.note, TIMESTAMPDIFF(SECOND, a.create_time, NOW()) as since_at from tb_call_queue a " +
            "left join tb_call_table b on a.call_table_id=b.id " +
            "where a.shop_id=#{shopId} and a.state in (3, 2, 1) order by a.create_time desc")
    Page<CallRecordVO> selectCallRecord(Integer shopId, Integer callTableId, Page<Object> objectPage);
}




