docs: 修改文档
This commit is contained in:
parent
829826c5c1
commit
65685d6cd9
312
ReadMe.md
312
ReadMe.md
|
@ -1,12 +1,11 @@
|
||||||
# 项目预览
|
# 项目预览
|
||||||
|
|
||||||
不知道为什么,图床用的使自己的,Gitee就是不显示其它GitHub和Gitea都能显示就Gitee显示不出来
|
不知道为什么,图床用的使自己的,Gitee就是不显示其它GitHub和Gitea都能显示就Gitee显示不出来,如果想用Gitee就把ReadMe文件下载下来也行;或者把项目clone下来看也可以
|
||||||
|
|
||||||
或者把项目clone下来看也可以
|
|
||||||
|
|
||||||
**线上地址**
|
**线上地址**
|
||||||
|
|
||||||
- 正式线上预览地址:http://111.229.137.235/#/welcome
|
- 正式线上预览地址:http://bunny-web.site/#/welcome
|
||||||
|
- 线上地址目前使用的是90天的SSL证书,可能会提示链接不安全,忽略就好了
|
||||||
|
|
||||||
- 测试预览地址:http://106.15.251.123/#/welcome
|
- 测试预览地址:http://106.15.251.123/#/welcome
|
||||||
- 服务器到期时间:12月30日
|
- 服务器到期时间:12月30日
|
||||||
|
@ -177,6 +176,74 @@ FLUSH PRIVILEGES;
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
## 后端日志文件
|
||||||
|
|
||||||
|
在后端日志文件中,使用了`logback.xml`进行格式化。然而,使用`logback.xml`后,配置文件中指定的日志输出文件位置可能会失效。如果项目是通过Docker部署的,想在宿主机查看日志文件需要进行文件映射。
|
||||||
|
|
||||||
|
### 使用SpringBoot
|
||||||
|
|
||||||
|
在配置文件中,指定名称和目录路径即可,之后使用docker映射就可以在宿主机看到日志了
|
||||||
|
|
||||||
|
如果想要用自带需要删除`logback.xml`文件
|
||||||
|
|
||||||
|
```
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
cn.bunny.service.mapper: warn
|
||||||
|
cn.bunny.service.controller: warn
|
||||||
|
cn.bunny.service.service: warn
|
||||||
|
root: warn
|
||||||
|
pattern:
|
||||||
|
dateformat: HH:mm:ss:SSS
|
||||||
|
file:
|
||||||
|
path: "logs/${spring.application.name}"
|
||||||
|
name: "logs/${spring.application.name}"
|
||||||
|
```
|
||||||
|
|
||||||
|
### 使用logback.xml
|
||||||
|
|
||||||
|
指定目录的位置`<file>D:/logs/${datetime}/auth-server.log</file>`根据你需要的指定
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<!-- 格式化 年-月-日 输出 -->
|
||||||
|
<timestamp key="datetime" datePattern="yyyy-MM-dd"/>
|
||||||
|
|
||||||
|
<appender name="STOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>
|
||||||
|
%cyan([%thread]) %yellow(%-5level) %green(%logger{100}).%boldRed(%method)-%boldMagenta(%line)- %blue(%msg%n)
|
||||||
|
</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 文件日志 -->
|
||||||
|
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
|
||||||
|
<file>/www/root/server/logs/${datetime}/auth-server.log</file>
|
||||||
|
<append>true</append>
|
||||||
|
<encoder>
|
||||||
|
<pattern>%date{yyyy-MM-dd HH:mm:ss} %-5level %logger{100} %method %line %msg%n</pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
```
|
||||||
|
|
||||||
|
> 如果按照上面搭建,日志文件会在`/www/root/server/logs`下,即使使Windows系统也会存在,如果docker使用的是文件映射,那么日志文件会在容器相对应的位置
|
||||||
|
|
||||||
|
如果开发环境或者其他环境也需要日志,可以根据当前环境进行选择`<springProfile name="prod">`
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<!-- 生产环境 -->
|
||||||
|
<springProfile name="prod">
|
||||||
|
<!-- 日志记录器:业务程序INFO级别 -->
|
||||||
|
<logger name="cn.bunny" level="INFO"/>
|
||||||
|
<!-- 根日志记录器:INFO级别 -->
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="CONSOLE"/>
|
||||||
|
<appender-ref ref="FILE"/>
|
||||||
|
</root>
|
||||||
|
</springProfile>
|
||||||
|
```
|
||||||
|
|
||||||
# 项目特点
|
# 项目特点
|
||||||
|
|
||||||
### 按钮权限显示
|
### 按钮权限显示
|
||||||
|
@ -810,59 +877,25 @@ public class MenuIconVo extends BaseUserVo {
|
||||||
|
|
||||||
使用Docker进行部署,后端接口地址以`/admin`开头,但前端默认请求前缀为`/api`,因此在请求时需要进行替换。详细内容请参考以下【项目部署】说明。
|
使用Docker进行部署,后端接口地址以`/admin`开头,但前端默认请求前缀为`/api`,因此在请求时需要进行替换。详细内容请参考以下【项目部署】说明。
|
||||||
|
|
||||||
## 配置相关
|
## 前端部署
|
||||||
|
|
||||||
### docker文件
|
运行`pnpm build`
|
||||||
|
|
||||||
```dockerfile
|
dockerfile中暴露端口要和生产环境的端口号保持一致
|
||||||
# 使用官方的 Nginx 镜像作为基础镜像
|
|
||||||
FROM nginx
|
|
||||||
|
|
||||||
# 删除默认的 Nginx 配置文件
|
### 使用http协议
|
||||||
RUN rm /etc/nginx/conf.d/default.conf
|
|
||||||
|
|
||||||
# 将自定义的 Nginx 配置文件复制到容器中
|
如果不使用https,需要将下面内容注释
|
||||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
||||||
|
|
||||||
# 设置时区,构建镜像时执行的命令
|

|
||||||
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
|
||||||
RUN echo "Asia/Shanghai" > /etc/timezone
|
|
||||||
|
|
||||||
# 创建一个目录来存放前端项目文件
|
对外暴露端口改为`80`或者你自己喜欢的端口
|
||||||
WORKDIR /usr/share/nginx/html
|
|
||||||
|
|
||||||
# 将前端项目打包文件复制到 Nginx 的默认静态文件目录
|

|
||||||
COPY dist/ /usr/share/nginx/html
|
|
||||||
# 复制到nginx目录下
|
|
||||||
COPY dist/ /etc/nginx/html
|
|
||||||
|
|
||||||
# 暴露 Nginx 的默认端口
|
#### NGINX配置
|
||||||
EXPOSE 80
|
|
||||||
|
|
||||||
# 自动启动 Nginx
|
将NGINX配置修改为以下内容
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
|
||||||
```
|
|
||||||
|
|
||||||
### NGINX文件
|
|
||||||
|
|
||||||
在请求中会使用代理所以会拿不到用户真实的IP地址,素以在要NGINX侠做下面的配置,这样用户在访问时就可以拿到真实的IP了
|
|
||||||
|
|
||||||
```nginx
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 如果需要使用https协议
|
|
||||||
|
|
||||||
```dockerfile
|
|
||||||
COPY bunny-web.site.csr /etc/nginx/bunny-web.site.csr
|
|
||||||
COPY bunny-web.site.key /etc/nginx/bunny-web.site.key
|
|
||||||
COPY bunny-web.site_bundle.crt /etc/nginx/bunny-web.site_bundle.crt
|
|
||||||
COPY bunny-web.site_bundle.pem /etc/nginx/bunny-web.site_bundle.pem
|
|
||||||
```
|
|
||||||
|
|
||||||
NGINX的文件
|
|
||||||
|
|
||||||
```nginx
|
```nginx
|
||||||
map $http_upgrade $connection_upgrade {
|
map $http_upgrade $connection_upgrade {
|
||||||
|
@ -871,73 +904,174 @@ map $http_upgrade $connection_upgrade {
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80 ;
|
||||||
listen [::]:80;
|
listen [::]:80;
|
||||||
server_name localhost;
|
server_name localhost;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
root /etc/nginx/html;
|
root /etc/nginx/html;
|
||||||
index index.html index.htm;
|
index index.html index.htm;
|
||||||
try_files $uri /index.html;
|
try_files $uri /index.html;
|
||||||
}
|
}
|
||||||
|
|
||||||
# 后端跨域请求
|
# 后端跨域请求
|
||||||
location ~/admin/ {
|
location ~/admin/ {
|
||||||
proxy_pass http://172.17.0.1:8000;
|
proxy_pass http://172.17.0.1:8000;
|
||||||
proxy_set_header Host $http_host;
|
proxy_set_header Host $http_host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
error_page 404 404.html;
|
error_page 404 404.html;
|
||||||
|
|
||||||
location = /50x.html {
|
location = /50x.html {
|
||||||
root html;
|
root html;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## 项目部署
|
如果你的暴露的端口和我一样是`80`
|
||||||
|
|
||||||
使用WebStorm进行项目部署,项目上线时默认端口为80。因此,Docker默认暴露的IP端口也应为80,NGINX中默认暴露的端口也是80,三者应一一对应。
|

|
||||||
|
|
||||||
若无法下载,请先使用pnpm下载。若不需使用pnpm,请删除或修改相应内容。
|
### 使用https协议
|
||||||
|
|
||||||

|
#### 环境准备
|
||||||
|
|
||||||
### docker配置
|
需要ssl证书这个是必要的,之后将ssl证书解压
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 配置环境
|
解压后放到docker文件下
|
||||||
|
|
||||||
设置启动端口号和项目地址机器后端请求地址
|

|
||||||
|
|
||||||

|
#### 注意事项
|
||||||
|
|
||||||
#### 配置线上环境
|
在docker文件中需要将证书相关信息复制到docker容器中,名称对应文件下的文件名,如果你想部署名称肯定是不一样的,当然你可以重命名成和我一样的
|
||||||
|
|
||||||
设置项目启动端口号,线上环境默认请求路径为`/admin`,需在NGINX中将访问请求前缀更改为`/admin`。
|
```dockerfile
|
||||||
|
# 将自定义的 Nginx 配置文件复制到容器中
|
||||||
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
COPY bunny-web.site.csr /etc/nginx/bunny-web.site.csr
|
||||||
|
COPY bunny-web.site.key /etc/nginx/bunny-web.site.key
|
||||||
|
COPY bunny-web.site_bundle.crt /etc/nginx/bunny-web.site_bundle.crt
|
||||||
|
COPY bunny-web.site_bundle.pem /etc/nginx/bunny-web.site_bundle.pem
|
||||||
|
```
|
||||||
|
|
||||||

|
如果使用的是SSL链接将端口号更改下,改成`443`
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
#### 配置开发环境
|
配置NGINX的配置文件,这些文件内容网上都有可以参看腾讯云文档
|
||||||
|
|
||||||
开发环境默认IP为7000,若与本地项目端口冲突,请修改。后端请求地址为7070。
|
- 证书下载和配置方式:https://cloud.tencent.com/document/product/400/4143?from_cn_redirect=1
|
||||||
|
- NGINX搭建SSL链接:https://cloud.tencent.com/document/product/400/35244
|
||||||
|
|
||||||
前端设置的请求前缀为`/api`,但后端接受的前缀为`/admin`,因此需在服务中修改此内容。
|
```nginx
|
||||||
|
map $http_upgrade $connection_upgrade {
|
||||||
|
default upgrade;
|
||||||
|
'' close;
|
||||||
|
}
|
||||||
|
|
||||||

|
server {
|
||||||
|
#SSL 默认访问端口号为 443
|
||||||
|
listen 443 ssl;
|
||||||
|
#请填写绑定证书的域名
|
||||||
|
server_name localhost;
|
||||||
|
#请填写证书文件的相对路径或绝对路径
|
||||||
|
ssl_certificate bunny-web.site_bundle.crt;
|
||||||
|
#请填写私钥文件的相对路径或绝对路径
|
||||||
|
ssl_certificate_key bunny-web.site.key;
|
||||||
|
ssl_session_timeout 5m;
|
||||||
|
#请按照以下协议配置
|
||||||
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
#请按照以下套件配置,配置加密套件,写法遵循 openssl 标准。
|
||||||
|
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
|
||||||
|
ssl_prefer_server_ciphers on;
|
||||||
|
|
||||||
**修改请求路径**
|
location / {
|
||||||
|
root /etc/nginx/html;
|
||||||
|
index index.html index.htm;
|
||||||
|
try_files $uri /index.html;
|
||||||
|
}
|
||||||
|
|
||||||

|
# 后端跨域请求
|
||||||
|
location ~/admin/ {
|
||||||
|
proxy_pass http://172.17.0.1:8000;
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
|
||||||
### 部署命令
|
error_page 404 404.html;
|
||||||
|
|
||||||
|
location = /50x.html {
|
||||||
|
root html;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80 ;
|
||||||
|
listen [::]:80;
|
||||||
|
server_name localhost;
|
||||||
|
return 301 https://$host$request_uri;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
root /etc/nginx/html;
|
||||||
|
index index.html index.htm;
|
||||||
|
try_files $uri /index.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
# 后端跨域请求
|
||||||
|
location ~/admin/ {
|
||||||
|
proxy_pass http://172.17.0.1:8000;
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
error_page 404 404.html;
|
||||||
|
|
||||||
|
location = /50x.html {
|
||||||
|
root html;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 运行docker文件
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
> 命令预览
|
||||||
|
>
|
||||||
|
> ```sh
|
||||||
|
> docker build -f Dockerfile -t bunny_auth_web:1.0.0 . && docker run -p 80:443 -p 443:443 --name bunny_auth_web --restart always bunny_auth_web:1.0.0
|
||||||
|
> ```
|
||||||
|
|
||||||
|
## 后端部署
|
||||||
|
|
||||||
|
开发环境环境:对外暴露的端口是`7070`
|
||||||
|
|
||||||
|
生产环境:对外暴露的端口是`8000`
|
||||||
|
|
||||||
|
需要先打包,打包完成后会在目录下生成对应的`target`相关文件
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker build -f Dockerfile -t bunny_auth_web:1.0.0 . && docker run -p 80:80 --name bunny_auth_web --restart always bunny_auth_web:1.0.0
|
# 开发环境
|
||||||
|
mvn clean package -Pprod -DskipTests
|
||||||
|
|
||||||
|
# 测试环境
|
||||||
|
mvn clean package -Ptest -DskipTests
|
||||||
```
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
这个文件夹是必须的
|
||||||
|
|
||||||
|

|
||||||
|
|
|
@ -3,8 +3,11 @@ package cn.bunny.common.generator.generator;
|
||||||
import cn.bunny.common.generator.entity.BaseField;
|
import cn.bunny.common.generator.entity.BaseField;
|
||||||
import cn.bunny.common.generator.entity.BaseResultMap;
|
import cn.bunny.common.generator.entity.BaseResultMap;
|
||||||
import cn.bunny.common.generator.utils.GeneratorCodeUtils;
|
import cn.bunny.common.generator.utils.GeneratorCodeUtils;
|
||||||
import cn.bunny.dao.dto.system.message.MessageReceivedDto;
|
import cn.bunny.dao.dto.financial.category.CategoryAddDto;
|
||||||
import cn.bunny.dao.entity.system.Message;
|
import cn.bunny.dao.dto.financial.category.CategoryDto;
|
||||||
|
import cn.bunny.dao.dto.financial.category.CategoryUpdateDto;
|
||||||
|
import cn.bunny.dao.entity.financial.Category;
|
||||||
|
import cn.bunny.dao.vo.financial.CategoryVo;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.google.common.base.CaseFormat;
|
import com.google.common.base.CaseFormat;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
@ -33,26 +36,27 @@ import java.util.stream.Stream;
|
||||||
@Service
|
@Service
|
||||||
public class WebGeneratorCode {
|
public class WebGeneratorCode {
|
||||||
// 公共路径
|
// 公共路径
|
||||||
public static String commonPath = "D:\\MyFolder\\auth-admin\\auth-web\\src";
|
// public static String commonPath = "D:\\Project\\web\\PC\\financial\\financial-web\\src";
|
||||||
|
public static String commonPath = "D:\\MyFolder\\financial\\financial-web\\src";
|
||||||
// 生成API请求路径
|
// 生成API请求路径
|
||||||
public static String apiPath = commonPath + "\\api\\v1\\";
|
public static String apiPath = commonPath + "\\api\\v1\\financial\\";
|
||||||
// 生成vue路径
|
// 生成vue路径
|
||||||
public static String vuePath = commonPath + "\\views\\message\\";
|
public static String vuePath = commonPath + "\\views\\financial\\";
|
||||||
// 生成仓库路径
|
// 生成仓库路径
|
||||||
public static String storePath = commonPath + "\\store\\message\\";
|
public static String storePath = commonPath + "\\store\\financial\\";
|
||||||
// 后端controller
|
// 后端controller
|
||||||
public static String controllerPath = "D:\\MyFolder\\auth-admin\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\controller\\";
|
public static String controllerPath = "D:\\MyFolder\\financial\\financial-server\\service\\src\\main\\java\\cn\\bunny\\services\\controller\\financial\\";
|
||||||
public static String servicePath = "D:\\MyFolder\\auth-admin\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\service\\";
|
public static String servicePath = "D:\\MyFolder\\financial\\financial-server\\service\\src\\main\\java\\cn\\bunny\\services\\service\\financial\\";
|
||||||
public static String serviceImplPath = "D:\\MyFolder\\auth-admin\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\service\\impl\\";
|
public static String serviceImplPath = "D:\\MyFolder\\financial\\financial-server\\service\\src\\main\\java\\cn\\bunny\\services\\service\\financial\\impl\\";
|
||||||
public static String mapperPath = "D:\\MyFolder\\auth-admin\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\mapper\\";
|
public static String mapperPath = "D:\\MyFolder\\financial\\financial-server\\service\\src\\main\\java\\cn\\bunny\\services\\mapper\\financial\\";
|
||||||
public static String resourceMapperPath = "D:\\MyFolder\\auth-admin\\auth-server-java\\service\\src\\main\\resources\\mapper\\";
|
public static String resourceMapperPath = "D:\\MyFolder\\financial\\financial-server\\service\\src\\main\\resources\\mapper\\financial\\";
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
Class<?> originalClass = Message.class;
|
Class<?> originalClass = Category.class;
|
||||||
Class<?> dtoClass = MessageReceivedDto.class;
|
Class<?> dtoClass = CategoryDto.class;
|
||||||
Class<?> addDtoClass = MessageReceivedDto.class;
|
Class<?> addDtoClass = CategoryAddDto.class;
|
||||||
// Class<?> updateDtoClass = MessageUpdateDto.class;
|
Class<?> updateDtoClass = CategoryUpdateDto.class;
|
||||||
// Class<?> voClass = MessageVo.class;
|
Class<?> voClass = CategoryVo.class;
|
||||||
|
|
||||||
// 设置velocity资源加载器
|
// 设置velocity资源加载器
|
||||||
Properties prop = new Properties();
|
Properties prop = new Properties();
|
||||||
|
@ -84,7 +88,7 @@ public class WebGeneratorCode {
|
||||||
generatorWebCode(dtoClass, addDtoClass, context);
|
generatorWebCode(dtoClass, addDtoClass, context);
|
||||||
|
|
||||||
// 生成后端
|
// 生成后端
|
||||||
generatorServerCode(originalClass, dtoClass, context);
|
generatorServerCode(originalClass, dtoClass, voClass, context);
|
||||||
|
|
||||||
// 写入文件
|
// 写入文件
|
||||||
writeFiles(lowercaseName, lowerHyphen, originalName, context);
|
writeFiles(lowercaseName, lowerHyphen, originalName, context);
|
||||||
|
@ -141,7 +145,7 @@ public class WebGeneratorCode {
|
||||||
/**
|
/**
|
||||||
* 生成后端内容
|
* 生成后端内容
|
||||||
*/
|
*/
|
||||||
public static void generatorServerCode(Class<?> originalClass, Class<?> dtoClass, VelocityContext context) {
|
public static void generatorServerCode(Class<?> originalClass, Class<?> dtoClass, Class<?> voClass, VelocityContext context) {
|
||||||
Field[] superFields = originalClass.getSuperclass().getDeclaredFields();
|
Field[] superFields = originalClass.getSuperclass().getDeclaredFields();
|
||||||
Field[] declaredFields = originalClass.getDeclaredFields();
|
Field[] declaredFields = originalClass.getDeclaredFields();
|
||||||
Field[] mergedArray = new Field[superFields.length + declaredFields.length];
|
Field[] mergedArray = new Field[superFields.length + declaredFields.length];
|
||||||
|
@ -168,9 +172,6 @@ public class WebGeneratorCode {
|
||||||
return BaseResultMap.builder().column(column).property(name).build();
|
return BaseResultMap.builder().column(column).property(name).build();
|
||||||
}).toList();
|
}).toList();
|
||||||
|
|
||||||
// 类型加包名
|
|
||||||
String name = originalClass.getName();
|
|
||||||
|
|
||||||
// 生层Base_Column_List
|
// 生层Base_Column_List
|
||||||
String baseColumnList = Stream.of(mergedArray)
|
String baseColumnList = Stream.of(mergedArray)
|
||||||
.map(field -> CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, field.getName()))
|
.map(field -> CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, field.getName()))
|
||||||
|
@ -180,7 +181,8 @@ public class WebGeneratorCode {
|
||||||
String tableName = originalClass.getAnnotation(TableName.class).value();
|
String tableName = originalClass.getAnnotation(TableName.class).value();
|
||||||
|
|
||||||
context.put("baseResultMaps", baseResultMaps);
|
context.put("baseResultMaps", baseResultMaps);
|
||||||
context.put("type", name);
|
context.put("type", originalClass.getName());
|
||||||
|
context.put("voClassType", voClass.getName());
|
||||||
context.put("baseColumnList", baseColumnList);
|
context.put("baseColumnList", baseColumnList);
|
||||||
context.put("tableName", tableName);
|
context.put("tableName", tableName);
|
||||||
context.put("pageQueryMap", pageQueryMap);
|
context.put("pageQueryMap", pageQueryMap);
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<!-- 分页查询${classTitle}内容 -->
|
<!-- 分页查询${classTitle}内容 -->
|
||||||
<select id="selectListByPage" resultType="${type}Vo">
|
<select id="selectListByPage" resultType="${voClassType}">
|
||||||
select
|
select
|
||||||
base.*,
|
base.*,
|
||||||
create_user.username as create_username,
|
create_user.username as create_username,
|
||||||
|
|
|
@ -5,65 +5,65 @@ import { storeMessage } from '@/utils/message';
|
||||||
import { storePagination } from '@/store/useStorePagination';
|
import { storePagination } from '@/store/useStorePagination';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ${classTitle} Store
|
* ${classTitle} Store
|
||||||
*/
|
*/
|
||||||
export const use${originalName}Store = defineStore('${lowercaseName}Store', {
|
export const use${originalName}Store = defineStore('${lowercaseName}Store', {
|
||||||
state() {
|
state() {
|
||||||
return {
|
return {
|
||||||
// ${classTitle}列表
|
// ${classTitle}列表
|
||||||
datalist: [],
|
datalist: [],
|
||||||
// 查询表单
|
// 查询表单
|
||||||
form: {
|
form: {
|
||||||
#foreach($item in $formList)
|
#foreach($item in $formList)
|
||||||
// $!{item.annotation}
|
// $!{item.annotation}
|
||||||
$!{item.name}: undefined,
|
$!{item.name}: undefined,
|
||||||
#end
|
#end
|
||||||
},
|
},
|
||||||
// 分页查询结果
|
// 分页查询结果
|
||||||
pagination: {
|
pagination: {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
pageSize: 150,
|
pageSize: 30,
|
||||||
total: 100,
|
total: 1,
|
||||||
pageSizes,
|
pageSizes,
|
||||||
},
|
},
|
||||||
// 加载
|
// 加载
|
||||||
loading: false,
|
loading: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
getters: {},
|
getters: {},
|
||||||
actions: {
|
actions: {
|
||||||
/** 获取${classTitle} */
|
/** 获取${classTitle} */
|
||||||
async get${originalName}List() {
|
async get${originalName}List() {
|
||||||
// 整理请求参数
|
// 整理请求参数
|
||||||
const data = { ...this.pagination, ...this.form };
|
const data = { ...this.pagination, ...this.form };
|
||||||
delete data.pageSizes;
|
delete data.pageSizes;
|
||||||
delete data.total;
|
delete data.total;
|
||||||
delete data.background;
|
delete data.background;
|
||||||
|
|
||||||
// 获取${classTitle}列表
|
// 获取${classTitle}列表
|
||||||
const result = await fetchGet${originalName}List(data);
|
const result = await fetchGet${originalName}List(data);
|
||||||
|
|
||||||
// 公共页面函数hook
|
// 公共页面函数hook
|
||||||
const pagination = storePagination.bind(this);
|
const pagination = storePagination.bind(this);
|
||||||
return pagination(result);
|
return pagination(result);
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 添加${classTitle} */
|
/** 添加${classTitle} */
|
||||||
async add${originalName}(data: any) {
|
async add${originalName}(data: any) {
|
||||||
const result = await fetchAdd${originalName}(data);
|
const result = await fetchAdd${originalName}(data);
|
||||||
return storeMessage(result);
|
return storeMessage(result);
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 修改${classTitle} */
|
/** 修改${classTitle} */
|
||||||
async update${originalName}(data: any) {
|
async update${originalName}(data: any) {
|
||||||
const result = await fetchUpdate${originalName}(data);
|
const result = await fetchUpdate${originalName}(data);
|
||||||
return storeMessage(result);
|
return storeMessage(result);
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 删除${classTitle} */
|
/** 删除${classTitle} */
|
||||||
async delete${originalName}(data: any) {
|
async delete${originalName}(data: any) {
|
||||||
const result = await fetchDelete${originalName}(data);
|
const result = await fetchDelete${originalName}(data);
|
||||||
return storeMessage(result);
|
return storeMessage(result);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,8 +9,9 @@ logging:
|
||||||
root: info
|
root: info
|
||||||
pattern:
|
pattern:
|
||||||
dateformat: HH:mm:ss:SSS
|
dateformat: HH:mm:ss:SSS
|
||||||
file:
|
# file:
|
||||||
path: "/logs/${spring.application.name}"
|
# path: "logs/${spring.application.name}"
|
||||||
|
# name: "logs/${spring.application.name}"
|
||||||
|
|
||||||
#mybatis-plus:
|
#mybatis-plus:
|
||||||
# configuration:
|
# configuration:
|
||||||
|
|
|
@ -14,8 +14,9 @@ logging:
|
||||||
root: warn
|
root: warn
|
||||||
pattern:
|
pattern:
|
||||||
dateformat: HH:mm:ss:SSS
|
dateformat: HH:mm:ss:SSS
|
||||||
file:
|
# file:
|
||||||
path: "logs/${spring.application.name}"
|
# path: "logs/${spring.application.name}"
|
||||||
|
# name: "logs/${spring.application.name}"
|
||||||
|
|
||||||
# 线上禁用文档
|
# 线上禁用文档
|
||||||
knife4j:
|
knife4j:
|
||||||
|
|
|
@ -14,8 +14,9 @@ logging:
|
||||||
root: warn
|
root: warn
|
||||||
pattern:
|
pattern:
|
||||||
dateformat: HH:mm:ss:SSS
|
dateformat: HH:mm:ss:SSS
|
||||||
file:
|
# file:
|
||||||
path: "logs/${spring.application.name}"
|
# path: "logs/${spring.application.name}"
|
||||||
|
# name: "logs/${spring.application.name}"
|
||||||
|
|
||||||
# 线上禁用文档
|
# 线上禁用文档
|
||||||
knife4j:
|
knife4j:
|
||||||
|
|
|
@ -1,18 +1,34 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration debug="false" xmlns="http://ch.qos.logback/xml/ns/logback"
|
<configuration>
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<contextName>logback</contextName>
|
||||||
xsi:schemaLocation="http://ch.qos.logback/xml/ns/logback
|
|
||||||
https://raw.githubusercontent.com/enricopulatzo/logback-XSD/master/src/main/xsd/logback.xsd">
|
|
||||||
|
|
||||||
<appender name="STOUT" class="ch.qos.logback.core.ConsoleAppender">
|
<!-- 格式化 年-月-日 输出 -->
|
||||||
|
<timestamp key="datetime" datePattern="yyyy-MM-dd"/>
|
||||||
|
|
||||||
|
<!--编码-->
|
||||||
|
<property name="ENCODING" value="UTF-8"/>
|
||||||
|
|
||||||
|
<!-- 控制台日志 -->
|
||||||
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<!-- 临界值过滤器 -->
|
||||||
|
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||||
|
<level>INFO</level>
|
||||||
|
</filter>
|
||||||
<encoder>
|
<encoder>
|
||||||
<pattern>
|
<pattern>%cyan([%thread]) %yellow(%-5level) %green(%logger{100}).%boldRed(%method)-%boldMagenta(%line)- %blue(%msg%n)</pattern>
|
||||||
%cyan([%thread]) %yellow(%-5level) %green(%logger{100}).%boldRed(%method)-%boldMagenta(%line) - %blue(%msg%n)
|
<charset>${ENCODING}</charset>
|
||||||
</pattern>
|
|
||||||
</encoder>
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<!-- additivity:false 禁止重复打印日志 -->
|
<!-- 文件日志 -->
|
||||||
|
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
|
||||||
|
<file>/www/root/server/logs/${datetime}/auth-server.log</file>
|
||||||
|
<append>true</append>
|
||||||
|
<encoder>
|
||||||
|
<pattern>%date{yyyy-MM-dd HH:mm:ss} [%-5level] %thread %file:%line %logger %msg%n</pattern>
|
||||||
|
<charset>${ENCODING}</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
<!-- 让SpringBoot内部日志ERROR级别 减少日志输出 -->
|
<!-- 让SpringBoot内部日志ERROR级别 减少日志输出 -->
|
||||||
<logger name="org.springframework" level="ERROR" additivity="false">
|
<logger name="org.springframework" level="ERROR" additivity="false">
|
||||||
|
@ -35,27 +51,18 @@
|
||||||
</logger>
|
</logger>
|
||||||
|
|
||||||
<!-- 我们自己开发的程序为DEBUG -->
|
<!-- 我们自己开发的程序为DEBUG -->
|
||||||
<logger name="com.redpig" level="DEBUG" additivity="false">
|
<logger name="cn.bunny" level="DEBUG" additivity="false">
|
||||||
<appender-ref ref="STOUT"/>
|
<appender-ref ref="STOUT"/>
|
||||||
</logger>
|
</logger>
|
||||||
|
|
||||||
|
|
||||||
<logger name="com.baomidou" level="ERROR" additivity="false">
|
<logger name="com.baomidou" level="ERROR" additivity="false">
|
||||||
<appender-ref ref="STOUT"/>
|
<appender-ref ref="STOUT"/>
|
||||||
</logger>
|
</logger>
|
||||||
|
|
||||||
<logger name="com.zaxxer" level="ERROR" additivity="false">
|
<!-- 根日志记录器:INFO级别 -->
|
||||||
<appender-ref ref="STOUT"/>
|
<root level="INFO">
|
||||||
</logger>
|
<appender-ref ref="CONSOLE"/>
|
||||||
|
<appender-ref ref="FILE"/>
|
||||||
<!-- Activiti日志 -->
|
|
||||||
<logger name="org.activiti" level="ERROR" />
|
|
||||||
<logger name="org.activiti.engine.impl.persistence.entity" level="DEBUG" />
|
|
||||||
<logger name="_org.springframework" level="ERROR" />
|
|
||||||
<logger name="springfox.documentation" level="ERROR" />
|
|
||||||
|
|
||||||
<!-- root级别开debug 子目录根据需要关闭 -->
|
|
||||||
<root level="DEBUG">
|
|
||||||
<appender-ref ref="STOUT"/>
|
|
||||||
</root>
|
</root>
|
||||||
|
|
||||||
</configuration>
|
</configuration>
|
Loading…
Reference in New Issue