@@ -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<BPA_GoodsInfo, BPA_GoodsType>((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)) | |||
@@ -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; | |||
@@ -41,5 +41,22 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.ProductFunction | |||
/// 枚举值 | |||
/// </summary> | |||
public string EnumValue { get; set; } | |||
/// <summary> | |||
/// 数据长度 | |||
/// </summary> | |||
public string DataLength { get; set; } | |||
/// <summary> | |||
/// 数据类型bool的描述 | |||
/// </summary> | |||
public string BoolLabel { get; set; } | |||
/// <summary> | |||
/// 读写类型0读写 1只读 | |||
/// </summary> | |||
public int ReadWrite { get; set; } | |||
/// <summary> | |||
/// 描述 | |||
/// </summary> | |||
public string Description { get; set; } | |||
public string ProductId { get; set; } | |||
} | |||
} |
@@ -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; } | |||
/// <summary> | |||
/// Topics类 | |||
/// </summary> | |||
public string Topics { get; set; } | |||
/// <summary> | |||
/// TopicsType类型 0发布 1订阅 2发布和订阅 | |||
/// </summary> | |||
public int TopicsType { get; set; } | |||
/// <summary> | |||
/// 描述 | |||
/// </summary> | |||
public string Description { get; set; } | |||
public string ProductId { get; set; } | |||
} | |||
} |
@@ -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; } | |||
} | |||
} |
@@ -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; | |||
@@ -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; | |||
@@ -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 | |||
{ | |||
/// <summary> | |||
/// 分页查询 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
Task<PageUtil> GetProductTopicsPage(ProductTopicsQueryInputDto inputDto); | |||
/// <summary> | |||
/// 添加 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
Task<bool> AddProductTopics(ProductTopicsBaseDto inputDto); | |||
/// <summary> | |||
/// 更新 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
Task<bool> UpdateProductTopics(ProductTopicsBaseDto inputDto); | |||
/// <summary> | |||
/// 删除 | |||
/// </summary> | |||
/// <param name="inputList"></param> | |||
/// <returns></returns> | |||
Task<bool> DelProductTopics(List<string> inputList); | |||
} | |||
} |
@@ -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; | |||
@@ -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; | |||
@@ -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; | |||
} | |||
/// <summary> | |||
/// 分页查询 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/producttopics/page")] | |||
public async Task<PageUtil> GetProductTopicsPage(ProductTopicsQueryInputDto inputDto) | |||
{ | |||
return await _productTopicsService.GetProductTopicsPage(inputDto); | |||
} | |||
/// <summary> | |||
/// 添加 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/producttopics/add")] | |||
public async Task<bool> AddProductTopics(ProductTopicsBaseDto inputDto) | |||
{ | |||
return await _productTopicsService.AddProductTopics(inputDto); | |||
} | |||
/// <summary> | |||
/// 更新 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/producttopics/update")] | |||
public async Task<bool> UpdateProductTopics(ProductTopicsBaseDto inputDto) | |||
{ | |||
return await _productTopicsService.UpdateProductTopics(inputDto); | |||
} | |||
/// <summary> | |||
/// 删除 | |||
/// </summary> | |||
/// <param name="inputList"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/producttopics/delete")] | |||
public async Task<bool> DelProductTopics(List<string> inputList) | |||
{ | |||
return await _productTopicsService.DelProductTopics(inputList); | |||
} | |||
} | |||
} |
@@ -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; | |||
@@ -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; | |||
@@ -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; | |||
@@ -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; | |||
@@ -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; | |||
} | |||
/// <summary> | |||
/// 分页查询 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<PageUtil> GetProductTopicsPage(ProductTopicsQueryInputDto inputDto) | |||
{ | |||
var total = new RefAsync<int>(); | |||
var data = await _db.Queryable<BPA_ProductTopics>().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 | |||
}; | |||
} | |||
/// <summary> | |||
/// 添加 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> AddProductTopics(ProductTopicsBaseDto inputDto) | |||
{ | |||
BPA_ProductTopics BPA_ProductTopics = inputDto.Adapt<BPA_ProductTopics>(); | |||
var res = await _db.Insertable(BPA_ProductTopics).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); | |||
return res != null; | |||
} | |||
/// <summary> | |||
/// 更新 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> UpdateProductTopics(ProductTopicsBaseDto inputDto) | |||
{ | |||
var data = await _db.Queryable<BPA_ProductTopics>().Where(x => x.Id == inputDto.Id).FirstAsync(); | |||
if (data != null) | |||
{ | |||
var product = _db.Queryable<BPA_ProductTopics>().Where(x => x.Id == inputDto.ProductId).First(); | |||
var inputData = inputDto.Adapt<BPA_ProductTopics>(); | |||
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; | |||
} | |||
/// <summary> | |||
/// 删除 | |||
/// </summary> | |||
/// <param name="inputList"></param> | |||
/// <returns></returns> | |||
public async Task<bool> DelProductTopics(List<string> inputList) | |||
{ | |||
var data = await _db.Queryable<BPA_ProductTopics>().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; | |||
} | |||
} | |||
} |
@@ -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; } |
@@ -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 | |||
{ | |||
/// <summary> | |||
///产品功能 | |||
@@ -59,5 +59,22 @@ namespace BPA.SAAS.Manage.Core.Device | |||
/// 枚举值 | |||
/// </summary> | |||
public string EnumValue { get; set; } | |||
/// <summary> | |||
/// 数据长度 | |||
/// </summary> | |||
public string DataLength { get; set; } | |||
/// <summary> | |||
/// 数据类型bool的描述 | |||
/// </summary> | |||
public string BoolLabel { get; set; } | |||
/// <summary> | |||
/// 读写类型0读写 1只读 | |||
/// </summary> | |||
public int ReadWrite { get; set; } | |||
/// <summary> | |||
/// 描述 | |||
/// </summary> | |||
public string Description { get; set; } | |||
public string ProductId { get; set; } | |||
} | |||
} |
@@ -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 | |||
{ | |||
/// <summary> | |||
/// 功能id |
@@ -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 | |||
{ | |||
/// <summary> | |||
/// Topics类 | |||
/// </summary> | |||
public string Topics { get; set; } | |||
/// <summary> | |||
/// TopicsType类型 0发布 1订阅 2发布和订阅 | |||
/// </summary> | |||
public int TopicsType { get; set; } | |||
/// <summary> | |||
/// 描述 | |||
/// </summary> | |||
public string Description { get; set; } | |||
public string ProductId { get; set; } | |||
public string GroupId { get; set; } | |||
} | |||
} |