namespace Tiobon.Core.Api.Controllers;

/// <summary>
/// 培训讲师异动(Controller)
/// </summary>
[Route("api/[controller]")]
[ApiController, GlobalActionFilter]
[Authorize(Permissions.Name), ApiExplorerSettings(GroupName = Grouping.GroupName_Ghre)]
public class Ghre_TeacherChangeController : BaseController<IGhre_TeacherChangeServices, Ghre_TeacherChange, Ghre_TeacherChangeDto, InsertGhre_TeacherChangeInput, EditGhre_TeacherChangeInput>
{
    public Ghre_TeacherChangeController(IGhre_TeacherChangeServices service) : base(service)
    {
    }
    #region 查询 
    [HttpPost("QueryDisabled")]
    public async Task<ServicePageResult<Ghre_TeacherChangeDto>> QueryDisabled([FromBody] QueryBody body)
    {
        return await _service.QueryFilterPage(body, null, false);
    }
    #endregion

    #region 查询
    /// <summary>
    /// 根据条件查询数据
    /// </summary>
    /// <param name="body">条件</param>
    /// <param name="status">status</param>
    /// <returns></returns>
    [HttpPost, Route("QueryList/{status}")]
    public async Task<ServicePageResult<Ghre_TeacherChangeDto>> QueryByStatus([FromBody] QueryBody body, string status)
    {
        return await _service.QueryFilterPage(body, $"Status ='{status}'");
    }
    #endregion

    #region 状态修改 
    [HttpPost("UpdateStatus/{status}")]
    public async Task<ServiceResult> UpdateStatus(string status, [FromBody] InsertGhre_TeacherChangeInput input)
    {
        return await _service.UpdateStatus(input, status);
    }
    #endregion 

    #region 新增 
    [HttpPost("Insert/{status}")]
    public async Task<ServiceResult<long>> InsertByStatus([FromBody] InsertGhre_TeacherChangeInput insertModel, string status)
    {
        return await _service.InsertByStatus(insertModel, status);
    }
    #endregion 

    #region 查询
    [HttpPost("QueryLast/{teacherId}")]
    public async Task<ServiceResult<Ghre_TeacherChangeDto>> QueryLast(int teacherId)
    {
        return await _service.QueryLast(teacherId);
    }
    #endregion 
}