Compare commits

..

281 Commits

Author SHA1 Message Date
陈淳
9c86d7dcbf fix: 同步 2023-02-20 19:57:25 +08:00
陈淳
191ccd0dbe 大小写问题 2023-02-02 17:42:23 +08:00
橙子
27ca377762 添加库存管理,入库、出库,收款、回款接口 2023-01-08 21:52:18 +08:00
橙子
8077450be0 完善采购订单备注 2023-01-08 16:58:53 +08:00
橙子
36c113398d Update Entity.cs 2023-01-08 14:36:03 +08:00
橙子
d73324ea90 Merge branch 'pr_3' into sqlsugar-dev 2023-01-07 19:42:13 +08:00
橙子
aed0b8c2e5 更改使用 2023-01-07 19:41:48 +08:00
陈淳
4ff771b8a6 采购单详情界面 2023-01-06 18:39:54 +08:00
JINBO
898be6c733 增加缓存AOP切面 2023-01-06 16:32:43 +08:00
陈淳
fd018555fa 完善采购订单供应商下拉列表 2023-01-06 15:40:46 +08:00
陈淳
f4280298af 重新生成getlistinput模板,联调接口 2023-01-06 12:02:48 +08:00
陈淳
1ed37897d5 还原部门页面 2023-01-06 11:42:47 +08:00
陈淳
29df3d658b 模板重新生成可空类型 2023-01-06 11:12:47 +08:00
陈淳
576397a042 修改可空类型 2023-01-06 10:15:37 +08:00
橙子
b7c9b84449 更改null操作 2023-01-05 20:32:58 +08:00
陈淳
efbf799218 采购订单添加物料功能 2023-01-05 19:21:48 +08:00
橙子
7d578ce363 创建采购订单接口 2023-01-04 20:50:10 +08:00
陈淳
e03e584684 采购订单搭建 2023-01-04 18:16:56 +08:00
陈淳
e8e6b928cf 完善单位定义界面 2023-01-04 16:47:24 +08:00
陈淳
5f6d29a3f8 自动生成定义管理通用代码 2023-01-04 15:46:29 +08:00
陈淳
a27d83a5e3 Update README.md 2023-01-04 14:09:03 +08:00
陈淳
ef1154d6f3 更新说明 2023-01-04 13:44:35 +08:00
陈淳
ae2400fd0b Merge branch 'sqlsugar-dev' into sqlsugar 2023-01-04 13:40:58 +08:00
陈淳
fbcd004b7e 添加各个木块代码生成 2023-01-04 13:40:30 +08:00
橙子
cb307f95ce update README.md.
Signed-off-by: 橙子 <454313500@qq.com>
2023-01-04 05:39:00 +00:00
橙子
7838cd1a6a Update Yi.Framework.Template.csproj 2023-01-03 21:03:29 +08:00
橙子
03dcb7d860 完善代码生成器自动生成目录 2023-01-03 21:03:07 +08:00
橙子
62c5470efe 添加代码生成器模块service实现 2023-01-03 20:06:16 +08:00
陈淳
53b4674da4 Create ProgramTemplateProvider.cs 2023-01-03 18:14:18 +08:00
陈淳
ff2cf68b08 添加模板生成代码 2023-01-03 18:05:57 +08:00
陈淳
8b55373794 更新文件helper 2023-01-03 16:03:11 +08:00
橙子
dba67d7127 添加供应商定义模块 2023-01-02 23:32:40 +08:00
橙子
762c455b53 删除多余文件 2023-01-02 21:18:38 +08:00
chenchun
714d1a36c4 添加供应商 2023-01-02 17:27:12 +08:00
chenchun
0e0ddbbd99 Update README.md 2023-01-02 15:09:59 +08:00
chenchun
497f8cfd1f 添加erp模块 2023-01-02 15:08:04 +08:00
chenchun
1ff709e6f8 优化分层结构,添加常量 2023-01-02 14:29:16 +08:00
chenchun
ea35871aba 使用sqlsugar内置工作单元 2023-01-02 13:59:05 +08:00
chenchun
0e78857645 添加自动映射 2023-01-02 00:09:30 +08:00
chenchun
5d7d115910 添加dto模式的demo测试 2023-01-01 23:51:05 +08:00
chenchun
b9384afd5d 爆肝,重构框架,你懂得 2023-01-01 23:06:11 +08:00
陈淳
dbe020dc94 添加工作单元测试 2022-12-29 09:53:45 +08:00
陈淳
9673aa7690 Merge branch 'sqlsugar' into sqlsugar-dev 2022-12-29 09:08:43 +08:00
黎明
ec06d30d59 添加工作单元 2022-12-26 14:19:12 +08:00
橙子
356d2e592b Update README.md 2022-12-20 15:32:59 +08:00
橙子
521c2e7ca6 Update README.md 2022-12-18 23:17:23 +08:00
陈淳
c4014c9333 更新单元测试 2022-12-16 16:00:36 +08:00
陈淳
2908a8d8a9 测试兼容中间件方式测验 2022-12-14 23:27:54 +08:00
陈淳
c964b98240 添加xunit单元测试 2022-12-14 00:14:22 +08:00
陈淳
f7c74b5c96 Quartz更改,使用内置注册 2022-12-13 23:12:10 +08:00
陈淳
d34c9818b4 更改mit协议 2022-12-13 23:01:23 +08:00
陈淳
6414c93116 Update README.md 2022-12-09 10:58:42 +08:00
陈淳
5a12c4a3ce Update README.md 2022-12-06 23:41:41 +08:00
陈淳
97a6ee39e5 Update README.md 2022-12-05 23:18:10 +08:00
陈淳
44db5ab150 添加评论功能 2022-12-01 16:06:53 +08:00
陈淳
e9bcd29e36 评论建表 2022-12-01 13:38:06 +08:00
橙子
a2ca897fca 社区板块添加点赞功能 2022-11-29 23:03:10 +08:00
陈淳
9a34e63d5f 点赞功能接口开发 2022-11-29 18:47:26 +08:00
陈淳
e501b894c3 job异常处理 2022-11-29 12:49:36 +08:00
陈淳
d97ef84b7e 删除hangfire(不支持毫秒级别)
This reverts commit 49a9eb5460.
2022-11-29 12:34:45 +08:00
陈淳
0f2dc4d3ba Merge branch 'sqlsugar-dev' of https://gitee.com/ccnetcore/Yi into sqlsugar-dev 2022-11-29 12:31:28 +08:00
橙子
49a9eb5460 hangfire测试 2022-11-27 15:05:27 +08:00
陈淳
7e7780a754 Update README.md 2022-11-21 11:20:24 +08:00
陈淳
d0770970f0 Merge branch 'sqlsugar-dev' of https://gitee.com/ccnetcore/Yi into sqlsugar-dev 2022-11-20 23:36:02 +08:00
陈淳
d5a10a5817 Update README.md 2022-11-19 18:18:03 +08:00
橙子
7b63d8b2ba Update README.md 2022-11-16 19:49:48 +08:00
陈淳
c544de8909 Update README.md 2022-11-14 17:04:39 +08:00
橙子
89da2ab50f 菜单权限管控 2022-11-13 22:52:03 +08:00
陈淳
a1a6b5967b Update README.md 2022-11-12 16:58:58 +08:00
陈淳
53ffb1b565 Update README.md 2022-11-11 08:54:11 +08:00
陈淳
6efecd123f Update README.md 2022-11-09 08:53:48 +08:00
陈淳
1ec5349a96 1108 2022-11-08 21:02:50 +08:00
陈淳
187abcd10c 编码转换 2022-11-07 21:45:29 +08:00
陈淳
d6ca4429d5 添加属性依赖注入、添加自定义日志扩展 2022-11-07 01:31:37 +08:00
陈淳
86e869ff16 注释 2022-11-06 21:38:55 +08:00
陈淳
dc58f9397f saas分库,仓储+公共库+业务库+动态配置连接串框架搭建 2022-11-06 20:22:32 +08:00
陈淳
97b4ab2f15 数据权限功能、用户信息缓存 2022-11-04 23:23:54 +08:00
陈淳
23a9d02aba 修复sqlserver codefirst的问题 2022-11-02 16:36:08 +08:00
陈淳
32ed6c3e97 准备接入Saas多租户 2022-11-02 11:06:41 +08:00
陈淳
102556dd2a 准备接入多租户 2022-11-02 08:48:01 +08:00
陈淳
2df3f7c56d 删除测试文件 2022-10-29 10:33:51 +08:00
陈淳
d6fd02ec19 修复路由切换问题 2022-10-29 10:33:08 +08:00
陈淳
c901b4bc06 时间单位精确到秒 2022-10-28 17:38:14 +08:00
陈淳
e19c89ccd9 修复jwt配置文件问题 2022-10-28 17:22:02 +08:00
陈淳
a667f1a65e 验证码缓存接入 2022-10-28 14:25:59 +08:00
陈淳
9f5829876c 登录验证码 2022-10-28 14:10:11 +08:00
陈淳
189d7c4719 缓存接入 2022-10-27 20:54:05 +08:00
陈淳
dfe877c438 缓存测试 2022-10-26 20:08:16 +08:00
陈淳
3a634d7888 配置文件更改 2022-10-26 20:01:18 +08:00
陈淳
fd9f3d04d9 商品首页完善 2022-10-25 10:59:51 +08:00
陈淳
ac70fc37f6 商品子页面完善 2022-10-25 09:47:30 +08:00
橙子
c29aeeee41 缓存搭建 2022-10-24 22:31:53 +08:00
橙子
51c13c7b52 角色 权限code完善 2022-10-24 21:22:03 +08:00
橙子
fec8c0fe53 Merge branch 'sqlsugar-dev' of https://gitee.com/ccnetcore/Yi into sqlsugar-dev 2022-10-23 22:29:44 +08:00
橙子
5da2143212 10/23更新 2022-10-23 22:29:35 +08:00
陈淳
30158ac145 spu、skus数据测试 2022-10-20 18:11:54 +08:00
陈淳
ff7eecee55 10/20更新 2022-10-20 16:33:29 +08:00
陈淳
0755a4026a 修复codefirst 2022-10-19 19:10:48 +08:00
陈淳
9aaf363584 10/19更新 2022-10-19 14:34:53 +08:00
陈淳
0a27cd7403 商城模块 2022-10-18 19:27:58 +08:00
陈淳
ab8cdd88b9 添加codeFirst功能 2022-10-18 18:01:16 +08:00
陈淳
dab4a092d9 sql日志打印输出配置 2022-10-18 09:01:16 +08:00
陈淳
9d365dbf1e 改造null 2022-10-17 18:08:16 +08:00
橙子
16d25fb60d 添加缩略图同步功能 2022-10-17 01:10:31 +08:00
橙子
50d43a2fc5 完善推荐页显示 2022-10-16 22:51:53 +08:00
橙子
6d99539730 修复列表展示问题 2022-10-16 16:09:45 +08:00
橙子
cf43dc8e70 修复上传问题 2022-10-16 15:54:49 +08:00
橙子
95c506c638 修复菜单排序问题 2022-10-16 13:43:23 +08:00
橙子
464b768c55 Revert "文章标题默认值"
This reverts commit 00ca4cc5bd.
2022-10-16 13:18:07 +08:00
橙子
00ca4cc5bd 文章标题默认值 2022-10-16 13:16:40 +08:00
橙子
bfb81ef60d 10/16更新 2022-10-16 13:15:43 +08:00
陈淳
420701bf23 文章管理、前端api、视图代码模板生成 2022-10-14 18:08:45 +08:00
橙子
88073aaa20 样式优化 2022-10-14 02:18:25 +08:00
橙子
8456320884 头像上传功能、性别选择 2022-10-13 23:55:21 +08:00
陈淳
3555b08fe8 修改数据 2022-10-13 14:47:45 +08:00
陈淳
55ad046e96 文件种子数据 2022-10-13 14:46:30 +08:00
陈淳
ea4ddb68f3 修复页面加载不出的问题 2022-10-13 14:04:48 +08:00
陈淳
edde5f8a88 前端登录逻辑对接 2022-10-13 11:05:43 +08:00
陈淳
de28fd4ca4 登录前后端联调对接 2022-10-12 19:00:26 +08:00
陈淳
dd7bbb138a 文件上传功能优化 2022-10-12 14:43:35 +08:00
陈淳
4a54eb56a7 完善登录页面 2022-10-12 14:20:03 +08:00
陈淳
24cda70cbc 登录页面搭建 2022-10-11 18:18:19 +08:00
陈淳
a0c869d0a1 前端联调接口 2022-10-11 16:48:25 +08:00
橙子
58f85992b0 设置及发表图文页面 2022-10-10 00:02:13 +08:00
陈淳
f11f5e1ca4 Update components.d.ts 2022-10-09 17:36:12 +08:00
陈淳
0672698ba7 添加特性自动依赖注入 2022-10-09 17:32:44 +08:00
陈淳
cf37f7c950 完善我的页面 2022-10-09 13:30:42 +08:00
陈淳
c7d64554ad 升级httphelper 2022-10-09 09:54:41 +08:00
橙子
039021532e 我的页面 2022-10-09 01:10:30 +08:00
橙子
e39ae170c3 tab与添加主页 2022-10-09 00:14:17 +08:00
橙子
8a44fe9d1c 推荐页面优化 2022-10-08 23:05:19 +08:00
橙子
70649653fb vant搭建 2022-10-05 23:54:53 +08:00
橙子
db1f241c33 Update TestController.cs 2022-10-04 15:22:34 +08:00
橙子
c9ed317e62 修复在线用户重连问题 2022-10-03 22:56:36 +08:00
橙子
afde26a7ae Update README.md 2022-10-03 18:51:51 +08:00
橙子
1a2d9ba2b2 强制退出功能 2022-10-03 18:27:37 +08:00
橙子
3943536485 实时在线用户功能 2022-10-03 17:04:59 +08:00
橙子
e963a4051f 添加登录日志功能 2022-10-02 14:02:21 +08:00
橙子
2b02194a18 修改sql日志打印 2022-10-02 11:49:19 +08:00
橙子
dd1aec3b60 操作日志功能完善 2022-10-01 23:53:43 +08:00
橙子
0b05d4d186 操作类型完善修改 2022-10-01 15:26:30 +08:00
橙子
8f0327604f 添加日志管理动态多级菜单 2022-10-01 15:04:35 +08:00
陈淳
40dddb3316 获取请求参数扩展 2022-09-29 18:01:19 +08:00
陈淳
be7ea64c5a 操作日志特性、操作日志全局过滤器搭建 2022-09-29 17:02:34 +08:00
陈淳
8eef0e410e 更新 2022-09-29 16:14:50 +08:00
陈淳
63f0b20fd6 通用数据导入功能 2022-09-29 10:03:21 +08:00
陈淳
87a685b823 通用数据控制器 2022-09-28 18:05:49 +08:00
陈淳
4796a494de 数据导入功能 2022-09-28 16:54:53 +08:00
陈淳
a329ff3796 注释 2022-09-27 19:31:34 +08:00
陈淳
00ab65e720 数据导出 2022-09-27 19:30:11 +08:00
陈淳
4997e25cdc 数据模板导入、数据导出 2022-09-27 19:27:17 +08:00
陈淳
6ce05984d5 权限code过滤器 2022-09-27 16:22:34 +08:00
陈淳
26e08774b0 更换背景图片 2022-09-26 16:15:51 +08:00
橙子
83ce9fb4c4 修复部署问题 2022-09-26 00:27:55 +08:00
橙子
ac946f4903 Update .env.staging 2022-09-25 20:54:33 +08:00
橙子
d6480db609 update README.md.
Signed-off-by: 橙子 <454313500@qq.com>
2022-09-25 12:51:52 +00:00
橙子
9f9c191240 readme 2022-09-25 20:50:51 +08:00
橙子
cb781aa4ad Update README.md 2022-09-25 20:47:07 +08:00
橙子
6a31e88855 swagger跳转 2022-09-25 20:41:55 +08:00
橙子
f862e5ea1b 用户去重判定 2022-09-25 20:04:04 +08:00
橙子
b8de3e9867 前端修改 2022-09-25 19:56:14 +08:00
橙子
1959160681 重置部门选择 2022-09-25 19:07:42 +08:00
橙子
b665ec5717 部门种子数据 2022-09-25 18:58:17 +08:00
橙子
8ef2c12be1 添加字典初始化 2022-09-25 18:06:07 +08:00
橙子
d85e7f0bcb Merge branch 'sqlsugar-dev' of https://gitee.com/ccnetcore/Yi into sqlsugar-dev 2022-09-24 20:28:57 +08:00
陈淳
544d65c7d0 Update README.md 2022-09-23 18:55:12 +08:00
陈淳
1bd5fc389a 字典样式类型及样式class设置 2022-09-23 18:53:59 +08:00
陈淳
9149d6de9a 配置管理增删改查 2022-09-23 18:46:37 +08:00
陈淳
261d9fcd79 Update README.md 2022-09-23 16:03:32 +08:00
橙子
5ecac4223d Update README.md 2022-09-22 19:42:17 +08:00
陈淳
215c21ad8a Update README.md 2022-09-21 19:01:30 +08:00
陈淳
5772de888c 岗位、部门种子数据 2022-09-20 20:57:01 +08:00
陈淳
55979e90dc 菜单角色种子 2022-09-20 15:11:55 +08:00
陈淳
5785f5beea 数据库种子初始化搭建 2022-09-19 17:25:43 +08:00
陈淳
e8bb256a8d 添加种子数据基础 2022-09-19 14:24:13 +08:00
chenchun
729a563545 添加模块 2022-09-18 17:50:38 +08:00
chenchun
1b38ed5c78 Update README.md 2022-09-18 17:49:17 +08:00
chenchun
483aea5c4f 数据权限功能 2022-09-18 17:22:47 +08:00
chenchun
a64d493a29 添加验证码 2022-09-18 16:46:31 +08:00
陈淳
2a8d436267 添加验证码 2022-09-17 18:09:18 +08:00
陈淳
7905f82d65 验证码 2022-09-16 20:01:01 +08:00
陈淳
dcf82d041a 验证码 2022-09-16 19:57:56 +08:00
陈淳
9618bd891f 添加用户性别字段 2022-09-16 19:18:24 +08:00
陈淳
c63f9de5c5 数据权限更新页面 2022-09-16 19:04:40 +08:00
陈淳
0e6113f0a6 数据权限 2022-09-16 18:57:32 +08:00
陈淳
71cf85f535 数据权限查询 2022-09-15 19:45:51 +08:00
陈淳
2a4f646181 数据权限 2022-09-15 19:05:57 +08:00
陈淳
0cc326836c 数据范围枚举 2022-09-15 18:59:01 +08:00
陈淳
52b8bc8909 上下文对象获取用户id扩展 2022-09-15 18:44:12 +08:00
陈淳
844a7b455c 鉴权 2022-09-15 18:40:24 +08:00
陈淳
489a0b6fb8 配置文件热重载功能 2022-09-15 17:09:30 +08:00
陈淳
e535133eca 个人中心信息更新、重置cc密码 2022-09-14 20:35:45 +08:00
陈淳
ea2be7609c 修复状态问题、用户中心页面查询及修改 2022-09-14 19:53:53 +08:00
陈淳
011d9d639b 用户部门查询 2022-09-13 19:39:16 +08:00
陈淳
e78e9d8e55 用户列表部门岗位角色信息 2022-09-13 19:04:41 +08:00
陈淳
89762cad78 路由构建充血模型 2022-09-13 18:15:01 +08:00
陈淳
4788562241 用户界面部门角色岗位选择 2022-09-13 17:59:35 +08:00
陈淳
5b1ad450d3 部门管理:增删改查、用户部门显示 2022-09-13 17:50:20 +08:00
陈淳
7b6d8671cf 岗位管理:增删改查功能 2022-09-13 17:05:53 +08:00
chenchun
01631860f4 菜单完善 2022-09-11 22:05:56 +08:00
chenchun
c65e76bbc3 树形构造器修改 2022-09-11 16:49:40 +08:00
chenchun
ef35e1cfd9 接口名称简化 2022-09-11 15:55:08 +08:00
chenchun
1d535b5d61 角色添加、角色编辑关联菜单功能 2022-09-11 15:39:55 +08:00
chenchun
004cb20132 添加角色关联菜单功能 2022-09-11 14:52:54 +08:00
chenchun
909bdf60e7 重置密码功能 2022-09-11 13:16:24 +08:00
chenchun
0cd3bea6bd 用户信息添加修改 2022-09-11 12:39:22 +08:00
chenchun
d001a0de15 用户编辑界面 2022-09-11 02:39:33 +08:00
chenchun
0dca7acee6 简单基类控制器封装 2022-09-10 20:49:46 +08:00
chenchun
b5ad7a1721 字典页面与字典信息页面完成增删改查 2022-09-10 20:25:39 +08:00
chenchun
9f23b911c1 字典信息表查询删除接口 2022-09-10 20:05:45 +08:00
chenchun
1db8bb4d13 字典类型查询 2022-09-10 14:02:41 +08:00
chenchun
eebafda9e5 db查询对象简化 2022-09-10 13:36:01 +08:00
陈淳
0fb57a0a2c 菜单类型接口 2022-09-09 19:34:20 +08:00
陈淳
d4c55620f1 菜单到前端路由转换 2022-09-09 19:22:14 +08:00
陈淳
ef26567850 添加目录、菜单、控件 2022-09-09 18:15:10 +08:00
陈淳
c15c43dba4 用户角色菜单数据对应 2022-09-09 16:52:32 +08:00
陈淳
5d738d99fe 分页参数时间范围处理 2022-09-09 15:53:11 +08:00
陈淳
43120b0017 测试 2022-09-08 18:24:51 +08:00
陈淳
23dc82f042 vue动态路由测试 2022-09-08 18:18:34 +08:00
陈淳
49330536c7 vue3.x-ruoyi前端 2022-09-07 18:30:43 +08:00
陈淳
781fa7ea1b ruoyi对接
登录接口、用户信息接口、用户管理接口等
2022-09-07 18:22:15 +08:00
橙子
bf17312a5f 9/06更新 2022-09-06 23:32:17 +08:00
陈淳
e4da8d4f15 对接ruoyi接口
用户、角色、菜单查询部分
2022-09-06 19:32:32 +08:00
陈淳
cc26bd09e6 Merge branch 'sqlsugar-dev' into sqlsugar 2022-09-04 18:47:51 +08:00
陈淳
9dc1c5c9e9 添加实时通信 2022-09-04 18:47:39 +08:00
陈淳
442ae94ad5 Merge branch 'sqlsugar-dev' into sqlsugar 2022-08-13 18:12:12 +08:00
陈淳
43820f71a3 Update README.md 2022-08-13 18:11:19 +08:00
陈淳
63920e034a 单例redis、rabbitmq更新、任务调度更新 2022-08-13 18:10:11 +08:00
陈淳
cddc47305f Update README.md 2022-07-13 10:34:29 +08:00
陈淳
583bebd10c Merge branch 'sqlsugar-dev' into sqlsugar 2022-07-13 10:33:08 +08:00
陈淳
7fe9a6c900 项目引用更新 2022-07-13 10:32:43 +08:00
chenchun
670e457dc6 Merge branch 'sqlsugar-dev' into sqlsugar 2022-06-22 14:07:21 +08:00
chenchun
300d8224ec 升级excel操作 2022-06-22 14:07:09 +08:00
橙子
924f5320bb Merge branch 'sqlsugar-dev' of https://gitee.com/ccnetcore/Yi into sqlsugar-dev 2022-06-04 14:41:08 +08:00
橙子
dd09fb2283 Update README.md 2022-06-04 14:40:59 +08:00
chenchun
3e18af626b Update README.md 2022-05-29 16:56:46 +08:00
chenchun
89dd5b79d6 Merge branch 'sqlsugar-dev' into sqlsugar 2022-05-29 16:56:11 +08:00
chenchun
356f71f13e 添加高级保存及查询排序方式 2022-05-29 16:56:02 +08:00
橙子
2f5d71a299 Merge branch 'sqlsugar-dev' into sqlsugar 2022-05-28 10:32:50 +08:00
橙子
b581c12edb 实体更改使用newjson 2022-05-28 10:32:12 +08:00
橙子
d4d6aeb0b4 Update README.md 2022-05-25 23:18:31 +08:00
橙子
77114e6cfc Merge branch 'sqlsugar-dev' into sqlsugar 2022-05-22 20:58:26 +08:00
橙子
e14a078440 修复了前端用户信息更新存储的bug 2022-05-22 20:58:17 +08:00
橙子
3b38a0d628 完善界面 2022-05-19 23:29:37 +08:00
橙子
927d8cb6c9 Update README.md 2022-05-14 17:51:09 +08:00
橙子
eb8ea2f549 Update README.md 2022-05-14 17:46:52 +08:00
橙子
208c93bc8f 添加微信支付模块 2022-05-14 17:45:17 +08:00
橙子
93180faa23 Merge branch 'sqlsugar-dev' into sqlsugar 2022-05-13 23:10:10 +08:00
橙子
816858f231 修改前端样式 2022-05-13 23:08:52 +08:00
橙子
fa1d68848f Update README.md 2022-05-12 23:40:27 +08:00
橙子
bce955a1e1 添加按钮权限 2022-05-12 23:39:42 +08:00
chenchun
82f70e0ac9 Update menuDic.js 2022-05-12 19:37:33 +08:00
chenchun
fc9b78cfef jwt授权不在需要添加bear 2022-05-11 16:24:36 +08:00
chenchun
72400a48da 添加sql参数 2022-05-11 12:21:59 +08:00
橙子
537b39b3c4 Update README.md 2022-05-08 14:46:53 +08:00
橙子
47e6e48729 Merge branch 'sqlsugar-dev' into sqlsugar 2022-05-08 14:46:35 +08:00
橙子
d252229777 完善动态菜单、设置角色等功能,修复登录问题 2022-05-08 14:46:22 +08:00
橙子
7f4c7f607d Update README.md 2022-05-06 22:57:36 +08:00
橙子
994ba5dd1a Merge branch 'sqlsugar-dev' into sqlsugar 2022-05-06 22:56:40 +08:00
橙子
e3a06b28dd 更新数据库 2022-05-06 22:56:26 +08:00
橙子
10d512470e 合并冲突 2022-05-06 22:51:45 +08:00
橙子
c1d8040fd5 合并冲突 2022-05-06 22:49:12 +08:00
橙子
e4b81da386 Merge branch 'sqlsugar-dev' of https://gitee.com/ccnetcore/Yi into sqlsugar-dev 2022-05-06 22:47:35 +08:00
橙子
fd7360e6f4 预添加前端权限控制 2022-05-06 22:47:26 +08:00
chenchun
62f15e218e Merge branch 'sqlsugar-dev' into sqlsugar 2022-05-05 17:05:12 +08:00
chenchun
5c1b91f348 完善权限 2022-05-05 17:04:49 +08:00
橙子
378cbd580f Update README.md 2022-05-04 15:55:19 +08:00
橙子
3994f14010 通用对象查询封装、权限封装 2022-05-04 15:54:40 +08:00
橙子
e7f4e743e3 Update README.md 2022-05-03 19:42:47 +08:00
橙子
b934ce2893 添加文件操作 2022-05-03 19:40:13 +08:00
橙子
5eec076ea2 添加前端权限 2022-05-03 17:34:38 +08:00
橙子
ada36ebff5 Update README.md 2022-05-01 18:33:04 +08:00
橙子
d9543ca23c 添加修改密码及用户信息 2022-05-01 18:31:06 +08:00
橙子
3871eb3c84 Update README.md 2022-04-30 22:14:49 +08:00
橙子
4ba696d289 添加用户简介 2022-04-30 22:12:25 +08:00
橙子
2f69e0b96c 添加前端用户信息展示 2022-04-30 22:04:47 +08:00
橙子
d6b0c56c35 添加登录用户全部信息查询 2022-04-30 21:48:18 +08:00
橙子
d8fe983b9d Update README.md 2022-04-29 12:58:35 +08:00
橙子
76079faca0 Merge branch 'sqlsugar-dev' into sqlsugar 2022-04-29 12:55:33 +08:00
橙子
5d5c62123c 修复代理问题 2022-04-29 12:55:18 +08:00
橙子
6c7b2224b1 完善角色菜单分配管理 2022-04-29 12:38:19 +08:00
960 changed files with 51899 additions and 3752 deletions

63
.gitattributes vendored
View File

@@ -1,63 +0,0 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain

214
LICENSE
View File

@@ -1,201 +1,21 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
MIT License
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
Copyright (c) 2022 jacktang
1. Definitions.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

109
README.md
View File

@@ -1,7 +1,7 @@
<h1 align="center"><img align="left" height="100px" src="https://user-images.githubusercontent.com/68722157/138828506-f58b7c57-5e10-4178-8f7d-5d5e12050113.png"> Yi框架</h1>
<h4 align="center">一套与SqlSugar一样爽的.Net6低代码开源框架</h4>
<h4 align="center">一套与SqlSugar一样爽的.Net6开源框架</h4>
<h2 align="center">集大成者,终究轮子</h2>
[English](README-en.md) | 简体中文
@@ -10,17 +10,21 @@
****
### 简介:
**中文:意框架**(和他的名字一样“简易”)
**中文:意框架**(和他的名字一样“简易”同时接入Java的Ruoyi Vue3.0前端
模块分化较多,可根据业务自行引用或抛弃,集大成者,大而全乎,也许你能从中学习到一些独特见解
正在持续更进业务模块已接入ruoyi
**英文YiFramework**
Yi框架-一套与SqlSugar一样爽的.Net6低代码开源框架。
与Sqlsugar理念一致以用户体验出发。
架构干净整洁、无业务代码、采用微软风格原生框架封装、WebFrist开发。
架构干净整洁、无业务代码、采用微软风格原生框架封装、CodeFrist+配套自研文件模板代码生成器 开发。
适合.Net6学习、Sqlsugar学习 、项目二次开发。
集大成者,终究轮子
Yi框架最新版本标签`v1.0.5`,具体版本可以查看标签迭代
Yi框架最新版本标签`v1.2.1`,具体版本可以查看标签迭代
项目与Sqlsugar同步更新但这作者老杰哥代码天天爆肝到凌晨两点我们也尽量会跟上他的脚步。更新频繁所以可watching持续关注。
@@ -28,11 +32,21 @@ Yi框架最新版本标签`v1.0.5`,具体版本可以查看标签迭代
**分支**
本项目由EFCore版本历经3年不断迭代至Sqlsugar版本现EFcore版本已弃用目前sqlsugar不带任何业务,之后会更新业务功能)
本项目由EFCore版本历经3年不断迭代至Sqlsugar版本现EFcore版本已弃用目前sqlsugar已带业务功能)
**SqlSugar**:.Net6 DDD领域驱动设计 简单分层微服务架构
**ec**:EFcore完整电商项目
- Yi.Framework.Net6.NetCore 6 意框架 (后端)
- Yi.Vue3.X.RuoYiVue3 RuoYi前端框架 (前端后台)
你没有听错已经接入java流行指数最高最火爆的框架之一与其他框架不同Yi框架后端为完全重制版并非为ruoyi java模仿版
- Yi.Vue3.x.VantVue3 移动端前端框架 (前端前台)持续迭代
**SqlSugar-Dev**为sqlsugar分支的实时开发版本
~~**ec**: EFcore完整电商项目~~
****
@@ -40,19 +54,15 @@ Yi框架最新版本标签`v1.0.5`,具体版本可以查看标签迭代
废话少说直接上地址,**请不要**更改里面的数据
API服务~~[yi.ccnetcore.com](http://yi.ccnetcore.com) 管理员账号:admin 、 123~~
API服务[yi.ccnetcore.com](http://yi.ccnetcore.com) 管理员账号:cc 、 123456
网关地址:~~[gate.ccnetcore.com/swagger](http://gate.ccnetcore.com/swagger)~~
WebFirst开发所有代码生成器已经配置完成无需任何操作数据库及任何代码只需要网页表格上点点点即可
~~WebFirst开发所有代码生成器已经配置完成无需任何操作数据库及任何代码只需要网页表格上点点点即可~~
[https://www.donet5.com/Doc/11](https://www.donet5.com/Doc/11)
代码自动生成:
谁能把持的住Sqlsugar作者自己都依赖成瘾的东西呢这是继DbFirst、CodeFirst下一代的划时代产品无脑爽
![image](https://s1.ax1x.com/2022/04/12/Lnm5Yq.png)
(首次添加实体后,生成代码记得修改对应的路径哦~~
![代码生成](Readme/%E4%BB%A3%E7%A0%81%E7%94%9F%E6%88%90.gif)
### 支持:
@@ -72,7 +82,7 @@ WebFirst开发所有代码生成器已经配置完成无需任何操作数
**身份验证**JWT、IdentityServer4
**组件**~~EFcore~~SqlSugar、Autofac、Castle、Swagger、Log4Net、Redis、RabbitMq、ES、Quartz.net、~~T4~~
**组件**SqlSugar、Autofac、Castle、Swagger、Log4Net、Redis、RabbitMq、ES、Quartz.net、~~T4~~
**分布式**CAP、Lock
@@ -81,7 +91,44 @@ WebFirst开发所有代码生成器已经配置完成无需任何操作数
**封装**Json处理模块滑动验证码模块base64图片处理模块异常捕捉模块、邮件处理模块、linq封装模块、随机数模块、统一接口模块、基于策略的jwt验证、过滤器、数据库连接、跨域、初始化种子数据、Base32、Console输出、日期处理、文件传输、html筛选、http请求、ip过滤、md5加密、Rsa加密、序列化、雪花算法、字符串处理、编码处理、地址处理、xml处理、心跳检查。。。
****
### 支持模块:
<h3>业务支持模块</h3>
RABC权限管理系统正在更新
大部分ruoyi功能采用ruoyi前端
- 用户管理
- 角色管理
- 菜单管理
- 部门管理
- 岗位管理
- 字典管理
- 参数管理
- 用户在线
- 操作日志
- 登录日志
- 等等
ERP进销存系统正在更新
- 供货商管理
- 等等
BBS论坛系统持续迭代
- 文章管理
- 评论管理
- 等等
SHOP电商系统持续迭代
- SPU管理
- SKU管理
- 商品规格
- 商品分类
- 等等
![输入图片说明](Readme/%E7%94%A8%E6%88%B7%E7%AE%A1%E7%90%86.png)
![输入图片说明](Readme/%E8%8F%9C%E5%8D%95%E7%AE%A1%E7%90%86.png)
### 框架支持模块:
大致如图:
@@ -94,9 +141,6 @@ WebFirst开发所有代码生成器已经配置完成无需任何操作数
- [x] 支持采用`异步`开发awit/async
- [x] 支持数据库主从`读写分离`
- [x] 支持功能替换,无需改动代码,只需配置`json文件`进行装配即可
- [x] ~~-支持采用DbFirst开发方式使用`T4模板代码生成器`自动映射模型一键生成Service及IService所有代码~~
- [x] 支持WebFirst无需改动代码自动生成全套代码与数据库只需点点点
- [x] ~~-支持`用户-角色-菜单-接口`以及vue2.0前端全部逻辑代码,下载无需修改直接使用~~
- [x] 支持`Aop封装`FilterAop、IocAop、LogAop、SqlAop
- [x] 支持`Log4Net日志`记录自动生成至bin目录下的logs文件夹
- [x] 支持`DbSeed数据库种子数据`接入
@@ -109,11 +153,12 @@ WebFirst开发所有代码生成器已经配置完成无需任何操作数
- [x] 支持`健康检查`
- [x] 支持`RabbitMQ`消息队列
- [x] 支持`Redis`多级缓存
- [x] 支持`MemoryCache`多级缓存
- [x] 支持`Ocelot`网关路由、服务聚合、服务发现、认证、鉴权、限流、熔断、缓存、Header头传递
- [x] 支持`Apollo`全局配置中心;
- [x] 支持`docker`镜像制作
- [x] ~~-支持页面`静态化处理`,将动态页面生成静态页面~~
- [x] 支持`Quartz.net`任务调度,实现任意接口被调度
- [x] 支持`ThumbnailSharp`缩略图封装
- [x] 支持`ELK`log4net+kafka+es+logstach+kibana
- [x] 支持`IdentityService4`授权中心
- [x] 支持`Es`分词查询
@@ -122,13 +167,18 @@ WebFirst开发所有代码生成器已经配置完成无需任何操作数
- [x] 支持`Docker+k8s`部署
- [x] 支持`Jenkins+CI/CD`
- [x] 支持`AutoMapper`模块映射
- [ ] 支持`微信支付`(没账号)
- [x] 支持`微信支付`模块
- [x] 支持`单表多租户`常用功能
- [x] 支持`逻辑删除`常用功能
- [x] 支持`操作日志`常用功能
- [x] 支持`自动分表`
- [x] 支持`数据权限`
- [x] 支持`CodeFrist`快速构建数据库
- [x] 支持自研文件版`代码生成器`快速构建通用代码
- [x] 支持完整`Dto`模式
- [x] 支持 太多了忘了
****
### 目录结构:
@@ -140,10 +190,11 @@ WebFirst开发所有代码生成器已经配置完成无需任何操作数
分层如此清晰什么还感觉太复杂了用户只需关注Api、Service其他都是轮子啊
~~- BackGround后台进程目前可以无视,等待更新)~~
- Client客户端测试、客户端
- BackGround后台进程通常使用消息队列进行消费任务)
- Test测试单元测试
- Domain领域层Dto、服务接口层、模型层、仓储层、服务层
- Infrastructure基础实例层(通用工具层、核心层、定时任务Job、国际化、Web扩展层)
- Module模块层其他模块可按需进行引入例如微信支付、代码生成
- MicroServiceInstance服务层微服务
****
@@ -151,14 +202,20 @@ WebFirst开发所有代码生成器已经配置完成无需任何操作数
我们将在之后更新教程手册!
后端
1. 下载全部源码默认使用sqlite数据库已经生成
2. 直接点击sln文件运行即可没有其他依赖
2. 直接点击sln文件运行即可没有任何其他依赖
前端
1. 下载全部源码npm i 安装依赖
2. 使用npm run dev进行运行
****
### 使用说明:
1. 导入使用仓库中的WebFirst数据库
2. 使用WebFirst添加实体、同步实体、修改模板生成路径并生成方案
~~1. 导入使用仓库中的WebFirst数据库~~
~~2. 使用WebFirst添加实体、同步实体、修改模板生成路径并生成方案~~
没了,恭喜你已经成功完成了项目,并且已经具备大部分通用场景业务
是不是一个字?爽!

Binary file not shown.

View File

@@ -4,11 +4,6 @@
<name>Yi.Framework.ApiMicroservice</name>
</assembly>
<members>
<member name="T:Yi.Framework.ApiMicroservice.Controllers.AccountController">
<summary>
账户管理
</summary>
</member>
<member name="T:Yi.Framework.ApiMicroservice.Controllers.BaseCrudController`1">
<summary>
Json To Sql 类比模式,通用模型
@@ -22,13 +17,13 @@
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.BaseCrudController`1.GetList(Yi.Framework.Model.Query.QueryCondition)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.BaseCrudController`1.GetList(Yi.Framework.Model.Base.Query.QueryCondition)">
<summary>
列表查询
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.BaseCrudController`1.PageList(Yi.Framework.Model.Query.QueryPageCondition)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.BaseCrudController`1.PageList(Yi.Framework.Model.Base.Query.QueryPageCondition)">
<summary>
条件分页查询
</summary>
@@ -56,6 +51,558 @@
<param name="ids"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.BaseExcelController`1.Template">
<summary>
下载模板
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.BaseExcelController`1.Export">
<summary>
导出数据
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.BaseExcelController`1.Import(Microsoft.AspNetCore.Http.IFormFile)">
<summary>
导入数据
</summary>
<returns></returns>
</member>
<member name="T:Yi.Framework.ApiMicroservice.Controllers.BaseSimpleCrudController`1">
<summary>
Json To Sql 类比模式,通用模型
</summary>
<typeparam name="T"></typeparam>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.BaseSimpleCrudController`1.GetById(System.Int64)">
<summary>
主键查询
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.BaseSimpleCrudController`1.GetList">
<summary>
全部列表查询
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.BaseSimpleCrudController`1.Add(`0)">
<summary>
添加
</summary>
<param name="entity"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.BaseSimpleCrudController`1.Update(`0)">
<summary>
修改
</summary>
<param name="entity"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.BaseSimpleCrudController`1.DelList(System.Collections.Generic.List{System.Int64})">
<summary>
列表删除
</summary>
<param name="ids"></param>
<returns></returns>
</member>
<member name="T:Yi.Framework.ApiMicroservice.Controllers.BaseSimpleRdController`1">
<summary>
Json To Sql 类比模式,通用模型
</summary>
<typeparam name="T"></typeparam>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.BaseSimpleRdController`1.GetById(System.Int64)">
<summary>
主键查询
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.BaseSimpleRdController`1.GetList">
<summary>
全部列表查询
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.BaseSimpleRdController`1.DelList(System.Collections.Generic.List{System.Int64})">
<summary>
列表删除
</summary>
<param name="ids"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AgreeController.Operate(System.Int64)">
<summary>
点赞操作
</summary>
<param name="articleId"></param>
<returns></returns>
</member>
<member name="T:Yi.Framework.ApiMicroservice.Controllers.ArticleController">
<summary>
文章控制器
</summary>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ArticleController.PageList(Yi.Framework.Model.BBS.Entitys.ArticleEntity,Yi.Framework.Common.Models.PageParModel)">
<summary>
动态条件分页查询
</summary>
<param name="entity"></param>
<param name="page"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ArticleController.Add(Yi.Framework.Model.BBS.Entitys.ArticleEntity)">
<summary>
添加
</summary>
<param name="entity"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.CommentController.GetListByArticleId(System.Int64)">
<summary>
获取文章的全部一级评论
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.CommentController.GetById(System.Int64)">
<summary>
获取一级评论详情
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.CommentController.Add(Yi.Framework.Model.BBS.Entitys.CommentEntity)">
<summary>
回复文章或回复评论
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.MaterialController.PageList(Yi.Framework.DtoModel.ERP.Material.MaterialGetListInput,Yi.Framework.Common.Models.PageParModel)">
<summary>
分页查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.MaterialController.GetById(System.Int64)">
<summary>
单查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.MaterialController.Create(Yi.Framework.DtoModel.ERP.Material.MaterialCreateUpdateInput)">
<summary>
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.MaterialController.Update(System.Int64,Yi.Framework.DtoModel.ERP.Material.MaterialCreateUpdateInput)">
<summary>
</summary>
<param name="id"></param>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.MaterialController.Del(System.Collections.Generic.List{System.Int64})">
<summary>
</summary>
<param name="ids"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.PurchaseController.PageList(Yi.Framework.DtoModel.ERP.Purchase.PurchaseGetListInput,Yi.Framework.Common.Models.PageParModel)">
<summary>
分页查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.PurchaseController.GetById(System.Int64)">
<summary>
单查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.PurchaseController.Create(Yi.Framework.DtoModel.ERP.Purchase.PurchaseCreateInput)">
<summary>
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.PurchaseController.Update(System.Int64,Yi.Framework.DtoModel.ERP.Purchase.PurchaseUpdateInput)">
<summary>
</summary>
<param name="id"></param>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.PurchaseController.Del(System.Collections.Generic.List{System.Int64})">
<summary>
</summary>
<param name="ids"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.PurchaseController.Receipt(Yi.Framework.DtoModel.ERP.Purchase.ReceiptInput)">
<summary>
收获
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.PurchaseController.Collection(Yi.Framework.DtoModel.ERP.Purchase.CollectionInput)">
<summary>
回款?????甲方主动给乙方钱,乙方给货物。应该不叫回款。。。。想想叫啥优雅的名字
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.PurchaseDetailsController.PageList(Yi.Framework.DtoModel.ERP.PurchaseDetails.PurchaseDetailsGetListInput,Yi.Framework.Common.Models.PageParModel)">
<summary>
分页查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.PurchaseDetailsController.GetById(System.Int64)">
<summary>
单查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.PurchaseDetailsController.Create(Yi.Framework.DtoModel.ERP.PurchaseDetails.PurchaseDetailsCreateUpdateInput)">
<summary>
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.PurchaseDetailsController.Update(System.Int64,Yi.Framework.DtoModel.ERP.PurchaseDetails.PurchaseDetailsCreateUpdateInput)">
<summary>
</summary>
<param name="id"></param>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.PurchaseDetailsController.Del(System.Collections.Generic.List{System.Int64})">
<summary>
</summary>
<param name="ids"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.StockController.PageList(Yi.Framework.DtoModel.ERP.Stock.StockGetListInput,Yi.Framework.Common.Models.PageParModel)">
<summary>
分页查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.StockController.GetById(System.Int64)">
<summary>
单查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.StockController.InputStock(Yi.Framework.DtoModel.ERP.Stock.StockCreateUpdateInput)">
<summary>
入库
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.StockController.OutputStock(Yi.Framework.DtoModel.ERP.Stock.StockCreateUpdateInput)">
<summary>
出库
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.StockDetailsController.PageList(Yi.Framework.DtoModel.ERP.StockDetails.StockDetailsGetListInput,Yi.Framework.Common.Models.PageParModel)">
<summary>
分页查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.StockDetailsController.GetById(System.Int64)">
<summary>
单查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.StockDetailsController.Del(System.Collections.Generic.List{System.Int64})">
<summary>
</summary>
<param name="ids"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.SupplierController.GetList">
<summary>
全查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.SupplierController.PageList(Yi.Framework.DtoModel.ERP.Supplier.SupplierGetListInput,Yi.Framework.Common.Models.PageParModel)">
<summary>
分页查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.SupplierController.GetById(System.Int64)">
<summary>
单查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.SupplierController.Create(Yi.Framework.DtoModel.ERP.Supplier.SupplierCreateUpdateInput)">
<summary>
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.SupplierController.Update(System.Int64,Yi.Framework.DtoModel.ERP.Supplier.SupplierCreateUpdateInput)">
<summary>
</summary>
<param name="id"></param>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.SupplierController.Del(System.Collections.Generic.List{System.Int64})">
<summary>
</summary>
<param name="ids"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.UnitController.PageList(Yi.Framework.DtoModel.ERP.Unit.UnitGetListInput,Yi.Framework.Common.Models.PageParModel)">
<summary>
分页查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.UnitController.GetById(System.Int64)">
<summary>
单查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.UnitController.GetList">
<summary>
全查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.UnitController.Create(Yi.Framework.DtoModel.ERP.Unit.UnitCreateUpdateInput)">
<summary>
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.UnitController.Update(System.Int64,Yi.Framework.DtoModel.ERP.Unit.UnitCreateUpdateInput)">
<summary>
</summary>
<param name="id"></param>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.UnitController.Del(System.Collections.Generic.List{System.Int64})">
<summary>
</summary>
<param name="ids"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.WarehouseController.PageList(Yi.Framework.DtoModel.ERP.Warehouse.WarehouseGetListInput,Yi.Framework.Common.Models.PageParModel)">
<summary>
分页查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.WarehouseController.GetById(System.Int64)">
<summary>
单查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.WarehouseController.Create(Yi.Framework.DtoModel.ERP.Warehouse.WarehouseCreateUpdateInput)">
<summary>
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.WarehouseController.Update(System.Int64,Yi.Framework.DtoModel.ERP.Warehouse.WarehouseCreateUpdateInput)">
<summary>
</summary>
<param name="id"></param>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.WarehouseController.Del(System.Collections.Generic.List{System.Int64})">
<summary>
</summary>
<param name="ids"></param>
<returns></returns>
</member>
<member name="T:Yi.Framework.ApiMicroservice.Controllers.AccountController">
<summary>
账户管理
</summary>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.RestCC">
<summary>
重置管理员CC的密码
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.Login(Yi.Framework.DtoModel.Base.Dto.LoginDto)">
<summary>
没啥说,登录
</summary>
<param name="loginDto"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.Register(Yi.Framework.DtoModel.Base.Dto.RegisterDto)">
<summary>
没啥说,注册
</summary>
<param name="registerDto"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.Logout">
<summary>
没啥说,登出
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.GetUserAllInfo">
<summary>
通过已登录的用户获取用户信息
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.GetRouterInfo">
<summary>
获取当前登录用户的前端路由
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.UpdatePassword(Yi.Framework.DtoModel.Base.Dto.UpdatePasswordDto)">
<summary>
自己更新密码
</summary>
<param name="dto"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.CaptchaImage">
<summary>
验证码
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ConfigController.PageList(Yi.Framework.Model.RABC.Entitys.ConfigEntity,Yi.Framework.Common.Models.PageParModel)">
<summary>
动态条件分页查询
</summary>
<param name="dic"></param>
<param name="page"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DeptController.SelctGetList(Yi.Framework.Model.RABC.Entitys.DeptEntity)">
<summary>
动态条件查询
</summary>
<param name="dept"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DeptController.Add(Yi.Framework.Model.RABC.Entitys.DeptEntity)">
<summary>
添加
</summary>
<param name="entity"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DeptController.Update(Yi.Framework.Model.RABC.Entitys.DeptEntity)">
<summary>
更新
</summary>
<param name="entity"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DeptController.GetListByRoleId(System.Int64)">
<summary>
根据角色id获取该角色下全部部门
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryController.PageList(Yi.Framework.Model.RABC.Entitys.DictionaryEntity,Yi.Framework.Common.Models.PageParModel)">
<summary>
动态条件分页查询
</summary>
<param name="dic"></param>
<param name="page"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryInfoController.PageList(Yi.Framework.Model.RABC.Entitys.DictionaryInfoEntity,Yi.Framework.Common.Models.PageParModel)">
<summary>
动态条件分页查询
</summary>
<param name="dicInfo"></param>
<param name="page"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryInfoController.GetListByType(System.String)">
<summary>
根据字典类别获取字典信息
</summary>
<param name="type"></param>
<returns></returns>
</member>
<member name="T:Yi.Framework.ApiMicroservice.Controllers.FileController">
<summary>
文件
</summary>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.FileController.#ctor(Yi.Framework.Interface.RABC.IFileService,Microsoft.Extensions.Hosting.IHostEnvironment,Yi.Framework.Core.ThumbnailSharpInvoer)">
<summary>
文件上传下载
</summary>
<param name="iFileService"></param>
<param name="env"></param>
<param name="thumbnailSharpInvoer"></param>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.FileController.Get(System.Int64,System.Nullable{System.Boolean})">
<summary>
文件下载,只需用文件code即可,可选择是否为缩略图
</summary>
<param name="code"></param>
<param name="isThumbnail"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.FileController.Upload(System.String,Microsoft.AspNetCore.Http.IFormFileCollection,System.String)">
<summary>
多文件上传,type可空默认上传至File文件夹下swagger返回雪花id精度是有问题的同时如果时图片类型还需要进行缩略图制作
</summary>
<param name="type">文件类型,可空</param>
<param name="file">多文件表单</param>
<param name="remark">描述</param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.FileController.ThumbnailSync">
<summary>
一键同步图片到缩略图
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.LogController.Add">
<summary>
自动分表,日志添加
@@ -68,40 +615,254 @@
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.LoginLogController.PageList(Yi.Framework.Model.RABC.Entitys.LoginLogEntity,Yi.Framework.Common.Models.PageParModel)">
<summary>
动态条件分页查询
</summary>
<param name="loginLog"></param>
<param name="page"></param>
<returns></returns>
</member>
<member name="T:Yi.Framework.ApiMicroservice.Controllers.MenuController">
<summary>
菜单管理
</summary>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MenuController.SelctGetList(Yi.Framework.Model.RABC.Entitys.MenuEntity)">
<summary>
动态条件查询全部
</summary>
<param name="menu"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MenuController.Add(Yi.Framework.Model.RABC.Entitys.MenuEntity)">
<summary>
插入
</summary>
<param name="menu"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MenuController.Update(Yi.Framework.Model.RABC.Entitys.MenuEntity)">
<summary>
更新
</summary>
<param name="menu"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MenuController.GetMenuTree">
<summary>
得到树形菜单
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MenuController.GetListByRoleId(System.Int64)">
<summary>
根据角色id获取该角色下全部菜单
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="T:Yi.Framework.ApiMicroservice.Controllers.OnlineController">
<summary>
在线管理
</summary>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.OnlineController.PageList(Yi.Framework.WebCore.SignalRHub.OnlineUser,Yi.Framework.Common.Models.PageParModel)">
<summary>
动态条件获取当前在线用户
</summary>
<param name="online"></param>
<param name="page"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.OnlineController.ForceOut(System.String)">
<summary>
强制退出用户
</summary>
<param name="connnectionId"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.OperationLogController.PageList(Yi.Framework.Model.RABC.Entitys.OperationLogEntity,Yi.Framework.Common.Models.PageParModel)">
<summary>
动态条件分页查询
</summary>
<param name="operationLog"></param>
<param name="page"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.PostController.PageList(Yi.Framework.Model.RABC.Entitys.PostEntity,Yi.Framework.Common.Models.PageParModel)">
<summary>
动态条件分页查询
</summary>
<param name="post"></param>
<param name="page"></param>
<returns></returns>
</member>
<member name="T:Yi.Framework.ApiMicroservice.Controllers.RoleController">
<summary>
角色管理
</summary>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.GiveRoleSetMenu(Yi.Framework.DTOModel.GiveRoleSetMenuDto)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.PageList(Yi.Framework.Model.RABC.Entitys.RoleEntity,Yi.Framework.Common.Models.PageParModel)">
<summary>
动态条件分页查询
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.GiveRoleSetMenu(Yi.Framework.DtoModel.Base.Dto.GiveRoleSetMenuDto)">
<summary>
给多用户设置多角色
</summary>
<param name="giveRoleSetMenuDto"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.Add(Yi.Framework.DtoModel.Base.Dto.RoleInfoDto)">
<summary>
添加角色包含菜单
</summary>
<param name="roleDto"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.Update(Yi.Framework.DtoModel.Base.Dto.RoleInfoDto)">
<summary>
更新角色信息
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.UpdateStatus(System.Int64,System.Boolean)">
<summary>
更改角色状态
</summary>
<param name="roleId"></param>
<param name="isDel"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.UpdateDataScpoce(Yi.Framework.DtoModel.Base.Dto.RoleInfoDto)">
<summary>
更改角色数据权限
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.DelList(System.Collections.Generic.List{System.Int64})">
<summary>
删除
</summary>
<param name="ids"></param>
<returns></returns>
</member>
<member name="T:Yi.Framework.ApiMicroservice.Controllers.UserController">
<summary>
用户管理
</summary>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.PageList(Yi.Framework.Model.RABC.Entitys.UserEntity,Yi.Framework.Common.Models.PageParModel,System.Nullable{System.Int64})">
<summary>
动态条件分页查询
</summary>
<param name="user"></param>
<param name="page"></param>
<param name="deptId"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.UpdateStatus(System.Int64,System.Boolean)">
<summary>
更改用户状态
</summary>
<param name="userId"></param>
<param name="isDel"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.GiveUserSetRole(Yi.Framework.DtoModel.Base.Dto.GiveUserSetRoleDto)">
<summary>
给多用户设置多角色
</summary>
<param name="giveUserSetRoleDto"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.GetById(System.Int64)">
<summary>
通过用户id得到用户信息关联部门、岗位、角色
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.Update(Yi.Framework.DtoModel.Base.Dto.UserInfoDto)">
<summary>
更新用户信息
</summary>
<param name="userDto"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.UpdateProfile(Yi.Framework.DtoModel.Base.Dto.UserInfoDto)">
<summary>
更新个人中心信息
</summary>
<param name="userDto"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.Add(Yi.Framework.DtoModel.Base.Dto.UserInfoDto)">
<summary>
添加用户
</summary>
<param name="userDto"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.RestPassword(Yi.Framework.Model.RABC.Entitys.UserEntity)">
<summary>
重置密码
</summary>
<param name="user"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.SkuController.PageList(Yi.Framework.Model.SHOP.Entitys.SkuEntity,Yi.Framework.Common.Models.PageParModel)">
<summary>
动态条件分页查询
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.SpuController.PageList(Yi.Framework.Model.SHOP.Entitys.SpuEntity,Yi.Framework.Common.Models.PageParModel)">
<summary>
动态条件分页查询
</summary>
<returns></returns>
</member>
<member name="T:Yi.Framework.ApiMicroservice.Controllers.TestController">
<summary>
测试控制器
</summary>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.#ctor(Microsoft.AspNetCore.SignalR.IHubContext{Yi.Framework.WebCore.SignalRHub.MainHub},Microsoft.Extensions.Logging.ILogger{Yi.Framework.ApiMicroservice.Controllers.TestController},Yi.Framework.Interface.RABC.IRoleService,Yi.Framework.Interface.RABC.IUserService,Microsoft.Extensions.Localization.IStringLocalizer{Yi.Framework.Language.LocalLanguage},Yi.Framework.Core.Quartz.QuartzInvoker,Yi.Framework.Core.ThumbnailSharpInvoer,Yi.Framework.Core.Cache.CacheInvoker,SqlSugar.ISugarUnitOfWork{Yi.Framework.Repository.UnitOfWork})">
<summary>
依赖注入,优雅写法
</summary>
<param name="hub"></param>
<param name="logger"></param>
<param name="iRoleService"></param>
<param name="iUserService"></param>
<param name="local"></param>
<param name="quartzInvoker"></param>
<param name="thumbnailSharpInvoer"></param>
<param name="cacheInvoker"></param>
<param name="unitOfWork"></param>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.Swagger">
<summary>
swagger跳转
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.DbTest">
<summary>
仓储上下文对象测试
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.UnitOfWorkTest">
<summary>
工作单元测试使用sqlsugar内置
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.SqlTest">
<summary>
执行Sql返回
@@ -144,34 +905,83 @@
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.stopJob">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.StopJob">
<summary>
停止任务
</summary>
<returns></returns>
</member>
<member name="T:Yi.Framework.ApiMicroservice.Controllers.UserController">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.ErrorJob">
<summary>
用户管
job异常处
</summary>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.Add(Yi.Framework.Model.Models.UserEntity)">
<summary>
添加用户,去重,密码加密
</summary>
<param name="entity"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.GiveUserSetRole(Yi.Framework.DTOModel.GiveUserSetRoleDto)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.TreeTest">
<summary>
给多用户设置多角色
树形结构构建测试
</summary>
<param name="giveUserSetRoleDto"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.GetRoleListByUserId(System.Int64)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.AuthorizeTest">
<summary>
通过用户id得到角色列表
授权测试
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.ClearDb">
<summary>
清空数据库
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.SeedDb">
<summary>
种子数据
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.LogTest(System.Collections.Generic.List{System.String})">
<summary>
操作日志测试
</summary>
<param name="par"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.SignalrTest(System.Int32)">
<summary>
Signalr实时推送测试
</summary>
<param name="msg"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.ThumbnailTest">
<summary>
缩略图测试,需要生成前及生成后的路径
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.CacheDBTest">
<summary>
缓存测试
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.CustomLogTest">
<summary>
自定义日志
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.PropertyTest">
<summary>
属性注入测试
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.CurrentUserTest">
<summary>
获取当前用户信息测试
</summary>
<returns></returns>
</member>

View File

@@ -1,59 +0,0 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Core;
using Yi.Framework.DTOModel;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
/// <summary>
/// 账户管理
/// </summary>
[ApiController]
[Route("api/[controller]/[action]")]
public class AccountController :ControllerBase
{
private IUserService _iUserService;
private JwtInvoker _jwtInvoker;
public AccountController(ILogger<UserEntity> logger, IUserService iUserService, JwtInvoker jwtInvoker)
{
_iUserService = iUserService;
_jwtInvoker = jwtInvoker;
}
[AllowAnonymous]
[HttpPost]
public async Task<Result> Login(LoginDto loginDto)
{
UserEntity user=new();
if (await _iUserService.Login(loginDto.UserName, loginDto.Password,o=> user=o))
{
return Result.Success("登录成功!").SetData(new { user, token = _jwtInvoker.GetAccessToken(user)});
}
return Result.SuccessError("登录失败!用户名或者密码错误!");
}
[AllowAnonymous]
[HttpPost]
public async Task<Result> Register(RegisterDto registerDto)
{
UserEntity user = new();
if (await _iUserService.Register(WebCore.Mapper.MapperHelper.Map<UserEntity, RegisterDto>(registerDto), o => user = o))
{
return Result.Success("注册成功!").SetData(user);
}
return Result.SuccessError("注册失败!用户名已存在!");
}
}
}

View File

@@ -0,0 +1,52 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Attribute;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Interface.BBS;
using Yi.Framework.Model.BBS.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.Service;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
using Yi.Framework.WebCore.CommonExtend;
namespace Yi.Framework.ApiMicroservice.Controllers
{
[ApiController]
[Route("api/[controller]/[action]")]
public class AgreeController : ControllerBase
{
[Autowired]
public IAgreeService? _iAgreeService { get; set; }
[Autowired]
public IArticleService? _iArticleService { get; set; }
[Autowired]
public ILogger<AgreeEntity>? _logger { get; set; }
/// <summary>
/// 点赞操作
/// </summary>
/// <param name="articleId"></param>
/// <returns></returns>
[HttpGet]
public async Task<Result> Operate(long articleId)
{
long userId = HttpContext.GetUserIdInfo();
if (await _iAgreeService!.OperateAsync(articleId, userId))
{
return Result.Success("点赞成功");
}
else
{
return Result.Success("已点赞,取消点赞").StatusFalse();
}
}
}
}

View File

@@ -0,0 +1,64 @@
using AutoMapper;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.DtoModel.Base.Vo;
using Yi.Framework.Interface;
using Yi.Framework.Interface.BBS;
using Yi.Framework.Model.BBS.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
using Yi.Framework.WebCore.CommonExtend;
namespace Yi.Framework.ApiMicroservice.Controllers
{
/// <summary>
/// 文章控制器
/// </summary>
[ApiController]
[Route("api/[controller]/[action]")]
public class ArticleController : BaseSimpleCrudController<ArticleEntity>
{
private IArticleService _iArticleService;
private IMapper _mapper;
public ArticleController(ILogger<ArticleEntity> logger, IArticleService iArticleService, IMapper mapper) : base(logger, iArticleService)
{
_iArticleService = iArticleService;
_mapper = mapper;
}
/// <summary>
/// 动态条件分页查询
/// </summary>
/// <param name="entity"></param>
/// <param name="page"></param>
/// <returns></returns>
[HttpGet]
public async Task<Result> PageList([FromQuery] ArticleEntity entity, [FromQuery] PageParModel page)
{
var pageData = await _iArticleService.SelctPageList(entity, page);
return Result.Success().SetData(new PageModel() { Data = _mapper.Map<List<ArticleVo>>(pageData.Data), Total = pageData.Total });
}
/// <summary>
/// 添加
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public override Task<Result> Add(ArticleEntity entity)
{
//如果标题为空默认为内容的前20个字符
entity.Title = string.IsNullOrEmpty(entity.Title) ?
(entity.Content?.Length > 20 ? entity.Content.Substring(0, 20) : entity.Content) :
entity.Title;
entity.UserId = HttpContext.GetUserIdInfo();
return base.Add(entity);
}
}
}

View File

@@ -0,0 +1,67 @@
using AutoMapper;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.DtoModel.Base.Vo;
using Yi.Framework.Interface;
using Yi.Framework.Interface.BBS;
using Yi.Framework.Model.BBS.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
[ApiController]
[Route("api/[controller]/[action]")]
public class CommentController : BaseSimpleCrudController<CommentEntity>
{
private ICommentService _iCommentService;
private IMapper _mapper;
public CommentController(ILogger<CommentEntity> logger, ICommentService iCommentService, IMapper mapper) : base(logger, iCommentService)
{
_iCommentService = iCommentService;
_mapper = mapper;
}
/// <summary>
/// 获取文章的全部一级评论
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("{articleId}")]
public async Task<Result> GetListByArticleId(long articleId)
{
//一级评论被回复的用户id为空
var data = await _repository._DbQueryable.Where(u => u.ParentId == 0 && u.ArticleId == articleId).Includes(u => u.CreateUserInfo).OrderByDescending(u=>u.CreateTime).ToListAsync();
return Result.Success().SetData(_mapper.Map<List<CommentVo>>(data));
}
/// <summary>
/// 获取一级评论详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public override async Task<Result> GetById([FromRoute] long id)
{
var data = await _repository._DbQueryable.Includes(u => u.CreateUserInfo).Includes(u => u.UserInfo).FirstAsync(u => u.Id == id);
return Result.Success().SetData(_mapper.Map<CommentVo>(data));
}
/// <summary>
/// 回复文章或回复评论
/// </summary>
/// <returns></returns>
[HttpPost]
public override async Task<Result> Add(CommentEntity comment)
{
return Result.Success().SetStatus(await _iCommentService.AddAsync(comment));
}
}
}

View File

@@ -1,10 +1,10 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Localization;
using Yi.Framework.Common.Helper;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Interface.Base;
using Yi.Framework.Language;
using Yi.Framework.Model.Models;
using Yi.Framework.Model.Query;
using Yi.Framework.Model.Base.Query;
using Yi.Framework.Repository;
using Yi.Framework.WebCore.AttributeExtend;
@@ -15,16 +15,14 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// </summary>
/// <typeparam name="T"></typeparam>
[ApiController]
public class BaseCrudController<T> : ControllerBase where T : class, IBaseModelEntity,new()
public class BaseCrudController<T> : BaseExcelController<T> where T : class,new()
{
private readonly ILogger<T> _logger;
private IBaseService<T> _baseService;
private IRepository<T> _repository;
public BaseCrudController(ILogger<T> logger, IBaseService<T> iBaseService)
protected readonly ILogger<T> _logger;
protected IBaseService<T> _baseService;
public BaseCrudController(ILogger<T> logger, IBaseService<T> iBaseService):base(iBaseService._repository)
{
_logger = logger;
_baseService = iBaseService;
_repository = iBaseService._repository;
}
/// <summary>
@@ -32,7 +30,6 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[Permission($"{nameof(T)}:get:one")]
[HttpGet]
public virtual async Task<Result> GetById(long id)
{
@@ -43,7 +40,6 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// 列表查询
/// </summary>
/// <returns></returns>
[Permission($"{nameof(T)}:get:list")]
[HttpPost]
public virtual async Task<Result> GetList(QueryCondition queryCondition)
{
@@ -55,7 +51,6 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// </summary>
/// <param name="queryCondition"></param>
/// <returns></returns>
[Permission($"{nameof(T)}:get:page")]
[HttpPost]
public virtual async Task<Result> PageList(QueryPageCondition queryCondition)
{
@@ -67,7 +62,6 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[Permission($"{nameof(T)}:add")]
[HttpPost]
public virtual async Task<Result> Add(T entity)
{
@@ -79,7 +73,6 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[Permission($"{nameof(T)}:update")]
[HttpPut]
public virtual async Task<Result> Update(T entity)
{
@@ -91,11 +84,10 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
[Permission($"{nameof(T)}:delete:list")]
[HttpDelete]
public virtual async Task<Result> DeleteList(List<long> ids)
{
return Result.Success().SetStatus(await _repository.DeleteByLogicAsync(ids));
return Result.Success().SetStatus(await _repository.DeleteByIdAsync(ids.ToDynamicArray()));
}
}
}

View File

@@ -0,0 +1,74 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Localization;
using Yi.Framework.Common.Const;
using Yi.Framework.Common.Enum;
using Yi.Framework.Common.Helper;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Language;
using Yi.Framework.Repository;
using Yi.Framework.WebCore.AttributeExtend;
namespace Yi.Framework.ApiMicroservice.Controllers
{
[ApiController]
public class BaseExcelController<T> : ControllerBase where T : class, new()
{
protected IRepository<T> _repository;
public BaseExcelController(IRepository<T> repository)
{
_repository = repository;
}
/// <summary>
/// 下载模板
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
public IActionResult Template()
{
List<T> users = new();
var fileName = typeof(T).Name + PathConst.DataTemplate;
var path = ExcelHelper.DownloadImportTemplate(users, fileName, Path.Combine(PathConst.wwwroot, PathEnum.Excel.ToString()));
var file = System.IO.File.OpenRead(path);
return File(file, "text/plain", $"{DateTime.Now.ToString("yyyyMMddHHmmssffff") + fileName }.xlsx");
}
/// <summary>
/// 导出数据
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
public async Task<IActionResult> Export()
{
var users = await _repository.GetListAsync();
var fileName = DateTime.Now.ToString("yyyyMMddHHmmssffff") + nameof(T) + PathConst.DataExport;
var path = ExcelHelper.ExportExcel(users, fileName, Path.Combine(PathConst.wwwroot, PathEnum.Temp.ToString()));
var file = System.IO.File.OpenRead(path);
return File(file, "text/plain", $"{ fileName }.xlsx");
}
/// <summary>
/// 导入数据
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public async Task<Result> Import([FromForm(Name = "file")]IFormFile formFile)
{
List<T> datas = ExcelHelper.ImportData<T>(formFile.OpenReadStream());
//全量删除在重新插入
var res = await _repository.UseTranAsync(async () =>
{
await _repository.DeleteAsync(u => true);
await _repository.InsertRangeAsync(datas);
});
return Result.Success().SetStatus(res);
}
}
}

View File

@@ -0,0 +1,83 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Localization;
using Yi.Framework.Common.Helper;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface.Base;
using Yi.Framework.Language;
using Yi.Framework.Repository;
using Yi.Framework.WebCore.AttributeExtend;
namespace Yi.Framework.ApiMicroservice.Controllers
{
/// <summary>
/// Json To Sql 类比模式,通用模型
/// </summary>
/// <typeparam name="T"></typeparam>
[ApiController]
public class BaseSimpleCrudController<T> : BaseExcelController<T> where T : class, new()
{
protected readonly ILogger<T> _logger;
protected IBaseService<T> _baseService;
public BaseSimpleCrudController(ILogger<T> logger, IBaseService<T> iBaseService):base(iBaseService._repository)
{
_logger = logger;
_baseService = iBaseService;
}
/// <summary>
/// 主键查询
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[Route("{id}")]
[HttpGet]
public virtual async Task<Result> GetById([FromRoute]long id)
{
return Result.Success().SetData(await _repository.GetByIdAsync(id));
}
/// <summary>
/// 全部列表查询
/// </summary>
/// <returns></returns>
[HttpGet]
public virtual async Task<Result> GetList()
{
return Result.Success().SetData(await _repository.GetListAsync());
}
/// <summary>
/// 添加
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[HttpPost]
public virtual async Task<Result> Add(T entity)
{
return Result.Success().SetData(await _repository.InsertReturnSnowflakeIdAsync(entity));
}
/// <summary>
/// 修改
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[HttpPut]
public virtual async Task<Result> Update(T entity)
{
return Result.Success().SetStatus(await _repository.UpdateIgnoreNullAsync(entity));
}
/// <summary>
/// 列表删除
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
[HttpDelete]
public virtual async Task<Result> DelList(List<long> ids)
{
return Result.Success().SetStatus(await _repository.DeleteByIdsAsync(ids.ToDynamicArray()));
}
}
}

View File

@@ -0,0 +1,60 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Localization;
using Yi.Framework.Common.Helper;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface.Base;
using Yi.Framework.Language;
using Yi.Framework.Repository;
using Yi.Framework.WebCore.AttributeExtend;
namespace Yi.Framework.ApiMicroservice.Controllers
{
/// <summary>
/// Json To Sql 类比模式,通用模型
/// </summary>
/// <typeparam name="T"></typeparam>
[ApiController]
public class BaseSimpleRdController<T> : BaseExcelController<T> where T : class, new()
{
protected readonly ILogger<T> _logger;
protected IBaseService<T> _baseService;
public BaseSimpleRdController(ILogger<T> logger, IBaseService<T> iBaseService):base(iBaseService._repository)
{
_logger = logger;
_baseService = iBaseService;
}
/// <summary>
/// 主键查询
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[Route("{id}")]
[HttpGet]
public virtual async Task<Result> GetById([FromRoute]long id)
{
return Result.Success().SetData(await _repository.GetByIdAsync(id));
}
/// <summary>
/// 全部列表查询
/// </summary>
/// <returns></returns>
[HttpGet]
public virtual async Task<Result> GetList()
{
return Result.Success().SetData(await _repository.GetListAsync());
}
/// <summary>
/// 列表删除
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
[HttpDelete]
public virtual async Task<Result> DelList(List<long> ids)
{
return Result.Success().SetStatus(await _repository.DeleteByIdsAsync(ids.ToDynamicArray()));
}
}
}

View File

@@ -0,0 +1,81 @@
using Microsoft.AspNetCore.Mvc;
using Yi.Framework.Common.Models;
using Yi.Framework.DtoModel.ERP.Material;
using Yi.Framework.Interface.ERP;
namespace Yi.Framework.ApiMicroservice.Controllers.ERP
{
[ApiController]
[Route("api/[controller]/[action]")]
public class MaterialController : ControllerBase
{
private readonly ILogger<MaterialController> _logger;
private readonly IMaterialService _materialService;
public MaterialController(ILogger<MaterialController> logger, IMaterialService materialService)
{
_logger = logger;
_materialService = materialService;
}
/// <summary>
/// 分页查
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> PageList([FromQuery] MaterialGetListInput input, [FromQuery] PageParModel page)
{
var result = await _materialService.PageListAsync(input, page);
return Result.Success().SetData(result);
}
/// <summary>
/// 单查
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("{id}")]
public async Task<Result> GetById(long id)
{
var result = await _materialService.GetByIdAsync(id);
return Result.Success().SetData(result);
}
/// <summary>
/// 增
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
public async Task<Result> Create(MaterialCreateUpdateInput input)
{
var result = await _materialService.CreateAsync(input);
return Result.Success().SetData(result);
}
/// <summary>
/// 更
/// </summary>
/// <param name="id"></param>
/// <param name="input"></param>
/// <returns></returns>
[HttpPut]
[Route("{id}")]
public async Task<Result> Update(long id, MaterialCreateUpdateInput input)
{
var result = await _materialService.UpdateAsync(id, input);
return Result.Success().SetData(result);
}
/// <summary>
/// 删
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
[HttpDelete]
public async Task<Result> Del(List<long> ids)
{
await _materialService.DeleteAsync(ids);
return Result.Success();
}
}
}

View File

@@ -0,0 +1,103 @@
using Microsoft.AspNetCore.Mvc;
using Yi.Framework.Common.Abstract;
using Yi.Framework.Common.Attribute;
using Yi.Framework.Common.Models;
using Yi.Framework.DtoModel.ERP.Purchase;
using Yi.Framework.Interface.ERP;
namespace Yi.Framework.ApiMicroservice.Controllers.ERP
{
[ApiController]
[Route("api/[controller]/[action]")]
public class PurchaseController : ControllerBase
{
private readonly ILogger<PurchaseController> _logger;
private readonly IPurchaseService _purchaseService;
public PurchaseController(ILogger<PurchaseController> logger, IPurchaseService purchaseService)
{
_logger = logger;
_purchaseService = purchaseService;
}
/// <summary>
/// 分页查
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> PageList([FromQuery] PurchaseGetListInput input, [FromQuery] PageParModel page)
{
var result = await _purchaseService.PageListAsync(input, page);
return Result.Success().SetData(result);
}
/// <summary>
/// 单查
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("{id}")]
public async Task<Result> GetById(long id)
{
var result = await _purchaseService.GetByIdAsync(id);
return Result.Success().SetData(result);
}
/// <summary>
/// 增
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
public async Task<Result> Create(PurchaseCreateInput input)
{
var result = await _purchaseService.CreateAsync(input);
return Result.Success().SetData(result);
}
/// <summary>
/// 更
/// </summary>
/// <param name="id"></param>
/// <param name="input"></param>
/// <returns></returns>
[HttpPut]
[Route("{id}")]
public async Task<Result> Update(long id, PurchaseUpdateInput input)
{
var result = await _purchaseService.UpdateAsync(id, input);
return Result.Success().SetData(result);
}
/// <summary>
/// 删
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
[HttpDelete]
public async Task<Result> Del(List<long> ids)
{
await _purchaseService.DeleteAsync(ids);
return Result.Success();
}
/// <summary>
/// 收获
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<Result> Receipt(ReceiptInput input)
{
throw new NotImplementedException();
}
/// <summary>
/// 回款?????甲方主动给乙方钱,乙方给货物。应该不叫回款。。。。想想叫啥优雅的名字
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<Result> Collection(CollectionInput input)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,93 @@
using Microsoft.AspNetCore.Mvc;
using Yi.Framework.Common.Models;
using Yi.Framework.DtoModel.ERP.PurchaseDetails;
using Yi.Framework.Interface.ERP;
namespace Yi.Framework.ApiMicroservice.Controllers.ERP
{
[ApiController]
[Route("api/[controller]/[action]")]
public class PurchaseDetailsController : ControllerBase
{
private readonly ILogger<PurchaseDetailsController> _logger;
private readonly IPurchaseDetailsService _purchaseDetailsService;
public PurchaseDetailsController(ILogger<PurchaseDetailsController> logger, IPurchaseDetailsService purchaseDetailsService)
{
_logger = logger;
_purchaseDetailsService = purchaseDetailsService;
}
/// <summary>
/// 分页查
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> PageList([FromQuery] PurchaseDetailsGetListInput input, [FromQuery] PageParModel page)
{
var result = await _purchaseDetailsService.PageListAsync(input, page);
return Result.Success().SetData(result);
}
[HttpGet]
[Route("{id}")]
public async Task<Result> GetListByPurchaseId(long id)
{
var result = await _purchaseDetailsService.GetListByPurchaseIdAsync(id);
return Result.Success().SetData(result);
}
/// <summary>
/// 单查
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("{id}")]
public async Task<Result> GetById(long id)
{
var result = await _purchaseDetailsService.GetByIdAsync(id);
return Result.Success().SetData(result);
}
/// <summary>
/// 增
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
public async Task<Result> Create(PurchaseDetailsCreateUpdateInput input)
{
var result = await _purchaseDetailsService.CreateAsync(input);
return Result.Success().SetData(result);
}
/// <summary>
/// 更
/// </summary>
/// <param name="id"></param>
/// <param name="input"></param>
/// <returns></returns>
[HttpPut]
[Route("{id}")]
public async Task<Result> Update(long id, PurchaseDetailsCreateUpdateInput input)
{
var result = await _purchaseDetailsService.UpdateAsync(id, input);
return Result.Success().SetData(result);
}
/// <summary>
/// 删
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
[HttpDelete]
public async Task<Result> Del(List<long> ids)
{
await _purchaseDetailsService.DeleteAsync(ids);
return Result.Success();
}
}
}

View File

@@ -0,0 +1,66 @@
using Microsoft.AspNetCore.Mvc;
using Yi.Framework.Common.Models;
using Yi.Framework.DtoModel.ERP.Stock;
using Yi.Framework.Interface.ERP;
namespace Yi.Framework.ApiMicroservice.Controllers.ERP
{
[ApiController]
[Route("api/[controller]/[action]")]
public class StockController : ControllerBase
{
private readonly ILogger<StockController> _logger;
private readonly IStockService _stockService;
public StockController(ILogger<StockController> logger, IStockService stockService)
{
_logger = logger;
_stockService = stockService;
}
/// <summary>
/// 分页查
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> PageList([FromQuery] StockGetListInput input, [FromQuery] PageParModel page)
{
var result = await _stockService.PageListAsync(input, page);
return Result.Success().SetData(result);
}
/// <summary>
/// 单查
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("{id}")]
public async Task<Result> GetById(long id)
{
var result = await _stockService.GetByIdAsync(id);
return Result.Success().SetData(result);
}
/// <summary>
/// 入库
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<Result> InputStock(StockCreateUpdateInput input)
{
var result = await _stockService.InputStockAsync(input);
return Result.Success().SetData(result);
}
/// <summary>
/// 出库
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<Result> OutputStock(StockCreateUpdateInput input)
{
var result = await _stockService.OutputStockAsync(input);
return Result.Success().SetData(result);
}
}
}

View File

@@ -0,0 +1,55 @@
using Microsoft.AspNetCore.Mvc;
using Yi.Framework.Common.Models;
using Yi.Framework.DtoModel.ERP.StockDetails;
using Yi.Framework.Interface.ERP;
namespace Yi.Framework.ApiMicroservice.Controllers.ERP
{
[ApiController]
[Route("api/[controller]/[action]")]
public class StockDetailsController : ControllerBase
{
private readonly ILogger<StockDetailsController> _logger;
private readonly IStockDetailsService _stockDetailsService;
public StockDetailsController(ILogger<StockDetailsController> logger, IStockDetailsService stockDetailsService)
{
_logger = logger;
_stockDetailsService = stockDetailsService;
}
/// <summary>
/// 分页查
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> PageList([FromQuery] StockDetailsGetListInput input, [FromQuery] PageParModel page)
{
var result = await _stockDetailsService.PageListAsync(input, page);
return Result.Success().SetData(result);
}
/// <summary>
/// 单查
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("{id}")]
public async Task<Result> GetById(long id)
{
var result = await _stockDetailsService.GetByIdAsync(id);
return Result.Success().SetData(result);
}
/// <summary>
/// 删
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
[HttpDelete]
public async Task<Result> Del(List<long> ids)
{
await _stockDetailsService.DeleteAsync(ids);
return Result.Success();
}
}
}

View File

@@ -0,0 +1,94 @@
using Microsoft.AspNetCore.Mvc;
using Yi.Framework.Common.Models;
using Yi.Framework.DtoModel.ERP.Supplier;
using Yi.Framework.Interface.ERP;
using Yi.Framework.Service.ERP;
namespace Yi.Framework.ApiMicroservice.Controllers.ERP
{
[ApiController]
[Route("api/[controller]/[action]")]
public class SupplierController : ControllerBase
{
private readonly ILogger<SupplierController> _logger;
private readonly ISupplierService _supplierService;
public SupplierController(ILogger<SupplierController> logger, ISupplierService supplierService)
{
_logger = logger;
_supplierService = supplierService;
}
/// <summary>
/// 全查
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> GetList()
{
var result = await _supplierService.GetListAsync();
return Result.Success().SetData(result);
}
/// <summary>
/// 分页查
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> PageList([FromQuery] SupplierGetListInput input, [FromQuery] PageParModel page)
{
var result = await _supplierService.PageListAsync(input, page);
return Result.Success().SetData(result);
}
/// <summary>
/// 单查
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("{id}")]
public async Task<Result> GetById(long id)
{
var result = await _supplierService.GetByIdAsync(id);
return Result.Success().SetData(result);
}
/// <summary>
/// 增
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
public async Task<Result> Create(SupplierCreateUpdateInput input)
{
var result = await _supplierService.CreateAsync(input);
return Result.Success().SetData(result);
}
/// <summary>
/// 更
/// </summary>
/// <param name="id"></param>
/// <param name="input"></param>
/// <returns></returns>
[HttpPut]
[Route("{id}")]
public async Task<Result> Update(long id, SupplierCreateUpdateInput input)
{
var result = await _supplierService.UpdateAsync(id, input);
return Result.Success().SetData(result);
}
/// <summary>
/// 删
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
[HttpDelete]
public async Task<Result> Del(List<long> ids)
{
await _supplierService.DeleteAsync(ids);
return Result.Success();
}
}
}

View File

@@ -0,0 +1,92 @@
using Microsoft.AspNetCore.Mvc;
using Yi.Framework.Common.Models;
using Yi.Framework.DtoModel.ERP.Unit;
using Yi.Framework.Interface.ERP;
namespace Yi.Framework.ApiMicroservice.Controllers.ERP
{
[ApiController]
[Route("api/[controller]/[action]")]
public class UnitController : ControllerBase
{
private readonly ILogger<UnitController> _logger;
private readonly IUnitService _unitService;
public UnitController(ILogger<UnitController> logger, IUnitService unitService)
{
_logger = logger;
_unitService = unitService;
}
/// <summary>
/// 分页查
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> PageList([FromQuery] UnitGetListInput input, [FromQuery] PageParModel page)
{
var result = await _unitService.PageListAsync(input, page);
return Result.Success().SetData(result);
}
/// <summary>
/// 单查
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("{id}")]
public async Task<Result> GetById(long id)
{
var result = await _unitService.GetByIdAsync(id);
return Result.Success().SetData(result);
}
/// <summary>
/// 全查
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> GetList()
{
var result = await _unitService.GetListAsync();
return Result.Success().SetData(result);
}
/// <summary>
/// 增
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
public async Task<Result> Create(UnitCreateUpdateInput input)
{
var result = await _unitService.CreateAsync(input);
return Result.Success().SetData(result);
}
/// <summary>
/// 更
/// </summary>
/// <param name="id"></param>
/// <param name="input"></param>
/// <returns></returns>
[HttpPut]
[Route("{id}")]
public async Task<Result> Update(long id, UnitCreateUpdateInput input)
{
var result = await _unitService.UpdateAsync(id, input);
return Result.Success().SetData(result);
}
/// <summary>
/// 删
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
[HttpDelete]
public async Task<Result> Del(List<long> ids)
{
await _unitService.DeleteAsync(ids);
return Result.Success();
}
}
}

View File

@@ -0,0 +1,81 @@
using Microsoft.AspNetCore.Mvc;
using Yi.Framework.Common.Models;
using Yi.Framework.DtoModel.ERP.Warehouse;
using Yi.Framework.Interface.ERP;
namespace Yi.Framework.ApiMicroservice.Controllers.ERP
{
[ApiController]
[Route("api/[controller]/[action]")]
public class WarehouseController : ControllerBase
{
private readonly ILogger<WarehouseController> _logger;
private readonly IWarehouseService _warehouseService;
public WarehouseController(ILogger<WarehouseController> logger, IWarehouseService warehouseService)
{
_logger = logger;
_warehouseService = warehouseService;
}
/// <summary>
/// 分页查
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> PageList([FromQuery] WarehouseGetListInput input, [FromQuery] PageParModel page)
{
var result = await _warehouseService.PageListAsync(input, page);
return Result.Success().SetData(result);
}
/// <summary>
/// 单查
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("{id}")]
public async Task<Result> GetById(long id)
{
var result = await _warehouseService.GetByIdAsync(id);
return Result.Success().SetData(result);
}
/// <summary>
/// 增
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
public async Task<Result> Create(WarehouseCreateUpdateInput input)
{
var result = await _warehouseService.CreateAsync(input);
return Result.Success().SetData(result);
}
/// <summary>
/// 更
/// </summary>
/// <param name="id"></param>
/// <param name="input"></param>
/// <returns></returns>
[HttpPut]
[Route("{id}")]
public async Task<Result> Update(long id, WarehouseCreateUpdateInput input)
{
var result = await _warehouseService.UpdateAsync(id, input);
return Result.Success().SetData(result);
}
/// <summary>
/// 删
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
[HttpDelete]
public async Task<Result> Del(List<long> ids)
{
await _warehouseService.DeleteAsync(ids);
return Result.Success();
}
}
}

View File

@@ -1,42 +0,0 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
/// <summary>
/// 菜单管理
/// </summary>
[ApiController]
[Route("api/[controller]/[action]")]
public class MenuController : BaseCrudController<MenuEntity>
{
private IMenuService _iMenuService;
public MenuController(ILogger<MenuEntity> logger, IMenuService iMenuService) : base(logger, iMenuService)
{
_iMenuService = iMenuService;
}
/// <summary>
/// 得到树形菜单
/// </summary>
/// <returns></returns>
[HttpGet]
//暂未制作逻辑删除与多租户的过滤
public async Task<Result> GetMenuTree()
{
return Result.Success().SetData(await _iMenuService. GetMenuTreeAsync());
}
}
}

View File

@@ -0,0 +1,242 @@
using Hei.Captcha;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Const;
using Yi.Framework.Common.Enum;
using Yi.Framework.Common.Helper;
using Yi.Framework.Common.Models;
using Yi.Framework.Core;
using Yi.Framework.Core.Cache;
using Yi.Framework.DtoModel.Base.Dto;
using Yi.Framework.Interface;
using Yi.Framework.Interface.RABC;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
using Yi.Framework.WebCore.CommonExtend;
namespace Yi.Framework.ApiMicroservice.Controllers
{
/// <summary>
/// 账户管理
/// </summary>
[ApiController]
[Authorize]
[Route("api/[controller]/[action]")]
public class AccountController : ControllerBase
{
private IUserService _iUserService;
private JwtInvoker _jwtInvoker;
private ILogger _logger;
private SecurityCodeHelper _securityCode;
private IRepository<UserEntity> _repository;
private CacheInvoker _cacheDb;
public AccountController(ILogger<UserEntity> logger,
IUserService iUserService,
JwtInvoker jwtInvoker,
SecurityCodeHelper securityCode,
CacheInvoker cacheInvoker)
{
_iUserService = iUserService;
_jwtInvoker = jwtInvoker;
_logger = logger;
_securityCode = securityCode;
_repository = iUserService._repository;
_cacheDb = cacheInvoker;
}
/// <summary>
/// 重置管理员CC的密码
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
public async Task<Result> RestCC()
{
var user = await _iUserService._repository.GetFirstAsync(u => u.UserName == "cc");
user.Password = "123456";
user.BuildPassword();
await _iUserService._repository.UpdateIgnoreNullAsync(user);
return Result.Success();
}
/// <summary>
/// 没啥说,登录
/// </summary>
/// <param name="loginDto"></param>
/// <returns></returns>
[AllowAnonymous]
[HttpPost]
public async Task<Result> Login(LoginDto loginDto)
{
//跳过需要redis缓存获取uuid与code的关系进行比较即可
//先效验验证码和UUID
//登录还需要进行登录日志的落库
//先进行验证码的效验
var code = _cacheDb.Get<string>($"Yi:Captcha:{loginDto.Uuid}");
//判断是否开启二维码效验
if (GobalModel.LoginCodeEnable)
{
if (code != loginDto.Code)
{
return Result.Error("验证码错误!");
}
}
var loginInfo = HttpContext.GetLoginLogInfo();
loginInfo.LoginUser = loginDto.UserName;
loginInfo.LogMsg = "登录成功!";
var loginLogRepository = _repository.ChangeRepository<Repository<LoginLogEntity>>();
UserEntity user = new();
//这里其实可以返回Dto
if (await _iUserService.Login(loginDto.UserName, loginDto.Password, o => user = o))
{
//根据用户id获取改用户的完整信息
var userRoleMenu = await _iUserService.GetUserAllInfo(user.Id);
//如果该用户没有任何一个菜单,或者没有任何一个角色,无意义的登录
if (userRoleMenu.PermissionCodes.Count == 0)
{
return Result.Error("登录禁用!该用户分配无任何权限,无意义登录!");
}
//将该用户的完整信息缓存一份至缓存后续需要完整用户信息只需通过token中的id从缓存中获取即可
//先制作token
var token = _jwtInvoker.GetAccessToken(userRoleMenu.User, userRoleMenu.Menus);
//需要注意缓存用户信息时间应大于或等于token过期时间
_cacheDb.Set($"Yi:UserInfo:{user.Id}", userRoleMenu, _jwtInvoker.GetTokenExpiration());
await loginLogRepository.InsertReturnSnowflakeIdAsync(loginInfo);
return Result.Success(loginInfo.LogMsg).SetData(new { token });
}
loginInfo.LogMsg = "登录失败!用户名或者密码错误!";
await loginLogRepository.InsertReturnSnowflakeIdAsync(loginInfo);
return Result.Error(loginInfo.LogMsg);
}
/// <summary>
/// 没啥说,注册
/// </summary>
/// <param name="registerDto"></param>
/// <returns></returns>
[AllowAnonymous]
[HttpPost]
public async Task<Result> Register(RegisterDto registerDto)
{
UserEntity user = new();
if (await _iUserService.Register(WebCore.Mapper.MapperHelper.Map<UserEntity, RegisterDto>(registerDto), o => user = o))
{
return Result.Success("注册成功!").SetData(user);
}
return Result.SuccessError("注册失败!用户名已存在!");
}
/// <summary>
/// 没啥说,登出
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public Result Logout()
{
return Result.Success("安全登出成功!");
}
/// <summary>
/// 通过已登录的用户获取用户信息
/// </summary>
/// <returns></returns>
[HttpGet]
public Result GetUserAllInfo()
{
//通过鉴权jwt获取到用户的id
var userId = HttpContext.GetUserIdInfo();
//此处从缓存中获取即可
var data = _cacheDb.Get<UserRoleMenuDto>($"Yi:UserInfo:{userId}");
//var data = await _iUserService.GetUserAllInfo(userId);
//系统用户数据被重置,老前端访问重新授权
if (data is null)
{
return Result.UnAuthorize();
}
data.Menus.Clear();
return Result.Success().SetData(data);
}
/// <summary>
/// 获取当前登录用户的前端路由
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> GetRouterInfo()
{
var userId = HttpContext.GetUserIdInfo();
var data = await _iUserService.GetUserAllInfo(userId);
var menus = data.Menus.ToList();
//为超级管理员直接给全部路由
if (SystemConst.Admin.Equals(data.User.UserName))
{
menus = await _iUserService._repository.ChangeRepository<Repository<MenuEntity>>().GetListAsync();
}
//将后端菜单转换成前端路由,组件级别需要过滤
List<VueRouterModel> routers = MenuEntity.RouterBuild(menus);
return Result.Success().SetData(routers);
}
/// <summary>
/// 自己更新密码
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPut]
public async Task<Result> UpdatePassword(UpdatePasswordDto dto)
{
long userId = HttpContext.GetUserIdInfo();
if (await _iUserService.UpdatePassword(dto, userId))
{
return Result.Success();
}
return Result.Error("更新失败!");
}
/// <summary>
/// 验证码
/// </summary>
/// <returns></returns>
[AllowAnonymous]
[HttpGet]
public Result CaptchaImage()
{
var uuid = Guid.NewGuid();
var code = _securityCode.GetRandomEnDigitalText(4);
//将uuid与codeRedis缓存中心化保存起来登录根据uuid比对即可
//10分钟过期
_cacheDb.Set($"Yi:Captcha:{uuid}", code, new TimeSpan(0, 10, 0));
var imgbyte = _securityCode.GetEnDigitalCodeByte(code);
return Result.Success().SetData(new { uuid = uuid, img = imgbyte });
}
}
}

View File

@@ -0,0 +1,41 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Interface.RABC;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
[ApiController]
[Route("api/[controller]/[action]")]
public class ConfigController : BaseSimpleCrudController<ConfigEntity>
{
private IConfigService _iConfigService;
public ConfigController(ILogger<ConfigEntity> logger, IConfigService iConfigService) : base(logger, iConfigService)
{
_iConfigService = iConfigService;
}
/// <summary>
/// 动态条件分页查询
/// </summary>
/// <param name="dic"></param>
/// <param name="page"></param>
/// <returns></returns>
[HttpGet]
public async Task<Result> PageList([FromQuery] ConfigEntity dic, [FromQuery] PageParModel page)
{
return Result.Success().SetData(await _iConfigService.SelctPageList(dic, page));
}
}
}

View File

@@ -0,0 +1,73 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Interface.RABC;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
[ApiController]
[Route("api/[controller]/[action]")]
public class DeptController : BaseSimpleCrudController<DeptEntity>
{
private IDeptService _iDeptService;
public DeptController(ILogger<DeptEntity> logger, IDeptService iDeptService) : base(logger, iDeptService)
{
_iDeptService = iDeptService;
}
/// <summary>
/// 动态条件查询
/// </summary>
/// <param name="dept"></param>
/// <returns></returns>
[HttpGet]
public async Task<Result> SelctGetList([FromQuery] DeptEntity dept)
{
return Result.Success().SetData(await _iDeptService.SelctGetList(dept));
}
/// <summary>
/// 添加
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public override async Task<Result> Add(DeptEntity entity)
{
return await base.Add(entity);
}
/// <summary>
/// 更新
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public override async Task<Result> Update(DeptEntity entity)
{
return await base.Update(entity);
}
/// <summary>
/// 根据角色id获取该角色下全部部门
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("{id}")]
public async Task<Result> GetListByRoleId(long id)
{
return Result.Success().SetData(await _iDeptService.GetListByRoleId(id));
}
}
}

View File

@@ -0,0 +1,43 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Helper;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Interface.RABC;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.Service;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
[ApiController]
[Route("api/[controller]/[action]")]
public class DictionaryController :BaseSimpleCrudController<DictionaryEntity>
{
private IDictionaryService _iDictionaryService;
public DictionaryController(ILogger<DictionaryEntity> logger, IDictionaryService iDictionaryService):base(logger, iDictionaryService)
{
_iDictionaryService = iDictionaryService;
}
/// <summary>
/// 动态条件分页查询
/// </summary>
/// <param name="dic"></param>
/// <param name="page"></param>
/// <returns></returns>
[HttpGet]
public async Task<Result> PageList([FromQuery] DictionaryEntity dic, [FromQuery] PageParModel page)
{
return Result.Success().SetData(await _iDictionaryService.SelctPageList(dic, page));
}
}
}

View File

@@ -0,0 +1,55 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Helper;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Interface.RABC;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.Service;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
[ApiController]
[Route("api/[controller]/[action]")]
public class DictionaryInfoController:BaseSimpleCrudController<DictionaryInfoEntity>
{
private IDictionaryInfoService _iDictionaryInfoService;
public DictionaryInfoController(ILogger<DictionaryInfoEntity> logger, IDictionaryInfoService iDictionaryInfoService):base(logger, iDictionaryInfoService)
{
_iDictionaryInfoService = iDictionaryInfoService;
}
/// <summary>
/// 动态条件分页查询
/// </summary>
/// <param name="dicInfo"></param>
/// <param name="page"></param>
/// <returns></returns>
[HttpGet]
public async Task<Result> PageList([FromQuery] DictionaryInfoEntity dicInfo, [FromQuery] PageParModel page)
{
return Result.Success().SetData(await _iDictionaryInfoService.SelctPageList(dicInfo, page));
}
/// <summary>
/// 根据字典类别获取字典信息
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
[HttpGet]
[Route("{type}")]
public async Task<Result> GetListByType([FromRoute] string type)
{
return Result.Success().SetData(await _iDictionaryInfoService._repository.GetListAsync(u=>u.DictType==type&&u.IsDeleted==false));
}
}
}

View File

@@ -0,0 +1,242 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Hosting;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Const;
using Yi.Framework.Common.Enum;
using Yi.Framework.Common.Helper;
using Yi.Framework.Common.Models;
using Yi.Framework.Core;
using Yi.Framework.Interface.RABC;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.WebCore;
namespace Yi.Framework.ApiMicroservice.Controllers
{
/// <summary>
/// 文件
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class FileController : ControllerBase
{
private IFileService _iFileService;
private readonly IHostEnvironment _env;
private ThumbnailSharpInvoer _thumbnailSharpInvoer;
/// <summary>
/// 文件上传下载
/// </summary>
/// <param name="iFileService"></param>
/// <param name="env"></param>
/// <param name="thumbnailSharpInvoer"></param>
public FileController(IFileService iFileService, IHostEnvironment env, ThumbnailSharpInvoer thumbnailSharpInvoer)
{
_iFileService = iFileService;
_env = env;
_thumbnailSharpInvoer = thumbnailSharpInvoer;
}
/// <summary>
/// 文件下载,只需用文件code即可,可选择是否为缩略图
/// </summary>
/// <param name="code"></param>
/// <param name="isThumbnail"></param>
/// <returns></returns>
[Route("/api/file/{code}/{isThumbnail?}")]
[HttpGet]
public async Task<IActionResult> Get(long code, bool? isThumbnail)
{
var file = await _iFileService._repository.GetByIdAsync(code);
if (file is null)
{
return new NotFoundResult();
}
try
{
//如果为缩略图
if (isThumbnail is true)
{
file.FilePath = PathEnum.Thumbnail.ToString();
}
//路径为: 文件路径/文件id+文件扩展名
var path = Path.Combine($"{PathConst.wwwroot}/{file.FilePath}", file.Id.ToString() + Path.GetExtension(file.FileName));
var stream = System.IO.File.OpenRead(path);
var MimeType = Common.Helper.MimeHelper.GetMimeMapping(file.FileName!);
return File(stream, MimeType, file.FileName);
}
catch
{
return new NotFoundResult();
}
}
/// <summary>
/// 多文件上传,type可空默认上传至File文件夹下swagger返回雪花id精度是有问题的同时如果时图片类型还需要进行缩略图制作
/// </summary>
/// <param name="type">文件类型,可空</param>
/// <param name="file">多文件表单</param>
/// <param name="remark">描述</param>
/// <returns></returns>
[Route("/api/file/Upload/{type?}")]
[HttpPost]
public async Task<Result> Upload([FromRoute] string? type, [FromForm] IFormFileCollection file, [FromQuery] string? remark)
{
type = type ?? PathEnum.File.ToString();
type = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(type.ToLower());
if (!Enum.IsDefined(typeof(PathEnum), type))
{
//后续类型可从字典表中获取
return Result.Error("上传失败!文件类型不支持!");
}
if (file.Count() == 0)
{
return Result.Error("未选择文件");
}
//批量插入
List<FileEntity> datas = new();
//返回的codes
List<long> codes = new();
try
{
foreach (var f in file)
{
FileEntity data = new();
data.Id = SnowFlakeSingle.Instance.NextId();
data.FileSize = ((decimal)f.Length) / 1024;
data.FileName = f.FileName;
data.FileType = Common.Helper.MimeHelper.GetMimeMapping(f.FileName);
data.FilePath = type;
data.Remark = remark;
data.IsDeleted = false;
//落盘文件文件名为雪花id+自己的扩展名
string filename = data.Id.ToString() + Path.GetExtension(f.FileName);
string typePath = $"{PathConst.wwwroot}/{type}";
if (!Directory.Exists(typePath))
{
Directory.CreateDirectory(typePath);
}
//生成文件
using (var stream = new FileStream(Path.Combine(typePath, filename), FileMode.CreateNew, FileAccess.ReadWrite))
{
await f.CopyToAsync(stream);
//如果是图片类型,还需要生成缩略图,当然,如果图片很小,直接复制过去即可
if (PathEnum.Image.ToString().Equals(type))
{
string thumbnailPath = $"{PathConst.wwwroot}/{PathEnum.Thumbnail}";
if (!Directory.Exists(thumbnailPath))
{
Directory.CreateDirectory(thumbnailPath);
}
//保存至缩略图路径
byte[] result=null!;
try
{
result = _thumbnailSharpInvoer.CreateThumbnailBytes(thumbnailSize: 300,
imageStream: stream,
imageFormat: Format.Jpeg);
}
catch
{
result = new byte[stream.Length];
stream.Read(result, 0, result.Length);
// 设置当前流的位置为流的开始
stream.Seek(0, SeekOrigin.Begin);
}
finally
{
await System.IO.File.WriteAllBytesAsync(Path.Combine(thumbnailPath, filename), result);
}
}
};
//将文件信息添加到数据库
datas.Add(data);
codes.Add(data.Id);
}
return Result.Success().SetData(codes).SetStatus(await _iFileService._repository.InsertRangeAsync(datas));
}
catch
{
return Result.Error();
}
}
/// <summary>
/// 一键同步图片到缩略图
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> ThumbnailSync()
{
string typePath = $"{PathConst.wwwroot}/{PathEnum.Image}";
string thumbnailPath = $"{PathConst.wwwroot}/{PathEnum.Thumbnail}";
List<string> fileNames = FileHelper.GetAllFileNames(typePath);
foreach (var filename in fileNames)
{
if (System.IO.File.Exists(Path.Combine(thumbnailPath, filename)))
{
//如果缩略图存在,直接跳过
continue;
}
if (!Directory.Exists(typePath))
{
Directory.CreateDirectory(typePath);
}
using (var stream = new FileStream(Path.Combine(typePath, filename), FileMode.Open, FileAccess.ReadWrite))
{
byte[] result=null!;
try
{
//保存至缩略图路径
result = _thumbnailSharpInvoer.CreateThumbnailBytes(thumbnailSize: 300,
imageStream: stream,
imageFormat: Format.Jpeg);
if (!Directory.Exists(thumbnailPath))
{
Directory.CreateDirectory(thumbnailPath);
}
}
catch
{
result = new byte[stream.Length];
stream.Read(result, 0, result.Length);
// 设置当前流的位置为流的开始
stream.Seek(0, SeekOrigin.Begin);
////如果当前文件同步失败,就跳转到下一个
}
finally {
await System.IO.File.WriteAllBytesAsync(Path.Combine(thumbnailPath, filename), result);
}
}
}
return Result.Success();
}
}
}

View File

@@ -7,7 +7,8 @@ using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Interface.RABC;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
@@ -35,10 +36,10 @@ namespace Yi.Framework.ApiMicroservice.Controllers
{
Random random = new Random();
var logList = new List<LogEntity>() {
new LogEntity() { LogCreateTime = Convert.ToDateTime("2019-12-1"), Message = "jack"+random.Next() } ,
new LogEntity() { LogCreateTime = Convert.ToDateTime("2022-02-1"), Message = "jack"+random.Next() },
new LogEntity() { LogCreateTime = Convert.ToDateTime("2020-02-1"), Message = "jack"+random.Next() },
new LogEntity() { LogCreateTime = Convert.ToDateTime("2021-12-1"), Message = "jack"+random.Next() } };
new LogEntity() { CreateTime = Convert.ToDateTime("2019-12-1"), Message = "jack"+random.Next() } ,
new LogEntity() { CreateTime = Convert.ToDateTime("2022-02-1"), Message = "jack"+random.Next() },
new LogEntity() { CreateTime = Convert.ToDateTime("2020-02-1"), Message = "jack"+random.Next() },
new LogEntity() { CreateTime = Convert.ToDateTime("2021-12-1"), Message = "jack"+random.Next() } };
return Result.Success().SetData(await _iLogService.AddListTest(logList));
}

View File

@@ -0,0 +1,42 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Interface.RABC;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
[ApiController]
[Route("api/[controller]/[action]")]
public class LoginLogController : BaseSimpleCrudController<LoginLogEntity>
{
private ILoginLogService _iLoginLogService;
public LoginLogController(ILogger<LoginLogEntity> logger, ILoginLogService iLoginLogService) : base(logger, iLoginLogService)
{
_iLoginLogService = iLoginLogService;
}
/// <summary>
/// 动态条件分页查询
/// </summary>
/// <param name="loginLog"></param>
/// <param name="page"></param>
/// <returns></returns>
[HttpGet]
public async Task<Result> PageList([FromQuery] LoginLogEntity loginLog, [FromQuery] PageParModel page)
{
return Result.Success().SetData(await _iLoginLogService.SelctPageList(loginLog, page));
}
}
}

View File

@@ -0,0 +1,95 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Interface.RABC;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
/// <summary>
/// 菜单管理
/// </summary>
[ApiController]
[Route("api/[controller]/[action]")]
public class MenuController: BaseSimpleRdController<MenuEntity>
{
private IMenuService _iMenuService;
public MenuController(ILogger<MenuEntity> logger, IMenuService iMenuService):base(logger,iMenuService)
{
_iMenuService = iMenuService;
}
/// <summary>
/// 动态条件查询全部
/// </summary>
/// <param name="menu"></param>
/// <returns></returns>
[HttpGet]
[Permission("system:menu:query")]
public async Task<Result> SelctGetList([FromQuery] MenuEntity menu)
{
return Result.Success().SetData(await _iMenuService.SelctGetList(menu));
}
/// <summary>
/// 插入
/// </summary>
/// <param name="menu"></param>
/// <returns></returns>
[HttpPost]
[Permission("system:menu:add")]
public async Task<Result> Add(MenuEntity menu)
{
return Result.Success().SetData(await _iMenuService._repository.InsertReturnSnowflakeIdAsync(menu));
}
/// <summary>
/// 更新
/// </summary>
/// <param name="menu"></param>
/// <returns></returns>
[HttpPut]
[Permission("system:menu:edit")]
public async Task<Result> Update(MenuEntity menu)
{
//注意,这里如果是主目录,还需要判断/,需要以/开头
return Result.Success().SetData(await _iMenuService._repository.UpdateIgnoreNullAsync(menu));
}
/// <summary>
/// 得到树形菜单
/// </summary>
/// <returns></returns>
[HttpGet]
[Permission("system:menu:query")]
public async Task<Result> GetMenuTree()
{
return Result.Success().SetData(await _iMenuService.GetMenuTreeAsync());
}
/// <summary>
/// 根据角色id获取该角色下全部菜单
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("{id}")]
[Permission("system:menu:query")]
public async Task<Result> GetListByRoleId(long id)
{
return Result.Success().SetData(await _iMenuService.GetListByRoleId(id));
}
}
}

View File

@@ -0,0 +1,83 @@
using Hei.Captcha;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Const;
using Yi.Framework.Common.Enum;
using Yi.Framework.Common.Helper;
using Yi.Framework.Common.Models;
using Yi.Framework.Core;
using Yi.Framework.DtoModel;
using Yi.Framework.Interface;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
using Yi.Framework.WebCore.SignalRHub;
namespace Yi.Framework.ApiMicroservice.Controllers
{
/// <summary>
/// 在线管理
/// </summary>
[ApiController]
[Authorize]
[Route("api/[controller]/[action]")]
public class OnlineController : ControllerBase
{
private ILogger<OnlineController> _logger;
private IHubContext<MainHub> _hub;
public OnlineController(ILogger<OnlineController> logger, IHubContext<MainHub> hub)
{
_logger = logger;
_hub = hub;
}
/// <summary>
/// 动态条件获取当前在线用户
/// </summary>
/// <param name="online"></param>
/// <param name="page"></param>
/// <returns></returns>
[HttpGet]
public Result PageList([FromQuery] OnlineUser online, [FromQuery] PageParModel page)
{
var data = MainHub.clientUsers;
IEnumerable<OnlineUser> dataWhere = data.AsEnumerable();
if (!string.IsNullOrEmpty(online.Ipaddr))
{
dataWhere = dataWhere.Where((u) => u.Ipaddr!.Contains(online.Ipaddr));
}
if (!string.IsNullOrEmpty(online.UserName))
{
dataWhere = dataWhere.Where((u) => u.UserName!.Contains(online.UserName));
}
return Result.Success().SetData(new PageModel<List<OnlineUser>>() { Total = data.Count, Data = dataWhere.ToList() });
}
/// <summary>
/// 强制退出用户
/// </summary>
/// <param name="connnectionId"></param>
/// <returns></returns>
[HttpDelete]
[Route("{connnectionId}")]
public async Task<Result> ForceOut(string connnectionId)
{
if (MainHub.clientUsers.Exists(u => u.ConnnectionId == connnectionId))
{
//前端接受到这个事件后,触发前端自动退出
await _hub.Clients.Client(connnectionId).SendAsync(HubTypeEnum.forceOut.ToString(),"你已被强制退出!");
return Result.Success();
}
return Result.Error("操作失败!未发现该连接!");
}
}
}

View File

@@ -0,0 +1,42 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Interface.RABC;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
[ApiController]
[Route("api/[controller]/[action]")]
public class OperationLogController : BaseSimpleCrudController<OperationLogEntity>
{
private IOperationLogService _iOperationLogService;
public OperationLogController(ILogger<OperationLogEntity> logger, IOperationLogService iOperationLogService) : base(logger, iOperationLogService)
{
_iOperationLogService = iOperationLogService;
}
/// <summary>
/// 动态条件分页查询
/// </summary>
/// <param name="operationLog"></param>
/// <param name="page"></param>
/// <returns></returns>
[HttpGet]
public async Task<Result> PageList([FromQuery] OperationLogEntity operationLog, [FromQuery] PageParModel page)
{
return Result.Success().SetData(await _iOperationLogService.SelctPageList(operationLog, page));
}
}
}

View File

@@ -0,0 +1,53 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Interface.RABC;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
[ApiController]
[Route("api/[controller]/[action]")]
public class PostController : BaseSimpleCrudController<PostEntity>
{
private IPostService _iPostService;
public PostController(ILogger<PostEntity> logger, IPostService iPostService) : base(logger, iPostService)
{
_iPostService = iPostService;
}
/// <summary>
/// 动态条件分页查询
/// </summary>
/// <param name="post"></param>
/// <param name="page"></param>
/// <returns></returns>
[HttpGet]
public async Task<Result> PageList([FromQuery] PostEntity post, [FromQuery] PageParModel page)
{
return Result.Success().SetData(await _iPostService.SelctPageList(post, page));
}
public override async Task<Result> Add(PostEntity entity)
{
return await base.Add(entity);
}
public override async Task<Result> Update(PostEntity entity)
{
return await base.Update(entity);
}
}
}

View File

@@ -0,0 +1,118 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.DtoModel.Base.Dto;
using Yi.Framework.Interface;
using Yi.Framework.Interface.RABC;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.Service;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
/// <summary>
/// 角色管理
/// </summary>
[ApiController]
[Route("api/[controller]/[action]")]
public class RoleController : BaseSimpleRdController<RoleEntity>
{
private IRoleService _iRoleService;
public RoleController(ILogger<RoleEntity> logger, IRoleService iRoleService) : base(logger, iRoleService)
{
_iRoleService = iRoleService;
}
/// <summary>
/// 动态条件分页查询
/// </summary>
/// <returns></returns>
[Permission("system:role:query")]
[HttpGet]
public async Task<Result> PageList([FromQuery] RoleEntity role, [FromQuery] PageParModel page)
{
return Result.Success().SetData(await _iRoleService.SelctPageList(role, page));
}
/// <summary>
/// 给多用户设置多角色
/// </summary>
/// <param name="giveRoleSetMenuDto"></param>
/// <returns></returns>
[HttpPut]
[Permission("system:role:edit")]
public async Task<Result> GiveRoleSetMenu(GiveRoleSetMenuDto giveRoleSetMenuDto)
{
return Result.Success().SetStatus(await _iRoleService.GiveRoleSetMenu(giveRoleSetMenuDto.RoleIds, giveRoleSetMenuDto.MenuIds));
}
/// <summary>
/// 添加角色包含菜单
/// </summary>
/// <param name="roleDto"></param>
/// <returns></returns>
[Permission("system:role:add")]
[HttpPost]
public async Task<Result> Add(RoleInfoDto roleDto)
{
return Result.Success().SetData(await _iRoleService.AddInfo(roleDto));
}
/// <summary>
/// 更新角色信息
/// </summary>
/// <returns></returns>
[Permission("system:role:edit")]
[HttpPut]
public async Task<Result> Update(RoleInfoDto roleDto)
{
return Result.Success().SetStatus(await _iRoleService.UpdateInfo(roleDto));
}
/// <summary>
/// 更改角色状态
/// </summary>
/// <param name="roleId"></param>
/// <param name="isDel"></param>
/// <returns></returns>
[Permission("system:role:edit")]
[HttpPut]
public async Task<Result> UpdateStatus(long roleId, bool isDel)
{
return Result.Success().SetData(await _iRoleService._repository.UpdateIgnoreNullAsync(new RoleEntity() { Id = roleId, IsDeleted = isDel }));
}
/// <summary>
///更改角色数据权限
/// </summary>
/// <returns></returns>
[Permission("system:role:edit")]
[HttpPut]
public async Task<Result> UpdateDataScpoce(RoleInfoDto roleDto)
{
return Result.Success().SetStatus(await _iRoleService.UpdateDataScpoce(roleDto));
}
/// <summary>
/// 删除
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
[Permission("system:role:remove")]
[HttpDelete]
public override async Task<Result> DelList(List<long> ids)
{
return await base.DelList(ids);
}
}
}

View File

@@ -0,0 +1,174 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Attribute;
using Yi.Framework.Common.Const;
using Yi.Framework.Common.Enum;
using Yi.Framework.Common.Helper;
using Yi.Framework.Common.Models;
using Yi.Framework.DtoModel.Base.Dto;
using Yi.Framework.Interface;
using Yi.Framework.Interface.RABC;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
using Yi.Framework.WebCore.CommonExtend;
namespace Yi.Framework.ApiMicroservice.Controllers
{
/// <summary>
/// 用户管理
/// </summary>
[ApiController]
[Authorize]
[Route("api/[controller]/[action]")]
public class UserController : BaseSimpleRdController<UserEntity>
{
private IUserService _iUserService;
public UserController(ILogger<UserEntity> logger, IUserService iUserService) : base(logger, iUserService)
{
_iUserService = iUserService;
}
/// <summary>
/// 动态条件分页查询
/// </summary>
/// <param name="user"></param>
/// <param name="page"></param>
/// <param name="deptId"></param>
/// <returns></returns>
[HttpGet]
[Permission("system:user:query")]
public async Task<Result> PageList([FromQuery] UserEntity user, [FromQuery] PageParModel page, [FromQuery] long? deptId)
{
return Result.Success().SetData(await _iUserService.SelctPageList(user, page, deptId));
}
/// <summary>
/// 更改用户状态
/// </summary>
/// <param name="userId"></param>
/// <param name="isDel"></param>
/// <returns></returns>
[HttpPut]
[Permission("system:user:edit")]
[Log("用户模块", OperEnum.Update)]
public async Task<Result> UpdateStatus(long userId, bool isDel)
{
return Result.Success().SetData(await _repository.UpdateIgnoreNullAsync(new UserEntity() { Id = userId, IsDeleted = isDel }));
}
/// <summary>
/// 给多用户设置多角色
/// </summary>
/// <param name="giveUserSetRoleDto"></param>
/// <returns></returns>
[HttpPut]
[Permission("system:user:edit")]
[Log("用户模块", OperEnum.Update)]
public async Task<Result> GiveUserSetRole(GiveUserSetRoleDto giveUserSetRoleDto)
{
return Result.Success().SetStatus(await _iUserService.GiveUserSetRole(giveUserSetRoleDto.UserIds, giveUserSetRoleDto.RoleIds));
}
/// <summary>
/// 通过用户id得到用户信息关联部门、岗位、角色
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("{id}")]
[Permission("system:user:query")]
public override async Task<Result> GetById([FromRoute] long id)
{
return Result.Success().SetData(await _iUserService.GetInfoById(id));
}
/// <summary>
/// 更新用户信息
/// </summary>
/// <param name="userDto"></param>
/// <returns></returns>
[HttpPut]
[Permission("system:user:edit")]
[Log("用户模块", OperEnum.Update)]
public async Task<Result> Update(UserInfoDto userDto)
{
if (await _repository.IsAnyAsync(u => userDto.User!.UserName!.Equals(u.UserName) && !userDto.User.Id.Equals(u.Id)))
{
return Result.Error("用户名已存在,修改失败!");
}
return Result.Success().SetStatus(await _iUserService.UpdateInfo(userDto));
}
/// <summary>
/// 更新个人中心信息
/// </summary>
/// <param name="userDto"></param>
/// <returns></returns>
[HttpPut]
[Permission("system:user:edit")]
[Log("用户模块", OperEnum.Update)]
public async Task<Result> UpdateProfile(UserInfoDto userDto)
{
//修改需要赋值上主键哦
userDto.User!.Id = HttpContext.GetUserIdInfo();
return Result.Success().SetStatus(await _iUserService.UpdateProfile(userDto));
}
/// <summary>
/// 添加用户
/// </summary>
/// <param name="userDto"></param>
/// <returns></returns>
[HttpPost]
[Permission("system:user:add")]
[Log("用户模块", OperEnum.Insert)]
public async Task<Result> Add(UserInfoDto userDto)
{
if (string.IsNullOrEmpty(userDto?.User?.Password))
{
return Result.Error("密码为空,添加失败!");
}
if (await _repository.IsAnyAsync(u => userDto.User.UserName!.Equals(u.UserName)))
{
return Result.Error("用户已经存在,添加失败!");
}
return Result.Success().SetStatus(await _iUserService.AddInfo(userDto));
}
/// <summary>
/// 重置密码
/// </summary>
/// <param name="user"></param>
/// <returns></returns>
[HttpPut]
[Permission("system:user:edit")]
[Log("用户模块", OperEnum.Update)]
public async Task<Result> RestPassword(UserEntity user)
{
return Result.Success().SetStatus(await _iUserService.RestPassword(user.Id, user.Password));
}
[Permission("system:user:query")]
public override Task<Result> GetList()
{
return base.GetList();
}
[Permission("system:user:remove")]
[Log("用户模块", OperEnum.Delete)]
public override Task<Result> DelList(List<long> ids)
{
return base.DelList(ids);
}
}
}

View File

@@ -1,45 +0,0 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.DTOModel;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
/// <summary>
/// 角色管理
/// </summary>
[ApiController]
[Route("api/[controller]/[action]")]
public class RoleController : BaseCrudController<RoleEntity>
{
private IRoleService _iRoleService;
public RoleController(ILogger<RoleEntity> logger, IRoleService iRoleService) : base(logger, iRoleService)
{
_iRoleService = iRoleService;
}
/// <summary>
/// 给多用户设置多角色
/// </summary>
/// <param name="giveRoleSetMenuDto"></param>
/// <returns></returns>
[HttpPut]
public async Task<Result> GiveRoleSetMenu(GiveRoleSetMenuDto giveRoleSetMenuDto)
{
return Result.Success().SetStatus(await _iRoleService.GiveRoleSetMenu(giveRoleSetMenuDto.RoleIds, giveRoleSetMenuDto.MenuIds));
}
}
}

View File

@@ -0,0 +1,28 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface.SHOP;
using Yi.Framework.Model.SHOP.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
[ApiController]
[Route("api/[controller]/[action]")]
public class CategoryController : BaseCrudController<CategoryEntity>
{
private ICategoryService _iCategoryService;
public CategoryController(ILogger<CategoryEntity> logger, ICategoryService iCategoryService) : base(logger, iCategoryService)
{
_iCategoryService = iCategoryService;
}
}
}

View File

@@ -0,0 +1,115 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Enum;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Interface.SHOP;
using Yi.Framework.Model.SHOP.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
[ApiController]
[Route("api/[controller]/[action]")]
public class SkuController : BaseSimpleCrudController<SkuEntity>
{
private ISkuService _iSkuService;
public SkuController(ILogger<SkuEntity> logger, ISkuService iSkuService) : base(logger, iSkuService)
{
_iSkuService = iSkuService;
}
/// <summary>
/// 动态条件分页查询
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> PageList([FromQuery] SkuEntity eneity, [FromQuery] PageParModel page)
{
return Result.Success().SetData(await _iSkuService.SelctPageList(eneity, page));
}
//数据测试
[HttpGet]
public async Task<Result> Test(OperEnum operEnum)
{
switch (operEnum)
{
case OperEnum.Insert:
List<SkuEntity> spus = new();
var sku1 = new SkuEntity()
{
Id = 1,
Stock = 100,
IsDeleted = false,
SpuId = 1,
Price = 1000,
SpecsSkuAllInfo = new List<SpecsSkuAllInfoModel> {
new SpecsSkuAllInfoModel { SpecsGroupName="内存",SpecsName="1GB" } ,
new SpecsSkuAllInfoModel { SpecsGroupName="颜色",SpecsName= "红" } },
};
var sku2 = new SkuEntity()
{
Id = 2,
Stock = 100,
IsDeleted = false,
SpuId = 1,
Price = 4000,
SpecsSkuAllInfo = new List<SpecsSkuAllInfoModel> {
new SpecsSkuAllInfoModel { SpecsGroupName="内存",SpecsName="2GB" } ,
new SpecsSkuAllInfoModel { SpecsGroupName="颜色",SpecsName= "绿" } },
};
var sku3 = new SkuEntity()
{
Id = 3,
Stock = 100,
IsDeleted = false,
SpuId = 2,
Price = 2000,
SpecsSkuAllInfo = new List<SpecsSkuAllInfoModel> {
new SpecsSkuAllInfoModel { SpecsGroupName="内存",SpecsName="3GB" } ,
new SpecsSkuAllInfoModel { SpecsGroupName="颜色",SpecsName= "红" } },
};
var sku4 = new SkuEntity()
{
Id = 4,
Stock = 100,
IsDeleted = false,
SpuId = 2,
Price = 1000,
SpecsSkuAllInfo = new List<SpecsSkuAllInfoModel> {
new SpecsSkuAllInfoModel { SpecsGroupName="内存",SpecsName="2GB" } ,
new SpecsSkuAllInfoModel { SpecsGroupName="颜色",SpecsName= "蓝" } },
};
spus.Add(sku1);
spus.Add(sku2);
spus.Add(sku3);
spus.Add(sku4);
await _iSkuService._repository.InsertRangeAsync(spus);
break;
case OperEnum.Delete:
await _iSkuService._repository.DeleteAsync((u)=>true);
break;
default:
break;
}
return Result.Success();
}
}
}

View File

@@ -0,0 +1,28 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface.SHOP;
using Yi.Framework.Model.SHOP.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
[ApiController]
[Route("api/[controller]/[action]")]
public class SpecsController : BaseCrudController<SpecsEntity>
{
private ISpecsService _iSpecsService;
public SpecsController(ILogger<SpecsEntity> logger, ISpecsService iSpecsService) : base(logger, iSpecsService)
{
_iSpecsService = iSpecsService;
}
}
}

View File

@@ -0,0 +1,28 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface.SHOP;
using Yi.Framework.Model.SHOP.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
[ApiController]
[Route("api/[controller]/[action]")]
public class SpecsGroupController : BaseCrudController<SpecsGroupEntity>
{
private ISpecsGroupService _iSpecsGroupService;
public SpecsGroupController(ILogger<SpecsGroupEntity> logger, ISpecsGroupService iSpecsGroupService) : base(logger, iSpecsGroupService)
{
_iSpecsGroupService = iSpecsGroupService;
}
}
}

View File

@@ -0,0 +1,96 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Enum;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Interface.SHOP;
using Yi.Framework.Model.SHOP.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
[ApiController]
[Route("api/[controller]/[action]")]
public class SpuController : BaseSimpleCrudController<SpuEntity>
{
private ISpuService _iSpuService;
public SpuController(ILogger<SpuEntity> logger, ISpuService iSpuService) : base(logger, iSpuService)
{
_iSpuService = iSpuService;
}
/// <summary>
/// 动态条件分页查询
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> PageList([FromQuery] SpuEntity eneity, [FromQuery] PageParModel page)
{
return Result.Success().SetData(await _iSpuService.SelctPageList(eneity, page));
}
[Route("{id}")]
[HttpGet]
public override async Task<Result> GetById([FromRoute] long id)
{
return Result.Success().SetData(await _repository._DbQueryable.Includes(u=>u.Skus).SingleAsync(u=>u.Id.Equals(id)));
}
//数据测试
[HttpGet]
public async Task<Result> Test(OperEnum operEnum)
{
switch (operEnum)
{
case OperEnum.Insert:
List<SpuEntity> spus = new();
var spu1 = new SpuEntity()
{
Id = 1,
SpuName = "华为mate40 5G手机",
IsDeleted = false,
Details = "华为手机就是牛",
Price = "1000-2000",
SpecsSpuAllInfo = new List<SpecsSpuAllInfoModel> {
new SpecsSpuAllInfoModel { SpecsGroupName="内存",SpecsNames=new List<string> { "1GB","2GB","3GB"} } ,
new SpecsSpuAllInfoModel { SpecsGroupName="颜色",SpecsNames=new List<string> { "红","蓝","绿"} } },
};
var spu2 = new SpuEntity()
{
Id = 2,
SpuName = "小米888 8G手机",
IsDeleted = false,
Details = "小米手机就是牛",
Price = "2000-3000",
SpecsSpuAllInfo = new List<SpecsSpuAllInfoModel> {
new SpecsSpuAllInfoModel { SpecsGroupName="内存",SpecsNames=new List<string> { "1GB","2GB","3GB"} } ,
new SpecsSpuAllInfoModel { SpecsGroupName="颜色",SpecsNames=new List<string> { "红","蓝","绿"} } },
};
spus.Add(spu1);
spus.Add(spu2);
await _iSpuService._repository.InsertRangeAsync(spus);
break;
case OperEnum.Delete:
await _iSpuService._repository.DeleteAsync((u) => true);
break;
default:
break;
}
return Result.Success();
}
}
}

View File

@@ -1,21 +1,32 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Logging;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Abstract;
using Yi.Framework.Common.Attribute;
using Yi.Framework.Common.Const;
using Yi.Framework.Common.Models;
using Yi.Framework.Core;
using Yi.Framework.Core.Cache;
using Yi.Framework.Core.Quartz;
using Yi.Framework.Interface;
using Yi.Framework.Interface.RABC;
using Yi.Framework.Job;
using Yi.Framework.Language;
using Yi.Framework.Model.Models;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
using Yi.Framework.WebCore.DbExtend;
using Yi.Framework.WebCore.SignalRHub;
namespace Yi.Framework.ApiMicroservice.Controllers
{
@@ -30,13 +41,54 @@ namespace Yi.Framework.ApiMicroservice.Controllers
private IUserService _iUserService;
private IRoleService _iRoleService;
private QuartzInvoker _quartzInvoker;
private IHubContext<MainHub> _hub;
private ThumbnailSharpInvoer _thumbnailSharpInvoer;
private CacheInvoker _cacheDb;
private ILogger<TestController> _logger;
ISugarUnitOfWork<UnitOfWork> _unitOfWork;
[Autowired]
private ICurrentUser _currentUser { get; set; }
[Autowired]
public CacheInvoker CacheInvoker { get; set; }
//你可以依赖注入服务层各各接口,也可以注入其他仓储层,怎么爽怎么来!
public TestController(ILogger<UserEntity> logger, IRoleService iRoleService, IUserService iUserService, IStringLocalizer<LocalLanguage> local, QuartzInvoker quartzInvoker)
/// <summary>
/// 依赖注入,优雅写法
/// </summary>
/// <param name="hub"></param>
/// <param name="logger"></param>
/// <param name="iRoleService"></param>
/// <param name="iUserService"></param>
/// <param name="local"></param>
/// <param name="quartzInvoker"></param>
/// <param name="thumbnailSharpInvoer"></param>
/// <param name="cacheInvoker"></param>
/// <param name="unitOfWork"></param>
public TestController(IHubContext<MainHub> hub,
ILogger<TestController> logger,
IRoleService iRoleService,
IUserService iUserService,
IStringLocalizer<LocalLanguage> local,
QuartzInvoker quartzInvoker,
ThumbnailSharpInvoer thumbnailSharpInvoer,
CacheInvoker cacheInvoker,
ISugarUnitOfWork<UnitOfWork> unitOfWork
) =>
(_logger, _iUserService, _iRoleService, _quartzInvoker, _hub, _local, _thumbnailSharpInvoer, _cacheDb, _unitOfWork) =
(logger, iUserService, iRoleService, quartzInvoker, hub, local, thumbnailSharpInvoer, cacheInvoker, unitOfWork);
/// <summary>
/// swagger跳转
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("/")]
public IActionResult Swagger()
{
_local = local;
_iUserService = iUserService;
_iRoleService = iRoleService;
_quartzInvoker = quartzInvoker;
return Redirect("/Swagger");
}
/// <summary>
@@ -45,7 +97,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// <returns></returns>
[HttpGet]
// 特点:化繁为简!意框架仓储代理上下文对象,用起来就是爽,但最好按规范来爽!
// 规范:控制器不建议使用切换仓储方法、控制器严禁使用DB上下文对象其它怎么爽怎么来
// 规范控制器严禁使用DB上下文对象其它怎么爽怎么来
public async Task<Result> DbTest()
{
//非常好使用UserService的特有方法
@@ -60,21 +112,38 @@ namespace Yi.Framework.ApiMicroservice.Controllers
//挺不错,依赖注入其他仓储
await _iRoleService._repository.GetListAsync();
//不建议操作,直接切换其他仓储
//还行,直接切换其他仓储,怎么爽怎么来
await _iUserService._repository.ChangeRepository<Repository<RoleEntity>>().GetListAsync();
//直接操作Db对象???恭喜你已经毕业了!此后将有一天,接手到这个的软件的程序员将破口大骂。
//最好不要在控制器直接操作Db对象
await _iUserService._repository._Db.Queryable<UserEntity>().ToListAsync();
await _iUserService._repository._DbQueryable.ToListAsync();
return Result.Success().SetData(await _iUserService.DbTest());
}
/// <summary>
/// 工作单元测试使用sqlsugar内置
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> UnitOfWorkTest()
{
var data = await _iRoleService._repository._DbQueryable.ToListAsync();
using (var uow = _unitOfWork.CreateContext())
{
var res = await _iRoleService._repository.InsertReturnSnowflakeIdAsync(new RoleEntity { RoleName = "测试", RoleCode = "tt" });
throw new ApplicationException("测试uow");
}
}
/// <summary>
/// 执行Sql返回
/// </summary>
/// <returns></returns>
[HttpGet]
//简单语句不推荐!
//简单语句不推荐使用sql
public async Task<Result> SqlTest()
{
return Result.Success().SetData(await _iUserService._repository.UseSqlAsync<UserEntity>("select * from User"));
@@ -165,7 +234,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
{JobConst.method,"get" },
{JobConst.url,"https://www.baidu.com" }
};
await _quartzInvoker.start("*/5 * * * * ?", new Quartz.JobKey("test", "my"), "Yi.Framework.Job", "HttpJob", data: data);
await _quartzInvoker.StartAsync("*/5 * * * * ?", "HttpJob", jobName: "test", jobGroup: "my", data: data);
return Result.Success();
}
@@ -174,10 +243,181 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// </summary>
/// <returns></returns>
[HttpPut]
public async Task<Result> stopJob()
public async Task<Result> StopJob()
{
await _quartzInvoker.Stop(new Quartz.JobKey("test", "my"));
await _quartzInvoker.StopAsync(new Quartz.JobKey("test", "my"));
return Result.Success("http://localhost:19001/hangfire");
}
/// <summary>
/// job异常处理
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> ErrorJob()
{
await _quartzInvoker.StartAsync("*/5 * * * * ?", "ErrorJob");
return Result.Success();
}
/// <summary>
/// 树形结构构建测试
/// </summary>
/// <returns></returns>
[HttpGet]
public Result TreeTest()
{
List<VueRouterModel> vueRouterModels = new()
{
new VueRouterModel { Id = 1, OrderNum = 1, ParentId = 0, Name = "001" },
new VueRouterModel { Id = 2, OrderNum = 1, ParentId = 1, Name = "001001" },
new VueRouterModel { Id = 3, OrderNum = 1, ParentId = 1, Name = "001002" }
};
var treeData = Common.Helper.TreeHelper.SetTree(vueRouterModels);
return Result.Success().SetData(treeData);
}
/// <summary>
/// 授权测试
/// </summary>
/// <returns></returns>
[Authorize]
[HttpGet]
public Result AuthorizeTest()
{
return Result.Success();
}
/// <summary>
/// 清空数据库
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> ClearDb()
{
var rep = _iUserService._repository;
return Result.Success().SetStatus(await rep.UseTranAsync(async () =>
{
await rep.DeleteAsync(u => true);
await rep.ChangeRepository<Repository<MenuEntity>>().DeleteAsync(u => true);
await rep.ChangeRepository<Repository<RoleEntity>>().DeleteAsync(u => true);
await rep.ChangeRepository<Repository<RoleMenuEntity>>().DeleteAsync(u => true);
await rep.ChangeRepository<Repository<UserRoleEntity>>().DeleteAsync(u => true);
await rep.ChangeRepository<Repository<DictionaryEntity>>().DeleteAsync(u => true);
await rep.ChangeRepository<Repository<DictionaryInfoEntity>>().DeleteAsync(u => true);
await rep.ChangeRepository<Repository<ConfigEntity>>().DeleteAsync(u => true);
await rep.ChangeRepository<Repository<PostEntity>>().DeleteAsync(u => true);
await rep.ChangeRepository<Repository<DeptEntity>>().DeleteAsync(u => true);
}));
}
/// <summary>
/// 种子数据
/// </summary>
/// <returns></returns>
[HttpGet]
public Result SeedDb()
{
var rep = _iUserService._repository;
return Result.Success().SetStatus(DbSeedExtend.DataInvoer(rep._Db));
}
/// <summary>
/// 操作日志测试
/// </summary>
/// <param name="par"></param>
/// <returns></returns>
[HttpPost]
[Log("测试模块", Common.Enum.OperEnum.Insert)]
public Result LogTest(List<string> par)
{
return Result.Success().SetData(par);
}
/// <summary>
/// Signalr实时推送测试
/// </summary>
/// <param name="msg"></param>
/// <returns></returns>
[HttpGet]
public async Task<Result> SignalrTest(int msg)
{
await _hub.Clients.All.SendAsync("onlineNum", msg);
return Result.Success("向所有连接客户端发送一个消息");
}
//job任务与公告管理
/// <summary>
/// 缩略图测试,需要生成前及生成后的路径
/// </summary>
/// <returns></returns>
[HttpGet]
public Result ThumbnailTest()
{
try
{
var path = @"D:\App\test11.jpg";
var result = _thumbnailSharpInvoer.CreateThumbnailBytes(thumbnailSize: 300,
imageStream: new FileStream(path, FileMode.Open, FileAccess.ReadWrite),
imageFormat: Format.Jpeg);
System.IO.File.WriteAllBytes(@"D:\App\test222.jpg", result);
}
catch (Exception ex)
{
return Result.Error(ex.Message);
}
return Result.Success();
}
/// <summary>
/// 缓存测试
/// </summary>
/// <returns></returns>
[HttpGet]
public Result CacheDBTest()
{
var key = "Yi:Test";
var item = "你好世界";
_cacheDb.Set(key, item);
var data = _cacheDb.Get<string>(key);
return Result.Success().SetData(data);
}
/// <summary>
/// 自定义日志
/// </summary>
/// <returns></returns>
[HttpGet]
public Result CustomLogTest()
{
_logger.LogWarning("输出一条日志");
return Result.Success();
}
/// <summary>
/// 属性注入测试
/// </summary>
/// <returns></returns>
[HttpGet]
public Result PropertyTest()
{
return Result.Success().SetStatus(CacheInvoker is not null);
}
/// <summary>
/// 获取当前用户信息测试
/// </summary>
/// <returns></returns>
[HttpGet]
[Authorize]
public Result CurrentUserTest()
{
var per = _currentUser.Permission;
return Result.Success().SetData(per);
}
}
}

View File

@@ -1,71 +0,0 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.DTOModel;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
/// <summary>
/// 用户管理
/// </summary>
[ApiController]
[Route("api/[controller]/[action]")]
public class UserController : BaseCrudController<UserEntity>
{
private IUserService _iUserService;
public UserController(ILogger<UserEntity> logger, IUserService iUserService) : base(logger, iUserService)
{
_iUserService = iUserService;
}
/// <summary>
/// 添加用户,去重,密码加密
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[Permission($"{nameof(UserEntity)}:add")]
[HttpPost]
public override async Task<Result> Add(UserEntity entity)
{
if (!await _iUserService.Exist(entity.UserName))
{
entity.BuildPassword();
return Result.Success().SetData(await _iUserService._repository.InsertReturnSnowflakeIdAsync(entity));
}
return Result.SuccessError("用户已存在");
}
/// <summary>
/// 给多用户设置多角色
/// </summary>
/// <param name="giveUserSetRoleDto"></param>
/// <returns></returns>
[HttpPut]
public async Task<Result> GiveUserSetRole(GiveUserSetRoleDto giveUserSetRoleDto)
{
return Result.Success().SetStatus(await _iUserService.GiveUserSetRole(giveUserSetRoleDto.UserIds, giveUserSetRoleDto.RoleIds));
}
/// <summary>
/// 通过用户id得到角色列表
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> GetRoleListByUserId(long userId)
{
return Result.Success().SetData(await _iUserService.GetRoleListByUserId(userId));
}
}
}

View File

@@ -1,13 +1,26 @@
global using System;
using Autofac.Extensions.DependencyInjection;
using Yi.Framework.WebCore.BuilderExtend;
using Yi.Framework.Core;
using Yi.Framework.WebCore.MiddlewareExtend;
using Yi.Framework.WebCore.Utility;
using Autofac;
using Yi.Framework.Common.Models;
using Yi.Framework.Language;
using Microsoft.Extensions.Localization;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.SignalRHub;
using Hei.Captcha;
using Microsoft.Extensions.DependencyInjection;
using Yi.Framework.WebCore.DbExtend;
using IPTools.Core;
using Yi.Framework.WebCore.LogExtend;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.AspNetCore.Mvc.Controllers;
using Yi.Framework.WebCore.AutoFacExtend;
using AspectCore.Extensions.DependencyInjection;
using AspectCore.Extensions.Hosting;
using Yi.Framework.WebCore.AspNetCoreExtensions;
using Yi.Framework.WebCore.CommonExtend;
var builder = WebApplication.CreateBuilder(args);
builder.Configuration.AddCommandLine(args);
@@ -21,6 +34,7 @@ builder.Host.ConfigureAppConfiguration((hostBuilderContext, configurationBuilder
#endregion
configurationBuilder.AddApolloService("Yi");
});
builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory());
builder.Host.ConfigureContainer<ContainerBuilder>(containerBuilder =>
{
@@ -28,13 +42,26 @@ builder.Host.ConfigureContainer<ContainerBuilder>(containerBuilder =>
//交由Module依赖注入
#endregion
containerBuilder.RegisterModule<CustomAutofacModule>();
#region
//添加属性注入模块
#endregion
containerBuilder.RegisterModule<PropertiesAutowiredModule>();
#region
//使用AppService特性优雅的进行自动依赖注入,仓储与基类服务便是使用该种方式自动注入
#endregion
containerBuilder.AddAutoIocService("Yi.Framework.Repository", "Yi.Framework.Service");
});
////属性注入将控制器的mvc模块转接给ioc
builder.Services.Replace(ServiceDescriptor.Transient<IControllerActivator, ServiceBasedControllerActivator>());
builder.Host.ConfigureLogging(loggingBuilder =>
{
loggingBuilder.AddFilter("System", Microsoft.Extensions.Logging.LogLevel.Warning);
loggingBuilder.AddFilter("Microsoft", Microsoft.Extensions.Logging.LogLevel.Warning);
loggingBuilder.AddLog4Net("./Config/Log4net.config");
//添加自定义日志
//loggingBuilder.AddCustomLogger();
});
#region
//配置类配置
@@ -49,9 +76,9 @@ builder.Host.ConfigureLogging(loggingBuilder =>
#endregion
builder.Services.AddIocService(builder.Configuration);
#region
//Sqlsugar上下文注入
//Sqlsugar上下文注入,是否开启数据权限功能,开启需走缓存
#endregion
builder.Services.AddSqlsugarServer();
builder.Services.AddSqlsugarServer(DbFiterExtend.Data);
#region
//Quartz任务调度配置
#endregion
@@ -63,13 +90,18 @@ builder.Services.AddAutoMapperService();
#region
//控制器+过滤器配置
#endregion
builder.Services.AddControllers(optios => {
//optios.Filters.Add<PermissionAttribute>();
builder.Services.AddControllers(optios =>
{
//注册全局
optios.Filters.Add<GlobalLogAttribute>();
}).AddJsonFileService();
#region
//权限过滤器
#endregion
//权限
builder.Services.AddSingleton<PermissionAttribute>();
//日志
builder.Services.AddSingleton<GlobalLogAttribute>();
#region
//Swagger服务配置
#endregion
@@ -89,7 +121,7 @@ builder.Services.AddAuthorizationService();
#region
//Redis服务配置
#endregion
builder.Services.AddRedisService();
builder.Services.AddCacheService();
#region
//RabbitMQ服务配置
#endregion
@@ -110,6 +142,33 @@ builder.Services.AddCAPService();
//国际化配置
#endregion
builder.Services.AddLocalizerService();
#region
//添加signalR
#endregion
builder.Services.AddSignalR();
#region
//添加验证码
#endregion
builder.Services.AddHeiCaptcha();
#region
//添加Http上下文
#endregion
builder.Services.AddHttpContextAccessor();
#region
//添加缩略图引入了System.Drawinglinu需要插件支持
#endregion
builder.Services.AddSingleton<ThumbnailSharpInvoer>();
#region
//添加当前用户信息使用
#endregion
builder.Services.AddCurrentUserServer();
#region
//全局配置初始化值
#endregion
GobalModel.SqlLogEnable = Appsettings.appBool("SqlLog_Enable");
GobalModel.LoginCodeEnable = Appsettings.appBool("LoginCode_Enable");
//-----------------------------------------------------------------------------------------------------------
var app = builder.Build();
#region
@@ -122,15 +181,13 @@ ServiceLocator.Instance = app.Services;
//测试页面注入
#endregion
app.UseDeveloperExceptionPage();
#region
//Swagger服务注入
#endregion
app.UseSwaggerService();
}
#region
//错误抓取反馈注入
#endregion
app.UseErrorHandlingService();
#region
//静态文件注入
#endregion
@@ -139,6 +196,11 @@ app.UseStaticFiles();
//多语言国际化注入
#endregion
app.UseLocalizerService();
#region
//上下文请求body
#endregion
app.UseHttpBodyService();
#region
//HttpsRedirection注入
#endregion
@@ -164,18 +226,30 @@ app.UseAuthentication();
#endregion
app.UseAuthorization();
#region
//添加当前用户信息使用
#endregion
app.UseCurrentUserServer();
#region
//Consul服务注入
#endregion
app.UseConsulService();
#region
//数据库种子注入
#endregion
app.UseDbSeedInitService();
#region
//redis种子注入
#endregion
app.UseRedisSeedInitService();
#region
//Endpoints注入
#endregion
app.UseEndpoints(endpoints =>
{
#region
//SignalR配置
#endregion
endpoints.MapHub<MainHub>("/api/hub/main");
endpoints.MapControllers();
});
//准备添加多租户
app.Run();

View File

@@ -2,6 +2,7 @@
"profiles": {
"Yi.Framework.ApiMicroservice": {
"commandName": "Project",
//开发环境根据情况是否自动启动浏览器
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"

View File

@@ -10,7 +10,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>./Config/SwaggerDoc.xml</DocumentationFile>
<NoWarn>1701;1702;CS1591</NoWarn>
<NoWarn>1701;1702;CS1591;CS8618</NoWarn>
</PropertyGroup>
<ItemGroup>
@@ -21,16 +21,32 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Yi.Framework.DTOModel\Yi.Framework.DTOModel.csproj" />
<ProjectReference Include="..\Yi.Framework.Interface\Yi.Framework.Interface.csproj" />
<ProjectReference Include="..\Yi.Framework.Model\Yi.Framework.Model.csproj" />
<ProjectReference Include="..\Yi.Framework.Service\Yi.Framework.Service.csproj" />
<PackageReference Include="AspectCore.Extensions.Hosting" Version="2.3.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Yi.Framework.WebCore\Yi.Framework.WebCore.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="wwwroot\file\" />
<Folder Include="wwwroot\image\" />
<Content Update="wwwroot\Image\0.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Update="Config\SwaggerDoc.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="ip2region.db">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="key.pem">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="public.pem">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@@ -1,5 +1,8 @@
{
"StartUrl": "http://localohost:19001",
//程序启动地址,*代表全部网口
"StartUrl": "http://*:19001",
//默认日志打印过滤
"Logging": {
"LogLevel": {
"Default": "Information",
@@ -7,73 +10,117 @@
"Microsoft.Hosting.Lifetime": "Information"
}
},
//运行全部主机
"AllowedHosts": "*",
"Consul_Enabled": false,
"DbSeed_Enabled": false,
"Apollo_Enabled": false,
"HealthCheck_Enabled": false,
"RabbitMQ_Enabled": false,
"Redis_Enabled": false,
"RedisSeed_Enabled": false,
"Kafka_Enabled": false,
"ElasticSeach_Enabled": false,
//【全局配置开启】
//Sql语句日志是否打印
"SqlLog_Enable": false,
//登录二维码是否打印
"LoginCode_Enable": false,
//【数据库配置】
//多数据库主从复制是否开启
"MutiDB_Enabled": false,
"SMS_Enabled": false,
"CAP_Enabled": false,
"CAPDashboard_Enabled": false,
"Cors_Enabled": true,
//数据库CodeFirst是否开启
"DbCodeFirst_Enabled": true,
//数据库种子数据是否开启
"DbSeed_Enabled": true,
//数据库列表
"DbList": [ "Sqlite", "Mysql", "Sqlserver", "Oracle" ],
"DbSelect": "Mysql",
"Pan": {
"ZipPath": "D:/AppWeb/test/zip"
},
//数据库类型选择
"DbSelect": "Sqlite",
//数据库连接地址,支持读写分离
"DbConn": {
//"WriteUrl": "DataSource=yi-sqlsugar-dev.db",
"WriteUrl": "server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]",
"WriteUrl": "DataSource=yi-sqlsugar-dev.db",
"ReadUrl": [
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]",
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]",
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]"
]
},
"JWTTokenOptions": {
"Audience": "http://localhost:7000",
"Issuer": "http://localhost:7000",
"SecurityKey": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDI2a2EJ7m872v0afyoSDJT2o1+SitIeJSWtLJU8/Wz2m7gStexajkeD+Lka6DSTy8gt9UwfgVQo6uKjVLG5Ex7PiGOODVqAEghBuS7JzIYU5RvI543nNDAPfnJsas96mSA7L/mD7RTE2drj6hf3oZjJpMPZUQI/B1Qjb5H3K3PNwIDAQAB"
//【缓存配置】
//缓存列表
"CacheList": [ "Redis", "MemoryCache" ],
//选择缓存
"CacheSelect": "MemoryCache",
//缓存种子数据是否开启
"CacheSeed_Enabled": false,
//【中间件开启】
//Consul是否开启
"Consul_Enabled": false,
//健康检查是否开启
"HealthCheck_Enabled": false,
//跨域开放是否开启
"Cors_Enabled": true,
//Apollo是否开启
"Apollo_Enabled": false,
//RabbitMQ是否开启
"RabbitMQ_Enabled": false,
//Kafka是否开启
"Kafka_Enabled": false,
//ElasticSeach是否开启
"ElasticSeach_Enabled": false,
//短信发送是否开启
"SMS_Enabled": false,
//分布式CAP是否开启
"CAP_Enabled": false,
//分布式CAP面板是否开启
"CAPDashboard_Enabled": false,
//【中间件配置】
//jwt授权内容公钥私钥转移到目录下的pem文件
"JwtAuthorize": {
"Issuer": "cc",
"Audience": "cc",
"PolicyName": "permission",
"DefaultScheme": "Bearer",
"IsHttps": false,
"Expiration": 300,
"ReExpiration": 3000
},
//Redis地址配置
"RedisConnOptions": {
"Host": "[xxxx]",
"Host": "[]",
"Prot": 6379,
"DB": 1,
"Password": "[xxxx]"
"Password": "[]"
},
//RabbitMq地址配置
"RabbitConn": {
"HostName": "[xxxx]",
"UserName": "[xxxx]",
"Password": "[xxxx]",
"HostName": "[]",
"UserName": "[]",
"Password": "[]",
"Port": 5672
},
//ElasticSeach地址配置
"ElasticSeachConn": {
"Url": "[xxxx]",
"IndexName": "[xxxx]",
"UserName": "[xxxx]",
"PassWord": "[xxxx]"
"Url": "[]",
"IndexName": "[]",
"UserName": "[]",
"PassWord": "[]."
},
//Kafka地址配置
"KafkaOptions": {
"BrokerList": "[xxxx]",
"TopicName": "[xxxx]"
"BrokerList": "[]:9092",
"TopicName": "kafkalog"
},
//Consul地址配置
"ConsulClientOption": {
"IP": "[xxxx]",
"Port": "[xxxx]",
"Datacenter": "[xxxx]"
"IP": "[]",
"Port": "8500",
"Datacenter": "dc1"
},
//Consul注册本机配置
"ConsulRegisterOption": {
"IP": "[xxxx]",
"Port": "19001",
"IP": "[]",
"Port": "[]",
"GroupName": "ApiMicroservice",
"HealthCheckUrl": "/Health",
"Interval": 10,
@@ -81,11 +128,11 @@
"DeregisterCriticalServiceAfter": 60,
"Tag": "13"
},
//阿里云短信配置
"SMS": {
"ID": "[xxxx]",
"Secret": "[xxxx]",
"Sign": "[xxxx]",
"Template": "[xxxx]"
},
"IPLibraryServiceUrl": "http://gRPCIPLibraryService"
"ID": "[]",
"Secret": "[]",
"Sign": "[]",
"Template": "[]"
}
}

View File

@@ -1,5 +1,8 @@
{
"StartUrl": "http://localohost:19001",
//程序启动地址,*代表全部网口
"StartUrl": "http://*:19001",
//默认日志打印过滤
"Logging": {
"LogLevel": {
"Default": "Information",
@@ -7,72 +10,117 @@
"Microsoft.Hosting.Lifetime": "Information"
}
},
//运行全部主机
"AllowedHosts": "*",
"Consul_Enabled": false,
"DbSeed_Enabled": false,
"Apollo_Enabled": false,
"HealthCheck_Enabled": false,
"RabbitMQ_Enabled": false,
"Redis_Enabled": false,
"RedisSeed_Enabled": false,
"Kafka_Enabled": false,
"ElasticSeach_Enabled": false,
//【全局配置开启】
//Sql语句日志是否打印
"SqlLog_Enable": false,
//登录二维码是否打印
"LoginCode_Enable": false,
//【数据库配置】
//多数据库主从复制是否开启
"MutiDB_Enabled": false,
"SMS_Enabled": false,
"CAP_Enabled": false,
"CAPDashboard_Enabled": false,
"Cors_Enabled": true,
//数据库CodeFirst是否开启
"DbCodeFirst_Enabled": true,
//数据库种子数据是否开启
"DbSeed_Enabled": true,
//数据库列表
"DbList": [ "Sqlite", "Mysql", "Sqlserver", "Oracle" ],
"DbSelect": "Mysql",
"Pan": {
"ZipPath": "D:/AppWeb/test/zip"
},
//数据库类型选择
"DbSelect": "Sqlite",
//数据库连接地址,支持读写分离
"DbConn": {
"WriteUrl": "server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]",
"WriteUrl": "DataSource=yi-sqlsugar-dev.db",
"ReadUrl": [
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]",
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]",
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]"
]
},
"JWTTokenOptions": {
"Audience": "http://localhost:7000",
"Issuer": "http://localhost:7000",
"SecurityKey": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDI2a2EJ7m872v0afyoSDJT2o1+SitIeJSWtLJU8/Wz2m7gStexajkeD+Lka6DSTy8gt9UwfgVQo6uKjVLG5Ex7PiGOODVqAEghBuS7JzIYU5RvI543nNDAPfnJsas96mSA7L/mD7RTE2drj6hf3oZjJpMPZUQI/B1Qjb5H3K3PNwIDAQAB"
//【缓存配置】
//缓存列表
"CacheList": [ "Redis", "MemoryCache" ],
//选择缓存
"CacheSelect": "MemoryCache",
//缓存种子数据是否开启
"CacheSeed_Enabled": false,
//【中间件开启】
//Consul是否开启
"Consul_Enabled": false,
//健康检查是否开启
"HealthCheck_Enabled": false,
//跨域开放是否开启
"Cors_Enabled": true,
//Apollo是否开启
"Apollo_Enabled": false,
//RabbitMQ是否开启
"RabbitMQ_Enabled": false,
//Kafka是否开启
"Kafka_Enabled": false,
//ElasticSeach是否开启
"ElasticSeach_Enabled": false,
//短信发送是否开启
"SMS_Enabled": false,
//分布式CAP是否开启
"CAP_Enabled": false,
//分布式CAP面板是否开启
"CAPDashboard_Enabled": false,
//【中间件配置】
//jwt授权内容公钥私钥转移到目录下的pem文件
"JwtAuthorize": {
"Issuer": "cc",
"Audience": "cc",
"PolicyName": "permission",
"DefaultScheme": "Bearer",
"IsHttps": false,
"Expiration": 300,
"ReExpiration": 3000
},
//Redis地址配置
"RedisConnOptions": {
"Host": "[xxxx]",
"Host": "[]",
"Prot": 6379,
"DB": 1,
"Password": "[xxxx]"
"Password": "[]"
},
//RabbitMq地址配置
"RabbitConn": {
"HostName": "[xxxx]",
"UserName": "[xxxx]",
"Password": "[xxxx]",
"HostName": "[]",
"UserName": "[]",
"Password": "[]",
"Port": 5672
},
//ElasticSeach地址配置
"ElasticSeachConn": {
"Url": "[xxxx]",
"IndexName": "[xxxx]",
"UserName": "[xxxx]",
"PassWord": "[xxxx]"
"Url": "[]",
"IndexName": "[]",
"UserName": "[]",
"PassWord": "[]."
},
//Kafka地址配置
"KafkaOptions": {
"BrokerList": "[xxxx]",
"TopicName": "[xxxx]"
"BrokerList": "[]:9092",
"TopicName": "kafkalog"
},
//Consul地址配置
"ConsulClientOption": {
"IP": "[xxxx]",
"Port": "[xxxx]",
"Datacenter": "[xxxx]"
"IP": "[]",
"Port": "8500",
"Datacenter": "dc1"
},
//Consul注册本机配置
"ConsulRegisterOption": {
"IP": "[xxxx]",
"Port": "19001",
"IP": "[]",
"Port": "[]",
"GroupName": "ApiMicroservice",
"HealthCheckUrl": "/Health",
"Interval": 10,
@@ -80,11 +128,11 @@
"DeregisterCriticalServiceAfter": 60,
"Tag": "13"
},
//阿里云短信配置
"SMS": {
"ID": "[xxxx]",
"Secret": "[xxxx]",
"Sign": "[xxxx]",
"Template": "[xxxx]"
},
"IPLibraryServiceUrl": "http://gRPCIPLibraryService"
"ID": "[]",
"Secret": "[]",
"Sign": "[]",
"Template": "[]"
}
}

View File

@@ -1,5 +1,8 @@
{
//程序启动地址,*代表全部网口
"StartUrl": "http://*:19001",
//默认日志打印过滤
"Logging": {
"LogLevel": {
"Default": "Information",
@@ -7,73 +10,122 @@
"Microsoft.Hosting.Lifetime": "Information"
}
},
//运行全部主机
"AllowedHosts": "*",
"Consul_Enabled": false,
"DbSeed_Enabled": false,
"Apollo_Enabled": false,
"HealthCheck_Enabled": false,
"RabbitMQ_Enabled": false,
"Redis_Enabled": false,
"RedisSeed_Enabled": false,
"Kafka_Enabled": false,
"ElasticSeach_Enabled": false,
"MutiDB_Enabled": false,
"SMS_Enabled": false,
"CAP_Enabled": false,
"CAPDashboard_Enabled": false,
//【全局配置开启】
//Sql语句日志是否打印
"SqlLog_Enable": false,
//登录二维码是否打印
"LoginCode_Enable": false,
"Cors_Enabled": true,
//【数据库配置】
//多数据库主从复制是否开启
"MutiDB_Enabled": false,
//数据库CodeFirst是否开启
"DbCodeFirst_Enabled": true,
//数据库种子数据是否开启
"DbSeed_Enabled": true,
//数据库列表
"DbList": [ "Sqlite", "Mysql", "Sqlserver", "Oracle" ],
//数据库类型选择
"DbSelect": "Sqlite",
//数据库连接地址,支持读写分离
"DbConn": {
"WriteUrl": "DataSource=yi-sqlsugar-dev.db",
//"WriteUrl": "[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]",
"ReadUrl": [
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]",
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]",
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]"
"DataSource=[xxxx]", //sqlite
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]", //mysql
"Data Source=[xxxx];Initial Catalog=[xxxx];User ID=[xxxx];password=[xxxx]" //sqlserver
]
},
//【缓存配置】
//缓存列表
"CacheList": [ "Redis", "MemoryCache" ],
//选择缓存
"CacheSelect": "MemoryCache",
//缓存Aop
"CacheAOP_Enabled": false,
//缓存种子数据是否开启
"CacheSeed_Enabled": false,
//【中间件开启】
//Consul是否开启
"Consul_Enabled": false,
//健康检查是否开启
"HealthCheck_Enabled": false,
//跨域开放是否开启
"Cors_Enabled": true,
//Apollo是否开启
"Apollo_Enabled": false,
//RabbitMQ是否开启
"RabbitMQ_Enabled": false,
//Kafka是否开启
"Kafka_Enabled": false,
//ElasticSeach是否开启
"ElasticSeach_Enabled": false,
//短信发送是否开启
"SMS_Enabled": false,
//分布式CAP是否开启
"CAP_Enabled": false,
//分布式CAP面板是否开启
"CAPDashboard_Enabled": false,
//【中间件配置】
//jwt授权内容公钥私钥转移到目录下的pem文件
"JwtAuthorize": {
"Issuer": "cc",
"Audience": "cc",
"PolicyName": "permission",
"DefaultScheme": "Bearer",
"IsHttps": false,
"Expiration": 30,
"Expiration": 300,
"ReExpiration": 3000
},
//Redis地址配置
"RedisConnOptions": {
"Host": "[xxxx]",
"Host": "[]",
"Prot": 6379,
"DB": 1,
"Password": "[xxxx]"
"Password": "[]"
},
//RabbitMq地址配置
"RabbitConn": {
"HostName": "[xxxx]",
"UserName": "[xxxx]",
"Password": "[xxxx]",
"HostName": "[]",
"UserName": "[]",
"Password": "[]",
"Port": 5672
},
//ElasticSeach地址配置
"ElasticSeachConn": {
"Url": "[xxxx]",
"IndexName": "[xxxx]",
"UserName": "[xxxx]",
"PassWord": "[xxxx]"
"Url": "[]",
"IndexName": "[]",
"UserName": "[]",
"PassWord": "[]."
},
//Kafka地址配置
"KafkaOptions": {
"BrokerList": "[xxxx]",
"TopicName": "[xxxx]"
"BrokerList": "[]:9092",
"TopicName": "kafkalog"
},
//Consul地址配置
"ConsulClientOption": {
"IP": "[xxxx]",
"Port": "[xxxx]",
"Datacenter": "[xxxx]"
"IP": "[]",
"Port": "8500",
"Datacenter": "dc1"
},
//Consul注册本机配置
"ConsulRegisterOption": {
"IP": "[xxxx]",
"Port": "19001",
"IP": "[]",
"Port": "[]",
"GroupName": "ApiMicroservice",
"HealthCheckUrl": "/Health",
"Interval": 10,
@@ -81,11 +133,11 @@
"DeregisterCriticalServiceAfter": 60,
"Tag": "13"
},
//阿里云短信配置
"SMS": {
"ID": "[xxxx]",
"Secret": "[xxxx]",
"Sign": "[xxxx]",
"Template": "[xxxx]"
},
"IPLibraryServiceUrl": "http://gRPCIPLibraryService"
"ID": "[]",
"Secret": "[]",
"Sign": "[]",
"Template": "[]"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Common.Abstract
{
public interface ICurrentUser
{
public bool IsAuthenticated { get; set; }
public long Id { get; set; }
public string UserName { get; set; }
public Guid? TenantId { get; set; }
public string Email { get; set; }
public bool EmailVerified { get; set; }
public string PhoneNumber { get; set; }
public bool PhoneNumberVerified { get; set; }
public string[]? Roles { get; set; }
public string[]? Permission { get; set; }
}
}

View File

@@ -0,0 +1,30 @@
using System;
namespace Yi.Framework.Common.Attribute
{
/// <summary>
/// 参考地址https://www.cnblogs.com/kelelipeng/p/10643556.html
/// 1、[AppService]:自动去找接口,如果存在就是接口,如果不存在就是本身
/// 2、[AppService(ServiceType = typeof(注册抽象或者接口或者本身))]手动去注册放type即可
/// </summary>
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
public class AppServiceAttribute : System.Attribute
{
/// <summary>
/// 服务声明周期
/// 不给默认值的话注册的是作用域
/// </summary>
public LifeTime ServiceLifetime { get; set; } = LifeTime.Scoped;
/// <summary>
/// 指定服务类型
/// </summary>
public Type? ServiceType { get; set; }
}
public enum LifeTime
{
Transient, Scoped, Singleton
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Common.Attribute
{
[AttributeUsage(AttributeTargets.Property)]
public class AutowiredAttribute : System.Attribute
{
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Common.Attribute
{
[AttributeUsage(AttributeTargets.Method, Inherited = true)]
public class CachingAttribute : System.Attribute
{
/// <summary>
/// 缓存绝对过期时间(分钟)
/// </summary>
public int AbsoluteExpiration { get; set; } = 30;
}
}

View File

@@ -0,0 +1,41 @@
using Microsoft.AspNetCore.Mvc.Filters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Yi.Framework.Common.Const;
using Yi.Framework.Common.Enum;
namespace Yi.Framework.Common.Attribute
{
[AttributeUsage(AttributeTargets.Method)]
public class LogAttribute : System.Attribute
{
/// <summary>
/// 操作类型
/// </summary>
public OperEnum OperType { get; set; }
/// <summary>
/// 日志标题(模块)
/// </summary>
public string Title { get; set; }
/// <summary>
/// 是否保存请求数据
/// </summary>
public bool IsSaveRequestData { get; set; } = true;
/// <summary>
/// 是否保存返回数据
/// </summary>
public bool IsSaveResponseData { get; set; } = true;
public LogAttribute(string title, OperEnum operationType)
{
this.Title = title;
this.OperType = operationType;
}
}
}

View File

@@ -0,0 +1,439 @@
using System;
namespace Yi.Framework.Common.Base
{
#region
/// <summary>
/// 无值定义
/// </summary>
public class NullValue
{
/// <summary>
/// 唯一识别型的默认无值
/// </summary>
public static readonly Guid Guid = Guid.Empty;
/// <summary>
/// 日期时间的默认无值
/// </summary>
/// <remarks>解决C#DateTime最小值是SQL 2005不允许的范围内</remarks>
public static readonly DateTime DateTime = DateTime.Parse("1753-1-1 12:00:01");
/// <summary>
/// JavaScript日期时间的默认无值
/// </summary>
/// <remarks></remarks>
public static readonly DateTime JavaScriptDateTime = DateTime.Parse("1970-1-1 00:00:00");
#region
/// <summary>
/// 短整数的默认无值
/// </summary>
public const short ShortInterger = -1;//short.MinValue;
/// <summary>
/// 整数的默认无值
/// </summary>
public const int Interger = -1;//int.MinValue;
/// <summary>
/// 长整数的默认无值
/// </summary>
public const long LongInterger = -1;//long.MinValue;
/// <summary>
/// Decimal数的默认无值
/// </summary>
public const decimal Decimal = -1;//decimal.MinValue;
/// <summary>
/// Float数的默认无值
/// </summary>
public const float Float = -1;//float.MinValue;
/// <summary>
/// Double数的默认无值
/// </summary>
public const double Double = -1;//double.MinValue;
/// <summary>
/// Byte数的默认无值
/// </summary>
public const byte Byte = byte.MinValue;
/// <summary>
/// SByte数的默认无值
/// </summary>
public const sbyte SByte = sbyte.MinValue;
#endregion
/// <summary>
/// 字串的默认无值
/// </summary>
public static readonly string String = string.Empty;
/// <summary>
/// 一般对象的判断
/// </summary>
public const object Object = null;
}
#endregion
#region
/// <summary>
/// 无值的扩展方法
/// </summary>
public static class NullValueExtensions
{
#region
public static Guid TryToGuid(this string guid)
{
if (Guid.TryParse(guid, out var guid1))
{
return guid1;
}
return Guid.Empty;
}
public static string TryStringNull(this string value)
{
return value == null ? "" : value;
}
public static string TryStringNull(this object value)
{
return value == null ? "" : value.ToString()!.Trim();
}
/// <summary>
/// Object类型无值判断
/// </summary>
/// <param name="value">待判断对象</param>
/// <returns>是否为空(true--真,false--假)</returns>
public static bool IsNull(this object value)
{
if (value == null || value == NullValue.Object)
{
return true;
}
return false;
}
/// <summary>
/// Object类型有值判断
/// </summary>
/// <param name="value">待判断对象</param>
/// <returns>是否不为空(true--真,false--假)</returns>
public static bool IsNotNull(this object value)
{
return !value.IsNull();
}
public static bool IsGuidNotNull(this Guid? value)
{
return !value.IsGuidNull();
}
public static bool IsGuidNull(this Guid? value)
{
if (value == null || value == Guid.Empty)
{
return true;
}
return false;
}
/// <summary>
/// String类型无值判断
/// </summary>
/// <param name="value">待判断对象</param>
/// <returns>是否为空(true--真,false--假)</returns>
public static bool IsNull(this string value)
{
if (string.IsNullOrEmpty(value) || string.IsNullOrWhiteSpace(value))
{
return true;
}
return false;
}
/// <summary>
/// String类型有值判断
/// </summary>
/// <param name="value">待判断对象</param>
/// <returns>是否不为空(true--真,false--假)</returns>
public static bool IsNotNull(this string value)
{
return !value.IsNull();
}
/// <summary>
/// Guid类型无值判断
/// </summary>
/// <param name="value">待判断对象</param>
/// <returns>是否为空(true--真,false--假)</returns>
public static bool IsNull(this Guid value)
{
if (value == NullValue.Guid)
{
return true;
}
return false;
}
/// <summary>
/// Guid类型有值判断
/// </summary>
/// <param name="value">待判断对象</param>
/// <returns>是否不为空(true--真,false--假)</returns>
public static bool IsNotNull(this Guid value)
{
return !value.IsNull();
}
#region
/// <summary>
/// ShortInterger类型无值判断
/// </summary>
/// <param name="value">待判断对象</param>
/// <returns>是否为空(true--真,false--假)</returns>
public static bool IsNull(this short value)
{
if (value == NullValue.ShortInterger)
{
return true;
}
return false;
}
/// <summary>
/// ShortInterger类型有值判断
/// </summary>
/// <param name="value">待判断对象</param>
/// <returns>是否不为空(true--真,false--假)</returns>
public static bool IsNotNull(this short value)
{
return !value.IsNull();
}
/// <summary>
/// Interger类型无值判断
/// </summary>
/// <param name="value">待判断对象</param>
/// <returns>是否为空(true--真,false--假)</returns>
public static bool IsNull(this int value)
{
if (value == NullValue.Interger)
{
return true;
}
return false;
}
/// <summary>
/// Interger类型有值判断
/// </summary>
/// <param name="value">待判断对象</param>
/// <returns>是否不为空(true--真,false--假)</returns>
public static bool IsNotNull(this int value)
{
return !value.IsNull();
}
/// <summary>
/// LongInterger类型无值判断
/// </summary>
/// <param name="value">待判断对象</param>
/// <returns>是否为空(true--真,false--假)</returns>
public static bool IsNull(this long value)
{
if (value == NullValue.LongInterger)
{
return true;
}
return false;
}
/// <summary>
/// LongInterger类型有值判断
/// </summary>
/// <param name="value">待判断对象</param>
/// <returns>是否不为空(true--真,false--假)</returns>
public static bool IsNotNull(this long value)
{
return !value.IsNull();
}
/// <summary>
/// Decimal类型无值判断
/// </summary>
/// <param name="value">待判断对象</param>
/// <returns>是否为空(true--真,false--假)</returns>
public static bool IsNull(this decimal value)
{
if (value == NullValue.Decimal)
{
return true;
}
return false;
}
/// <summary>
/// Decimal类型有值判断
/// </summary>
/// <param name="value">待判断对象</param>
/// <returns>是否不为空(true--真,false--假)</returns>
public static bool IsNotNull(this decimal value)
{
return !value.IsNull();
}
/// <summary>
/// Float类型无值判断
/// </summary>
/// <param name="value">待判断对象</param>
/// <returns>是否为空(true--真,false--假)</returns>
public static bool IsNull(this float value)
{
if (value == NullValue.Float)
{
return true;
}
return false;
}
/// <summary>
/// Float类型有值判断
/// </summary>
/// <param name="value">待判断对象</param>
/// <returns>是否不为空(true--真,false--假)</returns>
public static bool IsNotNull(this float value)
{
return !value.IsNull();
}
/// <summary>
/// Double类型无值判断
/// </summary>
/// <param name="value">待判断对象</param>
/// <returns>是否为空(true--真,false--假)</returns>
public static bool IsNull(this double value)
{
if (value == NullValue.Double)
{
return true;
}
return false;
}
/// <summary>
/// Double类型有值判断
/// </summary>
/// <param name="value">待判断对象</param>
/// <returns>是否不为空(true--真,false--假)</returns>
public static bool IsNotNull(this double value)
{
return !value.IsNull();
}
/// <summary>
/// Byte类型无值判断
/// </summary>
/// <param name="value">待判断对象</param>
/// <returns>是否为空(true--真,false--假)</returns>
public static bool IsNull(this byte value)
{
if (value == NullValue.Byte)
{
return true;
}
return false;
}
/// <summary>
/// Byte类型有值判断
/// </summary>
/// <param name="value">待判断对象</param>
/// <returns>是否不为空(true--真,false--假)</returns>
public static bool IsNotNull(this byte value)
{
return !value.IsNull();
}
/// <summary>
/// SByte类型无值判断
/// </summary>
/// <param name="value">待判断对象</param>
/// <returns>是否为空(true--真,false--假)</returns>
public static bool IsNull(this sbyte value)
{
if (value == NullValue.SByte)
{
return true;
}
return false;
}
/// <summary>
/// SByte类型有值判断
/// </summary>
/// <param name="value">待判断对象</param>
/// <returns>是否不为空(true--真,false--假)</returns>
public static bool IsNotNull(this sbyte value)
{
return !value.IsNull();
}
#endregion
/// <summary>
/// DateTime类型无值判断
/// </summary>
/// <param name="value">待判断对象</param>
/// <returns>是否为空(true--真,false--假)</returns>
public static bool IsNull(this DateTime value)
{
if (value == DateTime.MinValue || value <= NullValue.DateTime || value == NullValue.JavaScriptDateTime)
{
return true;
}
return false;
}
/// <summary>
/// DateTime类型有值判断
/// </summary>
/// <param name="value">待判断对象</param>
/// <returns>是否不为空(true--真,false--假)</returns>
public static bool IsNotNull(this DateTime value)
{
return !value.IsNull();
}
#endregion
}
#endregion
}

View File

@@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Common.Const
{
public class FileConst
{
public const string Image = "Image";
public const string File = "File";
}
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Common.Const
{
public class PathConst
{
public const string wwwroot = "wwwroot";
public const string DataTemplate = "_DataTemplate";
public const string DataExport = "_DataExport";
}
}

View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Common.Const
{
public class SystemConst
{
public const string Admin = "cc";
public const string AdminRolesCode = "admin";
public const string AdminPermissionCode = "*:*:*";
public const string PermissionClaim = "permission";
public const string UserName = "userName";
public const string DeptId = "deptId";
public const string TenantId = "tenantId";
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Common.Enum
{
public enum DataScopeEnum
{
ALL = 0,
CUSTOM = 1,
DEPT = 2,
DEPT_FOLLOW = 3,
USER = 4
}
}

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Common.Enum
{
public enum HubTypeEnum
{
/// <summary>
/// 在线总数
/// </summary>
onlineNum,
/// <summary>
/// 强制退出
/// </summary>
forceOut
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Yi.Framework.Common.Enum
{
public enum MenuTypeEnum
{
Catalogue=0, //目录
Menu=1, //菜单
Component = 2//组件
}
}

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Common.Enum
{
public enum OperEnum
{
Insert=1,
Update=2,
Delete=3,
Auth=4,
Export=5,
Import=6,
ForcedOut = 7,
GenerateCode=8,
ClearData=9
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Common.Enum
{
public enum PathEnum
{
Excel,
File,
Image,
Thumbnail,
Temp
}
}

View File

@@ -4,9 +4,9 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Common.Models.Enum
namespace Yi.Framework.Common.Enum
{
public enum ResultCode
public enum ResultCodeEnum
{
/// <summary>
/// 操作成功。

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Common.Enum
{
public enum StateEnum
{
Normal=0,
Disable=1
}
}

View File

@@ -0,0 +1,47 @@
using System;
using System.Runtime.Serialization;
using Microsoft.Extensions.Logging;
using Yi.Framework.Common.Enum;
namespace Yi.Framework.Common.Exceptions;
[Serializable]
public class BusinessException : Exception,
IHasErrorCode,
IHasErrorDetails,
IHasLogLevel
{
public ResultCodeEnum Code { get; set; }
public string? Details { get; set; }
public LogLevel LogLevel { get; set; }
public BusinessException(
ResultCodeEnum code = ResultCodeEnum.NotSuccess,
string? message = null,
string? details = null,
Exception? innerException = null,
LogLevel logLevel = LogLevel.Warning)
: base(message, innerException)
{
Code = code;
Details = details;
LogLevel = logLevel;
}
/// <summary>
/// 序列化参数的构造函数
/// </summary>
public BusinessException(SerializationInfo serializationInfo, StreamingContext context)
: base(serializationInfo, context)
{
}
public BusinessException WithData(string name, object value)
{
Data[name] = value;
return this;
}
}

View File

@@ -0,0 +1,42 @@
using System;
using System.Runtime.ExceptionServices;
using Microsoft.Extensions.Logging;
using Yi.Framework.Common.Enum;
namespace Yi.Framework.Common.Exceptions;
/// <summary>
/// <see cref="Exception"/>类的扩展方法
/// </summary>
public static class ExceptionExtensions
{
/// <summary>
/// 使用 <see cref="ExceptionDispatchInfo.Capture"/> 再次抛出异常
/// </summary>
/// <param name="exception">Exception to be re-thrown</param>
public static void ReThrow(this Exception exception)
{
ExceptionDispatchInfo.Capture(exception).Throw();
}
/// <summary>
/// 获取异常中的日志等级
/// </summary>
/// <param name="exception"></param>
/// <param name="defaultLevel"></param>
/// <returns></returns>
public static LogLevel GetLogLevel(this Exception exception, LogLevel defaultLevel = LogLevel.Error)
{
return (exception as IHasLogLevel)?.LogLevel ?? defaultLevel;
}
/// <summary>
/// 获取异常中的日志错误码
/// </summary>
/// <param name="exception"></param>
/// <param name="defaultLevel"></param>
/// <returns></returns>
public static ResultCodeEnum GetLogErrorCode(this Exception exception, ResultCodeEnum defaultCode = ResultCodeEnum.NotSuccess)
{
return (exception as IHasErrorCode)?.Code ?? defaultCode;
}
}

View File

@@ -0,0 +1,8 @@
using Yi.Framework.Common.Enum;
namespace Yi.Framework.Common.Exceptions;
public interface IHasErrorCode
{
ResultCodeEnum Code { get; }
}

View File

@@ -0,0 +1,6 @@
namespace Yi.Framework.Common.Exceptions;
public interface IHasErrorDetails
{
string? Details { get; }
}

View File

@@ -0,0 +1,14 @@
using Microsoft.Extensions.Logging;
namespace Yi.Framework.Common.Exceptions;
/// <summary>
/// 定义<see cref="LogLevel"/> 属性的接口
/// </summary>
public interface IHasLogLevel
{
/// <summary>
/// Log severity.
/// </summary>
LogLevel LogLevel { get; set; }
}

View File

@@ -0,0 +1,38 @@
using System;
using System.Runtime.Serialization;
using Microsoft.Extensions.Logging;
using Yi.Framework.Common.Enum;
namespace Yi.Framework.Common.Exceptions;
/// <summary>
/// 用户友好异常
/// </summary>
[Serializable]
public class UserFriendlyException : BusinessException
{
public UserFriendlyException(
string message,
ResultCodeEnum code = ResultCodeEnum.NotSuccess,
string? details = null,
Exception? innerException = null,
LogLevel logLevel = LogLevel.Warning)
: base(
code,
message,
details,
innerException,
logLevel)
{
Details = details;
}
/// <summary>
/// 序列化参数的构造函数
/// </summary>
public UserFriendlyException(SerializationInfo serializationInfo, StreamingContext context)
: base(serializationInfo, context)
{
}
}

View File

@@ -1,4 +1,6 @@
using System;
using AutoMapper;
using AutoMapper.Internal;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
@@ -9,14 +11,32 @@ namespace Yi.Framework.Common.Helper
{
public class AssemblyHelper
{
public static List<Type> GetClass(string assemblyFile, string className = null, string spaceName=null)
public static List<Type> GetClass(string assemblyFile, string? className = null, string? spaceName = null)
{
Assembly assembly = Assembly.Load(assemblyFile);
return assembly.GetTypes().Where(m => m.IsClass
&& className == null?true:m.Name==className
&& spaceName == null ? true :m.Namespace == spaceName
&& className == null ? true : m.Name == className
&& spaceName == null ? true : m.Namespace == spaceName
).ToList();
}
public static List<Type> GetClassByBaseClassesAndInterfaces(string assemblyFile, Type type)
{
Assembly assembly = Assembly.Load(assemblyFile);
List<Type> resList = new List<Type>();
List<Type> typeList = assembly.GetTypes().Where(m => m.IsClass).ToList();
foreach (var t in typeList)
{
var data = t.BaseClassesAndInterfaces();
if (data.Contains(type))
{
resList.Add(t);
}
}
return resList;
}
}
}

View File

@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Common.Helper
{
public class Compare<T, C> : IEqualityComparer<T>
{
private Func<T, C> _getField;
public Compare(Func<T, C> getfield)
{
this._getField = getfield;
}
public bool Equals(T? x, T? y)
{
return EqualityComparer<C>.Default.Equals(_getField(x!), _getField(y!));
}
public int GetHashCode(T obj)
{
return EqualityComparer<C>.Default.GetHashCode(this._getField(obj)!);
}
}
public static class DistinctHelper
{
/// <summary>
/// 自定义Distinct扩展方法
/// </summary>
/// <typeparam name="T">要去重的对象类</typeparam>
/// <typeparam name="C">自定义去重的字段类型</typeparam>
/// <param name="source">要去重的对象</param>
/// <param name="getfield">获取自定义去重字段的委托</param>
/// <returns></returns>
public static IEnumerable<T> DistinctNew<T, C>(this IEnumerable<T> source, Func<T, C> getfield)
{
return source.Distinct(new Compare<T, C>(getfield));
}
}
}

View File

@@ -9,10 +9,10 @@ namespace Yi.Framework.Common.Helper
{
public class EmailHelper
{
public static string fromMail { get; set; }
public static string pwdMail { get; set; }
public static string senderMail { get; set; }
public static string subjectMail { get; set; }
public static string fromMail { get; set; } = string.Empty;
public static string pwdMail { get; set; } = string.Empty;
public static string senderMail { get; set; } = string.Empty;
public static string subjectMail { get; set; } = string.Empty;
public static void Init(string fromMail,string pwdMail,string senderMail, string subjectMail)
{
EmailHelper.fromMail = fromMail;

View File

@@ -1,60 +1,237 @@
using System;
using OfficeOpenXml;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using OfficeOpenXml;
/// <summary>
/// 此处来源于ZrAdmin
/// </summary>
namespace Yi.Framework.Common.Helper
{
public class ExcelHelper
{
/// <summary>
///
/// 导出Excel
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="dataList">数据</param>
/// <param name="headers">表头</param>
/// <returns></returns>
public static string CreateExcelFromList<T>(List<T> dataList, List<string> headers,string evn)
/// <param name="list"></param>
/// <param name="sheetName"></param>
/// <param name="fileName"></param>
public static string ExportExcel<T>(List<T> list, string fileName,string path,string sheetName= "default")
{
string sFileName = $"{fileName}.xlsx";
string newFileName = Path.Combine(path, sFileName);
//调试模式需要加上
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
string sWebRootFolder = Path.Combine($"{evn}", "wwwroot/Excel");//如果用浏览器url下载的方式 存放excel的文件夹一定要建在网站首页的同级目录下
if (!Directory.Exists(sWebRootFolder))
Directory.CreateDirectory(Path.GetDirectoryName(newFileName)!);
using (ExcelPackage package = new(new FileInfo(newFileName)))
{
Directory.CreateDirectory(sWebRootFolder);
}
string sFileName = $@"Excel_{DateTime.Now.ToString("yyyyMMddHHmmss")}.xlsx";
var path = Path.Combine(sWebRootFolder, sFileName);
FileInfo file = new FileInfo(path);
if (file.Exists)
{
file.Delete();
file = new FileInfo(path);
}
using (ExcelPackage package = new(file))
{
//创建sheet
ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("sheet1");
worksheet.Cells.LoadFromCollection(dataList, true);
//表头字段
for (int i = 0; i < headers.Count; i++)
{
worksheet.Cells[1, i + 1].Value = headers[i];
}
for (int i = 0; i < headers.Count + 1; i++)
{//删除不需要的列
string aa = worksheet.Cells[1, i + 1].Value.ToString();
if (aa == "总行数")
{
worksheet.DeleteColumn(i + 1);
}
}
// 添加worksheet
ExcelWorksheet worksheet = package.Workbook.Worksheets.Add(sheetName);
//单元格自动适应大小
worksheet.Cells.Style.ShrinkToFit = true;
//全部字段导出
worksheet.Cells.LoadFromCollection(list, true, OfficeOpenXml.Table.TableStyles.Light13);
package.Save();
}
//return path;//这是返回文件的方式
return sFileName; //如果用浏览器url下载的方式 这里直接返回生成的文件名就可以了
return newFileName;
}
/// <summary>
/// 下载导入模板
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="list"></param>
/// <param name="stream"></param>
/// <param name="fileName">下载文件名</param>
/// <returns></returns>
public static string DownloadImportTemplate<T>(List<T> list, string fileName,string path)
{
string sFileName = $"{fileName}.xlsx";
string newFileName = Path.Combine(path, sFileName);
//如果文件存在,直接返回即可
if (File.Exists(newFileName))
{
return newFileName;
}
//调试模式需要加上
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
if (!Directory.Exists(newFileName))
{
Directory.CreateDirectory(Path.GetDirectoryName(newFileName)!);
}
Stream stream = new FileStream(newFileName, FileMode.OpenOrCreate);
using (ExcelPackage package = new(new FileInfo(newFileName)))
{
// 添加worksheet
ExcelWorksheet worksheet = package.Workbook.Worksheets.Add(fileName);
//单元格自动适应大小
worksheet.Cells.Style.ShrinkToFit = true;
//全部字段导出
worksheet.Cells.LoadFromCollection(list, true, OfficeOpenXml.Table.TableStyles.Light13);
package.SaveAs(stream);
}
stream.Dispose();
return newFileName;
}
/// <summary>
/// 导入数据
/// </summary>
/// <param name="stream"></param>
/// <returns></returns>
public static List<T> ImportData<T>(Stream stream) where T : new()
{
using ExcelPackage package = new(stream);
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
ExcelWorksheet worksheet = package.Workbook.Worksheets[0];//读取第1个sheet
//获取表格的列数和行数
int colStart = worksheet.Dimension.Start.Column;
int colEnd = worksheet.Dimension.End.Column;
int rowStart = worksheet.Dimension.Start.Row;
int rowEnd = worksheet.Dimension.End.Row;
//int rowCount = worksheet.Dimension.Rows;
//int ColCount = worksheet.Dimension.Columns;
List<T> resultList = new();
List<PropertyInfo> propertyInfos = new();// new(typeof(T).GetProperties());
Dictionary<string, int> dictHeader = new();
for (int i = colStart; i < colEnd; i++)
{
var name = worksheet.Cells[rowStart, i].Value.ToString();
dictHeader[name!] = i;
PropertyInfo propertyInfo = MapPropertyInfo<T>(name!);
if (propertyInfo != null)
{
propertyInfos.Add(propertyInfo);
}
}
for (int row = rowStart + 1; row <= rowEnd; row++)
{
T result = new();
foreach (PropertyInfo p in propertyInfos)
{
try
{
ExcelRange cell = worksheet.Cells[row, dictHeader[p.Name]];
if (cell.Value == null)
{
continue;
}
switch (p.PropertyType.Name.ToLower())
{
case "string":
p.SetValue(result, cell.GetValue<string>());
break;
case "int16":
p.SetValue(result, cell.GetValue<short>()); break;
case "int32":
p.SetValue(result, cell.GetValue<int>()); break;
case "int64":
p.SetValue(result, cell.GetValue<long>()); break;
case "decimal":
p.SetValue(result, cell.GetValue<decimal>());
break;
case "double":
p.SetValue(result, cell.GetValue<double>()); break;
case "datetime":
p.SetValue(result, cell.GetValue<DateTime>()); break;
case "boolean":
p.SetValue(result, cell.GetValue<bool>()); break;
case "char":
p.SetValue(result, cell.GetValue<string>()); break;
default:
break;
}
}
catch (KeyNotFoundException ex)
{
Console.WriteLine("未找到该列将继续循环," + ex.Message);
continue;
}
}
resultList.Add(result);
}
return resultList.ToList();
}
/// <summary>
/// 查找Excel列名对应的实体属性
/// </summary>
/// <param name="columnName"></param>
/// <returns></returns>
private static PropertyInfo MapPropertyInfo<T>(string columnName)
{
PropertyInfo[] propertyList = GetProperties(typeof(T));
PropertyInfo propertyInfo = propertyList.Where(p => p.Name == columnName).FirstOrDefault()!;
if (propertyInfo != null)
{
return propertyInfo;
}
else
{
foreach (PropertyInfo tempPropertyInfo in propertyList)
{
System.ComponentModel.DescriptionAttribute[] attributes = (System.ComponentModel.DescriptionAttribute[])tempPropertyInfo.GetCustomAttributes(typeof(System.ComponentModel.DescriptionAttribute), false);
if (attributes.Length > 0)
{
if (attributes[0].Description == columnName)
{
return tempPropertyInfo;
}
}
}
}
return null!;
}
/// <summary>
/// 得到类里面的属性集合
/// </summary>
/// <param name="type"></param>
/// <param name="columns"></param>
/// <returns></returns>
private static PropertyInfo[] GetProperties(Type type, string[] columns = null!)
{
PropertyInfo[] properties = null!;
properties = type.GetProperties();
if (columns != null && columns.Length > 0)
{
// 按columns顺序返回属性
var columnPropertyList = new List<PropertyInfo>();
foreach (var column in columns)
{
var columnProperty = properties.Where(p => p.Name == column).FirstOrDefault();
if (columnProperty != null)
{
columnPropertyList.Add(columnProperty);
}
}
return columnPropertyList.ToArray();
}
else
{
return properties;
}
}
}
}

View File

@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
@@ -10,6 +11,8 @@ namespace Yi.Framework.Common.Helper
private bool _alreadyDispose = false;
#region
public FileHelper()
{
@@ -391,5 +394,97 @@ namespace Yi.Framework.Common.Helper
}
}
#endregion
/// <summary>
/// 获取目录下全部文件名
/// </summary>
/// <param name="path"></param>
/// <param name="pattern"></param>
/// <returns></returns>
public static List<string> GetAllFileNames(string path, string pattern = "*")
{
List<FileInfo> folder = new DirectoryInfo(path).GetFiles(pattern).ToList();
return folder.Select(x => x.Name).ToList();
}
/// <summary>
/// 文件内容替换
/// </summary>
public static string FileContentReplace(string path, string oldStr, string newStr)
{
var content = File.ReadAllText(path);
if (content.Contains(oldStr))
{
File.Delete(path);
File.WriteAllText(path, content.Replace(oldStr, newStr));
}
return path;
}
/// <summary>
/// 文件名称
/// </summary>
public static string FileNameReplace(string path, string oldStr, string newStr)
{
string fileName = Path.GetFileName(path);
if (!fileName.Contains(oldStr))
{
return path;
}
string? directoryName = Path.GetDirectoryName(path);
string newFileName = fileName.Replace(oldStr, newStr);
string newPath = Path.Combine(directoryName ?? "", newFileName);
File.Move(path, newPath);
return newPath;
}
/// <summary>
/// 目录名替换
/// </summary>
public static string DirectoryNameReplace(string path, string oldStr, string newStr)
{
string fileName = Path.GetFileName(path);
if (!fileName.Contains(oldStr))
{
return path;
}
string? directoryName = Path.GetDirectoryName(path);
string newFileName = fileName.Replace(oldStr, newStr);
string newPath = Path.Combine(directoryName ?? "", newFileName);
Directory.Move(path, newPath);
return newPath;
}
/// <summary>
/// 全部信息递归替换
/// </summary>
/// <param name="dirPath"></param>
/// <param name="oldStr"></param>
/// <param name="newStr"></param>
public static void AllInfoReplace(string dirPath, string oldStr, string newStr)
{
var path = DirectoryNameReplace(dirPath, oldStr, newStr);
var dirInfo = new DirectoryInfo(path);
var files = dirInfo.GetFiles();
var dirs = dirInfo.GetDirectories();
if (files.Length > 0)
{
foreach (var f in files)
{
FileContentReplace(f.FullName, oldStr, newStr);
FileNameReplace(f.FullName, oldStr, newStr);
}
}
if (dirs.Length > 0)
{
foreach (var d in dirs)
{
AllInfoReplace(d.FullName, oldStr, newStr);
}
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More