You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.2 KiB

using GDZZ.Core;
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using System.Linq;
using System.Threading.Tasks;
using GDZZ.Application.Entity;
using Microsoft.AspNetCore.Authorization;
using System.Collections.Generic;
namespace GDZZ.Application
{
/// <summary>
/// 地区表服务
/// </summary>
[ApiDescriptionSettings("Application",Name = "SysRegion", Order = 1)]
public class SysRegionService : ISysRegionService, IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<SysRegion> _rep;
public SysRegionService(SqlSugarRepository<SysRegion> rep)
{
_rep = rep;
}
/// <summary>
/// 查询所有城市列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet("/SysRegion/list")]
[AllowAnonymous]
public async Task<List<SysRegionOutput>> list()
{
var entities = await _rep.AsQueryable().Where(x => x.region_level == 2).ToArrayAsync();
return entities.Adapt<List<SysRegionOutput>>();
}
}
}