fix 代码优化
This commit is contained in:
@@ -51,7 +51,7 @@ public class DishesMenusController : ControllerBase
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 菜单明细
|
||||
/// 菜单信息明细
|
||||
/// </summary>
|
||||
/// <param name="date"></param>
|
||||
/// <param name="businessPlaceCode"></param>
|
||||
@@ -103,7 +103,7 @@ public class DishesMenusController : ControllerBase
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("setting")]
|
||||
public async Task<GetDishesMenusBookingResponse> GetDishesMenusBookingSetting([FromQuery] GetDishesMenusBookingRequest request)
|
||||
public async Task<DishesMenusBookingSettingResponse> GetDishesMenusBookingSetting([FromQuery] GetDishesMenusBookingRequest request)
|
||||
{
|
||||
return await _dishesService.GetDishesMenusBookingSetting(request);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,13 @@ public class DishesCategorySaveRequest
|
||||
{
|
||||
public long? Id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 营业点
|
||||
/// </summary>
|
||||
[Required]
|
||||
public Guid BusinessPlaceCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// PCode
|
||||
/// </summary>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Response
|
||||
namespace Dlhis.Basic.Dishes.Response;
|
||||
|
||||
public class BalanceRecordSourceEnumDto
|
||||
{
|
||||
public class BalanceRecordSourceEnumDto
|
||||
{
|
||||
public BalanceRecordSourceEnumType Type { get; set; }
|
||||
public string TypeCN => Type.GetDescription();
|
||||
}
|
||||
public BalanceRecordSourceEnumType Type { get; set; }
|
||||
|
||||
public string TypeDesc => Type.GetDescription();
|
||||
}
|
||||
|
||||
@@ -1,29 +1,28 @@
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Response
|
||||
namespace Dlhis.Basic.Dishes.Response;
|
||||
|
||||
public class BusinessShiftMealRelationshipResponse
|
||||
{
|
||||
public class BusinessShiftMealRelationshipResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 餐别Code
|
||||
/// </summary>
|
||||
public Guid ShiftCode { get; set; }
|
||||
/// <summary>
|
||||
/// 餐别Code
|
||||
/// </summary>
|
||||
public Guid ShiftCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐别手工号
|
||||
/// </summary>
|
||||
public string ShiftCustomCode { get; set; }
|
||||
/// <summary>
|
||||
/// 餐别手工号
|
||||
/// </summary>
|
||||
public string ShiftCustomCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐次
|
||||
/// </summary>
|
||||
public ShiftEnumType ShiftType { get; set; }
|
||||
/// <summary>
|
||||
/// 餐次
|
||||
/// </summary>
|
||||
public ShiftEnumType ShiftType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐次CN
|
||||
/// </summary>
|
||||
public string ShiftTypeCN => ShiftType.GetDescription();
|
||||
/// <summary>
|
||||
/// 餐次CN
|
||||
/// </summary>
|
||||
public string ShiftTypeDesc => ShiftType.GetDescription();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace Dlhis.Basic.Dishes.Response;
|
||||
|
||||
public class DishesMenusBookingSettingResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 服务端时间
|
||||
/// </summary>
|
||||
public DateTime ServerTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐别-餐次信息
|
||||
/// </summary>
|
||||
public List<BusinessShiftMealRelationshipResponse> ShiftInfos { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 支付方式
|
||||
/// </summary>
|
||||
public List<BalanceRecordSourceEnumDto> PayTypes { get; set; }
|
||||
}
|
||||
@@ -5,6 +5,8 @@ namespace Dlhis.Basic.Dishes.Response;
|
||||
|
||||
public class DishesResponse
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分类
|
||||
/// </summary>
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using SqlSugar.DbConvert;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Response
|
||||
{
|
||||
public class GetDishesMenusBookingResponse
|
||||
{
|
||||
public List<BusinessShiftMealRelationshipResponse> BusinessShiftMealRelationships { get; set; }
|
||||
|
||||
public DateTime ServiceTime { get; set; }
|
||||
|
||||
public List<BalanceRecordSourceEnumDto> PayTypes { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,6 @@ public interface IDishesService : IScopeDependency
|
||||
|
||||
Task<DishesDetailResponse> GetDishesDetailByIdAsync(long id);
|
||||
|
||||
Task<GetDishesMenusBookingResponse> GetDishesMenusBookingSetting(GetDishesMenusBookingRequest request);
|
||||
Task<DishesMenusBookingSettingResponse> GetDishesMenusBookingSetting(GetDishesMenusBookingRequest request);
|
||||
|
||||
}
|
||||
|
||||
@@ -8,20 +8,16 @@ 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;
|
||||
|
||||
public class DishesService : IDishesService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
public DishesService(IDbContext dbContext, IConfiguration configuration)
|
||||
public DishesService(IDbContext dbContext)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
public async Task<Pagination<DishesResponse>> GetDishesPageAsync(DishesPageRequest request)
|
||||
@@ -35,6 +31,7 @@ public class DishesService : IDishesService
|
||||
.OrderBy(x => x.CreateTime, SqlSugar.OrderByType.Desc)
|
||||
.Select((x, category) => new DishesResponse
|
||||
{
|
||||
Id = x.Id,
|
||||
CurrnetUnits = x.Units.ToString(),
|
||||
CategoryName = category.Name,
|
||||
|
||||
@@ -61,7 +58,7 @@ public class DishesService : IDishesService
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<GetDishesMenusBookingResponse> GetDishesMenusBookingSetting(GetDishesMenusBookingRequest request)
|
||||
public async Task<DishesMenusBookingSettingResponse> GetDishesMenusBookingSetting(GetDishesMenusBookingRequest request)
|
||||
{
|
||||
// 读取最晚订餐的时间
|
||||
var strDatetime = await _dbContext.Queryable<CanteenSettingEntity>()
|
||||
@@ -72,9 +69,9 @@ public class DishesService : IDishesService
|
||||
DateTime dateTime;
|
||||
DateTime.TryParseExact(strDatetime, "HH:mm:ss", null, System.Globalization.DateTimeStyles.None, out dateTime);
|
||||
|
||||
var res = new GetDishesMenusBookingResponse
|
||||
var res = new DishesMenusBookingSettingResponse
|
||||
{
|
||||
ServiceTime = dateTime,
|
||||
ServerTime = dateTime,
|
||||
};
|
||||
|
||||
var shift = await _dbContext.Queryable<BusinessPlaceShiftRelationshipEntity>()
|
||||
@@ -94,7 +91,7 @@ public class DishesService : IDishesService
|
||||
.Where(x => x.ShiftCode == shift.ShiftCode)
|
||||
.Select<BusinessShiftMealRelationshipResponse>()
|
||||
.ToListAsync();
|
||||
res.BusinessShiftMealRelationships = businessShiftMealRelationships;
|
||||
res.ShiftInfos = businessShiftMealRelationships;
|
||||
|
||||
if (shift.TenantId == request.Factory)
|
||||
{
|
||||
@@ -108,7 +105,7 @@ public class DishesService : IDishesService
|
||||
}
|
||||
res.PayTypes = payTypes;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<DishesDetailResponse> GetDishesDetailByIdAsync(long id)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Basic.Organization.Services;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -45,39 +46,6 @@ public class GainfosController : ControllerBase
|
||||
return await _gainfoService.GetPageAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 档案表修改
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut("update")]
|
||||
public async Task UpdateAsync(GainfoSaveRequest request)
|
||||
{
|
||||
await _gainfoService.UpdateAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 离职
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("dimission")]
|
||||
public async Task DimissionAsync(GainfoDimissionRequest request)
|
||||
{
|
||||
await _gainfoService.DimissionAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 入职
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("onboarding")]
|
||||
public async Task OnboardingAsync(GainfoDimissionRequest request)
|
||||
{
|
||||
await _gainfoService.OnboardingAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前人员信息,余额
|
||||
/// </summary>
|
||||
@@ -93,6 +61,7 @@ public class GainfosController : ControllerBase
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost("face")]
|
||||
[Transactional]
|
||||
public async Task UploadFaceAsync(GainfoUploadFaceRequest request)
|
||||
{
|
||||
await _gainfoService.UploadFaceAsync(request);
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using SqlSugar;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Response;
|
||||
|
||||
@@ -122,17 +120,11 @@ public class GainfoDetailResponse
|
||||
/// </summary>
|
||||
public string NationName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 人脸base64
|
||||
/// </summary>
|
||||
public string Face { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 在职状态
|
||||
/// </summary>
|
||||
public string Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 厂区
|
||||
/// </summary>
|
||||
|
||||
@@ -13,7 +13,6 @@ using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services.Implements;
|
||||
@@ -28,7 +27,6 @@ public class GainfoService : IGainfoService
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly ILogger<GainfoService> _logger;
|
||||
private readonly IDepartmentService _departmentService;
|
||||
|
||||
public GainfoService(IGainfoStore gainfoStore,
|
||||
IDbContext dbContext,
|
||||
@@ -48,7 +46,6 @@ public class GainfoService : IGainfoService
|
||||
_serviceProvider = serviceProvider;
|
||||
_configuration = configuration;
|
||||
_logger = logger;
|
||||
_departmentService = departmentService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -427,13 +424,6 @@ public class GainfoService : IGainfoService
|
||||
OnboardingDate = ga.CreateTime,
|
||||
})
|
||||
.FirstAsync();
|
||||
info.Status = request.Status.GetDescription();
|
||||
var trees = await _departmentService.GetTreeAsync();
|
||||
var res = trees.First(x => x.No == info.Factory);
|
||||
if (res != null)
|
||||
{
|
||||
info.FactoryName = res.Name;
|
||||
}
|
||||
|
||||
if (info != null)
|
||||
{
|
||||
@@ -446,201 +436,6 @@ public class GainfoService : IGainfoService
|
||||
return info;
|
||||
}
|
||||
|
||||
public async Task<Dictionary<string, Pagination<GainfoDetailResponse>>> GetWeekNumberAsync(WeekNumberRequest request, string token)
|
||||
{
|
||||
var werks = GetClaimValueFromToken(token, "tenant");
|
||||
|
||||
//获取近7天并转化为"yyyy-MM-dd"集合
|
||||
DateTime currentDate = DateTime.Now;
|
||||
List<string> times = new List<string>();
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
DateTime date = currentDate.AddDays(-i);
|
||||
string dateString = date.ToString("yyyy-MM-dd");
|
||||
times.Add(dateString);
|
||||
}
|
||||
|
||||
var dic = new Dictionary<string, Pagination<GainfoDetailResponse>>();
|
||||
|
||||
foreach (var time in times)
|
||||
{
|
||||
var infos = await _gainfoStore.Queryable(GainfoStatusEnumType.Working)
|
||||
.LeftJoin<DepartmentEntity>((ga, de) => ga.DepartmentNo == de.No)
|
||||
.LeftJoin<BasicTypeEntity>((ga, de, type) => ga.Native == type.Code && type.Type == "native")
|
||||
.LeftJoin<PositionEntity>((ga, de, type, posi) => ga.Position == posi.Name)
|
||||
.LeftJoin<BasicTypeEntity>((ga, de, type, posi, type2) => ga.CountryNo == type2.Code && type2.Type == "country")
|
||||
.LeftJoin<BasicTypeEntity>((ga, de, type, posi, type2, type3) => ga.Nation == type3.Code && type3.Type == "nation")
|
||||
.Where(ga => ga.CreateTime.ToString("yyyy-MM-dd") == time && ga.Werks == werks)
|
||||
.Select((ga, de, type, posi, type2, type3) => new GainfoDetailResponse
|
||||
{
|
||||
No = ga.No,
|
||||
SapNo = ga.SapNo,
|
||||
Name = ga.Name,
|
||||
Code = ga.Code,
|
||||
DepartmentName = de.Name,
|
||||
IdClass = ga.IdClass,
|
||||
IdNo = ga.IdNo,
|
||||
Gender = ga.Gender,
|
||||
NativeName = type.Display,
|
||||
Address = ga.Address,
|
||||
Birthday = ga.Birthday,
|
||||
Phone = ga.Phone,
|
||||
Position = ga.Position,
|
||||
Grade = posi.Grade,
|
||||
Degree = ga.Degree,
|
||||
Werks = ga.Werks,
|
||||
CostId = ga.CostId,
|
||||
Marital = ga.Marital,
|
||||
CountryName = type2.Display,
|
||||
NationName = type3.Display,
|
||||
}).ToPageListAsync(request);
|
||||
|
||||
dic[time] = infos;
|
||||
}
|
||||
return dic;
|
||||
}
|
||||
|
||||
public async Task<Dictionary<string, Pagination<GainfoDetailResponse>>> GetDimissionWeekNumberAsync(WeekNumberRequest request, string token)
|
||||
{
|
||||
var werks = GetClaimValueFromToken(token, "tenant");
|
||||
|
||||
//获取近7天并转化为"yyyy-MM-dd"集合
|
||||
DateTime currentDate = DateTime.Now;
|
||||
List<string> times = new List<string>();
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
DateTime date = currentDate.AddDays(-i);
|
||||
string dateString = date.ToString("yyyy-MM-dd");
|
||||
times.Add(dateString);
|
||||
}
|
||||
|
||||
var dic = new Dictionary<string, Pagination<GainfoDetailResponse>>();
|
||||
foreach (var time in times)
|
||||
{
|
||||
var infos = await _gainfoStore.Queryable(GainfoStatusEnumType.Leave)
|
||||
.LeftJoin<DepartmentEntity>((ga, de) => ga.DepartmentNo == de.No)
|
||||
.LeftJoin<BasicTypeEntity>((ga, de, type) => ga.Native == type.Code && type.Type == "native")
|
||||
.LeftJoin<PositionEntity>((ga, de, type, posi) => ga.Position == posi.Name)
|
||||
.LeftJoin<BasicTypeEntity>((ga, de, type, posi, type2) => ga.CountryNo == type2.Code && type2.Type == "country")
|
||||
.LeftJoin<BasicTypeEntity>((ga, de, type, posi, type2, type3) => ga.Nation == type3.Code && type3.Type == "nation")
|
||||
.Where(ga => ga.CreateTime.ToString("yyyy-MM-dd") == time && ga.Werks == werks)
|
||||
.Select((ga, de, type, posi, type2, type3) => new GainfoDetailResponse
|
||||
{
|
||||
No = ga.No,
|
||||
SapNo = ga.SapNo,
|
||||
Name = ga.Name,
|
||||
Code = ga.Code,
|
||||
DepartmentName = de.Name,
|
||||
IdClass = ga.IdClass,
|
||||
IdNo = ga.IdNo,
|
||||
Gender = ga.Gender,
|
||||
NativeName = type.Display,
|
||||
Address = ga.Address,
|
||||
Birthday = ga.Birthday,
|
||||
Phone = ga.Phone,
|
||||
Position = ga.Position,
|
||||
Grade = posi.Grade,
|
||||
Degree = ga.Degree,
|
||||
Werks = ga.Werks,
|
||||
CostId = ga.CostId,
|
||||
Marital = ga.Marital,
|
||||
CountryName = type2.Display,
|
||||
NationName = type3.Display,
|
||||
}).ToPageListAsync(request);
|
||||
dic[time] = infos;
|
||||
}
|
||||
return dic;
|
||||
}
|
||||
|
||||
public async Task<GainfoGainfoNumbersResponse> GetGainfoNumbersAsync(string token)
|
||||
{
|
||||
var werks = GetClaimValueFromToken(token, "tenant");
|
||||
|
||||
//在职人数
|
||||
var onlineNumber = await _gainfoStore.Queryable(GainfoStatusEnumType.Working)
|
||||
.Where(ga => ga.Werks == werks)
|
||||
.CountAsync();
|
||||
|
||||
//离职人数
|
||||
var offlineNumber = await _gainfoStore.Queryable(GainfoStatusEnumType.Leave)
|
||||
.Where(ga => ga.Werks == werks)
|
||||
.CountAsync();
|
||||
|
||||
//考勤总人数
|
||||
var attendanceNumber = onlineNumber + offlineNumber;
|
||||
|
||||
var res = new GainfoGainfoNumbersResponse
|
||||
{
|
||||
OnlineNumber = onlineNumber,
|
||||
OfflineNumber = offlineNumber,
|
||||
AttendanceNumber = attendanceNumber
|
||||
};
|
||||
return res;
|
||||
}
|
||||
|
||||
//-------------------------------------------help methods ------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// 递归获取部门No
|
||||
/// </summary>
|
||||
/// <param name="departmentNos"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<List<string>> GetRecursionDepartmentNosAsync(List<string> departmentNos)
|
||||
{
|
||||
if (departmentNos.IsEmpty())
|
||||
{
|
||||
return new List<string>();
|
||||
}
|
||||
|
||||
var departments = await _dbContext.Queryable<DepartmentEntity>().ToListAsync();
|
||||
var currentNos = departments.Where(x => departmentNos.Contains(x.No)).ToList();
|
||||
|
||||
foreach (var item in currentNos)
|
||||
{
|
||||
RecursionGetNext(item.No, departments, departmentNos);
|
||||
}
|
||||
|
||||
return departmentNos.Distinct().ToList();
|
||||
|
||||
void RecursionGetNext(string currentCode, List<DepartmentEntity> departments, List<string> result)
|
||||
{
|
||||
var next = departments.Where(x => x.PNo == currentCode).ToList();
|
||||
|
||||
foreach (var item in next)
|
||||
{
|
||||
result.Add(item.No);
|
||||
RecursionGetNext(item.No, departments, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 解析token
|
||||
/// </summary>
|
||||
/// <param name="token"></param>
|
||||
/// <param name="claimType"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
private string GetClaimValueFromToken(string token, string claimType)
|
||||
{
|
||||
try
|
||||
{
|
||||
var handler = new JwtSecurityTokenHandler();
|
||||
var jsonToken = handler.ReadToken(token) as JwtSecurityToken;
|
||||
|
||||
if (jsonToken == null)
|
||||
throw new Exception("Invalid JWT Token");
|
||||
|
||||
var claimValue = jsonToken.Claims.FirstOrDefault(c => c.Type == claimType)?.Value;
|
||||
|
||||
return claimValue;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task MigrationAsync(MigrationRequest request)
|
||||
{
|
||||
//档案数据
|
||||
@@ -677,4 +472,41 @@ public class GainfoService : IGainfoService
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------help methods ------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// 递归获取部门No
|
||||
/// </summary>
|
||||
/// <param name="departmentNos"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<List<string>> GetRecursionDepartmentNosAsync(List<string> departmentNos)
|
||||
{
|
||||
if (departmentNos.IsEmpty())
|
||||
{
|
||||
return new List<string>();
|
||||
}
|
||||
|
||||
var departments = await _dbContext.Queryable<DepartmentEntity>().ToListAsync();
|
||||
var currentNos = departments.Where(x => departmentNos.Contains(x.No)).ToList();
|
||||
|
||||
foreach (var item in currentNos)
|
||||
{
|
||||
RecursionGetNext(item.No, departments, departmentNos);
|
||||
}
|
||||
|
||||
return departmentNos.Distinct().ToList();
|
||||
|
||||
void RecursionGetNext(string currentCode, List<DepartmentEntity> departments, List<string> result)
|
||||
{
|
||||
var next = departments.Where(x => x.PNo == currentCode).ToList();
|
||||
|
||||
foreach (var item in next)
|
||||
{
|
||||
result.Add(item.No);
|
||||
RecursionGetNext(item.No, departments, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,12 @@ namespace Dlhis.Entity.Canteen.Entities;
|
||||
[SugarTable(TableName = "DishesCategory", TableDescription = "菜品分类")]
|
||||
public class DishesCategoryEntity : SugarBaseEntity, ITenantId
|
||||
{
|
||||
/// <summary>
|
||||
/// 营业点
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "营业点", IsNullable = false)]
|
||||
public Guid BusinessPlaceCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// PCode
|
||||
/// </summary>
|
||||
@@ -21,13 +27,13 @@ public class DishesCategoryEntity : SugarBaseEntity, ITenantId
|
||||
/// <summary>
|
||||
/// 分类名称
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = false, ColumnDescription = "名称")]
|
||||
[SugarColumn(ColumnDescription = "名称", IsNullable = false)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 序号
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = false, ColumnDescription = "序号", DefaultValue = "100")]
|
||||
[SugarColumn(ColumnDescription = "序号", IsNullable = false, DefaultValue = "100")]
|
||||
public int Sequence { get; set; } = 100;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user