Student.Core.API/Controllers/DepartController.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Student.Core.API.Code.Attributes;
using Student.DTO;
using Student.IServices;
using yrjw.ORM.Chimp.Result;

namespace Student.Core.API.Controllers
{
    [Description("部门信息")]
    public class DepartController : ControllerAbstract
    {
        private readonly Lazy<IDepartService> DepartService;
        public DepartController(ILogger<ControllerAbstract> logger, Lazy<IDepartService> departService) : base(logger)
        {
            DepartService = departService;
        }

        [Description("通过指定部门ID,返回该部门信息")]
        [OperationId("获取部门信息")]
        [Parameters(name="id", param = "部门ID")]
        [ResponseCache(Duration = 0)]
        [HttpGet("{id}")]
        public async Task<IResultModel> Query([Required]int id)
        {
            _logger.LogDebug($"根据ID获取指定部门{id}");
            return await DepartService.Value.GetByIdAsync(id);
        }

        [Description("获取全部部门列表")]
        [ResponseCache(Duration = 0)]
        [HttpGet]
        public async Task<IResultModel> GetListAll()
        {
            _logger.LogDebug($"获取全部部门列表");
            return await DepartService.Value.GetListAllAsync();
        }

        [Description("获取所有班级列表")]
        [ResponseCache(Duration = 0)]
        [HttpGet("GetClassesList")]
        public async Task<IResultModel> GetClassesList()
        {
            _logger.LogDebug($"获取所有班级列表");
            return await DepartService.Value.GetClassesListAsync();
        }

        [Description("获取部门分页列表")]
        [Parameters(name = "pageIndex", param = "索引页")]
        [Parameters(name = "pageSize", param = "单页条数")]
        [Parameters(name = "search", param = "检索条件")]
        [ResponseCache(Duration = 0)]
        [HttpGet("{pageIndex}/{pageSize}/{search?}")]
        public async Task<IResultModel> GetPagedList([Required]int pageIndex, int pageSize, string search)
后面还有 43 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。