10/20更新
This commit is contained in:
@@ -150,6 +150,18 @@
|
|||||||
<param name="ids"></param>
|
<param name="ids"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.SkuController.PageList(Yi.Framework.Model.Models.SkuEntity,Yi.Framework.Common.Models.PageParModel)">
|
||||||
|
<summary>
|
||||||
|
动态条件分页查询
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.SpuController.PageList(Yi.Framework.Model.Models.SpuEntity,Yi.Framework.Common.Models.PageParModel)">
|
||||||
|
<summary>
|
||||||
|
动态条件分页查询
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="T:Yi.Framework.ApiMicroservice.Controllers.AccountController">
|
<member name="T:Yi.Framework.ApiMicroservice.Controllers.AccountController">
|
||||||
<summary>
|
<summary>
|
||||||
账户管理
|
账户管理
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
{
|
{
|
||||||
//如果标题为空,默认为内容的前20个字符
|
//如果标题为空,默认为内容的前20个字符
|
||||||
entity.Title = string.IsNullOrEmpty(entity.Title) ?
|
entity.Title = string.IsNullOrEmpty(entity.Title) ?
|
||||||
(entity.Content.Length > 20 ? entity.Content.Substring(0, 20) : entity.Content) :
|
(entity.Content?.Length > 20 ? entity.Content.Substring(0, 20) : entity.Content) :
|
||||||
entity.Title;
|
entity.Title;
|
||||||
entity.UserId = HttpContext.GetUserIdInfo();
|
entity.UserId = HttpContext.GetUserIdInfo();
|
||||||
return base.Add(entity);
|
return base.Add(entity);
|
||||||
|
|||||||
@@ -17,12 +17,22 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
{
|
{
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/[controller]/[action]")]
|
[Route("api/[controller]/[action]")]
|
||||||
public class SkuController : BaseCrudController<SkuEntity>
|
public class SkuController : BaseSimpleCrudController<SkuEntity>
|
||||||
{
|
{
|
||||||
private ISkuService _iSkuService;
|
private ISkuService _iSkuService;
|
||||||
public SkuController(ILogger<SkuEntity> logger, ISkuService iSkuService) : base(logger, iSkuService)
|
public SkuController(ILogger<SkuEntity> logger, ISkuService iSkuService) : base(logger, iSkuService)
|
||||||
{
|
{
|
||||||
_iSkuService = iSkuService;
|
_iSkuService = iSkuService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 动态条件分页查询
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<Result> PageList([FromQuery] SkuEntity eneity, [FromQuery] PageParModel page)
|
||||||
|
{
|
||||||
|
return Result.Success().SetData(await _iSkuService.SelctPageList(eneity, page));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,12 +17,22 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
{
|
{
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/[controller]/[action]")]
|
[Route("api/[controller]/[action]")]
|
||||||
public class SpuController : BaseCrudController<SpuEntity>
|
public class SpuController : BaseSimpleCrudController<SpuEntity>
|
||||||
{
|
{
|
||||||
private ISpuService _iSpuService;
|
private ISpuService _iSpuService;
|
||||||
public SpuController(ILogger<SpuEntity> logger, ISpuService iSpuService) : base(logger, iSpuService)
|
public SpuController(ILogger<SpuEntity> logger, ISpuService iSpuService) : base(logger, iSpuService)
|
||||||
{
|
{
|
||||||
_iSpuService = iSpuService;
|
_iSpuService = iSpuService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 动态条件分页查询
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<Result> PageList([FromQuery] SpuEntity eneity, [FromQuery] PageParModel page)
|
||||||
|
{
|
||||||
|
return Result.Success().SetData(await _iSpuService.SelctPageList(eneity, page));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
19
Yi.Framework.Net6/Yi.Framework.Interface/ISkuService.cs
Normal file
19
Yi.Framework.Net6/Yi.Framework.Interface/ISkuService.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Yi.Framework.Common.Models;
|
||||||
|
using Yi.Framework.Model.Models;
|
||||||
|
using Yi.Framework.Repository;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Interface
|
||||||
|
{
|
||||||
|
public partial interface ISkuService:IBaseService<SkuEntity>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 动态条件分页查询
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="eneity"></param>
|
||||||
|
/// <param name="page"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<PageModel<List<SkuEntity>>> SelctPageList(SkuEntity entity, PageParModel page);
|
||||||
|
}
|
||||||
|
}
|
||||||
19
Yi.Framework.Net6/Yi.Framework.Interface/ISpuService.cs
Normal file
19
Yi.Framework.Net6/Yi.Framework.Interface/ISpuService.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Yi.Framework.Common.Models;
|
||||||
|
using Yi.Framework.Model.Models;
|
||||||
|
using Yi.Framework.Repository;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Interface
|
||||||
|
{
|
||||||
|
public partial interface ISpuService:IBaseService<SpuEntity>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 动态条件分页查询
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="eneity"></param>
|
||||||
|
/// <param name="page"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<PageModel<List<SpuEntity>>> SelctPageList(SpuEntity entity, PageParModel page);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,17 +27,17 @@ namespace Yi.Framework.Model.Models
|
|||||||
/// 商品名称
|
/// 商品名称
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarColumn(ColumnName="SpuName" )]
|
[SugarColumn(ColumnName="SpuName" )]
|
||||||
public string SpuName { get; set; }
|
public string? SpuName { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 商品详情
|
/// 商品详情
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarColumn(ColumnName="Details" )]
|
[SugarColumn(ColumnName="Details" )]
|
||||||
public string Details { get; set; }
|
public string? Details { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 商品价格
|
/// 商品价格
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarColumn(ColumnName="Price" )]
|
[SugarColumn(ColumnName="Price" )]
|
||||||
public string Price { get; set; }
|
public string? Price { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建者
|
/// 创建者
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace Yi.Framework.Model.Models
|
|||||||
public List<SpecsSpuInfoModel>? SpecsSpuInfo { get; set; }
|
public List<SpecsSpuInfoModel>? SpecsSpuInfo { get; set; }
|
||||||
|
|
||||||
[Navigate(NavigateType.OneToMany, nameof(SkuEntity.SpuId))]
|
[Navigate(NavigateType.OneToMany, nameof(SkuEntity.SpuId))]
|
||||||
public List<SpuEntity>? Spus { get; set; }
|
public List<SkuEntity>? Skus { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SpecsSpuAllInfoModel
|
public class SpecsSpuAllInfoModel
|
||||||
|
|||||||
25
Yi.Framework.Net6/Yi.Framework.Service/SkuService.cs
Normal file
25
Yi.Framework.Net6/Yi.Framework.Service/SkuService.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Yi.Framework.Common.Models;
|
||||||
|
using Yi.Framework.Interface;
|
||||||
|
using Yi.Framework.Model.Models;
|
||||||
|
using Yi.Framework.Repository;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Service
|
||||||
|
{
|
||||||
|
public partial class SkuService : BaseService<SkuEntity>, ISkuService
|
||||||
|
{
|
||||||
|
public async Task<PageModel<List<SkuEntity>>> SelctPageList(SkuEntity enetity, PageParModel page)
|
||||||
|
{
|
||||||
|
RefAsync<int> total = 0;
|
||||||
|
var data = await _repository._DbQueryable
|
||||||
|
|
||||||
|
.WhereIF(page.StartTime is not null && page.EndTime is not null, u => u.CreateTime >= page.StartTime && u.CreateTime <= page.EndTime)
|
||||||
|
.WhereIF(enetity.IsDeleted is not null, u => u.IsDeleted == enetity.IsDeleted)
|
||||||
|
.OrderBy(u => u.CreateTime, OrderByType.Desc)
|
||||||
|
.ToPageListAsync(page.PageNum, page.PageSize, total);
|
||||||
|
return new PageModel<List<SkuEntity>>(data, total);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
25
Yi.Framework.Net6/Yi.Framework.Service/SpuService.cs
Normal file
25
Yi.Framework.Net6/Yi.Framework.Service/SpuService.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Yi.Framework.Common.Models;
|
||||||
|
using Yi.Framework.Interface;
|
||||||
|
using Yi.Framework.Model.Models;
|
||||||
|
using Yi.Framework.Repository;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Service
|
||||||
|
{
|
||||||
|
public partial class SpuService : BaseService<SpuEntity>, ISpuService
|
||||||
|
{
|
||||||
|
public async Task<PageModel<List<SpuEntity>>> SelctPageList(SpuEntity enetity, PageParModel page)
|
||||||
|
{
|
||||||
|
RefAsync<int> total = 0;
|
||||||
|
var data = await _repository._DbQueryable
|
||||||
|
|
||||||
|
.WhereIF(page.StartTime is not null && page.EndTime is not null, u => u.CreateTime >= page.StartTime && u.CreateTime <= page.EndTime)
|
||||||
|
.WhereIF(enetity.IsDeleted is not null, u => u.IsDeleted == enetity.IsDeleted)
|
||||||
|
.OrderBy(u => u.CreateTime, OrderByType.Desc)
|
||||||
|
.ToPageListAsync(page.PageNum, page.PageSize, total);
|
||||||
|
return new PageModel<List<SpuEntity>>(data, total);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user