init 项目代码初始化
This commit is contained in:
69
Src/Dlhis.Canteen/Setting/Controllers/SettingController.cs
Normal file
69
Src/Dlhis.Canteen/Setting/Controllers/SettingController.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using Dlhis.Canteen.Setting.Request;
|
||||
using Dlhis.Canteen.Setting.Response;
|
||||
using Dlhis.Canteen.Setting.Services;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.Canteen.Setting.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 就餐配置
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class SettingController : ControllerBase
|
||||
{
|
||||
private readonly ICanteenSettingService _settingService;
|
||||
|
||||
public SettingController(ICanteenSettingService settingService)
|
||||
{
|
||||
_settingService = settingService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 配置分页
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
public async Task<Pagination<CanteenSettingResponse>> GetPageAsync([FromQuery] CanteenSettingPageRequest request)
|
||||
{
|
||||
return await _settingService.GetPageAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 配置保存
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("save")]
|
||||
public async Task SaveSettingAsync(CanteenSettingSaveRequest request)
|
||||
{
|
||||
await _settingService.SaveSettingAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 配置启用状态
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut("enable")]
|
||||
public async Task SetEnableAsync(CanteenSettingSetEnableRequest request)
|
||||
{
|
||||
await _settingService.SetEnableAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户配置
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("user")]
|
||||
public async Task<Dictionary<CanteenSettingItemEnumType, string>> GetUserSettingAsync(string userId)
|
||||
{
|
||||
return await _settingService.GetUserSettingAsync(userId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user