02/27
commit
87caf1caff
@ -0,0 +1,43 @@
|
||||
namespace DS.Module.Core.Data;
|
||||
|
||||
/// <summary>
|
||||
/// 数据条件组
|
||||
/// </summary>
|
||||
public class DataGroupConditions
|
||||
{
|
||||
/// <summary>
|
||||
/// 逻辑操作符
|
||||
/// </summary>
|
||||
public string LogicalOperator { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 条件组
|
||||
/// </summary>
|
||||
public List<DataConditions> Conditions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分组
|
||||
/// </summary>
|
||||
public List<DataGroupConditions> Groups { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 条件
|
||||
/// </summary>
|
||||
public class DataConditions
|
||||
{
|
||||
/// <summary>
|
||||
/// 字段
|
||||
/// </summary>
|
||||
public string Field { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作符
|
||||
/// </summary>
|
||||
public string Operator { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 值
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
namespace DS.Module.Core.Data;
|
||||
|
||||
/// <summary>
|
||||
/// id实体
|
||||
/// </summary>
|
||||
public class IdModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键id
|
||||
/// </summary>
|
||||
public string Id { get; set; }
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Data;
|
||||
using SqlSugar;
|
||||
|
||||
namespace DS.WMS.Core.Code.Entity;
|
||||
/// <summary>
|
||||
/// 商品信息表
|
||||
/// </summary>
|
||||
[SqlSugar.SugarTable("op_code_goods","商品信息表")]
|
||||
public class CodeGoods: BaseModel<long>
|
||||
{
|
||||
/// <summary>
|
||||
/// 商品编码
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "商品编码", Length = 30)]
|
||||
public string GoodsCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 商品名称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "商品名称", Length = 50)]
|
||||
public string GoodName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料号
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "物料号", Length = 50)]
|
||||
public string GoodNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 英文名称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "英文名称", Length = 10)]
|
||||
public string EnName { get; set; }
|
||||
/// <summary>
|
||||
/// 商品描述
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "商品描述", Length = 200)]
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 入库应收
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "入库应收", Length = 18,DecimalDigits = 2,DefaultValue ="0")]
|
||||
public decimal ARRate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 入库应付
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "入库应收", Length = 18,DecimalDigits = 2,DefaultValue ="0")]
|
||||
public decimal APRate { get; set; }
|
||||
/// <summary>
|
||||
/// 出库应收
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "出库应收", Length = 18,DecimalDigits = 2,DefaultValue ="0")]
|
||||
public decimal AROutRate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 出库应付
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "出库应收", Length = 18,DecimalDigits = 2,DefaultValue ="0")]
|
||||
public decimal APOutRate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 商品类型
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "商品类型", IsNullable = true)]
|
||||
public long GoodsTypeId { get; set; }
|
||||
/// <summary>
|
||||
/// 计费大类
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "计费大类", IsNullable = true)]
|
||||
public long GoodsFeeTypeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 海关代码
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "海关代码", Length = 50)]
|
||||
public string HSCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 申报计量单位
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "物料号", Length = 50)]
|
||||
public string RuleUnit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 法定第一计量单位
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "法定第一计量单位", Length = 50)]
|
||||
public string RuleUnit1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 法定第二计量单位
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "法定第二计量单位", Length = 50)]
|
||||
public string RuleUnit2 { get; set; }
|
||||
/// <summary>
|
||||
/// 状态 0启用 1禁用
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "状态",DefaultValue = "0")]
|
||||
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Data;
|
||||
using SqlSugar;
|
||||
|
||||
namespace DS.WMS.Core.Code.Entity;
|
||||
/// <summary>
|
||||
/// 商品类型表
|
||||
/// </summary>
|
||||
[SqlSugar.SugarTable("op_code_goods_type","商品类型表")]
|
||||
public class CodeGoodsType: BaseModel<long>
|
||||
{
|
||||
/// <summary>
|
||||
/// 类型代码
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "类型代码", Length = 20)]
|
||||
public string GoodsTypeCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货物类型
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "货物类型", Length = 50)]
|
||||
public string GoodsTypeName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 英文名称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "英文名称", Length = 10)]
|
||||
public string EnName { get; set; }
|
||||
/// <summary>
|
||||
/// 描述
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "描述", Length = 200)]
|
||||
public string Description { get; set; }
|
||||
/// <summary>
|
||||
/// 状态 0启用 1禁用
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "状态",DefaultValue = "0")]
|
||||
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
namespace DS.WMS.Core.System.Dtos;
|
||||
|
||||
/// <summary>
|
||||
/// 客户权限返回
|
||||
/// </summary>
|
||||
public class ClientPermissionRes
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键Id
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 权限名称
|
||||
/// </summary>
|
||||
public string PermissionName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 权限实体
|
||||
/// </summary>
|
||||
public string PermissionEntity { get; set; }
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
using DS.Module.Core;
|
||||
using FluentValidation;
|
||||
|
||||
namespace DS.WMS.Core.System.Dtos;
|
||||
|
||||
/// <summary>
|
||||
/// 字典值请求实体
|
||||
/// </summary>
|
||||
public class DictDataReq
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键Id
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
/// <summary>
|
||||
/// 字典类型Id
|
||||
/// </summary>
|
||||
public long TypeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字典值编码
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字典值
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int? OrderNo { get; set; } = 100;
|
||||
|
||||
/// <summary>
|
||||
/// 状态 0 启用 1 禁用
|
||||
/// </summary>
|
||||
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Note { get; set; } = "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证
|
||||
/// </summary>
|
||||
public class DictDataReqValidator : AbstractValidator<DictDataReq>
|
||||
{
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
public DictDataReqValidator()
|
||||
{
|
||||
this.RuleFor(o => o.Value)
|
||||
.NotEmpty().WithName("字典值");
|
||||
this.RuleFor(o => o.Code)
|
||||
.NotEmpty().WithName("字典值编码");
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
using DS.Module.Core;
|
||||
|
||||
namespace DS.WMS.Core.System.Dtos;
|
||||
/// <summary>
|
||||
/// 字典值返回
|
||||
/// </summary>
|
||||
public class DictDataRes
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键Id
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
/// <summary>
|
||||
/// 字典类型Id
|
||||
/// </summary>
|
||||
public long TypeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字典值编码
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字典值
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int? OrderNo { get; set; } = 100;
|
||||
|
||||
/// <summary>
|
||||
/// 状态 0 启用 1 禁用
|
||||
/// </summary>
|
||||
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Note { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
using DS.Module.Core;
|
||||
using FluentValidation;
|
||||
|
||||
namespace DS.WMS.Core.System.Dtos;
|
||||
|
||||
/// <summary>
|
||||
/// 字典类型请求实体
|
||||
/// </summary>
|
||||
public class DictTypeReq
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键Id
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 唯一编码
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字典类型名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int? OrderNo { get; set; } = 100;
|
||||
/// <summary>
|
||||
/// 状态 0 启用 1 禁用
|
||||
/// </summary>
|
||||
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Note { get; set; } = "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证
|
||||
/// </summary>
|
||||
public class DictTypeReqValidator : AbstractValidator<DictTypeReq>
|
||||
{
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
public DictTypeReqValidator()
|
||||
{
|
||||
this.RuleFor(o => o.Name)
|
||||
.NotEmpty().WithName("字典类型名称");
|
||||
this.RuleFor(o => o.Code)
|
||||
.NotEmpty().WithName("字典类型唯一编码");
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
using DS.Module.Core;
|
||||
|
||||
namespace DS.WMS.Core.System.Dtos;
|
||||
|
||||
/// <summary>
|
||||
/// 字典类型返回
|
||||
/// </summary>
|
||||
public class DictTypeRes
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键Id
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 唯一编码
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字典类型名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int? OrderNo { get; set; } = 100;
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Note { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 状态 0 启用 1 禁用
|
||||
/// </summary>
|
||||
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Data;
|
||||
|
||||
namespace DS.WMS.Core.System.Entity;
|
||||
/// <summary>
|
||||
/// 系统字典值表
|
||||
/// </summary>
|
||||
[SqlSugar.SugarTable("sys_dict_data")]
|
||||
public class SysDictData : BaseModel<long>
|
||||
{
|
||||
/// <summary>
|
||||
/// 字典类型Id
|
||||
/// </summary>
|
||||
public long TypeId { get; set; }
|
||||
/// <summary>
|
||||
/// 字典值
|
||||
/// </summary>
|
||||
[SqlSugar.SugarColumn(Length = 100,ColumnDescription="名称")]
|
||||
public string Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字典值编码
|
||||
/// </summary>
|
||||
[SqlSugar.SugarColumn(Length = 50,ColumnDescription="编码")]
|
||||
public string Code { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
[SqlSugar.SugarColumn(ColumnDescription = "排序")]
|
||||
public int? OrderNo { get; set; } = 100;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
[SqlSugar.SugarColumn(ColumnDescription = "状态")]
|
||||
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Data;
|
||||
|
||||
namespace DS.WMS.Core.System.Entity;
|
||||
/// <summary>
|
||||
/// 系统字典类型表
|
||||
/// </summary>
|
||||
[SqlSugar.SugarTable("sys_dict_type")]
|
||||
public class SysDictType : BaseModel<long>
|
||||
{
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
[SqlSugar.SugarColumn(Length = 100,ColumnDescription="名称")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 编码
|
||||
/// </summary>
|
||||
[SqlSugar.SugarColumn(Length = 50,ColumnDescription="编码")]
|
||||
public string Code { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
[SqlSugar.SugarColumn(ColumnDescription = "排序")]
|
||||
public int? OrderNo { get; set; } = 100;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
[SqlSugar.SugarColumn(ColumnDescription = "状态")]
|
||||
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
|
||||
|
||||
|
||||
}
|
@ -1,9 +1,30 @@
|
||||
using DS.Module.Core;
|
||||
using DS.WMS.Core.System.Dtos;
|
||||
using DS.WMS.Core.System.Entity;
|
||||
|
||||
namespace DS.WMS.Core.System.Interface;
|
||||
|
||||
public interface IDataRuleService
|
||||
{
|
||||
DataResult<List<SysDataRule>> GetListByPage(PageRequest request);
|
||||
/// <summary>
|
||||
/// 列表
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<List<DataRuleRes>> GetListByPage(PageRequest request);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 编辑
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
DataResult EditDataRule(DataRuleReq model);
|
||||
|
||||
/// <summary>
|
||||
/// 获取详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<DataRuleRes> GetDataRuleInfo(string id);
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
using DS.Module.Core;
|
||||
using DS.WMS.Core.System.Dtos;
|
||||
|
||||
namespace DS.WMS.Core.System.Interface;
|
||||
|
||||
public interface ISysDictDataService
|
||||
{
|
||||
/// <summary>
|
||||
/// 列表查询
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<List<DictDataRes>> GetListByPage(PageRequest request);
|
||||
/// <summary>
|
||||
/// 添加字典值
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
DataResult EditDictData(DictDataReq model);
|
||||
|
||||
/// <summary>
|
||||
/// 获取详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<DictDataRes> GetDictDataInfo(string id);
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
using DS.Module.Core;
|
||||
using DS.WMS.Core.System.Dtos;
|
||||
|
||||
namespace DS.WMS.Core.System.Interface;
|
||||
|
||||
public interface ISysDictTypeService
|
||||
{
|
||||
/// <summary>
|
||||
/// 列表查询
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<List<DictTypeRes>> GetListByPage(PageRequest request);
|
||||
/// <summary>
|
||||
/// 添加字典类型
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
DataResult EditDictType(DictTypeReq model);
|
||||
|
||||
/// <summary>
|
||||
/// 获取详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<DictTypeRes> GetDictTypeInfo(string id);
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Extensions;
|
||||
using DS.Module.UserModule;
|
||||
using DS.WMS.Core.System.Dtos;
|
||||
using DS.WMS.Core.System.Entity;
|
||||
using DS.WMS.Core.System.Interface;
|
||||
using Mapster;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
|
||||
namespace DS.WMS.Core.System.Method;
|
||||
|
||||
public class SysDictDataService:ISysDictDataService
|
||||
{
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly ISqlSugarClient db;
|
||||
private readonly IUser user;
|
||||
private readonly ICommonService _commonService;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="serviceProvider"></param>
|
||||
public SysDictDataService(IServiceProvider serviceProvider)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
|
||||
user = _serviceProvider.GetRequiredService<IUser>();
|
||||
_commonService = _serviceProvider.GetRequiredService<ICommonService>();
|
||||
}
|
||||
public DataResult<List<DictDataRes>> GetListByPage(PageRequest request)
|
||||
{
|
||||
//序列化查询条件
|
||||
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
|
||||
var data = db.Queryable<SysDictData>()
|
||||
.Select<DictDataRes>()
|
||||
.Where(whereList).ToQueryPage(request.PageCondition);
|
||||
return data;
|
||||
}
|
||||
|
||||
public DataResult EditDictData(DictDataReq req)
|
||||
{
|
||||
if (req.Id == 0)
|
||||
{
|
||||
var isExist = db.Queryable<SysDictData>().Where(x =>x.TypeId == req.TypeId && x.Code == req.Code).First();
|
||||
if (isExist != null)
|
||||
{
|
||||
return DataResult.Failed("字典值唯一编码已存在!",MultiLanguageConst.DictCodeExist);
|
||||
}
|
||||
|
||||
var data = req.Adapt<SysDictData>();
|
||||
|
||||
var entity = db.Insertable(data).ExecuteReturnEntity();
|
||||
|
||||
return DataResult.Successed("添加成功!", entity.Id,MultiLanguageConst.DataCreateSuccess);
|
||||
}
|
||||
else
|
||||
{
|
||||
var info = db.Queryable<SysDictData>().Where(x => x.Id == req.Id).First();
|
||||
|
||||
info = req.Adapt(info);
|
||||
|
||||
db.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
|
||||
return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess);
|
||||
}
|
||||
}
|
||||
|
||||
public DataResult<DictDataRes> GetDictDataInfo(string id)
|
||||
{
|
||||
var data = db.Queryable<SysDictData>()
|
||||
.Where(a => a.Id == long.Parse(id))
|
||||
.Select<DictDataRes>()
|
||||
.First();
|
||||
return DataResult<DictDataRes>.Success(data,MultiLanguageConst.DataQuerySuccess);
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Extensions;
|
||||
using DS.Module.UserModule;
|
||||
using DS.WMS.Core.System.Dtos;
|
||||
using DS.WMS.Core.System.Entity;
|
||||
using DS.WMS.Core.System.Interface;
|
||||
using Mapster;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
|
||||
namespace DS.WMS.Core.System.Method;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class SysDictTypeService:ISysDictTypeService
|
||||
{
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly ISqlSugarClient db;
|
||||
private readonly IUser user;
|
||||
private readonly ICommonService _commonService;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="serviceProvider"></param>
|
||||
public SysDictTypeService(IServiceProvider serviceProvider)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
|
||||
user = _serviceProvider.GetRequiredService<IUser>();
|
||||
_commonService = _serviceProvider.GetRequiredService<ICommonService>();
|
||||
}
|
||||
public DataResult<List<DictTypeRes>> GetListByPage(PageRequest request)
|
||||
{
|
||||
//序列化查询条件
|
||||
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
|
||||
var data = db.Queryable<SysDictType>()
|
||||
.Select<DictTypeRes>()
|
||||
.Where(whereList).ToQueryPage(request.PageCondition);
|
||||
return data;
|
||||
}
|
||||
|
||||
public DataResult EditDictType(DictTypeReq req)
|
||||
{
|
||||
if (req.Id == 0)
|
||||
{
|
||||
var isExist = db.Queryable<SysDictType>().Where(x => x.Code == req.Code).First();
|
||||
if (isExist != null)
|
||||
{
|
||||
return DataResult.Failed("字典类型唯一编码已存在!",MultiLanguageConst.DictCodeExist);
|
||||
}
|
||||
|
||||
var data = req.Adapt<SysDictType>();
|
||||
|
||||
var entity = db.Insertable(data).ExecuteReturnEntity();
|
||||
|
||||
return DataResult.Successed("添加成功!", entity.Id,MultiLanguageConst.DataCreateSuccess);
|
||||
}
|
||||
else
|
||||
{
|
||||
var info = db.Queryable<SysDictType>().Where(x => x.Id == req.Id).First();
|
||||
|
||||
info = req.Adapt(info);
|
||||
|
||||
db.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
|
||||
return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess);
|
||||
}
|
||||
}
|
||||
|
||||
public DataResult<DictTypeRes> GetDictTypeInfo(string id)
|
||||
{
|
||||
var data = db.Queryable<SysDictType>()
|
||||
.Where(a => a.Id == long.Parse(id))
|
||||
.Select<DictTypeRes>()
|
||||
.First();
|
||||
return DataResult<DictTypeRes>.Success(data,MultiLanguageConst.DataQuerySuccess);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue