管理端船公司下拉接口

usertest
cjy 3 months ago
parent 9e512a1085
commit 5430161cf5

@ -16,16 +16,30 @@ namespace DS.WMS.AdminApi.Controllers;
public class CommonController : ApiController public class CommonController : ApiController
{ {
private readonly ICommonService _invokeService; private readonly ICommonService _invokeService;
private readonly IServerCommonService _serverService;
/// <summary> /// <summary>
/// 构造函数 /// 构造函数
/// </summary> /// </summary>
/// <param name="invokeService"></param> /// <param name="invokeService"></param>
public CommonController(ICommonService invokeService) public CommonController(ICommonService invokeService, IServerCommonService serverService)
{ {
_invokeService = invokeService; _invokeService = invokeService;
_serverService = serverService;
} }
/// <summary>
/// 获取船公司下拉列表
/// </summary>
/// <param name="queryKey">船公司代码或中文名称</param>
/// <returns></returns>
[HttpGet]
[Route("GetCarrierSelectList")]
public async Task<DataResult<List<CodeCarrierRes>>> GetCarrierSelectList([FromQuery] string queryKey)
{
var res = await _serverService.GetCodeCarrierSelectList(queryKey);
return res;
}
/// <summary> /// <summary>
/// 用户登录-管理端 /// 用户登录-管理端
/// </summary> /// </summary>

@ -0,0 +1,23 @@
using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.WMS.Core.Code.Dtos;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Info.Dtos;
using DS.WMS.Core.Op.Dtos;
using DS.WMS.Core.Sys.Dtos;
using DS.WMS.Core.Sys.Entity;
using SqlSugar;
namespace DS.WMS.Core.Sys.Interface;
/// <summary>
///
/// </summary>
public interface IServerCommonService
{
/// <summary>
/// 获取船公司下拉列表-管理端
/// </summary>
/// <returns></returns>
public Task<DataResult<List<CodeCarrierRes>>> GetCodeCarrierSelectList(string queryKey = "");
}

@ -1,6 +1,5 @@
using DS.Module.Core; using DS.Module.Core;
using DS.Module.Core.Constants; using DS.Module.Core.Constants;
using DS.Module.Core.Data;
using DS.Module.Core.Extensions; using DS.Module.Core.Extensions;
using DS.Module.Core.Log; using DS.Module.Core.Log;
using DS.Module.SqlSugar; using DS.Module.SqlSugar;
@ -11,21 +10,14 @@ using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Entity; using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Info.Dtos; using DS.WMS.Core.Info.Dtos;
using DS.WMS.Core.Info.Entity; using DS.WMS.Core.Info.Entity;
using DS.WMS.Core.Invoice.Dtos;
using DS.WMS.Core.Op.Dtos; using DS.WMS.Core.Op.Dtos;
using DS.WMS.Core.Op.EDI;
using DS.WMS.Core.Op.Entity; using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Sys.Dtos; using DS.WMS.Core.Sys.Dtos;
using DS.WMS.Core.Sys.Entity; using DS.WMS.Core.Sys.Entity;
using DS.WMS.Core.Sys.Interface; using DS.WMS.Core.Sys.Interface;
using Mapster; using Mapster;
using Microsoft.AspNetCore.Http.HttpResults;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using NPOI.POIFS.Crypt.Dsig;
using SqlSugar; using SqlSugar;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using static System.Runtime.InteropServices.JavaScript.JSType;
namespace DS.WMS.Core.Sys.Method; namespace DS.WMS.Core.Sys.Method;

@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DS.Module.Core;
using DS.WMS.Core.Code.Dtos;
using DS.WMS.Core.Sys.Interface;
using Mapster;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
using DS.Module.Core;
using DS.Module.Core.Constants;
using DS.Module.Core.Extensions;
using DS.Module.Core.Log;
using DS.Module.SqlSugar;
using DS.Module.UserModule;
using DS.WMS.Core.Code.Entity;
namespace DS.WMS.Core.Sys.Method
{
public class ServerCommonService : IServerCommonService
{
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
private readonly IUser user;
/// <summary>
///
/// </summary>
/// <param name="serviceProvider"></param>
public ServerCommonService(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
user = _serviceProvider.GetRequiredService<IUser>();
}
/// <summary>
///
/// </summary>
/// <param name="queryKey"></param>
/// <returns></returns>
public async Task<DataResult<List<CodeCarrierRes>>> GetCodeCarrierSelectList(string queryKey = "")
{
var list = await db.Queryable<CodeCarrier>()
.WhereIF(!string.IsNullOrEmpty(queryKey), a => a.Code.Contains(queryKey) || a.CnName.Contains(queryKey))
.Select(a => new CodeCarrierRes()
{
PinYinCode = a.CnName + "(" + a.Code + ")",
},
true)
.Take(20)
.ToListAsync();
return await Task.FromResult(DataResult<List<CodeCarrierRes>>.Success("获取数据成功!", list));
}
}
}
Loading…
Cancel
Save