zhaoy 9 months ago
parent
commit
934f03fbba
10 changed files with 296 additions and 7 deletions
  1. +1
    -1
      BPA.SAAS.Manage.Application/Auth/AuthService.cs
  2. +1
    -1
      BPA.SAAS.Manage.Application/Auth/IAuthService.cs
  3. +17
    -0
      BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttributePrice/GoodsAttributePriceDto.cs
  4. +14
    -0
      BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttributePrice/GoodsAttributePriceQueryDto.cs
  5. +17
    -0
      BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttributePrice/GoodsAttributePriceView.cs
  6. +71
    -0
      BPA.SAAS.Manage.Application/DataBase/GoodsAttributePriceServices.cs
  7. +39
    -0
      BPA.SAAS.Manage.Application/DataBase/Interface/IGoodsAttributePriceService.cs
  8. +113
    -0
      BPA.SAAS.Manage.Application/DataBase/Services/GoodsAttributePriceService.cs
  9. +18
    -0
      BPA.SAAS.Manage.Core/DataBase/BPA_GoodsAttributePrice.cs
  10. +5
    -5
      BPA.SAAS.Manage.Web.Core/Handlers/RequestAuditFiltercs.cs

+ 1
- 1
BPA.SAAS.Manage.Application/Auth/AuthService.cs View File

@@ -32,7 +32,7 @@ namespace BPA.SAAS.Manage.Application.Auth
/// <returns></returns>
[HttpPost("/api/auth/login")]
[AllowAnonymous]
public async Task<LoginOutInfo> Login([FromHeader] string logintype, [Required] LoginInput input)
public async Task<LoginOutInfo> Login(LoginInput input)
{

// 获取加密后的密码


+ 1
- 1
BPA.SAAS.Manage.Application/Auth/IAuthService.cs View File

@@ -10,7 +10,7 @@ namespace BPA.SAAS.Manage.Application.Auth
{
public interface IAuthService
{
Task<LoginOutInfo> Login([FromHeader] string logintype, [Required] LoginInput input);
Task<LoginOutInfo> Login(LoginInput input);
Task<LoginOutput> GetLoginUserAsync();
Task LogoutAsync();



+ 17
- 0
BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttributePrice/GoodsAttributePriceDto.cs View File

@@ -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; }
}
}

+ 14
- 0
BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttributePrice/GoodsAttributePriceQueryDto.cs View File

@@ -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; }
}
}

+ 17
- 0
BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttributePrice/GoodsAttributePriceView.cs View File

@@ -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; }
}
}

+ 71
- 0
BPA.SAAS.Manage.Application/DataBase/GoodsAttributePriceServices.cs View File

@@ -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;
}
/// <summary>
/// 分页查询
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("/api/goodsattributeprice/getpage")]
public async Task<PageUtil> GetGoodsAttributePricePage(GoodsAttributePriceQueryDto dto)
{
return await _goodsAttributePriceService.GetGoodsAttributePricePage(dto);
}
/// <summary>
/// 查询商品属性价格列表
/// </summary>
/// <param name="goodsId"></param>
/// <returns></returns>
[HttpGet("/api/goodsattributeprice/getlist")]
public async Task<List<GoodsAttributePriceView>> GetGoodsAttributePriceList(string goodsId)
{
return await _goodsAttributePriceService.GetGoodsAttributePriceList(goodsId);
}
/// <summary>
/// 添加
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("/api/goodsattributeprice/add")]
public async Task<bool> AddGoodsAttributePrice(GoodsAttributePriceDto dto)
{
return await _goodsAttributePriceService.AddGoodsAttributePrice(dto);
}
/// <summary>
/// 更新
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("/api/goodsattributeprice/update")]
public async Task<bool> UpdateGoodsAttributePrice(GoodsAttributePriceDto dto)
{
return await _goodsAttributePriceService.UpdateGoodsAttributePrice(dto);
}
/// <summary>
/// 删除
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[HttpGet("/api/goodsattributeprice/delete")]
public async Task<bool> DelGoodsAttributePrice(string Id)
{
return await _goodsAttributePriceService.DelGoodsAttributePrice(Id);
}
}
}

+ 39
- 0
BPA.SAAS.Manage.Application/DataBase/Interface/IGoodsAttributePriceService.cs View File

@@ -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
{
// <summary>
/// 分页查询
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
Task<PageUtil> GetGoodsAttributePricePage(GoodsAttributePriceQueryDto dto);
Task<List<GoodsAttributePriceView>> GetGoodsAttributePriceList(string goodsId);
/// <summary>
/// 添加
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
Task<bool> AddGoodsAttributePrice(GoodsAttributePriceDto dto);
/// <summary>
/// 更新
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
Task<bool> UpdateGoodsAttributePrice(GoodsAttributePriceDto dto);
/// <summary>
/// 删除
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
Task<bool> DelGoodsAttributePrice(string Id);
}
}

+ 113
- 0
BPA.SAAS.Manage.Application/DataBase/Services/GoodsAttributePriceService.cs View File

@@ -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; // 推荐操作
}
/// <summary>
/// 分页查询
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
public async Task<PageUtil> GetGoodsAttributePricePage(GoodsAttributePriceQueryDto dto)
{
RefAsync<int> total =0;
var res = await _db.Queryable<BPA_GoodsAttributePrice>()
.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<List<GoodsAttributePriceView>> GetGoodsAttributePriceList(string goodsId)
{
var res = await _db.Queryable<BPA_GoodsAttributePrice>()
.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;
}
/// <summary>
/// 添加
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
public async Task<bool> AddGoodsAttributePrice(GoodsAttributePriceDto dto)
{
var check=_db.Queryable<BPA_GoodsAttributePrice>().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;
}
/// <summary>
/// 更新
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
public async Task<bool> UpdateGoodsAttributePrice(GoodsAttributePriceDto dto)
{
// 查询数据库中是否存在未删除的商品类型
var resEntity = _db.Queryable<BPA_GoodsAttributePrice>().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;
}
/// <summary>
/// 删除
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public async Task<bool> DelGoodsAttributePrice(string Id)
{
var resEntity = _db.Queryable<BPA_GoodsAttributePrice>().First(it => it.Id == Id);
if (resEntity == null) throw Oops.Oh("找不到相关记录");
var res = await _db.Deleteable(resEntity).ExecuteCommandAsync();
return res > 0;
}
}
}

+ 18
- 0
BPA.SAAS.Manage.Core/DataBase/BPA_GoodsAttributePrice.cs View File

@@ -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; }
}
}

+ 5
- 5
BPA.SAAS.Manage.Web.Core/Handlers/RequestAuditFiltercs.cs View File

@@ -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()))
{


Loading…
Cancel
Save