43 lines
1.4 KiB
C#
43 lines
1.4 KiB
C#
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();
|
|
}
|
|
} |