You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.9 KiB
C#
59 lines
1.9 KiB
C#
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));
|
|
}
|
|
}
|
|
}
|