diff --git a/Src/Dlhis.External/OpenApi/Controllers/BusinessPlacesController.cs b/Src/Dlhis.External/OpenApi/Controllers/BusinessPlacesController.cs new file mode 100644 index 00000000..503c0faf --- /dev/null +++ b/Src/Dlhis.External/OpenApi/Controllers/BusinessPlacesController.cs @@ -0,0 +1,43 @@ +using System.ComponentModel.DataAnnotations; +using Dlhis.Entity.Basic.Entity; +using Dlhis.Entity.Canteen.Enums; +using Dlhis.External.OpenApi.Response; +using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop; +using Kurisu.AspNetCore.DataAccess.SqlSugar.Services; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; + +namespace Dlhis.External.OpenApi.Controllers; + +[Authorize] +[Route("api/[controller]")] +[ApiController] +public class BusinessPlacesController : ControllerBase +{ + private readonly IDbContext _dbContext; + + public BusinessPlacesController(IDbContext dbContext) + { + _dbContext = dbContext; + } + + /// + /// 根据厂区获取营业点列表 + /// + /// + /// + /// + [HttpGet("list")] + [IgnoreTenant] + public async Task> GetListAsync(string factory, + [EnumDataType(typeof(CanteenBusinessPlaceCatalogEnumType))] + CanteenBusinessPlaceCatalogEnumType catalog) + { + return await _dbContext.Queryable().Where(x => x.TenantId == factory).Where(x => x.Catalog == catalog).Select(x => new BusinessPlaceOpenResponse + { + CustomCode = x.CustomCode, + Name = x.Name, + Catalog = x.Catalog + }).ToListAsync(); + } +} \ No newline at end of file diff --git a/Src/Dlhis.External/OpenApi/Response/BusinessPlaceOpenResponse.cs b/Src/Dlhis.External/OpenApi/Response/BusinessPlaceOpenResponse.cs new file mode 100644 index 00000000..9f7ef469 --- /dev/null +++ b/Src/Dlhis.External/OpenApi/Response/BusinessPlaceOpenResponse.cs @@ -0,0 +1,27 @@ +using Dlhis.Entity.Canteen.Enums; +using Kurisu.AspNetCore.Utils.Extensions; + +namespace Dlhis.External.OpenApi.Response; + +public class BusinessPlaceOpenResponse +{ + /// + /// 编码 + /// + public string CustomCode { get; set; } + + /// + /// 名称 + /// + public string Name { get; set; } + + /// + /// 分类 + /// + public CanteenBusinessPlaceCatalogEnumType Catalog { get; set; } + + /// + /// 分类中文 + /// + public string CatalogDesc => Catalog.GetDescription(); +} \ No newline at end of file