using SafeCampus.Application.Services.Business.MajorService;

namespace SafeCampus.Web.Core.Controllers.Application.Business;
/// <summary>
///专业管理接口
/// </summary>
[ApiDescriptionSettings(ApiGroupConsts.SYSTEM_Business, Order = 82, Tag = "专业管理")]
[Route("/business/major")]
[RolePermission]
public class MajorController
{
    private readonly IMajorService _majorService;

    public MajorController(IMajorService majorService)
    {
        _majorService = majorService;
    }

    /// <summary>
    /// 添加
    /// </summary>
    /// <param name="input">添加参数</param>
    /// <returns></returns>
    public async Task<bool> Add(MajorDto input)
    {
        return await _majorService.Add(input);
    }

    /// <summary>
    /// 修改
    /// </summary>
    /// <param name="input">添加参数</param>
    /// <returns></returns>
    public async Task<bool> Update(MajorDto input)
    {
        return await _majorService.Update(input);
    }

    /// <summary>
    /// 获取详情
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public async Task<MajorDto> GetInfo(long id)
    {
        return await _majorService.GetInfo(id);
    }

    /// <summary>
    /// 删除
    /// </summary>
    /// <param name="id">id</param>
    /// <returns></returns>
    [HttpPost]
    public async Task<bool> Delete(BaseIdListInput id)
    {
        return await _majorService.Delete(id.Ids);
    }

    /// <summary>
    /// 获取列表
    /// </summary>
    /// <returns></returns>
    public async Task<SqlSugarPagedList<MajorDto>> GetPageList(MajorSearch search)
    {
        return await _majorService.GetPageList(search);
    }

    /// <summary>
    /// 获取列表不分页
    /// </summary>
    /// <param name="search"></param>
    /// <returns></returns>
    public async Task<List<MajorDto>> GetNoPageList(MajorSearch search)
    {
        return await _majorService.GetNoPageList(search);
    }
}