├── vben-modules
├── Vben.Bpm
│ ├── GlobalUsings.cs
│ └── Vben.Bpm.csproj
└── Vben.Base
│ ├── Tool
│ ├── Code
│ │ ├── Root
│ │ │ ├── CodeGenConfig.cs
│ │ │ ├── CodeGenerateTemplate.cs
│ │ │ ├── CodeGenerateOption.cs
│ │ │ ├── ReplaceDto.cs
│ │ │ └── GenerateDto.cs
│ │ └── Table
│ │ │ └── ToolCodeField.cs
│ ├── Form
│ │ ├── ToolFormService.cs
│ │ ├── ToolForm.cs
│ │ └── ToolFormApi.cs
│ ├── Dict
│ │ ├── Cate
│ │ │ ├── ToolDictCateService.cs
│ │ │ ├── ToolDictCate.cs
│ │ │ └── ToolDictCateApi.cs
│ │ ├── Data
│ │ │ ├── ToolDictDataService.cs
│ │ │ ├── ToolDictDataVo.cs
│ │ │ ├── ToolDictData.cs
│ │ │ └── ToolDictDataApi.cs
│ │ └── Main
│ │ │ ├── ToolDictMain.cs
│ │ │ ├── ToolDictMainService.cs
│ │ │ └── ToolDictMainApi.cs
│ ├── Oss
│ │ ├── Root
│ │ │ └── Zfile.cs
│ │ ├── File
│ │ │ └── ToolOssFile.cs
│ │ └── Main
│ │ │ └── ToolOssMain.cs
│ └── Num
│ │ ├── ToolNum.cs
│ │ ├── ToolNumApi.cs
│ │ └── NumUtil.cs
│ ├── Sys
│ ├── Perm
│ │ ├── Api
│ │ │ ├── ApiDto.cs
│ │ │ ├── SysPermApiCache.cs
│ │ │ ├── SysPermApi.cs
│ │ │ └── SysPermApiApi.cs
│ │ └── Role
│ │ │ ├── vo
│ │ │ ├── ApiVo.cs
│ │ │ ├── MenuVo.cs
│ │ │ └── SysPermRoleVo.cs
│ │ │ ├── SysPermRoleToApi.cs
│ │ │ ├── SysPermRoleToMenu.cs
│ │ │ ├── SysPermRoleToOrg.cs
│ │ │ └── bo
│ │ │ └── SysPermRoleBo.cs
│ ├── Org
│ │ ├── User
│ │ │ ├── bo
│ │ │ │ ├── IdPacodBo.cs
│ │ │ │ └── IdAvtagBo.cs
│ │ │ └── SysOrgUserCache.cs
│ │ ├── Group
│ │ │ ├── SysOrgGroupCate.cs
│ │ │ ├── SysOrgGroupOrg.cs
│ │ │ ├── SysOrgGroup.cs
│ │ │ ├── SysOrgGroupService.cs
│ │ │ └── SysOrgGroupApi.cs
│ │ ├── Post
│ │ │ ├── SysOrgPostOrg.cs
│ │ │ ├── SysOrgPost.cs
│ │ │ ├── SysOrgPostService.cs
│ │ │ └── SysOrgPostApi.cs
│ │ ├── Rece
│ │ │ ├── SysOrgRece.cs
│ │ │ └── SysOrgReceService.cs
│ │ └── Dept
│ │ │ ├── SysOrgDeptVo.cs
│ │ │ └── SysOrgDept.cs
│ ├── Security
│ │ └── Pojo
│ │ │ ├── Zportal.cs
│ │ │ ├── Yapi.cs
│ │ │ ├── LoginVo.cs
│ │ │ ├── Yurl.cs
│ │ │ ├── Zmeta.cs
│ │ │ ├── Zmenu.cs
│ │ │ ├── UserDo.cs
│ │ │ └── Zuser.cs
│ ├── Profile
│ │ ├── SysProfileApi.cs
│ │ └── ProfileUserVo.cs
│ ├── Notice
│ │ ├── SysNotice.cs
│ │ └── SysNoticeApi.cs
│ └── Config
│ │ ├── SysConfig.cs
│ │ └── SysConfigApi.cs
│ ├── Mon
│ ├── Cache
│ │ ├── CacheCommandVo.cs
│ │ ├── CacheInfoVo.cs
│ │ └── MonCacheApi.cs
│ ├── Login
│ │ └── Log
│ │ │ ├── MonLoginLogService.cs
│ │ │ └── MonLoginLogApi.cs
│ ├── Online
│ │ ├── Hub
│ │ │ ├── OnlineUserHubInput.cs
│ │ │ ├── OnlineUserHubOutput.cs
│ │ │ └── IOnlineUserHub.cs
│ │ └── User
│ │ │ ├── OnlineUserInput.cs
│ │ │ └── MonOnlineUser.cs
│ ├── Job
│ │ ├── Log
│ │ │ ├── MonJobLogService.cs
│ │ │ ├── MonJobLog.cs
│ │ │ └── MonJobLogApi.cs
│ │ └── Main
│ │ │ ├── MyJob.cs
│ │ │ ├── MyJob2.cs
│ │ │ ├── MonJobMain.cs
│ │ │ └── MonJobMonitor.cs
│ ├── Oper
│ │ └── Log
│ │ │ └── MonOperLogApi.cs
│ ├── Log
│ │ ├── Error
│ │ │ └── MonLogErrorApi.cs
│ │ ├── Root
│ │ │ ├── LogExceptionHandler.cs
│ │ │ └── LogEventSubscriber.cs
│ │ └── Audit
│ │ │ └── MonLogAudit.cs
│ └── Server
│ │ ├── ShellHelper.cs
│ │ └── MonServerApi.cs
│ ├── Auth
│ ├── Captcha
│ │ ├── CaptchaVo.cs
│ │ └── AuthCapchaApi.cs
│ ├── Login
│ │ ├── PasswordLoginBo.cs
│ │ ├── LoginBo.cs
│ │ └── LoginVo.cs
│ └── User
│ │ ├── UserInfoVo.cs
│ │ ├── MetaVo.cs
│ │ ├── RouterVo.cs
│ │ └── SysUserVo.cs
│ ├── Pub
│ ├── Org
│ │ ├── Dept
│ │ │ └── PubOrgDeptApi.cs
│ │ └── Group
│ │ │ └── PubOrgGroupApi.cs
│ └── Oss
│ │ └── PubOssApi.cs
│ ├── Carry
│ ├── Message
│ │ └── Dto
│ │ │ ├── ThemeAttribute.cs
│ │ │ ├── SmsInput.cs
│ │ │ ├── MessageTypeEnum.cs
│ │ │ └── MessageInput.cs
│ └── Root
│ │ ├── BasePageInput.cs
│ │ └── DataMaskAttribute.cs
│ ├── Vben.Base.csproj
│ └── GlobalUsings.cs
├── .gitignore
├── vben-common
├── Vben.Common.Furion
│ ├── GlobalUsings.cs
│ ├── Vben.Common.Furion.csproj
│ └── MyApp2.cs
├── Vben.Common.Sqlsugar
│ ├── Config
│ │ ├── Db.cs
│ │ ├── DbConfig.cs
│ │ ├── SqlSugarConst.cs
│ │ ├── SqlSugarRepository.cs
│ │ ├── ConnectionStringsOptions.cs
│ │ └── DbExtension.cs
│ ├── Mvc
│ │ ├── Pojo
│ │ │ ├── Zres.cs
│ │ │ ├── Lmove.cs
│ │ │ ├── TreeMovePo.cs
│ │ │ ├── SidOrnum.cs
│ │ │ ├── SidNamePid.cs
│ │ │ ├── SidName.cs
│ │ │ ├── LpidTier.cs
│ │ │ ├── Ltree.cs
│ │ │ ├── Stree.cs
│ │ │ └── XreqUtil.cs
│ │ ├── Entity
│ │ │ ├── BaseEntity.cs
│ │ │ ├── SysOrg.cs
│ │ │ └── BaseMainEntity.cs
│ │ ├── Api
│ │ │ └── RestPageResult.cs
│ │ └── Service
│ │ │ ├── BaseService.cs
│ │ │ └── BaseStrCateService.cs
│ ├── GlobalUsings.cs
│ └── Vben.Common.Sqlsugar.csproj
└── Vben.Common.Core
│ ├── Filter
│ ├── DisableOpLogAttribute.cs
│ ├── OplogAttribute.cs
│ ├── AppServiceAttribute.cs
│ └── MyUnitOfWorkAttribute.cs
│ ├── Enum
│ ├── YesOrNot.cs
│ ├── AdminType.cs
│ ├── RequestTypeEnum.cs
│ ├── LoginType.cs
│ └── DataOpType.cs
│ ├── Config
│ ├── OssOptions.cs
│ └── UploadOptions.cs
│ ├── GlobalUsings.cs
│ ├── Npoi
│ └── NpoiMemoryStream.cs
│ ├── Cache
│ ├── CacheTypeEnum.cs
│ └── CacheSetup.cs
│ ├── Manager
│ └── IUserManager.cs
│ ├── Utils
│ ├── XuserUtil.cs
│ ├── XfileUtil.cs
│ └── StrUtils.cs
│ ├── Attribute
│ └── ServiceAttribute.cs
│ ├── Token
│ ├── GlobalExceptionHandler.cs
│ └── TokenModel.cs
│ ├── Const
│ ├── ClaimConst.cs
│ └── CommonConst.cs
│ ├── Vben.Common.Core.csproj
│ └── Wrapper
│ ├── ModelValidationFilter.cs
│ ├── Extension.Validate.cs
│ └── ServiceCollectionExtensions.cs
├── vben-apps
├── Vben.Admin
│ ├── Properties
│ │ ├── Vben.Admin.xml
│ │ ├── Vms
│ │ │ ├── C#
│ │ │ │ ├── service.vm
│ │ │ │ ├── entity.vm
│ │ │ │ └── controller.vm
│ │ │ └── Route
│ │ │ │ ├── route.sql.vm
│ │ │ │ └── route.json.vm
│ │ ├── launchSettings.json
│ │ └── Configs
│ │ │ ├── Cache.json
│ │ │ ├── web.Production.json
│ │ │ └── web.Development.json
│ ├── Vben.Admin.csproj.user
│ ├── Launch
│ │ ├── GlobalUsings.cs
│ │ ├── Program.cs
│ │ └── Init
│ │ │ └── DataInit.cs
│ └── Vben.Admin.csproj
└── Vben.Demo
│ ├── Demo
│ ├── Link
│ │ ├── Cate
│ │ │ ├── DemoLinkCate.cs
│ │ │ ├── DemoLinkCateService.cs
│ │ │ └── DemoLinkCateController.cs
│ │ ├── Mid
│ │ │ └── DemoLinkMainToOrg.cs
│ │ ├── Main
│ │ │ ├── DemoLinkMainService.cs
│ │ │ ├── DemoLinkMain.cs
│ │ │ └── DemoLinkMainController.cs
│ │ └── Item
│ │ │ └── DemoLinkItem.cs
│ └── Single
│ │ ├── Main
│ │ ├── DemoSingleMain.cs
│ │ └── DemoSingleMainService.cs
│ │ └── Cate
│ │ ├── DemoSingleCate.cs
│ │ └── DemoSingleCateService.cs
│ ├── Properties
│ ├── Vms
│ │ ├── C#
│ │ │ ├── service.vm
│ │ │ ├── entity.vm
│ │ │ └── controller.vm
│ │ └── Route
│ │ │ ├── route.sql.vm
│ │ │ └── route.json.vm
│ ├── launchSettings.json
│ └── Configs
│ │ ├── Cache.json
│ │ ├── web.Production.json
│ │ └── web.Development.json
│ ├── Launch
│ ├── GlobalUsings.cs
│ ├── Init
│ │ └── DataInit.cs
│ └── Program.cs
│ └── Vben.Demo.csproj
├── LICENSE
└── Directory.Build.props
/vben-modules/Vben.Bpm/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | .vs
3 | /**/bin/
4 | /**/obj/
5 | /**/logs/
6 | zsvg
7 | vben-net.sln.DotSettings.user
8 |
9 |
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Furion/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | global using Furion;
2 | global using Microsoft.AspNetCore.Http;
3 | global using Microsoft.Extensions.DependencyInjection;
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Sqlsugar/Config/Db.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Sqlsugar.Config;
2 |
3 | public static class Db
4 | {
5 | public static string True = "1";
6 |
7 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Tool/Code/Root/CodeGenConfig.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Tool.Code.Root;
2 |
3 | public class CodeGenConfig
4 | {
5 | public string Path { get; set; }= "../../zsvg/vms";
6 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Admin/Properties/Vben.Admin.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Vben.Admin
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Perm/Api/ApiDto.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Perm.Api;
2 |
3 |
4 | public class ApiDto
5 | {
6 | private string url { get; set; }
7 |
8 | private string perm { get; set; }
9 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Org/User/bo/IdPacodBo.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Org.User.bo;
2 |
3 | public class IdPacodBo
4 | {
5 | public string id { get; set; }
6 |
7 | public string pacod { get; set; }
8 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Mon/Cache/CacheCommandVo.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Mon.Cache;
2 |
3 | public class CacheCommandVo
4 | {
5 | public string name { get; set; }
6 |
7 | public string value { get; set; }
8 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Org/User/bo/IdAvtagBo.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Org.User.bo;
2 |
3 | public class IdAvtagBo
4 | {
5 | public string id { get; set; }
6 |
7 | public bool avtag { get; set; }
8 |
9 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Security/Pojo/Zportal.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Security.Pojo;
2 |
3 | //前台返回门户
4 | public class Zportal
5 | {
6 | public string id { get; set; }
7 |
8 | public string name { get; set; }
9 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Sqlsugar/Config/DbConfig.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Sqlsugar.Config;
2 |
3 | public class DbConfig
4 | {
5 | public bool ShowSql { get; set; }= true;
6 |
7 | public List ConnectionConfigs { get; set; }
8 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Sqlsugar/Mvc/Pojo/Zres.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Sqlsugar.Mvc.Pojo;
2 |
3 | public class Zres
4 | {
5 | public int code { get; set; }
6 |
7 | public string msg { get; set; }
8 |
9 | public object data { get; set; }
10 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Sqlsugar/Mvc/Pojo/Lmove.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Sqlsugar.Mvc.Pojo;
2 |
3 | public class Lmove
4 | {
5 | public long draid { get; set; }
6 |
7 | public long droid { get; set; }
8 |
9 | public string type { get; set; }
10 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Perm/Role/vo/ApiVo.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Perm.Role.vo;
2 |
3 | public class ApiVo
4 | {
5 | public long id { get; set; }
6 |
7 | public string name { get; set; }
8 |
9 | public long menid { get; set; }
10 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Auth/Captcha/CaptchaVo.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Auth.Captcha;
2 |
3 | public class CaptchaVo
4 | {
5 | public bool captchaEnabled { get; set; }
6 |
7 | public string uuid { get; set; }
8 |
9 | public string img { get; set; }
10 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Sqlsugar/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | global using Microsoft.AspNetCore.Mvc.Filters;
2 | global using Microsoft.Extensions.DependencyInjection;
3 | global using SqlSugar;
4 | global using System.ComponentModel;
5 | global using System.Text;
6 | global using Yitter.IdGenerator;
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Sqlsugar/Mvc/Pojo/TreeMovePo.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Sqlsugar.Mvc.Pojo;
2 |
3 | public class TreeMovePo
4 | {
5 | public string draid { get; set; }
6 |
7 | public string droid { get; set; }
8 |
9 | public string type { get; set; }
10 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Sqlsugar/Mvc/Pojo/SidOrnum.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Sqlsugar.Mvc.Pojo;
2 |
3 | public class SidOrnum
4 | {
5 | [SugarColumn(ColumnDescription = "Id主键", IsPrimaryKey = true)]
6 | public string id { get; set; }
7 |
8 | public int ornum { get; set; }
9 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Auth/Login/PasswordLoginBo.cs:
--------------------------------------------------------------------------------
1 | using Vben.Base.Auth.Login;
2 |
3 | namespace Vben.Base.Auth;
4 |
5 | public class PasswordLoginBo:LoginBo
6 | {
7 | public string username { get; set; }
8 |
9 | public string password { get; set; }
10 |
11 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Security/Pojo/Yapi.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Security.Pojo;
2 |
3 | //api pojo:存储URL,权限位与权限码
4 | public class Yapi
5 | {
6 | public int pos { get; set; }
7 |
8 | public long code { get; set; }
9 |
10 | public string url { get; set; }
11 |
12 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Tool/Form/ToolFormService.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Tool.Form;
2 |
3 | [Service]
4 | public class ToolFormService : BaseMainService
5 | {
6 | public ToolFormService(SqlSugarRepository repo)
7 | {
8 | Repo = repo;
9 | }
10 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Demo/Demo/Link/Cate/DemoLinkCate.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Admin.Demo.Link.Cate;
2 |
3 | ///
4 | /// 关联分类表
5 | ///
6 | [SugarTable("demo_link_cate", TableDescription = "关联分类表")]
7 | [Description("关联分类表")]
8 | public class DemoLinkCate : BaseCateEntity
9 | {
10 |
11 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Sqlsugar/Mvc/Pojo/SidNamePid.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Sqlsugar.Mvc.Pojo;
2 |
3 | //id,name,pid简单属性pojo
4 | public class SidNamePid
5 | {
6 | public string id { get; set; }
7 |
8 | public string name { get; set; }
9 |
10 | public string pid { get; set; }
11 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Demo/Demo/Single/Main/DemoSingleMain.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Admin.Demo.Single.Main;
2 |
3 | ///
4 | /// 单一主表
5 | ///
6 | [SugarTable("demo_single_main", TableDescription = "单一主表")]
7 | [Description("单一主表")]
8 | public class DemoSingleMain : BaseMainEntity
9 | {
10 |
11 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Core/Filter/DisableOpLogAttribute.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Core.Filter;
2 |
3 | ///
4 | /// 禁用操作日志
5 | ///
6 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property)]
7 | public class DisableOpLogAttribute : System.Attribute
8 | {
9 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Demo/Demo/Single/Cate/DemoSingleCate.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Admin.Demo.Single.Cate;
2 |
3 | ///
4 | /// 单一树表
5 | ///
6 | [SugarTable("demo_single_cate", TableDescription = "单一树表")]
7 | [Description("单一树表")]
8 | public class DemoSingleCate : BaseCateEntity
9 | {
10 |
11 |
12 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Sqlsugar/Mvc/Pojo/SidName.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Sqlsugar.Mvc.Pojo;
2 |
3 | //基础pojo,只有id与name属性
4 | public class SidName
5 | {
6 | [SugarColumn(ColumnDescription = "Id主键", IsPrimaryKey = true)]
7 | public string id { get; set; }
8 |
9 | public string name { get; set; }
10 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Tool/Dict/Cate/ToolDictCateService.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Tool.Dict.Cate;
2 |
3 | [Service]
4 | public class ToolDictCateService : BaseService
5 | {
6 | public ToolDictCateService(SqlSugarRepository repo)
7 | {
8 | base.repo = repo;
9 | }
10 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Security/Pojo/LoginVo.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Security.Pojo;
2 |
3 |
4 | //用户名与密码VO,登录时用到
5 | public class LoginVo
6 | {
7 | /// sa
8 | public string username { get; set; }
9 |
10 | /// 1
11 | public string password { get; set; }
12 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Tool/Dict/Data/ToolDictDataService.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Tool.Dict.Data;
2 |
3 | [Service]
4 | public class ToolDictDataService : BaseStrMainService
5 | {
6 | public ToolDictDataService(SqlSugarRepository repo)
7 | {
8 | base.repo = repo;
9 | }
10 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Admin/Properties/Vms/C#/service.vm:
--------------------------------------------------------------------------------
1 | namespace ${options.Namespace};
2 |
3 | [Service]
4 | public class ${genTable.bunam}Service : ${genTable.baser}<${genTable.bunam}>
5 | {
6 | public ${genTable.bunam}Service(SqlSugarRepository<${genTable.bunam}> repo)
7 | {
8 | Repo = repo;
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/vben-apps/Vben.Demo/Properties/Vms/C#/service.vm:
--------------------------------------------------------------------------------
1 | namespace ${options.Namespace};
2 |
3 | [Service]
4 | public class ${genTable.bunam}Service : ${genTable.baser}<${genTable.bunam}>
5 | {
6 | public ${genTable.bunam}Service(SqlSugarRepository<${genTable.bunam}> repo)
7 | {
8 | Repo = repo;
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Security/Pojo/Yurl.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Security.Pojo;
2 |
3 | //url扫描收集时是用到的pojo
4 | public class Yurl
5 | {
6 | public string id { get; set; }
7 |
8 | public string url { get; set; }
9 |
10 | public string pid { get; set; }
11 |
12 | public string type { get; set; }
13 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Sqlsugar/Mvc/Pojo/LpidTier.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Sqlsugar.Mvc.Pojo;
2 |
3 | public class LpidTier
4 | {
5 | [SugarColumn(ColumnDescription = "Id主键", IsPrimaryKey = true)]
6 | public long id { get; set; }
7 |
8 | public string tier { get; set; }
9 |
10 | public long pid { get; set; }
11 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Tool/Oss/Root/Zfile.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Tool.Oss.Root;
2 |
3 | public class Zfile
4 | {
5 | public string id { get; set; }
6 |
7 | public string name { get; set; }
8 |
9 | public string size { get; set; }
10 |
11 | public string path { get; set; }
12 |
13 | public string filid { get; set; }
14 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Mon/Login/Log/MonLoginLogService.cs:
--------------------------------------------------------------------------------
1 | using Vben.Base.Mon.Log.Login;
2 |
3 | namespace Vben.Base.Mon.Login.Log;
4 |
5 | [Service]
6 | public class MonLoginLogService : BaseService
7 | {
8 | public MonLoginLogService(SqlSugarRepository repo)
9 | {
10 | this.repo = repo;
11 | }
12 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Mon/Cache/CacheInfoVo.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Mon.Cache;
2 |
3 | public class CacheInfoVo
4 | {
5 |
6 | public IDictionary info { get; set; }
7 |
8 |
9 | public int dbSize { get; set; }
10 |
11 |
12 | public List commandStats { get; set; } = new ();
13 |
14 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Core/Enum/YesOrNot.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Core.Enum;
2 |
3 | ///
4 | /// 菜单激活类型
5 | ///
6 | public enum YesOrNot
7 | {
8 | ///
9 | /// 是
10 | ///
11 | [Description("是")] Y = 0,
12 |
13 | ///
14 | /// 否
15 | ///
16 | [Description("否")] N = 1
17 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Tool/Form/ToolForm.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Tool.Form;
2 |
3 | [SugarTable("tool_form", TableDescription = "在线表单")]
4 | [Description("在线表单")]
5 | public class ToolForm : BaseMainEntity
6 | {
7 |
8 | [SugarColumn(ColumnDescription = "表单规则", ColumnDataType = "varchar(max)", IsNullable = true)]
9 | public string frule { get; set; }
10 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Core/Config/OssOptions.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Core.Config;
2 |
3 | ///
4 | /// 文件存储配置
5 | ///
6 | public sealed class OssOptions
7 | {
8 | public string AccessKeyId { get; set; }
9 |
10 | public string AccessKeySecret { get; set; }
11 |
12 | public string Endpoint { get; set; }
13 |
14 | public string Bucket { get; set; }
15 |
16 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Org/Group/SysOrgGroupCate.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Org.Group;
2 |
3 |
4 | [SugarTable("sys_org_group_cate", TableDescription = "组织架构群组分类")]
5 | public class SysOrgGroupCate : BaseStrCateEntity
6 | {
7 | ///
8 | /// 子分类集合
9 | ///
10 | [SugarColumn(IsIgnore = true)]
11 | public List children { get; set; }
12 |
13 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Core/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | global using Microsoft.AspNetCore.Http;
2 | global using Microsoft.AspNetCore.Mvc;
3 | global using Microsoft.Extensions.Caching.Memory;
4 | global using Microsoft.Extensions.DependencyInjection;
5 | global using Microsoft.Extensions.Options;
6 | global using System.ComponentModel;
7 | global using System.Data;
8 | global using System.Reflection;
9 | global using System.Text;
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Core/Npoi/NpoiMemoryStream.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Core.Npoi;
2 |
3 | public class NpoiMemoryStream : MemoryStream
4 | {
5 | public NpoiMemoryStream()
6 | {
7 | AllowClose = true;
8 | }
9 |
10 | public bool AllowClose { get; set; }
11 |
12 | public override void Close()
13 | {
14 | if (AllowClose)
15 | base.Close();
16 | }
17 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Auth/Login/LoginBo.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Auth.Login;
2 |
3 |
4 | public class LoginBo
5 | {
6 |
7 | public string clientId { get; set; }
8 |
9 | public string grantType { get; set; }
10 |
11 | public string tenantId { get; set; }
12 |
13 | public string code { get; set; }
14 |
15 | public string uuid { get; set; }
16 |
17 |
18 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Auth/User/UserInfoVo.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Auth.User;
2 |
3 | public class UserInfoVo
4 | {
5 | /**
6 | * 用户基本信息
7 | */
8 | public SysUserVo user { get; set; }
9 |
10 | /**
11 | * 菜单权限
12 | */
13 | public HashSet permissions { get; set; }
14 |
15 | /**
16 | * 角色权限
17 | */
18 | public HashSet roles { get; set; }
19 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Sqlsugar/Vben.Common.Sqlsugar.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Org/Post/SysOrgPostOrg.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Org.Post;
2 |
3 | [SugarTable("sys_org_post_org", TableDescription = "岗位员工关系表")]
4 | public class SysOrgPostOrg
5 | {
6 | [SugarColumn(ColumnDescription = "岗位ID", IsNullable = true)]
7 | public string pid { get; set; }
8 |
9 | [SugarColumn(ColumnDescription = "用户ID", IsNullable = true)]
10 | public string oid { get; set; }
11 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Org/Group/SysOrgGroupOrg.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Org.Group;
2 |
3 | [SugarTable("sys_org_group_org", TableDescription = "组织架构群组成员关系表")]
4 | public class SysOrgGroupOrg
5 | {
6 | [SugarColumn(ColumnDescription = "群组ID", IsNullable = true)]
7 | public string gid { get; set; }
8 |
9 | [SugarColumn(ColumnDescription = "成员ID", IsNullable = true)]
10 | public string oid { get; set; }
11 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Perm/Role/SysPermRoleToApi.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Perm.Role;
2 |
3 | [SugarTable("sys_perm_role_api", TableDescription = "权限角色与接口关联表")]
4 | public class SysPermRoleToApi
5 | {
6 | [SugarColumn(ColumnDescription = "角色ID", IsNullable = true)]
7 | public long rid { get; set; }
8 |
9 | [SugarColumn(ColumnDescription = "接口ID", IsNullable = true)]
10 | public long aid { get; set; }
11 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Perm/Role/vo/MenuVo.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Perm.Role.vo;
2 |
3 | public class MenuVo
4 | {
5 | public long id { get; set; }
6 |
7 | public string name { get; set; }
8 |
9 | public string icon { get; set; }
10 |
11 | public string type { get; set; }
12 |
13 | public long pid { get; set; }
14 |
15 | public List apis { get; set; }= new ();
16 |
17 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Demo/Demo/Link/Cate/DemoLinkCateService.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Admin.Demo.Link.Cate;
2 |
3 | ///
4 | /// 单一主表服务
5 | ///
6 | [Service]
7 | public class DemoLinkCateService : BaseCateService
8 | {
9 | ///
10 | /// 单一主表服务
11 | ///
12 | public DemoLinkCateService(SqlSugarRepository repo)
13 | {
14 | Repo = repo;
15 | }
16 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Sqlsugar/Config/SqlSugarConst.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Sqlsugar.Config;
2 |
3 | ///
4 | /// SqlSugar相关常量
5 | ///
6 | public class SqlSugarConst
7 | {
8 | ///
9 | /// 默认数据库标识
10 | ///
11 | public const string ConfigId = "primary";
12 |
13 | ///
14 | /// 默认表主键
15 | ///
16 | public const string PrimaryKey = "id";
17 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Perm/Role/SysPermRoleToMenu.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Perm.Role;
2 |
3 | [SugarTable("sys_perm_role_menu", TableDescription = "权限角色与菜单关联表")]
4 | public class SysPermRoleToMenu
5 | {
6 | [SugarColumn(ColumnDescription = "角色ID", IsNullable = true)]
7 | public long rid { get; set; }
8 |
9 | [SugarColumn(ColumnDescription = "菜单ID", IsNullable = true)]
10 | public long mid { get; set; }
11 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Demo/Demo/Link/Mid/DemoLinkMainToOrg.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Admin.Demo.Link.Mid;
2 |
3 | [SugarTable("demo_link_main_org", TableDescription = "中间关联表")]
4 | public class DemoLinkMainToOrg
5 | {
6 | [SugarColumn(ColumnDescription = "主表ID", IsNullable = true)]
7 | public long mid { get; set; }
8 |
9 | [SugarColumn(ColumnDescription = "组织架构ID", IsNullable = true, Length = 36)]
10 | public string oid { get; set; }
11 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Demo/Demo/Single/Cate/DemoSingleCateService.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Admin.Demo.Single.Cate;
2 |
3 | ///
4 | /// 单一主表服务
5 | ///
6 | [Service]
7 | public class DemoSingleCateService : BaseCateService
8 | {
9 | ///
10 | /// 单一主表服务
11 | ///
12 | public DemoSingleCateService(SqlSugarRepository repo)
13 | {
14 | Repo = repo;
15 | }
16 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Demo/Demo/Single/Main/DemoSingleMainService.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Admin.Demo.Single.Main;
2 |
3 | ///
4 | /// 单一主表服务
5 | ///
6 | [Service]
7 | public class DemoSingleMainService : BaseMainService
8 | {
9 | ///
10 | /// 单一主表服务
11 | ///
12 | public DemoSingleMainService(SqlSugarRepository repo)
13 | {
14 | Repo = repo;
15 | }
16 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Core/Cache/CacheTypeEnum.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Core.Cache;
2 |
3 | ///
4 | /// 缓存类型枚举
5 | ///
6 | [Description("缓存类型枚举")]
7 | public enum CacheTypeEnum
8 | {
9 | ///
10 | /// 内存缓存
11 | ///
12 | [Description("内存缓存")]
13 | Memory,
14 |
15 | ///
16 | /// Redis缓存
17 | ///
18 | [Description("Redis缓存")]
19 | Redis
20 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Admin/Vben.Admin.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ProjectDebugger
5 |
6 |
7 | Vben.Admin
8 |
9 |
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Perm/Role/SysPermRoleToOrg.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Perm.Role;
2 |
3 | [SugarTable("sys_perm_role_org", TableDescription = "权限角色与组织架构关联表")]
4 | public class SysPermRoleToOrg
5 | {
6 | [SugarColumn(ColumnDescription = "角色ID", IsNullable = true)]
7 | public long rid { get; set; }
8 |
9 | [SugarColumn(ColumnDescription = "组织架构ID", IsNullable = true, Length = 36)]
10 | public string oid { get; set; }
11 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Auth/Captcha/AuthCapchaApi.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Auth.Captcha;
2 |
3 | [Route("")]
4 | [ApiDescriptionSettings("Auth", Tag = "验证码")]
5 | public class AuthCapchaApi : ControllerBase
6 | {
7 | [HttpGet("/auth/code")]
8 | [AllowAnonymous]
9 | public CaptchaVo GetCode()
10 | {
11 | CaptchaVo captchaVo = new CaptchaVo();
12 | captchaVo.captchaEnabled = false;
13 | return captchaVo;
14 | }
15 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Mon/Online/Hub/OnlineUserHubInput.cs:
--------------------------------------------------------------------------------
1 | // Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
2 | //
3 | // 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
4 | //
5 | // 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
6 |
7 | namespace Admin.NET.Core;
8 |
9 | public class OnlineUserHubInput
10 | {
11 | public string ConnectionId { get; set; }
12 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Sqlsugar/Mvc/Entity/BaseEntity.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Sqlsugar.Mvc.Entity;
2 |
3 | //简单Entity基类,仅提供id与name字段,如有租户需求,可加租户ID。
4 | public abstract class BaseEntity
5 | {
6 | [SugarColumn(ColumnDescription = "Id主键", IsPrimaryKey = true, Length = 36)]
7 | public virtual string id { get; set; }
8 |
9 | [SugarColumn(ColumnDescription = "名称", IsNullable = true, Length = 255)]
10 | public virtual string name { get; set; }
11 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Demo/Demo/Link/Main/DemoLinkMainService.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Admin.Demo.Link.Main;
2 |
3 | ///
4 | /// 关联主表服务
5 | ///
6 | [Service]
7 | public class DemoLinkMainService : BaseMainService
8 | {
9 | ///
10 | /// 单一主表服务
11 | ///
12 | public DemoLinkMainService(SqlSugarRepository repo)
13 | {
14 | Repo = repo;
15 | AutoNav = true;
16 | }
17 |
18 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Tool/Dict/Data/ToolDictDataVo.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Tool.Dict.Data;
2 |
3 | public class ToolDictDataVo
4 | {
5 | ///
6 | /// 数据标签
7 | ///
8 | public string label { get; set; }
9 |
10 | ///
11 | ///数据键值
12 | ///
13 | public string value { get; set; }
14 |
15 | ///
16 | /// 显示样式
17 | ///
18 | public string shsty { get; set; }
19 |
20 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Sqlsugar/Mvc/Api/RestPageResult.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Sqlsugar.Mvc.Api;
2 |
3 | public class PageResult
4 | {
5 | public int total { get; set; }
6 | public object rows { get; set; }
7 | }
8 |
9 | public static class RestPageResult
10 | {
11 | public static PageResult Build(int Total, object Rows)
12 | {
13 | return new()
14 | {
15 | total = Total,
16 | rows = Rows
17 | };
18 | }
19 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Perm/Api/SysPermApiCache.cs:
--------------------------------------------------------------------------------
1 | using Vben.Base.Sys.Security.Pojo;
2 |
3 | namespace Vben.Base.Sys.Perm.Api;
4 |
5 | public class SysPermApiCache
6 | {
7 | public static Yapi[] GET_URLS = Array.Empty();
8 |
9 | public static Yapi[] POST_URLS = Array.Empty();
10 |
11 | public static Yapi[] PUT_URLS = Array.Empty();
12 |
13 | public static Yapi[] DELETE_URLS = Array.Empty();
14 |
15 | public static int AUTHPOS = 0;
16 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Core/Enum/AdminType.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Core.Enum;
2 |
3 | ///
4 | /// 账号类型
5 | ///
6 | public enum AdminType
7 | {
8 | ///
9 | /// 超级管理员
10 | ///
11 | [Description("超级管理员")] SuperAdmin = 1,
12 |
13 | ///
14 | /// 管理员
15 | ///
16 | [Description("管理员")] Admin = 2,
17 |
18 | ///
19 | /// 普通账号
20 | ///
21 | [Description("普通账号")] None = 3
22 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Auth/Login/LoginVo.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Auth.Login;
2 |
3 |
4 | public class LoginVo
5 | {
6 |
7 | public string access_token { get; set; }
8 |
9 | public string refresh_token { get; set; }
10 |
11 | public long expire_in { get; set; }
12 |
13 | public long? refresh_expire_in { get; set; }
14 |
15 | public string client_id { get; set; }
16 |
17 | public string scope { get; set; }
18 |
19 | public string openid { get; set; }
20 |
21 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Sqlsugar/Mvc/Pojo/Ltree.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Vben.Common.Sqlsugar.Mvc.Pojo;
4 |
5 | //树形pojo
6 | public class Ltree
7 | {
8 | [SugarColumn(ColumnDescription = "Id主键", IsPrimaryKey = true)]
9 | public long id { get; set; }
10 |
11 | public string name { get; set; }
12 |
13 | public string type { get; set; }
14 |
15 | [JsonIgnore] public long pid { get; set; }
16 |
17 | [SugarColumn(IsIgnore = true)] public List children { get; set; }
18 |
19 |
20 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Sqlsugar/Mvc/Pojo/Stree.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Vben.Common.Sqlsugar.Mvc.Pojo;
4 |
5 | //树形pojo
6 | public class Stree
7 | {
8 | [SugarColumn(ColumnDescription = "Id主键", IsPrimaryKey = true)]
9 | public string id { get; set; }
10 |
11 | public string name { get; set; }
12 |
13 | public string type { get; set; }
14 |
15 | [JsonIgnore] public string pid { get; set; }
16 |
17 | [SugarColumn(IsIgnore = true)] public List children { get; set; }
18 |
19 |
20 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Auth/User/MetaVo.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Auth.User;
2 |
3 | public class MetaVo
4 | {
5 | /*
6 | * 设置该路由在侧边栏和面包屑中展示的名字
7 | */
8 | public string title { get; set; }
9 |
10 | /**
11 | * 设置该路由的图标,对应路径src/assets/icons/svg
12 | */
13 | public string icon { get; set; }
14 |
15 | /**
16 | * 设置为true,则不会被 缓存
17 | */
18 | public bool noCache { get; set; }
19 |
20 | /**
21 | * 内链地址(http(s)://开头)
22 | */
23 | public string link { get; set; }
24 |
25 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Mon/Job/Log/MonJobLogService.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Mon.Job.Log;
2 |
3 | [Service]
4 | public class MonJobLogService(SqlSugarRepository repo)
5 | {
6 | public SqlSugarRepository repo { get; } = repo;
7 |
8 | public async Task SingleAsync(string id)
9 | {
10 | return await repo.GetSingleAsync(t => t.id == id);
11 | }
12 |
13 | public async Task DeleteAsync(string[] ids)
14 | {
15 | await repo.Context.Deleteable().In(ids).ExecuteCommandAsync();
16 | }
17 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Security/Pojo/Zmeta.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Security.Pojo;
2 |
3 | //前台返回菜单meta信息
4 | public class Zmeta
5 | {
6 | public string title { get; set; }
7 |
8 | public string affix { get; set; }
9 |
10 | public string icon { get; set; }
11 |
12 | public int orderNo { get; set; }
13 |
14 | public bool isHide { get; set; }
15 |
16 | public bool isIframe { get; set; } = false;
17 |
18 | public string isLink { get; set; }
19 |
20 | public bool isKeepAlive { get; set; }
21 |
22 | public Zmeta()
23 | {
24 | }
25 |
26 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Core/Filter/OplogAttribute.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Core.Filter;
2 |
3 | ///
4 | /// 操作日志特性
5 | ///
6 | [AttributeUsage(AttributeTargets.Method)]
7 | public class OplogAttribute : System.Attribute
8 | {
9 | ///
10 | /// 构造函数
11 | ///
12 | public OplogAttribute()
13 | {
14 |
15 | }
16 |
17 | public string name { get; set; }
18 |
19 | public int type { get; set; }
20 |
21 | public string title { get; set; }
22 |
23 | public OplogAttribute(string name) => this.name = name;
24 |
25 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Mon/Online/Hub/OnlineUserHubOutput.cs:
--------------------------------------------------------------------------------
1 | // Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
2 | //
3 | // 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
4 | //
5 | // 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
6 |
7 | using Vben.Base.Mon.online.user;
8 |
9 | namespace Admin.NET.Core;
10 |
11 | public class OnlineUserList
12 | {
13 | public string RealName { get; set; }
14 |
15 | public bool Online { get; set; }
16 |
17 | public List UserList { get; set; }
18 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Core/Manager/IUserManager.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Core.Manager;
2 |
3 | public interface IUserManager
4 | {
5 | string Account { get; }
6 | string Name { get; }
7 | bool SuperAdmin { get; }
8 | // SysOrgUser User { get; }
9 | string UserId { get; }
10 | string Perms { get; }
11 |
12 | string DeptId { get; }
13 |
14 | string Label { get; }
15 |
16 | string Type { get; }
17 |
18 | string Conds { get; }
19 |
20 | // Task CheckUserAsync(string userId, bool tracking = true);
21 | // Task GetUserEmpInfo(string userId);
22 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Tool/Dict/Main/ToolDictMain.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Tool.Dict.Main;
2 |
3 | [SugarTable("tool_dict_main", TableDescription = "字典信息")]
4 | [Description("字典信息")]
5 | public class ToolDictMain : BaseStrMainEntity
6 | {
7 | [SugarColumn(ColumnDescription = "排序号", IsNullable = true)]
8 | public int ornum { get; set; }
9 |
10 | [SugarColumn(ColumnDescription = "类型", IsNullable = true, Length = 32)]
11 | public string catid { get; set; }
12 |
13 |
14 | [SugarColumn(ColumnDescription = "字典代码", IsNullable = true, Length = 32)]
15 | public string code { get; set; }
16 |
17 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Admin/Properties/Vms/C#/entity.vm:
--------------------------------------------------------------------------------
1 | namespace ${options.Namespace};
2 |
3 | [SugarTable("${genTable.name}", TableDescription = "${genTable.remark}")]
4 | public class ${genTable.bunam} : ${genTable.baent}
5 | {
6 | $foreach(item in genTable.fields)
7 |
8 | ///
9 | /// ${item.remark}
10 | ///
11 | [SugarColumn(ColumnDescription = "${item.remark}", IsNullable = true $if(item.type=="string"&&item.length), Length = ${item.length} $end)]
12 | public $if(item.type=="date")DateTime?$else${item.type}$end ${item.name} { get; set; }
13 |
14 | $end
15 |
16 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Demo/Properties/Vms/C#/entity.vm:
--------------------------------------------------------------------------------
1 | namespace ${options.Namespace};
2 |
3 | [SugarTable("${genTable.name}", TableDescription = "${genTable.remark}")]
4 | public class ${genTable.bunam} : ${genTable.baent}
5 | {
6 | $foreach(item in genTable.fields)
7 |
8 | ///
9 | /// ${item.remark}
10 | ///
11 | [SugarColumn(ColumnDescription = "${item.remark}", IsNullable = true $if(item.type=="string"&&item.length), Length = ${item.length} $end)]
12 | public $if(item.type=="date")DateTime?$else${item.type}$end ${item.name} { get; set; }
13 |
14 | $end
15 |
16 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Core/Enum/RequestTypeEnum.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Core.Enum;
2 |
3 | ///
4 | /// http请求类型
5 | ///
6 | public enum RequestTypeEnum
7 | {
8 | ///
9 | /// 执行内部方法
10 | ///
11 | Run = 0,
12 |
13 | ///
14 | /// GET请求
15 | ///
16 | Get = 1,
17 |
18 | ///
19 | /// POST请求
20 | ///
21 | Post = 2,
22 |
23 | ///
24 | /// PUT请求
25 | ///
26 | Put = 3,
27 |
28 | ///
29 | /// DELETE请求
30 | ///
31 | Delete = 4
32 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Sqlsugar/Config/SqlSugarRepository.cs:
--------------------------------------------------------------------------------
1 | using Vben.Common.Core;
2 |
3 | namespace Vben.Common.Sqlsugar.Config;
4 |
5 | ///
6 | /// SqlSugar仓储类
7 | ///
8 | ///
9 | public class SqlSugarRepository : SimpleClient where T : class, new()
10 | {
11 | protected ITenant iTenant = null; // 多租户事务
12 |
13 | public SqlSugarRepository(ISqlSugarClient context = null) : base(context) // 默认值等于null不能少
14 | {
15 | iTenant = MyApp.GetService().AsTenant();
16 | base.Context = iTenant.GetConnectionWithAttr();
17 | }
18 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Security/Pojo/Zmenu.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Security.Pojo;
2 |
3 | //前台返回菜单
4 | public class Zmenu
5 | {
6 |
7 | public string id { get; set; }
8 |
9 | public string pid { get; set; }
10 |
11 | public string perm { get; set; }
12 |
13 | public string path { get; set; }
14 |
15 | public string name { get; set; }
16 | public string porid { get; set; }
17 |
18 | public string type { get; set; }
19 |
20 | public string component { get; set; }
21 |
22 | public Zmeta meta { get; set; }
23 |
24 | public string redirect { get; set; }
25 |
26 | public List children { get; set; }
27 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Sqlsugar/Config/ConnectionStringsOptions.cs:
--------------------------------------------------------------------------------
1 | // namespace Vben.Common.Sqlsugar.Config;
2 | //
3 | // ///
4 | // /// 数据库链接配置
5 | // ///
6 | // public class ConnectionStringsOptions : IConfigurableOptions
7 | // {
8 | // ///
9 | // /// 启用初始化库表
10 | // ///
11 | // public bool EnableInitTable { get; set; }
12 | //
13 | // ///
14 | // /// 启用库表差异日志
15 | // ///
16 | // public bool EnableDiffLog { get; set; }
17 | //
18 | // ///
19 | // /// 数据库配置集合
20 | // ///
21 | // public List ConnectionConfigs { get; set; }
22 | // }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Mon/Job/Main/MyJob.cs:
--------------------------------------------------------------------------------
1 | using Furion.Schedule;
2 | using Furion.TimeCrontab;
3 | using Microsoft.Extensions.Logging;
4 |
5 | namespace Vben.Base.Mon.Job.Main;
6 |
7 | [JobDetail("myjob","30秒钟执行一次的DEMO1")]
8 | [Cron("*/30 * * * * *", CronStringFormat.WithSeconds)]
9 | public class MyJob : IJob
10 | {
11 | private readonly ILogger _logger;
12 | public MyJob(ILogger logger)
13 | {
14 | _logger = logger;
15 | }
16 |
17 | public Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
18 | {
19 | _logger.LogInformation($"{context}");
20 | return Task.CompletedTask;
21 | }
22 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Org/Rece/SysOrgRece.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Org.Rece;
2 |
3 | [SugarTable("sys_org_rece", TableDescription = "组织架构-最近访问记录")]
4 | [Description("组织架构-最近访问记录")]
5 | public class SysOrgRece
6 | {
7 | [SugarColumn(ColumnDescription = "Id主键", IsPrimaryKey = true, Length = 36)]
8 | public string id { get; set; }
9 |
10 | [SugarColumn(ColumnDescription = "用户ID", Length = 36)]
11 | public string useid { get; set; }
12 |
13 | [SugarColumn(ColumnDescription = "组织架构ID", Length = 36)]
14 | public string oid { get; set; }
15 |
16 | [SugarColumn(ColumnDescription = "最近使用时间", IsNullable = true)]
17 | public virtual DateTime? uptim { get; set; }
18 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Tool/Dict/Cate/ToolDictCate.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Tool.Dict.Cate;
2 |
3 | [SugarTable("tool_dict_cate", TableDescription = "字典分类")]
4 | [Description("字典分类")]
5 | public class ToolDictCate : BaseEntity
6 | {
7 | [SugarColumn(ColumnDescription = "可用标记:1可用,0禁用", IsNullable = true)]
8 | public bool? avtag { get; set; }
9 |
10 | [SugarColumn(ColumnDescription = "排序号", IsNullable = true)]
11 | public int ornum { get; set; }
12 |
13 | [SugarColumn(ColumnDescription = "备注", IsNullable = true, Length = 64)]
14 | public string notes { get; set; }
15 |
16 | [SugarColumn(ColumnDescription = "代码", Length = 32)]
17 | public string code { get; set; }
18 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Pub/Org/Dept/PubOrgDeptApi.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using Vben.Base.Sys.Org.Dept;
4 |
5 | namespace Vben.Base.Pub.Org.Dept;
6 |
7 | [Route("pub/org/dept")]
8 | [ApiDescriptionSettings("Pub", Tag = "部门查询")]
9 | public class PubOrgDeptApi(SqlSugarRepository repo) : ControllerBase
10 | {
11 | [HttpGet("tree")]
12 | public List GetTree()
13 | {
14 | var trees = repo.Context.SqlQueryable("select id,pid,name from sys_org_dept where avtag="+Db.True)
15 | .ToTreeAsync(it => it.children, it => it.pid, null).Result;
16 | Console.WriteLine(trees);
17 | return trees;
18 | }
19 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Bpm/Vben.Bpm.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Vben.Bpm
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/vben-apps/Vben.Admin/Properties/Vms/Route/route.sql.vm:
--------------------------------------------------------------------------------
1 | insert into sys_perm_menu (id,ornum,pid,porid,type,code,icon,path,comp,extag,catag,shtag,iftag,name,crman,avtag)
2 | values ('${genTable.bunam}',999991,null,'sys','M','${genTable.bunam}','ele-Tickets','/${replaceDto.UrlName}','/${replaceDto.UrlName}/index',0,1,1,0,'${genTable.remark}清单','sa',1);
3 |
4 | $if(genTable.edtyp=="tab")
5 | insert into sys_perm_menu (id,ornum,pid,porid,type,code,icon,path,comp,extag,catag,shtag,iftag,name,crman,avtag)
6 | values ('${genTable.bunam}Edit',999992,null,'sys','M','${genTable.bunam}Edit','ele-Tickets','/${replaceDto.UrlName}/edit','/${replaceDto.UrlName}/edit',0,1,0,0,'${genTable.remark}编辑','sa',1);
7 | $end
--------------------------------------------------------------------------------
/vben-apps/Vben.Demo/Properties/Vms/Route/route.sql.vm:
--------------------------------------------------------------------------------
1 | insert into sys_perm_menu (id,ornum,pid,porid,type,code,icon,path,comp,extag,catag,shtag,iftag,name,crman,avtag)
2 | values ('${genTable.bunam}',999991,null,'sys','M','${genTable.bunam}','ele-Tickets','/${replaceDto.UrlName}','/${replaceDto.UrlName}/index',0,1,1,0,'${genTable.remark}清单','sa',1);
3 |
4 | $if(genTable.edtyp=="tab")
5 | insert into sys_perm_menu (id,ornum,pid,porid,type,code,icon,path,comp,extag,catag,shtag,iftag,name,crman,avtag)
6 | values ('${genTable.bunam}Edit',999992,null,'sys','M','${genTable.bunam}Edit','ele-Tickets','/${replaceDto.UrlName}/edit','/${replaceDto.UrlName}/edit',0,1,0,0,'${genTable.remark}编辑','sa',1);
7 | $end
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Core/Config/UploadOptions.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Core.Config;
2 |
3 | ///
4 | /// 文件上传配置
5 | ///
6 | public sealed class UploadOptions
7 | {
8 | ///
9 | /// 上传服务
10 | ///
11 | public string Service { get; set; }
12 |
13 | ///
14 | /// 上传地址
15 | ///
16 | public string Path { get; set; }
17 |
18 |
19 | ///
20 | /// 大小
21 | ///
22 | public long MaxSize { get; set; }
23 |
24 | ///
25 | /// 上传格式
26 | ///
27 | public List ContentType { get; set; }
28 |
29 | //xtodo
30 | public string DrawPath { get; set; }
31 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Carry/Message/Dto/ThemeAttribute.cs:
--------------------------------------------------------------------------------
1 | // Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
2 | //
3 | // 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
4 | //
5 | // 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
6 |
7 | namespace Admin.NET.Core;
8 |
9 | ///
10 | /// 枚举拓展主题样式
11 | ///
12 | [SuppressSniffer]
13 | [AttributeUsage(AttributeTargets.Enum | AttributeTargets.Field)]
14 | public class ThemeAttribute : Attribute
15 | {
16 | public string Theme { get; private set; }
17 |
18 | public ThemeAttribute(string theme)
19 | {
20 | this.Theme = theme;
21 | }
22 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Core/Enum/LoginType.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Core.Enum;
2 |
3 | ///
4 | /// 登陆类型
5 | ///
6 | public enum LoginType
7 | {
8 | ///
9 | /// 登陆
10 | ///
11 | [Description("登陆")] LOGIN = 0,
12 |
13 | ///
14 | /// 登出
15 | ///
16 | [Description("登出")] LOGOUT = 1,
17 |
18 | ///
19 | /// 注册
20 | ///
21 | [Description("注册")] REGISTER = 2,
22 |
23 | ///
24 | /// 改密
25 | ///
26 | [Description("改密")] CHANGEPASSWORD = 3,
27 |
28 | ///
29 | /// 三方授权登陆
30 | ///
31 | [Description("授权登陆")] AUTHORIZEDLOGIN = 4
32 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Core/Utils/XuserUtil.cs:
--------------------------------------------------------------------------------
1 | using Vben.Common.Core.Manager;
2 |
3 | namespace Vben.Common.Core.Utils;
4 |
5 | public class XuserUtil
6 | {
7 | // public static SysOrg getUser()
8 | // {
9 | // var user = App.GetService();
10 | // return new SysOrg(user.UserId, user.Name);
11 | // }
12 |
13 | public static String getUserId()
14 | {
15 | String userId = null;
16 | var user = MyApp.GetHttpService();
17 | if (user != null)
18 | {
19 | userId = user.UserId;
20 | }
21 |
22 | if (userId == null)
23 | {
24 | userId = "u1";
25 | }
26 | return userId;
27 | }
28 |
29 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Mon/Job/Main/MyJob2.cs:
--------------------------------------------------------------------------------
1 | using Furion.Schedule;
2 | using Microsoft.Extensions.Logging;
3 |
4 | namespace Vben.Base.Mon.Job.Main;
5 |
6 | [JobDetail("myjob2","1分钟执行一次的DEMO2")]
7 | [Minutely]
8 | public class MyJob2 : IJob
9 | {
10 | private readonly ILogger _logger;
11 | public MyJob2(ILogger logger)
12 | {
13 | _logger = logger;
14 | }
15 |
16 | public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
17 | {
18 | _logger.LogInformation($"开始:{context}");
19 | await Task.Delay(5000, stoppingToken); //
20 | throw new Exception("假装出错");
21 | _logger.LogInformation($"结束:{context}");
22 | }
23 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Org/Dept/SysOrgDeptVo.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Org.Dept;
2 |
3 | public class SysOrgDeptVo
4 | {
5 | [SugarColumn(ColumnDescription = "Id主键", IsPrimaryKey = true)]
6 | public string id { get; set; }
7 |
8 | public string name { get; set; }
9 |
10 | public string type { get; set; }
11 |
12 | public DateTime? crtim { get; set; }
13 |
14 | public DateTime? uptim { get; set; }
15 |
16 | public string cruna { get; set; }
17 |
18 | public string upuna { get; set; }
19 |
20 | public string notes { get; set; }
21 |
22 | [JsonIgnore] public string pid { get; set; }
23 |
24 | [SugarColumn(IsIgnore = true)] public List children { get; set; }
25 |
26 |
27 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Vben.Base.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Vben.Base.xml
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Security/Pojo/UserDo.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Security.Pojo;
2 |
3 | //数据库用户信息,登录时用到
4 | public class UserDo
5 | {
6 | public string id { get; set; }
7 |
8 | public string name { get; set; }
9 |
10 | public string pacod { get; set; }
11 |
12 | public bool catag { get; set; }
13 |
14 | public string tier { get; set; }
15 |
16 | public string usnam { get; set; }
17 |
18 | public string monum { get; set; }//手机号
19 |
20 | public string label { get; set; }//账号标签
21 | public string type { get; set; }//账号类型
22 |
23 | public string depid { get; set; }//部门id,协同用户则是公司id
24 |
25 | public string depna { get; set; }//部门名称,协同用户则是公司名称
26 |
27 | public string relog { get; set; }//前台通知是否查看过的标记
28 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Demo/Launch/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | global using Furion;
2 | global using Furion.DependencyInjection;
3 | global using Furion.DynamicApiController;
4 | global using SqlSugar;
5 | global using System;
6 | global using System.Collections.Generic;
7 | global using System.Linq;
8 | global using System.Threading.Tasks;
9 | global using Yitter.IdGenerator;
10 | global using Vben.Common.Sqlsugar.Mvc.Api;
11 | global using Vben.Common.Sqlsugar.Mvc.Entity;
12 | global using Vben.Common.Sqlsugar.Mvc.Pojo;
13 | global using Vben.Common.Sqlsugar.Mvc.Service;
14 | global using Vben.Common.Sqlsugar.Mvc.Dao;
15 | global using Vben.Common.Sqlsugar.Config;
16 | global using Microsoft.AspNetCore.Mvc;
17 | global using System.ComponentModel;
18 | global using Vben.Common.Core.Attribute;
--------------------------------------------------------------------------------
/vben-apps/Vben.Admin/Launch/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | global using Furion;
2 | global using Furion.DependencyInjection;
3 | global using Furion.DynamicApiController;
4 | global using SqlSugar;
5 | global using System;
6 | global using System.Collections.Generic;
7 | global using System.Linq;
8 | global using System.Threading.Tasks;
9 | global using Yitter.IdGenerator;
10 | global using Vben.Common.Sqlsugar.Mvc.Api;
11 | global using Vben.Common.Sqlsugar.Mvc.Entity;
12 | global using Vben.Common.Sqlsugar.Mvc.Pojo;
13 | global using Vben.Common.Sqlsugar.Mvc.Service;
14 | global using Vben.Common.Sqlsugar.Mvc.Dao;
15 | global using Vben.Common.Sqlsugar.Config;
16 | global using Microsoft.AspNetCore.Mvc;
17 | global using System.ComponentModel;
18 | global using Vben.Common.Core.Attribute;
19 |
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Org/Group/SysOrgGroup.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Org.Group;
2 |
3 | [SugarTable("sys_org_group", TableDescription = "组织架构-群组")]
4 | [Description("组织架构-群组")]
5 | public class SysOrgGroup : BaseStrMainEntity
6 | {
7 | [SugarColumn(ColumnDescription = "排序号", IsNullable = true)]
8 | public int ornum { get; set; }
9 |
10 | [SugarColumn(ColumnDescription = "标签", IsNullable = true, Length = 32)]
11 | public string label { get; set; }
12 |
13 | [SugarColumn(ColumnDescription = "分类ID", IsNullable = true, Length = 36)]
14 | public string catid { get; set; }
15 |
16 | [Navigate(typeof(SysOrgGroupOrg), nameof(SysOrgGroupOrg.gid), nameof(SysOrgGroupOrg.oid))]
17 | [SugarColumn(IsIgnore = true)] public List members { get; set; }
18 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Furion/Vben.Common.Furion.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 1701;1702;1591
5 | Vben.Common.Furion.xml
6 | Vben.Common.Furion
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Mon/Online/User/OnlineUserInput.cs:
--------------------------------------------------------------------------------
1 | // Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
2 | //
3 | // 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
4 | //
5 | // 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
6 |
7 | namespace Admin.NET.Core.Service;
8 |
9 | public class PageOnlineUserInput : BasePageInput
10 | {
11 | // ///
12 | // /// 账号名称
13 | // ///
14 | // public string UserName { get; set; }
15 | //
16 | // ///
17 | // /// 真实姓名
18 | // ///
19 | // public string RealName { get; set; }
20 | //
21 | // ///
22 | // /// 租户Id
23 | // ///
24 | // public long TenantId { get; set; }
25 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Core/Utils/XfileUtil.cs:
--------------------------------------------------------------------------------
1 | using NPOI.SS.Util;
2 |
3 | namespace Vben.Common.Core.Utils;
4 |
5 | public class XfileUtil
6 | {
7 | public static string GetFileSize(long fileS)
8 | {
9 | string size = "";
10 | DecimalFormat df = new DecimalFormat("#.00");
11 | if (fileS < 1024)
12 | {
13 | size = df.Format(fileS) + "B";
14 | }
15 | else if (fileS < 1048576)
16 | {
17 | size = df.Format((double)fileS / 1024) + "KB";
18 | }
19 | else if (fileS < 1073741824)
20 | {
21 | size = df.Format((double)fileS / 1048576) + "MB";
22 | }
23 | else
24 | {
25 | size = df.Format((double)fileS / 1073741824) + "GB";
26 | }
27 | return size;
28 | }
29 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Demo/Vben.Demo.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Vben.Admin
5 | Properties\Vben.Demo.xml
6 | Development
7 |
8 |
9 |
10 |
11 | PreserveNewest
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Perm/Role/bo/SysPermRoleBo.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Perm.Role.bo;
2 |
3 | public class SysPermRoleBo
4 | {
5 | public long id { get; set; }
6 |
7 | public string name { get; set; }
8 |
9 | public string notes { get; set; }
10 |
11 | public bool avtag { get; set; } = true;
12 |
13 | public int ornum { get; set; }
14 |
15 | public DateTime? crtim { get; set; } = DateTime.Now;
16 |
17 | public DateTime? uptim { get; set; }
18 |
19 | public SysOrg crman { get; set; }
20 |
21 | public string cruid { get; set; }
22 |
23 | public SysOrg upman { get; set; }
24 |
25 | public string upuid { get; set; }
26 |
27 | public List orgs { get; set; }
28 |
29 | public List menus { get; set; }
30 |
31 | public List apis { get; set; }
32 |
33 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Perm/Role/vo/SysPermRoleVo.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Perm.Role.vo;
2 |
3 | public class SysPermRoleVo
4 | {
5 | public long id { get; set; }
6 |
7 | public string name { get; set; }
8 |
9 | public string notes { get; set; }
10 |
11 | public bool avtag { get; set; } = true;
12 |
13 | public int ornum { get; set; }
14 |
15 | public DateTime? crtim { get; set; } = DateTime.Now;
16 |
17 | public DateTime? uptim { get; set; }
18 |
19 | public SysOrg crman { get; set; }
20 |
21 | public string cruid { get; set; }
22 |
23 | public SysOrg upman { get; set; }
24 |
25 | public string upuid { get; set; }
26 |
27 | public List orgs { get; set; }
28 |
29 | public List menus { get; set; }
30 |
31 | public List apis { get; set; }
32 |
33 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Admin/Vben.Admin.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Vben.Admin
5 | Properties\Vben.Admin.xml
6 | Development
7 |
8 |
9 |
10 |
11 |
12 | PreserveNewest
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Org/Post/SysOrgPost.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Org.Post;
2 |
3 | [SugarTable("sys_org_post", TableDescription = "组织架构-岗位")]
4 | [Description("组织架构-岗位")]
5 | public class SysOrgPost : BaseStrMainEntity
6 | {
7 | [SugarColumn(ColumnDescription = "部门ID", IsNullable = true, Length = 36)]
8 | public string depid { get; set; }
9 |
10 | [SugarColumn(ColumnDescription = "标签", IsNullable = true, Length = 32)]
11 | public string label { get; set; }
12 |
13 | [SugarColumn(ColumnDescription = "排序号", IsNullable = true)]
14 | public int ornum { get; set; }
15 |
16 | [Navigate(typeof(SysOrgPostOrg), nameof(SysOrgPostOrg.pid), nameof(SysOrgPostOrg.oid))]
17 | public List users { get; set; }
18 |
19 | [SugarColumn(ColumnDescription = "层级", IsNullable = true, Length = 512)]
20 | public string tier { get; set; }
21 |
22 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Admin/Properties/Vms/Route/route.json.vm:
--------------------------------------------------------------------------------
1 | {
2 | path: '/${replaceDto.UrlName}',
3 | name: '${genTable.bunam}',
4 | component: () => import('/@/pages/${replaceDto.UrlName}/index.vue'),
5 | meta:{
6 | title: '${genTable.remark}清单',
7 | isLink: '',
8 | isHide: false,
9 | isKeepAlive: true,
10 | isAffix: false,
11 | isIframe: false,
12 | roles: ['admin'],
13 | icon: 'ele-Tickets',
14 | },
15 | },
16 | $if(genTable.edtyp=="tab")
17 | {
18 | path: '/${replaceDto.UrlName}/edit',
19 | name: '${genTable.bunam}Edit',
20 | component: () => import('/@/pages/${replaceDto.UrlName}/edit.vue'),
21 | meta: {
22 | title: '${genTable.remark}编辑',
23 | isLink: '',
24 | isHide: true,
25 | isKeepAlive: true,
26 | isAffix: false,
27 | isIframe: false,
28 | roles: ['admin'],
29 | icon: 'ele-Tickets',
30 | },
31 | },
32 | $end
--------------------------------------------------------------------------------
/vben-apps/Vben.Demo/Properties/Vms/Route/route.json.vm:
--------------------------------------------------------------------------------
1 | {
2 | path: '/${replaceDto.UrlName}',
3 | name: '${genTable.bunam}',
4 | component: () => import('/@/pages/${replaceDto.UrlName}/index.vue'),
5 | meta:{
6 | title: '${genTable.remark}清单',
7 | isLink: '',
8 | isHide: false,
9 | isKeepAlive: true,
10 | isAffix: false,
11 | isIframe: false,
12 | roles: ['admin'],
13 | icon: 'ele-Tickets',
14 | },
15 | },
16 | $if(genTable.edtyp=="tab")
17 | {
18 | path: '/${replaceDto.UrlName}/edit',
19 | name: '${genTable.bunam}Edit',
20 | component: () => import('/@/pages/${replaceDto.UrlName}/edit.vue'),
21 | meta: {
22 | title: '${genTable.remark}编辑',
23 | isLink: '',
24 | isHide: true,
25 | isKeepAlive: true,
26 | isAffix: false,
27 | isIframe: false,
28 | roles: ['admin'],
29 | icon: 'ele-Tickets',
30 | },
31 | },
32 | $end
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Tool/Code/Table/ToolCodeField.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Tool.Code.Table;
2 |
3 | [SugarTable("tool_code_field", TableDescription = "代码生成-字段信息")]
4 | [Description("代码生成-字段信息")]
5 | public class ToolCodeField : BaseStrMainEntity
6 | {
7 |
8 | [SugarColumn(ColumnDescription = "排序号", IsNullable = true)]
9 | public int ornum { get; set; }
10 |
11 | [SugarColumn(ColumnDescription = "字段注释", IsNullable = true, Length = 64)]
12 | public string remark { get; set; }
13 |
14 | [SugarColumn(ColumnDescription = "字段类型", IsNullable = true, Length = 32)]
15 | public string type { get; set; }
16 |
17 | [SugarColumn(ColumnDescription = "表格ID", IsNullable = true, Length = 32)]
18 | public long tabid { get; set; }
19 |
20 | [SugarColumn(ColumnDescription = "字段长度", IsNullable = true)]
21 | public int length { get; set; }
22 |
23 |
24 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Demo/Launch/Init/DataInit.cs:
--------------------------------------------------------------------------------
1 | using Vben.Common.Sqlsugar.Config;
2 | using Vben.Common.Sqlsugar.Mvc.Entity;
3 |
4 | namespace Vben.Admin.Launch.Init;
5 |
6 | public class DataInit(
7 | SysOrgInit orgInit,
8 | SysPermInit permInit,
9 | ToolInit toolInit,
10 | SqlSugarRepository sysOrgRepo)
11 | : ITransient
12 | {
13 | //首次启动,数据库生成后,初始化组织架构,菜单,权限角色,接口等信息
14 | public async Task Init()
15 | {
16 | var sysOrg = sysOrgRepo.GetSingle(it => it.id == "u1");
17 | if (sysOrg == null)
18 | {
19 | Console.WriteLine("首次启动系统,正在进行数据库初始化,请耐心等待。");
20 | await orgInit.initData();
21 | Console.WriteLine("1 初始化组长架构完毕");
22 | await permInit.initData();
23 | Console.WriteLine("2 初始化权限完毕");
24 | await toolInit.InitData();
25 | Console.WriteLine("3 初始化辅助工具完毕");
26 | }
27 | }
28 |
29 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Core/Attribute/ServiceAttribute.cs:
--------------------------------------------------------------------------------
1 | using Vben.Common.Core.Filter;
2 |
3 | namespace Vben.Common.Core.Attribute;
4 |
5 | ///
6 | /// 参考地址:https://www.cnblogs.com/kelelipeng/p/10643556.html
7 | /// 标记服务
8 | /// 如何使用?
9 | /// 1、如果服务是本身 直接在类上使用[AppService]
10 | /// 2、如果服务是接口 在类上使用 [AppService(ServiceType = typeof(实现接口))]
11 | ///
12 | [AttributeUsage(AttributeTargets.Class, Inherited = false)]
13 | public class ServiceAttribute : System.Attribute
14 | {
15 | ///
16 | /// 服务声明周期
17 | /// 不给默认值的话注册的是AddSingleton
18 | ///
19 | public LifeTime ServiceLifetime { get; set; } = LifeTime.Transient;
20 |
21 | ///
22 | /// 指定服务类型
23 | ///
24 | public Type ServiceType { get; set; }
25 |
26 | ///
27 | /// 是否可以从第一个接口获取服务类型
28 | ///
29 | public bool InterfaceServiceType { get; set; }
30 | }
31 |
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Carry/Message/Dto/SmsInput.cs:
--------------------------------------------------------------------------------
1 | // Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
2 | //
3 | // 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
4 | //
5 | // 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
6 |
7 | using Furion.DataValidation;
8 |
9 | namespace Admin.NET.Core;
10 |
11 | public class SmsVerifyCodeInput
12 | {
13 | ///
14 | /// 手机号码
15 | ///
16 | /// admin
17 | [Required(ErrorMessage = "手机号码不能为空")]
18 | [DataValidation(ValidationTypes.PhoneNumber, ErrorMessage = "手机号码不正确")]
19 | public string Phone { get; set; }
20 |
21 | ///
22 | /// 验证码
23 | ///
24 | /// 123456
25 | [Required(ErrorMessage = "验证码不能为空"), MinLength(4, ErrorMessage = "验证码不能少于4个字符")]
26 | public string Code { get; set; }
27 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Mon/Job/Log/MonJobLog.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Mon.Job.Log;
2 |
3 | [SugarTable("mon_job_log")]
4 | [Description("定时任务日志")]
5 | public class MonJobLog
6 | {
7 | [SugarColumn(ColumnDescription = "Id主键", IsPrimaryKey = true, Length = 36)]
8 | public string id { get; set; }
9 |
10 | [SugarColumn(ColumnDescription = "名称", IsNullable = true, Length = 255)]
11 | public string name { get; set; }
12 |
13 | [SugarColumn(ColumnDescription = "信息", IsNullable = true, Length = 2000)]
14 | public string msg { get; set; }
15 |
16 | [SugarColumn(ColumnDescription = "结果", IsNullable = true, Length = 255)]
17 | public string ret { get; set; }
18 |
19 | [SugarColumn(ColumnDescription = "开始时间", IsNullable = true)]
20 | public DateTime sttim { get; set; }
21 |
22 | [SugarColumn(ColumnDescription = "结束时间", IsNullable = true)]
23 | public DateTime entim { get; set; }
24 |
25 |
26 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Core/Filter/AppServiceAttribute.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Core.Filter;
2 |
3 | ///
4 | /// 参考地址:https://www.cnblogs.com/kelelipeng/p/10643556.html
5 | /// 标记服务
6 | /// 如何使用?
7 | /// 1、如果服务是本身 直接在类上使用[AppService]
8 | /// 2、如果服务是接口 在类上使用 [AppService(ServiceType = typeof(实现接口))]
9 | ///
10 | [AttributeUsage(AttributeTargets.Class, Inherited = false)]
11 | public class AppServiceAttribute : System.Attribute
12 | {
13 | ///
14 | /// 服务声明周期
15 | /// 不给默认值的话注册的是AddSingleton
16 | ///
17 | public LifeTime ServiceLifetime { get; set; } = LifeTime.Scoped;
18 |
19 | ///
20 | /// 指定服务类型
21 | ///
22 | public Type ServiceType { get; set; }
23 |
24 | ///
25 | /// 是否可以从第一个接口获取服务类型
26 | ///
27 | public bool InterfaceServiceType { get; set; }
28 | }
29 |
30 | public enum LifeTime
31 | {
32 | Transient,
33 | Scoped,
34 | Singleton
35 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Tool/Oss/File/ToolOssFile.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Tool.Oss.File;
2 |
3 | [SugarTable("tool_oss_file", TableDescription = "OSS存储文件")]
4 | public class ToolOssFile
5 | {
6 | [SugarColumn(ColumnDescription = "主键", IsPrimaryKey = true, Length = 32)]
7 | public string id { get; set; }
8 |
9 | [SugarColumn(ColumnDescription = "文件md5", IsNullable = true, Length = 32)]
10 | public string md5 { get; set; }
11 |
12 | [SugarColumn(ColumnDescription = "文件大小", IsNullable = true)]
13 | public long zsize { get; set; }
14 |
15 | [SugarColumn(ColumnDescription = "存储地址", IsNullable = true, Length = 255)]
16 | public string path { get; set; }
17 |
18 | [SugarColumn(ColumnDescription = "存储服务", IsNullable = true, Length = 32)]
19 | public string service { get; set; }
20 |
21 | [SugarColumn(ColumnDescription = "创建时间", IsNullable = true, IsOnlyIgnoreUpdate = true)]
22 | public DateTime? crtim { get; set; } = DateTime.Now;
23 |
24 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Core/Token/GlobalExceptionHandler.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Diagnostics;
2 | using Microsoft.Extensions.Logging;
3 |
4 | namespace Vben.Common.Core.Token;
5 |
6 | public class GlobalExceptionHandler : IExceptionHandler
7 | {
8 | private readonly ILogger _logger;
9 | public GlobalExceptionHandler(ILogger logger) => _logger = logger;
10 |
11 | public async ValueTask TryHandleAsync(HttpContext context, Exception exception, CancellationToken token)
12 | {
13 | _logger.LogError(exception, "An unhandled exception occurred.");
14 |
15 | var problemDetails = new ProblemDetails
16 | {
17 | Status = StatusCodes.Status500InternalServerError,
18 | Title = "Server Error",
19 | Type = "https://httpstatuses.com/500"
20 | };
21 | await context.Response.WriteAsJsonAsync(problemDetails, token);
22 | return true; // 表示异常已处理
23 | }
24 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Carry/Message/Dto/MessageTypeEnum.cs:
--------------------------------------------------------------------------------
1 | // Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
2 | //
3 | // 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
4 | //
5 | // 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
6 |
7 | namespace Admin.NET.Core;
8 |
9 | ///
10 | /// 消息类型枚举
11 | ///
12 | [Description("消息类型枚举")]
13 | public enum MessageTypeEnum
14 | {
15 | ///
16 | /// 普通信息
17 | ///
18 | [Description("消息"), Theme("info")]
19 | Info = 0,
20 |
21 | ///
22 | /// 成功提示
23 | ///
24 | [Description("成功"), Theme("success")]
25 | Success = 1,
26 |
27 | ///
28 | /// 警告提示
29 | ///
30 | [Description("警告"), Theme("warning")]
31 | Warning = 2,
32 |
33 | ///
34 | /// 错误提示
35 | ///
36 | [Description("错误"), Theme("danger")]
37 | Error = 3
38 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Admin/Launch/Program.cs:
--------------------------------------------------------------------------------
1 | using Vben.Common.Core;
2 | using Vben.Common.Sqlsugar;
3 |
4 | var builder = WebApplication.CreateBuilder(args);
5 | MyApp.Configuration = builder.Configuration;
6 |
7 | builder.Configuration.AddJsonFile("Properties/Configs/web.json", optional: true, reloadOnChange: true);
8 | if (builder.Environment.IsDevelopment())
9 | {
10 | builder.Configuration.AddJsonFile("Properties/Configs/web.Development.json", optional: true, reloadOnChange: true);
11 | }
12 | else if (builder.Environment.IsProduction())
13 | {
14 | builder.Configuration.AddJsonFile("Properties/Configs/web.Production.json", optional: true, reloadOnChange: true);
15 | }
16 |
17 | builder.Configuration.AddJsonFile("Properties/Configs/Cache.json");
18 |
19 | builder.Inject();
20 | builder.Host.UseSerilogDefault();
21 | builder.Services.AddDb();
22 |
23 | var app = builder.Build();
24 |
25 | MyApp.ServiceProvider = app.Services;
26 | MyApp.WebHostEnvironment = app.Environment;
27 | app.DbFirst();
28 |
29 | app.Run();
--------------------------------------------------------------------------------
/vben-apps/Vben.Demo/Demo/Link/Main/DemoLinkMain.cs:
--------------------------------------------------------------------------------
1 | using Vben.Admin.Demo.Link.Item;
2 | using Vben.Admin.Demo.Link.Mid;
3 |
4 | namespace Vben.Admin.Demo.Link.Main;
5 |
6 | ///
7 | /// 关联主表
8 | ///
9 | [SugarTable("demo_link_main", TableDescription = "关联主表")]
10 | [Description("关联主表")]
11 | public class DemoLinkMain : BaseMainEntity
12 | {
13 |
14 | ///
15 | /// 分类ID
16 | ///
17 | [SugarColumn(ColumnDescription = "分类ID", IsNullable = true)]
18 | public long catid { get; set; }
19 |
20 | ///
21 | /// 行项目列表
22 | ///
23 | [Navigate(NavigateType.OneToMany, nameof(DemoLinkItem.maiid))]
24 | [SugarColumn(IsIgnore = true)]
25 | public List items { get; set; }
26 |
27 | ///
28 | /// 关联用户中间表
29 | ///
30 | [Navigate(typeof(DemoLinkMainToOrg), nameof(DemoLinkMainToOrg.mid), nameof(DemoLinkMainToOrg.oid))]
31 | public List orgs { get; set; }
32 |
33 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Admin/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json.schemastore.org/launchsettings.json",
3 | "iisSettings": {
4 | "windowsAuthentication": false,
5 | "anonymousAuthentication": true,
6 | "iisExpress": {
7 | "applicationUrl": "https://localhost:5001;http://localhost:8080",
8 | "sslPort": 44342
9 | }
10 | },
11 | "profiles": {
12 | "IIS Express": {
13 | "commandName": "IISExpress",
14 | "launchBrowser": true,
15 | "launchUrl": "",
16 | "environmentVariables": {
17 | "ASPNETCORE_ENVIRONMENT": "Development"
18 | }
19 | },
20 | "Vben.Admin": {
21 | "commandName": "Project",
22 | "dotnetRunMessages": "true",
23 | "launchBrowser": true,
24 | "launchUrl": "",
25 | "applicationUrl": "https://localhost:5001;http://localhost:8080;https://0.0.0.0:5001;http://0.0.0.0:8080",
26 | "environmentVariables": {
27 | "ASPNETCORE_ENVIRONMENT": "Development"
28 | }
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Demo/Launch/Program.cs:
--------------------------------------------------------------------------------
1 | using Vben.Common.Core;
2 | using Vben.Common.Sqlsugar;
3 |
4 | var builder = WebApplication.CreateBuilder(args);
5 | MyApp.Configuration = builder.Configuration;
6 |
7 | builder.Configuration.AddJsonFile("Properties/Configs/web.json", optional: true, reloadOnChange: true);
8 | if (builder.Environment.IsDevelopment())
9 | {
10 | builder.Configuration.AddJsonFile("Properties/Configs/web.Development.json", optional: true, reloadOnChange: true);
11 | }
12 | else if (builder.Environment.IsProduction())
13 | {
14 | builder.Configuration.AddJsonFile("Properties/Configs/web.Production.json", optional: true, reloadOnChange: true);
15 | }
16 |
17 | builder.Configuration.AddJsonFile("Properties/Configs/Cache.json");
18 |
19 | builder.Inject();
20 | builder.Host.UseSerilogDefault();
21 | builder.Services.AddDb();
22 |
23 | var app = builder.Build();
24 |
25 |
26 | MyApp.ServiceProvider = app.Services;
27 | MyApp.WebHostEnvironment = app.Environment;
28 | app.DbFirst();
29 |
30 | app.Run();
--------------------------------------------------------------------------------
/vben-apps/Vben.Demo/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json.schemastore.org/launchsettings.json",
3 | "iisSettings": {
4 | "windowsAuthentication": false,
5 | "anonymousAuthentication": true,
6 | "iisExpress": {
7 | "applicationUrl": "https://localhost:5001;http://localhost:8080",
8 | "sslPort": 44342
9 | }
10 | },
11 | "profiles": {
12 | "IIS Express": {
13 | "commandName": "IISExpress",
14 | "launchBrowser": true,
15 | "launchUrl": "",
16 | "environmentVariables": {
17 | "ASPNETCORE_ENVIRONMENT": "Development"
18 | }
19 | },
20 | "Vben.Demo": {
21 | "commandName": "Project",
22 | "dotnetRunMessages": "true",
23 | "launchBrowser": true,
24 | "launchUrl": "",
25 | "applicationUrl": "https://localhost:5001;http://localhost:8080;https://0.0.0.0:5001;http://0.0.0.0:8080",
26 | "environmentVariables": {
27 | "ASPNETCORE_ENVIRONMENT": "Development"
28 | }
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Core/Const/ClaimConst.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Core.Const;
2 |
3 | public class ClaimConst
4 | {
5 | ///
6 | /// 用户Id
7 | ///
8 | public const string CLAINM_USERID = "userId";
9 |
10 | ///
11 | /// 账号
12 | ///
13 | public const string CLAINM_ACCOUNT = "Account";
14 |
15 | ///
16 | /// 名称
17 | ///
18 | public const string CLAINM_NAME = "name";
19 |
20 | ///
21 | /// 是否超级管理
22 | ///
23 | public const string CLAINM_SUPERADMIN = "SuperAdmin";
24 |
25 | ///
26 | /// 是否超级管理
27 | ///
28 | public const string TENANT_ID = "TenantId";
29 |
30 | public const string CLAINM_PERMS = "Perms";
31 |
32 | public const string CLAINM_DEPTID = "DeptId";
33 |
34 | public const string CLAINM_TYPE = "Type";
35 |
36 | public const string CLAINM_LABEL = "Label";
37 |
38 | public const string CLAINM_CONDS = "Conds";
39 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Sqlsugar/Mvc/Pojo/XreqUtil.cs:
--------------------------------------------------------------------------------
1 | using Vben.Common.Core;
2 |
3 | namespace Vben.Common.Sqlsugar.Mvc.Pojo;
4 |
5 | public class XreqUtil
6 | {
7 | public static PagingParam GetPp()
8 | {
9 | var pp = new PagingParam();
10 | // var xx = MyApp.ServiceProvider;
11 | // var yy = MyApp.Configuration;
12 | var request = MyApp.HttpContext.Request;
13 | var strPageSize = request.Query["pageSize"].ToString();
14 | if (!string.IsNullOrEmpty(strPageSize))
15 | {
16 | pp.pageSize = int.Parse(strPageSize);
17 | }
18 | var strPage = request.Query["pageNum"].ToString();
19 | if (!string.IsNullOrEmpty(strPage))
20 | {
21 | pp.page = int.Parse(strPage);
22 | }
23 | return pp;
24 | }
25 | }
26 |
27 | public class PagingParam
28 | {
29 | public RefAsync total { get; set; } = 0;
30 |
31 | public int page { get; set; } = 1;
32 |
33 | public int pageSize { get; set; } = 10;
34 |
35 |
36 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Furion/MyApp2.cs:
--------------------------------------------------------------------------------
1 | // using Microsoft.AspNetCore.Hosting;
2 | // using Microsoft.Extensions.Configuration;
3 | //
4 | // namespace Vben.Common.Core;
5 | //
6 | // public class MyApp2
7 | // {
8 | // public static HttpContext HttpContext => App.HttpContext;
9 | //
10 | // public static TService GetService() where TService : class
11 | // {
12 | // return App.GetService();
13 | // }
14 | //
15 | // public static TOptions GetOptions(IServiceProvider serviceProvider = default)
16 | // where TOptions : class, new()
17 | // {
18 | // return App.GetOptions(serviceProvider);
19 | // }
20 | //
21 | // public static T GetOptions(string key)
22 | // {
23 | // return App.Configuration.GetSection(key).Get();
24 | // }
25 | //
26 | // public static IConfiguration Configuration;
27 | //
28 | // public static IServiceProvider ServiceProvider;
29 | //
30 | // public static IWebHostEnvironment WebHostEnvironment;
31 | // }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Tool/Dict/Data/ToolDictData.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Tool.Dict.Data;
2 |
3 | [SugarTable("tool_dict_data", TableDescription = "字典数据")]
4 | [Description("字典数据")]
5 | public class ToolDictData : BaseStrMainEntity
6 | {
7 | [SugarColumn(ColumnDescription = "排序号", IsNullable = true)]
8 | public int ornum { get; set; }
9 |
10 | [SugarColumn(ColumnDescription = "字典ID", Length = 36)]
11 | public string dicid { get; set; }
12 |
13 | ///
14 | /// 数据标签
15 | ///
16 | [SugarColumn(ColumnDescription = "数据标签", Length = 36,IsNullable = true)]
17 | public string dalab { get; set; }
18 |
19 | ///
20 | /// 数据键值
21 | ///
22 | [SugarColumn(ColumnDescription = "字典ID", Length = 36,IsNullable = true)]
23 | public string daval { get; set; }
24 |
25 |
26 | ///
27 | /// 显示样式
28 | ///
29 | [SugarColumn(ColumnDescription = "显示样式", Length = 36,IsNullable = true)]
30 | public string shsty { get; set; }
31 |
32 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Sqlsugar/Mvc/Entity/SysOrg.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Sqlsugar.Mvc.Entity;
2 |
3 | [SugarTable("sys_org", TableDescription = "组织架构表")]
4 | [Description("组织架构表")]
5 | public class SysOrg
6 | {
7 | [SugarColumn(ColumnDescription = "ID", IsPrimaryKey = true, Length = 36)]
8 | public string id { get; set; }
9 |
10 | [SugarColumn(ColumnDescription = "名称", IsNullable = true, Length = 128)]
11 | public string name { get; set; }
12 |
13 | //1为机构,2为部门,4为岗位,8为用户,16为群组,32为角色
14 | [SugarColumn(ColumnDescription = "类型", IsNullable = true)]
15 | public int type { get; set; }
16 |
17 |
18 | public SysOrg()
19 | {
20 | }
21 |
22 | public SysOrg(string id)
23 | {
24 | this.id = id;
25 | }
26 |
27 | public SysOrg(string id, string name)
28 | {
29 | this.id = id;
30 | this.name = name;
31 | }
32 |
33 | public SysOrg(string id, string name, int type)
34 | {
35 | this.id = id;
36 | this.name = name;
37 | this.type = type;
38 | }
39 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Auth/User/RouterVo.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Auth.User;
2 |
3 | public class RouterVo
4 | {
5 | /*
6 | * 路由名字
7 | */
8 | public string name { get; set; }
9 |
10 | /**
11 | * 路由地址
12 | */
13 | public string path { get; set; }
14 |
15 | /**
16 | * 是否隐藏路由,当设置 true 的时候该路由不会再侧边栏出现
17 | */
18 | public bool hidden { get; set; }
19 |
20 | /**
21 | * 重定向地址,当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
22 | */
23 | public string redirect { get; set; }
24 |
25 | /**
26 | * 组件地址
27 | */
28 | public string component { get; set; }
29 |
30 | /**
31 | * 路由参数:如 {"id": 1, "name": "ry"}
32 | */
33 | public string query { get; set; }
34 |
35 | /**
36 | * 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面
37 | */
38 | public bool alwaysShow { get; set; }
39 |
40 | /**
41 | * 其他元素
42 | */
43 | public MetaVo meta { get; set; }
44 |
45 | /**
46 | * 子路由
47 | */
48 | public List children { get; set; }
49 |
50 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Tool/Dict/Main/ToolDictMainService.cs:
--------------------------------------------------------------------------------
1 | using Vben.Base.Tool.Dict.Data;
2 |
3 | namespace Vben.Base.Tool.Dict.Main;
4 |
5 | [Service]
6 | public class ToolDictMainService : BaseStrMainService
7 | {
8 | public ToolDictMainService(SqlSugarRepository repo)
9 | {
10 | this.repo = repo;
11 | }
12 |
13 | public async Task> findData(string code)
14 | {
15 | string sql = "select t.dalab,t.daval,t.shsty from tool_dict_data t inner join tool_dict_main m on m.id=t.dicid where m.code = @code and t.avtag="+ Db.True+" order by m.ornum";
16 | var list = await repo.Context.Ado.SqlQueryAsync(sql,new { code });
17 | var voList = new List();
18 | foreach (var item in list)
19 | {
20 | var vo = new ToolDictDataVo();
21 | vo.label=item.dalab;
22 | vo.value=item.daval;
23 | vo.shsty=item.shsty;
24 | voList.Add(vo);
25 | }
26 | return voList;
27 | }
28 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Mon/Cache/MonCacheApi.cs:
--------------------------------------------------------------------------------
1 | using NewLife.Caching;
2 |
3 | namespace Vben.Base.Mon.Cache;
4 | [Route("mon/cache")]
5 | [ApiDescriptionSettings("Mon", Tag = "缓存监控")]
6 | public class MonCacheApi : ControllerBase
7 | {
8 |
9 | [HttpGet]
10 | public CacheInfoVo GetInfo(string id)
11 | {
12 | var redis = MyApp.GetRequiredService();
13 | IDictionary dict= redis.GetInfo(true);
14 | CacheInfoVo infoVo = new CacheInfoVo();
15 | infoVo.info = dict;
16 | foreach (var item in dict)
17 | {
18 | if (item.Key.StartsWith("cmdstat_"))
19 | {
20 | var value= item.Value.Split("calls=")[1].Split(",")[0];
21 | infoVo.commandStats.Add(new CacheCommandVo{name=item.Key.Substring("cmdstat_".Length),value=value});
22 | }
23 | else if (item.Key=="db0")
24 | {
25 | infoVo.dbSize = int.Parse(item.Value.Split("keys=")[1].Split(",")[0]);
26 | }
27 | }
28 | return infoVo;
29 | }
30 |
31 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Profile/SysProfileApi.cs:
--------------------------------------------------------------------------------
1 | using Vben.Base.Sys.Org.User;
2 |
3 | namespace Vben.Base.Sys.Profile;
4 |
5 | [Route("system/user/profile")]
6 | [ApiDescriptionSettings("Sys", Tag = "个人信息")]
7 | public class SysProfileApi(SysOrgUserService userService) : ControllerBase
8 | {
9 |
10 | [HttpGet]
11 | public async Task GetProfile()
12 | {
13 | SysOrgUser user= await userService.SingleAsync(XuserUtil.getUserId());
14 | ProfileUserVo vo=new ProfileUserVo();
15 | vo.userId=user.id;
16 | vo.email=user.email;
17 | vo.sex=user.sex;
18 | vo.deptId=user.depid;
19 | vo.userName = user.usnam;
20 | vo.userType=user.type+"";
21 | vo.nickName = user.name;
22 | vo.phonenumber= user.monum;
23 | // vo.deptName = user.d setDeptName(user.getDepna());
24 | vo.loginIp=user.loip;
25 | vo.loginDate=user.lotim;
26 | vo.avatar=user.avatar;
27 | var todo = new Dictionary
28 | {
29 | {"user", vo}
30 | };
31 | return todo;
32 | }
33 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2026 vben
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/vben-apps/Vben.Demo/Demo/Link/Item/DemoLinkItem.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Admin.Demo.Link.Item;
2 |
3 | [SugarTable("demo_link_item", TableDescription = "关联子表")]
4 | public class DemoLinkItem
5 | {
6 | ///
7 | /// Id主键
8 | ///
9 | [SugarColumn(ColumnDescription = "Id主键", IsPrimaryKey = true, Length = 32)]
10 | public string id { get; set; }
11 |
12 | ///
13 | /// 名称
14 | ///
15 | [SugarColumn(ColumnDescription = "名称", IsNullable = true, Length = 128)]
16 | public string name { get; set; }
17 |
18 |
19 | ///
20 | /// 主表ID
21 | ///
22 | [SugarColumn(ColumnDescription = "主表ID", IsNullable = true)]
23 | public long maiid { get; set; }
24 |
25 | ///
26 | /// 排序号
27 | ///
28 | [SugarColumn(ColumnDescription = "排序号", IsNullable = true)]
29 | public int ornum { get; set; }
30 |
31 | ///
32 | /// 备注
33 | ///
34 | [SugarColumn(ColumnDescription = "备注", IsNullable = true, Length = 255)]
35 | public string notes { get; set; }
36 |
37 | }
38 |
39 |
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Core/Filter/MyUnitOfWorkAttribute.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Core.Filter;
2 |
3 | ///
4 | /// SqlSugar 工作单元配置特性
5 | ///
6 | [AttributeUsage(AttributeTargets.Method)]
7 | public class MyUnitOfWorkAttribute : System.Attribute
8 | {
9 | ///
10 | /// 构造函数
11 | ///
12 | public MyUnitOfWorkAttribute()
13 | {
14 | }
15 |
16 | ///
17 | /// 构造函数
18 | ///
19 | ///
20 | /// 支持传入事务隔离级别 参数值
21 | ///
22 | /// 事务隔离级别
23 | public MyUnitOfWorkAttribute(IsolationLevel isolationLevel)
24 | {
25 | IsolationLevel = isolationLevel;
26 | }
27 |
28 | ///
29 | /// 事务隔离级别
30 | ///
31 | ///
32 | /// 默认:,参见:
33 | /// 说明:当事务A更新某条数据的时候,不容许其他事务来更新该数据,但可以进行读取操作
34 | ///
35 | public IsolationLevel IsolationLevel { get; set; } = IsolationLevel.ReadCommitted;
36 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Core/Const/CommonConst.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Core.Const;
2 |
3 | public class CommonConst
4 | {
5 | ///
6 | /// 用户缓存
7 | ///
8 | public const string CACHE_KEY_USER = "user_";
9 |
10 | ///
11 | /// 菜单缓存
12 | ///
13 | public const string CACHE_KEY_MENU = "menu_";
14 |
15 | ///
16 | /// 权限缓存
17 | ///
18 | public const string CACHE_KEY_PERMISSION = "permission_";
19 |
20 | ///
21 | /// 数据范围缓存
22 | ///
23 | public const string CACHE_KEY_DATASCOPE = "datascope_";
24 |
25 | ///
26 | /// 验证码缓存
27 | ///
28 | public const string CACHE_KEY_CODE = "vercode_";
29 |
30 |
31 | public static string[] ENTITY_ASSEMBLY_NAME = new string[] { "Vben.Common.Core", "Vben.App" };
32 |
33 | ///
34 | /// 库表实体信息缓存
35 | ///
36 | public const string CACHE_KEY_ENTITYINFO = "tableentity";
37 |
38 | ///
39 | /// 所有权限缓存
40 | ///
41 | public const string CACHE_KEY_ALLPERMISSION = "allpermission";
42 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Core/Vben.Common.Core.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 1701;1702;1591
5 | Vben.Common.Core.xml
6 | Vben.Common.Core
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Sqlsugar/Mvc/Service/BaseService.cs:
--------------------------------------------------------------------------------
1 | using Vben.Common.Sqlsugar.Config;
2 | using Vben.Common.Sqlsugar.Mvc.Entity;
3 |
4 | namespace Vben.Common.Sqlsugar.Mvc.Service;
5 |
6 | //简单表Service基类,提供简单Entity增删改查的通用方法
7 | public class BaseService where TEntity : BaseEntity, new()
8 | {
9 |
10 | public SqlSugarRepository repo { get; set; }
11 |
12 | //查询单个实体详细信息
13 | public async Task SingleAsync(string id)
14 | {
15 | return await repo.GetSingleAsync(t => t.id == id);
16 | }
17 |
18 | //新增
19 | public async Task InsertAsync(TEntity entity)
20 | {
21 | if (string.IsNullOrEmpty(entity.id))
22 | {
23 | entity.id = YitIdHelper.NextId() + "";
24 | }
25 |
26 | await repo.InsertAsync(entity);
27 | }
28 |
29 | //修改
30 | public async Task UpdateAsync(TEntity entity)
31 | {
32 | await repo.UpdateAsync(entity);
33 | }
34 |
35 | //删除
36 | public async Task DeleteAsync(string ids)
37 | {
38 | var idArr = ids.Split(",");
39 | await repo.Context.Deleteable().In(idArr).ExecuteCommandAsync();
40 | }
41 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Mon/Login/Log/MonLoginLogApi.cs:
--------------------------------------------------------------------------------
1 | using Vben.Base.Mon.Log.Login;
2 |
3 | namespace Vben.Base.Mon.Login.Log;
4 |
5 | [Route("mon/login/log")]
6 | [ApiDescriptionSettings("Mon", Tag = "登录日志")]
7 | public class MonLoginLogApi(MonLoginLogService service) : ControllerBase
8 | {
9 | [HttpGet]
10 | public async Task Get(string name)
11 | {
12 | var pp = XreqUtil.GetPp();
13 | var items = await service.repo.AsQueryable()
14 | .WhereIF(!string.IsNullOrWhiteSpace(name), t => t.name.Contains(name.Trim()))
15 | .ToPageListAsync(pp.page, pp.pageSize, pp.total);
16 | return RestPageResult.Build(pp.total.Value, items);
17 | }
18 |
19 | [HttpGet("info/{id}")]
20 | public async Task GetInfo(string id)
21 | {
22 | return await service.SingleAsync(id);
23 | }
24 |
25 | [HttpDelete("{ids}")]
26 | public async Task Delete(string ids)
27 | {
28 | await service.DeleteAsync(ids);
29 | }
30 |
31 | [HttpDelete("all")]
32 | public async Task DeleteAll()
33 | {
34 | await service.repo.Context.Deleteable().ExecuteCommandAsync();
35 | }
36 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Mon/Online/Hub/IOnlineUserHub.cs:
--------------------------------------------------------------------------------
1 | // Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
2 | //
3 | // 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
4 | //
5 | // 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
6 |
7 | using Vben.Base.Sys.Notice;
8 |
9 | namespace Admin.NET.Core;
10 |
11 | public interface IOnlineUserHub
12 | {
13 | ///
14 | /// 在线用户列表
15 | ///
16 | ///
17 | ///
18 | Task OnlineUserList(OnlineUserList context);
19 |
20 | ///
21 | /// 强制下线
22 | ///
23 | ///
24 | ///
25 | Task ForceOffline(object context);
26 |
27 | ///
28 | /// 发布站内消息
29 | ///
30 | ///
31 | ///
32 | Task PublicNotice(SysNotice context);
33 |
34 | ///
35 | /// 接收消息
36 | ///
37 | ///
38 | ///
39 | Task ReceiveMessage(object context);
40 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Core/Wrapper/ModelValidationFilter.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Mvc.Filters;
2 | using Vben.Common.Core.Filter;
3 |
4 | namespace Vben.Common.Core.Wrapper;
5 |
6 | public class ModelValidationFilter : IAsyncActionFilter
7 | {
8 | public async Task OnActionExecutionAsync(ActionExecutingContext context,
9 | ActionExecutionDelegate next)
10 | {
11 | if (!context.ModelState.IsValid)
12 | {
13 | var errors = context.ModelState
14 | .Where(e => e.Value.Errors.Count > 0)
15 | .Select(e => new ValidationError
16 | {
17 | Field = e.Key,
18 | Errors = e.Value.Errors.Select(err => err.ErrorMessage).ToList()
19 | })
20 | .ToList();
21 |
22 | var apiResult = ApiResult.Fail("数据验证失败", 400, errors);
23 | context.Result = new BadRequestObjectResult(apiResult);
24 | return;
25 | }
26 |
27 | await next();
28 | }
29 | }
30 |
31 | public class ValidationError
32 | {
33 | public string Field { get; set; }
34 | public List Errors { get; set; }
35 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Pub/Oss/PubOssApi.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Authorization;
2 | using Vben.Base.Tool.Oss.Main;
3 | using Vben.Base.Tool.Oss.Root;
4 |
5 | namespace Vben.Base.Pub.Oss;
6 |
7 | [Route("pub/oss")]
8 | [ApiDescriptionSettings("Pub", Tag = "文件存储")]
9 | public class PubOssApi(ToolOssMainService ossService) : ControllerBase
10 | {
11 | [HttpPost("upload")]
12 | // [NonUnify]
13 | public async Task PostUpload(IFormFile file)
14 | {
15 | var sysFile = await ossService.UploadFile(file);
16 | return sysFile;
17 | }
18 |
19 | [HttpGet("download")]
20 | public IActionResult GetDownload(string table, string id)
21 | {
22 | return ossService.DownloadFile(table, id);
23 | }
24 |
25 | [HttpGet("info")]
26 | public ToolOssMain GetInfo(string id)
27 | {
28 | return ossService.GetInfo(id);
29 | }
30 |
31 | [HttpGet("infos")]
32 | public List GetInfos(string ids)
33 | {
34 | return ossService.GetInfos(ids);
35 | }
36 |
37 | [HttpGet("login2")]
38 | // [AllowAnonymous]
39 | public Task Test()
40 | {
41 | return Task.FromResult(0);
42 | }
43 |
44 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Mon/Oper/Log/MonOperLogApi.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Mon.Oper.Log;
2 |
3 | [Route("mon/oper/log")]
4 | [ApiDescriptionSettings("Mon", Tag = "操作日志")]
5 | public class MonOperLogApi(SqlSugarRepository repo) : ControllerBase
6 | {
7 | [HttpGet]
8 | public async Task Get()
9 | {
10 | var pp = XreqUtil.GetPp();
11 | var items = await repo.Context.Queryable()
12 | .OrderBy(t => t.optim, OrderByType.Desc)
13 | .ToPageListAsync(pp.page, pp.pageSize, pp.total);
14 | return RestPageResult.Build(pp.total.Value, items);
15 | }
16 |
17 | [HttpGet("info/{id}")]
18 | public async Task GetInfo(string id)
19 | {
20 | return await repo.GetSingleAsync(t => t.id == id);
21 | }
22 |
23 | [HttpDelete("{ids}")]
24 | public async Task Delete(string ids)
25 | {
26 |
27 | var idArr = ids.Split(",");
28 | await repo.Context.Deleteable().In(idArr).ExecuteCommandAsync();
29 | }
30 |
31 | [HttpDelete("all")]
32 | public async Task DeleteAll()
33 | {
34 | await repo.Context.Deleteable().ExecuteCommandAsync();
35 | }
36 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Mon/Job/Log/MonJobLogApi.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Mon.Job.Log;
2 |
3 | [Route("mon/job/log")]
4 | [ApiDescriptionSettings("Mon", Tag = "定时任务-日志")]
5 | public class MonJobLogApi(MonJobLogService monJobLogService) : ControllerBase
6 | {
7 | [HttpGet]
8 | public async Task Get(string name)
9 | {
10 | var pp = XreqUtil.GetPp();
11 | var items = await monJobLogService.repo.Context.Queryable()
12 | .Select((t) => new { t.id, t.name, t.sttim, t.entim, t.msg, t.ret })
13 | .WhereIF(!string.IsNullOrWhiteSpace(name), t => t.name.Contains(name.Trim()))
14 | .OrderByDescending(t=>t.sttim)
15 | .ToPageListAsync(pp.page, pp.pageSize, pp.total);
16 | return RestPageResult.Build(pp.total.Value, items);
17 | }
18 |
19 | [HttpGet("info/{id}")]
20 | public async Task GetInfo(string id)
21 | {
22 | var cate = await monJobLogService.SingleAsync(id);
23 | return cate;
24 | }
25 |
26 | [HttpDelete("{ids}")]
27 | public async Task Delete(string ids)
28 | {
29 | var idArr = ids.Split(",");
30 | await monJobLogService.DeleteAsync(idArr);
31 | }
32 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Core/Wrapper/Extension.Validate.cs:
--------------------------------------------------------------------------------
1 | //using Microsoft.AspNetCore.Http;
2 |
3 | namespace Vben.Common.Core;
4 |
5 | public static partial class Extensions
6 | {
7 | public static bool IsEmpty(this object value)
8 | {
9 | if (value != null && !string.IsNullOrEmpty(value.ParseToString()))
10 | {
11 | return false;
12 | }
13 | else
14 | {
15 | return true;
16 | }
17 | }
18 |
19 | public static bool IsNotEmpty(this object value)
20 | {
21 | return !IsEmpty(value);
22 | }
23 |
24 | public static bool IsNullOrZero(this object value)
25 | {
26 | if (value == null || value.ParseToString().Trim() == "0")
27 | {
28 | return true;
29 | }
30 | else
31 | {
32 | return false;
33 | }
34 | }
35 |
36 | //public static bool IsAjaxRequest(this HttpRequest request)
37 | //{
38 | // if (request == null)
39 | // throw new ArgumentNullException("request");
40 |
41 | // if (request.Headers != null)
42 | // return request.Headers["X-Requested-With"] == "XMLHttpRequest";
43 | // return false;
44 | //}
45 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Org/Group/SysOrgGroupService.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Org.Group;
2 |
3 | [Service]
4 | public class SysOrgGroupService : BaseStrMainService
5 | {
6 | public SysOrgGroupService(SqlSugarRepository repo)
7 | {
8 | base.repo = repo;
9 | }
10 |
11 | public async Task InsertAsync(SysOrgGroup group)
12 | {
13 | group.id = YitIdHelper.NextId() + "";
14 | await repo.Context.Ado.BeginTranAsync();
15 | await repo.Context.InsertNav(group).Include(it => it.members).ExecuteCommandAsync();
16 | await repo.Context.Insertable(new SysOrg { id = group.id, name = group.name, type = 16 }).ExecuteCommandAsync();
17 | await repo.Context.Ado.CommitTranAsync();
18 | }
19 |
20 | public async Task UpdateAsync(SysOrgGroup group)
21 | {
22 | await repo.Context.Ado.BeginTranAsync();
23 | await repo.Context.UpdateNav(group).Include(it => it.members,new UpdateNavOptions { ManyToManyIsUpdateA=true }).ExecuteCommandAsync();
24 | await repo.Context.Updateable(new SysOrg { id = group.id, name = group.name, type = 16 })
25 | .UpdateColumns(it => new { it.name }).ExecuteCommandAsync();
26 | await repo.Context.Ado.CommitTranAsync();
27 | }
28 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Core/Wrapper/ServiceCollectionExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Core.Wrapper;
2 |
3 | public static class ServiceCollectionExtensions
4 | {
5 | ///
6 | /// 添加全局包装器(中间件方案)
7 | ///
8 | public static IServiceCollection AddGlobalWrapperMiddleware(
9 | this IServiceCollection services,
10 | Action configure = null)
11 | {
12 | var options = new GlobalWrapperOptions();
13 | configure?.Invoke(options);
14 |
15 | services.AddSingleton(Options.Create(options));
16 | return services;
17 | }
18 |
19 | ///
20 | /// 添加模型验证过滤器(配合使用)
21 | ///
22 | public static IServiceCollection AddModelValidationFilter(this IServiceCollection services)
23 | {
24 | services.Configure(options =>
25 | {
26 | options.SuppressModelStateInvalidFilter = true;
27 | });
28 |
29 | services.AddScoped();
30 | services.Configure(options =>
31 | {
32 | options.Filters.AddService(order: int.MaxValue - 20);
33 | });
34 |
35 | return services;
36 | }
37 |
38 |
39 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Mon/Log/Error/MonLogErrorApi.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Mon.Log.Error;
2 |
3 | [Route("mon/log/error")]
4 | [ApiDescriptionSettings("Mon", Tag = "错误日志")]
5 | public class MonLogErrorApi(SqlSugarRepository repo) : ControllerBase
6 | {
7 | [HttpGet]
8 | public async Task Get(string name)
9 | {
10 | var pp = XreqUtil.GetPp();
11 | var items = await repo.Context.Queryable()
12 | .WhereIF(!string.IsNullOrWhiteSpace(name), t => t.name.Contains(name.Trim()))
13 | .OrderBy(t => t.crtim, OrderByType.Desc)
14 | .ToPageListAsync(pp.page, pp.pageSize, pp.total);
15 | return RestPageResult.Build(pp.total.Value, items);
16 | }
17 |
18 | [HttpGet("info/{id}")]
19 | public async Task GetInfo(string id)
20 | {
21 | return await repo.GetSingleAsync(t => t.id == id);
22 | }
23 |
24 | [HttpDelete("{ids}")]
25 | public async Task Delete(string ids)
26 | {
27 | var idArr = ids.Split(",");
28 | await repo.Context.Deleteable().In(idArr).ExecuteCommandAsync();
29 | }
30 |
31 | [HttpDelete("all")]
32 | public async Task DeleteAll()
33 | {
34 | await repo.Context.Deleteable().ExecuteCommandAsync();
35 | }
36 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Core/Enum/DataOpType.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Core.Enum;
2 |
3 | ///
4 | /// 数据操作类型
5 | ///
6 | public enum DataOpType
7 | {
8 | ///
9 | /// 其它
10 | ///
11 | OTHER,
12 |
13 | ///
14 | /// 增加
15 | ///
16 | ADD,
17 |
18 | ///
19 | /// 删除
20 | ///
21 | DELETE,
22 |
23 | ///
24 | /// 编辑
25 | ///
26 | EDIT,
27 |
28 | ///
29 | /// 更新
30 | ///
31 | UPDATE,
32 |
33 | ///
34 | /// 查询
35 | ///
36 | QUERY,
37 |
38 | ///
39 | /// 详情
40 | ///
41 | DETAIL,
42 |
43 | ///
44 | /// 树
45 | ///
46 | TREE,
47 |
48 | ///
49 | /// 导入
50 | ///
51 | IMPORT,
52 |
53 | ///
54 | /// 导出
55 | ///
56 | EXPORT,
57 |
58 | ///
59 | /// 授权
60 | ///
61 | GRANT,
62 |
63 | ///
64 | /// 强退
65 | ///
66 | FORCE,
67 |
68 | ///
69 | /// 清空
70 | ///
71 | CLEAN,
72 |
73 | ///
74 | /// 修改状态
75 | ///
76 | CHANGE_STATUS
77 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Admin/Properties/Configs/Cache.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
3 |
4 | // 缓存配置
5 | "Cache": {
6 | "Prefix": "vben_", // 全局缓存前缀
7 | "CacheType": "Redis", // Memory、Redis
8 | "Redis": {
9 | "Configuration": "server=127.0.0.1:6379;password=;db=5;", // Redis连接字符串
10 | "Prefix": "vben_", // Redis前缀(目前没用)
11 | "MaxMessageSize": "1048576", // 最大消息大小 默认1024 * 1024
12 | "AutoDetect": false // 自动检测集群节点 阿里云的Redis分布式集群使用代理模式,需要设置为false关闭自动检测;如果不用代理地址,就配置多个节点地址并打开自动检测
13 | }
14 | },
15 | // 集群配置
16 | "Cluster": {
17 | "Enabled": false, // 启用集群:前提开启Redis缓存模式
18 | "ServerId": "vben", // 服务器标识
19 | "ServerIp": "", // 服务器IP
20 | "SignalR": {
21 | "RedisConfiguration": "127.0.0.1:6379,ssl=false,password=,defaultDatabase=5",
22 | "ChannelPrefix": "signalrPrefix_"
23 | },
24 | "DataProtecteKey": "vben:DataProtection-Keys",
25 | "IsSentinel": false, // 是否哨兵模式
26 | "SentinelConfig": {
27 | "DefaultDb": "4",
28 | "EndPoints": [ // 哨兵端口
29 | // "10.10.0.124:26380"
30 | ],
31 | "MainPrefix": "vben:",
32 | "Password": "123456",
33 | "SentinelPassword": "vben",
34 | "ServiceName": "vben",
35 | "SignalRChannelPrefix": "signalR:"
36 | }
37 | }
38 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Demo/Properties/Configs/Cache.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
3 |
4 | // 缓存配置
5 | "Cache": {
6 | "Prefix": "vben_", // 全局缓存前缀
7 | "CacheType": "Redis", // Memory、Redis
8 | "Redis": {
9 | "Configuration": "server=127.0.0.1:6379;password=;db=5;", // Redis连接字符串
10 | "Prefix": "vben_", // Redis前缀(目前没用)
11 | "MaxMessageSize": "1048576", // 最大消息大小 默认1024 * 1024
12 | "AutoDetect": false // 自动检测集群节点 阿里云的Redis分布式集群使用代理模式,需要设置为false关闭自动检测;如果不用代理地址,就配置多个节点地址并打开自动检测
13 | }
14 | },
15 | // 集群配置
16 | "Cluster": {
17 | "Enabled": false, // 启用集群:前提开启Redis缓存模式
18 | "ServerId": "vben", // 服务器标识
19 | "ServerIp": "", // 服务器IP
20 | "SignalR": {
21 | "RedisConfiguration": "127.0.0.1:6379,ssl=false,password=,defaultDatabase=5",
22 | "ChannelPrefix": "signalrPrefix_"
23 | },
24 | "DataProtecteKey": "vben:DataProtection-Keys",
25 | "IsSentinel": false, // 是否哨兵模式
26 | "SentinelConfig": {
27 | "DefaultDb": "4",
28 | "EndPoints": [ // 哨兵端口
29 | // "10.10.0.124:26380"
30 | ],
31 | "MainPrefix": "vben:",
32 | "Password": "123456",
33 | "SentinelPassword": "vben",
34 | "ServiceName": "vben",
35 | "SignalRChannelPrefix": "signalR:"
36 | }
37 | }
38 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Admin/Launch/Init/DataInit.cs:
--------------------------------------------------------------------------------
1 | using Vben.Common.Sqlsugar.Config;
2 | using Vben.Common.Sqlsugar.Mvc.Entity;
3 |
4 | namespace Vben.Admin.Launch.Init;
5 |
6 | //数据库初始化入口
7 | public class DataInit : ITransient
8 | {
9 | private readonly SysOrgInit _orgInit;
10 | private readonly SysPermInit _permInit;
11 | private readonly ToolInit _toolInit;
12 | private readonly SqlSugarRepository _sysOrgRepo;
13 |
14 | public DataInit(SysOrgInit orgInit,
15 | SysPermInit permInit,
16 | ToolInit toolInit,
17 | SqlSugarRepository sysOrgRepo
18 | )
19 | {
20 | _orgInit = orgInit;
21 | _permInit = permInit;
22 | _toolInit = toolInit;
23 | _sysOrgRepo = sysOrgRepo;
24 | }
25 |
26 | //首次启动,数据库生成后,初始化组织架构,菜单,权限角色,接口等信息
27 | public async Task Init()
28 | {
29 | var sysOrg = _sysOrgRepo.GetSingle(it => it.id == "u1");
30 | if (sysOrg == null)
31 | {
32 | Console.WriteLine("首次启动系统,正在进行数据库初始化,请耐心等待。");
33 | await _orgInit.initData();
34 | Console.WriteLine("1 初始化组长架构完毕");
35 | await _permInit.initData();
36 | Console.WriteLine("2 初始化权限完毕");
37 | await _toolInit.InitData();
38 | Console.WriteLine("3 初始化辅助工具完毕");
39 | }
40 | }
41 |
42 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Notice/SysNotice.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Notice;
2 |
3 |
4 | [SugarTable("sys_notice", TableDescription = "系统通知")]
5 | [Description("系统通知")]
6 | public class SysNotice
7 | {
8 | [SugarColumn(ColumnDescription = "Id主键", IsPrimaryKey = true)]
9 | public long id { get; set; }
10 |
11 | [SugarColumn(ColumnDescription = "公告标题", IsNullable = true, Length = 64)]
12 | public string name { get; set; }
13 |
14 | [SugarColumn(ColumnDescription = "公告内容", IsNullable = true, Length = 2000)]
15 | public string content { get; set; }
16 |
17 | [SugarColumn(ColumnDescription = "公告类型(1通知 2公告)", IsNullable = true)]
18 | public int type { get; set; }
19 |
20 | [SugarColumn(ColumnDescription = "备注", IsNullable = true, Length = 255)]
21 | public string notes { get; set; }
22 |
23 | [SugarColumn(ColumnDescription = "创建时间", IsNullable = true, IsOnlyIgnoreUpdate = true)]
24 | public DateTime? crtim { get; set; } = DateTime.Now;
25 |
26 | [SugarColumn(ColumnDescription = "更新时间", IsNullable = true)]
27 | public DateTime? uptim { get; set; } = DateTime.Now;
28 |
29 | [SugarColumn(ColumnDescription = "是否可用", IsNullable = true)]
30 | public bool avtag { get; set; }
31 |
32 | [SugarColumn(ColumnDescription = "排序号", IsNullable = true)]
33 | public int ornum { get; set; }
34 |
35 | }
--------------------------------------------------------------------------------
/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 |
6 |
7 |
8 |
9 |
10 |
11 | enable
12 | 12
13 | enable
14 |
15 |
16 |
17 | 1
18 | 0
19 | 0
20 |
21 |
22 |
23 | $(VersionMajor).$(VersionMinor).$(VersionPatch)
24 | $(VersionMajor).$(VersionMinor).$(VersionPatch)
25 | $(VersionMajor).$(VersionMinor).$(VersionPatch)
26 | $(VersionMajor).$(VersionMinor).$(VersionPatch)
27 |
28 |
29 | 你的公司名
30 | 你的产品名
31 | Copyright © $([System.DateTime]::Now.Year) $(Company)
32 |
33 |
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Tool/Dict/Cate/ToolDictCateApi.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Tool.Dict.Cate;
2 |
3 | [Route("tool/dict/cate")]
4 | [ApiDescriptionSettings("Tool", Tag = "字典分类")]
5 | public class ToolDictCateApi(ToolDictCateService service) : ControllerBase
6 | {
7 | [HttpGet]
8 | public async Task Get()
9 | {
10 | var pp = XreqUtil.GetPp();
11 | var items = await service.repo.Context.Queryable()
12 | .OrderBy(u => u.ornum)
13 | .Select((t) => new { t.id, t.name, t.notes })
14 | .ToPageListAsync(pp.page, pp.pageSize, pp.total);
15 | return RestPageResult.Build(pp.total.Value, items);
16 | }
17 |
18 | [HttpGet("info/{id}")]
19 | public async Task GetInfo(string id)
20 | {
21 | var cate = await service.repo.Context.Queryable()
22 | .Where(it => it.id == id).FirstAsync();
23 | return cate;
24 | }
25 |
26 | [HttpPost]
27 | public async Task Post([FromBody] ToolDictCate cate)
28 | {
29 | await service.InsertAsync(cate);
30 | }
31 |
32 | [HttpPut]
33 | public async Task Put([FromBody] ToolDictCate cate)
34 | {
35 | await service.UpdateAsync(cate);
36 | }
37 |
38 | [HttpDelete("{ids}")]
39 | public async Task Delete(string ids)
40 | {
41 | await service.DeleteAsync(ids);
42 | }
43 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Tool/Code/Root/CodeGenerateTemplate.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Tool.Code.Root;
2 |
3 | ///
4 | /// 代码生成模板
5 | ///
6 | public class CodeGenerateTemplate
7 | {
8 | //模板调用
9 | public static string QueryExp(string propertyName, string queryType)
10 | {
11 | if (queryType.Equals("EQ"))
12 | {
13 | return $"it => it.{propertyName} == parm.{propertyName})";
14 | }
15 |
16 | if (queryType.Equals("GTE"))
17 | {
18 | return $"it => it.{propertyName} >= parm.{propertyName})";
19 | }
20 |
21 | if (queryType.Equals("GT"))
22 | {
23 | return $"it => it.{propertyName} > parm.{propertyName})";
24 | }
25 |
26 | if (queryType.Equals("LT"))
27 | {
28 | return $"it => it.{propertyName} < parm.{propertyName})";
29 | }
30 |
31 | if (queryType.Equals("LTE"))
32 | {
33 | return $"it => it.{propertyName} <= parm.{propertyName})";
34 | }
35 |
36 | if (queryType.Equals("NE"))
37 | {
38 | return $"it => it.{propertyName} != parm.{propertyName})";
39 | }
40 |
41 | if (queryType.Equals("LIKE"))
42 | {
43 | return $"it => it.{propertyName}.Contains(parm.{propertyName}))";
44 | }
45 |
46 | return $"it => it.{propertyName} == parm.{propertyName})";
47 | }
48 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Profile/ProfileUserVo.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Profile;
2 |
3 | public class ProfileUserVo
4 | {
5 | /**
6 | * 用户ID
7 | */
8 | public string userId {get;set;}
9 |
10 | /**
11 | * 租户ID
12 | */
13 | public string tenantId {get;set;}
14 |
15 | /**
16 | * 部门ID
17 | */
18 | public string deptId {get;set;}
19 |
20 | /**
21 | * 用户账号
22 | */
23 | public string userName {get;set;}
24 |
25 | /**
26 | * 用户昵称
27 | */
28 | public string nickName {get;set;}
29 |
30 | /**
31 | * 用户类型(sys_user系统用户)
32 | */
33 | public string userType {get;set;}
34 |
35 | /**
36 | * 用户邮箱
37 | */
38 | public string email {get;set;}
39 |
40 | /**
41 | * 手机号码
42 | */
43 | public string phonenumber {get;set;}
44 |
45 | /**
46 | * 用户性别(0男 1女 2未知)
47 | */
48 | public string sex {get;set;}
49 |
50 | /**
51 | * 头像地址
52 | */
53 | // @Translation(type = TransConstant.OSS_ID_TO_URL)
54 | public string avatar {get;set;}
55 |
56 | /**
57 | * 最后登录IP
58 | */
59 | public string loginIp {get;set;}
60 |
61 | /**
62 | * 最后登录时间
63 | */
64 | public DateTime loginDate {get;set;}
65 |
66 | /**
67 | * 部门名
68 | */
69 | // @Translation(type = TransConstant.DEPT_ID_TO_NAME, mapper = "deptId")
70 | public string deptName {get;set;}
71 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | global using SqlSugar;
2 | global using Microsoft.AspNetCore.Http;
3 | global using Microsoft.AspNetCore.Mvc;
4 | global using Microsoft.AspNetCore.Mvc.Controllers;
5 | global using Microsoft.AspNetCore.Mvc.Filters;
6 | global using Microsoft.Extensions.Options;
7 | global using Microsoft.Extensions.DependencyInjection;
8 | global using Microsoft.AspNetCore.Authorization;
9 | global using System.ComponentModel;
10 | global using System.ComponentModel.DataAnnotations;
11 | global using System.Diagnostics;
12 | global using System.Runtime.InteropServices;
13 | global using System.Security.Claims;
14 | global using System.Text;
15 | global using UAParser;
16 | global using Yitter.IdGenerator;
17 | global using Vben.Common.Core;
18 | global using Vben.Common.Core.Utils;
19 | global using Vben.Common.Core.Attribute;
20 | global using Vben.Common.Core.Manager;
21 | global using Vben.Common.Core.Config;
22 | global using Vben.Common.Sqlsugar.Config;
23 | global using Vben.Common.Sqlsugar.Mvc.Pojo;
24 | global using Vben.Common.Sqlsugar.Mvc.Dao;
25 | global using Vben.Common.Sqlsugar.Mvc.Entity;
26 | global using Vben.Common.Sqlsugar.Mvc.Api;
27 | global using Vben.Common.Sqlsugar.Mvc.Service;
28 | global using Newtonsoft.Json;
29 |
30 | global using Furion;
31 | global using Furion.DependencyInjection;
32 | global using Furion.EventBus;
33 | global using Furion.FriendlyException;
34 | global using Furion.JsonSerialization;
35 |
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Tool/Num/ToolNum.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Tool.Num;
2 |
3 | [SugarTable("tool_num", TableDescription = "编号工具")]
4 | [Description("编号策略表")]
5 | public class ToolNum : BaseEntity
6 | {
7 | [SugarColumn(ColumnDescription = "编号标签", IsNullable = true, Length = 100)]
8 | public string label { get; set; }
9 |
10 | [SugarColumn(ColumnDescription = "编号生成模式", Length = 32)]
11 | public string numod { get; set; }
12 |
13 | [SugarColumn(ColumnDescription = "编号前缀", IsNullable = true, Length = 32)]
14 | public string nupre { get; set; }
15 |
16 | [SugarColumn(ColumnDescription = "判断标记", IsNullable = true)]
17 | public bool nflag { get; set; } = true;
18 |
19 | [SugarColumn(ColumnDescription = "下一个编号", Length = 8, IsNullable = true)]
20 | public string nunex { get; set; }
21 |
22 | [SugarColumn(ColumnDescription = "编号长度")]
23 | public int nulen { get; set; }
24 |
25 | [SugarColumn(ColumnDescription = "当前日期", Length = 8, IsNullable = true)]
26 | public string cudat { get; set; }
27 |
28 | [SugarColumn(ColumnDescription = "创建时间", IsNullable = true, IsOnlyIgnoreUpdate = true)]
29 | public DateTime? crtim { get; set; } = DateTime.Now;
30 |
31 | [SugarColumn(ColumnDescription = "更新时间", IsNullable = true)]
32 | public DateTime? uptim { get; set; }
33 |
34 | [SugarColumn(ColumnDescription = "备注", IsNullable = true, Length = 64)]
35 | public string notes { get; set; }
36 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Carry/Message/Dto/MessageInput.cs:
--------------------------------------------------------------------------------
1 | // Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
2 | //
3 | // 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
4 | //
5 | // 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
6 |
7 | namespace Admin.NET.Core;
8 |
9 | public class MessageInput
10 | {
11 | ///
12 | /// 接收者用户Id
13 | ///
14 | public string ReceiveUserId { get; set; }
15 |
16 | ///
17 | /// 接收者名称
18 | ///
19 | public string ReceiveUserName { get; set; }
20 |
21 | ///
22 | /// 用户ID列表
23 | ///
24 | public List UserIds { get; set; }
25 |
26 | ///
27 | /// 消息标题
28 | ///
29 | public string Title { get; set; }
30 |
31 | ///
32 | /// 消息类型
33 | ///
34 | public MessageTypeEnum MessageType { get; set; }
35 |
36 | ///
37 | /// 消息内容
38 | ///
39 | public string Message { get; set; }
40 |
41 | ///
42 | /// 发送者Id
43 | ///
44 | public string SendUserId { get; set; }
45 |
46 | ///
47 | /// 发送者名称
48 | ///
49 | public string SendUserName { get; set; }
50 |
51 | ///
52 | /// 发送时间
53 | ///
54 | public DateTime SendTime { get; set; }
55 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Tool/Code/Root/CodeGenerateOption.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Tool.Code.Root;
2 |
3 | public class CodeGenerateOption
4 | {
5 | ///
6 | /// 项目命名空间
7 | ///
8 | public string BaseNamespace { get; set; }
9 |
10 | public string Namespace { get; set; }
11 |
12 | ///
13 | /// 下级命名空间
14 | ///
15 | public string SubNamespace { get; set; }
16 |
17 | ///
18 | /// 数据实体命名空间
19 | ///
20 | public string ModelsNamespace { get; set; }
21 |
22 | ///
23 | /// 输入输出数据实体名称空间
24 | ///
25 | public string DtosNamespace { get; set; }
26 |
27 | ///
28 | /// 仓储接口命名空间
29 | ///
30 | public string IRepositoriesNamespace { get; set; }
31 |
32 | ///
33 | /// 仓储实现名称空间
34 | ///
35 | public string RepositoriesNamespace { get; set; }
36 |
37 | ///
38 | /// 服务接口命名空间
39 | ///
40 | public string IServicsNamespace { get; set; }
41 |
42 | ///
43 | /// 服务接口实现命名空间
44 | ///
45 | public string ServicesNamespace { get; set; }
46 |
47 | ///
48 | /// Api控制器命名空间
49 | ///
50 | public string ApiControllerNamespace { get; set; }
51 |
52 | ///
53 | /// 去掉的表头字符
54 | ///
55 | public string ReplaceTableNameStr { get; set; }
56 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Tool/Num/ToolNumApi.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Tool.Num;
2 |
3 | [Route("tool/num")]
4 | [ApiDescriptionSettings("Tool", Tag = "编号工具")]
5 | public class ToolNumApi(ToolNumService service) : ControllerBase
6 | {
7 | [HttpGet("list")]
8 | public async Task GetList()
9 | {
10 | return await service.repo.GetListAsync();
11 | }
12 |
13 | [HttpGet]
14 | public async Task Get(string name)
15 | {
16 | var pp = XreqUtil.GetPp();
17 | var items = await service.repo.Context.Queryable()
18 | .WhereIF(!string.IsNullOrWhiteSpace(name), t
19 | => t.name.Contains(name.Trim()) || t.id.Contains(name.Trim()))
20 | .ToPageListAsync(pp.page, pp.pageSize, pp.total);
21 | return RestPageResult.Build(pp.total.Value, items);
22 | }
23 |
24 | [HttpGet("info/{id}")]
25 | public async Task GetInfo(string id)
26 | {
27 | return await service.SingleAsync(id);
28 | }
29 |
30 | [HttpPost]
31 | public async Task Post([FromBody] ToolNum main)
32 | {
33 | await service.InsertAsync(main);
34 | }
35 |
36 | [HttpPut]
37 | public async Task Put([FromBody] ToolNum main)
38 | {
39 | await service.UpdateAsync(main);
40 | }
41 |
42 | [HttpDelete("{ids}")]
43 | public async Task Delete(string ids)
44 | {
45 | await service.DeleteAsync(ids);
46 | }
47 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Config/SysConfig.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Config;
2 |
3 |
4 | [SugarTable("sys_config", TableDescription = "系统参数")]
5 | [Description("系统参数")]
6 | public class SysConfig
7 | {
8 | [SugarColumn(ColumnDescription = "Id主键", IsPrimaryKey = true)]
9 | public long id { get; set; }
10 |
11 | [SugarColumn(ColumnDescription = "参数名称", IsNullable = true, Length = 32)]
12 | public string name { get; set; }
13 |
14 | [SugarColumn(ColumnDescription = "参数键名", IsNullable = true, Length = 32)]
15 | public string kenam { get; set; }
16 |
17 | [SugarColumn(ColumnDescription = "参数键值", IsNullable = true, Length = 64)]
18 | public string keval { get; set; }
19 |
20 | [SugarColumn(ColumnDescription = "内置标记", IsNullable = true)]
21 | public bool intag { get; set; }
22 |
23 | [SugarColumn(ColumnDescription = "备注", IsNullable = true, Length = 255)]
24 | public string notes { get; set; }
25 |
26 | [SugarColumn(ColumnDescription = "创建时间", IsNullable = true, IsOnlyIgnoreUpdate = true)]
27 | public DateTime? crtim { get; set; } = DateTime.Now;
28 |
29 | [SugarColumn(ColumnDescription = "更新时间", IsNullable = true)]
30 | public DateTime? uptim { get; set; } = DateTime.Now;
31 |
32 | [SugarColumn(ColumnDescription = "是否可用", IsNullable = true)]
33 | public bool avtag { get; set; }
34 |
35 | [SugarColumn(ColumnDescription = "排序号", IsNullable = true)]
36 | public int ornum { get; set; }
37 |
38 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Org/Dept/SysOrgDept.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Org.Dept;
2 |
3 | [SugarTable("sys_org_dept", TableDescription = "组织架构-部门")]
4 | [Description("组织架构-部门")]
5 | public class SysOrgDept : BaseStrMainEntity
6 | {
7 | [SugarColumn(ColumnDescription = "父ID", IsNullable = true, Length = 32)]
8 | public string pid { get; set; }
9 |
10 | [SugarColumn(ColumnDescription = "层级", IsNullable = true, Length = 512)]
11 | public string tier { get; set; }
12 |
13 | [SugarColumn(ColumnDescription = "标签", IsNullable = true, Length = 32)]
14 | public string label { get; set; }
15 |
16 | [SugarColumn(ColumnDescription = "排序号", IsNullable = true)]
17 | public int ornum { get; set; }
18 |
19 | /**
20 | * 部门在整个组织架构sys_org表中类别为1,这个字段是进行部门细分的,比如分为集团、企业、机构、部门等
21 | */
22 | [SugarColumn(ColumnDescription = "部门类型", IsNullable = true)]
23 | public int type { get; set; }
24 |
25 | [SugarColumn(IsIgnore = true)]
26 | public List children { get; set; }
27 |
28 | [SugarColumn(ColumnDescription = "扩展字段1", IsNullable = true, Length = 32)]
29 | public string ex1 { get; set; }
30 |
31 | [SugarColumn(ColumnDescription = "扩展字段2", IsNullable = true, Length = 32)]
32 | public string ex2 { get; set; }
33 |
34 | [SugarColumn(ColumnDescription = "扩展字段3", IsNullable = true, Length = 32)]
35 | public string ex3 { get; set; }
36 |
37 | [SugarColumn(ColumnDescription = "扩展字段4", IsNullable = true, Length = 32)]
38 | public string ex4 { get; set; }
39 |
40 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Org/Rece/SysOrgReceService.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Org.Rece;
2 |
3 | [Service]
4 | public class SysOrgReceService
5 | {
6 |
7 | public readonly SqlSugarRepository _repo;
8 |
9 | public SysOrgReceService(SqlSugarRepository repo)
10 | {
11 | _repo = repo;
12 | }
13 |
14 | public async Task update(List reces)
15 | {
16 | string userId = XuserUtil.getUserId();
17 |
18 | List orgidList = new List();
19 | foreach (var rece in reces)
20 | {
21 | rece.oid = rece.id;
22 | rece.id = YitIdHelper.NextId() + "";
23 | rece.useid = userId;
24 | rece.uptim = DateTime.Now;
25 | orgidList.Add(rece.oid);
26 | }
27 |
28 | //数据库删除本次已传的记录
29 | await _repo.Context.Deleteable().Where("useid=@useid", new { useid = userId })
30 | .Where("oid in (@oid)", new { oid = orgidList.ToArray() }).ExecuteCommandAsync();
31 |
32 | //删除当前数据库最近10次前的数据
33 | RefAsync total = 0;
34 | var items = await _repo.Context.Queryable()
35 | .Where(it => it.useid == userId)
36 | .OrderBy(u => u.uptim, OrderByType.Desc)
37 | .Select((t) => t.id)
38 | .ToPageListAsync(2, 10, total);
39 | if (items.Count > 0)
40 | {
41 | await _repo.Context.Deleteable().In(items.ToArray()).ExecuteCommandAsync();
42 | }
43 | //插入本次使用的记录
44 | await _repo.InsertRangeAsync(reces);
45 | }
46 |
47 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Mon/Server/ShellHelper.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Mon.Server;
2 | public class ShellHelper
3 | {
4 | ///
5 | /// linux 系统命令
6 | ///
7 | ///
8 | ///
9 | public static string Bash(string command)
10 | {
11 | var escapedArgs = command.Replace("\"", "\\\"");
12 | var process = new Process()
13 | {
14 | StartInfo = new ProcessStartInfo
15 | {
16 | FileName = "/bin/bash",
17 | Arguments = $"-c \"{escapedArgs}\"",
18 | RedirectStandardOutput = true,
19 | UseShellExecute = false,
20 | CreateNoWindow = true,
21 | }
22 | };
23 | process.Start();
24 | string result = process.StandardOutput.ReadToEnd();
25 | process.WaitForExit();
26 | process.Dispose();
27 | return result;
28 | }
29 |
30 | ///
31 | /// windows系统命令
32 | ///
33 | ///
34 | ///
35 | ///
36 | public static string Cmd(string fileName, string args)
37 | {
38 | string output = string.Empty;
39 |
40 | var info = new ProcessStartInfo();
41 | info.FileName = fileName;
42 | info.Arguments = args;
43 | info.RedirectStandardOutput = true;
44 |
45 | using (var process = Process.Start(info))
46 | {
47 | output = process.StandardOutput.ReadToEnd();
48 | }
49 |
50 | return output;
51 | }
52 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Core/Cache/CacheSetup.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.DependencyInjection.Extensions;
2 | using NewLife.Caching;
3 | using NewLife.Caching.Services;
4 |
5 | namespace Vben.Common.Core.Cache;
6 |
7 | public static class CacheSetup
8 | {
9 | ///
10 | /// 缓存注册(新生命Redis组件)
11 | ///
12 | ///
13 | public static void AddCache(this IServiceCollection services)
14 | {
15 | // var cacheOptions = App.GetConfig("Cache", true);
16 | var cacheOptions = MyApp.GetOptions("Cache");
17 | if (cacheOptions.CacheType.ToString() == CacheTypeEnum.Redis.ToString())
18 | {
19 | var redis = new FullRedis(new RedisOptions
20 | {
21 | Configuration = cacheOptions.Redis.Configuration,
22 | Prefix = cacheOptions.Redis.Prefix
23 | })
24 | {
25 | // 自动检测集群节点
26 | // AutoDetect = App.GetConfig("Cache:Redis:AutoDetect", true)
27 | AutoDetect = MyApp.GetOptions("Cache:Redis:AutoDetect")
28 | };
29 | // 最大消息大小
30 | if (cacheOptions.Redis.MaxMessageSize > 0)
31 | redis.MaxMessageSize = cacheOptions.Redis.MaxMessageSize;
32 | // 注入 Redis 缓存提供者
33 | services.AddSingleton(u => new RedisCacheProvider(u) { Cache = redis });
34 | services.AddSingleton(redis);
35 | }
36 |
37 | // 内存缓存兜底。在没有配置Redis时,使用内存缓存,逻辑代码无需修改
38 | services.TryAddSingleton();
39 | }
40 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Org/Post/SysOrgPostService.cs:
--------------------------------------------------------------------------------
1 | using Vben.Base.Sys.Org.Dept;
2 |
3 | namespace Vben.Base.Sys.Org.Post;
4 |
5 | [Service]
6 | public class SysOrgPostService : BaseStrMainService
7 | {
8 | public SysOrgPostService(SqlSugarRepository repo)
9 | {
10 | base.repo = repo;
11 | }
12 |
13 | public async Task InsertAsync(SysOrgPost post)
14 | {
15 | post.id = YitIdHelper.NextId() + "";
16 | if (post.depid != null)
17 | {
18 | var deptTier = await repo.Context.Queryable()
19 | .Where(it => it.id == post.depid).Select(it => it.tier).SingleAsync();
20 | post.tier = deptTier + post.id + "_";
21 | }
22 | await repo.Context.InsertNav(post).Include(it => it.users).ExecuteCommandAsync();
23 | await repo.Context.Insertable(new SysOrg { id = post.id, name = post.name, type = 4 }).ExecuteCommandAsync();
24 | }
25 | public async Task UpdateAsync(SysOrgPost post)
26 | {
27 | if (post.depid != null)
28 | {
29 | var deptTier = await repo.Context.Queryable()
30 | .Where(it => it.id == post.depid).Select(it => it.tier).SingleAsync();
31 | post.tier = deptTier + post.id + "_" ;
32 | }
33 | await repo.Context.UpdateNav(post)
34 | .Include(it => it.users,new UpdateNavOptions { ManyToManyIsUpdateA=true })
35 | .ExecuteCommandAsync();
36 | await repo.Context.Updateable(new SysOrg { id = post.id, name = post.name, type = 4 })
37 | .UpdateColumns(it => new { it.name }).ExecuteCommandAsync();
38 | }
39 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Admin/Properties/Configs/web.Production.json:
--------------------------------------------------------------------------------
1 | {
2 | "ServiceScanModules": [
3 | "Vben.Common.Core",
4 | "Vben.Base",
5 | "Vben.Admin"
6 | ],
7 | "DbFirstScanModules": [
8 | "Vben.Base",
9 | "Vben.Admin"
10 | ],
11 | "DbConfig": {
12 | "ShowSql": true,
13 | "ConnectionConfigs": [
14 | {
15 | "ConfigId": "primary",
16 | "DbType": "MySql",
17 | "ConnectionString": "Data Source=localhost;Database=vben-net;User ID=root;Password=123456;pooling=true;port=3306;sslmode=none;CharSet=utf8;AllowLoadLocalInfile=true;OldGuids=true;AllowPublicKeyRetrieval=true;",
18 | // "DbType": "Oracle",
19 | // "ConnectionString": "Data Source=localhost/orcl;User ID=scott;Password=123456;",
20 | "IsAutoCloseConnection": true
21 | }
22 | ]
23 | },
24 | "Upload": {
25 | "Service": "local", //修改成aliyun时,需要维护Oss配置
26 | "Path": "C:/vben-net/upload", //本地上传的路径
27 | "MaxSize": 1048576,
28 | "ContentType": [
29 | "image/jpg",
30 | "image/png",
31 | "image/jpeg",
32 | "image/gif",
33 | "image/bmp",
34 | "text/plain",
35 | "application/pdf",
36 | "application/msword",
37 | "application/vnd.ms-excel",
38 | "application/vnd.ms-powerpoint",
39 | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
40 | "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
41 | ]
42 | },
43 | "CodeGenConfig": {
44 | "Path": "../../zsvg/vms"
45 | },
46 | "Oss": {
47 | "AccessKeyId": "",
48 | "AccessKeySecret": "",
49 | "Endpoint": "",
50 | "Bucket": ""
51 | }
52 | }
53 |
54 |
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Carry/Root/BasePageInput.cs:
--------------------------------------------------------------------------------
1 | // Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
2 | //
3 | // 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
4 | //
5 | // 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
6 |
7 | using Dm.filter;
8 | using Furion.DataValidation;
9 |
10 | namespace Admin.NET.Core;
11 |
12 | ///
13 | /// 全局分页查询输入参数
14 | ///
15 | public class BasePageInput : BaseFilter
16 | {
17 | ///
18 | /// 当前页码
19 | ///
20 | [DataValidation(ValidationTypes.Numeric)]
21 | public virtual int pageNum { get; set; } = 1;
22 |
23 | ///
24 | /// 页码容量
25 | ///
26 | //[Range(0, 100, ErrorMessage = "页码容量超过最大限制")]
27 | [DataValidation(ValidationTypes.Numeric)]
28 | public virtual int pageSize { get; set; } = 10;
29 |
30 | // ///
31 | // /// 排序字段
32 | // ///
33 | // public virtual string Field { get; set; }
34 | //
35 | // ///
36 | // /// 排序方向
37 | // ///
38 | // public virtual string Order { get; set; }
39 | //
40 | // ///
41 | // /// 降序排序
42 | // ///
43 | // public virtual string DescStr { get; set; } = "descending";
44 | }
45 |
46 | ///
47 | /// 全局分页查询输入参数(带时间)
48 | ///
49 | public class BasePageTimeInput : BasePageInput
50 | {
51 | ///
52 | /// 开始时间
53 | ///
54 | public DateTime? StartTime { get; set; }
55 |
56 | ///
57 | /// 结束时间
58 | ///
59 | public DateTime? EndTime { get; set; }
60 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Org/User/SysOrgUserCache.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Org.User;
2 |
3 | [SugarTable("sys_org_user_cache", TableDescription = "用户缓存表")]
4 | [Description("用户缓存表")]
5 | public class SysOrgUserCache
6 | {
7 | ///
8 | /// 主键Id
9 | ///
10 | ///
11 | [SugarColumn(ColumnDescription = "Id主键", IsPrimaryKey = true, Length = 36)]
12 | public string id { get; set; }
13 |
14 | ///
15 | /// 组织架构集
16 | ///
17 | ///
18 | //组织架构集,用户ID,所有上级部门ID,岗位ID,群组ID
19 | [SugarColumn(ColumnDescription = "组织架构集", IsNullable = true, Length = 2000)]
20 | public string conds { get; set; }
21 |
22 | ///
23 | /// 后台所有权限集
24 | ///
25 | ///
26 | //后台所有权限集,用于验证URL权限
27 | [SugarColumn(ColumnDescription = "后台所有权限集", IsNullable = true, Length = 2000)]
28 | public string perms { get; set; }
29 |
30 | ///
31 | /// 前台菜单缓存
32 | ///
33 | ///
34 | [SugarColumn(ColumnDescription = "前台菜单缓存", IsNullable = true, ColumnDataType = "varchar(max)")]
35 | public string menus { get; set; }
36 |
37 | ///
38 | /// 前台按钮缓存
39 | ///
40 | ///
41 | [SugarColumn(ColumnDescription = "前台按钮缓存", IsNullable = true, ColumnDataType = "varchar(max)")]
42 | public string btns { get; set; }
43 |
44 | ///
45 | /// 前台门户缓存
46 | ///
47 | ///
48 | [SugarColumn(ColumnDescription = "前台门户缓存", IsNullable = true, Length = 2000)]
49 | public string portals { get; set; }
50 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Demo/Properties/Configs/web.Production.json:
--------------------------------------------------------------------------------
1 | {
2 | "ServiceScanModules": [
3 | "Vben.Common.Core",
4 | "Vben.Base",
5 | "Vben.Bpm",
6 | "Vben.Demo"
7 | ],
8 | "DbFirstScanModules": [
9 | "Vben.Base",
10 | "Vben.Bpm",
11 | "Vben.Demo"
12 | ],
13 | "DbConfig": {
14 | "ShowSql": true,
15 | "ConnectionConfigs": [
16 | {
17 | "ConfigId": "primary",
18 | "DbType": "MySql",
19 | "ConnectionString": "Data Source=localhost;Database=vben-net;User ID=root;Password=123456;pooling=true;port=3306;sslmode=none;CharSet=utf8;AllowLoadLocalInfile=true;OldGuids=true;AllowPublicKeyRetrieval=true;",
20 | // "DbType": "Oracle",
21 | // "ConnectionString": "Data Source=localhost/orcl;User ID=scott;Password=123456;",
22 | "IsAutoCloseConnection": true
23 | }
24 | ]
25 | },
26 | "Upload": {
27 | "Service": "local", //修改成aliyun时,需要维护Oss配置
28 | "Path": "C:/vben-net/upload", //本地上传的路径
29 | "MaxSize": 1048576,
30 | "ContentType": [
31 | "image/jpg",
32 | "image/png",
33 | "image/jpeg",
34 | "image/gif",
35 | "image/bmp",
36 | "text/plain",
37 | "application/pdf",
38 | "application/msword",
39 | "application/vnd.ms-excel",
40 | "application/vnd.ms-powerpoint",
41 | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
42 | "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
43 | ]
44 | },
45 | "CodeGenConfig": {
46 | "Path": "../../zsvg/vms"
47 | },
48 | "Oss": {
49 | "AccessKeyId": "",
50 | "AccessKeySecret": "",
51 | "Endpoint": "",
52 | "Bucket": ""
53 | }
54 | }
55 |
56 |
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Tool/Oss/Main/ToolOssMain.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Tool.Oss.Main;
2 |
3 | [SugarTable("tool_oss_main", TableDescription = "OSS存储引用")]
4 | public class ToolOssMain
5 | {
6 | [SugarColumn(ColumnDescription = "主键", IsPrimaryKey = true, Length = 32)]
7 | public string id { get; set; }
8 |
9 | ///
10 | /// 文件名称
11 | ///
12 | [SugarColumn(ColumnDescription = "文件名称", IsNullable = true, Length = 255)]
13 | public string name { get; set; }
14 |
15 | ///
16 | /// 类型(后缀)
17 | ///
18 | [SugarColumn(ColumnDescription = "类型(后缀)", IsNullable = true, Length = 32)]
19 | public string type { get; set; }
20 |
21 | ///
22 | /// 文件ID
23 | ///
24 | [SugarColumn(ColumnDescription = "文件ID", IsNullable = true, Length = 32)]
25 | public string filid { get; set; }
26 |
27 | ///
28 | /// 业务ID
29 | ///
30 | [SugarColumn(ColumnDescription = "业务ID", IsNullable = true, Length = 32)]
31 | public string busid { get; set; }
32 |
33 | ///
34 | /// 创建时间
35 | ///
36 | [SugarColumn(ColumnDescription = "创建时间", IsNullable = true, IsOnlyIgnoreUpdate = true)]
37 | public DateTime? crtim { get; set; } = DateTime.Now;
38 |
39 | ///
40 | /// 创建者Id
41 | ///
42 | [SugarColumn(ColumnName = "crman", ColumnDescription = "创建者Id", IsNullable = true, IsOnlyIgnoreUpdate = true,
43 | Length = 36)]
44 | public virtual string crmid { get; set; }
45 |
46 | ///
47 | /// 创建者
48 | ///
49 | [SugarColumn(IsIgnore = true)]
50 | public virtual SysOrg crman { get; set; }
51 |
52 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Pub/Org/Group/PubOrgGroupApi.cs:
--------------------------------------------------------------------------------
1 | using Vben.Base.Sys.Org.Group;
2 |
3 | namespace Vben.Base.Pub.Org.Group;
4 |
5 | [Route("pub/org/group")]
6 | [ApiDescriptionSettings("Pub", Tag = "群组查询")]
7 | public class PubOrgGroupApi(SqlSugarRepository repo) : ControllerBase
8 | {
9 | [HttpGet("tree")]
10 | public async Task GetTree()
11 | {
12 | var treeList = await repo.Context.SqlQueryable
13 | ("select id,pid,name,'cate' type from sys_org_group_cate " +
14 | "union all select id,catid as pid,name,'group' type from sys_org_group")
15 | .ToTreeAsync(it => it.children, it => it.pid, null);
16 | return treeList;
17 | }
18 |
19 | [HttpGet("list")]
20 | public async Task GetList(string pid, string type, string name)
21 | {
22 | if (type == "cate")
23 | {
24 | var list = await repo.Context.SqlQueryable
25 | ("select id,name from sys_org_group where catid=@catid order by ornum")
26 | .AddParameters(new SugarParameter[] { new SugarParameter("@catid", pid) })
27 | .ToListAsync();
28 | return list;
29 | }
30 | else if (type == "group")
31 | {
32 | var list = await repo.Context.SqlQueryable
33 | ("select t.id,t.name from sys_org t inner join sys_org_group_org o on o.oid=t.id where o.gid=@gid")
34 | .AddParameters(new SugarParameter[] { new SugarParameter("@gid", pid) })
35 | .ToListAsync();
36 | return list;
37 | }
38 | else
39 | {
40 | return new List();
41 | }
42 | }
43 |
44 |
45 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Mon/Log/Root/LogExceptionHandler.cs:
--------------------------------------------------------------------------------
1 | using Vben.Base.Mon.Log.Error;
2 | using Vben.Common.Core.Const;
3 |
4 | namespace Vben.Base.Mon.Log.Root;
5 |
6 | ///
7 | /// 全局异常处理
8 | ///
9 | public class LogExceptionHandler : IGlobalExceptionHandler, ISingleton
10 | {
11 | private readonly IEventPublisher _eventPublisher;
12 |
13 | public LogExceptionHandler(IEventPublisher eventPublisher)
14 | {
15 | _eventPublisher = eventPublisher;
16 | }
17 |
18 | public Task OnExceptionAsync(ExceptionContext context)
19 | {
20 | Console.WriteLine("出错了");
21 | var userContext = App.User;
22 | _eventPublisher.PublishAsync(new ChannelEventSource("Create:ErrorLog",
23 | new MonLogError
24 | {
25 | id = YitIdHelper.NextId() + "",
26 | useid = userContext?.FindFirstValue(ClaimConst.CLAINM_USERID),
27 | usnam = userContext?.FindFirstValue(ClaimConst.CLAINM_ACCOUNT),
28 | usena = userContext?.FindFirstValue(ClaimConst.CLAINM_NAME),
29 | name = "未定义的操作",
30 | clazz = context.Exception.TargetSite.DeclaringType?.FullName,
31 | method = context.Exception.TargetSite.Name,
32 | ExceptionName = context.Exception.Message,
33 | ExceptionMsg = context.Exception.Message,
34 | ExceptionSource = context.Exception.Source,
35 | error = context.Exception.StackTrace,
36 | param = context.Exception.TargetSite.GetParameters().ToString(),
37 | crtim = DateTime.Now
38 | }));
39 | Serilog.Log.Error(context.Exception.ToString());
40 | return Task.CompletedTask;
41 | }
42 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Tool/Form/ToolFormApi.cs:
--------------------------------------------------------------------------------
1 | using Vben.Base.Tool.Form;
2 |
3 | [Route("tool/form")]
4 | [ApiDescriptionSettings("Tool", Tag = "在线表单")]
5 | public class ToolFormApi(ToolFormService service) : ControllerBase
6 | {
7 | [HttpGet]
8 | public async Task Get(string name)
9 | {
10 | var pp = XreqUtil.GetPp();
11 | var items = await service.Repo.Context.Queryable()
12 | .LeftJoin((t, c) => c.id == t.cruid)
13 | .LeftJoin((t, c, u) => u.id == t.upuid)
14 | .WhereIF(!string.IsNullOrWhiteSpace(name), t => t.name.Contains(name.Trim()))
15 | .Select((t, c, u) => new
16 | {
17 | t.id, t.name, t.crtim, t.uptim, t.notes,
18 | cruna = c.name, upuna = u.name
19 | })
20 | .ToPageListAsync(pp.page, pp.pageSize, pp.total);
21 | return RestPageResult.Build(pp.total.Value, items);
22 | }
23 |
24 | [HttpGet("info/{id}")]
25 | public async Task GetInfo(long id)
26 | {
27 | var main = await service.Repo.Context.Queryable()
28 | .Where(it => it.id == id).FirstAsync();
29 | return main;
30 | }
31 |
32 | [HttpPost]
33 | public async Task Post([FromBody] ToolForm main)
34 | {
35 | DateTime now = DateTime.Now;
36 | main.name = now.ToString("yyyy-MM-dd HH:mm:ss");;
37 | return await service.Insert(main);
38 | }
39 |
40 | [HttpPut]
41 | public async Task Put([FromBody] ToolForm main)
42 | {
43 | return await service.Update(main);
44 | }
45 |
46 | [HttpDelete]
47 | public async Task Delete(string ids)
48 | {
49 | return await service.Delete(ids);
50 | }
51 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Core/Utils/StrUtils.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Core.Utils;
2 |
3 | public class StrUtils
4 | {
5 | public static string EMPTY = "";
6 | public static string UpperFirst(string input)
7 | {
8 | if (string.IsNullOrEmpty(input))
9 | return input;
10 |
11 | return char.ToUpper(input[0]) + input.Substring(1);
12 | }
13 |
14 | public static bool IsUrl(string url)
15 | {
16 | bool isValid = Uri.IsWellFormedUriString(url, UriKind.Relative);
17 | return isValid;
18 | }
19 |
20 | ///
21 | /// 同时替换字符串中的多个不同文本[citation:1]
22 | ///
23 | /// 原始字符串
24 | /// 要查找的字符串数组
25 | /// 替换成的字符串数组
26 | /// 替换后的字符串
27 | public static string ReplaceEach(string text, string[] targets, string[] replacements)
28 | {
29 | if (string.IsNullOrEmpty(text)) return text;
30 | if (targets == null || replacements == null)
31 | throw new ArgumentNullException("目标数组和替换数组不能为null");
32 | if (targets.Length != replacements.Length)
33 | throw new ArgumentException("目标数组和替换数组长度必须相同");
34 |
35 | StringBuilder result = new StringBuilder(text);
36 |
37 | // 遍历每个要查找的目标字符串[citation:1]
38 | for (int i = 0; i < targets.Length; i++)
39 | {
40 | string target = targets[i];
41 | string replacement = replacements[i];
42 |
43 | if (string.IsNullOrEmpty(target)) continue;
44 |
45 | // 替换当前目标字符串[citation:1]
46 | result.Replace(target, replacement);
47 | }
48 |
49 | return result.ToString();
50 | }
51 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Notice/SysNoticeApi.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Notice;
2 |
3 | [Route("sys/notice")]
4 | [ApiDescriptionSettings("Sys", Tag = "通知管理")]
5 | public class SysNoticeApi(SqlSugarRepository repo) : ControllerBase
6 | {
7 | [HttpGet("list")]
8 | public async Task GetList()
9 | {
10 | return await repo.GetListAsync();
11 | }
12 |
13 | [HttpGet]
14 | public async Task Get(string name)
15 | {
16 | var pp = XreqUtil.GetPp();
17 | var items = await repo.Context.Queryable()
18 | .WhereIF(!string.IsNullOrWhiteSpace(name), t => t.name.Contains(name.Trim()))
19 | .Select((t) => new { t.id, t.name, t.crtim, t.uptim,t.avtag })
20 | .ToPageListAsync(pp.page, pp.pageSize, pp.total);
21 | return RestPageResult.Build(pp.total.Value, items);
22 | }
23 |
24 | [HttpGet("info/{id}")]
25 | public async Task GetInfo(long id)
26 | {
27 | var main = await repo.Context.Queryable()
28 | .Where(it => it.id == id).FirstAsync();
29 | return main;
30 | }
31 |
32 | [HttpPost]
33 | public async Task Post([FromBody] SysNotice main)
34 | {
35 | main.id = YitIdHelper.NextId() ;
36 | await repo.InsertAsync(main);
37 | return main.id;
38 | }
39 |
40 | [HttpPut]
41 | public async Task Put([FromBody] SysNotice main)
42 | {
43 | main.uptim = DateTime.Now;
44 | await repo.UpdateAsync(main);
45 | return main.id;
46 | }
47 |
48 | [HttpDelete("{ids}")]
49 | public async Task Delete(string ids)
50 | {
51 | var idArr = ids.Split(",");
52 | await repo.Context.Deleteable().In(idArr).ExecuteCommandAsync();
53 | }
54 |
55 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Tool/Dict/Main/ToolDictMainApi.cs:
--------------------------------------------------------------------------------
1 | using Vben.Base.Tool.Dict.Data;
2 |
3 | namespace Vben.Base.Tool.Dict.Main;
4 |
5 | [Route("tool/dict/main")]
6 | [ApiDescriptionSettings("Tool", Tag = "字典数据")]
7 | public class ToolDictMainApi(ToolDictMainService service) : ControllerBase
8 | {
9 | [HttpGet("list")]
10 | public async Task GetList()
11 | {
12 | return await service.repo.GetListAsync();
13 | }
14 |
15 | [HttpGet]
16 | public async Task Get(string name)
17 | {
18 | var pp = XreqUtil.GetPp();
19 | var items = await service.repo.Context.Queryable()
20 | .WhereIF(!string.IsNullOrWhiteSpace(name), t
21 | => t.name.Contains(name.Trim()) || t.id.Contains(name.Trim()))
22 | .OrderBy(u => u.ornum)
23 | .Select((t) => new { t.id, t.name, t.crtim, t.uptim, t.notes })
24 | .ToPageListAsync(pp.page, pp.pageSize, pp.total);
25 | return RestPageResult.Build(pp.total.Value, items);
26 | }
27 |
28 | [HttpGet("info/{id}")]
29 | public async Task GetInfo(string id)
30 | {
31 | return await service.SingleAsync(id); ;
32 | }
33 |
34 | [HttpGet("data")]
35 | public async Task> GetData(string code)
36 | {
37 | return await service.findData(code);
38 | }
39 |
40 | [HttpPost]
41 | public async Task Post([FromBody] ToolDictMain main)
42 | {
43 | await service.InsertAsync(main);
44 | }
45 |
46 | [HttpPut]
47 | public async Task Put([FromBody] ToolDictMain main)
48 | {
49 | await service.UpdateAsync(main);
50 | }
51 |
52 | [HttpDelete("{ids}")]
53 | public async Task Delete(string ids)
54 | {
55 | await service.DeleteAsync(ids);
56 | }
57 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Perm/Api/SysPermApi.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Perm.Api;
2 |
3 | [SugarTable("sys_perm_api", TableDescription = "权限接口")]
4 | [Description("权限接口")]
5 | public class SysPermApi
6 | {
7 | [SugarColumn(ColumnDescription = "Id主键", IsPrimaryKey = true)]
8 | public long id { get; set; }
9 |
10 | [SugarColumn(ColumnDescription = "接口名称", IsNullable = true, Length = 32)]
11 | public string name { get; set; }
12 |
13 | [SugarColumn(ColumnDescription = "菜单ID", IsNullable = true)]
14 | public long menid { get; set; }
15 |
16 | [SugarColumn(ColumnDescription = "排序号", IsNullable = true)]
17 | public int ornum { get; set; }
18 |
19 | [SugarColumn(ColumnDescription = "权限字符", IsNullable = true, Length = 64)]
20 | public string perm { get; set; }
21 |
22 | [SugarColumn(ColumnDescription = "权限代码", IsNullable = true, IsOnlyIgnoreUpdate = true)]
23 | public long code { get; set; }
24 |
25 | [SugarColumn(ColumnDescription = "权限位", IsNullable = true, IsOnlyIgnoreUpdate = true)]
26 | public int pos { get; set; }
27 |
28 | [SugarColumn(ColumnDescription = "权限类型", IsNullable = true)]
29 | public string type { get; set; }
30 |
31 | [SugarColumn(ColumnDescription = "是否可用", IsNullable = true)]
32 | public bool avtag { get; set; } = true;
33 |
34 | [SugarColumn(ColumnDescription = "备注", IsNullable = true, Length = 255)]
35 | public string notes { get; set; }
36 |
37 | [SugarColumn(ColumnDescription = "创建时间", IsNullable = true, IsOnlyIgnoreUpdate = true)]
38 | public DateTime? crtim { get; set; } = DateTime.Now;
39 |
40 | [SugarColumn(ColumnDescription = "更新时间", IsNullable = true)]
41 | public DateTime? uptim { get; set; }
42 |
43 | public SysPermApi(long id)
44 | {
45 | this.id = id;
46 | }
47 |
48 | public SysPermApi()
49 | {
50 | }
51 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Tool/Dict/Data/ToolDictDataApi.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Tool.Dict.Data;
2 |
3 | [Route("tool/dict/data")]
4 | [ApiDescriptionSettings("Tool", Tag = "字典配置")]
5 | public class ToolDictDataApi(ToolDictDataService service) : ControllerBase
6 | {
7 | [HttpGet]
8 | public async Task Get(string dicid, string name)
9 | {
10 | var pp = XreqUtil.GetPp();
11 | var items = await service.repo.Context.Queryable()
12 | .WhereIF(!string.IsNullOrWhiteSpace(name), t
13 | => t.name.Contains(name.Trim()) || t.dalab.Contains(name.Trim()))
14 | .Where((t) => t.dicid == dicid)
15 | .OrderBy(u => u.ornum)
16 | .Select((t) => new { t.id, t.name, t.dalab, t.daval, t.crtim, t.uptim, t.notes })
17 | .ToPageListAsync(pp.page, pp.pageSize, pp.total);
18 | return RestPageResult.Build(pp.total.Value, items);
19 | }
20 |
21 | [HttpGet("list")]
22 | public async Task GetList(string dicid)
23 | {
24 | return await service.repo.Context.Queryable()
25 | .Where(it => it.dicid == dicid).ToListAsync();
26 | }
27 |
28 | [HttpGet("info/{id}")]
29 | public async Task GetInfo(string id)
30 | {
31 | var data = await service.repo.Context.Queryable()
32 | .Where(it => it.id == id).FirstAsync();
33 | return data;
34 | }
35 |
36 | [HttpPost]
37 | public async Task Post([FromBody] ToolDictData data)
38 | {
39 | await service.InsertAsync(data);
40 | }
41 |
42 | [HttpPut]
43 | public async Task Put([FromBody] ToolDictData data)
44 | {
45 | await service.UpdateAsync(data);
46 | }
47 |
48 | [HttpDelete("{ids}")]
49 | public async Task Delete(string ids)
50 | {
51 | await service.DeleteAsync(ids);
52 | }
53 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Perm/Api/SysPermApiApi.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Perm.Api;
2 |
3 | [Route("sys/perm/api")]
4 | [ApiDescriptionSettings("Sys", Tag = "权限管理-接口")]
5 | public class SysPermApiApi(SqlSugarRepository repo) : ControllerBase
6 | {
7 | [HttpGet("list")]
8 | public async Task GetList()
9 | {
10 | return await repo.GetListAsync();
11 | }
12 |
13 | [HttpGet]
14 | public async Task Get(string name, string menid)
15 | {
16 | var pp = XreqUtil.GetPp();
17 | var items = await repo.Context.Queryable()
18 | .WhereIF(!string.IsNullOrEmpty(menid) && menid != "0", t => t.menid.Equals(menid))
19 | .WhereIF(!string.IsNullOrWhiteSpace(name), t => t.name.Contains(name.Trim()))
20 | .Select((t) => new { t.id, t.perm, t.type, t.crtim, t.uptim, t.name })
21 | .ToPageListAsync(pp.page, pp.pageSize, pp.total);
22 | return RestPageResult.Build(pp.total.Value, items);
23 | }
24 |
25 | [HttpGet("info/{id}")]
26 | public async Task GetInfo(long id)
27 | {
28 | var main = await repo.Context.Queryable()
29 | .Where(it => it.id == id).FirstAsync();
30 | return main;
31 | }
32 |
33 | [HttpPost]
34 | public async Task Post([FromBody] SysPermApi api)
35 | {
36 | api.id = YitIdHelper.NextId();
37 | await repo.InsertAsync(api);
38 | return api.id;
39 | }
40 |
41 | [HttpPut]
42 | public async Task Put([FromBody] SysPermApi api)
43 | {
44 | api.uptim = DateTime.Now;
45 | await repo.UpdateAsync(api);
46 | return api.id;
47 | }
48 |
49 | [HttpDelete("{ids}")]
50 | public async Task Delete(string ids)
51 | {
52 | var idArr = ids.Split(",");
53 | await repo.Context.Deleteable().In(idArr).ExecuteCommandAsync();
54 | }
55 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Security/Pojo/Zuser.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Security.Pojo;
2 |
3 | //用户pojo,前台与后台都会用到,前台用于获取用户信息,后台存在redis里,用于获取用户信息及权限校验
4 | public class Zuser
5 | {
6 | public string id { get; set; }
7 |
8 | public string name { get; set; }
9 |
10 | public string usnam { get; set; }
11 |
12 | public string monum { get; set; }//手机号
13 |
14 | public string label { get; set; }//账号标签
15 | public string type { get; set; }//账号类型
16 |
17 | public string depid { get; set; }//部门id,协同用户则是公司id
18 |
19 | public string depna { get; set; }//部门名称,协同用户则是公司名称
20 |
21 | public string relog { get; set; }//前台通知是否查看过的标记
22 |
23 | private bool isAdmin;
24 |
25 | public bool IsAdmin
26 | {
27 | get
28 | {
29 | if ("sa" == usnam || "admin" == usnam || "vben" == usnam)
30 | {
31 | return true;
32 | }
33 | return false;
34 | }
35 | set => isAdmin = value;
36 | }
37 |
38 | public string perms { get; set; } //权限集,用于验证URL权限 比较下哪个方式快0
39 |
40 | // public long[] permArr{ get; set; }//权限集,用于验证URL权限 比较下哪个方式快1
41 |
42 | // public List permList{ get; set; }//权限集,用于验证URL权限 比较下哪个方式快2
43 |
44 | public string conds { get; set; } //组织架构集,用户ID,所有上级部门ID,岗位ID,群组ID
45 |
46 | public Zuser()
47 | {
48 | }
49 |
50 | public Zuser(string id, string name, string usnam)
51 | {
52 | this.id = id;
53 | this.name = name;
54 | this.usnam = usnam;
55 | }
56 |
57 | public Zuser(UserDo userDo)
58 | {
59 | this.id = userDo.id;
60 | this.name = userDo.name;
61 | this.usnam = userDo.usnam;
62 | this.monum = userDo.monum;
63 | this.label = userDo.label;
64 | this.type = userDo.type;
65 | this.relog = userDo.relog;
66 | this.depid = userDo.depid;
67 | this.depna = userDo.depna;
68 | }
69 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Tool/Code/Root/ReplaceDto.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Tool.Code.Root;
2 |
3 | public class ReplaceDto
4 | {
5 | ///
6 | /// 主键字段
7 | ///
8 | public string PKName { get; set; }
9 |
10 | public string UrlName { get; set; }
11 |
12 | public string VueEvent { get; set; } = "$event";
13 |
14 | ///
15 | /// 首字母小写主键
16 | ///
17 | public string FistLowerPk { get; set; }
18 |
19 | ///
20 | /// 主键类型
21 | ///
22 | public string PKType { get; set; }
23 |
24 | ///
25 | /// 控制器权限
26 | ///
27 | public string PermissionPrefix { get; set; }
28 |
29 | ///
30 | /// C#类名
31 | ///
32 | public string ModelTypeName { get; set; }
33 |
34 | //vue、api
35 | //public string VueViewFormResetHtml { get; set; }
36 | ///
37 | /// 前端列表查询html
38 | ///
39 | public string VueViewListHtml { get; set; }
40 |
41 | ///
42 | /// 前端添加、编辑表格html
43 | ///
44 | public string VueViewFormHtml { get; set; }
45 |
46 | ///
47 | /// 前端搜索表单html
48 | ///
49 | public string VueQueryFormHtml { get; set; }
50 |
51 | ///
52 | /// 查询条件
53 | ///
54 | public string QueryCondition { get; set; } = "";
55 |
56 | public bool ShowBtnExport { get; set; }
57 | public bool ShowBtnAdd { get; set; }
58 | public bool ShowBtnEdit { get; set; }
59 | public bool ShowBtnDelete { get; set; }
60 | public bool ShowBtnView { get; set; }
61 |
62 | ///
63 | /// 上传URL data
64 | ///
65 | //public string VueUploadUrl { get; set; }
66 | public int UploadFile { get; set; } = 0;
67 |
68 | public string Author { get; set; }
69 | public string AddTime { get; set; } = DateTime.Now.ToString("yyyy-MM-dd");
70 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Carry/Root/DataMaskAttribute.cs:
--------------------------------------------------------------------------------
1 | // Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
2 | //
3 | // 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
4 | //
5 | // 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
6 |
7 | namespace Admin.NET.Core;
8 |
9 | ///
10 | /// 数据脱敏特性(支持自定义脱敏位置和脱敏字符)
11 | ///
12 | [AttributeUsage(AttributeTargets.Property)]
13 | public class DataMaskAttribute : Attribute
14 | {
15 | ///
16 | /// 脱敏起始位置(从0开始)
17 | ///
18 | private int StartIndex { get; }
19 |
20 | ///
21 | /// 脱敏长度
22 | ///
23 | private int Length { get; }
24 |
25 | ///
26 | /// 脱敏字符(默认*)
27 | ///
28 | private char MaskChar { get; set; } = '*';
29 |
30 | ///
31 | /// 是否保留原始长度(默认true)
32 | ///
33 | private bool KeepLength { get; set; } = true;
34 |
35 | public DataMaskAttribute(int startIndex, int length)
36 | {
37 | if (startIndex < 0) throw new ArgumentOutOfRangeException(nameof(startIndex));
38 | if (length <= 0) throw new ArgumentOutOfRangeException(nameof(length));
39 |
40 | StartIndex = startIndex;
41 | Length = length;
42 | }
43 |
44 | ///
45 | /// 执行脱敏处理
46 | ///
47 | public string Mask(string input)
48 | {
49 | if (string.IsNullOrEmpty(input) || input.Length <= StartIndex)
50 | return input;
51 |
52 | var maskedLength = Math.Min(Length, input.Length - StartIndex);
53 | var maskStr = new string(MaskChar, KeepLength ? maskedLength : Math.Min(4, maskedLength));
54 |
55 | return input.Substring(0, StartIndex) + maskStr +
56 | (StartIndex + maskedLength < input.Length ?
57 | input.Substring(StartIndex + maskedLength) : "");
58 | }
59 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Sqlsugar/Mvc/Service/BaseStrCateService.cs:
--------------------------------------------------------------------------------
1 | using Vben.Common.Core.Utils;
2 | using Vben.Common.Sqlsugar.Config;
3 | using Vben.Common.Sqlsugar.Mvc.Entity;
4 |
5 | namespace Vben.Common.Sqlsugar.Mvc.Service;
6 |
7 | //分类Service基类,提供分类Entity增删改查的通用方法
8 | public class BaseStrCateService where TEntity : BaseStrCateEntity, new()
9 | {
10 | public SqlSugarRepository repo { get; set; }
11 |
12 | //查询单个实体详细信息
13 | public async Task SingleAsync(string id)
14 | {
15 | var main = await repo.GetSingleAsync(t => t.id == id);
16 | if (main.crmid != null)
17 | {
18 | main.crman = await repo.Context.Queryable()
19 | .Where(it => it.id == main.crmid).SingleAsync();
20 | }
21 |
22 | if (main.upmid != null)
23 | {
24 | main.upman = await repo.Context.Queryable()
25 | .Where(it => it.id == main.upmid).SingleAsync();
26 | }
27 |
28 | return main;
29 | }
30 |
31 | //新增
32 | public async Task InsertAsync(TEntity entity)
33 | {
34 | if (string.IsNullOrEmpty(entity.id))
35 | {
36 | entity.id = YitIdHelper.NextId() + "";
37 | }
38 |
39 | entity.crmid = XuserUtil.getUserId();
40 | entity.crtim = DateTime.Now;
41 | entity.avtag = true;
42 | await repo.InsertAsync(entity);
43 | return entity.id;
44 | }
45 |
46 | //更新
47 | public async Task UpdateAsync(TEntity entity)
48 | {
49 | entity.uptim = DateTime.Now;
50 | entity.upmid = XuserUtil.getUserId();
51 | await repo.UpdateAsync(entity);
52 | return entity.id;
53 | }
54 |
55 | //删除
56 | public async Task DeleteAsync(string ids)
57 | {
58 | var idArr = ids.Split(",");
59 | await repo.Context.Deleteable().In(idArr).ExecuteCommandAsync();
60 | }
61 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Mon/Job/Main/MonJobMain.cs:
--------------------------------------------------------------------------------
1 | using Vben.Common.Core.Enum;
2 |
3 | namespace Vben.Base.Mon.Job.Main;
4 |
5 | ///
6 | /// 定时任务
7 | ///
8 | [SugarTable("mon_job_main")]
9 | [Description("定时任务")]
10 | public class MonJobMain : BaseStrMainEntity
11 | {
12 | ///
13 | /// 任务code
14 | ///
15 | [SugarColumn(ColumnDescription = "任务代码", IsNullable = true)]
16 | public string code { get; set; }
17 |
18 | [SugarColumn(ColumnDescription = "排序号", IsNullable = true)]
19 | public int ornum { get; set; }
20 |
21 | ///
22 | /// 请求url
23 | ///
24 | [MaxLength(200)]
25 | [SugarColumn(ColumnDescription = "请求url", IsNullable = true)]
26 | public string reurl { get; set; }
27 |
28 |
29 | ///
30 | /// 请求类型
31 | ///
32 | /// 2
33 | [SugarColumn(ColumnDescription = "请求类型", IsNullable = true)]
34 | public RequestTypeEnum retyp { get; set; } = RequestTypeEnum.Post;
35 |
36 | ///
37 | /// Headers(可以包含如:Authorization授权认证)
38 | /// 格式:{"Authorization":"userpassword.."}
39 | ///
40 | [SugarColumn(ColumnDescription = "Headers", IsNullable = true)]
41 | public string rehea { get; set; }
42 |
43 | ///
44 | /// 请求参数(Post,Put请求用)
45 | ///
46 | [SugarColumn(ColumnDescription = "请求参数", IsNullable = true)]
47 | public string repar { get; set; }
48 |
49 | ///
50 | /// Cron表达式
51 | ///
52 | ///
53 | [MaxLength(20)]
54 | [SugarColumn(ColumnDescription = "Cron表达式", IsNullable = true)]
55 | public string cron { get; set; }
56 |
57 | // ///
58 | // /// 执行类型(并行、列队)
59 | // ///
60 | // [SugarColumn(ColumnDescription = "执行类型", IsNullable = true)]
61 | // public SpareTimeExecuteTypes extyp { get; set; } = SpareTimeExecuteTypes.Parallel;
62 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Mon/Log/Audit/MonLogAudit.cs:
--------------------------------------------------------------------------------
1 | using Vben.Common.Core.Enum;
2 |
3 | namespace Vben.Base.Mon.Log.Audit;
4 |
5 | ///
6 | /// 系统操作/审计日志表
7 | ///
8 | [SugarTable("mon_log_audit")]
9 | [Description("系统操作/审计日志表")]
10 | public class MonLogAudit
11 | {
12 | ///
13 | /// 主键Id
14 | ///
15 | [SugarColumn(ColumnDescription = "Id主键", IsPrimaryKey = true, Length = 36)]
16 | public string Id { get; set; }
17 |
18 | ///
19 | /// 表名
20 | ///
21 | [MaxLength(50)]
22 | [SugarColumn(ColumnDescription = "表名", IsNullable = true)]
23 | public string TableName { get; set; }
24 |
25 | ///
26 | /// 列名
27 | ///
28 | [MaxLength(50)]
29 | [SugarColumn(ColumnDescription = "列名", IsNullable = true)]
30 | public string ColumnName { get; set; }
31 |
32 | ///
33 | /// 新值
34 | ///
35 | [SugarColumn(ColumnDescription = "新值", IsNullable = true)]
36 | public string NewValue { get; set; }
37 |
38 | ///
39 | /// 旧值
40 | ///
41 | [SugarColumn(ColumnDescription = "旧值", IsNullable = true)]
42 | public string OldValue { get; set; }
43 |
44 | ///
45 | /// 操作时间
46 | ///
47 | [SugarColumn(ColumnDescription = "操作时间", IsNullable = true)]
48 | public DateTime CreatedTime { get; set; }
49 |
50 | ///
51 | /// 操作人Id
52 | ///
53 | [SugarColumn(ColumnDescription = "操作人Id", IsNullable = true)]
54 | public long UserId { get; set; }
55 |
56 | ///
57 | /// 操作人名称
58 | ///
59 | [MaxLength(20)]
60 | [SugarColumn(ColumnDescription = "操作人名称", IsNullable = true)]
61 | public string UserName { get; set; }
62 |
63 | ///
64 | /// 操作方式:新增、更新、删除
65 | ///
66 | [SugarColumn(ColumnDescription = "操作方式:新增、更新、删除", IsNullable = true)]
67 | public DataOpType Operate { get; set; }
68 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Mon/Online/User/MonOnlineUser.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Mon.online.user;
2 |
3 | ///
4 | /// 在线用户
5 | ///
6 | [SugarTable("mon_online_user", "在线用户")]
7 | public class MonOnlineUser
8 | {
9 |
10 | ///
11 | /// 雪花Id
12 | ///
13 | [SugarColumn(ColumnName = "id", ColumnDescription = "主键Id", IsPrimaryKey = true, IsIdentity = false)]
14 | public long id { get; set; }
15 |
16 | ///
17 | /// 租户Id
18 | ///
19 | [SugarColumn(ColumnDescription = "租户Id", IsOnlyIgnoreUpdate = true)]
20 | public long? tenid { get; set; }
21 |
22 | ///
23 | /// 连接Id
24 | ///
25 | [SugarColumn(ColumnDescription = "连接Id")]
26 | public string? conid { get; set; }
27 |
28 | ///
29 | /// 用户Id
30 | ///
31 | [SugarColumn(ColumnDescription = "用户Id")]
32 | public string useid { get; set; }
33 |
34 | ///
35 | /// 账号
36 | ///
37 | [SugarColumn(ColumnDescription = "账号", Length = 32)]
38 | [Required, MaxLength(32)]
39 | public virtual string usena { get; set; }
40 |
41 | ///
42 | /// 真实姓名
43 | ///
44 | [SugarColumn(ColumnDescription = "真实姓名", Length = 32)]
45 | [MaxLength(32)]
46 | public string? nicna { get; set; }
47 |
48 | ///
49 | /// 连接时间
50 | ///
51 | [SugarColumn(ColumnDescription = "连接时间")]
52 | public DateTime? cotim { get; set; }
53 |
54 | ///
55 | /// 连接IP
56 | ///
57 | [SugarColumn(ColumnDescription = "连接IP", Length = 256)]
58 | [MaxLength(256)]
59 | public string? ip { get; set; }
60 |
61 | ///
62 | /// 浏览器
63 | ///
64 | [SugarColumn(ColumnDescription = "浏览器", Length = 128)]
65 | [MaxLength(128)]
66 | public string? browser { get; set; }
67 |
68 | ///
69 | /// 操作系统
70 | ///
71 | [SugarColumn(ColumnDescription = "操作系统", Length = 128)]
72 | [MaxLength(128)]
73 | public string? os { get; set; }
74 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Tool/Code/Root/GenerateDto.cs:
--------------------------------------------------------------------------------
1 | using Vben.Base.Tool.Code.Table;
2 |
3 | namespace Vben.Base.Tool.Code.Root;
4 |
5 | public class GenerateDto
6 | {
7 | ///
8 | /// vue版本
9 | ///
10 | public int VueVersion { get; set; }
11 |
12 | public long TableId { get; set; }
13 |
14 | ///
15 | /// 是否预览代码
16 | ///
17 | public bool IsPreview { get; set; }
18 |
19 | ///
20 | /// 生成代码的数据库类型 0、mysql 1、sqlserver
21 | ///
22 | public int DbType { get; set; }
23 |
24 | ///
25 | /// 生成的按钮功能
26 | ///
27 | public int[] CheckedBtn { get; set; } = System.Array.Empty();
28 |
29 | public ToolCodeTable GenTable { get; set; }
30 | public CodeGenerateOption GenOptions { get; set; }
31 |
32 | #region 存储路径
33 |
34 | ///
35 | /// 代码模板预览存储路径存放
36 | ///
37 | public List GenCodes { get; set; } = new List();
38 |
39 | ///
40 | /// 代码生成路径
41 | ///
42 | public string GenCodePath { get; set; } = string.Empty;
43 |
44 | ///
45 | /// 代码生成压缩包路径
46 | ///
47 | public string ZipPath { get; set; }
48 |
49 | ///
50 | /// 代码生成压缩包名称
51 | ///
52 | public string ZipFileName { get; set; }
53 |
54 | ///
55 | /// 生成代码方式(0zip压缩包 1自定义路径)
56 | ///
57 | public string GenType { get; set; }
58 |
59 | public string GenPath { get; set; } = "";
60 |
61 | ///
62 | /// vue代码路径
63 | ///
64 | public string VueParentPath { get; set; }
65 |
66 | #endregion
67 | }
68 |
69 | public class GenCode
70 | {
71 | public int Type { get; set; }
72 | public string Title { get; set; }
73 | public string Path { get; set; }
74 | public string Content { get; set; }
75 |
76 | public GenCode(int type, string title, string path, string content)
77 | {
78 | Type = type;
79 | Title = title;
80 | Path = path;
81 | Content = content;
82 | }
83 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Sqlsugar/Config/DbExtension.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using Microsoft.AspNetCore.Builder;
3 | using Vben.Common.Core;
4 | using Vben.Common.Sqlsugar.Mvc.Entity;
5 |
6 | namespace Vben.Common.Sqlsugar.Config;
7 |
8 | public static class DbExtension
9 | {
10 | public static IApplicationBuilder DbFirst(this IApplicationBuilder app)
11 | {
12 | SqlSugarScope _sqlSugarScope = (SqlSugarScope)app.ApplicationServices.GetRequiredService();
13 | var path = AppDomain.CurrentDomain.RelativeSearchPath ?? AppDomain.CurrentDomain.BaseDirectory;
14 | var vbenProvider = _sqlSugarScope.GetConnectionScope("primary");
15 | vbenProvider.CodeFirst.InitTables(typeof(SysOrg));
16 | List cls=MyApp.GetOptions>("DbFirstScanModules");
17 | foreach (var cl in cls)
18 | {
19 | var assemblies = Directory.GetFiles(path, cl+".dll").Select(Assembly.LoadFrom)
20 | .ToArray();
21 |
22 | var coreModelTypes = assemblies
23 | .SelectMany(a => a.DefinedTypes)
24 | .Select(type => type.AsType())
25 | .Where(x => x.IsClass && x.Namespace != null && x.Namespace.StartsWith("Vben")).ToList();
26 | coreModelTypes.ForEach(t =>
27 | {
28 | var customAttributeDatas = t.CustomAttributes;
29 | foreach (var attribute in customAttributeDatas)
30 | {
31 | if (attribute.ToString().Contains("SugarTable"))
32 | {
33 | var tAtt = t.GetCustomAttribute();
34 | if (tAtt == null)
35 | {
36 | vbenProvider.CodeFirst.InitTables(t);
37 | }
38 | else
39 | {
40 | _sqlSugarScope.GetConnectionScope(tAtt.configId).CodeFirst.InitTables(t);
41 | }
42 | }
43 | }
44 | });
45 | }
46 | return app;
47 | }
48 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Config/SysConfigApi.cs:
--------------------------------------------------------------------------------
1 | using NewLife.Caching;
2 |
3 | namespace Vben.Base.Sys.Config;
4 |
5 | [Route("sys/config")]
6 | [ApiDescriptionSettings("Sys", Tag = "参数管理")]
7 | public class SysConfigApi(SqlSugarRepository repo) : ControllerBase
8 | {
9 |
10 | [HttpGet("list")]
11 | public async Task GetList()
12 | {
13 | return await repo.GetListAsync();
14 | }
15 |
16 | [HttpGet]
17 | public async Task Get(string name)
18 | {
19 | var pp = XreqUtil.GetPp();
20 | var items = await repo.Context.Queryable()
21 | .WhereIF(!string.IsNullOrWhiteSpace(name), t => t.name.Contains(name.Trim()))
22 | // .Select((t) => new { t.id, t.name, t.crtim, t.uptim })
23 | .ToPageListAsync(pp.page, pp.pageSize, pp.total);
24 | return RestPageResult.Build(pp.total.Value, items);
25 | }
26 |
27 | // [SaCheckPermission("sys:config:query")]
28 | [HttpGet("info/{id}")]
29 | public async Task GetInfo(long id)
30 | {
31 | ICache cache = MyApp.GetRequiredService().Cache;
32 | var main = cache.Get("bbb");
33 | if (main != null)
34 | {
35 | return main;
36 | }
37 | main = await repo.Context.Queryable()
38 | .Where(it => it.id == id).FirstAsync();
39 | cache.Add("bbb", main);
40 | return main;
41 | }
42 |
43 | [HttpPost]
44 | public async Task Post([FromBody] SysConfig main)
45 | {
46 | main.id = YitIdHelper.NextId();
47 | await repo.InsertAsync(main);
48 | return main.id;
49 | }
50 |
51 | [HttpPut]
52 | public async Task Put([FromBody] SysConfig main)
53 | {
54 | main.uptim = DateTime.Now;
55 | await repo.UpdateAsync(main);
56 | return main.id;
57 | }
58 |
59 | [HttpDelete("{ids}")]
60 | public async Task Delete(string ids)
61 | {
62 | var idArr = ids.Split(",");
63 | await repo.Context.Deleteable().In(idArr).ExecuteCommandAsync();
64 | }
65 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Core/Token/TokenModel.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Core.Token;
2 |
3 | public class TokenModel
4 | {
5 | ///
6 | /// 用户id
7 | ///
8 | public long UserId { get; set; }
9 |
10 | ///
11 | /// 部门id
12 | ///
13 | public long DeptId { get; set; }
14 |
15 | ///
16 | /// 登录用户名
17 | ///
18 | public string UserName { get; set; }
19 |
20 | ///
21 | /// 用户昵称
22 | ///
23 | public string NickName { get; set; }
24 |
25 | ///
26 | /// 角色集合(eg:admin,common)
27 | ///
28 | public List RoleKeys { get; set; } = [];
29 |
30 | ///
31 | /// 角色集合(数据权限过滤使用)
32 | ///
33 | public List Roles { get; set; }
34 |
35 | ///
36 | /// Jwt过期时间
37 | ///
38 | public DateTime ExpireTime { get; set; }
39 |
40 | ///
41 | /// 租户ID
42 | ///
43 | public string TenantId { get; set; }
44 |
45 | ///
46 | /// 用户所有权限
47 | ///
48 | public List Permissions { get; set; } = [];
49 |
50 | public TokenModel()
51 | {
52 | }
53 |
54 | public TokenModel(TokenModel info, List roles)
55 | {
56 | UserId = info.UserId;
57 | UserName = info.UserName;
58 | DeptId = info.DeptId;
59 | Roles = roles;
60 | NickName = info.NickName;
61 | RoleKeys = roles.Select(f => f.RoleKey).ToList();
62 | }
63 |
64 | public bool HasPermission(string permission)
65 | {
66 | if (IsAdmin()) return true;
67 | return Permissions != null && Permissions.Contains(permission);
68 | }
69 |
70 | ///
71 | /// 是否管理员
72 | ///
73 | ///
74 | public bool IsAdmin()
75 | {
76 | return RoleKeys.Contains("admin") || UserId == 1;
77 | }
78 | }
79 |
80 | public class Roles
81 | {
82 | public long RoleId { get; set; }
83 | public string RoleKey { get; set; }
84 | public int DataScope { get; set; }
85 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Auth/User/SysUserVo.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Auth.User;
2 |
3 | public class SysUserVo
4 | {
5 | /**
6 | * 用户ID
7 | */
8 | public string userId { get; set; }
9 |
10 | /**
11 | * 租户ID
12 | */
13 | public string tenantId { get; set; }
14 |
15 | /**
16 | * 部门ID
17 | */
18 | public string deptId { get; set; }
19 |
20 | /**
21 | * 用户账号
22 | */
23 | public string userName { get; set; }
24 |
25 | /**
26 | * 用户昵称
27 | */
28 | public string nickName { get; set; }
29 |
30 | /**
31 | * 用户类型(sys_user系统用户)
32 | */
33 | public string userType { get; set; }
34 |
35 | /**
36 | * 用户邮箱
37 | */
38 | public string email { get; set; }
39 |
40 | /**
41 | * 手机号码
42 | */
43 | public string phonenumber { get; set; }
44 |
45 | /**
46 | * 用户性别(0男 1女 2未知)
47 | */
48 | public string sex { get; set; }
49 |
50 | /**
51 | * 头像地址
52 | */
53 | public string avatar { get; set; }
54 |
55 | /**
56 | * 密码
57 | */
58 | public string password { get; set; }
59 |
60 | /**
61 | * 帐号状态(0正常 1停用)
62 | */
63 | public string status { get; set; }
64 |
65 | /**
66 | * 最后登录IP
67 | */
68 | public string loginIp { get; set; }
69 |
70 | /**
71 | * 最后登录时间
72 | */
73 | public DateTime loginDate { get; set; }= DateTime.Now;
74 |
75 | /**
76 | * 备注
77 | */
78 | public string remark { get; set; }
79 |
80 | /**
81 | * 创建时间
82 | */
83 | public DateTime createTime { get; set; }= DateTime.Now;
84 |
85 | /**
86 | * 部门名
87 | */
88 | public string deptName { get; set; }
89 |
90 | /**
91 | * 角色对象
92 | */
93 | /**
94 | * 角色组
95 | */
96 | public long[] roleIds { get; set; }
97 |
98 | /**
99 | * 岗位组
100 | */
101 | public long[] postIds { get; set; }
102 |
103 | /**
104 | * 数据权限 当前角色ID
105 | */
106 | public long roleId { get; set; }
107 | }
--------------------------------------------------------------------------------
/vben-common/Vben.Common.Sqlsugar/Mvc/Entity/BaseMainEntity.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Common.Sqlsugar.Mvc.Entity;
2 |
3 | //主数据Entity基类,提供通用的字段
4 | public abstract class BaseMainEntity
5 | {
6 | ///
7 | /// 主键Id
8 | ///
9 | ///
10 | [SugarColumn(ColumnDescription = "Id主键", IsPrimaryKey = true)]
11 | public virtual long id { get; set; }
12 |
13 | ///
14 | /// 名称
15 | ///
16 | /// API测试
17 | [SugarColumn(ColumnDescription = "名称", IsNullable = true, Length = 255)]
18 | public virtual string name { get; set; }
19 |
20 | ///
21 | /// 创建时间
22 | ///
23 | [SugarColumn(ColumnDescription = "创建时间", IsNullable = true, IsOnlyIgnoreUpdate = true)]
24 | public virtual DateTime? crtim { get; set; } = DateTime.Now;
25 |
26 | ///
27 | /// 创建者Id
28 | ///
29 | [SugarColumn(ColumnDescription = "创建人Id", IsNullable = true, IsOnlyIgnoreUpdate = true,Length = 36)]
30 | public virtual string cruid { get; set; }
31 |
32 | ///
33 | /// 创建者姓名
34 | ///
35 | [SugarColumn(IsIgnore = true)]
36 | public virtual string cruna { get; set; }
37 |
38 | ///
39 | /// 更新时间
40 | ///
41 | [SugarColumn(ColumnDescription = "更新时间", IsNullable = true)]
42 | public virtual DateTime? uptim { get; set; }
43 |
44 | ///
45 | /// 修改人Id
46 | ///
47 | [SugarColumn(ColumnDescription = "修改人Id", IsNullable = true, Length = 36)]
48 | public virtual string upuid { get; set; }
49 |
50 | ///
51 | /// 修改人姓名
52 | ///
53 | [SugarColumn(IsIgnore = true)]
54 | public virtual string upuna { get; set; }
55 |
56 | ///
57 | /// 可用标记,1可用,0不可用
58 | ///
59 | [SugarColumn(ColumnDescription = "可用标记:1可用,0禁用", IsNullable = true)]
60 | public virtual bool avtag { get; set; } = true;
61 |
62 | [SugarColumn(ColumnDescription = "备注", IsNullable = true, Length = 255)]
63 | public virtual string notes { get; set; }
64 |
65 |
66 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Mon/Server/MonServerApi.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Hosting;
2 |
3 | namespace Vben.Base.Mon.Server;
4 |
5 | [Route("mon/server")]
6 | [ApiDescriptionSettings("Mon", Tag = "服务监控")]
7 | public class MonServerApi(
8 | IHttpContextAccessor httpContextAccessor,
9 | IWebHostEnvironment hostEnvironment)
10 | : ControllerBase
11 | {
12 | [HttpGet]
13 | public dynamic Get()
14 | {
15 | //核心数
16 | int cpuNum = Environment.ProcessorCount;
17 | string computerName = Environment.MachineName;
18 | string osName = RuntimeInformation.OSDescription;
19 | string osArch = RuntimeInformation.OSArchitecture.ToString();
20 | string version = RuntimeInformation.FrameworkDescription;
21 | string appRAM = ((double)Process.GetCurrentProcess().WorkingSet64 / 1048576).ToString("N2") + " MB";
22 | string startTime = Process.GetCurrentProcess().StartTime.ToString("yyyy-MM-dd HH:mm:ss");
23 | string sysRunTime = ComputerHelper.GetRunTime();
24 | string serverIP = httpContextAccessor.HttpContext.Connection.LocalIpAddress.MapToIPv4().ToString() + ":"
25 | + httpContextAccessor.HttpContext.Connection.LocalPort;//获取服务器IP
26 |
27 | var programStartTime = Process.GetCurrentProcess().StartTime;
28 | string programRunTime = DateTimeHelper.FormatTime((DateTime.Now - programStartTime).TotalMilliseconds.ToString().Split('.')[0].ParseToLong());
29 | var data = new
30 | {
31 | cpu = ComputerHelper.GetComputerInfo(),
32 | disk = ComputerHelper.GetDiskInfos(),
33 | sys = new { cpuNum, computerName, osName, osArch, serverIP, runTime = sysRunTime },
34 | app = new
35 | {
36 | name = hostEnvironment.EnvironmentName,
37 | rootPath = hostEnvironment.ContentRootPath,
38 | webRootPath = hostEnvironment.WebRootPath,
39 | version,
40 | appRAM,
41 | startTime,
42 | runTime = programRunTime,
43 | host = serverIP
44 | },
45 | };
46 | return data;
47 | }
48 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Tool/Num/NumUtil.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Tool.Num;
2 |
3 | public class NumUtil
4 | {
5 | // 利用给定的流水位生成第一个流水号
6 | public static string GetFirstSerialNum(int zlength)
7 | {
8 | string serialNum = "";
9 | //流水号为4里下面取3
10 | for (int i = 0; i < zlength - 1; i++)
11 | {
12 | serialNum = serialNum + "0";
13 | }
14 | serialNum = serialNum + "1";
15 | return serialNum;
16 | }
17 |
18 | //根据当前的流水号,生成下一个流水号
19 | public static string getNextSerialNum(string curSerialNum)
20 | {
21 | curSerialNum = "1" + curSerialNum;
22 | int icurSerialNum = int.Parse(curSerialNum);
23 | icurSerialNum++;
24 | curSerialNum = icurSerialNum + "";
25 | curSerialNum = curSerialNum.Substring(1);
26 | return curSerialNum;
27 | }
28 |
29 | public static string getNum(string numNow, string hintType)
30 | {
31 | string numNext = "";
32 | string todayYYYYMM = DateTime.Now.ToString("yyyyMM");
33 | if ("yyyymmxx" == hintType)
34 | {
35 | if (numNow == null)
36 | {
37 | numNext = todayYYYYMM + GetFirstSerialNum(2);
38 | }
39 | else
40 | {
41 | string yyyymm = numNow.Substring(0, 6);
42 | if (todayYYYYMM == yyyymm)
43 | {
44 | numNext = yyyymm + getNextSerialNum(numNow.Substring(numNow.Length - 2));
45 | }
46 | else
47 | {
48 | numNext = todayYYYYMM + GetFirstSerialNum(2);
49 | }
50 | }
51 | }
52 | else if ("xxxxxx" == hintType)
53 | {
54 | if (numNow == null)
55 | {
56 | numNext = GetFirstSerialNum(6);
57 | }
58 | else if (numNow.Length != 6)
59 | {
60 | numNext = GetFirstSerialNum(6);
61 | }
62 | else
63 | {
64 | numNext = getNextSerialNum(numNow);
65 | }
66 | }
67 | return numNext;
68 | }
69 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Mon/Job/Main/MonJobMonitor.cs:
--------------------------------------------------------------------------------
1 | using Furion.Schedule;
2 | using Microsoft.Extensions.Logging;
3 | using Vben.Base.Mon.Job.Log;
4 |
5 | namespace Vben.Base.Mon.Job.Main;
6 |
7 | public class MonJobMonitor : IJobMonitor
8 | {
9 | private readonly ILogger _logger;
10 |
11 | private readonly IServiceScopeFactory _serviceScopeFactory;
12 |
13 | public MonJobMonitor(
14 | ILogger logger,
15 | IServiceScopeFactory serviceScopeFactory
16 | )
17 | {
18 | _logger = logger;
19 | _serviceScopeFactory = serviceScopeFactory;
20 | }
21 |
22 | public Task OnExecutingAsync(JobExecutingContext context, CancellationToken stoppingToken)
23 | {
24 | using var scope = _serviceScopeFactory.CreateScope();
25 | var db = scope.ServiceProvider.GetRequiredService().CopyNew();
26 | MonJobLog log = new MonJobLog();
27 | log.id=YitIdHelper.NextId().ToString();
28 | log.msg=context.RunId;
29 | log.sttim=DateTime.Now;
30 | log.name=context.JobDetail.Description;
31 | log.ret="执行中";
32 | db.Insertable(log).ExecuteCommand();
33 | _logger.LogInformation("执行之前:{context}", context);
34 | return Task.CompletedTask;
35 | }
36 |
37 | public Task OnExecutedAsync(JobExecutedContext context, CancellationToken stoppingToken)
38 | {
39 | using var scope = _serviceScopeFactory.CreateScope();
40 | var db = scope.ServiceProvider.GetRequiredService().CopyNew();
41 | _logger.LogInformation("执行之后:{context}", context);
42 | MonJobLog log =db.Queryable().First(it=>it.msg==context.RunId);
43 | log.entim=DateTime.Now;
44 | log.ret="成功";
45 | log.msg=context.Result;
46 | if (context.Exception != null)
47 | {
48 | log.ret="失败";
49 | log.msg=context.Exception.Message+context.Exception.InnerException;
50 | _logger.LogError(context.Exception, "执行出错啦:{context}", context);
51 | }
52 | db.Updateable(log).ExecuteCommand();
53 | return Task.CompletedTask;
54 | }
55 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Mon/Log/Root/LogEventSubscriber.cs:
--------------------------------------------------------------------------------
1 | using Vben.Base.Mon.Log.Error;
2 | using Vben.Base.Mon.Log.Login;
3 | using Vben.Base.Mon.Oper.Log;
4 | using Vben.Base.Sys.Org.User;
5 |
6 | namespace Vben.Base.Mon.Log.Root;
7 |
8 | public class LogEventSubscriber : IEventSubscriber
9 | {
10 | public LogEventSubscriber(IServiceProvider services)
11 | {
12 | Services = services;
13 | }
14 |
15 | public IServiceProvider Services { get; }
16 |
17 | [EventSubscribe("Create:OperLog")]
18 | public async Task CreateOperLog(EventHandlerExecutingContext context)
19 | {
20 | using var scope = Services.CreateScope();
21 | var repository = scope.ServiceProvider.GetRequiredService>();
22 | var log = (MonOperLog)context.Source.Payload;
23 | await repository.InsertAsync(log);
24 | }
25 |
26 | [EventSubscribe("Create:ErrorLog")]
27 | public async Task CreateErrorLog(EventHandlerExecutingContext context)
28 | {
29 | using var scope = Services.CreateScope();
30 | var repository = scope.ServiceProvider.GetRequiredService>();
31 | var log = (MonLogError)context.Source.Payload;
32 | await repository.InsertAsync(log);
33 | }
34 |
35 | [EventSubscribe("Create:LoginLog")]
36 | public async Task CreateLoginLog(EventHandlerExecutingContext context)
37 | {
38 | using var scope = Services.CreateScope();
39 | var repository = scope.ServiceProvider.GetRequiredService>();
40 | var log = (MonLoginLog)context.Source.Payload;
41 | await repository.InsertAsync(log);
42 | }
43 |
44 | [EventSubscribe("Update:UserLoginInfo")]
45 | public async Task UpdateUserLoginInfo(EventHandlerExecutingContext context)
46 | {
47 | using var scope = Services.CreateScope();
48 | var repository = scope.ServiceProvider.GetRequiredService>();
49 | var log = (SysOrgUser)context.Source.Payload;
50 | await repository.Context.Updateable(log).UpdateColumns(m => new { m.lotim, m.loip })
51 | .ExecuteCommandAsync();
52 | }
53 | }
--------------------------------------------------------------------------------
/vben-modules/Vben.Base/Sys/Org/Group/SysOrgGroupApi.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Base.Sys.Org.Group;
2 |
3 | [Route("sys/org/group")]
4 | [ApiDescriptionSettings("Sys", Tag = "组织架构-群组")]
5 | public class SysOrgGroupApi(SysOrgGroupService groupService) : ControllerBase
6 | {
7 | [HttpGet]
8 | public async Task Get(string name, string catid)
9 | {
10 | var pp = XreqUtil.GetPp();
11 | if (string.IsNullOrEmpty(catid))
12 | {
13 | var items = await groupService.repo.Context.Queryable()
14 | .WhereIF(!string.IsNullOrWhiteSpace(name), t => t.name.Contains(name.Trim()))
15 | .OrderBy(u => u.ornum)
16 | .Select((t) => new { t.id, t.name, t.notes, t.crtim, t.uptim })
17 | .ToPageListAsync(pp.page, pp.pageSize, pp.total);
18 | return RestPageResult.Build(pp.total.Value, items);
19 | }
20 | else
21 | {
22 | var items = await groupService.repo.Context.Queryable()
23 | .Where(t => t.catid == catid)
24 | .OrderBy(u => u.ornum)
25 | .Select((t) => new { t.id, t.name, t.notes, t.crtim, t.uptim })
26 | .ToPageListAsync(pp.page, pp.pageSize, pp.total);
27 | return RestPageResult.Build(pp.total.Value, items);
28 | }
29 | }
30 |
31 | [HttpGet("info/{id}")]
32 | public async Task GetInfo(string id)
33 | {
34 | var group= await groupService.repo.Context.Queryable()
35 | .Where(it => it.id == id)
36 | .Includes(t => t.crman)
37 | .Includes(t => t.upman)
38 | .Includes(t => t.members)
39 | .SingleAsync();
40 | return group;
41 | }
42 |
43 | [HttpPost]
44 | public async Task Post([FromBody] SysOrgGroup group)
45 | {
46 | await groupService.InsertAsync(group);
47 | }
48 |
49 | [HttpPut]
50 | public async Task Put([FromBody] SysOrgGroup group)
51 | {
52 | await groupService.UpdateAsync(group);
53 | }
54 |
55 | [HttpDelete("{ids}")]
56 | public async Task Delete(string ids)
57 | {
58 | await groupService.DeleteAsync(ids);
59 | }
60 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Demo/Demo/Link/Cate/DemoLinkCateController.cs:
--------------------------------------------------------------------------------
1 | namespace Vben.Admin.Demo.Link.Cate;
2 |
3 | ///
4 | /// 关联分类表案例
5 | ///
6 | [Route("demo/link/cate")]
7 | [ApiDescriptionSettings(Tag = "关联分类表案例")]
8 | public class DemoLinkCateConroller(DemoLinkCateService service) : ControllerBase
9 | {
10 | private const string TABLE = "demo_link_cate";
11 |
12 | ///
13 | /// 关联分类表-列表查询
14 | ///
15 | [HttpGet("list")]
16 | public async Task GetList(string name)
17 | {
18 | var list = await service.Repo.Context
19 | .Queryable()
20 | .WhereIF(!string.IsNullOrWhiteSpace(name), t => t.name.Contains(name.Trim()))
21 | .OrderBy(it => it.ornum)
22 | .ToListAsync();
23 | return list;
24 | }
25 |
26 | ///
27 | /// 关联分类表-树状查询
28 | ///
29 | [HttpGet("tree")]
30 | public async Task> GetTree(long id)
31 | {
32 | Sqler sqler=new Sqler(TABLE);
33 | return await service.findTreeList(sqler,id);
34 | }
35 |
36 | ///
37 | /// 关联分类表-详情查询
38 | ///
39 | [HttpGet("info/{id}")]
40 | public async Task GetInfo(long id)
41 | {
42 | return await service.Select(id);
43 | }
44 |
45 | ///
46 | /// 关联分类表-新增
47 | ///
48 | [HttpPost]
49 | public async Task Post([FromBody] DemoLinkCate cate)
50 | {
51 | return await service.Insert(cate);
52 | }
53 |
54 | ///
55 | /// 关联分类表-修改
56 | ///
57 | [HttpPut]
58 | public async Task Put([FromBody] DemoLinkCate cate)
59 | {
60 | return await service.Update(cate,TABLE);
61 | }
62 |
63 | ///
64 | /// 关联分类表-删除
65 | ///
66 | [HttpDelete("{ids}")]
67 | public async Task Delete(string ids)
68 | {
69 | return await service.Delete(ids);
70 | }
71 |
72 | ///
73 | /// 关联分类表-移动
74 | ///
75 | [HttpPost("move")]
76 | public async Task PostMove([FromBody] Lmove po)
77 | {
78 | await service.Move(po,TABLE);
79 | }
80 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Admin/Properties/Vms/C#/controller.vm:
--------------------------------------------------------------------------------
1 | namespace ${options.Namespace};
2 |
3 | ///
4 | /// ${genTable.remark}
5 | ///
6 | [Route("${replaceDto.UrlName}")]
7 | [ApiDescriptionSettings(Tag = "${genTable.remark}")]
8 | public class DemoEasyMainConroller(${genTable.bunam}Service service) : ControllerBase
9 | {
10 | ///
11 | /// ${genTable.remark}分页查询
12 | ///
13 | [HttpGet]
14 | public async Task Get(string name)
15 | {
16 | var pp = XreqUtil.GetPp();
17 | var items = await service.Repo.Context.Queryable<${genTable.bunam}>()
18 | .LeftJoin((t, c) => c.id == t.cruid)
19 | .LeftJoin((t, c, u) => u.id == t.upuid)
20 | .WhereIF(!string.IsNullOrWhiteSpace(name), t => t.name.Contains(name.Trim()))
21 | .Select((t, c, u) => new
22 | {
23 | t.id, t.name, t.crtim, t.uptim, t.notes,
24 | cruna = c.name, upuna = u.name
25 | })
26 | .ToPageListAsync(pp.page, pp.pageSize, pp.total);
27 | return RestPageResult.Build(pp.total.Value, items);
28 | }
29 |
30 | ///
31 | /// ${genTable.remark}详情查询
32 | ///
33 | [HttpGet("info/{id}")]
34 | public async Task<${genTable.bunam}> GetInfo(long id)
35 | {
36 | return await service.Select(id);
37 | }
38 |
39 | ///
40 | /// ${genTable.remark}新增
41 | ///
42 | [HttpPost]
43 | [Oplog(title="${genTable.remark}",type = 1)]
44 | public async Task Post([FromBody] ${genTable.bunam} main)
45 | {
46 | return await service.Insert(main);
47 | }
48 |
49 | ///
50 | /// ${genTable.remark}修改
51 | ///
52 | [HttpPut]
53 | [Oplog(title="${genTable.remark}",type = 2)]
54 | public async Task Put([FromBody] ${genTable.bunam} main)
55 | {
56 | return await service.Update(main);
57 | }
58 |
59 | ///
60 | /// ${genTable.remark}删除
61 | ///
62 | [HttpDelete("{ids}")]
63 | [Oplog(title="${genTable.remark}",type = 3)]
64 | public async Task Delete(string ids)
65 | {
66 | return await service.Delete(ids);
67 | }
68 | }
--------------------------------------------------------------------------------
/vben-apps/Vben.Demo/Properties/Vms/C#/controller.vm:
--------------------------------------------------------------------------------
1 | namespace ${options.Namespace};
2 |
3 | ///
4 | /// ${genTable.remark}
5 | ///
6 | [Route("${replaceDto.UrlName}")]
7 | [ApiDescriptionSettings(Tag = "${genTable.remark}")]
8 | public class DemoEasyMainConroller(${genTable.bunam}Service service) : ControllerBase
9 | {
10 | ///
11 | /// ${genTable.remark}分页查询
12 | ///
13 | [HttpGet]
14 | public async Task Get(string name)
15 | {
16 | var pp = XreqUtil.GetPp();
17 | var items = await service.Repo.Context.Queryable<${genTable.bunam}>()
18 | .LeftJoin((t, c) => c.id == t.cruid)
19 | .LeftJoin