diff --git a/BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs b/BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs index 0c418cb..fd92a9e 100644 --- a/BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs +++ b/BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs @@ -12,6 +12,7 @@ using BPA.SAAS.Manage.Comm.Util; using BPA.SAAS.Manage.Core.Base; using BPA.SAAS.Manage.Core.DataBase; using BPA.SAAS.Manage.Core.Device; +using BPA.SAAS.Manage.Core.Product; using Newtonsoft.Json; using Npoi.Mapper; using NPOI.HSSF.UserModel; @@ -72,7 +73,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services var res =await _db.Queryable((a, b) => new JoinQueryInfos( JoinType.Left, a.GoodsTypeId == b.Id )) - .Where((a, b) => a.IsDeleted == 0) .WhereIF(!string.IsNullOrWhiteSpace(dto.Code), (a, b) => a.Code.Contains(dto.Code)) // .WhereIF(dto.CreateAt.HasValue, (a, b) => SqlFunc.DateIsSame(a.CreateAt, Convert.ToDateTime(dto.CreateAt), DateType.Day)) diff --git a/BPA.SAAS.Manage.Application/DataBase/Services/GoodsTechnologyService.cs b/BPA.SAAS.Manage.Application/DataBase/Services/GoodsTechnologyService.cs index c6f6d19..712e38d 100644 --- a/BPA.SAAS.Manage.Application/DataBase/Services/GoodsTechnologyService.cs +++ b/BPA.SAAS.Manage.Application/DataBase/Services/GoodsTechnologyService.cs @@ -4,6 +4,7 @@ using BPA.SAAS.Manage.Comm.Const; using BPA.SAAS.Manage.Core.Base; using BPA.SAAS.Manage.Core.DataBase; using BPA.SAAS.Manage.Core.Device; +using BPA.SAAS.Manage.Core.Product; using System; using System.Collections.Generic; using System.Linq; diff --git a/BPA.SAAS.Manage.Application/Device/Dtos/ProductFunction/ProductFunctionBaseDto.cs b/BPA.SAAS.Manage.Application/Device/Dtos/ProductFunction/ProductFunctionBaseDto.cs index ed58b71..5a664d2 100644 --- a/BPA.SAAS.Manage.Application/Device/Dtos/ProductFunction/ProductFunctionBaseDto.cs +++ b/BPA.SAAS.Manage.Application/Device/Dtos/ProductFunction/ProductFunctionBaseDto.cs @@ -41,5 +41,22 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.ProductFunction /// 枚举值 /// public string EnumValue { get; set; } + /// + /// 数据长度 + /// + public string DataLength { get; set; } + /// + /// 数据类型bool的描述 + /// + public string BoolLabel { get; set; } + /// + /// 读写类型0读写 1只读 + /// + public int ReadWrite { get; set; } + /// + /// 描述 + /// + public string Description { get; set; } + public string ProductId { get; set; } } } diff --git a/BPA.SAAS.Manage.Application/Device/Dtos/ProductTopics/ProductTopicsBaseDto.cs b/BPA.SAAS.Manage.Application/Device/Dtos/ProductTopics/ProductTopicsBaseDto.cs new file mode 100644 index 0000000..c41fb8a --- /dev/null +++ b/BPA.SAAS.Manage.Application/Device/Dtos/ProductTopics/ProductTopicsBaseDto.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.Device.Dtos.ProductTopics +{ + public class ProductTopicsBaseDto + { + public string Id { get; set; } + /// + /// Topics类 + /// + public string Topics { get; set; } + /// + /// TopicsType类型 0发布 1订阅 2发布和订阅 + /// + public int TopicsType { get; set; } + /// + /// 描述 + /// + public string Description { get; set; } + public string ProductId { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Application/Device/Dtos/ProductTopics/ProductTopicsQueryInputDto.cs b/BPA.SAAS.Manage.Application/Device/Dtos/ProductTopics/ProductTopicsQueryInputDto.cs new file mode 100644 index 0000000..bc8c553 --- /dev/null +++ b/BPA.SAAS.Manage.Application/Device/Dtos/ProductTopics/ProductTopicsQueryInputDto.cs @@ -0,0 +1,15 @@ +using BPA.SAAS.Manage.Core.Base; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.Device.Dtos.ProductTopics +{ + public class ProductTopicsQueryInputDto : PageInputBase + { + public int? TopicsType { get; set; } + public string ProductId { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Application/Device/Interface/IProductFunctionService.cs b/BPA.SAAS.Manage.Application/Device/Interface/IProductFunctionService.cs index b5715a2..e54c6e5 100644 --- a/BPA.SAAS.Manage.Application/Device/Interface/IProductFunctionService.cs +++ b/BPA.SAAS.Manage.Application/Device/Interface/IProductFunctionService.cs @@ -1,6 +1,6 @@ using BPA.SAAS.Manage.Application.Device.Dtos.ProductFunction; using BPA.SAAS.Manage.Core.Base; -using BPA.SAAS.Manage.Core.Device; +using BPA.SAAS.Manage.Core.Product; using System; using System.Collections.Generic; using System.Linq; diff --git a/BPA.SAAS.Manage.Application/Device/Interface/IProductService.cs b/BPA.SAAS.Manage.Application/Device/Interface/IProductService.cs index 66782d1..e8d2391 100644 --- a/BPA.SAAS.Manage.Application/Device/Interface/IProductService.cs +++ b/BPA.SAAS.Manage.Application/Device/Interface/IProductService.cs @@ -1,6 +1,6 @@ using BPA.SAAS.Manage.Application.Device.Dtos.Device; using BPA.SAAS.Manage.Core.Base; -using BPA.SAAS.Manage.Core.Device; +using BPA.SAAS.Manage.Core.Product; using System; using System.Collections.Generic; using System.Linq; diff --git a/BPA.SAAS.Manage.Application/Device/Interface/IProductTopicsService.cs b/BPA.SAAS.Manage.Application/Device/Interface/IProductTopicsService.cs new file mode 100644 index 0000000..cbb6579 --- /dev/null +++ b/BPA.SAAS.Manage.Application/Device/Interface/IProductTopicsService.cs @@ -0,0 +1,39 @@ +using BPA.SAAS.Manage.Application.Device.Dtos.Device; +using BPA.SAAS.Manage.Application.Device.Dtos.ProductTopics; +using BPA.SAAS.Manage.Core.Base; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.Device.Interface +{ + public interface IProductTopicsService + { + /// + /// 分页查询 + /// + /// + /// + Task GetProductTopicsPage(ProductTopicsQueryInputDto inputDto); + /// + /// 添加 + /// + /// + /// + Task AddProductTopics(ProductTopicsBaseDto inputDto); + /// + /// 更新 + /// + /// + /// + Task UpdateProductTopics(ProductTopicsBaseDto inputDto); + /// + /// 删除 + /// + /// + /// + Task DelProductTopics(List inputList); + } +} diff --git a/BPA.SAAS.Manage.Application/Device/ProductFunctionServices.cs b/BPA.SAAS.Manage.Application/Device/ProductFunctionServices.cs index aa210e1..39610b8 100644 --- a/BPA.SAAS.Manage.Application/Device/ProductFunctionServices.cs +++ b/BPA.SAAS.Manage.Application/Device/ProductFunctionServices.cs @@ -1,7 +1,7 @@ using BPA.SAAS.Manage.Application.Device.Dtos.ProductFunction; using BPA.SAAS.Manage.Application.Device.Interface; using BPA.SAAS.Manage.Core.Base; -using BPA.SAAS.Manage.Core.Device; +using BPA.SAAS.Manage.Core.Product; using Microsoft.AspNetCore.Components.Forms; using System; using System.Collections.Generic; diff --git a/BPA.SAAS.Manage.Application/Device/ProductServices.cs b/BPA.SAAS.Manage.Application/Device/ProductServices.cs index 02ad5ee..fe65278 100644 --- a/BPA.SAAS.Manage.Application/Device/ProductServices.cs +++ b/BPA.SAAS.Manage.Application/Device/ProductServices.cs @@ -1,7 +1,7 @@ using BPA.SAAS.Manage.Application.Device.Dtos.Device; using BPA.SAAS.Manage.Application.Device.Interface; using BPA.SAAS.Manage.Core.Base; -using BPA.SAAS.Manage.Core.Device; +using BPA.SAAS.Manage.Core.Product; using Microsoft.AspNetCore.Components.Forms; using System; using System.Collections.Generic; diff --git a/BPA.SAAS.Manage.Application/Device/ProductTopicsServices.cs b/BPA.SAAS.Manage.Application/Device/ProductTopicsServices.cs new file mode 100644 index 0000000..c15ff01 --- /dev/null +++ b/BPA.SAAS.Manage.Application/Device/ProductTopicsServices.cs @@ -0,0 +1,63 @@ +using BPA.SAAS.Manage.Application.Device.Dtos.Device; +using BPA.SAAS.Manage.Application.Device.Dtos.ProductTopics; +using BPA.SAAS.Manage.Application.Device.Interface; +using BPA.SAAS.Manage.Core.Base; +using Microsoft.AspNetCore.Components.Forms; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.Device +{ + [ApiDescriptionSettings("Device", Tag = "产品Topics")] + public class ProductTopicsServices: IDynamicApiController, ITransient + { + IProductTopicsService _productTopicsService; + public ProductTopicsServices(IProductTopicsService productTopicsService) + { + _productTopicsService=productTopicsService; + } + /// + /// 分页查询 + /// + /// + /// + [HttpPost("/api/producttopics/page")] + public async Task GetProductTopicsPage(ProductTopicsQueryInputDto inputDto) + { + return await _productTopicsService.GetProductTopicsPage(inputDto); + } + /// + /// 添加 + /// + /// + /// + [HttpPost("/api/producttopics/add")] + public async Task AddProductTopics(ProductTopicsBaseDto inputDto) + { + return await _productTopicsService.AddProductTopics(inputDto); + } + /// + /// 更新 + /// + /// + /// + [HttpPost("/api/producttopics/update")] + public async Task UpdateProductTopics(ProductTopicsBaseDto inputDto) + { + return await _productTopicsService.UpdateProductTopics(inputDto); + } + /// + /// 删除 + /// + /// + /// + [HttpPost("/api/producttopics/delete")] + public async Task DelProductTopics(List inputList) + { + return await _productTopicsService.DelProductTopics(inputList); + } + } +} diff --git a/BPA.SAAS.Manage.Application/Device/Services/DeviceService.cs b/BPA.SAAS.Manage.Application/Device/Services/DeviceService.cs index a33403e..2cd1a48 100644 --- a/BPA.SAAS.Manage.Application/Device/Services/DeviceService.cs +++ b/BPA.SAAS.Manage.Application/Device/Services/DeviceService.cs @@ -7,6 +7,7 @@ using BPA.SAAS.Manage.Comm.Util; using BPA.SAAS.Manage.Core.Base; using BPA.SAAS.Manage.Core.Device; using BPA.SAAS.Manage.Core.Org; +using BPA.SAAS.Manage.Core.Product; using BPA.SAAS.Manage.Core.system; using Dm; using System; diff --git a/BPA.SAAS.Manage.Application/Device/Services/DeviceVesionService.cs b/BPA.SAAS.Manage.Application/Device/Services/DeviceVesionService.cs index 2c4c2ba..8c81f8e 100644 --- a/BPA.SAAS.Manage.Application/Device/Services/DeviceVesionService.cs +++ b/BPA.SAAS.Manage.Application/Device/Services/DeviceVesionService.cs @@ -4,6 +4,7 @@ using BPA.SAAS.Manage.Comm.Const; using BPA.SAAS.Manage.Comm.Enum; using BPA.SAAS.Manage.Core.Base; using BPA.SAAS.Manage.Core.Device; +using BPA.SAAS.Manage.Core.Product; using System; using System.Collections.Generic; using System.Linq; diff --git a/BPA.SAAS.Manage.Application/Device/Services/ProductFunctionService.cs b/BPA.SAAS.Manage.Application/Device/Services/ProductFunctionService.cs index d40306d..aac391c 100644 --- a/BPA.SAAS.Manage.Application/Device/Services/ProductFunctionService.cs +++ b/BPA.SAAS.Manage.Application/Device/Services/ProductFunctionService.cs @@ -4,6 +4,8 @@ using BPA.SAAS.Manage.Comm.Const; using BPA.SAAS.Manage.Comm.Enum; using BPA.SAAS.Manage.Core.Base; using BPA.SAAS.Manage.Core.Device; +using BPA.SAAS.Manage.Core.Product; +using NPOI.POIFS.Crypt.Dsig; using NPOI.Util; using System; using System.Collections.Generic; @@ -54,6 +56,10 @@ namespace BPA.SAAS.Manage.Application.Device.Services Unit= x.Unit, StepSize= x.StepSize, EnumValue= x.EnumValue, + DataLength = x.DataLength, + BoolLabel = x.BoolLabel, + ReadWrite = x.ReadWrite, + Description= x.Description, }) .ToPageListAsync(inputDto.Current, inputDto.PageSize, total); return new PageUtil() @@ -110,6 +116,11 @@ namespace BPA.SAAS.Manage.Application.Device.Services Unit =inputDto.Unit, StepSize = inputDto.StepSize, EnumValue = inputDto.EnumValue, + DataLength = inputDto.DataLength, + BoolLabel = inputDto.BoolLabel, + ReadWrite = inputDto.ReadWrite, + Description=inputDto.Description, + ProductId= inputDto.ProductId, }).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); return res > 0; } @@ -132,6 +143,10 @@ namespace BPA.SAAS.Manage.Application.Device.Services data.Unit = inputDto.Unit; data.StepSize = inputDto.StepSize; data.EnumValue = inputDto.EnumValue; + data.DataLength = inputDto.DataLength; + data.BoolLabel = inputDto.BoolLabel; + data.ReadWrite = inputDto.ReadWrite; + data.Description= inputDto.Description; data.Status = (CommonStatus)Enum.ToObject(typeof(CommonStatus), inputDto.Status); var res =await _db.Updateable(data).ExecuteCommandAsync(); return res > 0; diff --git a/BPA.SAAS.Manage.Application/Device/Services/ProductService.cs b/BPA.SAAS.Manage.Application/Device/Services/ProductService.cs index d3ef588..06b5284 100644 --- a/BPA.SAAS.Manage.Application/Device/Services/ProductService.cs +++ b/BPA.SAAS.Manage.Application/Device/Services/ProductService.cs @@ -4,7 +4,7 @@ using BPA.SAAS.Manage.Application.Device.Interface; using BPA.SAAS.Manage.Comm.Const; using BPA.SAAS.Manage.Comm.Enum; using BPA.SAAS.Manage.Core.Base; -using BPA.SAAS.Manage.Core.Device; +using BPA.SAAS.Manage.Core.Product; using System; using System.Collections.Generic; using System.Linq; diff --git a/BPA.SAAS.Manage.Application/Device/Services/ProductTopicsService.cs b/BPA.SAAS.Manage.Application/Device/Services/ProductTopicsService.cs new file mode 100644 index 0000000..b4a5be8 --- /dev/null +++ b/BPA.SAAS.Manage.Application/Device/Services/ProductTopicsService.cs @@ -0,0 +1,97 @@ +using BPA.SAAS.Manage.Application.Device.Dtos.Device; +using BPA.SAAS.Manage.Application.Device.Dtos.ProductTopics; +using BPA.SAAS.Manage.Application.Device.Interface; +using BPA.SAAS.Manage.Comm.Enum; +using BPA.SAAS.Manage.Core.Base; +using BPA.SAAS.Manage.Core.Device; +using BPA.SAAS.Manage.Core.Product; +using StackExchange.Profiling.Internal; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.Device.Services +{ + public class ProductTopicsService : IProductTopicsService, ITransient + { + private readonly ISqlSugarClient _db; + public ProductTopicsService(ISqlSugarClient db) + { + _db= db; + } + /// + /// 分页查询 + /// + /// + /// + public async Task GetProductTopicsPage(ProductTopicsQueryInputDto inputDto) + { + var total = new RefAsync(); + var data = await _db.Queryable().Where(x=>x.ProductId== inputDto.ProductId) + .WhereIF(inputDto.TopicsType!=null, x => x.TopicsType==Convert.ToInt32(inputDto.TopicsType)) + .OrderBy(x => x.CreateAt, OrderByType.Desc) + .ToPageListAsync(inputDto.Current, inputDto.PageSize, total); + + return new PageUtil() + { + Data = data, + Total = total + + }; + } + /// + /// 添加 + /// + /// + /// + public async Task AddProductTopics(ProductTopicsBaseDto inputDto) + { + BPA_ProductTopics BPA_ProductTopics = inputDto.Adapt(); + var res = await _db.Insertable(BPA_ProductTopics).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); + return res != null; + } + /// + /// 更新 + /// + /// + /// + public async Task UpdateProductTopics(ProductTopicsBaseDto inputDto) + { + var data = await _db.Queryable().Where(x => x.Id == inputDto.Id).FirstAsync(); + + if (data != null) + { + var product = _db.Queryable().Where(x => x.Id == inputDto.ProductId).First(); + var inputData = inputDto.Adapt(); + var res = await _db.Updateable(inputData) + .UpdateColumns(x => new + { + x.Topics, + x.TopicsType, + x.Description, + }) + .Where(x => x.Id == inputDto.Id).ExecuteCommandAsync(); + + return res > 0; + } + return false; + } + /// + /// 删除 + /// + /// + /// + public async Task DelProductTopics(List inputList) + { + var data = await _db.Queryable().Where(x => inputList.Contains(x.Id)).ToListAsync(); + foreach (var item in data) + { + item.IsDeleted = 1; + } + var res = await _db.Updateable(data).ExecuteCommandAsync(); + return res > 0; + } + } +} diff --git a/BPA.SAAS.Manage.Core/Device/BPA_Product.cs b/BPA.SAAS.Manage.Core/Product/BPA_Product.cs similarity index 88% rename from BPA.SAAS.Manage.Core/Device/BPA_Product.cs rename to BPA.SAAS.Manage.Core/Product/BPA_Product.cs index fd4ac47..6044e32 100644 --- a/BPA.SAAS.Manage.Core/Device/BPA_Product.cs +++ b/BPA.SAAS.Manage.Core/Product/BPA_Product.cs @@ -7,10 +7,10 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace BPA.SAAS.Manage.Core.Device +namespace BPA.SAAS.Manage.Core.Product { [SugarTable("bpa_product")] - public class BPA_Product: IBaseEntity, IGroupId + public class BPA_Product : IBaseEntity, IGroupId { public string Name { get; set; } public string Key { get; set; } diff --git a/BPA.SAAS.Manage.Core/Device/BPA_ProductFunction.cs b/BPA.SAAS.Manage.Core/Product/BPA_ProductFunction.cs similarity index 74% rename from BPA.SAAS.Manage.Core/Device/BPA_ProductFunction.cs rename to BPA.SAAS.Manage.Core/Product/BPA_ProductFunction.cs index 90c25f0..8468c91 100644 --- a/BPA.SAAS.Manage.Core/Device/BPA_ProductFunction.cs +++ b/BPA.SAAS.Manage.Core/Product/BPA_ProductFunction.cs @@ -7,7 +7,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace BPA.SAAS.Manage.Core.Device +namespace BPA.SAAS.Manage.Core.Product { /// ///产品功能 @@ -59,5 +59,22 @@ namespace BPA.SAAS.Manage.Core.Device /// 枚举值 /// public string EnumValue { get; set; } + /// + /// 数据长度 + /// + public string DataLength { get; set; } + /// + /// 数据类型bool的描述 + /// + public string BoolLabel { get; set; } + /// + /// 读写类型0读写 1只读 + /// + public int ReadWrite { get; set; } + /// + /// 描述 + /// + public string Description { get; set; } + public string ProductId { get; set; } } } diff --git a/BPA.SAAS.Manage.Core/Device/BPA_ProductFunctionAction.cs b/BPA.SAAS.Manage.Core/Product/BPA_ProductFunctionAction.cs similarity index 90% rename from BPA.SAAS.Manage.Core/Device/BPA_ProductFunctionAction.cs rename to BPA.SAAS.Manage.Core/Product/BPA_ProductFunctionAction.cs index de17693..85643e8 100644 --- a/BPA.SAAS.Manage.Core/Device/BPA_ProductFunctionAction.cs +++ b/BPA.SAAS.Manage.Core/Product/BPA_ProductFunctionAction.cs @@ -5,9 +5,9 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace BPA.SAAS.Manage.Core.Device +namespace BPA.SAAS.Manage.Core.Product { - public class BPA_ProductFunctionAction: IBaseEntity, IGroupId + public class BPA_ProductFunctionAction : IBaseEntity, IGroupId { /// /// 功能id diff --git a/BPA.SAAS.Manage.Core/Product/BPA_ProductTopics.cs b/BPA.SAAS.Manage.Core/Product/BPA_ProductTopics.cs new file mode 100644 index 0000000..829c2a0 --- /dev/null +++ b/BPA.SAAS.Manage.Core/Product/BPA_ProductTopics.cs @@ -0,0 +1,29 @@ +using BPA.SAAS.Manage.Core.Base; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Core.Product +{ + [SugarTable("bpa_producttopics")] + public class BPA_ProductTopics : IBaseEntity, IGroupId + { + /// + /// Topics类 + /// + public string Topics { get; set; } + /// + /// TopicsType类型 0发布 1订阅 2发布和订阅 + /// + public int TopicsType { get; set; } + /// + /// 描述 + /// + public string Description { get; set; } + public string ProductId { get; set; } + public string GroupId { get; set; } + } +}