
using SafeCampus.Application.Services.Business.DepartmentService;

namespace SafeCampus.Web.Core.Controllers.Application.Business;
/// <summary>
///系部管理接口
/// </summary>
[ApiDescriptionSettings(ApiGroupConsts.SYSTEM_Business, Order = 83, Tag = "系部管理")]
[Route("/business/department")]
[RolePermission]
public class DepartmentController 
{
    private readonly IDepartmentService _departmentService;

    public DepartmentController(IDepartmentService departmentService)
    {
        _departmentService = departmentService;
    }

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

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

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

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

    /// <summary>
    /// 获取列表
    /// </summary>
    /// <returns></returns>
    public async Task<SqlSugarPagedList<DepartmentDto>> GetPageList(DepartmentSearch search)
    {
        return await _departmentService.GetPageList(search);
    }

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