style: 修改rbac service结构
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
using SqlSugar;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.Application.Dtos;
|
||||
using Volo.Abp.Application.Services;
|
||||
using Yi.Framework.Ddd.Application;
|
||||
using Yi.Framework.Rbac.Application.Contracts.Dtos.LoginLog;
|
||||
using Yi.Framework.Rbac.Domain.Entities;
|
||||
using Yi.Framework.SqlSugarCore.Abstractions;
|
||||
|
||||
namespace Yi.Framework.Rbac.Application.Services
|
||||
{
|
||||
public class LoginLogService : YiCrudAppService<LoginLogEntity, LoginLogGetListOutputDto, Guid, LoginLogGetListInputVo>
|
||||
{
|
||||
private readonly ISqlSugarRepository<LoginLogEntity> _repository;
|
||||
public LoginLogService(ISqlSugarRepository<LoginLogEntity, Guid> repository) : base(repository)
|
||||
{
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
public override async Task<PagedResultDto<LoginLogGetListOutputDto>> GetListAsync(LoginLogGetListInputVo input)
|
||||
{
|
||||
RefAsync<int> total = 0;
|
||||
|
||||
var entities = await _repository._DbQueryable.WhereIF(!string.IsNullOrEmpty(input.LoginIp), x => x.LoginIp.Contains(input.LoginIp!))
|
||||
.WhereIF(!string.IsNullOrEmpty(input.LoginUser), x => x.LoginUser!.Contains(input.LoginUser!))
|
||||
.WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime)
|
||||
.ToPageListAsync(input.SkipCount, input.MaxResultCount, total);
|
||||
return new PagedResultDto<LoginLogGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));
|
||||
}
|
||||
|
||||
[RemoteService(false)]
|
||||
public override Task<LoginLogGetListOutputDto> UpdateAsync(Guid id, LoginLogGetListOutputDto input)
|
||||
{
|
||||
return base.UpdateAsync(id, input);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ using Volo.Abp.Application.Services;
|
||||
using Yi.Framework.Rbac.Application.Contracts.Dtos.MonitorCache;
|
||||
using Yi.Framework.Rbac.Application.Contracts.IServices;
|
||||
|
||||
namespace Yi.Framework.Rbac.Application.Services
|
||||
namespace Yi.Framework.Rbac.Application.Services.Monitor
|
||||
{
|
||||
public class MonitorCacheService : ApplicationService, IMonitorCacheService
|
||||
{
|
||||
@@ -7,7 +7,7 @@ using Volo.Abp.Application.Services;
|
||||
using Yi.Framework.Core.Helper;
|
||||
using Yi.Framework.Rbac.Application.Contracts.IServices;
|
||||
|
||||
namespace Yi.Framework.Rbac.Application.Services
|
||||
namespace Yi.Framework.Rbac.Application.Services.Monitor
|
||||
{
|
||||
public class MonitorServerService : ApplicationService, IMonitorServerService
|
||||
{
|
||||
@@ -7,7 +7,7 @@ using Yi.Framework.Rbac.Application.Contracts.IServices;
|
||||
using Yi.Framework.Rbac.Application.SignalRHubs;
|
||||
using Yi.Framework.Rbac.Domain.Shared.Model;
|
||||
|
||||
namespace Yi.Framework.Rbac.Application.Services
|
||||
namespace Yi.Framework.Rbac.Application.Services.Monitor
|
||||
{
|
||||
public class OnlineService : ApplicationService, IOnlineService
|
||||
{
|
||||
@@ -37,7 +37,7 @@ namespace Yi.Framework.Rbac.Application.Services
|
||||
{
|
||||
dataWhere = dataWhere.Where((u) => u.UserName!.Contains(online.UserName));
|
||||
}
|
||||
return Task.FromResult(new PagedResultDto<OnlineUserModel>() { TotalCount = data.Count, Items = dataWhere.ToList() }) ;
|
||||
return Task.FromResult(new PagedResultDto<OnlineUserModel>() { TotalCount = data.Count, Items = dataWhere.ToList() });
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ using Yi.Framework.Rbac.Application.Contracts.Dtos.Task;
|
||||
using Yi.Framework.Rbac.Application.Contracts.IServices;
|
||||
using Yi.Framework.Rbac.Domain.Shared.Enums;
|
||||
|
||||
namespace Yi.Framework.Rbac.Application.Services
|
||||
namespace Yi.Framework.Rbac.Application.Services.Monitor
|
||||
{
|
||||
public class TaskService : ApplicationService, ITaskService
|
||||
{
|
||||
@@ -19,7 +19,7 @@ namespace Yi.Framework.Rbac.Application.Services
|
||||
private readonly IClock _clock;
|
||||
public TaskService(ISchedulerFactory schedulerFactory, IClock clock)
|
||||
{
|
||||
_clock=clock;
|
||||
_clock = clock;
|
||||
_schedulerFactory = schedulerFactory;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Yi.Framework.Rbac.Application.Services
|
||||
Properties = Newtonsoft.Json.JsonConvert.SerializeObject(jobDetail.JobDataMap),
|
||||
Concurrent = !jobDetail.ConcurrentExecutionDisallowed,
|
||||
Description = jobDetail.Description,
|
||||
LastRunTime = _clock.Normalize( trigger.GetPreviousFireTimeUtc()?.DateTime??DateTime.MinValue),
|
||||
LastRunTime = _clock.Normalize(trigger.GetPreviousFireTimeUtc()?.DateTime ?? DateTime.MinValue),
|
||||
NextRunTime = _clock.Normalize(trigger.GetNextFireTimeUtc()?.DateTime ?? DateTime.MinValue),
|
||||
AssemblyName = jobDetail.JobType.Assembly.GetName().Name,
|
||||
Status = state.ToString()
|
||||
@@ -56,7 +56,7 @@ namespace Yi.Framework.Rbac.Application.Services
|
||||
|
||||
if (trigger is ISimpleTrigger simple)
|
||||
{
|
||||
output.TriggerArgs =Math.Round(simple.RepeatInterval.TotalMinutes,2) .ToString() + "分钟";
|
||||
output.TriggerArgs = Math.Round(simple.RepeatInterval.TotalMinutes, 2).ToString() + "分钟";
|
||||
output.Type = JobTypeEnum.Millisecond;
|
||||
output.Millisecond = simple.RepeatInterval.TotalMilliseconds;
|
||||
}
|
||||
@@ -64,7 +64,7 @@ namespace Yi.Framework.Rbac.Application.Services
|
||||
{
|
||||
output.TriggerArgs = cron.CronExpressionString!;
|
||||
output.Type = JobTypeEnum.Cron;
|
||||
output.Cron=cron.CronExpressionString;
|
||||
output.Cron = cron.CronExpressionString;
|
||||
}
|
||||
return output;
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
using SqlSugar;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.Application.Dtos;
|
||||
using Yi.Framework.Ddd.Application;
|
||||
using Yi.Framework.Rbac.Application.Contracts.Dtos.OperLog;
|
||||
using Yi.Framework.Rbac.Application.Contracts.IServices;
|
||||
using Yi.Framework.Rbac.Domain.Operlog;
|
||||
using Yi.Framework.SqlSugarCore.Abstractions;
|
||||
|
||||
namespace Yi.Framework.Rbac.Application.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// OperationLog服务实现
|
||||
/// </summary>
|
||||
public class OperationLogService : YiCrudAppService<OperationLogEntity, OperationLogGetListOutputDto, Guid, OperationLogGetListInputVo>,
|
||||
IOperationLogService
|
||||
{
|
||||
private ISqlSugarRepository<OperationLogEntity, Guid> _repository;
|
||||
public OperationLogService(ISqlSugarRepository<OperationLogEntity, Guid> repository) : base(repository)
|
||||
{
|
||||
_repository=repository;
|
||||
}
|
||||
|
||||
public override async Task<PagedResultDto<OperationLogGetListOutputDto>> GetListAsync(OperationLogGetListInputVo input)
|
||||
{
|
||||
RefAsync<int> total = 0;
|
||||
var entities = await _repository._DbQueryable.WhereIF(!string.IsNullOrEmpty(input.OperUser), x => x.OperUser.Contains(input.OperUser!))
|
||||
.WhereIF(input.OperType is not null, x => x.OperType == input.OperType)
|
||||
.WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime)
|
||||
.ToPageListAsync(input.SkipCount, input.MaxResultCount, total);
|
||||
return new PagedResultDto<OperationLogGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));
|
||||
}
|
||||
|
||||
[RemoteService(false)]
|
||||
public override Task<OperationLogGetListOutputDto> UpdateAsync(Guid id, OperationLogGetListOutputDto input)
|
||||
{
|
||||
return base.UpdateAsync(id, input);
|
||||
}
|
||||
}
|
||||
}
|
||||
41
Yi.Doc.Md/01.框架快速开始教程/00.快速上手/00.模块与项目.md
Normal file
41
Yi.Doc.Md/01.框架快速开始教程/00.快速上手/00.模块与项目.md
Normal file
@@ -0,0 +1,41 @@
|
||||
## 模块与项目
|
||||
意框架是一个基于Abp.VNext的框架,完美使用模块化理念进行开发。既然是模块化开发,就有`项目`与`项目`的概念。
|
||||
|
||||
很多人问到了我,我的代码应该放到哪里,其实是没有分清楚模块与项目,弄清楚这个,再下手撸码,才更有方向。
|
||||
|
||||
其实不必一堆概念,只需要心中思考一下
|
||||
|
||||
> 我接下来要开发的业务是否有必要被其他项目依赖使用?
|
||||
|
||||
例如:内置的Rbac模块、Bbs模块,单独具备权限管理和社区论坛的功能,公开给大家复用引用,这就可以当成一个模块
|
||||
|
||||
`但是`,有时候如果我不认为他有必要复用,就是公司的一个内部系统,想要快速开发并交付,要同时具备权限管理、商城、审批等各种功能,那就直接当一个项目开发即可,不一定需要将各个模块拆的太散
|
||||
|
||||
> 这个划分的界限,是由项目来决定
|
||||
|
||||
注意:模块的代码与项目的代码结构几乎没有区别
|
||||
|
||||
这意味,有一个最好的方式,先将业务全部写在项目中,等稳定之后,在复制抽象到模块中,完全没有问题。
|
||||
|
||||
### 模块的优缺点
|
||||
- 优点:高度抽象复用
|
||||
- 缺点:肉眼可见的程序集增加、维护成本更高
|
||||
|
||||
### 模块
|
||||

|
||||
|
||||
代码位置放在`module`目录下,单独建立一个自己的模块名称,可使用`脚手架使用`将默认代码生成在这里。
|
||||
|
||||
### 项目
|
||||

|
||||
|
||||
框架内置一个host项目,代码位置存放在`src`中,直接使用即可,如果想更换命名,可以使用上一节的`脚手架使用`。
|
||||
|
||||
## 总结
|
||||
> 由于很多人询问我这个问题,所以单独写一篇,方便大家理解。
|
||||
|
||||
先区分模块还是项目,然后代码写到对应的位置即可
|
||||
|
||||
理论上,按这套规则意味着,只有在自己的`module`、`src`下才需要写代码,其他地方都是内置好了的,通过继承、实现等方式扩展即可
|
||||
|
||||
当然,你可以不按这套规则出发,目录结构按自己的舒服的方式去设计,当然也是可以的,不过这得花费一些时间了。
|
||||
0
Yi.Doc.Md/01.框架快速开始教程/00.快速上手/01.依赖关系.md
Normal file
0
Yi.Doc.Md/01.框架快速开始教程/00.快速上手/01.依赖关系.md
Normal file
BIN
Yi.Doc.Md/01.框架快速开始教程/00.快速上手/image-1.png
Normal file
BIN
Yi.Doc.Md/01.框架快速开始教程/00.快速上手/image-1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.9 KiB |
BIN
Yi.Doc.Md/01.框架快速开始教程/00.快速上手/image.png
Normal file
BIN
Yi.Doc.Md/01.框架快速开始教程/00.快速上手/image.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
34
Yi.Doc.Md/01.框架快速开始教程/05.脚手架使用.md
Normal file
34
Yi.Doc.Md/01.框架快速开始教程/05.脚手架使用.md
Normal file
@@ -0,0 +1,34 @@
|
||||
## 简介
|
||||
上节说到,真正关注的代码其实只用在src中
|
||||

|
||||
当我们要新建一个项目或者模块的时候,并不想取这个`Yi.Abp`的名字,我们可以使用dotnet的脚手架进行模板的生成
|
||||
|
||||
**环境**:只需要dotnet sdk即可
|
||||
|
||||
## 步骤
|
||||

|
||||
在模板文件目录上,有一个`.template.config`文件夹,就是通过这个进行控制模板的生成及替换
|
||||
|
||||
进入该目录,使用cmd执行以以下命令:
|
||||
``` shell
|
||||
dotnet new install . --force
|
||||
```
|
||||
|
||||

|
||||
|
||||
出现 `已安装以下模板` 及代表安装完成
|
||||
|
||||
>我们只需要安装一次即可,如果模板文件发生变化,我们生成出来的文件也是一样会变化的
|
||||
|
||||
当模板安装完成,接下来我们可以选择一个自己想要的空白文件夹,输入命令:
|
||||
|
||||
``` shell
|
||||
dotnet new yi --name=Acme.BookStore
|
||||
#Acme.BookStore可以替换成你想要生成的名称即可
|
||||
```
|
||||
|
||||

|
||||
|
||||
最后查看目录:
|
||||

|
||||
这个便是我们想要的结果了
|
||||
Reference in New Issue
Block a user