Student.Core.API/Controllers/StudentInfoController.cs

(开头部分) 5KB

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

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

namespace Student.Core.API.Controllers
{
    [Description("学生信息")]
    public class StudentInfoController : ControllerAbstract
    {
        private readonly Lazy<IStudentInfoService> StudentInfoService;
        public StudentInfoController(ILogger<ControllerAbstract> logger, Lazy<IStudentInfoService> studentInfoService) : base(logger)
        {
            StudentInfoService = studentInfoService;
        }
        
        [Description("根据ID获取指定学生信息")]
        [OperationId("获取学生信息")]
        [Parameters(name = "id", param = "学生ID")]
        [ResponseCache(Duration = 0)]
        [HttpGet("{id}")]
        public async Task<IResultModel> Query([Required]long id)
        {
            _logger.LogDebug($"根据ID获取指定学生信息{id}");
            return await StudentInfoService.Value.GetByIdAsync(id);
        }

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

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

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

AI 解读 AI

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

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