fix 解决dishersservice冲突
This commit is contained in:
@@ -7,7 +7,6 @@ using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Org.BouncyCastle.Asn1.Ocsp;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Controller;
|
||||
|
||||
|
||||
@@ -12,6 +12,12 @@ public class DishesSaveRequest
|
||||
[Required]
|
||||
public Guid CategoryCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 营业点
|
||||
/// </summary>
|
||||
[Required]
|
||||
public Guid BusinessPlaceCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜品名称
|
||||
/// </summary>
|
||||
@@ -40,6 +46,12 @@ public class DishesSaveRequest
|
||||
/// </summary>
|
||||
public string ImageUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
[MinLength(1)]
|
||||
public List<string> Units { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using SqlSugar.DbConvert;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Response;
|
||||
|
||||
@@ -11,11 +9,6 @@ public class DishesMenuPageResponse
|
||||
/// </summary>
|
||||
public string CustomCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜单类型
|
||||
/// </summary>
|
||||
public CanteenMenuEnumType Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属营业点
|
||||
/// </summary>
|
||||
|
||||
@@ -1,40 +1,35 @@
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Response;
|
||||
|
||||
public class DishesResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 大类
|
||||
/// 分类
|
||||
/// </summary>
|
||||
public string Categories { get; set; }
|
||||
public Guid CategoryCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 小类
|
||||
/// 分类
|
||||
/// </summary>
|
||||
public string SubCategories { get; set; }
|
||||
public string CategoryName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 营业点
|
||||
/// </summary>
|
||||
public Guid BusinessPlaceCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜品编码
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
public string CustomCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜品名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜品类型
|
||||
/// </summary>
|
||||
public CanteenMenuEnumType Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜品类型描述
|
||||
/// </summary>
|
||||
public string TypeDescription => Type.GetDescription();
|
||||
|
||||
/// <summary>
|
||||
/// 描述
|
||||
/// </summary>
|
||||
@@ -43,25 +38,23 @@ public class DishesResponse
|
||||
/// <summary>
|
||||
/// 单价
|
||||
/// </summary>
|
||||
public decimal Amount { get; set; }
|
||||
public decimal Price { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
public string Unit { get; set; }
|
||||
public List<string> Units => CurrnetUnits.ToObject<List<string>>();
|
||||
|
||||
[JsonIgnore]
|
||||
public string CurrnetUnits { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图片
|
||||
/// </summary>
|
||||
public string Image { get; set; }
|
||||
public string ImageUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public bool Enable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 限售份数
|
||||
/// </summary>
|
||||
public int? RestrictedNum { get; set; } = null;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class DishesMenuService : IDishesMenuService
|
||||
Number = number,
|
||||
Price = price,
|
||||
|
||||
Type = CanteenMenuEnumType.Booking,
|
||||
Type = CanteenApplicaitonTypeEnumType.Booking,
|
||||
Version = 0,
|
||||
Enable = false,
|
||||
};
|
||||
|
||||
@@ -8,8 +8,6 @@ using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Services.Implements;
|
||||
|
||||
@@ -29,9 +27,15 @@ public class DishesService : IDishesService
|
||||
//todo 营业点权限
|
||||
|
||||
return await _dbContext.Queryable<DishesEntity>()
|
||||
.LeftJoin<DishesCategoryEntity>((x, category) => x.CategoryCode == category.Code)
|
||||
.WhereIF(request.Search.IsPresent(), x => x.CustomCode == request.Search || x.Name.Contains(request.Search))
|
||||
.OrderBy(x => x.CreateTime, SqlSugar.OrderByType.Desc)
|
||||
.Select<DishesResponse>()
|
||||
.Select((x, category) => new DishesResponse
|
||||
{
|
||||
CurrnetUnits = x.Units.ToString(),
|
||||
CategoryName = category.Name,
|
||||
|
||||
}, true)
|
||||
.ToPageListAsync(request);
|
||||
}
|
||||
|
||||
@@ -61,7 +65,7 @@ public class DishesService : IDishesService
|
||||
.FirstAsync();
|
||||
shift.ThrowIfNull($"营业点{request.PlaceCode}吗,没有餐别!");
|
||||
|
||||
var BusinessShiftMealRelationships= await _dbContext.Queryable<BusinessShiftMealRelationshipEntity>()
|
||||
var BusinessShiftMealRelationships = await _dbContext.Queryable<BusinessShiftMealRelationshipEntity>()
|
||||
.Where(x => x.ShiftCode == shift.ShiftCode)
|
||||
.Select<BusinessShiftMealRelationshipResponse>()
|
||||
.ToListAsync();
|
||||
@@ -75,7 +79,7 @@ public class DishesService : IDishesService
|
||||
{
|
||||
payTypes.Add(BalanceRecordSourceEnumType.LocalTenantSubsidies);
|
||||
}
|
||||
|
||||
|
||||
var res = new GetDishesMenusBookingResponse
|
||||
{
|
||||
BusinessShiftMealRelationships = BusinessShiftMealRelationships,
|
||||
|
||||
Reference in New Issue
Block a user