package org.ta.pddserver.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.ta.pddserver.entity.GDTicketEntity;
import org.ta.pddserver.model.api.request.CollectOutMailDetailIoRequest;
import org.ta.pddserver.model.api.request.TicketListRequest;
import org.ta.pddserver.model.api.response.CollectOutMailDetailIoListResponse;
import org.ta.pddserver.model.api.response.TicketListResponse;

import java.util.List;

@Mapper
public interface GDTicketMapper extends BaseMapper<GDTicketEntity> {

    @Select("SELECT * FROM `gd_ticket` WHERE `ticket_id` = #{ticketId};")
    GDTicketEntity findByTicketId(Long ticketId);

    @Select("SELECT COUNT(*) FROM `gd_ticket`")
    Integer countUsable(TicketListRequest param);

    @Select("SELECT `uid`, `title`, `ticket_id`, `waybill_no`, `description`, `create_at`, `update_at` FROM `gd_ticket` ORDER BY `update_at` DESC LIMIT #{offset}, #{size} ")
    List<GDTicketEntity> getListByRequest(TicketListRequest param);
}
