namespace Tiobon.Core.Api.Controllers;

/// <summary>
/// 培训记录(Controller)
/// </summary>
[Route("api/[controller]")]
[ApiController, GlobalActionFilter]
[Authorize(Permissions.Name), ApiExplorerSettings(GroupName = Grouping.GroupName_Ghre)]
public class Ghre_CertificateController : BaseController<IGhre_CertificateServices, Ghre_Certificate, Ghre_CertificateDto, InsertGhre_CertificateInput, EditGhre_CertificateInput>
{
    public Ghre_CertificateController(IGhre_CertificateServices service) : base(service)
    {
    }

    [HttpPost("QueryControl")]
    public ServiceResult<List<Ghre_CertificateControl>> QueryControl()
    {
        return _service.QueryControl();
    }

    #region 根据条件查询数据
    /// <summary>
    /// 根据条件查询数据
    /// </summary>
    /// <param name="RuleId">RuleId</param>
    /// <param name="body">条件</param>
    /// <returns></returns>
    [HttpPost, Route("QueryByRuleId/{RuleId}")]
    public async Task<ServicePageResult<Ghre_CertificateDto>> Query(long RuleId, [FromBody] QueryBody body)
    {
        return await _service.QueryFilterPage(body, $"CertificateRuleId='{RuleId}'");
    }

    #endregion
}