@@ -0,0 +1,25 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>net6.0</TargetFramework> | |||
<NoWarn>1701;1702;1591</NoWarn> | |||
<DocumentationFile>BPA.SAAS.KitChenManage.Application.xml</DocumentationFile> | |||
<ImplicitUsings>enable</ImplicitUsings> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<None Remove="BPA.SAAS.KitChenManage.Application.xml" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPA.SAAS.KitChenManage.Core\BPA.SAAS.KitChenManage.Core.csproj" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Folder Include="System\Services\" /> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,103 @@ | |||
<?xml version="1.0"?> | |||
<doc> | |||
<assembly> | |||
<name>BPA.SAAS.KitChenManage.Application</name> | |||
</assembly> | |||
<members> | |||
<member name="M:BPA.SAAS.KitChenManage.Application.Store.Services.IStoreService.Page(BPA.SAAS.KitChenManage.Application.Store.Dtos.StoreDtoPageInput)"> | |||
<summary> | |||
分页 | |||
</summary> | |||
<param name="input"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.SAAS.KitChenManage.Application.Store.Services.IStoreService.Add(BPA.SAAS.KitChenManage.Application.Store.Dtos.StoreDtoInput)"> | |||
<summary> | |||
添加 | |||
</summary> | |||
<param name="input"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.SAAS.KitChenManage.Application.Store.Services.IStoreService.Update(BPA.SAAS.KitChenManage.Application.Store.Dtos.StoreDtoInput)"> | |||
<summary> | |||
修改 | |||
</summary> | |||
<param name="input"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.SAAS.KitChenManage.Application.Store.Services.IStoreService.Delete(System.Collections.Generic.List{System.String})"> | |||
<summary> | |||
删除 | |||
</summary> | |||
<param name="input"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.SAAS.KitChenManage.Application.Store.Services.StoreService.Page(BPA.SAAS.KitChenManage.Application.Store.Dtos.StoreDtoPageInput)"> | |||
<summary> | |||
分页 | |||
</summary> | |||
<param name="input"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.SAAS.KitChenManage.Application.Store.Services.StoreService.Add(BPA.SAAS.KitChenManage.Application.Store.Dtos.StoreDtoInput)"> | |||
<summary> | |||
添加 | |||
</summary> | |||
<param name="input"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.SAAS.KitChenManage.Application.Store.Services.StoreService.Update(BPA.SAAS.KitChenManage.Application.Store.Dtos.StoreDtoInput)"> | |||
<summary> | |||
修改 | |||
</summary> | |||
<param name="input"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.SAAS.KitChenManage.Application.Store.Services.StoreService.Delete(System.Collections.Generic.List{System.String})"> | |||
<summary> | |||
删除 | |||
</summary> | |||
<param name="input"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.SAAS.KitChenManage.Application.Store.StoreServices.Page(BPA.SAAS.KitChenManage.Application.Store.Dtos.StoreDtoPageInput)"> | |||
<summary> | |||
分页查询 | |||
</summary> | |||
<param name="input"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.SAAS.KitChenManage.Application.Store.StoreServices.Add(BPA.SAAS.KitChenManage.Application.Store.Dtos.StoreDtoInput)"> | |||
<summary> | |||
添加 | |||
</summary> | |||
<param name="input"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.SAAS.KitChenManage.Application.Store.StoreServices.Update(BPA.SAAS.KitChenManage.Application.Store.Dtos.StoreDtoInput)"> | |||
<summary> | |||
修改 | |||
</summary> | |||
<param name="input"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.SAAS.KitChenManage.Application.Store.StoreServices.Delete(System.Collections.Generic.List{System.String})"> | |||
<summary> | |||
删除 | |||
</summary> | |||
<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> |
@@ -0,0 +1,15 @@ | |||
global using Furion; | |||
global using Furion.DataEncryption; | |||
global using Furion.DataValidation; | |||
global using Furion.DependencyInjection; | |||
global using Furion.DynamicApiController; | |||
global using Furion.Extensions; | |||
global using Furion.FriendlyException; | |||
global using Furion.Logging; | |||
global using Mapster; | |||
global using Microsoft.AspNetCore.Authorization; | |||
global using Microsoft.AspNetCore.Http; | |||
global using Microsoft.AspNetCore.Mvc; | |||
global using Microsoft.CodeAnalysis; | |||
global using SqlSugar; | |||
global using System.ComponentModel.DataAnnotations; |
@@ -0,0 +1,19 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.KitChenManage.Application.Store.Dtos | |||
{ | |||
public class StoreDtoInput | |||
{ | |||
public string Id { get; set; } | |||
public string Name { get; set; } | |||
public string OrgId { get; set; } | |||
public string Phone { get; set; } | |||
public int Sort { get; set; } | |||
public string Description { get; set; } | |||
public string OrgName { get; set; } | |||
} | |||
} |
@@ -0,0 +1,21 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.KitChenManage.Application.Store.Dtos | |||
{ | |||
public class StoreDtoOutput | |||
{ | |||
public string Id { get; set; } | |||
public string Name { get; set; } | |||
public string OrgId { get; set; } | |||
public string OrgName { get; set; } | |||
public string Phone { get; set; } | |||
public int Sort { get; set; } | |||
public string Description { get; set; } | |||
public string GroupId { get; set; } | |||
public DateTime CreateAt { get; set; } | |||
} | |||
} |
@@ -0,0 +1,16 @@ | |||
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.Store.Dtos | |||
{ | |||
public class StoreDtoPageInput: PageInputBase | |||
{ | |||
public string Name { get; set; } | |||
public string OrgId { get; set; } | |||
public string Phone { get; set; } | |||
} | |||
} |
@@ -0,0 +1,38 @@ | |||
using BPA.SAAS.KitChenManage.Application.Store.Dtos; | |||
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.Store.Services | |||
{ | |||
public interface IStoreService | |||
{ | |||
/// <summary> | |||
/// 分页 | |||
/// </summary> | |||
/// <param name="input"></param> | |||
/// <returns></returns> | |||
Task<PageUtil> Page(StoreDtoPageInput input); | |||
/// <summary> | |||
/// 添加 | |||
/// </summary> | |||
/// <param name="input"></param> | |||
/// <returns></returns> | |||
Task<bool> Add(StoreDtoInput input); | |||
/// <summary> | |||
/// 修改 | |||
/// </summary> | |||
/// <param name="input"></param> | |||
/// <returns></returns> | |||
Task<bool> Update(StoreDtoInput input); | |||
/// <summary> | |||
/// 删除 | |||
/// </summary> | |||
/// <param name="input"></param> | |||
/// <returns></returns> | |||
Task<bool> Delete(List<string> input); | |||
} | |||
} |
@@ -0,0 +1,103 @@ | |||
using BPA.SAAS.KitChenManage.Application.Store.Dtos; | |||
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.Store.Services | |||
{ | |||
public class StoreService: IStoreService, ITransient | |||
{ | |||
private readonly ISqlSugarClient _db; | |||
public StoreService(ISqlSugarClient db) | |||
{ | |||
_db=db; | |||
} | |||
/// <summary> | |||
/// 分页 | |||
/// </summary> | |||
/// <param name="input"></param> | |||
/// <returns></returns> | |||
public async Task<PageUtil> Page(StoreDtoPageInput input) | |||
{ | |||
RefAsync<int> total = 0; | |||
var res = await _db.Queryable<BPA_Store>() | |||
.WhereIF(!input.OrgId.IsNullOrEmpty(), t => t.OrgId.Contains(input.OrgId)) | |||
.WhereIF(!input.Name.IsNullOrEmpty(), t => t.Name.Contains(input.Name)) | |||
.Select(t => new StoreDtoOutput | |||
{ | |||
CreateAt = t.CreateAt, | |||
Id = t.Id, | |||
Name = t.Name, | |||
Phone = t.Phone, | |||
Description = t.Description, | |||
OrgName=t.OrgName, | |||
OrgId=t.OrgId, | |||
Sort = t.Sort, | |||
}).OrderBy(t => t.Sort).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(StoreDtoInput input) | |||
{ | |||
var Store = input.Adapt<BPA_Store>(); | |||
// 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(StoreDtoInput input) | |||
{ | |||
var BPA_Store = await _db.Queryable<BPA_Store>().Where(a => a.Id == input.Id).FirstAsync(); | |||
var Store = await _db.Queryable<BPA_Store>().Where(a => a.Id == input.Id).FirstAsync(); | |||
Store.Name = input.Name; | |||
Store.OrgId = input.OrgId; | |||
Store.Phone = input.Phone; | |||
Store.Description = input.Description; | |||
Store.Phone = input.Phone; | |||
Store.Sort = input.Sort; | |||
Store.OrgName = input.OrgName; | |||
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_Store>().In(input).ToList(); | |||
var res = await _db.Deleteable(resEntitites).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
catch (Exception) | |||
{ | |||
throw Oops.Oh("删除失败"); | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,62 @@ | |||
using BPA.SAAS.KitChenManage.Application.Store.Dtos; | |||
using BPA.SAAS.KitChenManage.Application.Store.Services; | |||
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.Store | |||
{ | |||
[ApiDescriptionSettings("Store", Tag = "场景管理")] | |||
public class StoreServices: IDynamicApiController | |||
{ | |||
IStoreService _storeService; | |||
public StoreServices(IStoreService storeService) | |||
{ | |||
_storeService=storeService; | |||
} | |||
/// <summary> | |||
/// 分页查询 | |||
/// </summary> | |||
/// <param name="input"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/store/page")] | |||
public async Task<PageUtil> Page(StoreDtoPageInput input) | |||
{ | |||
return await _storeService.Page(input); | |||
} | |||
/// <summary> | |||
/// 添加 | |||
/// </summary> | |||
/// <param name="input"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/store/add")] | |||
public async Task<bool> Add(StoreDtoInput input) | |||
{ | |||
return await _storeService.Add(input); | |||
} | |||
/// <summary> | |||
/// 修改 | |||
/// </summary> | |||
/// <param name="input"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/store/update")] | |||
public async Task<bool> Update(StoreDtoInput input) | |||
{ | |||
return await _storeService.Update(input); | |||
} | |||
/// <summary> | |||
/// 删除 | |||
/// </summary> | |||
/// <param name="input"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/store/delete")] | |||
public async Task<bool> Delete(List<string> input) | |||
{ | |||
return await _storeService.Delete(input); | |||
} | |||
} | |||
} |
@@ -0,0 +1,9 @@ | |||
namespace BPA.SAAS.KitChenManage.Application | |||
{ | |||
public class Mapper : IRegister | |||
{ | |||
public void Register(TypeAdapterConfig config) | |||
{ | |||
} | |||
} | |||
} |
@@ -0,0 +1,7 @@ | |||
namespace BPA.SAAS.KitChenManage.Application | |||
{ | |||
public interface ISystemService | |||
{ | |||
string GetDescription(); | |||
} | |||
} |
@@ -0,0 +1,10 @@ | |||
namespace BPA.SAAS.KitChenManage.Application | |||
{ | |||
public class SystemService : ISystemService, ITransient | |||
{ | |||
public string GetDescription() | |||
{ | |||
return "让 .NET 开发更简单,更通用,更流行。"; | |||
} | |||
} | |||
} |
@@ -0,0 +1,23 @@ | |||
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(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,9 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>net6.0</TargetFramework> | |||
<ImplicitUsings>enable</ImplicitUsings> | |||
<Nullable>enable</Nullable> | |||
</PropertyGroup> | |||
</Project> |
@@ -0,0 +1,57 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.KitChenManage.Comm.Const | |||
{ | |||
public class ClaimConst | |||
{ | |||
/// <summary> | |||
/// 用户Id | |||
/// </summary> | |||
public const string CLAINM_USERID = "UserId"; | |||
/// <summary> | |||
/// 账号 | |||
/// </summary> | |||
public const string CLAINM_ACCOUNT = "Account"; | |||
/// <summary> | |||
/// 名称 | |||
/// </summary> | |||
public const string CLAINM_NAME = "Name"; | |||
/// <summary> | |||
/// 是否超级管理 | |||
/// </summary> | |||
public const string CLAINM_SUPERADMIN = "SuperAdmin"; | |||
/// <summary> | |||
/// 登录类型1平台用户登录,0加盟商登录 | |||
/// </summary> | |||
public const string LoginType = "LoginType"; | |||
/// <summary> | |||
/// 加盟商编号 | |||
/// </summary> | |||
public const string FranchID = "FranchID"; | |||
/// <summary> | |||
/// 加盟商通知手机号 | |||
/// </summary> | |||
public const string FranchTel = "18782023833"; | |||
/// <summary> | |||
/// 加盟商组id | |||
/// </summary> | |||
public const string GroupId = "GroupId"; | |||
/// <summary> | |||
/// 权限 | |||
/// </summary> | |||
public const string RoleId = "RoleId"; | |||
public const string OrgId = ""; | |||
public const string SupplyPlatformId = "SupplyPlatformId"; | |||
} | |||
} |
@@ -0,0 +1,27 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>net6.0</TargetFramework> | |||
<NoWarn>1701;1702;1591</NoWarn> | |||
<DocumentationFile>BPA.SAAS.KitChenManage.Core.xml</DocumentationFile> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<None Remove="BPA.SAAS.KitChenManage.Core.xml" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.1.23" /> | |||
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.1.23" /> | |||
<PackageReference Include="Furion.Pure" Version="4.9.1.23" /> | |||
<PackageReference Include="SqlSugarCore" Version="5.1.4.67" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPA.SAAS.KitChenManage.Comm\BPA.SAAS.KitChenManage.Comm.csproj" /> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,64 @@ | |||
<?xml version="1.0"?> | |||
<doc> | |||
<assembly> | |||
<name>BPA.SAAS.KitChenManage.Core</name> | |||
</assembly> | |||
<members> | |||
<member name="P:BPA.SAAS.KitChenManage.Core.Base.IBaseEntity.Id"> | |||
<summary> | |||
主键 Guid | |||
</summary> | |||
</member> | |||
<member name="P:BPA.SAAS.KitChenManage.Core.Base.IBaseEntity.IsDeleted"> | |||
<summary> | |||
是否删除 | |||
</summary> | |||
</member> | |||
<member name="M:BPA.SAAS.KitChenManage.Core.Base.IBaseEntity.Create"> | |||
<summary> | |||
新增 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.SAAS.KitChenManage.Core.Base.IDeleted.IsDeleted"> | |||
<summary> | |||
是否删除 | |||
</summary> | |||
</member> | |||
<member name="F:BPA.SAAS.KitChenManage.Core.Base.PageInputBase.current"> | |||
<summary> | |||
当前页码 | |||
</summary> | |||
</member> | |||
<member name="F:BPA.SAAS.KitChenManage.Core.Base.PageInputBase.pagesize"> | |||
<summary> | |||
页码容量 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.SAAS.KitChenManage.Core.Base.PageUtil"> | |||
<summary> | |||
分页实体 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.SAAS.KitChenManage.Core.Base.PageUtil.Data"> | |||
<summary> | |||
Data | |||
</summary> | |||
</member> | |||
<member name="P:BPA.SAAS.KitChenManage.Core.Base.PageUtil.Total"> | |||
<summary> | |||
Total | |||
</summary> | |||
</member> | |||
<member name="T:BPA.SAAS.KitChenManage.Core.DbContext"> | |||
<summary> | |||
数据库上下文对象 | |||
</summary> | |||
</member> | |||
<member name="M:BPA.SAAS.KitChenManage.Core.DbContext.AddSqlsugarSetup(Microsoft.Extensions.DependencyInjection.IServiceCollection,Microsoft.Extensions.Configuration.IConfiguration)"> | |||
<summary> | |||
SqlSugar 数据库实例 | |||
</summary> | |||
</member> | |||
<!-- Badly formed XML comment ignored for member "M:BPA.SAAS.KitChenManage.Core.DbContext.IsSuperAdmin" --> | |||
</members> | |||
</doc> |
@@ -0,0 +1,45 @@ | |||
using BPA.SAAS.KitChenManage.Comm.Const; | |||
using Furion; | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.KitChenManage.Core.Base | |||
{ | |||
public abstract class IBaseEntity : IDeleted | |||
{ | |||
/// <summary> | |||
/// 主键 Guid | |||
/// </summary> | |||
[SugarColumn(IsPrimaryKey = true, ColumnDataType = "Nvarchar(64)", IsNullable = false)] | |||
public string Id { get; set; } | |||
public DateTime CreateAt { get; set; } = DateTime.Now; | |||
public string CreateBy { get; set; } | |||
/// <summary> | |||
/// 是否删除 | |||
/// </summary> | |||
public int IsDeleted { get; set; } = 0; | |||
/// <summary> | |||
/// 新增 | |||
/// </summary> | |||
public virtual void Create() | |||
{ | |||
var userId = App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value; | |||
this.Id = Guid.NewGuid().ToString(); | |||
this.CreateAt = DateTime.Now; | |||
if (!string.IsNullOrEmpty(userId)) | |||
{ | |||
this.CreateBy = userId; | |||
} | |||
else | |||
{ | |||
this.CreateBy = "admin"; | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,16 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.KitChenManage.Core.Base | |||
{ | |||
public interface IDeleted | |||
{ | |||
/// <summary> | |||
/// 是否删除 | |||
/// </summary> | |||
public int IsDeleted { get; set; } | |||
} | |||
} |
@@ -0,0 +1,13 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.KitChenManage.Core.Base | |||
{ | |||
public interface IGroupId | |||
{ | |||
public string GroupId { get; set; } | |||
} | |||
} |
@@ -0,0 +1,54 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.KitChenManage.Core.Base | |||
{ | |||
public class PageInputBase | |||
{ | |||
/// <summary> | |||
/// 当前页码 | |||
/// </summary> | |||
private int current; | |||
public virtual int Current | |||
{ | |||
get | |||
{ | |||
return current; | |||
} | |||
set | |||
{ | |||
current = value; | |||
if (current <= 0) | |||
{ | |||
current = 1; | |||
} | |||
} | |||
} | |||
//public int? Status { get; set; } | |||
/// <summary> | |||
/// 页码容量 | |||
/// </summary> | |||
private int pagesize; | |||
public virtual int PageSize | |||
{ | |||
get | |||
{ | |||
return pagesize; | |||
} | |||
set | |||
{ | |||
pagesize = value; | |||
if (pagesize <= 0) | |||
{ | |||
pagesize = 10; | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,25 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.KitChenManage.Core.Base | |||
{ | |||
/// <summary> | |||
/// 分页实体 | |||
/// </summary> | |||
public class PageUtil | |||
{ | |||
/// <summary> | |||
/// Data | |||
/// </summary> | |||
public object Data { get; set; } | |||
/// <summary> | |||
/// Total | |||
/// </summary> | |||
public int Total { get; set; } | |||
} | |||
} |
@@ -0,0 +1,81 @@ | |||
using BPA.SAAS.KitChenManage.Comm.Const; | |||
using BPA.SAAS.KitChenManage.Core.Base; | |||
using Furion; | |||
using Microsoft.Extensions.Configuration; | |||
using Microsoft.Extensions.DependencyInjection; | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Data; | |||
using System.Linq; | |||
namespace BPA.SAAS.KitChenManage.Core | |||
{ | |||
/// <summary> | |||
/// 数据库上下文对象 | |||
/// </summary> | |||
public static class DbContext | |||
{ | |||
/// <summary> | |||
/// SqlSugar 数据库实例 | |||
/// </summary> | |||
public static void AddSqlsugarSetup(this IServiceCollection services, IConfiguration configuration) | |||
{ | |||
var connectionConfigs = App.GetConfig<List<ConnectionConfig>>("ConnectionConfigs"); | |||
//如果多个数数据库传 List<ConnectionConfig> | |||
var configConnection = new ConnectionConfig() | |||
{ | |||
ConnectionString = connectionConfigs[0].ConnectionString, | |||
DbType = SqlSugar.DbType.MySql,//设置数据库类型 | |||
IsAutoCloseConnection = true,//自动释放数据务,如果存在事务,在事务结束后释放 | |||
InitKeyType = InitKeyType.Attribute, //从实体特性中读取主键自增列信息 | |||
ConfigId = "default", | |||
}; | |||
SqlSugarScope sqlSugar = new SqlSugarScope(configConnection, | |||
db => | |||
{ | |||
db.Aop.DataExecuting = (oldValue, entityInfo) => | |||
{ | |||
//新增添加加盟商id赋值 | |||
var groupId = App.User?.FindFirst(ClaimConst.GroupId)?.Value; | |||
if (entityInfo.PropertyName == "GroupId" && entityInfo.OperationType == DataFilterType.InsertByObject) | |||
{ | |||
if (oldValue == null || oldValue == Convert.DBNull) | |||
{ | |||
entityInfo.SetValue(groupId); | |||
} | |||
} | |||
}; | |||
//单例参数配置,所有上下文生效 | |||
db.Aop.OnLogExecuting = (sql, pars) => | |||
{ | |||
//过滤已删除数据 | |||
db.QueryFilter.AddTableFilter<IDeleted>(it => it.IsDeleted == 0); | |||
if (!IsSuperAdmin()) | |||
{ | |||
//非管理员账户过滤加盟商数据 | |||
var groupId = App.User?.FindFirst(ClaimConst.GroupId)?.Value; | |||
db.QueryFilter.AddTableFilter<IGroupId>(it => it.GroupId == groupId); | |||
} | |||
//Console.WriteLine(sql);//输出sql | |||
Console.WriteLine($"当前SQL语句:【{sql}】,参数:【{string.Join(",", pars.Select(t => t.Value))}】"); | |||
}; | |||
}); | |||
services.AddSingleton<ISqlSugarClient>(sqlSugar);//这边是SqlSugarScope用AddSingleton | |||
} | |||
// <summary> | |||
/// 判断是不是超级管理员 | |||
/// </summary> | |||
/// <returns></returns> | |||
private static bool IsSuperAdmin() | |||
{ | |||
if (App.User == null) return false; | |||
return App.User.FindFirst(ClaimConst.CLAINM_SUPERADMIN)?.Value == "1"; | |||
} | |||
} | |||
} |
@@ -0,0 +1,22 @@ | |||
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_store")] | |||
public class BPA_Store : IBaseEntity, IGroupId | |||
{ | |||
public string Name { get; set; } | |||
public string OrgId { get; set; } | |||
public string Phone { get; set; } | |||
public int Sort { get; set; } | |||
public string Description { get; set; } | |||
public string GroupId { get; set; } | |||
public string OrgName { get; set; } | |||
} | |||
} |
@@ -0,0 +1,20 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>net6.0</TargetFramework> | |||
<NoWarn>1701;1702;1591</NoWarn> | |||
<DocumentationFile>BPA.SAAS.KitChenManage.Web.Core.xml</DocumentationFile> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<None Remove="BPA.SAAS.KitChenManage.Web.Core.xml" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPA.SAAS.KitChenManage.Application\BPA.SAAS.KitChenManage.Application.csproj" /> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,8 @@ | |||
<?xml version="1.0"?> | |||
<doc> | |||
<assembly> | |||
<name>BPA.SAAS.KitChenManage.Web.Core</name> | |||
</assembly> | |||
<members> | |||
</members> | |||
</doc> |
@@ -0,0 +1,17 @@ | |||
using Furion.Authorization; | |||
using Microsoft.AspNetCore.Authorization; | |||
using Microsoft.AspNetCore.Http; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.KitChenManage.Web.Core | |||
{ | |||
public class JwtHandler : AppAuthorizeHandler | |||
{ | |||
public override Task<bool> PipelineAsync(AuthorizationHandlerContext context, DefaultHttpContext httpContext) | |||
{ | |||
// 这里写您的授权判断逻辑,授权通过返回 true,否则返回 false | |||
return Task.FromResult(true); | |||
} | |||
} | |||
} |
@@ -0,0 +1,47 @@ | |||
using BPA.SAAS.KitChenManage.Core; | |||
using Furion; | |||
using Microsoft.AspNetCore.Builder; | |||
using Microsoft.AspNetCore.Hosting; | |||
using Microsoft.Extensions.DependencyInjection; | |||
using Microsoft.Extensions.Hosting; | |||
namespace BPA.SAAS.KitChenManage.Web.Core | |||
{ | |||
public class Startup : AppStartup | |||
{ | |||
public void ConfigureServices(IServiceCollection services) | |||
{ | |||
services.AddConsoleFormatter(); | |||
services.AddJwt<JwtHandler>(); | |||
services.AddCorsAccessor(); | |||
services.AddSqlsugarSetup(App.Configuration); | |||
services.AddControllers() | |||
.AddInjectWithUnifyResult(); | |||
} | |||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) | |||
{ | |||
if (env.IsDevelopment()) | |||
{ | |||
app.UseDeveloperExceptionPage(); | |||
} | |||
app.UseHttpsRedirection(); | |||
app.UseRouting(); | |||
app.UseCorsAccessor(); | |||
app.UseAuthentication(); | |||
app.UseAuthorization(); | |||
app.UseInject(string.Empty); | |||
app.UseEndpoints(endpoints => | |||
{ | |||
endpoints.MapControllers(); | |||
}); | |||
} | |||
} | |||
} |
@@ -0,0 +1,22 @@ | |||
<Project Sdk="Microsoft.NET.Sdk.Web"> | |||
<PropertyGroup> | |||
<TargetFramework>net6.0</TargetFramework> | |||
<ImplicitUsings>enable</ImplicitUsings> | |||
<SatelliteResourceLanguages>en-US</SatelliteResourceLanguages> | |||
<PublishReadyToRunComposite>true</PublishReadyToRunComposite> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPA.SAAS.KitChenManage.Web.Core\BPA.SAAS.KitChenManage.Web.Core.csproj" /> | |||
</ItemGroup> | |||
<ProjectExtensions> | |||
<VisualStudio> | |||
<UserProperties properties_4launchsettings_1json__JsonSchema="" /> | |||
</VisualStudio> | |||
</ProjectExtensions> | |||
</Project> |
@@ -0,0 +1,9 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> | |||
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor> | |||
</PropertyGroup> | |||
<PropertyGroup> | |||
<ActiveDebugProfile>BPA.SAAS.KitChenManage.Web.Entry</ActiveDebugProfile> | |||
</PropertyGroup> | |||
</Project> |
@@ -0,0 +1 @@ | |||
Serve.Run(RunOptions.Default.WithArgs(args)); |
@@ -0,0 +1,31 @@ | |||
{ | |||
"$schema": "http://json.schemastore.org/launchsettings.json", | |||
"iisSettings": { | |||
"windowsAuthentication": false, | |||
"anonymousAuthentication": true, | |||
"iisExpress": { | |||
"applicationUrl": "http://localhost:53785", | |||
"sslPort": 44342 | |||
} | |||
}, | |||
"profiles": { | |||
"IIS Express": { | |||
"commandName": "IISExpress", | |||
"launchBrowser": true, | |||
"launchUrl": "", | |||
"environmentVariables": { | |||
"ASPNETCORE_ENVIRONMENT": "Development" | |||
} | |||
}, | |||
"BPA.SAAS.KitChenManage.Web.Entry": { | |||
"commandName": "Project", | |||
"dotnetRunMessages": true, | |||
"launchBrowser": true, | |||
"launchUrl": "", | |||
"applicationUrl": "http://192.168.1.19:5008", | |||
"environmentVariables": { | |||
"ASPNETCORE_ENVIRONMENT": "Development" | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,23 @@ | |||
using Furion; | |||
using System.Reflection; | |||
namespace BPA.SAAS.KitChenManage.Web.Entry | |||
{ | |||
public class SingleFilePublish : ISingleFilePublish | |||
{ | |||
public Assembly[] IncludeAssemblies() | |||
{ | |||
return Array.Empty<Assembly>(); | |||
} | |||
public string[] IncludeAssemblyNames() | |||
{ | |||
return new[] | |||
{ | |||
"BPA.SAAS.KitChenManage.Application", | |||
"BPA.SAAS.KitChenManage.Core", | |||
"BPA.SAAS.KitChenManage.Web.Core" | |||
}; | |||
} | |||
} | |||
} |
@@ -0,0 +1,10 @@ | |||
{ | |||
"$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json", | |||
"Logging": { | |||
"LogLevel": { | |||
"Default": "Information", | |||
"Microsoft.AspNetCore": "Warning", | |||
"Microsoft.EntityFrameworkCore": "Information" | |||
} | |||
} | |||
} |
@@ -0,0 +1,18 @@ | |||
{ | |||
"$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json", | |||
"Logging": { | |||
"LogLevel": { | |||
"Default": "Information", | |||
"Microsoft.AspNetCore": "Warning", | |||
"Microsoft.EntityFrameworkCore": "Information" | |||
} | |||
}, | |||
"AllowedHosts": "*", | |||
"ConnectionConfigs": [ | |||
{ | |||
"ConnectionString": "server=10.2.1.21;Database=bpa_kitchen_kitchenmanage;Uid=root;Pwd=cygadmin;Allow Zero Datetime=True;Convert Zero Datetime=True;", | |||
"DbType": "Mysql", | |||
"IsAutoCloseConnection": true | |||
} | |||
] | |||
} |
@@ -0,0 +1,49 @@ | |||
| |||
Microsoft Visual Studio Solution File, Format Version 12.00 | |||
# Visual Studio Version 17 | |||
VisualStudioVersion = 17.4.33205.214 | |||
MinimumVisualStudioVersion = 10.0.40219.1 | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPA.SAAS.KitChenManage.Application", "BPA.SAAS.KitChenManage.Application\BPA.SAAS.KitChenManage.Application.csproj", "{D28EBCAE-1D41-4D87-9D88-FC5C90FFA80C}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPA.SAAS.KitChenManage.Core", "BPA.SAAS.KitChenManage.Core\BPA.SAAS.KitChenManage.Core.csproj", "{AEC1516E-41FC-41E5-9635-D4B304952FD1}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPA.SAAS.KitChenManage.Web.Core", "BPA.SAAS.KitChenManage.Web.Core\BPA.SAAS.KitChenManage.Web.Core.csproj", "{4F50D938-38C1-40FA-87CF-C6F57679060A}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPA.SAAS.KitChenManage.Web.Entry", "BPA.SAAS.KitChenManage.Web.Entry\BPA.SAAS.KitChenManage.Web.Entry.csproj", "{3021297F-13CD-4B89-AA86-9ABC20A82A22}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPA.SAAS.KitChenManage.Comm", "BPA.SAAS.KitChenManage.Comm\BPA.SAAS.KitChenManage.Comm.csproj", "{E1B95273-F2CB-4BFC-BBC7-7D556129D878}" | |||
EndProject | |||
Global | |||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||
Debug|Any CPU = Debug|Any CPU | |||
Release|Any CPU = Release|Any CPU | |||
EndGlobalSection | |||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | |||
{D28EBCAE-1D41-4D87-9D88-FC5C90FFA80C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{D28EBCAE-1D41-4D87-9D88-FC5C90FFA80C}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{D28EBCAE-1D41-4D87-9D88-FC5C90FFA80C}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{D28EBCAE-1D41-4D87-9D88-FC5C90FFA80C}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{AEC1516E-41FC-41E5-9635-D4B304952FD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{AEC1516E-41FC-41E5-9635-D4B304952FD1}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{AEC1516E-41FC-41E5-9635-D4B304952FD1}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{AEC1516E-41FC-41E5-9635-D4B304952FD1}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{4F50D938-38C1-40FA-87CF-C6F57679060A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{4F50D938-38C1-40FA-87CF-C6F57679060A}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{4F50D938-38C1-40FA-87CF-C6F57679060A}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{4F50D938-38C1-40FA-87CF-C6F57679060A}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{3021297F-13CD-4B89-AA86-9ABC20A82A22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{3021297F-13CD-4B89-AA86-9ABC20A82A22}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{3021297F-13CD-4B89-AA86-9ABC20A82A22}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{3021297F-13CD-4B89-AA86-9ABC20A82A22}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{E1B95273-F2CB-4BFC-BBC7-7D556129D878}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{E1B95273-F2CB-4BFC-BBC7-7D556129D878}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{E1B95273-F2CB-4BFC-BBC7-7D556129D878}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{E1B95273-F2CB-4BFC-BBC7-7D556129D878}.Release|Any CPU.Build.0 = Release|Any CPU | |||
EndGlobalSection | |||
GlobalSection(SolutionProperties) = preSolution | |||
HideSolutionNode = FALSE | |||
EndGlobalSection | |||
GlobalSection(ExtensibilityGlobals) = postSolution | |||
SolutionGuid = {B2F45D5A-A815-46D9-B4C4-483D53175EA2} | |||
EndGlobalSection | |||
EndGlobal |