Browse Source

菜谱

master
zhaoy 11 months ago
parent
commit
19078a0680
17 changed files with 510 additions and 66 deletions
  1. +0
    -4
      BPA.SAAS.KitChenManage.Application/BPA.SAAS.KitChenManage.Application.csproj
  2. +136
    -11
      BPA.SAAS.KitChenManage.Application/BPA.SAAS.KitChenManage.Application.xml
  3. +22
    -0
      BPA.SAAS.KitChenManage.Application/Food/Dtos/FoodMenuBaseDto.cs
  4. +15
    -0
      BPA.SAAS.KitChenManage.Application/Food/Dtos/FoodMenuDtoInput.cs
  5. +15
    -0
      BPA.SAAS.KitChenManage.Application/Food/Dtos/FoodMenuDtoPageInput.cs
  6. +85
    -0
      BPA.SAAS.KitChenManage.Application/Food/FoodMenuServices.cs
  7. +131
    -0
      BPA.SAAS.KitChenManage.Application/Food/Services/FoodMenuService.cs
  8. +52
    -0
      BPA.SAAS.KitChenManage.Application/Food/Services/IFoodMenuService.cs
  9. +1
    -1
      BPA.SAAS.KitChenManage.Application/Store/Dtos/StoreDtoPageInput.cs
  10. +1
    -1
      BPA.SAAS.KitChenManage.Application/Store/Services/StoreService.cs
  11. +0
    -9
      BPA.SAAS.KitChenManage.Application/System/Dtos/Mapper.cs
  12. +0
    -7
      BPA.SAAS.KitChenManage.Application/System/Services/ISystemService.cs
  13. +0
    -10
      BPA.SAAS.KitChenManage.Application/System/Services/SystemService.cs
  14. +0
    -23
      BPA.SAAS.KitChenManage.Application/System/SystemAppService.cs
  15. +10
    -0
      BPA.SAAS.KitChenManage.Core/BPA.SAAS.KitChenManage.Core.xml
  16. +18
    -0
      BPA.SAAS.KitChenManage.Core/Model/BPA_FoodMenu.cs
  17. +24
    -0
      BPA.SAAS.KitChenManage.Core/Model/BPA_FoodMenuGoods.cs

+ 0
- 4
BPA.SAAS.KitChenManage.Application/BPA.SAAS.KitChenManage.Application.csproj View File

@@ -18,8 +18,4 @@
<ProjectReference Include="..\BPA.SAAS.KitChenManage.Core\BPA.SAAS.KitChenManage.Core.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="System\Services\" />
</ItemGroup>

</Project>

+ 136
- 11
BPA.SAAS.KitChenManage.Application/BPA.SAAS.KitChenManage.Application.xml View File

@@ -4,6 +4,142 @@
<name>BPA.SAAS.KitChenManage.Application</name>
</assembly>
<members>
<member name="P:BPA.SAAS.KitChenManage.Application.Food.Dtos.FoodMenuBaseDto.GoodsIds">
<summary>
商品菜品id
</summary>
</member>
<member name="P:BPA.SAAS.KitChenManage.Application.Food.Dtos.FoodMenuBaseDto.FoodMenuId">
<summary>
菜谱信息表
</summary>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.Food.FoodMenuServices.Page(BPA.SAAS.KitChenManage.Application.Food.Dtos.FoodMenuDtoPageInput)">
<summary>
分页查询
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.Food.FoodMenuServices.Add(BPA.SAAS.KitChenManage.Application.Food.Dtos.FoodMenuDtoInput)">
<summary>
添加
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.Food.FoodMenuServices.Update(BPA.SAAS.KitChenManage.Application.Food.Dtos.FoodMenuDtoInput)">
<summary>
修改
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.Food.FoodMenuServices.Delete(System.Collections.Generic.List{System.String})">
<summary>
删除
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.Food.FoodMenuServices.EditFoodMenuGoods(BPA.SAAS.KitChenManage.Application.Food.Dtos.FoodMenuBaseDto)">
<summary>
菜谱关联商品
</summary>
<param name="inputDto"></param>
<returns></returns>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.Food.FoodMenuServices.GetFoodMenuGoods(System.String)">
<summary>
查询菜谱绑定的商品
</summary>
<param name="foodMenuId"></param>
<returns></returns>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.Food.Services.FoodMenuService.Page(BPA.SAAS.KitChenManage.Application.Food.Dtos.FoodMenuDtoPageInput)">
<summary>
分页
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.Food.Services.FoodMenuService.Add(BPA.SAAS.KitChenManage.Application.Food.Dtos.FoodMenuDtoInput)">
<summary>
添加
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.Food.Services.FoodMenuService.Update(BPA.SAAS.KitChenManage.Application.Food.Dtos.FoodMenuDtoInput)">
<summary>
修改
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.Food.Services.FoodMenuService.Delete(System.Collections.Generic.List{System.String})">
<summary>
删除
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.Food.Services.FoodMenuService.EditFoodMenuGoods(BPA.SAAS.KitChenManage.Application.Food.Dtos.FoodMenuBaseDto)">
<summary>
菜谱关联商品
</summary>
<param name="inputDto"></param>
<returns></returns>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.Food.Services.FoodMenuService.GetFoodMenuGoods(System.String)">
<summary>
查询菜谱绑定的商品
</summary>
<param name="foodMenuId"></param>
<returns></returns>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.Food.Services.IFoodMenuService.Page(BPA.SAAS.KitChenManage.Application.Food.Dtos.FoodMenuDtoPageInput)">
<summary>
分页
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.Food.Services.IFoodMenuService.Add(BPA.SAAS.KitChenManage.Application.Food.Dtos.FoodMenuDtoInput)">
<summary>
添加
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.Food.Services.IFoodMenuService.Update(BPA.SAAS.KitChenManage.Application.Food.Dtos.FoodMenuDtoInput)">
<summary>
修改
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.Food.Services.IFoodMenuService.Delete(System.Collections.Generic.List{System.String})">
<summary>
删除
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.Food.Services.IFoodMenuService.EditFoodMenuGoods(BPA.SAAS.KitChenManage.Application.Food.Dtos.FoodMenuBaseDto)">
<summary>
菜谱关联商品
</summary>
<param name="inputDto"></param>
<returns></returns>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.Food.Services.IFoodMenuService.GetFoodMenuGoods(System.String)">
<summary>
查询菜谱绑定的商品
</summary>
<param name="foodMenuId"></param>
<returns></returns>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.Store.Services.IStoreService.Page(BPA.SAAS.KitChenManage.Application.Store.Dtos.StoreDtoPageInput)">
<summary>
分页
@@ -88,16 +224,5 @@
<param name="input"></param>
<returns></returns>
</member>
<member name="T:BPA.SAAS.KitChenManage.Application.SystemAppService">
<summary>
系统服务接口
</summary>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.SystemAppService.GetDescription">
<summary>
获取系统描述
</summary>
<returns></returns>
</member>
</members>
</doc>

+ 22
- 0
BPA.SAAS.KitChenManage.Application/Food/Dtos/FoodMenuBaseDto.cs View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.KitChenManage.Application.Food.Dtos
{
public class FoodMenuBaseDto
{
/// <summary>
/// 商品菜品id
/// </summary>
public List<string> GoodsIds { get; set; }

/// <summary>
/// 菜谱信息表
/// </summary>
public string FoodMenuId { get; set; }
}
}

+ 15
- 0
BPA.SAAS.KitChenManage.Application/Food/Dtos/FoodMenuDtoInput.cs View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.KitChenManage.Application.Food.Dtos
{
public class FoodMenuDtoInput
{
public string Id { get; set; }
public string Name { get; set; }
public string Code { get; set; }
}
}

+ 15
- 0
BPA.SAAS.KitChenManage.Application/Food/Dtos/FoodMenuDtoPageInput.cs View File

@@ -0,0 +1,15 @@
using BPA.SAAS.KitChenManage.Core.Base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.KitChenManage.Application.Food.Dtos
{
public class FoodMenuDtoPageInput: PageInputBase
{
public string Name { get; set; }
public string Code { get; set; }
}
}

+ 85
- 0
BPA.SAAS.KitChenManage.Application/Food/FoodMenuServices.cs View File

@@ -0,0 +1,85 @@
using BPA.SAAS.KitChenManage.Application.Food.Dtos;
using BPA.SAAS.KitChenManage.Application.Food.Services;
using BPA.SAAS.KitChenManage.Application.Store.Dtos;
using BPA.SAAS.KitChenManage.Application.Store.Services;
using BPA.SAAS.KitChenManage.Core.Base;
using BPA.SAAS.KitChenManage.Core.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.KitChenManage.Application.Food
{
[ApiDescriptionSettings("FoodMenu", Tag = "场景菜谱管理")]
public class FoodMenuServices : IDynamicApiController
{
IFoodMenuService _foodmenuService;
public FoodMenuServices(IFoodMenuService foodmenuService)
{
_foodmenuService = foodmenuService;
}
/// <summary>
/// 分页查询
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/api/foodmenu/page")]

public async Task<PageUtil> Page(FoodMenuDtoPageInput input)
{
return await _foodmenuService.Page(input);
}
/// <summary>
/// 添加
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/api/foodmenu/add")]
public async Task<bool> Add(FoodMenuDtoInput input)
{
return await _foodmenuService.Add(input);
}
/// <summary>
/// 修改
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/api/foodmenu/update")]
public async Task<bool> Update(FoodMenuDtoInput input)
{
return await _foodmenuService.Update(input);
}
/// <summary>
/// 删除
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/api/foodmenu/delete")]
public async Task<bool> Delete(List<string> input)
{
return await _foodmenuService.Delete(input);
}
/// <summary>
/// 菜谱关联商品
/// </summary>
/// <param name="inputDto"></param>
/// <returns></returns>
[HttpPost("/api/foodmenu/editfoodmenugoods")]
public async Task<bool> EditFoodMenuGoods(FoodMenuBaseDto inputDto)
{
return await _foodmenuService.EditFoodMenuGoods(inputDto);
}
/// <summary>
/// 查询菜谱绑定的商品
/// </summary>
/// <param name="foodMenuId"></param>
/// <returns></returns>
[HttpGet("/api/foodmenu/getfoodmenugoods")]
public async Task<List<BPA_FoodMenuGoods>> GetFoodMenuGoods(string foodMenuId)
{
return await _foodmenuService.GetFoodMenuGoods(foodMenuId);
}
}
}

+ 131
- 0
BPA.SAAS.KitChenManage.Application/Food/Services/FoodMenuService.cs View File

@@ -0,0 +1,131 @@
using BPA.SAAS.KitChenManage.Application.Food.Dtos;
using BPA.SAAS.KitChenManage.Application.Store.Dtos;
using BPA.SAAS.KitChenManage.Application.Store.Services;
using BPA.SAAS.KitChenManage.Core.Base;
using BPA.SAAS.KitChenManage.Core.Model;
using Furion.LinqBuilder;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.KitChenManage.Application.Food.Services
{
public class FoodMenuService : IFoodMenuService, ITransient
{
private readonly ISqlSugarClient _db;
public FoodMenuService(ISqlSugarClient db)
{
_db=db;
}
/// <summary>
/// 分页
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public async Task<PageUtil> Page(FoodMenuDtoPageInput input)
{
RefAsync<int> total = 0;
var res = await _db.Queryable<BPA_FoodMenu>()
.WhereIF(!input.Code.IsNullOrEmpty(), t => t.Code.Contains(input.Code))
.WhereIF(!input.Name.IsNullOrEmpty(), t => t.Name.Contains(input.Name))

.Select(t => new
{
CreateAt = t.CreateAt,
Id = t.Id,
Name = t.Name,
Code = t.Code,
}).OrderBy(x => x.CreateAt, OrderByType.Desc).ToPageListAsync(input.Current, input.PageSize, total);
PageUtil util = new PageUtil()
{
Total = total,
Data = res

};
return util;
}
/// <summary>
/// 添加
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public async Task<bool> Add(FoodMenuDtoInput input)
{
var Store = input.Adapt<BPA_FoodMenu>();
// role.DataScopeType = DataScopeType.ALL;
return await _db.Insertable(Store).CallEntityMethod(t => t.Create()).ExecuteCommandAsync() > 0;
}
/// <summary>
/// 修改
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public async Task<bool> Update(FoodMenuDtoInput input)
{
var BPA_Food = await _db.Queryable<BPA_FoodMenu>().Where(a => a.Id == input.Id).FirstAsync();

var Store = await _db.Queryable<BPA_FoodMenu>().Where(a => a.Id == input.Id).FirstAsync();
Store.Name = input.Name;
Store.Code = input.Code;
return _db.Updateable(Store).ExecuteCommandHasChange();

}
/// <summary>
/// 删除
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public async Task<bool> Delete(List<string> input)
{
try
{
// 查询数据库中是否存在未删除的活动信息
var resEntitites = _db.Queryable<BPA_FoodMenu>().In(input).ToList();
var res = await _db.Deleteable(resEntitites).ExecuteCommandAsync();
return res > 0;

}
catch (Exception)
{
throw Oops.Oh("删除失败");
}
}
/// <summary>
/// 菜谱关联商品
/// </summary>
/// <param name="inputDto"></param>
/// <returns></returns>
public async Task<bool> EditFoodMenuGoods(FoodMenuBaseDto inputDto)
{
//删除设置的菜谱
await _db.Deleteable<BPA_FoodMenuGoods>()
.Where(x => inputDto.FoodMenuId.Contains(x.FoodMenuId)).ExecuteCommandAsync();
//菜谱添加商品
var data = inputDto.GoodsIds.Select(x => new BPA_FoodMenuGoods()
{
FoodMenuId = inputDto.FoodMenuId,

GoodsId = x,
}).ToList();
if (data.Count > 0)
{
var res = await _db.Insertable(data).CallEntityMethod(m => m.Create()).ExecuteCommandAsync();
}
return true;

}
/// <summary>
/// 查询菜谱绑定的商品
/// </summary>
/// <param name="foodMenuId"></param>
/// <returns></returns>
public async Task<List<BPA_FoodMenuGoods>> GetFoodMenuGoods(string foodMenuId)
{
return await _db.Queryable<BPA_FoodMenuGoods>().Where(x => x.FoodMenuId == foodMenuId).ToListAsync();
}
}
}

+ 52
- 0
BPA.SAAS.KitChenManage.Application/Food/Services/IFoodMenuService.cs View File

@@ -0,0 +1,52 @@
using BPA.SAAS.KitChenManage.Application.Food.Dtos;
using BPA.SAAS.KitChenManage.Application.Store.Dtos;
using BPA.SAAS.KitChenManage.Core.Base;
using BPA.SAAS.KitChenManage.Core.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.KitChenManage.Application.Food.Services
{
public interface IFoodMenuService
{
/// <summary>
/// 分页
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task<PageUtil> Page(FoodMenuDtoPageInput input);
/// <summary>
/// 添加
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task<bool> Add(FoodMenuDtoInput input);
/// <summary>
/// 修改
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task<bool> Update(FoodMenuDtoInput input);
/// <summary>
/// 删除
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task<bool> Delete(List<string> input);
/// <summary>
/// 菜谱关联商品
/// </summary>
/// <param name="inputDto"></param>
/// <returns></returns>
Task<bool> EditFoodMenuGoods(FoodMenuBaseDto inputDto);
/// <summary>
/// 查询菜谱绑定的商品
/// </summary>
/// <param name="foodMenuId"></param>
/// <returns></returns>
Task<List<BPA_FoodMenuGoods>> GetFoodMenuGoods(string foodMenuId);
}
}

+ 1
- 1
BPA.SAAS.KitChenManage.Application/Store/Dtos/StoreDtoPageInput.cs View File

@@ -10,7 +10,7 @@ namespace BPA.SAAS.KitChenManage.Application.Store.Dtos
public class StoreDtoPageInput: PageInputBase
{
public string Name { get; set; }
public string OrgId { get; set; }
public string OrgName { get; set; }
public string Phone { get; set; }
}
}

+ 1
- 1
BPA.SAAS.KitChenManage.Application/Store/Services/StoreService.cs View File

@@ -26,7 +26,7 @@ namespace BPA.SAAS.KitChenManage.Application.Store.Services
{
RefAsync<int> total = 0;
var res = await _db.Queryable<BPA_Store>()
.WhereIF(!input.OrgId.IsNullOrEmpty(), t => t.OrgId.Contains(input.OrgId))
.WhereIF(!input.OrgName.IsNullOrEmpty(), t => t.OrgId.Contains(input.OrgName))
.WhereIF(!input.Name.IsNullOrEmpty(), t => t.Name.Contains(input.Name))

.Select(t => new StoreDtoOutput


+ 0
- 9
BPA.SAAS.KitChenManage.Application/System/Dtos/Mapper.cs View File

@@ -1,9 +0,0 @@
namespace BPA.SAAS.KitChenManage.Application
{
public class Mapper : IRegister
{
public void Register(TypeAdapterConfig config)
{
}
}
}

+ 0
- 7
BPA.SAAS.KitChenManage.Application/System/Services/ISystemService.cs View File

@@ -1,7 +0,0 @@
namespace BPA.SAAS.KitChenManage.Application
{
public interface ISystemService
{
string GetDescription();
}
}

+ 0
- 10
BPA.SAAS.KitChenManage.Application/System/Services/SystemService.cs View File

@@ -1,10 +0,0 @@
namespace BPA.SAAS.KitChenManage.Application
{
public class SystemService : ISystemService, ITransient
{
public string GetDescription()
{
return "让 .NET 开发更简单,更通用,更流行。";
}
}
}

+ 0
- 23
BPA.SAAS.KitChenManage.Application/System/SystemAppService.cs View File

@@ -1,23 +0,0 @@
namespace BPA.SAAS.KitChenManage.Application
{
/// <summary>
/// 系统服务接口
/// </summary>
public class SystemAppService : IDynamicApiController
{
private readonly ISystemService _systemService;
public SystemAppService(ISystemService systemService)
{
_systemService = systemService;
}

/// <summary>
/// 获取系统描述
/// </summary>
/// <returns></returns>
public string GetDescription()
{
return _systemService.GetDescription();
}
}
}

+ 10
- 0
BPA.SAAS.KitChenManage.Core/BPA.SAAS.KitChenManage.Core.xml View File

@@ -60,5 +60,15 @@
</summary>
</member>
<!-- Badly formed XML comment ignored for member "M:BPA.SAAS.KitChenManage.Core.DbContext.IsSuperAdmin" -->
<member name="P:BPA.SAAS.KitChenManage.Core.Model.BPA_FoodMenuGoods.FoodMenuId">
<summary>
菜谱id
</summary>
</member>
<member name="P:BPA.SAAS.KitChenManage.Core.Model.BPA_FoodMenuGoods.GoodsId">
<summary>
商品id
</summary>
</member>
</members>
</doc>

+ 18
- 0
BPA.SAAS.KitChenManage.Core/Model/BPA_FoodMenu.cs View File

@@ -0,0 +1,18 @@
using BPA.SAAS.KitChenManage.Core.Base;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.KitChenManage.Core.Model
{
[SugarTable("bpa_foodmenu")]
public class BPA_FoodMenu : IBaseEntity, IGroupId
{
public string Name { get; set; }
public string Code { get; set; }
public string GroupId { get; set; }
}
}

+ 24
- 0
BPA.SAAS.KitChenManage.Core/Model/BPA_FoodMenuGoods.cs View File

@@ -0,0 +1,24 @@
using BPA.SAAS.KitChenManage.Core.Base;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.KitChenManage.Core.Model
{
[SugarTable("bpa_foodmenugoods")]
public class BPA_FoodMenuGoods : IBaseEntity, IGroupId
{
/// <summary>
/// 菜谱id
/// </summary>
public string FoodMenuId { get; set; }
/// <summary>
/// 商品id
/// </summary>
public string GoodsId { get; set; }
public string GroupId { get; set; }
}
}

Loading…
Cancel
Save