diff --git a/README.md b/README.md
deleted file mode 100644
index 626ccef8..00000000
--- a/README.md
+++ /dev/null
@@ -1,281 +0,0 @@
-
-
-
Yi框架
-一套与SqlSugar一样爽的.Net6开源框架
-集大成者,终究轮子
-
-[English](README-en.md) | 简体中文
-
-
-
-****
-### 简介:
-**中文:意框架**(和他的名字一样“简易”,同时接入Java的Ruoyi Vue3.0前端)
-
-模块分化较多,可根据业务自行引用或抛弃,集大成者,大而全乎,也许你能从中学习到一些独特见解
-
-正在持续更进业务模块,已接入ruoyi
-
-**英文:YiFramework**
-
-Yi框架-一套与SqlSugar一样爽的.Net6低代码开源框架。
-与Sqlsugar理念一致,以用户体验出发。
-架构干净整洁、无业务代码、采用微软风格原生框架封装、CodeFrist+配套自研文件模板代码生成器 开发。
-适合.Net6学习、Sqlsugar学习 、项目二次开发。
-集大成者,终究轮子
-
-Yi框架最新版本标签:`v1.2.1`,具体版本可以查看标签迭代
-
-(项目与Sqlsugar同步更新,但这作者老杰哥代码天天爆肝到凌晨两点,我们也尽量会跟上他的脚步。更新频繁,所以可watching持续关注。)
-
-————这不仅仅是一个程序,更是一个艺术品,面向艺术的开发!
-
-**分支**:
-
-(本项目由EFCore版本历经3年不断迭代至Sqlsugar版本,现EFcore版本已弃用,目前sqlsugar已带业务功能)
-
-**SqlSugar**:.Net6 DDD领域驱动设计 简单分层微服务架构
-
-- Yi.Framework.Net6:.NetCore 6 意框架 (后端)
-
-- Yi.Vue3.X.RuoYi:Vue3 RuoYi前端框架 (前端后台)
-
- (你没有听错,已经接入java流行指数最高最火爆的框架之一,与其他框架不同,Yi框架后端为完全重制版,并非为ruoyi java模仿版)
-
-- Yi.Vue3.x.Vant:Vue3 移动端前端框架 (前端前台)持续迭代
-
-**SqlSugar-Dev**:为sqlsugar分支的实时开发版本
-
-~~**ec**: EFcore完整电商项目~~
-
-****
-
-### 演示地址:
-
-废话少说直接上地址,**请不要**更改里面的数据
-
-API服务:[yi.ccnetcore.com](http://yi.ccnetcore.com) 管理员账号:cc 、 123456
-
-网关地址:~~[gate.ccnetcore.com/swagger](http://gate.ccnetcore.com/swagger)~~
-
-~~WebFirst开发:所有代码生成器已经配置完成,无需任何操作数据库及任何代码,只需要网页表格上点点点即可~~
-
-代码自动生成:
-
-
-
-### 支持:
-
-- [x] 完全支持单体应用架构
-- [x] 完全支持分布式应用架构
-- [x] 完全支持微服务架构
-- [ ] 即将支持网格服务架构(我们将在后续版本加入dapr)
-
-****
-### 软件架构:
-
-**架构**:后端.NET6(Asp.NetCore 6)、WebFirst代码生成器~~与.NET5(Asp.NetCore 5)、前端Vue(2.0)~~
-
-**关系型数据库**:mysql、sql server、sqlite、oracle(正在兼容中)
-
-**操作系统**:Windows、Linux
-
-**身份验证**:JWT、IdentityServer4
-
-**组件**:SqlSugar、Autofac、Castle、Swagger、Log4Net、Redis、RabbitMq、ES、Quartz.net、~~T4~~
-
-**分布式**:CAP、Lock
-
-**微服务**:Consul、Ocelot、IdentityService、Apollo、Docker、Jenkins、Nginx、K8s、ELK、Polly
-
-**封装**:Json处理模块,滑动验证码模块,base64图片处理模块,异常捕捉模块、邮件处理模块、linq封装模块、随机数模块、统一接口模块、基于策略的jwt验证、过滤器、数据库连接、跨域、初始化种子数据、Base32、Console输出、日期处理、文件传输、html筛选、http请求、ip过滤、md5加密、Rsa加密、序列化、雪花算法、字符串处理、编码处理、地址处理、xml处理、心跳检查。。。
-
-****
-业务支持模块
-
-RABC权限管理系统(正在更新)
-(大部分ruoyi功能,采用ruoyi前端)
-- 用户管理
-- 角色管理
-- 菜单管理
-- 部门管理
-- 岗位管理
-- 字典管理
-- 参数管理
-- 用户在线
-- 操作日志
-- 登录日志
-- 等等
-
-ERP进销存系统(正在更新)
-- 供货商管理
-- 等等
-
-BBS论坛系统(持续迭代)
-- 文章管理
-- 评论管理
-- 等等
-
-SHOP电商系统(持续迭代)
-- SPU管理
-- SKU管理
-- 商品规格
-- 商品分类
-- 等等
-
-
-
-
-
-
-### 框架支持模块:
-
-大致如图:
-
-
-
-
-
-(删除线代表已实现功能还未迁移过来)
-- [x] 支持大致`DDD领域驱动设计`进行分层,支持微服务扩展
-- [x] 支持采用`异步`开发awit/async
-- [x] 支持数据库主从`读写分离`
-- [x] 支持功能替换,无需改动代码,只需配置`json文件`进行装配即可
-- [x] 支持`Aop封装`,FilterAop、IocAop、LogAop、SqlAop
-- [x] 支持`Log4Net日志`记录,自动生成至bin目录下的logs文件夹
-- [x] 支持`DbSeed数据库种子数据`接入
-- [x] 支持主流`数据库随意切换`,Mysql/Sqlite/Sqlserver/Oracle
-- [x] 支持上海杰哥官方`SqlSugar ORM`封装
-- [x] 支持新版`SwaggerWebAPI`,jwt身份认证接入
-- [x] 支持`Cors`跨域
-- [x] 支持`AutoFac`自动映射依赖注入
-- [x] 支持`consul`服务器注册与发现
-- [x] 支持`健康检查`
-- [x] 支持`RabbitMQ`消息队列
-- [x] 支持`Redis`多级缓存
-- [x] 支持`MemoryCache`多级缓存
-- [x] 支持`Ocelot`网关,路由、服务聚合、服务发现、认证、鉴权、限流、熔断、缓存、Header头传递
-- [x] 支持`Apollo`全局配置中心;
-- [x] 支持`docker`镜像制作
-- [x] 支持`Quartz.net`任务调度,实现任意接口被调度
-- [x] 支持`ThumbnailSharp`缩略图封装
-- [x] 支持`ELK`,log4net+kafka+es+logstach+kibana
-- [x] 支持`IdentityService4`授权中心
-- [x] 支持`Es`分词查询
-- [x] 支持多级`缓存`
-- [x] 支持`CAP`分布式事务,mysql+rabbitMq
-- [x] 支持`Docker+k8s`部署
-- [x] 支持`Jenkins+CI/CD`
-- [x] 支持`AutoMapper`模块映射
-- [x] 支持`微信支付`模块
-- [x] 支持`单表多租户`常用功能
-- [x] 支持`逻辑删除`常用功能
-- [x] 支持`操作日志`常用功能
-- [x] 支持`自动分表`
-- [x] 支持`数据权限`
-- [x] 支持`CodeFrist`快速构建数据库
-- [x] 支持自研文件版`代码生成器`快速构建通用代码
-- [x] 支持完整`Dto`模式
-- [x] 支持 太多了忘了
-
-
-****
-### 目录结构:
-
-
-
-
-
-我们大致依照DDD领域驱动设计分层
-
-分层如此清晰!什么?还感觉太复杂了?用户只需关注Api、Service其他都是轮子啊!
-
-- BackGround:后台进程(通常使用消息队列进行消费任务)
-- Test:测试(单元测试)
-- Domain:领域层(Dto、服务接口层、模型层、仓储层、服务层)
-- Infrastructure:基础实例层(通用工具层、核心层、定时任务Job、国际化、Web扩展层)
-- Module:模块层(其他模块,可按需进行引入,例如微信支付、代码生成)
-- MicroServiceInstance:服务层(微服务)
-
-****
-### 安装教程:
-
-我们将在之后更新教程手册!
-
-后端
-1. 下载全部源码,默认使用sqlite数据库,已经生成
-2. 直接点击sln文件运行即可,没有任何其他依赖
-
-前端
-1. 下载全部源码,npm i 安装依赖
-2. 使用npm run dev进行运行
-
-
-****
-### 使用说明:
-
-~~1. 导入使用仓库中的WebFirst数据库~~
-~~2. 使用WebFirst添加实体、同步实体、修改模板生成路径并生成方案~~
-
- 没了,恭喜你已经成功完成了项目,并且已经具备大部分通用场景业务
-是不是一个字?爽!
-到此为止,你无需写任何一个代码!
-
-**爽点**:
-
-新人,看这里,项目下载之后直接可以启动,无任何依赖,之后你可以查看`Test控制器`,迫不及待的快来爽一爽!
-
-我们将使用说明转移至我们的官方论坛中,正在制作中,尽情期待!
-
-****
-### 感谢:
-
-**大力支持**: Eleven神、Sqlsugar上海杰哥、Gerry、哲学的老张
-
-[橙子]https://ccnetcore.com
-
-[lzw]https://github.com/yeslode
-
-[朝夕教育]https://www.zhaoxiedu.net
-
-[Sqlsugar]https://www.donet5.com/Home/Doc
-
-[RuYiAdmin]https://gitee.com/pang-mingjun/RuYiAdmin
-
-[ZrAdminNetCore]https://gitee.com/izory/ZrAdminNetCore
-
-****
-### 联系我们:
-
-作者QQ:`454313500`,2029年之前作者24小时在线,时刻保持活跃更新。
-
-QQ交流群:官方一群(已满)、官方二群(已满)、官方三群:`786308927`(加作者QQ后同意)
-
-联系作者,这里人人都是顾问
-
-官方网址:正在建设
-
-****
-### FQA:
-
-问1:为什么不采用EFcore?
-
-答1:别问,问就是Sqlsugar,和本框架一样爽!
-
-问2:以后会持续更新下去吗?
-
-答2:一定会的,我们的标题是 一个和Sqlsugar一样爽的.Net6开源框架 ,只要Sqlsugar在,我们将一直更新下去。
-
-问3:这个框架的针对人群是哪些人?适合所有人吗?
-
-答3:并不是适合所有人,应该算适合需要有一定基础的开发人员,当然,如果你是大神,你完全可以将这个框架二次开发!
-
-问4:花如此多的精力制作这个框架,是为了什么?是为了赚钱吗?和目前主流的abp等框架比,又有什么意义呢?
-
-答4:我们与Sqlsugar作者理念一致,我们是从用户角度出发,框架是为用户服务,与ABP复杂上手理念完全是相反的。
-
-问5:为何不出版一个详细的说明书呢?
-
-答5:暂时不会了,之后可能会,代码都是基于Asp.NetCore框架,适用于新手不用造轮子,整个框架较为简单,阅读源码后,基本能自定义改造使用了,过难也已经封装完毕,别忘了,其意义是为了开发更加简易!建议添加作者好友,这里人人都是顾问。
-
-我大抵要厌倦了负重前行。
diff --git a/Readme/代码生成.gif b/Readme/代码生成.gif
deleted file mode 100644
index 1a81643e..00000000
Binary files a/Readme/代码生成.gif and /dev/null differ
diff --git a/Readme/用户管理.png b/Readme/用户管理.png
deleted file mode 100644
index b870e6ed..00000000
Binary files a/Readme/用户管理.png and /dev/null differ
diff --git a/Readme/菜单管理.png b/Readme/菜单管理.png
deleted file mode 100644
index 55e0425c..00000000
Binary files a/Readme/菜单管理.png and /dev/null differ
diff --git a/Yi.Framework.Net6/.dockerignore b/Yi.Framework.Net6/.dockerignore
deleted file mode 100644
index 3729ff0c..00000000
--- a/Yi.Framework.Net6/.dockerignore
+++ /dev/null
@@ -1,25 +0,0 @@
-**/.classpath
-**/.dockerignore
-**/.env
-**/.git
-**/.gitignore
-**/.project
-**/.settings
-**/.toolstarget
-**/.vs
-**/.vscode
-**/*.*proj.user
-**/*.dbmdl
-**/*.jfm
-**/azds.yaml
-**/bin
-**/charts
-**/docker-compose*
-**/Dockerfile*
-**/node_modules
-**/npm-debug.log
-**/obj
-**/secrets.dev.yaml
-**/values.dev.yaml
-LICENSE
-README.md
\ No newline at end of file
diff --git a/Yi.Framework.Net6/.editorconfig b/Yi.Framework.Net6/.editorconfig
deleted file mode 100644
index 4de968e1..00000000
--- a/Yi.Framework.Net6/.editorconfig
+++ /dev/null
@@ -1,4 +0,0 @@
-[*.cs]
-
-# SYSLIB0014: 类型或成员已过时
-dotnet_diagnostic.SYSLIB0014.severity = none
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/Log4net.config b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/Log4net.config
deleted file mode 100644
index 958c7e78..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/Log4net.config
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml
deleted file mode 100644
index 7024d905..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml
+++ /dev/null
@@ -1,928 +0,0 @@
-
-
-
- Yi.Framework.ApiMicroservice
-
-
-
-
- Json To Sql 类比模式,通用模型
-
-
-
-
-
- 主键查询
-
-
-
-
-
-
- 列表查询
-
-
-
-
-
- 条件分页查询
-
-
-
-
-
-
- 添加
-
-
-
-
-
-
- 修改
-
-
-
-
-
-
- 列表删除
-
-
-
-
-
-
- 下载模板
-
-
-
-
-
- 导出数据
-
-
-
-
-
- 导入数据
-
-
-
-
-
- Json To Sql 类比模式,通用模型
-
-
-
-
-
- 主键查询
-
-
-
-
-
-
- 全部列表查询
-
-
-
-
-
- 添加
-
-
-
-
-
-
- 修改
-
-
-
-
-
-
- 列表删除
-
-
-
-
-
-
- Json To Sql 类比模式,通用模型
-
-
-
-
-
- 主键查询
-
-
-
-
-
-
- 全部列表查询
-
-
-
-
-
- 列表删除
-
-
-
-
-
-
- 点赞操作
-
-
-
-
-
-
- 文章控制器
-
-
-
-
- 动态条件分页查询
-
-
-
-
-
-
-
- 添加
-
-
-
-
-
-
- 获取文章的全部一级评论
-
-
-
-
-
- 获取一级评论详情
-
-
-
-
-
-
- 回复文章或回复评论
-
-
-
-
-
- 分页查
-
-
-
-
-
- 单查
-
-
-
-
-
- 增
-
-
-
-
-
-
- 更
-
-
-
-
-
-
-
- 删
-
-
-
-
-
-
- 分页查
-
-
-
-
-
- 单查
-
-
-
-
-
- 增
-
-
-
-
-
-
- 更
-
-
-
-
-
-
-
- 删
-
-
-
-
-
-
- 分页查
-
-
-
-
-
- 单查
-
-
-
-
-
- 增
-
-
-
-
-
-
- 更
-
-
-
-
-
-
-
- 删
-
-
-
-
-
-
- 分页查
-
-
-
-
-
- 单查
-
-
-
-
-
- 增
-
-
-
-
-
-
- 更
-
-
-
-
-
-
-
- 删
-
-
-
-
-
-
- 分页查
-
-
-
-
-
- 单查
-
-
-
-
-
- 全查
-
-
-
-
-
- 增
-
-
-
-
-
-
- 更
-
-
-
-
-
-
-
- 删
-
-
-
-
-
-
- 分页查
-
-
-
-
-
- 单查
-
-
-
-
-
- 增
-
-
-
-
-
-
- 更
-
-
-
-
-
-
-
- 删
-
-
-
-
-
-
- 账户管理
-
-
-
-
- 重置管理员CC的密码
-
-
-
-
-
- 没啥说,登录
-
-
-
-
-
-
- 没啥说,注册
-
-
-
-
-
-
- 没啥说,登出
-
-
-
-
-
- 通过已登录的用户获取用户信息
-
-
-
-
-
- 获取当前登录用户的前端路由
-
-
-
-
-
- 自己更新密码
-
-
-
-
-
-
- 验证码
-
-
-
-
-
- 动态条件分页查询
-
-
-
-
-
-
-
- 动态条件查询
-
-
-
-
-
-
- 添加
-
-
-
-
-
-
- 更新
-
-
-
-
-
-
- 根据角色id获取该角色下全部部门
-
-
-
-
-
-
- 动态条件分页查询
-
-
-
-
-
-
-
- 动态条件分页查询
-
-
-
-
-
-
-
- 根据字典类别获取字典信息
-
-
-
-
-
-
- 文件
-
-
-
-
- 文件上传下载
-
-
-
-
-
-
-
- 文件下载,只需用文件code即可,可选择是否为缩略图
-
-
-
-
-
-
-
- 多文件上传,type可空,默认上传至File文件夹下,swagger返回雪花id精度是有问题的,同时如果时图片类型,还需要进行缩略图制作
-
- 文件类型,可空
- 多文件表单
- 描述
-
-
-
-
- 一键同步图片到缩略图
-
-
-
-
-
- 自动分表,日志添加
-
-
-
-
-
- 查询近20年与21年的日志表
-
-
-
-
-
- 动态条件分页查询
-
-
-
-
-
-
-
- 菜单管理
-
-
-
-
- 动态条件查询全部
-
-
-
-
-
-
- 插入
-
-
-
-
-
-
- 更新
-
-
-
-
-
-
- 得到树形菜单
-
-
-
-
-
- 根据角色id获取该角色下全部菜单
-
-
-
-
-
-
- 在线管理
-
-
-
-
- 动态条件获取当前在线用户
-
-
-
-
-
-
-
- 强制退出用户
-
-
-
-
-
-
- 动态条件分页查询
-
-
-
-
-
-
-
- 动态条件分页查询
-
-
-
-
-
-
-
- 角色管理
-
-
-
-
- 动态条件分页查询
-
-
-
-
-
- 给多用户设置多角色
-
-
-
-
-
-
- 添加角色包含菜单
-
-
-
-
-
-
- 更新角色信息
-
-
-
-
-
- 更改角色状态
-
-
-
-
-
-
-
- 更改角色数据权限
-
-
-
-
-
- 删除
-
-
-
-
-
-
- 用户管理
-
-
-
-
- 动态条件分页查询
-
-
-
-
-
-
-
-
- 更改用户状态
-
-
-
-
-
-
-
- 给多用户设置多角色
-
-
-
-
-
-
- 通过用户id得到用户信息关联部门、岗位、角色
-
-
-
-
-
-
- 更新用户信息
-
-
-
-
-
-
- 更新个人中心信息
-
-
-
-
-
-
- 添加用户
-
-
-
-
-
-
- 重置密码
-
-
-
-
-
-
- 动态条件分页查询
-
-
-
-
-
- 动态条件分页查询
-
-
-
-
-
- 测试控制器
-
-
-
-
- 依赖注入,优雅写法
-
-
-
-
-
-
-
-
-
-
-
-
-
- swagger跳转
-
-
-
-
-
- 仓储上下文对象测试
-
-
-
-
-
- 工作单元测试,使用sqlsugar内置
-
-
-
-
-
- 执行Sql返回
-
-
-
-
-
- 国际化测试
-
-
-
-
-
- 权限测试
-
-
-
-
-
- 策略授权测试
-
-
-
-
-
- 异步事务测试
-
-
-
-
-
- 极爽导航属性
-
-
-
-
-
- 启动一个定时任务
-
-
-
-
-
- 停止任务
-
-
-
-
-
- job异常处理
-
-
-
-
-
- 树形结构构建测试
-
-
-
-
-
- 授权测试
-
-
-
-
-
- 清空数据库
-
-
-
-
-
- 种子数据
-
-
-
-
-
- 操作日志测试
-
-
-
-
-
-
- Signalr实时推送测试
-
-
-
-
-
-
- 缩略图测试,需要生成前及生成后的路径
-
-
-
-
-
- 缓存测试
-
-
-
-
-
- 自定义日志
-
-
-
-
-
- 属性注入测试
-
-
-
-
-
- 获取当前用户信息测试
-
-
-
-
-
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/configuration.json b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/configuration.json
deleted file mode 100644
index 4431edcd..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/configuration.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "apollo": {
- "AppId": "ApiMicroservice",
- "Env": "DEV",
- "MetaServer": "http://[xxxx]:18080",
- "ConfigServer": [ "http://[xxxx]:18080" ]
- }
-}
\ No newline at end of file
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/BBS/AgreeController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/BBS/AgreeController.cs
deleted file mode 100644
index e76c7a02..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/BBS/AgreeController.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Logging;
-using Org.BouncyCastle.Asn1.IsisMtt.X509;
-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? _logger { get; set; }
-
- ///
- /// 点赞操作
- ///
- ///
- ///
- [HttpGet]
- public async Task Operate(long articleId)
- {
- long userId = HttpContext.GetUserIdInfo();
- if (await _iAgreeService!.OperateAsync(articleId, userId))
- {
- return Result.Success("点赞成功");
-
- }
- else
- {
- return Result.Success("已点赞,取消点赞").StatusFalse();
- }
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/BBS/ArticleController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/BBS/ArticleController.cs
deleted file mode 100644
index 59194929..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/BBS/ArticleController.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-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
-{
- ///
- /// 文章控制器
- ///
- [ApiController]
- [Route("api/[controller]/[action]")]
- public class ArticleController : BaseSimpleCrudController
- {
- private IArticleService _iArticleService;
- private IMapper _mapper;
- public ArticleController(ILogger logger, IArticleService iArticleService, IMapper mapper) : base(logger, iArticleService)
- {
- _iArticleService = iArticleService;
- _mapper = mapper;
- }
-
- ///
- /// 动态条件分页查询
- ///
- ///
- ///
- ///
- [HttpGet]
- public async Task PageList([FromQuery] ArticleEntity entity, [FromQuery] PageParModel page)
- {
- var pageData = await _iArticleService.SelctPageList(entity, page);
- return Result.Success().SetData(new PageModel() { Data = _mapper.Map>(pageData.Data), Total = pageData.Total });
- }
-
- ///
- /// 添加
- ///
- ///
- ///
- public override Task 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);
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/BBS/CommentController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/BBS/CommentController.cs
deleted file mode 100644
index 523b6748..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/BBS/CommentController.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-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
- {
- private ICommentService _iCommentService;
- private IMapper _mapper;
- public CommentController(ILogger logger, ICommentService iCommentService, IMapper mapper) : base(logger, iCommentService)
- {
- _iCommentService = iCommentService;
- _mapper = mapper;
- }
-
- ///
- /// 获取文章的全部一级评论
- ///
- ///
- [HttpGet]
- [Route("{articleId}")]
- public async Task 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>(data));
- }
-
- ///
- /// 获取一级评论详情
- ///
- ///
- ///
- public override async Task 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(data));
- }
-
- ///
- /// 回复文章或回复评论
- ///
- ///
- [HttpPost]
- public override async Task Add(CommentEntity comment)
- {
- return Result.Success().SetStatus(await _iCommentService.AddAsync(comment));
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Base/BaseCrudController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Base/BaseCrudController.cs
deleted file mode 100644
index 5d196a9d..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Base/BaseCrudController.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-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.Model.Base.Query;
-using Yi.Framework.Repository;
-using Yi.Framework.WebCore.AttributeExtend;
-
-namespace Yi.Framework.ApiMicroservice.Controllers
-{
- ///
- /// Json To Sql 类比模式,通用模型
- ///
- ///
- [ApiController]
- public class BaseCrudController : BaseExcelController where T : class,new()
- {
- protected readonly ILogger _logger;
- protected IBaseService _baseService;
- public BaseCrudController(ILogger logger, IBaseService iBaseService):base(iBaseService._repository)
- {
- _logger = logger;
- _baseService = iBaseService;
- }
-
- ///
- /// 主键查询
- ///
- ///
- ///
- [HttpGet]
- public virtual async Task GetById(long id)
- {
- return Result.Success().SetData(await _repository.GetByIdAsync(id));
- }
-
- ///
- /// 列表查询
- ///
- ///
- [HttpPost]
- public virtual async Task GetList(QueryCondition queryCondition)
- {
- return Result.Success().SetData(await _repository.GetListAsync(queryCondition));
- }
-
- ///
- /// 条件分页查询
- ///
- ///
- ///
- [HttpPost]
- public virtual async Task PageList(QueryPageCondition queryCondition)
- {
- return Result.Success().SetData(await _repository.CommonPageAsync(queryCondition));
- }
-
- ///
- /// 添加
- ///
- ///
- ///
- [HttpPost]
- public virtual async Task Add(T entity)
- {
- return Result.Success().SetData(await _repository.InsertReturnSnowflakeIdAsync(entity));
- }
-
- ///
- /// 修改
- ///
- ///
- ///
- [HttpPut]
- public virtual async Task Update(T entity)
- {
- return Result.Success().SetStatus(await _repository.UpdateIgnoreNullAsync(entity));
- }
-
- ///
- /// 列表删除
- ///
- ///
- ///
- [HttpDelete]
- public virtual async Task DeleteList(List ids)
- {
- return Result.Success().SetStatus(await _repository.DeleteByIdAsync(ids.ToDynamicArray()));
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Base/BaseExcelController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Base/BaseExcelController.cs
deleted file mode 100644
index 1d246613..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Base/BaseExcelController.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-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 : ControllerBase where T : class, new()
- {
- protected IRepository _repository;
- public BaseExcelController(IRepository repository)
- {
- _repository = repository;
- }
- ///
- /// 下载模板
- ///
- ///
- [HttpGet]
- [AllowAnonymous]
- public IActionResult Template()
- {
- List 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");
- }
-
-
- ///
- /// 导出数据
- ///
- ///
- [HttpGet]
- [AllowAnonymous]
- public async Task 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");
- }
-
-
- ///
- /// 导入数据
- ///
- ///
- [HttpPost]
- [AllowAnonymous]
- public async Task Import([FromForm(Name = "file")]IFormFile formFile)
- {
- List datas = ExcelHelper.ImportData(formFile.OpenReadStream());
-
- //全量删除在重新插入
- var res = await _repository.UseTranAsync(async () =>
- {
- await _repository.DeleteAsync(u => true);
- await _repository.InsertRangeAsync(datas);
- });
- return Result.Success().SetStatus(res);
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Base/BaseSimpleCrudController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Base/BaseSimpleCrudController.cs
deleted file mode 100644
index 7cdb6814..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Base/BaseSimpleCrudController.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-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
-{
- ///
- /// Json To Sql 类比模式,通用模型
- ///
- ///
- [ApiController]
- public class BaseSimpleCrudController : BaseExcelController where T : class, new()
- {
- protected readonly ILogger _logger;
- protected IBaseService _baseService;
- public BaseSimpleCrudController(ILogger logger, IBaseService iBaseService):base(iBaseService._repository)
- {
- _logger = logger;
- _baseService = iBaseService;
- }
-
- ///
- /// 主键查询
- ///
- ///
- ///
- [Route("{id}")]
- [HttpGet]
- public virtual async Task GetById([FromRoute]long id)
- {
- return Result.Success().SetData(await _repository.GetByIdAsync(id));
- }
-
- ///
- /// 全部列表查询
- ///
- ///
- [HttpGet]
- public virtual async Task GetList()
- {
- return Result.Success().SetData(await _repository.GetListAsync());
- }
-
- ///
- /// 添加
- ///
- ///
- ///
- [HttpPost]
- public virtual async Task Add(T entity)
- {
- return Result.Success().SetData(await _repository.InsertReturnSnowflakeIdAsync(entity));
- }
-
-
- ///
- /// 修改
- ///
- ///
- ///
- [HttpPut]
- public virtual async Task Update(T entity)
- {
- return Result.Success().SetStatus(await _repository.UpdateIgnoreNullAsync(entity));
- }
-
- ///
- /// 列表删除
- ///
- ///
- ///
- [HttpDelete]
- public virtual async Task DelList(List ids)
- {
- return Result.Success().SetStatus(await _repository.DeleteByIdsAsync(ids.ToDynamicArray()));
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Base/BaseSimpleRdController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Base/BaseSimpleRdController.cs
deleted file mode 100644
index 3f98aadf..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Base/BaseSimpleRdController.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-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
-{
- ///
- /// Json To Sql 类比模式,通用模型
- ///
- ///
- [ApiController]
- public class BaseSimpleRdController : BaseExcelController where T : class, new()
- {
- protected readonly ILogger _logger;
- protected IBaseService _baseService;
- public BaseSimpleRdController(ILogger logger, IBaseService iBaseService):base(iBaseService._repository)
- {
- _logger = logger;
- _baseService = iBaseService;
- }
-
- ///
- /// 主键查询
- ///
- ///
- ///
- [Route("{id}")]
- [HttpGet]
- public virtual async Task GetById([FromRoute]long id)
- {
- return Result.Success().SetData(await _repository.GetByIdAsync(id));
- }
-
- ///
- /// 全部列表查询
- ///
- ///
- [HttpGet]
- public virtual async Task GetList()
- {
- return Result.Success().SetData(await _repository.GetListAsync());
- }
-
- ///
- /// 列表删除
- ///
- ///
- ///
- [HttpDelete]
- public virtual async Task DelList(List ids)
- {
- return Result.Success().SetStatus(await _repository.DeleteByIdsAsync(ids.ToDynamicArray()));
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/MaterialController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/MaterialController.cs
deleted file mode 100644
index c1ca9d68..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/MaterialController.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-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 _logger;
- private readonly IMaterialService _materialService;
- public MaterialController(ILogger logger, IMaterialService materialService)
- {
- _logger = logger;
- _materialService = materialService;
- }
-
- ///
- /// 分页查
- ///
- ///
- [HttpGet]
- public async Task PageList([FromQuery] MaterialCreateUpdateInput input, [FromQuery] PageParModel page)
- {
- var result = await _materialService.PageListAsync(input, page);
- return Result.Success().SetData(result);
- }
-
- ///
- /// 单查
- ///
- ///
- [HttpGet]
- [Route("{id}")]
- public async Task GetById(long id)
- {
- var result = await _materialService.GetByIdAsync(id);
- return Result.Success().SetData(result);
- }
-
- ///
- /// 增
- ///
- ///
- ///
- [HttpPost]
- public async Task Create(MaterialCreateUpdateInput input)
- {
- var result = await _materialService.CreateAsync(input);
- return Result.Success().SetData(result);
- }
-
- ///
- /// 更
- ///
- ///
- ///
- ///
- [HttpPut]
- [Route("{id}")]
- public async Task Update(long id, MaterialCreateUpdateInput input)
- {
- var result = await _materialService.UpdateAsync(id, input);
- return Result.Success().SetData(result);
- }
-
- ///
- /// 删
- ///
- ///
- ///
- [HttpDelete]
- public async Task Del(List ids)
- {
- await _materialService.DeleteAsync(ids);
- return Result.Success();
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/PurchaseController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/PurchaseController.cs
deleted file mode 100644
index 985c356e..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/PurchaseController.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-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 _logger;
- private readonly IPurchaseService _purchaseService;
- public PurchaseController(ILogger logger, IPurchaseService purchaseService)
- {
- _logger = logger;
- _purchaseService = purchaseService;
- }
-
- ///
- /// 分页查
- ///
- ///
- [HttpGet]
- public async Task PageList([FromQuery] PurchaseGetListInput input, [FromQuery] PageParModel page)
- {
- var result = await _purchaseService.PageListAsync(input, page);
- return Result.Success().SetData(result);
- }
-
- ///
- /// 单查
- ///
- ///
- [HttpGet]
- [Route("{id}")]
- public async Task GetById(long id)
- {
- var result = await _purchaseService.GetByIdAsync(id);
- return Result.Success().SetData(result);
- }
-
- ///
- /// 增
- ///
- ///
- ///
- [HttpPost]
- public async Task Create(PurchaseCreateInput input)
- {
- var result = await _purchaseService.CreateAsync(input);
- return Result.Success().SetData(result);
- }
-
- ///
- /// 更
- ///
- ///
- ///
- ///
- [HttpPut]
- [Route("{id}")]
- public async Task Update(long id, PurchaseUpdateInput input)
- {
- var result = await _purchaseService.UpdateAsync(id, input);
- return Result.Success().SetData(result);
- }
-
- ///
- /// 删
- ///
- ///
- ///
- [HttpDelete]
- public async Task Del(List ids)
- {
- await _purchaseService.DeleteAsync(ids);
- return Result.Success();
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/PurchaseDetailsController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/PurchaseDetailsController.cs
deleted file mode 100644
index b1b5dd45..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/PurchaseDetailsController.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-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 _logger;
- private readonly IPurchaseDetailsService _purchaseDetailsService;
- public PurchaseDetailsController(ILogger logger, IPurchaseDetailsService purchaseDetailsService)
- {
- _logger = logger;
- _purchaseDetailsService = purchaseDetailsService;
- }
-
- ///
- /// 分页查
- ///
- ///
- [HttpGet]
- public async Task PageList([FromQuery] PurchaseDetailsCreateUpdateInput input, [FromQuery] PageParModel page)
- {
- var result = await _purchaseDetailsService.PageListAsync(input, page);
- return Result.Success().SetData(result);
- }
-
- ///
- /// 单查
- ///
- ///
- [HttpGet]
- [Route("{id}")]
- public async Task GetById(long id)
- {
- var result = await _purchaseDetailsService.GetByIdAsync(id);
- return Result.Success().SetData(result);
- }
-
- ///
- /// 增
- ///
- ///
- ///
- [HttpPost]
- public async Task Create(PurchaseDetailsCreateUpdateInput input)
- {
- var result = await _purchaseDetailsService.CreateAsync(input);
- return Result.Success().SetData(result);
- }
-
- ///
- /// 更
- ///
- ///
- ///
- ///
- [HttpPut]
- [Route("{id}")]
- public async Task Update(long id, PurchaseDetailsCreateUpdateInput input)
- {
- var result = await _purchaseDetailsService.UpdateAsync(id, input);
- return Result.Success().SetData(result);
- }
-
- ///
- /// 删
- ///
- ///
- ///
- [HttpDelete]
- public async Task Del(List ids)
- {
- await _purchaseDetailsService.DeleteAsync(ids);
- return Result.Success();
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/SupplierController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/SupplierController.cs
deleted file mode 100644
index 1a10baf5..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/SupplierController.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-using Yi.Framework.Common.Models;
-using Yi.Framework.DtoModel.ERP.Supplier;
-using Yi.Framework.Interface.ERP;
-
-namespace Yi.Framework.ApiMicroservice.Controllers.ERP
-{
- [ApiController]
- [Route("api/[controller]/[action]")]
- public class SupplierController : ControllerBase
- {
- private readonly ILogger _logger;
- private readonly ISupplierService _supplierService;
- public SupplierController(ILogger logger, ISupplierService supplierService)
- {
- _logger = logger;
- _supplierService = supplierService;
- }
-
- ///
- /// 分页查
- ///
- ///
- [HttpGet]
- public async Task PageList([FromQuery] SupplierCreateUpdateInput input, [FromQuery] PageParModel page)
- {
- var result = await _supplierService.PageListAsync(input, page);
- return Result.Success().SetData(result);
- }
-
- ///
- /// 单查
- ///
- ///
- [HttpGet]
- [Route("{id}")]
- public async Task GetById(long id)
- {
- var result = await _supplierService.GetByIdAsync(id);
- return Result.Success().SetData(result);
- }
-
- ///
- /// 增
- ///
- ///
- ///
- [HttpPost]
- public async Task Create(SupplierCreateUpdateInput input)
- {
- var result = await _supplierService.CreateAsync(input);
- return Result.Success().SetData(result);
- }
-
- ///
- /// 更
- ///
- ///
- ///
- ///
- [HttpPut]
- [Route("{id}")]
- public async Task Update(long id, SupplierCreateUpdateInput input)
- {
- var result = await _supplierService.UpdateAsync(id, input);
- return Result.Success().SetData(result);
- }
-
- ///
- /// 删
- ///
- ///
- ///
- [HttpDelete]
- public async Task Del(List ids)
- {
- await _supplierService.DeleteAsync(ids);
- return Result.Success();
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/UnitController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/UnitController.cs
deleted file mode 100644
index c8180bab..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/UnitController.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-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 _logger;
- private readonly IUnitService _unitService;
- public UnitController(ILogger logger, IUnitService unitService)
- {
- _logger = logger;
- _unitService = unitService;
- }
-
- ///
- /// 分页查
- ///
- ///
- [HttpGet]
- public async Task PageList([FromQuery] UnitCreateUpdateInput input, [FromQuery] PageParModel page)
- {
- var result = await _unitService.PageListAsync(input, page);
- return Result.Success().SetData(result);
- }
-
- ///
- /// 单查
- ///
- ///
- [HttpGet]
- [Route("{id}")]
- public async Task GetById(long id)
- {
- var result = await _unitService.GetByIdAsync(id);
- return Result.Success().SetData(result);
- }
-
- ///
- /// 全查
- ///
- ///
- [HttpGet]
- public async Task GetList()
- {
- var result = await _unitService.GetListAsync();
- return Result.Success().SetData(result);
- }
-
- ///
- /// 增
- ///
- ///
- ///
- [HttpPost]
- public async Task Create(UnitCreateUpdateInput input)
- {
- var result = await _unitService.CreateAsync(input);
- return Result.Success().SetData(result);
- }
-
- ///
- /// 更
- ///
- ///
- ///
- ///
- [HttpPut]
- [Route("{id}")]
- public async Task Update(long id, UnitCreateUpdateInput input)
- {
- var result = await _unitService.UpdateAsync(id, input);
- return Result.Success().SetData(result);
- }
-
- ///
- /// 删
- ///
- ///
- ///
- [HttpDelete]
- public async Task Del(List ids)
- {
- await _unitService.DeleteAsync(ids);
- return Result.Success();
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/WarehouseController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/WarehouseController.cs
deleted file mode 100644
index 56cd4964..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/WarehouseController.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-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 _logger;
- private readonly IWarehouseService _warehouseService;
- public WarehouseController(ILogger logger, IWarehouseService warehouseService)
- {
- _logger = logger;
- _warehouseService = warehouseService;
- }
-
- ///
- /// 分页查
- ///
- ///
- [HttpGet]
- public async Task PageList([FromQuery] WarehouseCreateUpdateInput input, [FromQuery] PageParModel page)
- {
- var result = await _warehouseService.PageListAsync(input, page);
- return Result.Success().SetData(result);
- }
-
- ///
- /// 单查
- ///
- ///
- [HttpGet]
- [Route("{id}")]
- public async Task GetById(long id)
- {
- var result = await _warehouseService.GetByIdAsync(id);
- return Result.Success().SetData(result);
- }
-
- ///
- /// 增
- ///
- ///
- ///
- [HttpPost]
- public async Task Create(WarehouseCreateUpdateInput input)
- {
- var result = await _warehouseService.CreateAsync(input);
- return Result.Success().SetData(result);
- }
-
- ///
- /// 更
- ///
- ///
- ///
- ///
- [HttpPut]
- [Route("{id}")]
- public async Task Update(long id, WarehouseCreateUpdateInput input)
- {
- var result = await _warehouseService.UpdateAsync(id, input);
- return Result.Success().SetData(result);
- }
-
- ///
- /// 删
- ///
- ///
- ///
- [HttpDelete]
- public async Task Del(List ids)
- {
- await _warehouseService.DeleteAsync(ids);
- return Result.Success();
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/AccountController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/AccountController.cs
deleted file mode 100644
index c08f0a85..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/AccountController.cs
+++ /dev/null
@@ -1,242 +0,0 @@
-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
-{
- ///
- /// 账户管理
- ///
- [ApiController]
- [Authorize]
- [Route("api/[controller]/[action]")]
- public class AccountController : ControllerBase
- {
- private IUserService _iUserService;
- private JwtInvoker _jwtInvoker;
- private ILogger _logger;
- private SecurityCodeHelper _securityCode;
- private IRepository _repository;
- private CacheInvoker _cacheDb;
- public AccountController(ILogger logger,
- IUserService iUserService,
- JwtInvoker jwtInvoker,
- SecurityCodeHelper securityCode,
- CacheInvoker cacheInvoker)
- {
- _iUserService = iUserService;
- _jwtInvoker = jwtInvoker;
- _logger = logger;
- _securityCode = securityCode;
- _repository = iUserService._repository;
- _cacheDb = cacheInvoker;
- }
-
- ///
- /// 重置管理员CC的密码
- ///
- ///
- [HttpGet]
- [AllowAnonymous]
- public async Task RestCC()
- {
- var user = await _iUserService._repository.GetFirstAsync(u => u.UserName == "cc");
- user.Password = "123456";
- user.BuildPassword();
- await _iUserService._repository.UpdateIgnoreNullAsync(user);
- return Result.Success();
- }
-
- ///
- /// 没啥说,登录
- ///
- ///
- ///
- [AllowAnonymous]
- [HttpPost]
- public async Task Login(LoginDto loginDto)
- {
- //跳过,需要redis缓存获取uuid与code的关系,进行比较即可
- //先效验验证码和UUID
- //登录还需要进行登录日志的落库
-
- //先进行验证码的效验
-
- var code = _cacheDb.Get($"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>();
- 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);
- }
-
-
-
- ///
- /// 没啥说,注册
- ///
- ///
- ///
- [AllowAnonymous]
- [HttpPost]
- public async Task Register(RegisterDto registerDto)
- {
- UserEntity user = new();
- if (await _iUserService.Register(WebCore.Mapper.MapperHelper.Map(registerDto), o => user = o))
- {
- return Result.Success("注册成功!").SetData(user);
- }
- return Result.SuccessError("注册失败!用户名已存在!");
- }
-
- ///
- /// 没啥说,登出
- ///
- ///
- [HttpPost]
- [AllowAnonymous]
- public Result Logout()
- {
- return Result.Success("安全登出成功!");
- }
-
- ///
- /// 通过已登录的用户获取用户信息
- ///
- ///
- [HttpGet]
- public Result GetUserAllInfo()
- {
- //通过鉴权jwt获取到用户的id
- var userId = HttpContext.GetUserIdInfo();
- //此处从缓存中获取即可
- var data = _cacheDb.Get($"Yi:UserInfo:{userId}");
- //var data = await _iUserService.GetUserAllInfo(userId);
- //系统用户数据被重置,老前端访问重新授权
- if (data is null)
- {
- return Result.UnAuthorize();
- }
-
- data.Menus.Clear();
- return Result.Success().SetData(data);
- }
-
- ///
- /// 获取当前登录用户的前端路由
- ///
- ///
- [HttpGet]
- public async Task 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>().GetListAsync();
- }
- //将后端菜单转换成前端路由,组件级别需要过滤
- List routers = MenuEntity.RouterBuild(menus);
- return Result.Success().SetData(routers);
- }
-
-
- ///
- /// 自己更新密码
- ///
- ///
- ///
- [HttpPut]
- public async Task UpdatePassword(UpdatePasswordDto dto)
- {
- long userId = HttpContext.GetUserIdInfo();
-
- if (await _iUserService.UpdatePassword(dto, userId))
- {
- return Result.Success();
- }
- return Result.Error("更新失败!");
- }
-
- ///
- /// 验证码
- ///
- ///
- [AllowAnonymous]
- [HttpGet]
- public Result CaptchaImage()
- {
- var uuid = Guid.NewGuid();
- var code = _securityCode.GetRandomEnDigitalText(4);
- //将uuid与code,Redis缓存中心化保存起来,登录根据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 });
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/ConfigController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/ConfigController.cs
deleted file mode 100644
index 4242c75f..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/ConfigController.cs
+++ /dev/null
@@ -1,41 +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.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
- {
- private IConfigService _iConfigService;
- public ConfigController(ILogger logger, IConfigService iConfigService) : base(logger, iConfigService)
- {
- _iConfigService = iConfigService;
- }
-
- ///
- /// 动态条件分页查询
- ///
- ///
- ///
- ///
- [HttpGet]
- public async Task PageList([FromQuery] ConfigEntity dic, [FromQuery] PageParModel page)
- {
- return Result.Success().SetData(await _iConfigService.SelctPageList(dic, page));
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/DeptController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/DeptController.cs
deleted file mode 100644
index 99eebdfb..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/DeptController.cs
+++ /dev/null
@@ -1,73 +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.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
- {
- private IDeptService _iDeptService;
- public DeptController(ILogger logger, IDeptService iDeptService) : base(logger, iDeptService)
- {
- _iDeptService = iDeptService;
- }
-
- ///
- /// 动态条件查询
- ///
- ///
- ///
- [HttpGet]
- public async Task SelctGetList([FromQuery] DeptEntity dept)
- {
- return Result.Success().SetData(await _iDeptService.SelctGetList(dept));
- }
-
-
- ///
- /// 添加
- ///
- ///
- ///
- public override async Task Add(DeptEntity entity)
- {
- return await base.Add(entity);
- }
-
- ///
- /// 更新
- ///
- ///
- ///
- public override async Task Update(DeptEntity entity)
- {
- return await base.Update(entity);
- }
-
- ///
- /// 根据角色id获取该角色下全部部门
- ///
- ///
- ///
- [HttpGet]
- [Route("{id}")]
- public async Task GetListByRoleId(long id)
- {
- return Result.Success().SetData(await _iDeptService.GetListByRoleId(id));
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/DictionaryController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/DictionaryController.cs
deleted file mode 100644
index 4f915135..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/DictionaryController.cs
+++ /dev/null
@@ -1,43 +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.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
- {
- private IDictionaryService _iDictionaryService;
- public DictionaryController(ILogger logger, IDictionaryService iDictionaryService):base(logger, iDictionaryService)
- {
- _iDictionaryService = iDictionaryService;
- }
-
- ///
- /// 动态条件分页查询
- ///
- ///
- ///
- ///
- [HttpGet]
- public async Task PageList([FromQuery] DictionaryEntity dic, [FromQuery] PageParModel page)
- {
- return Result.Success().SetData(await _iDictionaryService.SelctPageList(dic, page));
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/DictionaryInfoController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/DictionaryInfoController.cs
deleted file mode 100644
index 34c429dc..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/DictionaryInfoController.cs
+++ /dev/null
@@ -1,55 +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.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
- {
- private IDictionaryInfoService _iDictionaryInfoService;
- public DictionaryInfoController(ILogger logger, IDictionaryInfoService iDictionaryInfoService):base(logger, iDictionaryInfoService)
- {
- _iDictionaryInfoService = iDictionaryInfoService;
- }
-
- ///
- /// 动态条件分页查询
- ///
- ///
- ///
- ///
- [HttpGet]
- public async Task PageList([FromQuery] DictionaryInfoEntity dicInfo, [FromQuery] PageParModel page)
- {
- return Result.Success().SetData(await _iDictionaryInfoService.SelctPageList(dicInfo, page));
- }
-
- ///
- /// 根据字典类别获取字典信息
- ///
- ///
- ///
- [HttpGet]
- [Route("{type}")]
- public async Task GetListByType([FromRoute] string type)
- {
- return Result.Success().SetData(await _iDictionaryInfoService._repository.GetListAsync(u=>u.DictType==type&&u.IsDeleted==false));
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/FileController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/FileController.cs
deleted file mode 100644
index 44cd33a4..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/FileController.cs
+++ /dev/null
@@ -1,242 +0,0 @@
-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
-{
- ///
- /// 文件
- ///
- [Route("api/[controller]/[action]")]
- [ApiController]
- public class FileController : ControllerBase
- {
- private IFileService _iFileService;
- private readonly IHostEnvironment _env;
- private ThumbnailSharpInvoer _thumbnailSharpInvoer;
-
- ///
- /// 文件上传下载
- ///
- ///
- ///
- ///
- public FileController(IFileService iFileService, IHostEnvironment env, ThumbnailSharpInvoer thumbnailSharpInvoer)
- {
- _iFileService = iFileService;
- _env = env;
- _thumbnailSharpInvoer = thumbnailSharpInvoer;
- }
-
- ///
- /// 文件下载,只需用文件code即可,可选择是否为缩略图
- ///
- ///
- ///
- ///
- [Route("/api/file/{code}/{isThumbnail?}")]
- [HttpGet]
- public async Task 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();
- }
- }
-
- ///
- /// 多文件上传,type可空,默认上传至File文件夹下,swagger返回雪花id精度是有问题的,同时如果时图片类型,还需要进行缩略图制作
- ///
- /// 文件类型,可空
- /// 多文件表单
- /// 描述
- ///
- [Route("/api/file/Upload/{type?}")]
- [HttpPost]
- public async Task 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 datas = new();
-
- //返回的codes
- List 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();
- }
- }
-
- ///
- /// 一键同步图片到缩略图
- ///
- ///
- [HttpGet]
- public async Task ThumbnailSync()
- {
- string typePath = $"{PathConst.wwwroot}/{PathEnum.Image}";
- string thumbnailPath = $"{PathConst.wwwroot}/{PathEnum.Thumbnail}";
- List 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();
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/LogController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/LogController.cs
deleted file mode 100644
index 92aff1ef..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/LogController.cs
+++ /dev/null
@@ -1,56 +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.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 LogController : ControllerBase
- {
- private ILogService _iLogService;
- //大量日志,将采用自动分表形式,默认1年分一次表
- public LogController(ILogger logger, ILogService iLogService)
- {
- _iLogService = iLogService;
- }
-
- ///
- /// 自动分表,日志添加
- ///
- ///
- [HttpPost]
- public async Task Add()
- {
- Random random = new Random();
- var logList = new List() {
- 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));
- }
-
- ///
- /// 查询近20年与21年的日志表
- ///
- ///
- [HttpGet]
- public async Task GetList()
- {
- return Result.Success().SetData(await _iLogService.GetListTest());
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/LoginLogController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/LoginLogController.cs
deleted file mode 100644
index 294559d4..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/LoginLogController.cs
+++ /dev/null
@@ -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.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
- {
- private ILoginLogService _iLoginLogService;
- public LoginLogController(ILogger logger, ILoginLogService iLoginLogService) : base(logger, iLoginLogService)
- {
- _iLoginLogService = iLoginLogService;
- }
-
- ///
- /// 动态条件分页查询
- ///
- ///
- ///
- ///
- [HttpGet]
- public async Task PageList([FromQuery] LoginLogEntity loginLog, [FromQuery] PageParModel page)
- {
- return Result.Success().SetData(await _iLoginLogService.SelctPageList(loginLog, page));
- }
-
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/MenuController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/MenuController.cs
deleted file mode 100644
index 148b24df..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/MenuController.cs
+++ /dev/null
@@ -1,95 +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.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 MenuController: BaseSimpleRdController
- {
- private IMenuService _iMenuService;
- public MenuController(ILogger logger, IMenuService iMenuService):base(logger,iMenuService)
- {
- _iMenuService = iMenuService;
- }
-
-
- ///
- /// 动态条件查询全部
- ///
- ///
- ///
- [HttpGet]
- [Permission("system:menu:query")]
- public async Task SelctGetList([FromQuery] MenuEntity menu)
- {
- return Result.Success().SetData(await _iMenuService.SelctGetList(menu));
- }
-
- ///
- /// 插入
- ///
- ///
- ///
- [HttpPost]
- [Permission("system:menu:add")]
- public async Task Add(MenuEntity menu)
- {
- return Result.Success().SetData(await _iMenuService._repository.InsertReturnSnowflakeIdAsync(menu));
- }
-
- ///
- /// 更新
- ///
- ///
- ///
- [HttpPut]
- [Permission("system:menu:edit")]
- public async Task Update(MenuEntity menu)
- {
- //注意,这里如果是主目录,还需要判断/,需要以/开头
- return Result.Success().SetData(await _iMenuService._repository.UpdateIgnoreNullAsync(menu));
- }
-
-
- ///
- /// 得到树形菜单
- ///
- ///
- [HttpGet]
- [Permission("system:menu:query")]
- public async Task GetMenuTree()
- {
- return Result.Success().SetData(await _iMenuService.GetMenuTreeAsync());
- }
-
- ///
- /// 根据角色id获取该角色下全部菜单
- ///
- ///
- ///
- [HttpGet]
- [Route("{id}")]
- [Permission("system:menu:query")]
- public async Task GetListByRoleId(long id)
- {
- return Result.Success().SetData(await _iMenuService.GetListByRoleId(id));
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/OnlineController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/OnlineController.cs
deleted file mode 100644
index 4012d81f..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/OnlineController.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-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
-{
- ///
- /// 在线管理
- ///
- [ApiController]
- [Authorize]
- [Route("api/[controller]/[action]")]
- public class OnlineController : ControllerBase
- {
- private ILogger _logger;
- private IHubContext _hub;
- public OnlineController(ILogger logger, IHubContext hub)
- {
- _logger = logger;
- _hub = hub;
- }
-
- ///
- /// 动态条件获取当前在线用户
- ///
- ///
- ///
- ///
- [HttpGet]
- public Result PageList([FromQuery] OnlineUser online, [FromQuery] PageParModel page)
- {
- var data = MainHub.clientUsers;
- IEnumerable 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>() { Total = data.Count, Data = dataWhere.ToList() });
- }
-
-
- ///
- /// 强制退出用户
- ///
- ///
- ///
- [HttpDelete]
- [Route("{connnectionId}")]
- public async Task 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("操作失败!未发现该连接!");
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/OperationLogController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/OperationLogController.cs
deleted file mode 100644
index 47dd2ea4..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/OperationLogController.cs
+++ /dev/null
@@ -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.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
- {
- private IOperationLogService _iOperationLogService;
- public OperationLogController(ILogger logger, IOperationLogService iOperationLogService) : base(logger, iOperationLogService)
- {
- _iOperationLogService = iOperationLogService;
- }
- ///
- /// 动态条件分页查询
- ///
- ///
- ///
- ///
- [HttpGet]
- public async Task PageList([FromQuery] OperationLogEntity operationLog, [FromQuery] PageParModel page)
- {
- return Result.Success().SetData(await _iOperationLogService.SelctPageList(operationLog, page));
- }
-
-
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/PostController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/PostController.cs
deleted file mode 100644
index be7d7232..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/PostController.cs
+++ /dev/null
@@ -1,53 +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.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
- {
- private IPostService _iPostService;
- public PostController(ILogger logger, IPostService iPostService) : base(logger, iPostService)
- {
- _iPostService = iPostService;
- }
-
- ///
- /// 动态条件分页查询
- ///
- ///
- ///
- ///
- [HttpGet]
- public async Task PageList([FromQuery] PostEntity post, [FromQuery] PageParModel page)
- {
- return Result.Success().SetData(await _iPostService.SelctPageList(post, page));
- }
-
-
-
- public override async Task Add(PostEntity entity)
- {
- return await base.Add(entity);
- }
-
- public override async Task Update(PostEntity entity)
- {
- return await base.Update(entity);
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/RoleController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/RoleController.cs
deleted file mode 100644
index eab8bb62..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/RoleController.cs
+++ /dev/null
@@ -1,118 +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.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
-{
- ///
- /// 角色管理
- ///
- [ApiController]
- [Route("api/[controller]/[action]")]
- public class RoleController : BaseSimpleRdController
- {
- private IRoleService _iRoleService;
- public RoleController(ILogger logger, IRoleService iRoleService) : base(logger, iRoleService)
- {
- _iRoleService = iRoleService;
- }
-
- ///
- /// 动态条件分页查询
- ///
- ///
- [Permission("system:role:query")]
- [HttpGet]
- public async Task PageList([FromQuery] RoleEntity role, [FromQuery] PageParModel page)
- {
- return Result.Success().SetData(await _iRoleService.SelctPageList(role, page));
- }
-
-
- ///
- /// 给多用户设置多角色
- ///
- ///
- ///
- [HttpPut]
- [Permission("system:role:edit")]
- public async Task GiveRoleSetMenu(GiveRoleSetMenuDto giveRoleSetMenuDto)
- {
- return Result.Success().SetStatus(await _iRoleService.GiveRoleSetMenu(giveRoleSetMenuDto.RoleIds, giveRoleSetMenuDto.MenuIds));
- }
-
-
- ///
- /// 添加角色包含菜单
- ///
- ///
- ///
- [Permission("system:role:add")]
- [HttpPost]
- public async Task Add(RoleInfoDto roleDto)
- {
- return Result.Success().SetData(await _iRoleService.AddInfo(roleDto));
- }
-
- ///
- /// 更新角色信息
- ///
- ///
- [Permission("system:role:edit")]
- [HttpPut]
- public async Task Update(RoleInfoDto roleDto)
- {
- return Result.Success().SetStatus(await _iRoleService.UpdateInfo(roleDto));
- }
-
- ///
- /// 更改角色状态
- ///
- ///
- ///
- ///
- [Permission("system:role:edit")]
- [HttpPut]
- public async Task UpdateStatus(long roleId, bool isDel)
- {
- return Result.Success().SetData(await _iRoleService._repository.UpdateIgnoreNullAsync(new RoleEntity() { Id = roleId, IsDeleted = isDel }));
- }
-
- ///
- ///更改角色数据权限
- ///
- ///
- [Permission("system:role:edit")]
- [HttpPut]
- public async Task UpdateDataScpoce(RoleInfoDto roleDto)
- {
- return Result.Success().SetStatus(await _iRoleService.UpdateDataScpoce(roleDto));
- }
-
- ///
- /// 删除
- ///
- ///
- ///
- [Permission("system:role:remove")]
- [HttpDelete]
- public override async Task DelList(List ids)
- {
- return await base.DelList(ids);
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/UserController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/UserController.cs
deleted file mode 100644
index 0d01cd52..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RABC/UserController.cs
+++ /dev/null
@@ -1,174 +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.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
-{
- ///
- /// 用户管理
- ///
- [ApiController]
- [Authorize]
- [Route("api/[controller]/[action]")]
- public class UserController : BaseSimpleRdController
- {
- private IUserService _iUserService;
-
- public UserController(ILogger logger, IUserService iUserService) : base(logger, iUserService)
- {
- _iUserService = iUserService;
-
- }
-
- ///
- /// 动态条件分页查询
- ///
- ///
- ///
- ///
- ///
- [HttpGet]
- [Permission("system:user:query")]
- public async Task PageList([FromQuery] UserEntity user, [FromQuery] PageParModel page, [FromQuery] long? deptId)
- {
- return Result.Success().SetData(await _iUserService.SelctPageList(user, page, deptId));
- }
-
- ///
- /// 更改用户状态
- ///
- ///
- ///
- ///
- [HttpPut]
- [Permission("system:user:edit")]
- [Log("用户模块", OperEnum.Update)]
- public async Task UpdateStatus(long userId, bool isDel)
- {
- return Result.Success().SetData(await _repository.UpdateIgnoreNullAsync(new UserEntity() { Id = userId, IsDeleted = isDel }));
- }
-
- ///
- /// 给多用户设置多角色
- ///
- ///
- ///
- [HttpPut]
- [Permission("system:user:edit")]
- [Log("用户模块", OperEnum.Update)]
- public async Task GiveUserSetRole(GiveUserSetRoleDto giveUserSetRoleDto)
- {
- return Result.Success().SetStatus(await _iUserService.GiveUserSetRole(giveUserSetRoleDto.UserIds, giveUserSetRoleDto.RoleIds));
- }
-
-
- ///
- /// 通过用户id得到用户信息关联部门、岗位、角色
- ///
- ///
- ///
- [HttpGet]
- [Route("{id}")]
- [Permission("system:user:query")]
- public override async Task GetById([FromRoute] long id)
- {
- return Result.Success().SetData(await _iUserService.GetInfoById(id));
- }
-
- ///
- /// 更新用户信息
- ///
- ///
- ///
- [HttpPut]
- [Permission("system:user:edit")]
- [Log("用户模块", OperEnum.Update)]
- public async Task 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));
- }
-
-
- ///
- /// 更新个人中心信息
- ///
- ///
- ///
- [HttpPut]
- [Permission("system:user:edit")]
- [Log("用户模块", OperEnum.Update)]
- public async Task UpdateProfile(UserInfoDto userDto)
- {
- //修改需要赋值上主键哦
- userDto.User!.Id = HttpContext.GetUserIdInfo();
- return Result.Success().SetStatus(await _iUserService.UpdateProfile(userDto));
- }
-
- ///
- /// 添加用户
- ///
- ///
- ///
- [HttpPost]
- [Permission("system:user:add")]
- [Log("用户模块", OperEnum.Insert)]
- public async Task 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));
- }
-
- ///
- /// 重置密码
- ///
- ///
- ///
- [HttpPut]
- [Permission("system:user:edit")]
- [Log("用户模块", OperEnum.Update)]
- public async Task RestPassword(UserEntity user)
- {
- return Result.Success().SetStatus(await _iUserService.RestPassword(user.Id, user.Password));
- }
- [Permission("system:user:query")]
- public override Task GetList()
- {
- return base.GetList();
- }
- [Permission("system:user:remove")]
- [Log("用户模块", OperEnum.Delete)]
- public override Task DelList(List ids)
- {
- return base.DelList(ids);
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/CategoryController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/CategoryController.cs
deleted file mode 100644
index 93a6f9bb..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/CategoryController.cs
+++ /dev/null
@@ -1,28 +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.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
- {
- private ICategoryService _iCategoryService;
- public CategoryController(ILogger logger, ICategoryService iCategoryService) : base(logger, iCategoryService)
- {
- _iCategoryService = iCategoryService;
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/SkuController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/SkuController.cs
deleted file mode 100644
index bfa4284c..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/SkuController.cs
+++ /dev/null
@@ -1,115 +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.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
- {
- private ISkuService _iSkuService;
- public SkuController(ILogger logger, ISkuService iSkuService) : base(logger, iSkuService)
- {
- _iSkuService = iSkuService;
- }
-
- ///
- /// 动态条件分页查询
- ///
- ///
- [HttpGet]
- public async Task PageList([FromQuery] SkuEntity eneity, [FromQuery] PageParModel page)
- {
- return Result.Success().SetData(await _iSkuService.SelctPageList(eneity, page));
- }
-
-
-
-
- //数据测试
- [HttpGet]
- public async Task Test(OperEnum operEnum)
- {
- switch (operEnum)
- {
- case OperEnum.Insert:
- List spus = new();
- var sku1 = new SkuEntity()
- {
- Id = 1,
- Stock = 100,
- IsDeleted = false,
- SpuId = 1,
- Price = 1000,
- SpecsSkuAllInfo = new List {
- 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 {
- 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 {
- 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 {
- 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();
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/SpecsController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/SpecsController.cs
deleted file mode 100644
index 3607e9ea..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/SpecsController.cs
+++ /dev/null
@@ -1,28 +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.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
- {
- private ISpecsService _iSpecsService;
- public SpecsController(ILogger logger, ISpecsService iSpecsService) : base(logger, iSpecsService)
- {
- _iSpecsService = iSpecsService;
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/SpecsGroupController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/SpecsGroupController.cs
deleted file mode 100644
index 3a2a196b..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/SpecsGroupController.cs
+++ /dev/null
@@ -1,28 +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.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
- {
- private ISpecsGroupService _iSpecsGroupService;
- public SpecsGroupController(ILogger logger, ISpecsGroupService iSpecsGroupService) : base(logger, iSpecsGroupService)
- {
- _iSpecsGroupService = iSpecsGroupService;
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/SpuController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/SpuController.cs
deleted file mode 100644
index 0bbcb69a..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/SpuController.cs
+++ /dev/null
@@ -1,96 +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.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
- {
- private ISpuService _iSpuService;
- public SpuController(ILogger logger, ISpuService iSpuService) : base(logger, iSpuService)
- {
- _iSpuService = iSpuService;
- }
-
- ///
- /// 动态条件分页查询
- ///
- ///
- [HttpGet]
- public async Task PageList([FromQuery] SpuEntity eneity, [FromQuery] PageParModel page)
- {
- return Result.Success().SetData(await _iSpuService.SelctPageList(eneity, page));
- }
-
- [Route("{id}")]
- [HttpGet]
- public override async Task 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 Test(OperEnum operEnum)
- {
- switch (operEnum)
- {
- case OperEnum.Insert:
- List spus = new();
- var spu1 = new SpuEntity()
- {
- Id = 1,
- SpuName = "华为mate40 5G手机",
- IsDeleted = false,
- Details = "华为手机就是牛",
- Price = "1000-2000",
- SpecsSpuAllInfo = new List {
- new SpecsSpuAllInfoModel { SpecsGroupName="内存",SpecsNames=new List { "1GB","2GB","3GB"} } ,
- new SpecsSpuAllInfoModel { SpecsGroupName="颜色",SpecsNames=new List { "红","蓝","绿"} } },
- };
- var spu2 = new SpuEntity()
- {
- Id = 2,
- SpuName = "小米888 8G手机",
- IsDeleted = false,
- Details = "小米手机就是牛",
- Price = "2000-3000",
- SpecsSpuAllInfo = new List {
- new SpecsSpuAllInfoModel { SpecsGroupName="内存",SpecsNames=new List { "1GB","2GB","3GB"} } ,
- new SpecsSpuAllInfoModel { SpecsGroupName="颜色",SpecsNames=new List { "红","蓝","绿"} } },
- };
- 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();
- }
- }
-}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs
deleted file mode 100644
index 33e47ccd..00000000
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs
+++ /dev/null
@@ -1,423 +0,0 @@
-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.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
-{
- ///
- /// 测试控制器
- ///
- [ApiController]
- [Route("api/[controller]/[action]")]
- public class TestController : ControllerBase
- {
- private IStringLocalizer _local;
- private IUserService _iUserService;
- private IRoleService _iRoleService;
- private QuartzInvoker _quartzInvoker;
- private IHubContext _hub;
- private ThumbnailSharpInvoer _thumbnailSharpInvoer;
- private CacheInvoker _cacheDb;
- private ILogger _logger;
- ISugarUnitOfWork _unitOfWork;
- [Autowired]
- private ICurrentUser _currentUser { get; set; }
-
- [Autowired]
- public CacheInvoker CacheInvoker { get; set; }
- //你可以依赖注入服务层各各接口,也可以注入其他仓储层,怎么爽怎么来!
- ///
- /// 依赖注入,优雅写法
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public TestController(IHubContext hub,
- ILogger logger,
- IRoleService iRoleService,
- IUserService iUserService,
- IStringLocalizer local,
- QuartzInvoker quartzInvoker,
- ThumbnailSharpInvoer thumbnailSharpInvoer,
- CacheInvoker cacheInvoker,
- ISugarUnitOfWork unitOfWork
- ) =>
-
- (_logger, _iUserService, _iRoleService, _quartzInvoker, _hub, _local, _thumbnailSharpInvoer, _cacheDb, _unitOfWork) =
-
- (logger, iUserService, iRoleService, quartzInvoker, hub, local, thumbnailSharpInvoer, cacheInvoker, unitOfWork);
-
-
- ///
- /// swagger跳转
- ///
- ///
- [HttpGet]
- [Route("/")]
- public IActionResult Swagger()
- {
- return Redirect("/Swagger");
- }
-
- ///
- /// 仓储上下文对象测试
- ///
- ///
- [HttpGet]
- // 特点:化繁为简!意框架仓储代理上下文对象,用起来就是爽,但最好按规范来爽!
- // 规范:控制器严禁使用DB上下文对象,其它怎么爽怎么来!
- public async Task DbTest()
- {
- //非常好,使用UserService的特有方法
- await _iUserService.DbTest();
-
- //非常好,依赖注入使用其他Service的特有方法
- await _iRoleService.DbTest();
-
- //很核理,使用仓储的通用方法
- await _iUserService._repository.GetListAsync();
-
- //挺不错,依赖注入其他仓储
- await _iRoleService._repository.GetListAsync();
-
- //还行,直接切换其他仓储,怎么爽怎么来
- await _iUserService._repository.ChangeRepository>().GetListAsync();
-
- //最好不要在控制器直接操作Db对象
- await _iUserService._repository._Db.Queryable().ToListAsync();
- await _iUserService._repository._DbQueryable.ToListAsync();
-
- return Result.Success().SetData(await _iUserService.DbTest());
- }
-
- ///
- /// 工作单元测试,使用sqlsugar内置
- ///
- ///
- [HttpGet]
-
- public async Task 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");
- }
- }
-
- ///
- /// 执行Sql返回
- ///
- ///
- [HttpGet]
- //简单语句不推荐使用sql!
- public async Task SqlTest()
- {
- return Result.Success().SetData(await _iUserService._repository.UseSqlAsync("select * from User"));
- }
-
- ///
- /// 国际化测试
- ///
- ///
- [HttpGet]
- //根据浏览器语言设置来切换输出
- public Result LocalTest()
- {
- return Result.Success().SetData(_local["succeed"]);
- }
-
- ///
- /// 权限测试
- ///
- ///
- [HttpGet]
- [Permission("user:get:test")]
- public Result PermissionTest()
- {
- return Result.Success();
- }
-
- ///
- /// 策略授权测试
- ///
- ///
- [HttpGet]
- [Authorize(PolicyName.Sid)]
- public Result AuthTest()
- {
- return Result.Success();
- }
-
- ///
- /// 异步事务测试
- ///
- ///
- [HttpGet]
- //注册一个用户获取它的信息之后再更新它,但是这个年龄可能会报错
- //如果一个事务中有任何一个错误,将会把所有执行过的操作进行回滚,确保数据的原子性
- public async Task TranTest()
- {
- UserEntity user = new() { UserName = $"杰哥{DateTime.Now}", Password = "5201314", Age = 99 };
-
- var res = await _iUserService._repository.UseTranAsync(async () =>
- {
- await _iUserService.Register(user, (o) => user = o);
- user.Age = 18 / (new Random().Next(0, 2));
- await _iUserService._repository.UpdateAsync(user);
- });
- if (res)
- {
- return Result.Success("执行成功!");
- }
- else
- {
- return Result.Error("发生错误,插入已回滚!");
- }
-
- }
-
- ///
- /// 极爽导航属性
- ///
- ///
- [HttpGet]
- //Sqlsugar精髓之一!必学!最新版本
- public async Task IncludeTest()
- {
- return Result.Success().SetData(await _iUserService.GetListInRole());
- }
-
- ///
- /// 启动一个定时任务
- ///
- ///
- [HttpGet]
- //每5秒访问一次百度,可查看控制台
- public async Task JobTest()
- {
- Dictionary data = new Dictionary()
- {
- {JobConst.method,"get" },
- {JobConst.url,"https://www.baidu.com" }
- };
- await _quartzInvoker.StartAsync("*/5 * * * * ?", "HttpJob", jobName: "test", jobGroup: "my", data: data);
- return Result.Success();
- }
-
- ///
- /// 停止任务
- ///
- ///
- [HttpPut]
- public async Task StopJob()
- {
- await _quartzInvoker.StopAsync(new Quartz.JobKey("test", "my"));
- return Result.Success("http://localhost:19001/hangfire");
- }
-
- ///
- /// job异常处理
- ///
- ///
- [HttpGet]
- public async Task ErrorJob()
- {
- await _quartzInvoker.StartAsync("*/5 * * * * ?", "ErrorJob");
- return Result.Success();
- }
-
- ///
- /// 树形结构构建测试
- ///
- ///
- [HttpGet]
- public Result TreeTest()
- {
- List 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);
- }
-
- ///
- /// 授权测试
- ///
- ///
- [Authorize]
- [HttpGet]
- public Result AuthorizeTest()
- {
- return Result.Success();
- }
-
-
- ///
- /// 清空数据库
- ///
- ///
- [HttpGet]
- public async Task ClearDb()
- {
- var rep = _iUserService._repository;
- return Result.Success().SetStatus(await rep.UseTranAsync(async () =>
- {
- await rep.DeleteAsync(u => true);
- await rep.ChangeRepository>().DeleteAsync(u => true);
- await rep.ChangeRepository>().DeleteAsync(u => true);
- await rep.ChangeRepository>().DeleteAsync(u => true);
- await rep.ChangeRepository>().DeleteAsync(u => true);
- await rep.ChangeRepository>().DeleteAsync(u => true);
- await rep.ChangeRepository>().DeleteAsync(u => true);
- await rep.ChangeRepository>().DeleteAsync(u => true);
- await rep.ChangeRepository>().DeleteAsync(u => true);
- await rep.ChangeRepository>().DeleteAsync(u => true);
- }));
-
- }
-
-
- ///
- /// 种子数据
- ///
- ///
- [HttpGet]
- public Result SeedDb()
- {
- var rep = _iUserService._repository;
- return Result.Success().SetStatus(DbSeedExtend.DataInvoer(rep._Db));
- }
-
- ///
- /// 操作日志测试
- ///
- ///
- ///
- [HttpPost]
- [Log("测试模块", Common.Enum.OperEnum.Insert)]
- public Result LogTest(List par)
- {
- return Result.Success().SetData(par);
- }
-
- ///