using Fake.Application;
using Microsoft.AspNetCore.Mvc;
using Oms.Application.Dtos.System;
using Oms.Domain.SystemAggregate.Repositories;
namespace Oms.Application.Services.System;
///
/// 国家 API 服务。
///
[ApiExplorerSettings(GroupName = "OMS-System")]
public class CountryService : ApplicationService
{
private ICountryRepository CountryRepository => LazyServiceProvider.GetRequiredService();
///
/// 查询国家列表。
///
/// 国家列表,返回全部有效国家主数据。
[HttpGet("/system/country/list")]
public async Task> GetListAsync()
{
return (await CountryRepository.GetListAsync())
.OrderBy(x => x.CountryCode)
.ThenBy(x => x.EnglishName)
.Select(x => new CountryOutput
{
Id = x.Id,
ChineseName = x.ChineseName,
EnglishName = x.EnglishName,
CountryCode = x.CountryCode
})
.ToList();
}
}