diff --git a/BPA.SAAS.Manage.Application/Auth/AuthService.cs b/BPA.SAAS.Manage.Application/Auth/AuthService.cs index 5e5468a..d3ad8c4 100644 --- a/BPA.SAAS.Manage.Application/Auth/AuthService.cs +++ b/BPA.SAAS.Manage.Application/Auth/AuthService.cs @@ -32,7 +32,7 @@ namespace BPA.SAAS.Manage.Application.Auth /// [HttpPost("/api/auth/login")] [AllowAnonymous] - public async Task Login([FromHeader] string logintype, [Required] LoginInput input) + public async Task Login(LoginInput input) { // 获取加密后的密码 diff --git a/BPA.SAAS.Manage.Application/Auth/IAuthService.cs b/BPA.SAAS.Manage.Application/Auth/IAuthService.cs index 784417c..e1c59f0 100644 --- a/BPA.SAAS.Manage.Application/Auth/IAuthService.cs +++ b/BPA.SAAS.Manage.Application/Auth/IAuthService.cs @@ -10,7 +10,7 @@ namespace BPA.SAAS.Manage.Application.Auth { public interface IAuthService { - Task Login([FromHeader] string logintype, [Required] LoginInput input); + Task Login(LoginInput input); Task GetLoginUserAsync(); Task LogoutAsync(); diff --git a/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttributePrice/GoodsAttributePriceDto.cs b/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttributePrice/GoodsAttributePriceDto.cs new file mode 100644 index 0000000..1d7e92b --- /dev/null +++ b/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttributePrice/GoodsAttributePriceDto.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsAttributePrice +{ + public class GoodsAttributePriceDto + { + public string Id { get; set; } + public string GoodsId { get; set; } + public string GoodsattributeValueId { get; set; } + public string GoodsattributeValue { get; set; } + public decimal Price { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttributePrice/GoodsAttributePriceQueryDto.cs b/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttributePrice/GoodsAttributePriceQueryDto.cs new file mode 100644 index 0000000..535cd22 --- /dev/null +++ b/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttributePrice/GoodsAttributePriceQueryDto.cs @@ -0,0 +1,14 @@ +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.DataBase.Dtos.GoodsAttributePrice +{ + public class GoodsAttributePriceQueryDto: PageInputBase + { + public string GoodsId { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttributePrice/GoodsAttributePriceView.cs b/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttributePrice/GoodsAttributePriceView.cs new file mode 100644 index 0000000..bd63f86 --- /dev/null +++ b/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttributePrice/GoodsAttributePriceView.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsAttributePrice +{ + public class GoodsAttributePriceView + { + public string Id { get; set; } + public string GoodsId { get; set; } + public string GoodsattributeValueId { get; set; } + public string GoodsattributeValue { get; set; } + public decimal Price { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Application/DataBase/GoodsAttributePriceServices.cs b/BPA.SAAS.Manage.Application/DataBase/GoodsAttributePriceServices.cs new file mode 100644 index 0000000..6186971 --- /dev/null +++ b/BPA.SAAS.Manage.Application/DataBase/GoodsAttributePriceServices.cs @@ -0,0 +1,71 @@ +using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsAttributePrice; +using BPA.SAAS.Manage.Application.DataBase.Interface; +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.DataBase +{ + [ApiDescriptionSettings("GoodsAttributePrice", Tag = "商品属性价格")] + public class GoodsAttributePriceServices: IDynamicApiController + { + IGoodsAttributePriceService _goodsAttributePriceService; + public GoodsAttributePriceServices(IGoodsAttributePriceService goodsAttributePriceService) + { + _goodsAttributePriceService=goodsAttributePriceService; + } + /// + /// 分页查询 + /// + /// + /// + [HttpPost("/api/goodsattributeprice/getpage")] + public async Task GetGoodsAttributePricePage(GoodsAttributePriceQueryDto dto) + { + return await _goodsAttributePriceService.GetGoodsAttributePricePage(dto); + } + /// + /// 查询商品属性价格列表 + /// + /// + /// + [HttpGet("/api/goodsattributeprice/getlist")] + public async Task> GetGoodsAttributePriceList(string goodsId) + { + return await _goodsAttributePriceService.GetGoodsAttributePriceList(goodsId); + } + /// + /// 添加 + /// + /// + /// + [HttpPost("/api/goodsattributeprice/add")] + public async Task AddGoodsAttributePrice(GoodsAttributePriceDto dto) + { + return await _goodsAttributePriceService.AddGoodsAttributePrice(dto); + } + /// + /// 更新 + /// + /// + /// + [HttpPost("/api/goodsattributeprice/update")] + public async Task UpdateGoodsAttributePrice(GoodsAttributePriceDto dto) + { + return await _goodsAttributePriceService.UpdateGoodsAttributePrice(dto); + } + /// + /// 删除 + /// + /// + /// + [HttpGet("/api/goodsattributeprice/delete")] + public async Task DelGoodsAttributePrice(string Id) + { + return await _goodsAttributePriceService.DelGoodsAttributePrice(Id); + } + } +} diff --git a/BPA.SAAS.Manage.Application/DataBase/Interface/IGoodsAttributePriceService.cs b/BPA.SAAS.Manage.Application/DataBase/Interface/IGoodsAttributePriceService.cs new file mode 100644 index 0000000..61e1874 --- /dev/null +++ b/BPA.SAAS.Manage.Application/DataBase/Interface/IGoodsAttributePriceService.cs @@ -0,0 +1,39 @@ +using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsAttributePrice; +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.DataBase.Interface +{ + public interface IGoodsAttributePriceService + { + // + /// 分页查询 + /// + /// + /// + Task GetGoodsAttributePricePage(GoodsAttributePriceQueryDto dto); + Task> GetGoodsAttributePriceList(string goodsId); + /// + /// 添加 + /// + /// + /// + Task AddGoodsAttributePrice(GoodsAttributePriceDto dto); + /// + /// 更新 + /// + /// + /// + Task UpdateGoodsAttributePrice(GoodsAttributePriceDto dto); + /// + /// 删除 + /// + /// + /// + Task DelGoodsAttributePrice(string Id); + } +} diff --git a/BPA.SAAS.Manage.Application/DataBase/Services/GoodsAttributePriceService.cs b/BPA.SAAS.Manage.Application/DataBase/Services/GoodsAttributePriceService.cs new file mode 100644 index 0000000..543d01f --- /dev/null +++ b/BPA.SAAS.Manage.Application/DataBase/Services/GoodsAttributePriceService.cs @@ -0,0 +1,113 @@ +using BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos; +using BPA.SAAS.Manage.Application.DataBase.Dtos.Bom; +using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsAttributePrice; +using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsType; +using BPA.SAAS.Manage.Application.DataBase.Interface; +using BPA.SAAS.Manage.Comm.Const; +using BPA.SAAS.Manage.Comm.Enum; +using BPA.SAAS.Manage.Core.Base; +using BPA.SAAS.Manage.Core.DataBase; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.DataBase.Services +{ + public class GoodsAttributePriceService : IGoodsAttributePriceService, ITransient + { + private readonly ISqlSugarClient _db; + public GoodsAttributePriceService(ISqlSugarClient db) + { + _db = db; // 推荐操作 + } + /// + /// 分页查询 + /// + /// + /// + public async Task GetGoodsAttributePricePage(GoodsAttributePriceQueryDto dto) + { + RefAsync total =0; + var res = await _db.Queryable() + .WhereIF(!string.IsNullOrWhiteSpace(dto.GoodsId),x=>x.GoodsId== dto.GoodsId) + .OrderBy(a => a.CreateAt, OrderByType.Desc) + .Select(it => new GoodsAttributePriceView() { Id = it.Id, GoodsId = it.GoodsId, GoodsattributeValueId = it.GoodsattributeValueId,Price=it.Price,GoodsattributeValue=it.GoodsattributeValue }) + + .ToPageListAsync(dto.Current, dto.PageSize, total); + //.ToPageList(dto.Current, dto.PageSize, ref total); + + PageUtil util = new PageUtil() + { + Total = total, + Data = res + + }; + return util; + } + public async Task> GetGoodsAttributePriceList(string goodsId) + { + var res = await _db.Queryable() + .WhereIF(!string.IsNullOrWhiteSpace(goodsId), x => x.GoodsId == goodsId) + .OrderBy(a => a.CreateAt, OrderByType.Desc) + .Select(it => new GoodsAttributePriceView() { Id = it.Id, GoodsId = it.GoodsId, GoodsattributeValueId = it.GoodsattributeValueId, Price = it.Price, GoodsattributeValue = it.GoodsattributeValue }) + .ToListAsync(); + return res; + } + /// + /// 添加 + /// + /// + /// + public async Task AddGoodsAttributePrice(GoodsAttributePriceDto dto) + { + var check=_db.Queryable().Where(x=>x.GoodsattributeValueId== dto.GoodsattributeValueId).Any(); + if (check) throw Oops.Oh("当前属性的价格已存在"); + var model = new BPA_GoodsAttributePrice + { + + GoodsId = dto.GoodsId, + GoodsattributeValueId = dto.GoodsattributeValueId, + GoodsattributeValue= dto.GoodsattributeValue, + Price = dto.Price + }; + + var res = await _db.Insertable(model).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); + return res > 0; + } + /// + /// 更新 + /// + /// + /// + public async Task UpdateGoodsAttributePrice(GoodsAttributePriceDto dto) + { + // 查询数据库中是否存在未删除的商品类型 + var resEntity = _db.Queryable().First(it => it.Id == dto.Id); + if (null == resEntity) + { + return false; + } + + resEntity.GoodsId = dto.GoodsId; + resEntity.GoodsattributeValueId = dto.GoodsattributeValueId; + resEntity.GoodsattributeValue = dto.GoodsattributeValue; + resEntity.Price = dto.Price; + var res = await _db.Updateable(resEntity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); + return res > 0; + } + /// + /// 删除 + /// + /// + /// + public async Task DelGoodsAttributePrice(string Id) + { + var resEntity = _db.Queryable().First(it => it.Id == Id); + if (resEntity == null) throw Oops.Oh("找不到相关记录"); + var res = await _db.Deleteable(resEntity).ExecuteCommandAsync(); + return res > 0; + } + } +} diff --git a/BPA.SAAS.Manage.Core/DataBase/BPA_GoodsAttributePrice.cs b/BPA.SAAS.Manage.Core/DataBase/BPA_GoodsAttributePrice.cs new file mode 100644 index 0000000..d23d6e8 --- /dev/null +++ b/BPA.SAAS.Manage.Core/DataBase/BPA_GoodsAttributePrice.cs @@ -0,0 +1,18 @@ +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.Core.DataBase +{ + public class BPA_GoodsAttributePrice : IBaseEntity, IGroupId + { + public string GoodsId { get; set; } + public string GoodsattributeValueId { get; set; } + public string GoodsattributeValue { get; set; } + public Decimal Price { get; set; } + public string GroupId { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Web.Core/Handlers/RequestAuditFiltercs.cs b/BPA.SAAS.Manage.Web.Core/Handlers/RequestAuditFiltercs.cs index e773775..27af602 100644 --- a/BPA.SAAS.Manage.Web.Core/Handlers/RequestAuditFiltercs.cs +++ b/BPA.SAAS.Manage.Web.Core/Handlers/RequestAuditFiltercs.cs @@ -63,11 +63,11 @@ namespace BPA.SAAS.Manage.Web.Core // 获取请求参数(写入日志,需序列化成字符串后存储) var parameters = context.ActionArguments; - foreach (var parameter in parameters) - { - var stingA = DtoValidator.GetSign(parameter.Value); - var vvvv = stingA; - } + //foreach (var parameter in parameters) + //{ + // var stingA = DtoValidator.GetSign(parameter.Value); + // var vvvv = stingA; + //} if (requestUrl.ToUpper().Contains("ExternalPlatform".ToUpper())) {