using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.WMS.Core.BaseInfo.Entity;
using DS.WMS.Core.System.Dtos;
using DS.WMS.Core.System.Entity;
using DS.WMS.Core.System.Interface;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
namespace DS.WMS.Core.System.Method;
///
///
///
public class CodeGoodsService:ICodeGoodsService
{
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
///
///
///
///
public CodeGoodsService(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService();
}
///
/// 商品列表
///
///
///
public DataResult> GetListByPage(PageRequest request)
{
//序列化查询条件
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var data = db.Queryable()
.LeftJoin((a, b) => a.GoodsTypeGID == b.GID)
.Select()
.Where(whereList).ToQueryPage(request.PageCondition);
return data;
}
///
/// 获取商品信息
///
///
///
public DataResult GetGoodInfo(string id)
{
var data = db.Queryable()
.LeftJoin((a, b) => a.GoodsTypeGID == b.GID)
.Where(a => a.GID == id)
.Select()
.First();
return DataResult.Success(data);
}
}