mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-03-20 00:16:37 +08:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c9e993194 | ||
|
|
dc3a465f09 | ||
|
|
6d008efd54 | ||
|
|
6aa970c375 | ||
|
|
1ecd01204b | ||
|
|
33bd8d1cd1 | ||
|
|
31d2c3c98e | ||
|
|
b082ec19aa | ||
|
|
9ccb496069 | ||
|
|
3871a7de84 | ||
|
|
c6931e3492 | ||
|
|
c8b2a38c99 | ||
|
|
a7bdcd8dd8 | ||
|
|
8196cd597a | ||
|
|
52deb6bb79 | ||
|
|
1a22aa0bfb | ||
|
|
d18e5eec99 |
@@ -20,7 +20,7 @@ Yi框架-一套与SqlSugar一样爽的.Net6低代码开源框架。
|
|||||||
适合.Net6学习、Sqlsugar学习 、项目二次开发。
|
适合.Net6学习、Sqlsugar学习 、项目二次开发。
|
||||||
集大成者,终究轮子
|
集大成者,终究轮子
|
||||||
|
|
||||||
Yi框架最新版本标签:`v1.0.2` 更新时间:2022/4/16
|
Yi框架最新版本标签:`v1.0.4`
|
||||||
|
|
||||||
(项目与Sqlsugar同步更新,但这作者老杰哥代码天天爆肝到凌晨两点,我们也尽量会跟上他的脚步。更新频繁,所以可watching持续关注。)
|
(项目与Sqlsugar同步更新,但这作者老杰哥代码天天爆肝到凌晨两点,我们也尽量会跟上他的脚步。更新频繁,所以可watching持续关注。)
|
||||||
|
|
||||||
@@ -126,16 +126,19 @@ WebFirst开发:所有代码生成器已经配置完成,无需任何操作数
|
|||||||
- [x] 支持`单表多租户`常用功能
|
- [x] 支持`单表多租户`常用功能
|
||||||
- [x] 支持`逻辑删除`常用功能
|
- [x] 支持`逻辑删除`常用功能
|
||||||
- [x] 支持`操作日志`常用功能
|
- [x] 支持`操作日志`常用功能
|
||||||
|
- [x] 支持`自动分表`
|
||||||
- [x] 支持 太多了忘了
|
- [x] 支持 太多了忘了
|
||||||
|
|
||||||
****
|
****
|
||||||
### 目录结构:
|
### 目录结构:
|
||||||
|
|
||||||

|

|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
我们大致依照DDD领域驱动设计分层
|
我们大致依照DDD领域驱动设计分层
|
||||||
|
|
||||||
什么?感觉太复杂了?用户只需关注Api、Service其他都是轮子啊!
|
分层如此清晰!什么?还感觉太复杂了?用户只需关注Api、Service其他都是轮子啊!
|
||||||
|
|
||||||
~~- BackGround:后台进程(目前可以无视,等待更新)~~
|
~~- BackGround:后台进程(目前可以无视,等待更新)~~
|
||||||
- Client:客户端(测试、客户端)
|
- Client:客户端(测试、客户端)
|
||||||
|
|||||||
Binary file not shown.
@@ -4,6 +4,11 @@
|
|||||||
<name>Yi.Framework.ApiMicroservice</name>
|
<name>Yi.Framework.ApiMicroservice</name>
|
||||||
</assembly>
|
</assembly>
|
||||||
<members>
|
<members>
|
||||||
|
<member name="T:Yi.Framework.ApiMicroservice.Controllers.AccountController">
|
||||||
|
<summary>
|
||||||
|
账户控制器
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="T:Yi.Framework.ApiMicroservice.Controllers.BaseCrudController`1">
|
<member name="T:Yi.Framework.ApiMicroservice.Controllers.BaseCrudController`1">
|
||||||
<summary>
|
<summary>
|
||||||
Json To Sql 类比模式,通用模型
|
Json To Sql 类比模式,通用模型
|
||||||
@@ -51,6 +56,23 @@
|
|||||||
<param name="ids"></param>
|
<param name="ids"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.LogController.Add">
|
||||||
|
<summary>
|
||||||
|
自动分表,日志添加
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.LogController.GetList">
|
||||||
|
<summary>
|
||||||
|
查询近20年与21年的日志表
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="T:Yi.Framework.ApiMicroservice.Controllers.TestController">
|
||||||
|
<summary>
|
||||||
|
测试控制器
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.DbTest">
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.DbTest">
|
||||||
<summary>
|
<summary>
|
||||||
仓储上下文对象测试
|
仓储上下文对象测试
|
||||||
@@ -93,5 +115,17 @@
|
|||||||
</summary>
|
</summary>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.JobTest">
|
||||||
|
<summary>
|
||||||
|
启动一个定时任务
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.stopJob">
|
||||||
|
<summary>
|
||||||
|
停止任务
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
</members>
|
</members>
|
||||||
</doc>
|
</doc>
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ using Yi.Framework.WebCore.AuthorizationPolicy;
|
|||||||
|
|
||||||
namespace Yi.Framework.ApiMicroservice.Controllers
|
namespace Yi.Framework.ApiMicroservice.Controllers
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 账户控制器
|
||||||
|
/// </summary>
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/[controller]/[action]")]
|
[Route("api/[controller]/[action]")]
|
||||||
public class AccountController :ControllerBase
|
public class AccountController :ControllerBase
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T"></typeparam>
|
||||||
[ApiController]
|
[ApiController]
|
||||||
public class BaseCrudController<T> : ControllerBase where T : BaseModelEntity,new()
|
public class BaseCrudController<T> : ControllerBase where T : class, IBaseModelEntity,new()
|
||||||
{
|
{
|
||||||
private readonly ILogger<T> _logger;
|
private readonly ILogger<T> _logger;
|
||||||
private IBaseService<T> _baseService;
|
private IBaseService<T> _baseService;
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Yi.Framework.Common.Models;
|
||||||
|
using Yi.Framework.Interface;
|
||||||
|
using Yi.Framework.Model.Models;
|
||||||
|
using Yi.Framework.Repository;
|
||||||
|
using Yi.Framework.WebCore;
|
||||||
|
using Yi.Framework.WebCore.AttributeExtend;
|
||||||
|
using Yi.Framework.WebCore.AuthorizationPolicy;
|
||||||
|
|
||||||
|
namespace Yi.Framework.ApiMicroservice.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/[controller]/[action]")]
|
||||||
|
public class LogController : ControllerBase
|
||||||
|
{
|
||||||
|
private ILogService _iLogService;
|
||||||
|
//大量日志,将采用自动分表形式,默认1年分一次表
|
||||||
|
public LogController(ILogger<LogEntity> logger, ILogService iLogService)
|
||||||
|
{
|
||||||
|
_iLogService = iLogService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 自动分表,日志添加
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<Result> Add()
|
||||||
|
{
|
||||||
|
Random random = new Random();
|
||||||
|
var logList = new List<LogEntity>() {
|
||||||
|
new LogEntity() { LogCreateTime = Convert.ToDateTime("2019-12-1"), Message = "jack"+random.Next() } ,
|
||||||
|
new LogEntity() { LogCreateTime = Convert.ToDateTime("2022-02-1"), Message = "jack"+random.Next() },
|
||||||
|
new LogEntity() { LogCreateTime = Convert.ToDateTime("2020-02-1"), Message = "jack"+random.Next() },
|
||||||
|
new LogEntity() { LogCreateTime = Convert.ToDateTime("2021-12-1"), Message = "jack"+random.Next() } };
|
||||||
|
return Result.Success().SetData(await _iLogService.AddListTest(logList));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询近20年与21年的日志表
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<Result> GetList()
|
||||||
|
{
|
||||||
|
return Result.Success().SetData(await _iLogService.GetListTest());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Yi.Framework.Common.Models;
|
||||||
|
using Yi.Framework.Interface;
|
||||||
|
using Yi.Framework.Model.Models;
|
||||||
|
using Yi.Framework.Repository;
|
||||||
|
using Yi.Framework.WebCore;
|
||||||
|
using Yi.Framework.WebCore.AttributeExtend;
|
||||||
|
using Yi.Framework.WebCore.AuthorizationPolicy;
|
||||||
|
|
||||||
|
namespace Yi.Framework.ApiMicroservice.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/[controller]/[action]")]
|
||||||
|
public class MenuController : BaseCrudController<MenuEntity>
|
||||||
|
{
|
||||||
|
private IMenuService _iMenuService;
|
||||||
|
public MenuController(ILogger<MenuEntity> logger, IMenuService iMenuService) : base(logger, iMenuService)
|
||||||
|
{
|
||||||
|
_iMenuService = iMenuService;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,7 +6,9 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Yi.Framework.Common.Const;
|
||||||
using Yi.Framework.Common.Models;
|
using Yi.Framework.Common.Models;
|
||||||
|
using Yi.Framework.Core;
|
||||||
using Yi.Framework.Interface;
|
using Yi.Framework.Interface;
|
||||||
using Yi.Framework.Language;
|
using Yi.Framework.Language;
|
||||||
using Yi.Framework.Model.Models;
|
using Yi.Framework.Model.Models;
|
||||||
@@ -17,6 +19,9 @@ using Yi.Framework.WebCore.AuthorizationPolicy;
|
|||||||
|
|
||||||
namespace Yi.Framework.ApiMicroservice.Controllers
|
namespace Yi.Framework.ApiMicroservice.Controllers
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 测试控制器
|
||||||
|
/// </summary>
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/[controller]/[action]")]
|
[Route("api/[controller]/[action]")]
|
||||||
public class TestController : ControllerBase
|
public class TestController : ControllerBase
|
||||||
@@ -24,12 +29,14 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
private IStringLocalizer<LocalLanguage> _local;
|
private IStringLocalizer<LocalLanguage> _local;
|
||||||
private IUserService _iUserService;
|
private IUserService _iUserService;
|
||||||
private IRoleService _iRoleService;
|
private IRoleService _iRoleService;
|
||||||
|
private QuartzInvoker _quartzInvoker;
|
||||||
//你可以依赖注入服务层各各接口,也可以注入其他仓储层,怎么爽怎么来!
|
//你可以依赖注入服务层各各接口,也可以注入其他仓储层,怎么爽怎么来!
|
||||||
public TestController(ILogger<UserEntity> logger, IRoleService iRoleService, IUserService iUserService, IStringLocalizer<LocalLanguage> local)
|
public TestController(ILogger<UserEntity> logger, IRoleService iRoleService, IUserService iUserService, IStringLocalizer<LocalLanguage> local, QuartzInvoker quartzInvoker)
|
||||||
{
|
{
|
||||||
_local = local;
|
_local = local;
|
||||||
_iUserService = iUserService;
|
_iUserService = iUserService;
|
||||||
_iRoleService = iRoleService;
|
_iRoleService = iRoleService;
|
||||||
|
_quartzInvoker = quartzInvoker;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -144,5 +151,33 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
{
|
{
|
||||||
return Result.Success().SetData(await _iUserService.GetListInRole());
|
return Result.Success().SetData(await _iUserService.GetListInRole());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 启动一个定时任务
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
//每5秒访问一次百度,可查看控制台
|
||||||
|
public async Task<Result> JobTest()
|
||||||
|
{
|
||||||
|
Dictionary<string, object> data = new Dictionary<string, object>()
|
||||||
|
{
|
||||||
|
{JobConst.method,"get" },
|
||||||
|
{JobConst.url,"https://www.baidu.com" }
|
||||||
|
};
|
||||||
|
await _quartzInvoker.start("*/5 * * * * ?", new Quartz.JobKey("test", "my"), "Yi.Framework.Job", "HttpJob", data: data);
|
||||||
|
return Result.Success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 停止任务
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPut]
|
||||||
|
public async Task<Result> stopJob()
|
||||||
|
{
|
||||||
|
await _quartzInvoker.Stop(new Quartz.JobKey("test", "my"));
|
||||||
|
return Result.Success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ ServiceLocator.Instance = app.Services;
|
|||||||
#region
|
#region
|
||||||
//错误抓取反馈注入
|
//错误抓取反馈注入
|
||||||
#endregion
|
#endregion
|
||||||
//app.UseErrorHandlingService();
|
app.UseErrorHandlingService();
|
||||||
#region
|
#region
|
||||||
//静态文件注入
|
//静态文件注入
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Binary file not shown.
@@ -61,6 +61,7 @@ namespace Yi.Framework.Common.Helper
|
|||||||
request.ContentType = "application/x-www-form-urlencoded";
|
request.ContentType = "application/x-www-form-urlencoded";
|
||||||
request.ContentLength = Encoding.UTF8.GetByteCount(postDataStr);
|
request.ContentLength = Encoding.UTF8.GetByteCount(postDataStr);
|
||||||
request.CookieContainer = cookie;
|
request.CookieContainer = cookie;
|
||||||
|
|
||||||
Stream myRequestStream = request.GetRequestStream();
|
Stream myRequestStream = request.GetRequestStream();
|
||||||
StreamWriter myStreamWriter = new StreamWriter(myRequestStream, Encoding.GetEncoding("gb2312"));
|
StreamWriter myStreamWriter = new StreamWriter(myRequestStream, Encoding.GetEncoding("gb2312"));
|
||||||
myStreamWriter.Write(postDataStr);
|
myStreamWriter.Write(postDataStr);
|
||||||
|
|||||||
@@ -10,5 +10,7 @@ namespace Yi.Framework.Common.IOCOptions
|
|||||||
{
|
{
|
||||||
public string Url { get; set; }
|
public string Url { get; set; }
|
||||||
public string IndexName { get; set; }
|
public string IndexName { get; set; }
|
||||||
|
public string UserName { get; set; }
|
||||||
|
public string PassWord { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace Yi.Framework.Core
|
|||||||
public ElasticSearchInvoker(IOptionsMonitor<ElasticSearchOptions> optionsMonitor)
|
public ElasticSearchInvoker(IOptionsMonitor<ElasticSearchOptions> optionsMonitor)
|
||||||
{
|
{
|
||||||
_elasticSearchOptions = optionsMonitor.CurrentValue;
|
_elasticSearchOptions = optionsMonitor.CurrentValue;
|
||||||
var settings = new ConnectionSettings(new Uri(_elasticSearchOptions.Url)).DefaultIndex(this._elasticSearchOptions.IndexName);
|
var settings = new ConnectionSettings(new Uri(_elasticSearchOptions.Url)).DefaultIndex(this._elasticSearchOptions.IndexName).BasicAuthentication(this._elasticSearchOptions.UserName, this._elasticSearchOptions.PassWord); ;
|
||||||
Client = new ElasticClient(settings);
|
Client = new ElasticClient(settings);
|
||||||
}
|
}
|
||||||
private ElasticClient Client;
|
private ElasticClient Client;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ using Yi.Framework.Repository;
|
|||||||
|
|
||||||
namespace Yi.Framework.Interface
|
namespace Yi.Framework.Interface
|
||||||
{
|
{
|
||||||
public interface IBaseService<T> where T:BaseModelEntity,new()
|
public interface IBaseService<T> where T: class, IBaseModelEntity,new()
|
||||||
{
|
{
|
||||||
public IRepository<T> _repository { get; set; }
|
public IRepository<T> _repository { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
13
Yi.Framework.Net6/Yi.Framework.Interface/ILogService.cs
Normal file
13
Yi.Framework.Net6/Yi.Framework.Interface/ILogService.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Yi.Framework.Model.Models;
|
||||||
|
using Yi.Framework.Repository;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Interface
|
||||||
|
{
|
||||||
|
public partial interface ILogService
|
||||||
|
{
|
||||||
|
Task<List<long>> AddListTest(List<LogEntity> logEntities);
|
||||||
|
Task<List<LogEntity>> GetListTest();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Yi.Framework.Model.Models;
|
||||||
|
using Yi.Framework.Repository;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Interface
|
||||||
|
{
|
||||||
|
public partial interface ILogService : IBaseService<LogEntity>
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@ using Yi.Framework.Repository;
|
|||||||
|
|
||||||
namespace Yi.Framework.Interface
|
namespace Yi.Framework.Interface
|
||||||
{
|
{
|
||||||
public partial interface IUserRoleService:IBaseService<UserRoleEntity>
|
public partial interface IMenuService:IBaseService<MenuEntity>
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
18
Yi.Framework.Net6/Yi.Framework.Model/LogEntity.cs
Normal file
18
Yi.Framework.Net6/Yi.Framework.Model/LogEntity.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using SqlSugar;
|
||||||
|
namespace Yi.Framework.Model.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 日志表
|
||||||
|
///</summary>
|
||||||
|
[SplitTable(SplitType.Year)]
|
||||||
|
[SugarTable("SplitLog_{year}{month}{day}")]
|
||||||
|
public partial class LogEntity
|
||||||
|
{
|
||||||
|
[SplitField] //分表字段 在插入的时候会根据这个字段插入哪个表,在更新删除的时候用这个字段找出相关表
|
||||||
|
public DateTime? LogCreateTime { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
15
Yi.Framework.Net6/Yi.Framework.Model/MenuEntity.cs
Normal file
15
Yi.Framework.Net6/Yi.Framework.Model/MenuEntity.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using SqlSugar;
|
||||||
|
namespace Yi.Framework.Model.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 菜单表
|
||||||
|
///</summary>
|
||||||
|
public partial class MenuEntity
|
||||||
|
{
|
||||||
|
[SqlSugar.SugarColumn(IsIgnore = true)]
|
||||||
|
public List<MenuEntity> Childs { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
using SqlSugar;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Yi.Framework.Model.Models
|
|
||||||
{
|
|
||||||
public abstract class BaseModelEntity
|
|
||||||
{
|
|
||||||
public BaseModelEntity()
|
|
||||||
{
|
|
||||||
this.IsDeleted = false;
|
|
||||||
this.CreateTime = DateTime.Now;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 1
|
|
||||||
///</summary>
|
|
||||||
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
|
|
||||||
public long Id { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 创建者
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnName = "CreateUser")]
|
|
||||||
public long? CreateUser { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 修改者
|
|
||||||
///</summary>
|
|
||||||
[SugarColumn(ColumnName = "ModifyUser")]
|
|
||||||
public long? ModifyUser { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 创建时间
|
|
||||||
///</summary>
|
|
||||||
[SugarColumn(ColumnName = "CreateTime")]
|
|
||||||
public DateTime? CreateTime { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 修改时间
|
|
||||||
///</summary>
|
|
||||||
[SugarColumn(ColumnName = "ModifyTime")]
|
|
||||||
public DateTime? ModifyTime { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 是否删除
|
|
||||||
///</summary>
|
|
||||||
[SugarColumn(ColumnName = "IsDeleted")]
|
|
||||||
public bool? IsDeleted { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Model.Models
|
||||||
|
{
|
||||||
|
public interface IBaseModelEntity
|
||||||
|
{
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
public long? CreateUser { get; set; }
|
||||||
|
|
||||||
|
public long? ModifyUser { get; set; }
|
||||||
|
|
||||||
|
public DateTime? CreateTime { get; set; }
|
||||||
|
|
||||||
|
public DateTime? ModifyTime { get; set; }
|
||||||
|
public bool? IsDeleted { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
59
Yi.Framework.Net6/Yi.Framework.Model/Models/LogEntity.cs
Normal file
59
Yi.Framework.Net6/Yi.Framework.Model/Models/LogEntity.cs
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using SqlSugar;
|
||||||
|
namespace Yi.Framework.Model.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 日志表
|
||||||
|
///</summary>
|
||||||
|
public partial class LogEntity:IBaseModelEntity
|
||||||
|
{
|
||||||
|
public LogEntity()
|
||||||
|
{
|
||||||
|
this.IsDeleted = false;
|
||||||
|
this.CreateTime = DateTime.Now;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 1
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建者
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="CreateUser" )]
|
||||||
|
public long? CreateUser { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="CreateTime" )]
|
||||||
|
public DateTime? CreateTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 修改者
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="ModifyUser" )]
|
||||||
|
public long? ModifyUser { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 修改时间
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="ModifyTime" )]
|
||||||
|
public DateTime? ModifyTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 是否删除
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="IsDeleted" )]
|
||||||
|
public bool? IsDeleted { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 租户Id
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="TenantId" )]
|
||||||
|
public long? TenantId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 消息
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="Message" )]
|
||||||
|
public string Message { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
74
Yi.Framework.Net6/Yi.Framework.Model/Models/MenuEntity.cs
Normal file
74
Yi.Framework.Net6/Yi.Framework.Model/Models/MenuEntity.cs
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using SqlSugar;
|
||||||
|
namespace Yi.Framework.Model.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 菜单表
|
||||||
|
///</summary>
|
||||||
|
[SugarTable("Menu")]
|
||||||
|
public partial class MenuEntity:IBaseModelEntity
|
||||||
|
{
|
||||||
|
public MenuEntity()
|
||||||
|
{
|
||||||
|
this.IsDeleted = false;
|
||||||
|
this.CreateTime = DateTime.Now;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 1
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
|
||||||
|
public long Id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="MenuName" )]
|
||||||
|
public string MenuName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="MenuType" )]
|
||||||
|
public int? MenuType { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="MenuCode" )]
|
||||||
|
public string PermissionCode { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="ParentId" )]
|
||||||
|
public long? ParentId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建者
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="CreateUser" )]
|
||||||
|
public long? CreateUser { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="CreateTime" )]
|
||||||
|
public DateTime? CreateTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 修改者
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="ModifyUser" )]
|
||||||
|
public long? ModifyUser { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 修改时间
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="ModifyTime" )]
|
||||||
|
public DateTime? ModifyTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 是否删除
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="IsDeleted" )]
|
||||||
|
public bool? IsDeleted { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 租户Id
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="TenantId" )]
|
||||||
|
public long? TenantId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,20 +5,55 @@ using SqlSugar;
|
|||||||
namespace Yi.Framework.Model.Models
|
namespace Yi.Framework.Model.Models
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// 角色表
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarTable("Role")]
|
[SugarTable("Role")]
|
||||||
public partial class RoleEntity:BaseModelEntity
|
public partial class RoleEntity:IBaseModelEntity
|
||||||
{
|
{
|
||||||
|
public RoleEntity()
|
||||||
|
{
|
||||||
|
this.IsDeleted = false;
|
||||||
|
this.CreateTime = DateTime.Now;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 1
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
|
||||||
|
public long Id { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarColumn(ColumnName="RoleName" )]
|
[SugarColumn(ColumnName="RoleName" )]
|
||||||
public string RoleName { get; set; }
|
public string RoleName { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 创建者
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="CreateUser" )]
|
||||||
|
public long? CreateUser { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="CreateTime" )]
|
||||||
|
public DateTime? CreateTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 修改时间
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="ModifyTime" )]
|
||||||
|
public DateTime? ModifyTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 是否删除
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="IsDeleted" )]
|
||||||
|
public bool? IsDeleted { get; set; }
|
||||||
|
/// <summary>
|
||||||
/// 租户Id
|
/// 租户Id
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarColumn(ColumnName="TenantId" )]
|
[SugarColumn(ColumnName="TenantId" )]
|
||||||
public long? TenantId { get; set; }
|
public long? TenantId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 修改者
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="ModifyUser" )]
|
||||||
|
public long? ModifyUser { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using SqlSugar;
|
||||||
|
namespace Yi.Framework.Model.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 角色菜单关系表
|
||||||
|
///</summary>
|
||||||
|
[SugarTable("RoleMenu")]
|
||||||
|
public partial class RoleMenuEntity:IBaseModelEntity
|
||||||
|
{
|
||||||
|
public RoleMenuEntity()
|
||||||
|
{
|
||||||
|
this.IsDeleted = false;
|
||||||
|
this.CreateTime = DateTime.Now;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 1
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
|
||||||
|
public long Id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="RoleId" )]
|
||||||
|
public long? RoleId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="MenuId" )]
|
||||||
|
public long? MenuId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建者
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="CreateUser" )]
|
||||||
|
public long? CreateUser { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="CreateTime" )]
|
||||||
|
public DateTime? CreateTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 修改者
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="ModifyUser" )]
|
||||||
|
public long? ModifyUser { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 修改时间
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="ModifyTime" )]
|
||||||
|
public DateTime? ModifyTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 是否删除
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="IsDeleted" )]
|
||||||
|
public bool? IsDeleted { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 租户Id
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="TenantId" )]
|
||||||
|
public long? TenantId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
59
Yi.Framework.Net6/Yi.Framework.Model/Models/TenantEntity.cs
Normal file
59
Yi.Framework.Net6/Yi.Framework.Model/Models/TenantEntity.cs
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using SqlSugar;
|
||||||
|
namespace Yi.Framework.Model.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 租户表
|
||||||
|
///</summary>
|
||||||
|
[SugarTable("Tenant")]
|
||||||
|
public partial class TenantEntity:IBaseModelEntity
|
||||||
|
{
|
||||||
|
public TenantEntity()
|
||||||
|
{
|
||||||
|
this.IsDeleted = false;
|
||||||
|
this.CreateTime = DateTime.Now;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 1
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
|
||||||
|
public long Id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="TenantName" )]
|
||||||
|
public string TenantName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建者
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="CreateUser" )]
|
||||||
|
public long? CreateUser { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="CreateTime" )]
|
||||||
|
public DateTime? CreateTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 修改者
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="ModifyUser" )]
|
||||||
|
public long? ModifyUser { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 修改时间
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="ModifyTime" )]
|
||||||
|
public DateTime? ModifyTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 是否删除
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="IsDeleted" )]
|
||||||
|
public bool? IsDeleted { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 租户Id
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="TenantId" )]
|
||||||
|
public long? TenantId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,11 +5,21 @@ using SqlSugar;
|
|||||||
namespace Yi.Framework.Model.Models
|
namespace Yi.Framework.Model.Models
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// 用户表
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarTable("User")]
|
[SugarTable("User")]
|
||||||
public partial class UserEntity:BaseModelEntity
|
public partial class UserEntity:IBaseModelEntity
|
||||||
{
|
{
|
||||||
|
public UserEntity()
|
||||||
|
{
|
||||||
|
this.IsDeleted = false;
|
||||||
|
this.CreateTime = DateTime.Now;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
|
||||||
|
public long Id { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
///</summary>
|
///</summary>
|
||||||
@@ -22,6 +32,31 @@ namespace Yi.Framework.Model.Models
|
|||||||
public int? Age { get; set; }
|
public int? Age { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="CreateUser" )]
|
||||||
|
public long? CreateUser { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="CreateTime" )]
|
||||||
|
public DateTime? CreateTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="ModifyUser" )]
|
||||||
|
public long? ModifyUser { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="ModifyTime" )]
|
||||||
|
public DateTime? ModifyTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="IsDeleted" )]
|
||||||
|
public bool? IsDeleted { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarColumn(ColumnName="TenantId" )]
|
[SugarColumn(ColumnName="TenantId" )]
|
||||||
public long? TenantId { get; set; }
|
public long? TenantId { get; set; }
|
||||||
|
|||||||
@@ -5,11 +5,21 @@ using SqlSugar;
|
|||||||
namespace Yi.Framework.Model.Models
|
namespace Yi.Framework.Model.Models
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// 用户角色关系表
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarTable("UserRole")]
|
[SugarTable("UserRole")]
|
||||||
public partial class UserRoleEntity:BaseModelEntity
|
public partial class UserRoleEntity:IBaseModelEntity
|
||||||
{
|
{
|
||||||
|
public UserRoleEntity()
|
||||||
|
{
|
||||||
|
this.IsDeleted = false;
|
||||||
|
this.CreateTime = DateTime.Now;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 1
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
|
||||||
|
public long Id { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
///</summary>
|
///</summary>
|
||||||
@@ -21,9 +31,34 @@ namespace Yi.Framework.Model.Models
|
|||||||
[SugarColumn(ColumnName="UserId" )]
|
[SugarColumn(ColumnName="UserId" )]
|
||||||
public long? UserId { get; set; }
|
public long? UserId { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 创建者
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="CreateUser" )]
|
||||||
|
public long? CreateUser { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="CreateTime" )]
|
||||||
|
public DateTime? CreateTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 修改时间
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="ModifyTime" )]
|
||||||
|
public DateTime? ModifyTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 是否删除
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="IsDeleted" )]
|
||||||
|
public bool? IsDeleted { get; set; }
|
||||||
|
/// <summary>
|
||||||
/// 租户Id
|
/// 租户Id
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarColumn(ColumnName="TenantId" )]
|
[SugarColumn(ColumnName="TenantId" )]
|
||||||
public long? TenantId { get; set; }
|
public long? TenantId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 修改者
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="ModifyUser" )]
|
||||||
|
public long? ModifyUser { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
namespace Yi.Framework.Model.Models
|
namespace Yi.Framework.Model.Models
|
||||||
{
|
{
|
||||||
public partial class UserEntity:BaseModelEntity
|
public partial class UserEntity
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 看好啦!ORM精髓,导航属性
|
/// 看好啦!ORM精髓,导航属性
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="NEST" Version="7.16.0" />
|
<PackageReference Include="NEST" Version="7.16.0" />
|
||||||
<PackageReference Include="SqlSugarCore" Version="5.0.7.2" />
|
<PackageReference Include="SqlSugarCore" Version="5.0.7.5" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Yi.Framework.Common.Models;
|
using Yi.Framework.Common.Models;
|
||||||
|
using Yi.Framework.Model.Models;
|
||||||
|
|
||||||
namespace Yi.Framework.Repository
|
namespace Yi.Framework.Repository
|
||||||
{
|
{
|
||||||
public class DataContext<T> : SimpleClient<T> where T : class, new()
|
public class DataContext<T> : SimpleClient<T> where T : class, IBaseModelEntity, new()
|
||||||
{
|
{
|
||||||
public DataContext(ISqlSugarClient context) : base(context)
|
public DataContext(ISqlSugarClient context) : base(context)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ using Yi.Framework.Model.Query;
|
|||||||
|
|
||||||
namespace Yi.Framework.Repository
|
namespace Yi.Framework.Repository
|
||||||
{
|
{
|
||||||
public interface IRepository<T> : ISimpleClient<T> where T : BaseModelEntity,new()
|
public interface IRepository<T> : ISimpleClient<T> where T : class, IBaseModelEntity, new()
|
||||||
{
|
{
|
||||||
public ISqlSugarClient _Db { get; set; }
|
public ISqlSugarClient _Db { get; set; }
|
||||||
public Task<bool> UseTranAsync(Func<Task> func);
|
public Task<bool> UseTranAsync(Func<Task> func);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace Yi.Framework.Repository
|
|||||||
/// 仓储模式
|
/// 仓储模式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T"></typeparam>
|
||||||
public class Repository<T> : DataContext<T>, IRepository<T> where T : BaseModelEntity,new()
|
public class Repository<T> : DataContext<T>, IRepository<T> where T : class, IBaseModelEntity, new()
|
||||||
{
|
{
|
||||||
public ISqlSugarClient _Db { get; set; }
|
public ISqlSugarClient _Db { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using Yi.Framework.Repository;
|
|||||||
|
|
||||||
namespace Yi.Framework.Service
|
namespace Yi.Framework.Service
|
||||||
{
|
{
|
||||||
public class BaseService<T>:IBaseService<T> where T:BaseModelEntity,new()
|
public class BaseService<T>:IBaseService<T> where T:class, IBaseModelEntity,new()
|
||||||
{
|
{
|
||||||
public IRepository<T> _repository { get; set; }
|
public IRepository<T> _repository { get; set; }
|
||||||
public BaseService(IRepository<T> iRepository)
|
public BaseService(IRepository<T> iRepository)
|
||||||
|
|||||||
23
Yi.Framework.Net6/Yi.Framework.Service/LogService.cs
Normal file
23
Yi.Framework.Net6/Yi.Framework.Service/LogService.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Yi.Framework.Interface;
|
||||||
|
using Yi.Framework.Model.Models;
|
||||||
|
using Yi.Framework.Repository;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Service
|
||||||
|
{
|
||||||
|
public partial class LogService
|
||||||
|
{
|
||||||
|
public async Task<List<long>> AddListTest(List<LogEntity> logEntities)
|
||||||
|
{
|
||||||
|
return await _repository._Db.Insertable(logEntities).SplitTable().ExecuteReturnSnowflakeIdListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<LogEntity>> GetListTest()
|
||||||
|
{
|
||||||
|
return await _repository._Db.Queryable<LogEntity>().SplitTable(tas => tas.Where(u => u.TableName.Contains("2020") || u.TableName.Contains("2021"))).ToListAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,9 +5,9 @@ using Yi.Framework.Repository;
|
|||||||
|
|
||||||
namespace Yi.Framework.Service
|
namespace Yi.Framework.Service
|
||||||
{
|
{
|
||||||
public partial class UserRoleService : BaseService<UserRoleEntity>, IUserRoleService
|
public partial class LogService : BaseService<LogEntity>, ILogService
|
||||||
{
|
{
|
||||||
public UserRoleService(IRepository<UserRoleEntity> repository) : base(repository)
|
public LogService(IRepository<LogEntity> repository) : base(repository)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using Yi.Framework.Interface;
|
||||||
|
using Yi.Framework.Model.Models;
|
||||||
|
using Yi.Framework.Repository;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Service
|
||||||
|
{
|
||||||
|
public partial class MenuService : BaseService<MenuEntity>, IMenuService
|
||||||
|
{
|
||||||
|
public MenuService(IRepository<MenuEntity> repository) : base(repository)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,7 +13,7 @@ namespace Yi.Framework.WebCore.BuilderExtend
|
|||||||
{
|
{
|
||||||
if (JsonFile==null)
|
if (JsonFile==null)
|
||||||
{
|
{
|
||||||
string[] myJsonFile = new string[] { "appsettings.json", "configuration.json" };
|
string[] myJsonFile = new string[] { "appsettings.json", "Config/configuration.json" };
|
||||||
foreach (var item in myJsonFile)
|
foreach (var item in myJsonFile)
|
||||||
{
|
{
|
||||||
builder.AddJsonFile(item, optional: true, reloadOnChange: false);
|
builder.AddJsonFile(item, optional: true, reloadOnChange: false);
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
|
|||||||
{
|
{
|
||||||
public static void AddSqlsugarServer(this IServiceCollection services)
|
public static void AddSqlsugarServer(this IServiceCollection services)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DbType dbType;
|
DbType dbType;
|
||||||
var slavaConFig = new List<SlaveConnectionConfig>();
|
var slavaConFig = new List<SlaveConnectionConfig>();
|
||||||
if (Appsettings.appBool("MutiDB_Enabled"))
|
if (Appsettings.appBool("MutiDB_Enabled"))
|
||||||
@@ -42,7 +45,19 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
|
|||||||
DisableNvarchar = true
|
DisableNvarchar = true
|
||||||
},
|
},
|
||||||
SlaveConnectionConfigs = slavaConFig,
|
SlaveConnectionConfigs = slavaConFig,
|
||||||
|
//设置codefirst非空值判断
|
||||||
|
ConfigureExternalServices = new ConfigureExternalServices
|
||||||
|
{
|
||||||
|
EntityService = (c, p) =>
|
||||||
|
{
|
||||||
|
// int? decimal?这种 isnullable=true
|
||||||
|
if (c.PropertyType.IsGenericType &&
|
||||||
|
c.PropertyType.GetGenericTypeDefinition() == typeof(Nullable<>))
|
||||||
|
{
|
||||||
|
p.IsNullable = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
db =>
|
db =>
|
||||||
{
|
{
|
||||||
@@ -80,6 +95,10 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
|
|||||||
|
|
||||||
Console.WriteLine("_______________________________________________");
|
Console.WriteLine("_______________________________________________");
|
||||||
Console.WriteLine("执行SQL:"+s.ToString());
|
Console.WriteLine("执行SQL:"+s.ToString());
|
||||||
|
foreach (var i in p)
|
||||||
|
{
|
||||||
|
Console.WriteLine("参数:" +i.ParameterName+",参数值"+i.Value);
|
||||||
|
}
|
||||||
Console.WriteLine("_______________________________________________");
|
Console.WriteLine("_______________________________________________");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user