Compare commits
37 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76079faca0 | ||
|
|
5d5c62123c | ||
|
|
6c7b2224b1 | ||
|
|
4d80ae2372 | ||
|
|
c651b60c59 | ||
|
|
90b39d075d | ||
|
|
5099c7e462 | ||
|
|
2f8b5dd229 | ||
|
|
7e427605ab | ||
|
|
512e640c13 | ||
|
|
acb1c6cc99 | ||
|
|
d01c3ff9ca | ||
|
|
3720644153 | ||
|
|
630cfb6769 | ||
|
|
f3061ed643 | ||
|
|
2556c037ba | ||
|
|
0b4626a5a2 | ||
|
|
1c9e993194 | ||
|
|
dc3a465f09 | ||
|
|
6d008efd54 | ||
|
|
6aa970c375 | ||
|
|
1ecd01204b | ||
|
|
33bd8d1cd1 | ||
|
|
31d2c3c98e | ||
|
|
b082ec19aa | ||
|
|
9ccb496069 | ||
|
|
3871a7de84 | ||
|
|
c6931e3492 | ||
|
|
c8b2a38c99 | ||
|
|
a7bdcd8dd8 | ||
|
|
8196cd597a | ||
|
|
52deb6bb79 | ||
|
|
1a22aa0bfb | ||
|
|
d18e5eec99 | ||
|
|
0fcf172192 | ||
|
|
88b968e826 | ||
|
|
f15d99e168 |
15
README.md
@@ -20,6 +20,10 @@ Yi框架-一套与SqlSugar一样爽的.Net6低代码开源框架。
|
|||||||
适合.Net6学习、Sqlsugar学习 、项目二次开发。
|
适合.Net6学习、Sqlsugar学习 、项目二次开发。
|
||||||
集大成者,终究轮子
|
集大成者,终究轮子
|
||||||
|
|
||||||
|
Yi框架最新版本标签:`v1.0.5`,具体版本可以查看标签迭代
|
||||||
|
|
||||||
|
(项目与Sqlsugar同步更新,但这作者老杰哥代码天天爆肝到凌晨两点,我们也尽量会跟上他的脚步。更新频繁,所以可watching持续关注。)
|
||||||
|
|
||||||
————这不仅仅是一个程序,更是一个艺术品,面向艺术的开发!
|
————这不仅仅是一个程序,更是一个艺术品,面向艺术的开发!
|
||||||
|
|
||||||
**分支**:
|
**分支**:
|
||||||
@@ -122,16 +126,19 @@ WebFirst开发:所有代码生成器已经配置完成,无需任何操作数
|
|||||||
- [x] 支持`单表多租户`常用功能
|
- [x] 支持`单表多租户`常用功能
|
||||||
- [x] 支持`逻辑删除`常用功能
|
- [x] 支持`逻辑删除`常用功能
|
||||||
- [x] 支持`操作日志`常用功能
|
- [x] 支持`操作日志`常用功能
|
||||||
|
- [x] 支持`自动分表`
|
||||||
- [x] 支持 太多了忘了
|
- [x] 支持 太多了忘了
|
||||||
|
|
||||||
****
|
****
|
||||||
### 目录结构:
|
### 目录结构:
|
||||||
|
|
||||||

|

|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
我们大致依照DDD领域驱动设计分层
|
我们大致依照DDD领域驱动设计分层
|
||||||
|
|
||||||
什么?感觉太复杂了?用户只需关注Api、Service其他都是轮子啊!
|
分层如此清晰!什么?还感觉太复杂了?用户只需关注Api、Service其他都是轮子啊!
|
||||||
|
|
||||||
~~- BackGround:后台进程(目前可以无视,等待更新)~~
|
~~- BackGround:后台进程(目前可以无视,等待更新)~~
|
||||||
- Client:客户端(测试、客户端)
|
- Client:客户端(测试、客户端)
|
||||||
@@ -183,7 +190,9 @@ WebFirst开发:所有代码生成器已经配置完成,无需任何操作数
|
|||||||
****
|
****
|
||||||
### 联系我们:
|
### 联系我们:
|
||||||
|
|
||||||
作者QQ:454313500
|
作者QQ:`454313500`,2029年之前作者24小时在线,时刻保持活跃更新。
|
||||||
|
|
||||||
|
QQ交流群:官方一群(已满)、官方二群(已满)、官方三群:`786308927`(加作者QQ后同意)
|
||||||
|
|
||||||
联系作者,这里人人都是顾问
|
联系作者,这里人人都是顾问
|
||||||
|
|
||||||
|
|||||||
@@ -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,52 @@
|
|||||||
<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.MenuController">
|
||||||
|
<summary>
|
||||||
|
菜单管理
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MenuController.GetMenuTree">
|
||||||
|
<summary>
|
||||||
|
得到树形菜单
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="T:Yi.Framework.ApiMicroservice.Controllers.RoleController">
|
||||||
|
<summary>
|
||||||
|
角色管理
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.GiveRoleSetMenu(Yi.Framework.DTOModel.GiveRoleSetMenuDto)">
|
||||||
|
<summary>
|
||||||
|
给多用户设置多角色
|
||||||
|
</summary>
|
||||||
|
<param name="giveRoleSetMenuDto"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.GetInMenuByRoleId(System.Int64)">
|
||||||
|
<summary>
|
||||||
|
通过角色id来获取菜单列表
|
||||||
|
</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>
|
||||||
仓储上下文对象测试
|
仓储上下文对象测试
|
||||||
@@ -87,5 +138,48 @@
|
|||||||
</summary>
|
</summary>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.IncludeTest">
|
||||||
|
<summary>
|
||||||
|
极爽导航属性
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</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>
|
||||||
|
<member name="T:Yi.Framework.ApiMicroservice.Controllers.UserController">
|
||||||
|
<summary>
|
||||||
|
用户管理
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.Add(Yi.Framework.Model.Models.UserEntity)">
|
||||||
|
<summary>
|
||||||
|
添加用户,去重,密码加密
|
||||||
|
</summary>
|
||||||
|
<param name="entity"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.GiveUserSetRole(Yi.Framework.DTOModel.GiveUserSetRoleDto)">
|
||||||
|
<summary>
|
||||||
|
给多用户设置多角色
|
||||||
|
</summary>
|
||||||
|
<param name="giveUserSetRoleDto"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.GetRoleListByUserId(System.Int64)">
|
||||||
|
<summary>
|
||||||
|
通过用户id得到角色列表
|
||||||
|
</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,12 +15,11 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T"></typeparam>
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/[controller]/[action]")]
|
public class BaseCrudController<T> : ControllerBase where T : class, IBaseModelEntity,new()
|
||||||
public class BaseCrudController<T> : ControllerBase where T : BaseModelEntity,new()
|
|
||||||
{
|
{
|
||||||
public readonly ILogger<T> _logger;
|
private readonly ILogger<T> _logger;
|
||||||
public IBaseService<T> _baseService;
|
private IBaseService<T> _baseService;
|
||||||
public IRepository<T> _repository;
|
private IRepository<T> _repository;
|
||||||
public BaseCrudController(ILogger<T> logger, IBaseService<T> iBaseService)
|
public BaseCrudController(ILogger<T> logger, IBaseService<T> iBaseService)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
@@ -35,7 +34,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[Permission($"{nameof(T)}:get:one")]
|
[Permission($"{nameof(T)}:get:one")]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public async Task<Result> GetById(long id)
|
public virtual async Task<Result> GetById(long id)
|
||||||
{
|
{
|
||||||
return Result.Success().SetData(await _repository.GetByIdAsync(id));
|
return Result.Success().SetData(await _repository.GetByIdAsync(id));
|
||||||
}
|
}
|
||||||
@@ -46,7 +45,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[Permission($"{nameof(T)}:get:list")]
|
[Permission($"{nameof(T)}:get:list")]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<Result> GetList(QueryCondition queryCondition)
|
public virtual async Task<Result> GetList(QueryCondition queryCondition)
|
||||||
{
|
{
|
||||||
return Result.Success().SetData(await _repository.GetListAsync(queryCondition));
|
return Result.Success().SetData(await _repository.GetListAsync(queryCondition));
|
||||||
}
|
}
|
||||||
@@ -58,7 +57,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[Permission($"{nameof(T)}:get:page")]
|
[Permission($"{nameof(T)}:get:page")]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<Result> PageList(QueryPageCondition queryCondition)
|
public virtual async Task<Result> PageList(QueryPageCondition queryCondition)
|
||||||
{
|
{
|
||||||
return Result.Success().SetData(await _repository.CommonPageAsync(queryCondition));
|
return Result.Success().SetData(await _repository.CommonPageAsync(queryCondition));
|
||||||
}
|
}
|
||||||
@@ -70,7 +69,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[Permission($"{nameof(T)}:add")]
|
[Permission($"{nameof(T)}:add")]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<Result> Add(T entity)
|
public virtual async Task<Result> Add(T entity)
|
||||||
{
|
{
|
||||||
return Result.Success().SetData(await _repository.InsertReturnSnowflakeIdAsync(entity));
|
return Result.Success().SetData(await _repository.InsertReturnSnowflakeIdAsync(entity));
|
||||||
}
|
}
|
||||||
@@ -82,7 +81,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[Permission($"{nameof(T)}:update")]
|
[Permission($"{nameof(T)}:update")]
|
||||||
[HttpPut]
|
[HttpPut]
|
||||||
public async Task<Result> Update(T entity)
|
public virtual async Task<Result> Update(T entity)
|
||||||
{
|
{
|
||||||
return Result.Success().SetStatus(await _repository.UpdateIgnoreNullAsync(entity));
|
return Result.Success().SetStatus(await _repository.UpdateIgnoreNullAsync(entity));
|
||||||
}
|
}
|
||||||
@@ -94,7 +93,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[Permission($"{nameof(T)}:delete:list")]
|
[Permission($"{nameof(T)}:delete:list")]
|
||||||
[HttpDelete]
|
[HttpDelete]
|
||||||
public async Task<Result> DeleteList(List<long> ids)
|
public virtual async Task<Result> DeleteList(List<long> ids)
|
||||||
{
|
{
|
||||||
return Result.Success().SetStatus(await _repository.DeleteByLogicAsync(ids));
|
return Result.Success().SetStatus(await _repository.DeleteByLogicAsync(ids));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,44 @@
|
|||||||
|
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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 菜单管理
|
||||||
|
/// </summary>
|
||||||
|
[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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 得到树形菜单
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
//暂未制作逻辑删除与多租户的过滤
|
||||||
|
public async Task<Result> GetMenuTree()
|
||||||
|
{
|
||||||
|
return Result.Success().SetData(await _iMenuService. GetMenuTreeAsync());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
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.DTOModel;
|
||||||
|
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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 角色管理
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/[controller]/[action]")]
|
||||||
|
public class RoleController : BaseCrudController<RoleEntity>
|
||||||
|
{
|
||||||
|
private IRoleService _iRoleService;
|
||||||
|
public RoleController(ILogger<RoleEntity> logger, IRoleService iRoleService) : base(logger, iRoleService)
|
||||||
|
{
|
||||||
|
_iRoleService = iRoleService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 给多用户设置多角色
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="giveRoleSetMenuDto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPut]
|
||||||
|
public async Task<Result> GiveRoleSetMenu(GiveRoleSetMenuDto giveRoleSetMenuDto)
|
||||||
|
{
|
||||||
|
return Result.Success().SetStatus(await _iRoleService.GiveRoleSetMenu(giveRoleSetMenuDto.RoleIds, giveRoleSetMenuDto.MenuIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 通过角色id来获取菜单列表
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<Result> GetInMenuByRoleId(long RoleId)
|
||||||
|
{
|
||||||
|
return Result.Success().SetData(await _iRoleService.GetInMenuByRoleId(RoleId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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,17 +19,24 @@ 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
|
||||||
{
|
{
|
||||||
private IStringLocalizer<LocalLanguage> _local;
|
private IStringLocalizer<LocalLanguage> _local;
|
||||||
private IUserService _iUserService;
|
private IUserService _iUserService;
|
||||||
|
private IRoleService _iRoleService;
|
||||||
|
private QuartzInvoker _quartzInvoker;
|
||||||
//你可以依赖注入服务层各各接口,也可以注入其他仓储层,怎么爽怎么来!
|
//你可以依赖注入服务层各各接口,也可以注入其他仓储层,怎么爽怎么来!
|
||||||
public TestController(ILogger<UserEntity> logger, 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;
|
||||||
|
_quartzInvoker = quartzInvoker;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -42,19 +51,19 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
//非常好,使用UserService的特有方法
|
//非常好,使用UserService的特有方法
|
||||||
await _iUserService.DbTest();
|
await _iUserService.DbTest();
|
||||||
|
|
||||||
//非常好,依赖注入使用其他Service的特有方法(就tm一张表,现在自己注入自己)
|
//非常好,依赖注入使用其他Service的特有方法
|
||||||
await _iUserService.DbTest();
|
await _iRoleService.DbTest();
|
||||||
|
|
||||||
//很核理,使用仓储的通用方法
|
//很核理,使用仓储的通用方法
|
||||||
await _iUserService._repository.GetListAsync();
|
await _iUserService._repository.GetListAsync();
|
||||||
|
|
||||||
//挺不错,依赖注入其他仓储(就tm一张表,现在自己注入自己)
|
//挺不错,依赖注入其他仓储
|
||||||
await _iUserService._repository.GetListAsync();
|
await _iRoleService._repository.GetListAsync();
|
||||||
|
|
||||||
//不建议操作,直接切换其他仓储(就tm一张表,现在自己切换自己)
|
//不建议操作,直接切换其他仓储
|
||||||
await _iUserService._repository.ChangeRepository<Repository<UserEntity>>().GetListAsync();
|
await _iUserService._repository.ChangeRepository<Repository<RoleEntity>>().GetListAsync();
|
||||||
|
|
||||||
//恭喜你已经毕业了!此后将有一天,接手到这个的软件的程序员将破口大骂。
|
//最好不要直接操作Db对象
|
||||||
await _iUserService._repository._Db.Queryable<UserEntity>().ToListAsync();
|
await _iUserService._repository._Db.Queryable<UserEntity>().ToListAsync();
|
||||||
|
|
||||||
return Result.Success().SetData(await _iUserService.DbTest());
|
return Result.Success().SetData(await _iUserService.DbTest());
|
||||||
@@ -132,6 +141,43 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//emmmm,看来一张表已经满足不了,接下来将要大更新一波
|
/// <summary>
|
||||||
|
/// 极爽导航属性
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
//Sqlsugar精髓之一!必学!最新版本
|
||||||
|
public async Task<Result> IncludeTest()
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Yi.Framework.Common.Models;
|
using Yi.Framework.Common.Models;
|
||||||
|
using Yi.Framework.DTOModel;
|
||||||
using Yi.Framework.Interface;
|
using Yi.Framework.Interface;
|
||||||
using Yi.Framework.Model.Models;
|
using Yi.Framework.Model.Models;
|
||||||
using Yi.Framework.Repository;
|
using Yi.Framework.Repository;
|
||||||
@@ -15,6 +16,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 UserController : BaseCrudController<UserEntity>
|
public class UserController : BaseCrudController<UserEntity>
|
||||||
@@ -24,5 +28,44 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
{
|
{
|
||||||
_iUserService = iUserService;
|
_iUserService = iUserService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 添加用户,去重,密码加密
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[Permission($"{nameof(UserEntity)}:add")]
|
||||||
|
[HttpPost]
|
||||||
|
public override async Task<Result> Add(UserEntity entity)
|
||||||
|
{
|
||||||
|
if (!await _iUserService.Exist(entity.UserName))
|
||||||
|
{
|
||||||
|
entity.BuildPassword();
|
||||||
|
return Result.Success().SetData(await _iUserService._repository.InsertReturnSnowflakeIdAsync(entity));
|
||||||
|
}
|
||||||
|
return Result.SuccessError("用户已存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 给多用户设置多角色
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="giveUserSetRoleDto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPut]
|
||||||
|
public async Task<Result> GiveUserSetRole(GiveUserSetRoleDto giveUserSetRoleDto)
|
||||||
|
{
|
||||||
|
return Result.Success().SetStatus(await _iUserService.GiveUserSetRole(giveUserSetRoleDto.UserIds, giveUserSetRoleDto.RoleIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 通过用户id得到角色列表
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<Result> GetRoleListByUserId(long userId)
|
||||||
|
{
|
||||||
|
return Result.Success().SetData(await _iUserService.GetRoleListByUserId(userId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ ServiceLocator.Instance = app.Services;
|
|||||||
#region
|
#region
|
||||||
//错误抓取反馈注入
|
//错误抓取反馈注入
|
||||||
#endregion
|
#endregion
|
||||||
//app.UseErrorHandlingService();
|
app.UseErrorHandlingService();
|
||||||
#region
|
#region
|
||||||
//静态文件注入
|
//静态文件注入
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Yi.Framework.DTOModel
|
||||||
|
{
|
||||||
|
public class GiveRoleSetMenuDto
|
||||||
|
{
|
||||||
|
public List<long> RoleIds { get; set; }
|
||||||
|
public List<long> MenuIds { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Yi.Framework.DTOModel
|
||||||
|
{
|
||||||
|
public class GiveUserSetRoleDto
|
||||||
|
{
|
||||||
|
public List<long> UserIds { get; set; }
|
||||||
|
public List<long> RoleIds { get; set;}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Yi.Framework.Net6/Yi.Framework.Interface/IMenuService.cs
Normal file
@@ -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 IMenuService:IBaseService<MenuEntity>
|
||||||
|
{
|
||||||
|
Task<List<MenuEntity>> GetMenuTreeAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
31
Yi.Framework.Net6/Yi.Framework.Interface/IRoleService.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Yi.Framework.Model.Models;
|
||||||
|
using Yi.Framework.Repository;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Interface
|
||||||
|
{
|
||||||
|
public partial interface IRoleService
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// DbTest
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<List<RoleEntity>> DbTest();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 通过角色id获取角色实体包含菜单
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="roleId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<RoleEntity> GetInMenuByRoleId(long roleId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 给角色设置菜单,多角色,多菜单
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="roleIds"></param>
|
||||||
|
/// <param name="menuIds"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<bool> GiveRoleSetMenu(List<long> roleIds, List<long> menuIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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>
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Yi.Framework.Model.Models;
|
||||||
|
using Yi.Framework.Repository;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Interface
|
||||||
|
{
|
||||||
|
public partial interface IMenuService : IBaseService<MenuEntity>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
using Yi.Framework.Model.Models;
|
||||||
|
using Yi.Framework.Repository;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Interface
|
||||||
|
{
|
||||||
|
public partial interface IRoleService:IBaseService<RoleEntity>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,7 +12,7 @@ namespace Yi.Framework.Interface
|
|||||||
/// 测试仓储的上下文对象
|
/// 测试仓储的上下文对象
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<List<UserEntity>> DbTest();
|
Task<List<UserEntity>> DbTest();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 登录方法
|
/// 登录方法
|
||||||
@@ -21,7 +21,7 @@ namespace Yi.Framework.Interface
|
|||||||
/// <param name="password"></param>
|
/// <param name="password"></param>
|
||||||
/// <param name="userAction"></param>
|
/// <param name="userAction"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<bool> Login(string userName, string password, Action<UserEntity> userAction = null);
|
Task<bool> Login(string userName, string password, Action<UserEntity> userAction = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 注册方法
|
/// 注册方法
|
||||||
@@ -29,6 +29,35 @@ namespace Yi.Framework.Interface
|
|||||||
/// <param name="userEntity"></param>
|
/// <param name="userEntity"></param>
|
||||||
/// <param name="userAction"></param>
|
/// <param name="userAction"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<bool> Register(UserEntity userEntity, Action<UserEntity> userAction = null);
|
Task<bool> Register(UserEntity userEntity, Action<UserEntity> userAction = null);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 导航属性关联角色
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<List<UserEntity>> GetListInRole();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 给用户设置角色,多用户,多角色
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userIds"></param>
|
||||||
|
/// <param name="roleIds"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<bool> GiveUserSetRole(List<long> userIds, List<long> roleIds);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 判断用户名是否存在,如果存在可返回该用户
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userName"></param>
|
||||||
|
/// <param name="userAction"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<bool> Exist(string userName, Action<UserEntity> userAction = null);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 通过用户id得到角色列表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<List<RoleEntity>> GetRoleListByUserId(long userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
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
@@ -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> Children { 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; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using SqlSugar;
|
|
||||||
namespace Yi.Framework.Model.Models
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
///</summary>
|
|
||||||
[SugarTable("User")]
|
|
||||||
public partial class UserEntity:BaseModelEntity
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
///</summary>
|
|
||||||
[SugarColumn(ColumnName="Name" )]
|
|
||||||
public string Name { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
///</summary>
|
|
||||||
[SugarColumn(ColumnName="Age" )]
|
|
||||||
public int? Age { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
///</summary>
|
|
||||||
[SugarColumn(ColumnName="TenantId" )]
|
|
||||||
public long? TenantId { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
///</summary>
|
|
||||||
[SugarColumn(ColumnName="UserName" )]
|
|
||||||
public string UserName { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
///</summary>
|
|
||||||
[SugarColumn(ColumnName="Password" )]
|
|
||||||
public string Password { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
///</summary>
|
|
||||||
[SugarColumn(ColumnName="Salt" )]
|
|
||||||
public string Salt { 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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
[JsonConverter(typeof(ValueToStringConverter))]
|
||||||
|
[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= "PermissionCode")]
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using SqlSugar;
|
||||||
|
namespace Yi.Framework.Model.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 角色表
|
||||||
|
///</summary>
|
||||||
|
[SugarTable("Role")]
|
||||||
|
public partial class RoleEntity:IBaseModelEntity
|
||||||
|
{
|
||||||
|
public RoleEntity()
|
||||||
|
{
|
||||||
|
this.IsDeleted = false;
|
||||||
|
this.CreateTime = DateTime.Now;
|
||||||
|
}
|
||||||
|
[JsonConverter(typeof(ValueToStringConverter))]
|
||||||
|
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
|
||||||
|
public long Id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="RoleName" )]
|
||||||
|
public string RoleName { 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="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="ModifyUser" )]
|
||||||
|
public long? ModifyUser { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
[JsonConverter(typeof(ValueToStringConverter))]
|
||||||
|
[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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
[JsonConverter(typeof(ValueToStringConverter))]
|
||||||
|
[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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using SqlSugar;
|
||||||
|
namespace Yi.Framework.Model.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 用户表
|
||||||
|
///</summary>
|
||||||
|
[SugarTable("User")]
|
||||||
|
public partial class UserEntity:IBaseModelEntity
|
||||||
|
{
|
||||||
|
public UserEntity()
|
||||||
|
{
|
||||||
|
this.IsDeleted = false;
|
||||||
|
this.CreateTime = DateTime.Now;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[Newtonsoft.Json.JsonConverter(typeof(ValueToStringConverter))]
|
||||||
|
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
|
||||||
|
public long Id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="Name" )]
|
||||||
|
public string Name { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="Age" )]
|
||||||
|
public int? Age { 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>
|
||||||
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="TenantId" )]
|
||||||
|
public long? TenantId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="UserName" )]
|
||||||
|
public string UserName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="Password" )]
|
||||||
|
public string Password { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="Salt" )]
|
||||||
|
public string Salt { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="Icon" )]
|
||||||
|
public long? Icon { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="Nick" )]
|
||||||
|
public string Nick { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="Email" )]
|
||||||
|
public string Email { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="Ip" )]
|
||||||
|
public string Ip { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="Address" )]
|
||||||
|
public string Address { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="Phone" )]
|
||||||
|
public string Phone { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using SqlSugar;
|
||||||
|
namespace Yi.Framework.Model.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 用户角色关系表
|
||||||
|
///</summary>
|
||||||
|
[SugarTable("UserRole")]
|
||||||
|
public partial class UserRoleEntity:IBaseModelEntity
|
||||||
|
{
|
||||||
|
public UserRoleEntity()
|
||||||
|
{
|
||||||
|
this.IsDeleted = false;
|
||||||
|
this.CreateTime = DateTime.Now;
|
||||||
|
}
|
||||||
|
[JsonConverter(typeof(ValueToStringConverter))]
|
||||||
|
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
|
||||||
|
public long Id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="RoleId" )]
|
||||||
|
public long? RoleId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="UserId" )]
|
||||||
|
public long? UserId { 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="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="ModifyUser" )]
|
||||||
|
public long? ModifyUser { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
16
Yi.Framework.Net6/Yi.Framework.Model/RoleEntity.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using SqlSugar;
|
||||||
|
namespace Yi.Framework.Model.Models
|
||||||
|
{
|
||||||
|
|
||||||
|
public partial class RoleEntity
|
||||||
|
{
|
||||||
|
//[Navigate(typeof(UserRoleEntity), nameof(UserRoleEntity.RoleId), nameof(UserRoleEntity.UserId))]
|
||||||
|
//public List<UserEntity> Users { get; set; }
|
||||||
|
[Navigate(typeof(RoleMenuEntity),nameof(RoleMenuEntity.RoleId),nameof(RoleMenuEntity.MenuId))]
|
||||||
|
public List<MenuEntity> Menus { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
30
Yi.Framework.Net6/Yi.Framework.Model/UserEntity.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using SqlSugar;
|
||||||
|
namespace Yi.Framework.Model.Models
|
||||||
|
{
|
||||||
|
public partial class UserEntity
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 看好啦!ORM精髓,导航属性
|
||||||
|
///</summary>
|
||||||
|
[Navigate(typeof(UserRoleEntity), nameof(UserRoleEntity.UserId), nameof(UserRoleEntity.RoleId))]
|
||||||
|
public List<RoleEntity> Roles { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 构建密码,MD5盐值加密
|
||||||
|
/// </summary>
|
||||||
|
public void BuildPassword(string password = null)
|
||||||
|
{
|
||||||
|
//如果不传值,那就把自己的password当作传进来的password
|
||||||
|
if (password == null)
|
||||||
|
{
|
||||||
|
password = this.Password;
|
||||||
|
}
|
||||||
|
this.Salt = Common.Helper.MD5Helper.GenerateSalt();
|
||||||
|
this.Password = Common.Helper.MD5Helper.SHA2Encode(password, this.Salt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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,15 +1,15 @@
|
|||||||
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)
|
||||||
{
|
// {
|
||||||
Db =base.Context;
|
// }
|
||||||
}
|
|
||||||
|
|
||||||
public ISqlSugarClient Db;
|
// }
|
||||||
}
|
//}
|
||||||
}
|
//简化已被弃用
|
||||||
|
|||||||
@@ -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);
|
||||||
@@ -23,6 +23,6 @@ namespace Yi.Framework.Repository
|
|||||||
public Task<bool> UpdateIgnoreNullAsync(T entity);
|
public Task<bool> UpdateIgnoreNullAsync(T entity);
|
||||||
public Task<List<S>> UseSqlAsync<S>(string sql);
|
public Task<List<S>> UseSqlAsync<S>(string sql);
|
||||||
public Task<bool> UseSqlAsync(string sql);
|
public Task<bool> UseSqlAsync(string sql);
|
||||||
|
ISugarQueryable<T> QueryConditionHandler(QueryCondition pars);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,16 +12,15 @@ 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> : SimpleClient<T>, IRepository<T> where T : class, IBaseModelEntity, new()
|
||||||
{
|
{
|
||||||
public ISqlSugarClient _Db { get; set; }
|
public ISqlSugarClient _Db { get { return base.Context; } set { } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 构造函数
|
/// 构造函数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="context"></param>
|
/// <param name="context"></param>
|
||||||
public Repository(ISqlSugarClient context) : base(context)//注意这里要有默认值等于null
|
public Repository(ISqlSugarClient context) : base(context)//注意这里要有默认值等于null
|
||||||
{
|
{
|
||||||
_Db = context;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -31,7 +30,8 @@ namespace Yi.Framework.Repository
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<bool> UseTranAsync(Func<Task> func)
|
public async Task<bool> UseTranAsync(Func<Task> func)
|
||||||
{
|
{
|
||||||
var res = await Db.AsTenant().UseTranAsync(func);
|
var con = Context;
|
||||||
|
var res = await _Db.AsTenant().UseTranAsync(func);
|
||||||
return res.IsSuccess;
|
return res.IsSuccess;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -44,7 +44,7 @@ namespace Yi.Framework.Repository
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<List<S>> UseSqlAsync<S>(string sql)
|
public async Task<List<S>> UseSqlAsync<S>(string sql)
|
||||||
{
|
{
|
||||||
return await Db.Ado.SqlQueryAsync<S>(sql);
|
return await _Db.Ado.SqlQueryAsync<S>(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ namespace Yi.Framework.Repository
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<bool> UseSqlAsync(string sql)
|
public async Task<bool> UseSqlAsync(string sql)
|
||||||
{
|
{
|
||||||
return await Db.Ado.ExecuteCommandAsync(sql)>0;
|
return await _Db.Ado.ExecuteCommandAsync(sql)>0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ namespace Yi.Framework.Repository
|
|||||||
public async Task<T> InsertReturnEntityAsync(T entity)
|
public async Task<T> InsertReturnEntityAsync(T entity)
|
||||||
{
|
{
|
||||||
entity.Id =SnowFlakeSingle.instance.getID();
|
entity.Id =SnowFlakeSingle.instance.getID();
|
||||||
return await Db.Insertable(entity).ExecuteReturnEntityAsync();
|
return await _Db.Insertable(entity).ExecuteReturnEntityAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -78,7 +78,7 @@ namespace Yi.Framework.Repository
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<bool> UpdateIgnoreNullAsync(T entity)
|
public async Task<bool> UpdateIgnoreNullAsync(T entity)
|
||||||
{
|
{
|
||||||
return await Db.Updateable(entity).IgnoreColumns(true).ExecuteCommandAsync()>0;
|
return await _Db.Updateable(entity).IgnoreColumns(true).ExecuteCommandAsync()>0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -88,9 +88,9 @@ namespace Yi.Framework.Repository
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<bool> DeleteByLogicAsync(List<long> ids)
|
public async Task<bool> DeleteByLogicAsync(List<long> ids)
|
||||||
{
|
{
|
||||||
var entitys = await Db.Queryable<T>().Where(u => ids.Contains(u.Id)).ToListAsync();
|
var entitys = await _Db.Queryable<T>().Where(u => ids.Contains(u.Id)).ToListAsync();
|
||||||
entitys.ForEach(u=>u.IsDeleted=true);
|
entitys.ForEach(u=>u.IsDeleted=true);
|
||||||
return await Db.Updateable(entitys).ExecuteCommandAsync()>0;
|
return await _Db.Updateable(entitys).ExecuteCommandAsync()>0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ namespace Yi.Framework.Repository
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<List<S>> StoreAsync<S>(string storeName, object para)
|
public async Task<List<S>> StoreAsync<S>(string storeName, object para)
|
||||||
{
|
{
|
||||||
return await Db.Ado.UseStoredProcedure().SqlQueryAsync<S>(storeName, para);
|
return await _Db.Ado.UseStoredProcedure().SqlQueryAsync<S>(storeName, para);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@ namespace Yi.Framework.Repository
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
private ISugarQueryable<T> QueryConditionHandler(QueryCondition pars)
|
public ISugarQueryable<T> QueryConditionHandler(QueryCondition pars)
|
||||||
{
|
{
|
||||||
var sugarParamters = pars.Parameters.Select(it => (IConditionalModel)new ConditionalModel()
|
var sugarParamters = pars.Parameters.Select(it => (IConditionalModel)new ConditionalModel()
|
||||||
{
|
{
|
||||||
@@ -142,7 +142,7 @@ namespace Yi.Framework.Repository
|
|||||||
FieldName = it.Key,
|
FieldName = it.Key,
|
||||||
FieldValue = it.Value
|
FieldValue = it.Value
|
||||||
}).ToList();
|
}).ToList();
|
||||||
var query = Db.Queryable<T>();
|
var query = _Db.Queryable<T>();
|
||||||
if (pars.OrderBys != null)
|
if (pars.OrderBys != null)
|
||||||
{
|
{
|
||||||
foreach (var item in pars.OrderBys)
|
foreach (var item in pars.OrderBys)
|
||||||
|
|||||||
@@ -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
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
19
Yi.Framework.Net6/Yi.Framework.Service/MenuService.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
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 async Task<List<MenuEntity>> GetMenuTreeAsync()
|
||||||
|
{
|
||||||
|
//ParentId 0,代表为根目录,只能存在一个
|
||||||
|
//复杂查询直接使用db代理
|
||||||
|
return await _repository._Db.Queryable<MenuEntity>().Where(u=>u.IsDeleted==false).ToTreeAsync(it=>it.Children,it=>it.ParentId,0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
50
Yi.Framework.Net6/Yi.Framework.Service/RoleService.cs
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Yi.Framework.Interface;
|
||||||
|
using Yi.Framework.Model.Models;
|
||||||
|
using Yi.Framework.Repository;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Service
|
||||||
|
{
|
||||||
|
public partial class RoleService
|
||||||
|
{
|
||||||
|
public async Task<List<RoleEntity>> DbTest()
|
||||||
|
{
|
||||||
|
return await _repository._Db.Queryable<RoleEntity>().ToListAsync();
|
||||||
|
}
|
||||||
|
public async Task<bool> GiveRoleSetMenu(List<long> roleIds, List<long> menuIds)
|
||||||
|
{
|
||||||
|
var _repositoryRoleMenu= _repository.ChangeRepository<Repository<RoleMenuEntity>>();
|
||||||
|
//多次操作,需要事务确保原子性
|
||||||
|
return await _repositoryRoleMenu.UseTranAsync(async () =>
|
||||||
|
{
|
||||||
|
|
||||||
|
//遍历用户
|
||||||
|
foreach (var roleId in roleIds)
|
||||||
|
{
|
||||||
|
//删除用户之前所有的用户角色关系(物理删除,没有恢复的必要)
|
||||||
|
await _repositoryRoleMenu.DeleteAsync(u => u.RoleId==roleId);
|
||||||
|
|
||||||
|
//添加新的关系
|
||||||
|
List<RoleMenuEntity> roleMenuEntity = new();
|
||||||
|
foreach (var menu in menuIds)
|
||||||
|
{
|
||||||
|
roleMenuEntity.Add(new RoleMenuEntity() { RoleId = roleId,MenuId=menu });
|
||||||
|
}
|
||||||
|
|
||||||
|
//一次性批量添加
|
||||||
|
await _repositoryRoleMenu.InsertReturnSnowflakeIdAsync(roleMenuEntity);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<RoleEntity> GetInMenuByRoleId(long roleId)
|
||||||
|
{
|
||||||
|
return await _repository._Db.Queryable<RoleEntity>().Includes(u => u.Menus).InSingleAsync(roleId);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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 LogService : BaseService<LogEntity>, ILogService
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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 RoleService : BaseService<RoleEntity>, IRoleService
|
||||||
|
{
|
||||||
|
public RoleService(IRepository<RoleEntity> repository) : base(repository)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ namespace Yi.Framework.Service
|
|||||||
{
|
{
|
||||||
return await _repository._Db.Queryable<UserEntity>().ToListAsync();
|
return await _repository._Db.Queryable<UserEntity>().ToListAsync();
|
||||||
}
|
}
|
||||||
public async Task<bool> Exist(Guid id, Action<UserEntity> userAction = null)
|
public async Task<bool> Exist(long id, Action<UserEntity> userAction = null)
|
||||||
{
|
{
|
||||||
var user = await _repository.GetByIdAsync(id);
|
var user = await _repository.GetByIdAsync(id);
|
||||||
userAction.Invoke(user);
|
userAction.Invoke(user);
|
||||||
@@ -27,7 +27,7 @@ namespace Yi.Framework.Service
|
|||||||
}
|
}
|
||||||
public async Task<bool> Exist(string userName, Action<UserEntity> userAction = null)
|
public async Task<bool> Exist(string userName, Action<UserEntity> userAction = null)
|
||||||
{
|
{
|
||||||
var user = await _repository.GetFirstAsync(u=>u.UserName== userName);
|
var user = await _repository.GetFirstAsync(u => u.UserName == userName);
|
||||||
if (userAction != null)
|
if (userAction != null)
|
||||||
{
|
{
|
||||||
userAction.Invoke(user);
|
userAction.Invoke(user);
|
||||||
@@ -38,18 +38,18 @@ namespace Yi.Framework.Service
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public async Task<bool> Login(string userName, string password,Action<UserEntity> userAction = null)
|
public async Task<bool> Login(string userName, string password, Action<UserEntity> userAction = null)
|
||||||
{
|
{
|
||||||
var user=new UserEntity();
|
var user = new UserEntity();
|
||||||
if (await Exist(userName, o => user = o))
|
if (await Exist(userName, o => user = o))
|
||||||
{
|
{
|
||||||
userAction.Invoke(user);
|
userAction.Invoke(user);
|
||||||
if (user.Password== Common.Helper.MD5Helper.SHA2Encode(password, user.Salt))
|
if (user.Password == Common.Helper.MD5Helper.SHA2Encode(password, user.Salt))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> Register(UserEntity userEntity, Action<UserEntity> userAction = null)
|
public async Task<bool> Register(UserEntity userEntity, Action<UserEntity> userAction = null)
|
||||||
@@ -57,13 +57,50 @@ namespace Yi.Framework.Service
|
|||||||
var user = new UserEntity();
|
var user = new UserEntity();
|
||||||
if (!await Exist(userEntity.UserName))
|
if (!await Exist(userEntity.UserName))
|
||||||
{
|
{
|
||||||
user.UserName= userEntity.UserName;
|
user.UserName = userEntity.UserName;
|
||||||
user.Salt = Common.Helper.MD5Helper.GenerateSalt();
|
user.BuildPassword();
|
||||||
user.Password = Common.Helper.MD5Helper.SHA2Encode(userEntity.Password,user.Salt);
|
|
||||||
userAction.Invoke(await _repository.InsertReturnEntityAsync(user));
|
userAction.Invoke(await _repository.InsertReturnEntityAsync(user));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<List<UserEntity>> GetListInRole()
|
||||||
|
{
|
||||||
|
return await _repository._Db.Queryable<UserEntity>().Includes(u => u.Roles).ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> GiveUserSetRole(List<long> userIds, List<long> roleIds)
|
||||||
|
{
|
||||||
|
var _repositoryUserRole = _repository.ChangeRepository<Repository<UserRoleEntity>>();
|
||||||
|
|
||||||
|
//多次操作,需要事务确保原子性
|
||||||
|
return await _repositoryUserRole.UseTranAsync(async () =>
|
||||||
|
{
|
||||||
|
|
||||||
|
//遍历用户
|
||||||
|
foreach (var userId in userIds)
|
||||||
|
{
|
||||||
|
//删除用户之前所有的用户角色关系(物理删除,没有恢复的必要)
|
||||||
|
await _repositoryUserRole.DeleteAsync(u => u.UserId == userId);
|
||||||
|
|
||||||
|
//添加新的关系
|
||||||
|
List<UserRoleEntity> userRoleEntities = new();
|
||||||
|
foreach (var roleId in roleIds)
|
||||||
|
{
|
||||||
|
userRoleEntities.Add(new UserRoleEntity() { UserId = userId, RoleId = roleId });
|
||||||
|
}
|
||||||
|
|
||||||
|
//一次性批量添加
|
||||||
|
await _repositoryUserRole.InsertReturnSnowflakeIdAsync(userRoleEntities);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<List<RoleEntity>> GetRoleListByUserId(long userId)
|
||||||
|
{
|
||||||
|
return (await _repository._Db.Queryable<UserEntity>().Includes(u => u.Roles).InSingleAsync(userId)).Roles;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Newtonsoft.Json.Serialization;
|
||||||
|
using SqlSugar;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -15,6 +17,8 @@ namespace Yi.Framework.WebCore.BuilderExtend
|
|||||||
{
|
{
|
||||||
options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
|
options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
|
||||||
options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm";
|
options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm";
|
||||||
|
|
||||||
|
//options.SerializerSettings.Converters.Add(new ValueToStringConverter());
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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("_______________________________________________");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -62,16 +62,16 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
|
|||||||
}, Array.Empty<string>() }
|
}, Array.Empty<string>() }
|
||||||
});
|
});
|
||||||
|
|
||||||
c.AddServer(new OpenApiServer()
|
//c.AddServer(new OpenApiServer()
|
||||||
{
|
//{
|
||||||
Url = "https://ccnetcore.com",
|
// Url = "https://ccnetcore.com",
|
||||||
Description = "Yi-Framework"
|
// Description = "Yi-Framework"
|
||||||
});
|
//});
|
||||||
c.CustomOperationIds(apiDesc =>
|
//c.CustomOperationIds(apiDesc =>
|
||||||
{
|
//{
|
||||||
var controllerAction = apiDesc.ActionDescriptor as ControllerActionDescriptor;
|
// var controllerAction = apiDesc.ActionDescriptor as ControllerActionDescriptor;
|
||||||
return controllerAction.ActionName;
|
// return controllerAction.ActionName;
|
||||||
});
|
//});
|
||||||
});
|
});
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -85,27 +85,12 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
|
|||||||
app.UseSwagger();
|
app.UseSwagger();
|
||||||
|
|
||||||
|
|
||||||
app.UseKnife4UI(c =>
|
//app.UseKnife4UI(c =>
|
||||||
{
|
|
||||||
c.RoutePrefix = "swagger"; // serve the UI at root
|
|
||||||
if (swaggerModels.Length == 0)
|
|
||||||
{
|
|
||||||
c.SwaggerEndpoint("/v1/swagger.json", "Yi.Framework");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
foreach (var k in swaggerModels)
|
|
||||||
{
|
|
||||||
c.SwaggerEndpoint(k.url, k.name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//app.UseSwaggerUI(c =>
|
|
||||||
//{
|
//{
|
||||||
|
// c.RoutePrefix = "swagger"; // serve the UI at root
|
||||||
// if (swaggerModels.Length == 0)
|
// if (swaggerModels.Length == 0)
|
||||||
// {
|
// {
|
||||||
// c.SwaggerEndpoint("/swagger/v1/swagger.json", "Yi.Framework");
|
// c.SwaggerEndpoint("/v1/swagger.json", "Yi.Framework");
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
@@ -114,10 +99,25 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
|
|||||||
// c.SwaggerEndpoint(k.url, k.name);
|
// c.SwaggerEndpoint(k.url, k.name);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
//});
|
||||||
|
|
||||||
//}
|
app.UseSwaggerUI(c =>
|
||||||
|
{
|
||||||
|
if (swaggerModels.Length == 0)
|
||||||
|
{
|
||||||
|
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Yi.Framework");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (var k in swaggerModels)
|
||||||
|
{
|
||||||
|
c.SwaggerEndpoint(k.url, k.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//);
|
}
|
||||||
|
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
3
Yi.Vue2.x/.browserslistrc
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
> 1%
|
||||||
|
last 2 versions
|
||||||
|
not dead
|
||||||
4
Yi.Vue2.x/.env.development
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#接口服务地址
|
||||||
|
VUE_APP_SERVICE_URL='http://localhost:19001/api'
|
||||||
|
#开发环境路径前缀
|
||||||
|
VUE_APP_BASE_API='/dev-apis'
|
||||||
2
Yi.Vue2.x/.env.production
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#生成环境路径前缀
|
||||||
|
VUE_APP_BASE_API='/prod-apis'
|
||||||
23
Yi.Vue2.x/.gitignore
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
.DS_Store
|
||||||
|
node_modules
|
||||||
|
/dist
|
||||||
|
|
||||||
|
|
||||||
|
# local env files
|
||||||
|
.env.local
|
||||||
|
.env.*.local
|
||||||
|
|
||||||
|
# Log files
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.idea
|
||||||
|
.vscode
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
19
Yi.Vue2.x/README.md
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# vuetify-test
|
||||||
|
|
||||||
|
## Project setup
|
||||||
|
```
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
### Compiles and hot-reloads for development
|
||||||
|
```
|
||||||
|
npm run serve
|
||||||
|
```
|
||||||
|
|
||||||
|
### Compiles and minifies for production
|
||||||
|
```
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
|
### Customize configuration
|
||||||
|
See [Configuration Reference](https://cli.vuejs.org/config/).
|
||||||
10212
Yi.Vue2.x/package-lock.json
generated
Normal file
30
Yi.Vue2.x/package.json
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"name": "vuetify-test",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"serve": "vue-cli-service serve",
|
||||||
|
"build": "vue-cli-service build"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@mdi/font": "^6.6.96",
|
||||||
|
"axios": "^0.22.0",
|
||||||
|
"json-bigint": "^1.0.0",
|
||||||
|
"typeface-roboto": "^1.1.13",
|
||||||
|
"vue": "^2.6.11",
|
||||||
|
"vue-chartist": "^2.3.1",
|
||||||
|
"vue-router": "^3.2.0",
|
||||||
|
"vuetify": "^2.4.0",
|
||||||
|
"vuetify-dialog": "^2.0.17",
|
||||||
|
"vuex": "^3.6.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@vue/cli-plugin-router": "~4.5.0",
|
||||||
|
"@vue/cli-service": "~4.5.0",
|
||||||
|
"sass": "~1.32.0",
|
||||||
|
"sass-loader": "^10.0.0",
|
||||||
|
"vue-cli-plugin-vuetify": "~2.4.2",
|
||||||
|
"vue-template-compiler": "^2.6.11",
|
||||||
|
"vuetify-loader": "^1.7.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
Yi.Vue2.x/public/favicon.ico
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
20
Yi.Vue2.x/public/index.html
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||||
|
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||||
|
<title>Yi-Vue</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<noscript>
|
||||||
|
<strong>We're sorry but Yi-Vue doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||||
|
</noscript>
|
||||||
|
<div id="app"></div>
|
||||||
|
<!-- built files will be auto injected -->
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
23
Yi.Vue2.x/src/App.vue
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<template>
|
||||||
|
<v-fade-transition mode="out-in">
|
||||||
|
<router-view />
|
||||||
|
</v-fade-transition>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Styles
|
||||||
|
import '@/styles/overrides.sass'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'App',
|
||||||
|
metaInfo: {
|
||||||
|
title: 'App',
|
||||||
|
titleTemplate: '%s | Material Dashboard Free',
|
||||||
|
htmlAttrs: { lang: 'en' },
|
||||||
|
meta: [
|
||||||
|
{ charset: 'utf-8' },
|
||||||
|
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
46
Yi.Vue2.x/src/api/accountApi.js
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
import myaxios from '@/util/myaxios'
|
||||||
|
export default {
|
||||||
|
login(username, password) {
|
||||||
|
return myaxios({
|
||||||
|
url: '/Account/login',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
username,
|
||||||
|
password
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
logout() {
|
||||||
|
return myaxios({
|
||||||
|
url: '/Account/logout',
|
||||||
|
method: 'post',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
register(username, password, phone, code) {
|
||||||
|
return myaxios({
|
||||||
|
url: `/Account/register?code=${code}`,
|
||||||
|
method: 'post',
|
||||||
|
data: { username, password, phone }
|
||||||
|
})
|
||||||
|
},
|
||||||
|
email(emailAddress) {
|
||||||
|
return myaxios({
|
||||||
|
url: `/Account/email?emailAddress=${emailAddress}`,
|
||||||
|
method: 'post',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
SendSMS(smsAddress) {
|
||||||
|
return myaxios({
|
||||||
|
url: `/Account/SendSMS?SMSAddress=${smsAddress}`,
|
||||||
|
method: 'post',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
changePassword(user, newPassword) {
|
||||||
|
return myaxios({
|
||||||
|
url: `/Account/changePassword`,
|
||||||
|
method: 'put',
|
||||||
|
data: { user, newPassword }
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
11
Yi.Vue2.x/src/api/fileApi.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import myaxios from '@/util/myaxios'
|
||||||
|
export default {
|
||||||
|
EditIcon(file) {
|
||||||
|
return myaxios({
|
||||||
|
url: '/File/EditIcon',
|
||||||
|
method: 'post',
|
||||||
|
headers: { "Content-Type": "multipart/form-data" },
|
||||||
|
data: file
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
30
Yi.Vue2.x/src/api/menuApi.js
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import myaxios from '@/util/myaxios'
|
||||||
|
export default {
|
||||||
|
getMenuTree() {
|
||||||
|
return myaxios({
|
||||||
|
url: '/Menu/getMenuTree',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
Update(data) {
|
||||||
|
return myaxios({
|
||||||
|
url: '/Menu/Update',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
DeleteList(ids) {
|
||||||
|
return myaxios({
|
||||||
|
url: '/Menu/DeleteList',
|
||||||
|
method: 'delete',
|
||||||
|
data: ids
|
||||||
|
})
|
||||||
|
},
|
||||||
|
Add(data) {
|
||||||
|
return myaxios({
|
||||||
|
url: '/Menu/Add',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
10
Yi.Vue2.x/src/api/mouldApi.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import myaxios from '@/util/myaxios'
|
||||||
|
export default {
|
||||||
|
getMould() {
|
||||||
|
return myaxios({
|
||||||
|
url: '/Mould/GetMould',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
19
Yi.Vue2.x/src/api/panApi.js
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import myaxios from '@/util/myaxios'
|
||||||
|
export default {
|
||||||
|
GetPanFiles(dirName) {
|
||||||
|
return myaxios({
|
||||||
|
url: '/Pan/GetPanFiles',
|
||||||
|
method: 'post',
|
||||||
|
data: { dirName}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
Download(dirName,allName)
|
||||||
|
{
|
||||||
|
return myaxios({
|
||||||
|
url: '/Pan/Download',
|
||||||
|
method: 'post',
|
||||||
|
data: { dirName,allName}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
37
Yi.Vue2.x/src/api/roleApi.js
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
import myaxios from '@/util/myaxios'
|
||||||
|
export default {
|
||||||
|
getList() {
|
||||||
|
return myaxios({
|
||||||
|
url: '/Role/GetList',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
parameters: [
|
||||||
|
{
|
||||||
|
key: "isDeleted",
|
||||||
|
value: "0",
|
||||||
|
type: 0
|
||||||
|
|
||||||
|
}
|
||||||
|
],
|
||||||
|
orderBys: [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
giveRoleSetMenu(roleList, menuList) {
|
||||||
|
return myaxios({
|
||||||
|
url: '/Role/GiveRoleSetMenu',
|
||||||
|
method: 'put',
|
||||||
|
data: { RoleIds: roleList, menuIds: menuList }
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
getInMenuByRoleId(roleId) {
|
||||||
|
return myaxios({
|
||||||
|
url: `/Role/GetInMenuByRoleId?roleId=${roleId}`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
31
Yi.Vue2.x/src/api/userApi.js
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import myaxios from '@/util/myaxios'
|
||||||
|
export default {
|
||||||
|
SetRoleByUser(userIds, roleIds) {
|
||||||
|
return myaxios({
|
||||||
|
url: '/User/SetRoleByUser',
|
||||||
|
method: 'post',
|
||||||
|
data: { "ids1": userIds, "ids2": roleIds }
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
GetUserInRolesByHttpUser() {
|
||||||
|
return myaxios({
|
||||||
|
url: `/User/GetUserInRolesByHttpUser`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
GetMenuByHttpUser() {
|
||||||
|
return myaxios({
|
||||||
|
url: `/User/GetMenuByHttpUser`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
GetRoleListByUserId(userId) {
|
||||||
|
return myaxios({
|
||||||
|
url: `/User/GetRoleListByUserId?userId=${userId}`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
BIN
Yi.Vue2.x/src/assets/clint-mckoy.jpg
Normal file
|
After Width: | Height: | Size: 170 KiB |
BIN
Yi.Vue2.x/src/assets/lock.jpg
Normal file
|
After Width: | Height: | Size: 808 KiB |
BIN
Yi.Vue2.x/src/assets/login.jpg
Normal file
|
After Width: | Height: | Size: 362 KiB |
1
Yi.Vue2.x/src/assets/login.svg
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
Yi.Vue2.x/src/assets/logo.png
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
1
Yi.Vue2.x/src/assets/logo.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 87.5 100"><defs><style>.cls-1{fill:#1697f6;}.cls-2{fill:#7bc6ff;}.cls-3{fill:#1867c0;}.cls-4{fill:#aeddff;}</style></defs><title>Artboard 46</title><polyline class="cls-1" points="43.75 0 23.31 0 43.75 48.32"/><polygon class="cls-2" points="43.75 62.5 43.75 100 0 14.58 22.92 14.58 43.75 62.5"/><polyline class="cls-3" points="43.75 0 64.19 0 43.75 48.32"/><polygon class="cls-4" points="64.58 14.58 87.5 14.58 43.75 100 43.75 62.5 64.58 14.58"/></svg>
|
||||||
|
After Width: | Height: | Size: 539 B |
BIN
Yi.Vue2.x/src/assets/mask-dark.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
Yi.Vue2.x/src/assets/mask-light.png
Normal file
|
After Width: | Height: | Size: 777 B |
BIN
Yi.Vue2.x/src/assets/pricing.jpg
Normal file
|
After Width: | Height: | Size: 637 KiB |
BIN
Yi.Vue2.x/src/assets/register.jpg
Normal file
|
After Width: | Height: | Size: 465 KiB |
BIN
Yi.Vue2.x/src/assets/tree-3.png
Normal file
|
After Width: | Height: | Size: 8.2 KiB |
BIN
Yi.Vue2.x/src/assets/tree-4.png
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
Yi.Vue2.x/src/assets/tree.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
30
Yi.Vue2.x/src/assets/vmd.svg
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<svg width="256" height="256" viewBox="0 0 256 256" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M132.472 205L182.534 118.292L162.162 130.093V119.162L191.975 102.019L221.665 50.5903L132.472 102.019V205Z" fill="#AEDDFF"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M132.472 194.938L173.714 123.386L162.162 130.094V124.255V119.162V113.448L189.863 97.423L214.584 54.5659L132.472 102.019V194.938Z" fill="#AEDDFF"/>
|
||||||
|
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M183.155 101.274L189.987 97.2988L214.707 54.5659L175.329 77.2988C176.447 85.8702 179.18 93.9447 183.155 101.274Z" fill="#AEDDFF"/>
|
||||||
|
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M132.472 194.938L173.839 123.385L162.162 130.093V124.255V123.634C151.23 125.497 141.168 129.845 132.472 135.932V194.938Z" fill="#AEDDFF"/>
|
||||||
|
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M132.472 156.553V178.043C134.584 180.279 136.447 182.515 138.311 184.876L145.888 171.832C141.913 166.242 137.441 161.149 132.472 156.553Z" fill="#AEDDFF"/>
|
||||||
|
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M132.472 146.242C139.056 151.584 145.019 157.671 150.112 164.379L166.137 136.677C156.323 127.236 145.019 119.286 132.472 113.447V146.242Z" fill="#AEDDFF"/>
|
||||||
|
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M160.299 85.9946L141.665 96.8021C151.23 101.647 161.665 105.249 172.472 107.485L189.988 97.4232L195.205 88.3549C191.727 88.7275 188.249 88.8518 184.771 88.8518C176.323 88.8518 168.125 87.858 160.299 85.9946Z" fill="#AEDDFF"/>
|
||||||
|
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M170.609 80.0311C175.206 80.6522 179.926 81.0249 184.771 81.0249C189.988 81.0249 195.081 80.6522 200.05 79.7826L212.1 58.9131C208.87 60.0311 205.516 61.0249 202.038 61.7702L170.609 80.0311Z" fill="#AEDDFF"/>
|
||||||
|
<path opacity="0.3" fill-rule="evenodd" clip-rule="evenodd" d="M132.472 194.938L173.714 123.385L171.975 124.379L132.472 192.826" fill="#AEDDFF"/>
|
||||||
|
<path opacity="0.3" fill-rule="evenodd" clip-rule="evenodd" d="M189.117 96.5534L161.043 112.827L162.161 119.162V113.448L189.863 97.423L214.583 54.5659L212.72 55.6839L189.117 96.5534Z" fill="#AEDDFF"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M123.528 205V102.019L34.3359 50.5903L84.398 137.298V113.696L93.8389 119.162V153.572L123.528 205Z" fill="#7BC6FF"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M123.528 194.937V102.018L43.0308 55.5586L84.3972 127.235V113.695V107.981L93.8381 113.447V119.161V143.509L123.528 194.937Z" fill="#7BC6FF"/>
|
||||||
|
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M123.528 194.937V144.006C116.82 150.714 111.478 158.788 107.875 167.733L123.528 194.937Z" fill="#7BC6FF"/>
|
||||||
|
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M60.5463 85.9933C68.2481 84.5026 75.4531 81.894 82.0369 78.1673L43.0308 55.5586L60.5463 85.9933Z" fill="#7BC6FF"/>
|
||||||
|
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M69.7397 101.895L82.5348 124.006C83.1559 124.131 83.777 124.255 84.3981 124.379V113.82V107.982L93.8391 113.447V119.286V126.367C104.522 129.224 114.46 133.696 123.528 139.534V109.472C109.864 104.379 95.0813 101.522 79.5534 101.522C76.1994 101.522 72.9696 101.646 69.7397 101.895Z" fill="#7BC6FF"/>
|
||||||
|
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M93.8384 143.509L100.671 155.31C108.994 158.912 116.695 163.633 123.528 169.223V148.85C114.584 142.515 104.646 137.546 93.8384 134.44V143.509Z" fill="#7BC6FF"/>
|
||||||
|
<path opacity="0.3" fill-rule="evenodd" clip-rule="evenodd" d="M84.3973 114.939V113.696V107.982L93.8383 113.448V119.162V120.404L94.8321 112.827L83.2793 106.119L84.3973 114.939Z" fill="#7BC6FF"/>
|
||||||
|
<path opacity="0.3" fill-rule="evenodd" clip-rule="evenodd" d="M43.0308 55.5586L84.3972 127.235V125.124L44.8941 56.6766L43.0308 55.5586Z" fill="#7BC6FF"/>
|
||||||
|
<path opacity="0.3" fill-rule="evenodd" clip-rule="evenodd" d="M123.528 192.826L93.8384 141.398V143.51L123.528 194.938" fill="#7BC6FF"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M135.948 60.3699L128.124 64.8994L103.418 50.5903H54.2114L128.124 93.2086L202.037 50.5903H119.065L135.948 60.3699Z" fill="#1867C0"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M140.065 57.8993L135.947 60.3699L128.124 64.8994L103.418 50.5903H62.5493L128.124 88.4732L193.698 50.5903H127.3L140.065 57.8993Z" fill="#1867C0"/>
|
||||||
|
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M167.036 66.0317L193.698 50.5903H170.33C168.58 55.4286 167.448 60.6787 167.036 66.0317Z" fill="#1867C0"/>
|
||||||
|
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M62.5493 50.5903L100.432 72.4142C105.579 67.7817 110.006 62.3258 113.3 56.2522L103.418 50.5903H62.5493Z" fill="#1867C0"/>
|
||||||
|
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M102.903 50.5903H94.1533C101.977 65.517 113.301 78.2819 127.095 87.8555L128.124 88.4732L140.272 81.4731C125.036 74.8848 112.168 64.0758 102.903 50.5903Z" fill="#1867C0"/>
|
||||||
|
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M128.125 64.8994L118.86 59.5464C126.889 67.37 136.566 73.4436 147.375 77.3555L163.434 68.0906C153.654 67.1641 144.39 64.4876 135.948 60.3699L128.125 64.8994Z" fill="#1867C0"/>
|
||||||
|
<path opacity="0.3" fill-rule="evenodd" clip-rule="evenodd" d="M127.301 50.5903L140.066 57.8993L135.948 60.3699L135.021 60.8846L141.816 57.8993L129.051 50.5903H127.301Z" fill="#1867C0"/>
|
||||||
|
<path opacity="0.3" fill-rule="evenodd" clip-rule="evenodd" d="M128.124 87.4438L64.2993 50.5903H62.5493L128.124 88.4732L193.698 50.5903H191.948L128.124 87.4438Z" fill="#1867C0"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M167.037 66.0317L163.331 68.0906L147.375 77.3554L140.272 81.4731L128.125 88.4732V93.2086L202.038 50.5903H193.699L167.037 66.0317Z" fill="#1867C0"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 5.6 KiB |
1
Yi.Vue2.x/src/assets/vuetify.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 87.5 100"><defs><style>.cls-1{fill:#1697f6;}.cls-2{fill:#7bc6ff;}.cls-3{fill:#aeddff;}</style></defs><title>Artboard 47</title><polyline class="cls-1" points="43.75 0 23.31 0 43.75 48.32"/><polygon class="cls-2" points="43.75 62.5 43.75 100 0 14.58 22.92 14.58 43.75 62.5"/><polyline class="cls-2" points="43.75 0 64.19 0 43.75 48.32"/><polygon class="cls-3" points="64.58 14.58 87.5 14.58 43.75 100 43.75 62.5 64.58 14.58"/></svg>
|
||||||
|
After Width: | Height: | Size: 518 B |
64
Yi.Vue2.x/src/components/Links.vue
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<template>
|
||||||
|
<v-container>
|
||||||
|
<v-row align="center">
|
||||||
|
<v-col
|
||||||
|
v-for="(link, i) in links"
|
||||||
|
:key="i"
|
||||||
|
class="text-center"
|
||||||
|
cols="6"
|
||||||
|
md="auto"
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
:href="link.href"
|
||||||
|
class="text-decoration-none text-uppercase text-caption font-weight-regular"
|
||||||
|
rel="noopener"
|
||||||
|
target="_blank"
|
||||||
|
v-text="link.text"
|
||||||
|
/>
|
||||||
|
</v-col>
|
||||||
|
|
||||||
|
<v-spacer class="hidden-sm-and-down" />
|
||||||
|
|
||||||
|
<v-col
|
||||||
|
cols="12"
|
||||||
|
md="auto"
|
||||||
|
>
|
||||||
|
<div class="text-body-1 font-weight-light pt-6 pt-md-0 text-center">
|
||||||
|
© {{ (new Date()).getFullYear() }}, Made by <v-icon>mdi-vuetify</v-icon>
|
||||||
|
<a
|
||||||
|
href="https://ccnetcore"
|
||||||
|
class="text-decoration-none"
|
||||||
|
>ccnetcore</a>
|
||||||
|
</div>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</v-container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'Links',
|
||||||
|
|
||||||
|
data: () => ({
|
||||||
|
links: [
|
||||||
|
{
|
||||||
|
href: '#',
|
||||||
|
text: 'YiFramework文档',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: '#',
|
||||||
|
text: 'GitHub',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: '#',
|
||||||
|
text: '论坛',
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="sass" scoped>
|
||||||
|
a
|
||||||
|
color: inherit !important
|
||||||
|
</style>
|
||||||
59
Yi.Vue2.x/src/components/MaterialAlert.vue
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
<template>
|
||||||
|
<v-alert
|
||||||
|
class="v-alert--material"
|
||||||
|
dark
|
||||||
|
v-bind="$attrs"
|
||||||
|
v-on="$listeners"
|
||||||
|
>
|
||||||
|
<template
|
||||||
|
v-if="$attrs.icon"
|
||||||
|
v-slot:prepend
|
||||||
|
>
|
||||||
|
<v-avatar
|
||||||
|
class="align-self-start mt-n9 elevation-6 mr-4"
|
||||||
|
size="38"
|
||||||
|
>
|
||||||
|
<v-icon
|
||||||
|
:color="$attrs.color"
|
||||||
|
class="elevation-6 white"
|
||||||
|
light
|
||||||
|
>
|
||||||
|
{{ $attrs.icon }}
|
||||||
|
</v-icon>
|
||||||
|
</v-avatar>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<slot />
|
||||||
|
|
||||||
|
<template
|
||||||
|
v-if="$attrs.dismissible"
|
||||||
|
v-slot:close="{ toggle }"
|
||||||
|
>
|
||||||
|
<v-btn
|
||||||
|
:aria-label="$vuetify.lang.t('$vuetify.close')"
|
||||||
|
class="ml-4"
|
||||||
|
color
|
||||||
|
icon
|
||||||
|
small
|
||||||
|
@click="toggle"
|
||||||
|
>
|
||||||
|
<v-icon>
|
||||||
|
$vuetify.icons.cancel
|
||||||
|
</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
</template>
|
||||||
|
</v-alert>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default { name: 'MaterialAlert' }
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="sass">
|
||||||
|
.v-alert--material
|
||||||
|
margin-top: 32px
|
||||||
|
|
||||||
|
.v-alert__dismissible
|
||||||
|
align-self: flex-start
|
||||||
|
margin: 0 0 0 16px !important
|
||||||
|
</style>
|
||||||
113
Yi.Vue2.x/src/components/MaterialCard.vue
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
<template>
|
||||||
|
<app-card
|
||||||
|
v-bind="$attrs"
|
||||||
|
class="v-card--material mt-4"
|
||||||
|
>
|
||||||
|
<v-card-title class="align-start">
|
||||||
|
<v-sheet
|
||||||
|
:color="color"
|
||||||
|
:width="fullHeader ? '100%' : undefined"
|
||||||
|
class="overflow-hidden mt-n9 transition-swing v-card--material__sheet"
|
||||||
|
elevation="6"
|
||||||
|
max-width="100%"
|
||||||
|
rounded
|
||||||
|
>
|
||||||
|
<v-theme-provider
|
||||||
|
v-if="hasHeading"
|
||||||
|
dark
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
v-if="icon"
|
||||||
|
:class="iconSmall ? 'pa-7' : 'pa-8'"
|
||||||
|
>
|
||||||
|
<v-icon
|
||||||
|
:large="!iconSmall"
|
||||||
|
v-text="icon"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<slot name="heading" />
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-if="heading"
|
||||||
|
class="text-h4 white--text pa-7 v-card--material__title"
|
||||||
|
>
|
||||||
|
{{ heading }}
|
||||||
|
</div>
|
||||||
|
</v-theme-provider>
|
||||||
|
</v-sheet>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-if="hasTitle"
|
||||||
|
:class="fullHeader ? 'pt-4' : 'pl-3'"
|
||||||
|
class="text-h4 v-card--material__title"
|
||||||
|
>
|
||||||
|
<slot name="title" />
|
||||||
|
|
||||||
|
<template v-if="title">
|
||||||
|
{{ title }}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<div class="text-subtitle-1 mb-n4">
|
||||||
|
<slot name="subtitle" />
|
||||||
|
|
||||||
|
<template v-if="subtitle">
|
||||||
|
{{ subtitle }}
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</v-card-title>
|
||||||
|
|
||||||
|
<slot />
|
||||||
|
|
||||||
|
<template v-if="$slots.actions">
|
||||||
|
<v-divider class="mt-2 mx-4" />
|
||||||
|
|
||||||
|
<v-card-actions class="px-4 text-caption grey--text">
|
||||||
|
<slot name="actions" />
|
||||||
|
</v-card-actions>
|
||||||
|
</template>
|
||||||
|
</app-card>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'MaterialCard',
|
||||||
|
|
||||||
|
props: {
|
||||||
|
color: String,
|
||||||
|
fullHeader: Boolean,
|
||||||
|
heading: String,
|
||||||
|
icon: String,
|
||||||
|
iconSmall: Boolean,
|
||||||
|
subtitle: String,
|
||||||
|
title: String,
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
hasHeading () {
|
||||||
|
return !!(
|
||||||
|
this.icon ||
|
||||||
|
this.heading ||
|
||||||
|
this.$slots.heading
|
||||||
|
)
|
||||||
|
},
|
||||||
|
hasTitle () {
|
||||||
|
return !!(
|
||||||
|
this.title ||
|
||||||
|
this.subtitle ||
|
||||||
|
this.$slots.title ||
|
||||||
|
this.$slots.subtitle
|
||||||
|
)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="sass">
|
||||||
|
.v-card.v-card--material
|
||||||
|
> .v-card__title
|
||||||
|
> .v-card--material__title
|
||||||
|
flex: 1 1 auto
|
||||||
|
word-break: break-word
|
||||||
|
</style>
|
||||||
93
Yi.Vue2.x/src/components/MaterialChartCard.vue
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
<template>
|
||||||
|
<material-card
|
||||||
|
v-bind="$attrs"
|
||||||
|
class="v-card--material-chart"
|
||||||
|
full-header
|
||||||
|
>
|
||||||
|
<template #heading>
|
||||||
|
<div class="pa-4">
|
||||||
|
<chartist
|
||||||
|
:data="data"
|
||||||
|
:event-handlers="eventHandlers"
|
||||||
|
:options="options"
|
||||||
|
:ratio="ratio"
|
||||||
|
:responsive-options="responsiveOptions"
|
||||||
|
:type="type"
|
||||||
|
style="max-height: 150px;"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #subtitle>
|
||||||
|
<slot name="subtitle" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<slot />
|
||||||
|
|
||||||
|
<template #actions>
|
||||||
|
<slot name="actions" />
|
||||||
|
</template>
|
||||||
|
</material-card>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'MaterialChartCard',
|
||||||
|
|
||||||
|
inheritAttrs: false,
|
||||||
|
|
||||||
|
props: {
|
||||||
|
data: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({}),
|
||||||
|
},
|
||||||
|
eventHandlers: {
|
||||||
|
type: Array,
|
||||||
|
default: () => ([]),
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({}),
|
||||||
|
},
|
||||||
|
ratio: String,
|
||||||
|
responsiveOptions: {
|
||||||
|
type: Array,
|
||||||
|
default: () => ([]),
|
||||||
|
},
|
||||||
|
type: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
validator: v => ['Bar', 'Line', 'Pie'].includes(v),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="sass">
|
||||||
|
.v-card--material-chart
|
||||||
|
p
|
||||||
|
color: #999
|
||||||
|
|
||||||
|
.v-card--material__sheet
|
||||||
|
max-height: 185px
|
||||||
|
width: 100%
|
||||||
|
|
||||||
|
.ct-label
|
||||||
|
color: rgba(255, 255, 255, 1)
|
||||||
|
opacity: .7
|
||||||
|
font-size: 0.875rem
|
||||||
|
font-weight: 300
|
||||||
|
|
||||||
|
.ct-grid
|
||||||
|
stroke: hsla(0,0%,100%,.2)
|
||||||
|
|
||||||
|
.ct-series-a .ct-point,
|
||||||
|
.ct-series-a .ct-line,
|
||||||
|
.ct-series-a .ct-bar,
|
||||||
|
.ct-series-a .ct-slice-donut
|
||||||
|
stroke: rgba(255,255,255,.8)
|
||||||
|
|
||||||
|
.ct-series-a .ct-slice-pie,
|
||||||
|
.ct-series-a .ct-area
|
||||||
|
fill: rgba(255,255,255,.4)
|
||||||
|
</style>
|
||||||
78
Yi.Vue2.x/src/components/MaterialSnackbar.vue
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
<template>
|
||||||
|
<v-snackbar
|
||||||
|
v-model="internalValue"
|
||||||
|
class="v-snackbar--material"
|
||||||
|
v-bind="{
|
||||||
|
...$attrs,
|
||||||
|
'color': 'transparent'
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<material-alert
|
||||||
|
v-model="internalValue"
|
||||||
|
:color="$attrs.color"
|
||||||
|
:dismissible="dismissible"
|
||||||
|
:type="type"
|
||||||
|
class="ma-0"
|
||||||
|
dark
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
|
</material-alert>
|
||||||
|
</v-snackbar>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'MaterialSnackbar',
|
||||||
|
|
||||||
|
props: {
|
||||||
|
dismissible: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
type: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
value: Boolean,
|
||||||
|
},
|
||||||
|
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
internalValue: this.value,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
internalValue (val, oldVal) {
|
||||||
|
if (val === oldVal) return
|
||||||
|
|
||||||
|
this.$emit('input', val)
|
||||||
|
},
|
||||||
|
value (val, oldVal) {
|
||||||
|
if (val === oldVal) return
|
||||||
|
|
||||||
|
this.internalValue = val
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="sass">
|
||||||
|
.v-snackbar--material
|
||||||
|
margin-top: 32px
|
||||||
|
margin-bottom: 32px
|
||||||
|
|
||||||
|
.v-alert
|
||||||
|
padding: 32px 16px
|
||||||
|
|
||||||
|
.v-alert--material,
|
||||||
|
.v-snack__wrapper
|
||||||
|
border-radius: 4px
|
||||||
|
|
||||||
|
.v-snack__content
|
||||||
|
overflow: visible
|
||||||
|
padding: 0
|
||||||
|
|
||||||
|
.v-snack__action
|
||||||
|
display: none
|
||||||
|
</style>
|
||||||
39
Yi.Vue2.x/src/components/MaterialStatsCard.vue
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<template>
|
||||||
|
<material-card
|
||||||
|
class="v-card--material-stats"
|
||||||
|
v-bind="$attrs"
|
||||||
|
v-on="$listeners"
|
||||||
|
>
|
||||||
|
<template #subtitle>
|
||||||
|
<div
|
||||||
|
class="text-right text-h3 v-card__subtitle--material-stats"
|
||||||
|
v-text="value"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #actions>
|
||||||
|
<slot name="actions" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<slot />
|
||||||
|
</material-card>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'MaterialStatCard',
|
||||||
|
|
||||||
|
props: { value: String },
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="sass">
|
||||||
|
.v-card--material-stats.v-card--material .v-card--material__title
|
||||||
|
color: #999999
|
||||||
|
font-size: .875rem !important
|
||||||
|
margin-left: auto
|
||||||
|
text-align: right
|
||||||
|
|
||||||
|
.v-card__subtitle--material-stats
|
||||||
|
color: #3C4858
|
||||||
|
</style>
|
||||||
43
Yi.Vue2.x/src/components/TableApi.js
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
import myaxios from '@/util/myaxios'
|
||||||
|
export default {
|
||||||
|
getItem(url) {
|
||||||
|
return myaxios({
|
||||||
|
url: url,
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
parameters: [
|
||||||
|
{
|
||||||
|
key: "isDeleted",
|
||||||
|
value: "0",
|
||||||
|
type: 0
|
||||||
|
|
||||||
|
}
|
||||||
|
],
|
||||||
|
orderBys: [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
addItem(url, data) {
|
||||||
|
return myaxios({
|
||||||
|
url: url,
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
updateItem(url, data) {
|
||||||
|
return myaxios({
|
||||||
|
url: url,
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
delItemList(url, Ids) {
|
||||||
|
return myaxios({
|
||||||
|
url: url,
|
||||||
|
method: 'delete',
|
||||||
|
data: Ids
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
37
Yi.Vue2.x/src/components/ViewIntro.vue
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<template>
|
||||||
|
<section class="mb-12 text-center">
|
||||||
|
<h1
|
||||||
|
class="mb-2 text-h3"
|
||||||
|
v-text="heading"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-if="link"
|
||||||
|
class="text-body-2 font-weight-light"
|
||||||
|
>
|
||||||
|
Please checkout the <a
|
||||||
|
:href="`https://vuetifyjs.com/en/${link}`"
|
||||||
|
class="text-decoration-none secondary--text"
|
||||||
|
target="_blank"
|
||||||
|
>full documentation</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<v-responsive
|
||||||
|
class="text-center mx-auto text-body-1 font-weight-light"
|
||||||
|
max-width="400"
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
|
</v-responsive>
|
||||||
|
</section>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'ViewIntro',
|
||||||
|
|
||||||
|
props: {
|
||||||
|
heading: String,
|
||||||
|
link: String,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
29
Yi.Vue2.x/src/components/app/BarItem.vue
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<script>
|
||||||
|
import { VHover, VListItem } from 'vuetify/lib'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'AppBarItem',
|
||||||
|
|
||||||
|
render (h) {
|
||||||
|
return h(VHover, {
|
||||||
|
scopedSlots: {
|
||||||
|
default: ({ hover }) => {
|
||||||
|
return h(VListItem, {
|
||||||
|
attrs: this.$attrs,
|
||||||
|
class: {
|
||||||
|
'black--text': !hover,
|
||||||
|
'white--text secondary elevation-12': hover,
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
activeClass: '',
|
||||||
|
dark: hover,
|
||||||
|
link: true,
|
||||||
|
...this.$attrs,
|
||||||
|
},
|
||||||
|
}, this.$slots.default)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
22
Yi.Vue2.x/src/components/app/Btn.vue
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<template>
|
||||||
|
<v-btn
|
||||||
|
:color="color"
|
||||||
|
v-bind="$attrs"
|
||||||
|
v-on="$listeners"
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
|
</v-btn>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'AppBtn',
|
||||||
|
|
||||||
|
props: {
|
||||||
|
color: {
|
||||||
|
type: String,
|
||||||
|
default: 'primary',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
12
Yi.Vue2.x/src/components/app/Card.vue
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<template>
|
||||||
|
<v-card
|
||||||
|
v-bind="$attrs"
|
||||||
|
v-on="$listeners"
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
|
</v-card>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default { name: 'AppCard' }
|
||||||
|
</script>
|
||||||
42
Yi.Vue2.x/src/components/app/Tabs.vue
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<template>
|
||||||
|
<v-tabs
|
||||||
|
:active-class="`${color} ${theme.isDark ? 'black' : 'white'}--text`"
|
||||||
|
class="v-tabs--pill"
|
||||||
|
hide-slider
|
||||||
|
v-bind="$attrs"
|
||||||
|
v-on="$listeners"
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
|
|
||||||
|
<slot name="items" />
|
||||||
|
</v-tabs>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'AppTabs',
|
||||||
|
|
||||||
|
inject: ['theme'],
|
||||||
|
|
||||||
|
props: {
|
||||||
|
color: {
|
||||||
|
type: String,
|
||||||
|
default: 'primary',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="sass">
|
||||||
|
.v-tabs--pill
|
||||||
|
.v-tab,
|
||||||
|
.v-tab:before
|
||||||
|
border-radius: 24px
|
||||||
|
|
||||||
|
&.v-tabs--icons-and-text
|
||||||
|
&:not(.v-tabs--vertical) > .v-tabs-bar
|
||||||
|
height: 100px
|
||||||
|
.v-tab,
|
||||||
|
.v-tab:before
|
||||||
|
border-radius: 4px
|
||||||
|
</style>
|
||||||