feat 公开获取营业点
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据厂区获取营业点列表
|
||||
/// </summary>
|
||||
/// <param name="factory"></param>
|
||||
/// <param name="catalog"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list")]
|
||||
[IgnoreTenant]
|
||||
public async Task<List<BusinessPlaceOpenResponse>> GetListAsync(string factory,
|
||||
[EnumDataType(typeof(CanteenBusinessPlaceCatalogEnumType))]
|
||||
CanteenBusinessPlaceCatalogEnumType catalog)
|
||||
{
|
||||
return await _dbContext.Queryable<BusinessPlaceEntity>().Where(x => x.TenantId == factory).Where(x => x.Catalog == catalog).Select(x => new BusinessPlaceOpenResponse
|
||||
{
|
||||
CustomCode = x.CustomCode,
|
||||
Name = x.Name,
|
||||
Catalog = x.Catalog
|
||||
}).ToListAsync();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
|
||||
namespace Dlhis.External.OpenApi.Response;
|
||||
|
||||
public class BusinessPlaceOpenResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 编码
|
||||
/// </summary>
|
||||
public string CustomCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分类
|
||||
/// </summary>
|
||||
public CanteenBusinessPlaceCatalogEnumType Catalog { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分类中文
|
||||
/// </summary>
|
||||
public string CatalogDesc => Catalog.GetDescription();
|
||||
}
|
||||
Reference in New Issue
Block a user