修改系统

This commit is contained in:
huangdeliang 2020-11-25 21:36:44 +08:00
commit e6b6ff145b
570 changed files with 47911 additions and 47241 deletions

BIN
.DS_Store vendored

Binary file not shown.

4
.gitignore vendored
View File

@ -42,4 +42,6 @@ nbdist/
!*/build/*.java !*/build/*.java
!*/build/*.html !*/build/*.html
!*/build/*.xml !*/build/*.xml
running/* running/file/*
running/logs/*
running/uploadPath/*

14
.vscode/launch.json vendored
View File

@ -1,14 +0,0 @@
{
"configurations": [
{
"type": "java",
"name": "Spring Boot-RuoYiApplication<ruoyi-admin>",
"request": "launch",
"cwd": "${workspaceFolder}",
"console": "internalConsole",
"mainClass": "com.ruoyi.RuoYiApplication",
"projectName": "ruoyi-admin",
"args": ""
}
]
}

View File

@ -1,3 +0,0 @@
{
"java.configuration.updateBuildConfiguration": "automatic"
}

7
bin/build-server.sh Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/sh
cd /home/workspace/ShengTangManage
git pull origin master
mvn clean package -Dmaven.test.skip=true -P prod
rm -f /home/api/manage.shengtangdiet.com/st-manage.jar
cp -f ./stdiet-admin/target/stdiet-admin.jar /home/api/manage.shengtangdiet.com/st-manage.jar
nohup java -jar /home/api/manage.shengtangdiet.com/st-manage.jar

7
bin/build-test-server.sh Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/sh
cd /home/workspace/ShengTangManage
git pull origin master
mvn clean package -Dmaven.test.skip=true -P dev
rm -f /home/api/manage.shengtangdiet.com/test/st-manage.jar
cp -f ./ruoyi-admin/target/stdiet-admin.jar /home/api/manage.shengtangdiet.com/test/st-manage.jar
nohup java -jar /home/api/manage.shengtangdiet.co/test/st-manage.jar

7
bin/build-test-web.sh Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/sh
cd /home/workspace/ShengTangManage/stdiet-ui
git pull origin master
yarn
yarn build:stage
rm -rf /home/web/test.stdiet/dist
cp -rf ./dist /home/web/test.stdiet/

7
bin/build-web.sh Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/sh
cd /home/workspace/ShengTangManage/stdiet-ui
git pull origin master
yarn
yarn build:prod
rm -rf /home/web/manage.shengtangdiet.com/dist
cp -rf ./dist /home/web/manage.shengtangdiet.com/

BIN
doc/.DS_Store vendored Normal file

Binary file not shown.

95
pom.xml
View File

@ -3,16 +3,16 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.ruoyi</groupId> <groupId>com.stdiet</groupId>
<artifactId>ruoyi</artifactId> <artifactId>stdiet</artifactId>
<version>3.1.0</version> <version>3.1.0</version>
<name>ruoyi</name> <name>stdiet</name>
<!-- <url>http://www.ruoyi.vip</url> --> <!-- <url>http://www.ruoyi.vip</url> -->
<description>管理系统</description> <description>管理系统</description>
<properties> <properties>
<ruoyi.version>3.1.0</ruoyi.version> <stdiet.version>3.1.0</stdiet.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version> <java.version>1.8</java.version>
@ -148,50 +148,50 @@
<!-- 定时任务--> <!-- 定时任务-->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.stdiet</groupId>
<artifactId>ruoyi-quartz</artifactId> <artifactId>stdiet-quartz</artifactId>
<version>${ruoyi.version}</version> <version>${stdiet.version}</version>
</dependency> </dependency>
<!-- 代码生成--> <!-- 代码生成-->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.stdiet</groupId>
<artifactId>ruoyi-generator</artifactId> <artifactId>stdiet-generator</artifactId>
<version>${ruoyi.version}</version> <version>${stdiet.version}</version>
</dependency> </dependency>
<!-- 核心模块--> <!-- 核心模块-->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.stdiet</groupId>
<artifactId>ruoyi-framework</artifactId> <artifactId>stdiet-framework</artifactId>
<version>${ruoyi.version}</version> <version>${stdiet.version}</version>
</dependency> </dependency>
<!-- 系统模块--> <!-- 系统模块-->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.stdiet</groupId>
<artifactId>ruoyi-system</artifactId> <artifactId>stdiet-system</artifactId>
<version>${ruoyi.version}</version> <version>${stdiet.version}</version>
</dependency> </dependency>
<!-- 通用工具--> <!-- 通用工具-->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.stdiet</groupId>
<artifactId>ruoyi-common</artifactId> <artifactId>stdiet-common</artifactId>
<version>${ruoyi.version}</version> <version>${stdiet.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
<modules> <modules>
<module>ruoyi-admin</module> <module>stdiet-admin</module>
<module>ruoyi-framework</module> <module>stdiet-framework</module>
<module>ruoyi-system</module> <module>stdiet-system</module>
<module>ruoyi-quartz</module> <module>stdiet-quartz</module>
<module>ruoyi-generator</module> <module>stdiet-generator</module>
<module>ruoyi-common</module> <module>stdiet-common</module>
<module>ruoyi-custom</module> <module>stdiet-custom</module>
</modules> </modules>
<packaging>pom</packaging> <packaging>pom</packaging>
@ -207,7 +207,25 @@
<encoding>${project.build.sourceEncoding}</encoding> <encoding>${project.build.sourceEncoding}</encoding>
</configuration> </configuration>
</plugin> </plugin>
<!-- 资源文件处理插件,必须配置 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins> </plugins>
<resources>
<!-- 所有公共资源文件 -->
<resource>
<directory>src/main/resources</directory>
</resource>
<!-- 不同环境的资源文件 -->
<resource>
<directory>src/main/filters/${profileActive}</directory>
</resource>
</resources>
</build> </build>
<repositories> <repositories>
@ -235,4 +253,29 @@
</pluginRepository> </pluginRepository>
</pluginRepositories> </pluginRepositories>
<profiles>
<!-- dev开发环境配置,release为生产环境配置 -->
<profile>
<id>dev</id>
<properties>
<profileActive>dev</profileActive>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>local</id>
<properties>
<profileActive>local</profileActive>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<profileActive>prod</profileActive>
</properties>
</profile>
</profiles>
</project> </project>

BIN
running/.DS_Store vendored

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,61 +0,0 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
# url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# password: wonderdb
# url: jdbc:mysql://47.115.23.82:3306/stdiet?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://localhost:3306/stdiet?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
password: Ttj4fAHU
username: root
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username:
login-password:
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true

2
ry.sh
View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
AppName=ruoyi-admin.jar AppName=stdiet-admin.jar
#JVM参数 #JVM参数
JVM_OPTS="-Dname=$AppName -Duser.timezone=Asia/Shanghai -Xms512M -Xmx512M -XX:PermSize=256M -XX:MaxPermSize=512M -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC" JVM_OPTS="-Dname=$AppName -Duser.timezone=Asia/Shanghai -Xms512M -Xmx512M -XX:PermSize=256M -XX:MaxPermSize=512M -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC"

View File

@ -1,154 +1,137 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<artifactId>ruoyi</artifactId> <artifactId>stdiet</artifactId>
<groupId>com.ruoyi</groupId> <groupId>com.stdiet</groupId>
<version>3.1.0</version> <version>3.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<packaging>war</packaging> <packaging>jar</packaging>
<artifactId>ruoyi-admin</artifactId> <artifactId>stdiet-admin</artifactId>
<description> <description>
web服务入口 web服务入口
</description> </description>
<dependencies> <dependencies>
<!-- spring-boot-devtools --> <!-- spring-boot-devtools -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId> <artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> <!-- 表示依赖不会传递 --> <optional>true</optional> <!-- 表示依赖不会传递 -->
</dependency> </dependency>
<!-- swagger2--> <!-- swagger2-->
<dependency> <dependency>
<groupId>io.springfox</groupId> <groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId> <artifactId>springfox-swagger2</artifactId>
</dependency> </dependency>
<!--防止进入swagger页面报类型转换错误排除2.9.2中的引用手动增加1.5.21版本--> <!--防止进入swagger页面报类型转换错误排除2.9.2中的引用手动增加1.5.21版本-->
<dependency> <dependency>
<groupId>io.swagger</groupId> <groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId> <artifactId>swagger-annotations</artifactId>
<version>1.5.21</version> <version>1.5.21</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.swagger</groupId> <groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId> <artifactId>swagger-models</artifactId>
<version>1.5.21</version> <version>1.5.21</version>
</dependency> </dependency>
<!-- swagger2-UI--> <!-- swagger2-UI-->
<dependency> <dependency>
<groupId>io.springfox</groupId> <groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId> <artifactId>springfox-swagger-ui</artifactId>
</dependency> </dependency>
<!-- Mysql驱动包 --> <!-- Mysql驱动包 -->
<dependency> <dependency>
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
</dependency> </dependency>
<!-- 核心模块--> <!-- 核心模块-->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.stdiet</groupId>
<artifactId>ruoyi-framework</artifactId> <artifactId>stdiet-framework</artifactId>
</dependency> </dependency>
<!-- 定时任务--> <!-- 定时任务-->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.stdiet</groupId>
<artifactId>ruoyi-quartz</artifactId> <artifactId>stdiet-quartz</artifactId>
</dependency> </dependency>
<!-- 代码生成--> <!-- 代码生成-->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.stdiet</groupId>
<artifactId>ruoyi-generator</artifactId> <artifactId>stdiet-generator</artifactId>
</dependency> </dependency>
<!-- Java 6 = JAX-B Version 2.0 --> <!-- Java 6 = JAX-B Version 2.0 -->
<!-- Java 7 = JAX-B Version 2.2.3 --> <!-- Java 7 = JAX-B Version 2.2.3 -->
<!-- Java 8 = JAX-B Version 2.2.8 --> <!-- Java 8 = JAX-B Version 2.2.8 -->
<dependency> <dependency>
<groupId>javax.xml.bind</groupId> <groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId> <artifactId>jaxb-api</artifactId>
<version>2.3.0</version> <version>2.3.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.sun.xml.bind</groupId> <groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId> <artifactId>jaxb-impl</artifactId>
<version>2.3.0</version> <version>2.3.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.sun.xml.bind</groupId> <groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId> <artifactId>jaxb-core</artifactId>
<version>2.3.0</version> <version>2.3.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.activation</groupId> <groupId>javax.activation</groupId>
<artifactId>activation</artifactId> <artifactId>activation</artifactId>
<version>1.1.1</version> <version>1.1.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.stdiet</groupId>
<artifactId>ruoyi-custom</artifactId> <artifactId>stdiet-custom</artifactId>
<version>3.1.0</version> <version>3.1.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<!-- 多模块排除内置tomcat --> </dependencies>
<dependency>
<groupId>org.springframework.boot</groupId> <build>
<artifactId>spring-boot-starter-web</artifactId> <plugins>
<exclusions> <plugin>
<exclusion> <groupId>org.springframework.boot</groupId>
<groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId>
<artifactId>spring-boot-starter-tomcat</artifactId> <version>2.1.1.RELEASE</version>
</exclusion> <configuration>
</exclusions> <fork>true</fork> <!-- 如果没有该配置devtools不会生效 -->
</dependency> </configuration>
<dependency> <executions>
<groupId>org.springframework.boot</groupId> <execution>
<artifactId>spring-boot-starter-tomcat</artifactId> <goals>
<scope>provided</scope> <goal>repackage</goal>
</dependency> </goals>
</execution>
</dependencies> </executions>
</plugin>
<build> <plugin>
<plugins> <groupId>org.apache.maven.plugins</groupId>
<plugin> <artifactId>maven-war-plugin</artifactId>
<groupId>org.springframework.boot</groupId> <version>3.1.0</version>
<artifactId>spring-boot-maven-plugin</artifactId> <configuration>
<version>2.1.1.RELEASE</version> <failOnMissingWebXml>false</failOnMissingWebXml>
<configuration> <warName>${project.artifactId}</warName>
<fork>true</fork> <!-- 如果没有该配置devtools不会生效 --> </configuration>
</configuration> </plugin>
<executions> </plugins>
<execution> <finalName>${project.artifactId}</finalName>
<goals> </build>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<warName>${project.artifactId}</warName>
</configuration>
</plugin>
</plugins>
<finalName>${project.artifactId}</finalName>
</build>
</project> </project>

View File

@ -1,120 +1,173 @@
# 项目相关配置 # 项目相关配置
ruoyi: stdiet:
# 名称 # 名称
name: Ruoyi name: Stdiet
# 版本 # 版本
version: 3.1.0 version: 3.1.0
# 版权年份 # 版权年份
copyrightYear: 2020 copyrightYear: 2020
# 实例演示开关 # 实例演示开关
demoEnabled: true demoEnabled: true
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath # 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath
# profile: /Users/wonder/Documents/Workspaces/java/RuoYi-Vue/running/uploadPath profile: /home/api/manage.shengtangdiet.com/test/uploadPath
profile: /home/api/manage.shengtangdiet.com/uploadPath # 获取ip地址开关
# 获取ip地址开关 addressEnabled: false
addressEnabled: false # 验证码类型 math 数组计算 char 字符验证
# 验证码类型 math 数组计算 char 字符验证 captchaType: math
captchaType: math
# 开发环境配置
# 开发环境配置 server:
server: # 服务器的HTTP端口默认为8080
# 服务器的HTTP端口默认为8080 port: 8091
port: 8090 servlet:
servlet: # 应用的访问路径
# 应用的访问路径 context-path: /
context-path: / tomcat:
tomcat: # tomcat的URI编码
# tomcat的URI编码 uri-encoding: UTF-8
uri-encoding: UTF-8 # tomcat最大线程数默认为200
# tomcat最大线程数默认为200 max-threads: 800
max-threads: 800 # Tomcat启动初始化的线程数默认值25
# Tomcat启动初始化的线程数默认值25 min-spare-threads: 30
min-spare-threads: 30
# 日志配置
# 日志配置 logging:
logging: level:
level: com.stdiet: debug
com.ruoyi: debug org.springframework: warn
org.springframework: warn
# Spring配置
# Spring配置 spring:
spring: # 资源信息
# 资源信息 messages:
messages: # 国际化资源文件路径
# 国际化资源文件路径 basename: i18n/messages
basename: i18n/messages profiles:
profiles: active: druid
active: druid # 文件上传
# 文件上传 servlet:
servlet: multipart:
multipart: # 单个文件大小
# 单个文件大小 max-file-size: 10MB
max-file-size: 10MB # 设置总上传的文件大小
# 设置总上传的文件大小 max-request-size: 20MB
max-request-size: 20MB # 服务模块
# 服务模块 devtools:
devtools: restart:
restart: # 热部署开关
# 热部署开关 enabled: true
enabled: true # redis 配置
# redis 配置 redis:
redis: # 地址
# 地址 host: localhost
host: localhost # 端口默认为6379
# 端口默认为6379 port: 6379
port: 6379 # 密码
# 密码 password:
password: # 连接超时时间
# 连接超时时间 timeout: 10s
timeout: 10s lettuce:
lettuce: pool:
pool: # 连接池中的最小空闲连接
# 连接池中的最小空闲连接 min-idle: 0
min-idle: 0 # 连接池中的最大空闲连接
# 连接池中的最大空闲连接 max-idle: 8
max-idle: 8 # 连接池的最大数据库连接数
# 连接池的最大数据库连接数 max-active: 8
max-active: 8 # #连接池最大阻塞等待时间(使用负值表示没有限制)
# #连接池最大阻塞等待时间(使用负值表示没有限制) max-wait: -1ms
max-wait: -1ms datasource:
type: com.alibaba.druid.pool.DruidDataSource
# token配置 driverClassName: com.mysql.cj.jdbc.Driver
token: druid:
# 令牌自定义标识 # 主库数据源
header: Authorization master:
# 令牌密钥 url: jdbc:mysql://localhost:3306/stdiet_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
secret: abcdefghijklmnopqrstuvwxyz password: Ttj4fAHU
# 令牌有效期默认30分钟 username: root
expireTime: 30 slave:
# 从数据源开关/默认关闭
# MyBatis配置 enabled: false
mybatis: url:
# 搜索指定包别名 username:
typeAliasesPackage: com.ruoyi.**.domain password:
# 配置mapper的扫描找到所有的mapper.xml映射文件 # 初始连接数
mapperLocations: classpath*:mapper/**/*Mapper.xml initialSize: 5
# 加载全局的配置文件 # 最小连接池数量
configLocation: classpath:mybatis/mybatis-config.xml minIdle: 10
# 最大连接池数量
# PageHelper分页插件 maxActive: 20
pagehelper: # 配置获取连接等待超时的时间
helperDialect: mysql maxWait: 60000
reasonable: true # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
supportMethodsArguments: true timeBetweenEvictionRunsMillis: 60000
params: count=countSql # 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# Swagger配置 # 配置一个连接在池中最大生存的时间,单位是毫秒
swagger: maxEvictableIdleTimeMillis: 900000
# 是否开启swagger # 配置检测连接是否有效
enabled: true validationQuery: SELECT 1 FROM DUAL
# 请求前缀 testWhileIdle: true
pathMapping: /dev-api testOnBorrow: false
testOnReturn: false
# 防止XSS攻击 webStatFilter:
xss: enabled: true
# 过滤开关 statViewServlet:
enabled: true enabled: true
# 排除链接(多个用逗号分隔) # 设置白名单,不填则允许所有访问
excludes: /system/notice/* allow:
# 匹配链接 url-pattern: /druid/*
urlPatterns: /system/*,/monitor/*,/tool/* # 控制台管理用户名和密码
login-username:
login-password:
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
# token配置
token:
# 令牌自定义标识
header: Authorization
# 令牌密钥
secret: shengtangdiet
# 令牌有效期默认30分钟
expireTime: 30
# MyBatis配置
mybatis:
# 搜索指定包别名
typeAliasesPackage: com.stdiet.**.domain
# 配置mapper的扫描找到所有的mapper.xml映射文件
mapperLocations: classpath*:mapper/**/*Mapper.xml
# 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml
# PageHelper分页插件
pagehelper:
helperDialect: mysql
reasonable: true
supportMethodsArguments: true
params: count=countSql
# Swagger配置
swagger:
# 是否开启swagger
enabled: true
# 请求前缀
pathMapping: /dev-api
# 防止XSS攻击
xss:
# 过滤开关
enabled: true
# 排除链接(多个用逗号分隔)
excludes: /system/notice/*
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 日志存放路径 -->
<property name="log.path" value="/home/api/manage.shengtangdiet.com/test/logs" />
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 用户访问日志输出 -->
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-user.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 按天回滚 daily -->
<fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.stdiet" level="info" />
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn" />
<root level="info">
<appender-ref ref="console" />
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info" />
<appender-ref ref="file_error" />
</root>
<!--系统用户操作日志-->
<logger name="sys-user" level="info">
<appender-ref ref="sys-user"/>
</logger>
</configuration>

View File

@ -0,0 +1,173 @@
# 项目相关配置
stdiet:
# 名称
name: Stdiet
# 版本
version: 3.1.0
# 版权年份
copyrightYear: 2020
# 实例演示开关
demoEnabled: true
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath
profile: /Users/wonder/Documents/Workspaces/java/ShengtangManage/running/uploadPath
# 获取ip地址开关
addressEnabled: false
# 验证码类型 math 数组计算 char 字符验证
captchaType: math
# 开发环境配置
server:
# 服务器的HTTP端口默认为8080
port: 8090
servlet:
# 应用的访问路径
context-path: /
tomcat:
# tomcat的URI编码
uri-encoding: UTF-8
# tomcat最大线程数默认为200
max-threads: 800
# Tomcat启动初始化的线程数默认值25
min-spare-threads: 30
# 日志配置
logging:
level:
com.stdiet: debug
org.springframework: warn
# Spring配置
spring:
# 资源信息
messages:
# 国际化资源文件路径
basename: i18n/messages
profiles:
active: druid
# 文件上传
servlet:
multipart:
# 单个文件大小
max-file-size: 10MB
# 设置总上传的文件大小
max-request-size: 20MB
# 服务模块
devtools:
restart:
# 热部署开关
enabled: true
# redis 配置
redis:
# 地址
host: localhost
# 端口默认为6379
port: 6379
# 密码
password:
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
url: jdbc:mysql://localhost:3306/stdiet?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
password: wonderdb
username: root
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username:
login-password:
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
# token配置
token:
# 令牌自定义标识
header: Authorization
# 令牌密钥
secret: shengtangdiet
# 令牌有效期默认30分钟
expireTime: 30
# MyBatis配置
mybatis:
# 搜索指定包别名
typeAliasesPackage: com.stdiet.**.domain
# 配置mapper的扫描找到所有的mapper.xml映射文件
mapperLocations: classpath*:mapper/**/*Mapper.xml
# 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml
# PageHelper分页插件
pagehelper:
helperDialect: mysql
reasonable: true
supportMethodsArguments: true
params: count=countSql
# Swagger配置
swagger:
# 是否开启swagger
enabled: true
# 请求前缀
pathMapping: /dev-api
# 防止XSS攻击
xss:
# 过滤开关
enabled: true
# 排除链接(多个用逗号分隔)
excludes: /system/notice/*
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 日志存放路径 -->
<property name="log.path" value="/Users/wonder/Documents/Workspaces/node/ShengtangMange/running/logs" />
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 用户访问日志输出 -->
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-user.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 按天回滚 daily -->
<fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.stdiet" level="info" />
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn" />
<root level="info">
<appender-ref ref="console" />
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info" />
<appender-ref ref="file_error" />
</root>
<!--系统用户操作日志-->
<logger name="sys-user" level="info">
<appender-ref ref="sys-user"/>
</logger>
</configuration>

View File

@ -0,0 +1,173 @@
# 项目相关配置
stdiet:
# 名称
name: Stdiet
# 版本
version: 3.1.0
# 版权年份
copyrightYear: 2020
# 实例演示开关
demoEnabled: true
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath
profile: /home/api/manage.shengtangdiet.com/uploadPath
# 获取ip地址开关
addressEnabled: false
# 验证码类型 math 数组计算 char 字符验证
captchaType: math
# 开发环境配置
server:
# 服务器的HTTP端口默认为8080
port: 8091
servlet:
# 应用的访问路径
context-path: /
tomcat:
# tomcat的URI编码
uri-encoding: UTF-8
# tomcat最大线程数默认为200
max-threads: 800
# Tomcat启动初始化的线程数默认值25
min-spare-threads: 30
# 日志配置
logging:
level:
com.stdiet: debug
org.springframework: warn
# Spring配置
spring:
# 资源信息
messages:
# 国际化资源文件路径
basename: i18n/messages
profiles:
active: druid
# 文件上传
servlet:
multipart:
# 单个文件大小
max-file-size: 10MB
# 设置总上传的文件大小
max-request-size: 20MB
# 服务模块
devtools:
restart:
# 热部署开关
enabled: true
# redis 配置
redis:
# 地址
host: localhost
# 端口默认为6379
port: 6379
# 密码
password:
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
url: jdbc:mysql://localhost:3306/stdiet?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
password: Ttj4fAHU
username: root
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username:
login-password:
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
# token配置
token:
# 令牌自定义标识
header: Authorization
# 令牌密钥
secret: shengtangdiet
# 令牌有效期默认30分钟
expireTime: 30
# MyBatis配置
mybatis:
# 搜索指定包别名
typeAliasesPackage: com.stdiet.**.domain
# 配置mapper的扫描找到所有的mapper.xml映射文件
mapperLocations: classpath*:mapper/**/*Mapper.xml
# 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml
# PageHelper分页插件
pagehelper:
helperDialect: mysql
reasonable: true
supportMethodsArguments: true
params: count=countSql
# Swagger配置
swagger:
# 是否开启swagger
enabled: true
# 请求前缀
pathMapping: /dev-api
# 防止XSS攻击
xss:
# 过滤开关
enabled: true
# 排除链接(多个用逗号分隔)
excludes: /system/notice/*
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*

View File

@ -1,94 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<configuration> <configuration>
<!-- 日志存放路径 --> <!-- 日志存放路径 -->
<!-- <property name="log.path" value="/Users/wonder/Documents/Workspaces/node/RuoYi-Vue/running/logs" />--> <property name="log.path" value="/home/api/manage.shengtangdiet.com/logs" />
<property name="log.path" value="/home/api/manage.shengtangdiet.com/logs" /> <!-- 日志输出格式 -->
<!-- 日志输出格式 --> <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
<!-- 控制台输出 -->
<!-- 控制台输出 --> <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> <encoder>
<encoder> <pattern>${log.pattern}</pattern>
<pattern>${log.pattern}</pattern> </encoder>
</encoder> </appender>
</appender>
<!-- 系统日志输出 -->
<!-- 系统日志输出 --> <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${log.path}/sys-info.log</file>
<file>${log.path}/sys-info.log</file> <!-- 循环政策:基于时间创建日志文件 -->
<!-- 循环政策:基于时间创建日志文件 --> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <!-- 日志文件名格式 -->
<!-- 日志文件名格式 --> <fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern> <!-- 日志最大的历史 60天 -->
<!-- 日志最大的历史 60天 --> <maxHistory>60</maxHistory>
<maxHistory>60</maxHistory> </rollingPolicy>
</rollingPolicy> <encoder>
<encoder> <pattern>${log.pattern}</pattern>
<pattern>${log.pattern}</pattern> </encoder>
</encoder> <filter class="ch.qos.logback.classic.filter.LevelFilter">
<filter class="ch.qos.logback.classic.filter.LevelFilter"> <!-- 过滤的级别 -->
<!-- 过滤的级别 --> <level>INFO</level>
<level>INFO</level> <!-- 匹配时的操作:接收(记录) -->
<!-- 匹配时的操作:接收(记录) --> <onMatch>ACCEPT</onMatch>
<onMatch>ACCEPT</onMatch> <!-- 不匹配时的操作:拒绝(不记录) -->
<!-- 不匹配时的操作:拒绝(不记录) --> <onMismatch>DENY</onMismatch>
<onMismatch>DENY</onMismatch> </filter>
</filter> </appender>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${log.path}/sys-error.log</file>
<file>${log.path}/sys-error.log</file> <!-- 循环政策:基于时间创建日志文件 -->
<!-- 循环政策:基于时间创建日志文件 --> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <!-- 日志文件名格式 -->
<!-- 日志文件名格式 --> <fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern> <!-- 日志最大的历史 60天 -->
<!-- 日志最大的历史 60天 --> <maxHistory>60</maxHistory>
<maxHistory>60</maxHistory> </rollingPolicy>
</rollingPolicy> <encoder>
<encoder> <pattern>${log.pattern}</pattern>
<pattern>${log.pattern}</pattern> </encoder>
</encoder> <filter class="ch.qos.logback.classic.filter.LevelFilter">
<filter class="ch.qos.logback.classic.filter.LevelFilter"> <!-- 过滤的级别 -->
<!-- 过滤的级别 --> <level>ERROR</level>
<level>ERROR</level> <!-- 匹配时的操作:接收(记录) -->
<!-- 匹配时的操作:接收(记录) --> <onMatch>ACCEPT</onMatch>
<onMatch>ACCEPT</onMatch> <!-- 不匹配时的操作:拒绝(不记录) -->
<!-- 不匹配时的操作:拒绝(不记录) --> <onMismatch>DENY</onMismatch>
<onMismatch>DENY</onMismatch> </filter>
</filter> </appender>
</appender>
<!-- 用户访问日志输出 -->
<!-- 用户访问日志输出 --> <appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${log.path}/sys-user.log</file>
<file>${log.path}/sys-user.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <!-- 按天回滚 daily -->
<!-- 按天回滚 daily --> <fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
<fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern> <!-- 日志最大的历史 60天 -->
<!-- 日志最大的历史 60天 --> <maxHistory>60</maxHistory>
<maxHistory>60</maxHistory> </rollingPolicy>
</rollingPolicy> <encoder>
<encoder> <pattern>${log.pattern}</pattern>
<pattern>${log.pattern}</pattern> </encoder>
</encoder> </appender>
</appender>
<!-- 系统模块日志级别控制 -->
<!-- 系统模块日志级别控制 --> <logger name="com.stdiet" level="info" />
<logger name="com.ruoyi" level="info" /> <!-- Spring日志级别控制 -->
<!-- Spring日志级别控制 --> <logger name="org.springframework" level="warn" />
<logger name="org.springframework" level="warn" />
<root level="info">
<root level="info"> <appender-ref ref="console" />
<appender-ref ref="console" /> </root>
</root>
<!--系统操作日志-->
<!--系统操作日志--> <root level="info">
<root level="info"> <appender-ref ref="file_info" />
<appender-ref ref="file_info" /> <appender-ref ref="file_error" />
<appender-ref ref="file_error" /> </root>
</root>
<!--系统用户操作日志-->
<!--系统用户操作日志--> <logger name="sys-user" level="info">
<logger name="sys-user" level="info"> <appender-ref ref="sys-user"/>
<appender-ref ref="sys-user"/> </logger>
</logger>
</configuration> </configuration>

View File

@ -1,30 +1,30 @@
package com.ruoyi; package com.stdiet;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
/** /**
* 启动程序 * 启动程序
* *
* @author ruoyi * @author ruoyi
*/ */
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class RuoYiApplication public class StdietApplication
{ {
public static void main(String[] args) public static void main(String[] args)
{ {
// System.setProperty("spring.devtools.restart.enabled", "false"); // System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(RuoYiApplication.class, args); SpringApplication.run(StdietApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 启动成功 ლ(´ڡ`ლ)゙ \n" + System.out.println("(♥◠‿◠)ノ゙ 启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" + " .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" + " | _ _ \\ \\ \\ / / \n" +
" | ( ' ) | \\ _. / ' \n" + " | ( ' ) | \\ _. / ' \n" +
" |(_ o _) / _( )_ .' \n" + " |(_ o _) / _( )_ .' \n" +
" | (_,_).' __ ___(_ o _)' \n" + " | (_,_).' __ ___(_ o _)' \n" +
" | |\\ \\ | || |(_,_)' \n" + " | |\\ \\ | || |(_,_)' \n" +
" | | \\ `' /| `-' / \n" + " | | \\ `' /| `-' / \n" +
" | | \\ / \\ / \n" + " | | \\ / \\ / \n" +
" ''-' `'-' `-..-' "); " ''-' `'-' `-..-' ");
} }
} }

View File

@ -1,18 +1,18 @@
package com.ruoyi; package com.stdiet;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
/** /**
* web容器中进行部署 * web容器中进行部署
* *
* @author ruoyi * @author ruoyi
*/ */
public class RuoYiServletInitializer extends SpringBootServletInitializer public class StdietServletInitializer extends SpringBootServletInitializer
{ {
@Override @Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
{ {
return application.sources(RuoYiApplication.class); return application.sources(StdietApplication.class);
} }
} }

View File

@ -1,86 +1,86 @@
package com.ruoyi.web.controller.common; package com.stdiet.web.controller.common;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.FastByteArrayOutputStream; import org.springframework.util.FastByteArrayOutputStream;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.google.code.kaptcha.Producer; import com.google.code.kaptcha.Producer;
import com.ruoyi.common.constant.Constants; import com.stdiet.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult; import com.stdiet.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache; import com.stdiet.common.core.redis.RedisCache;
import com.ruoyi.common.utils.sign.Base64; import com.stdiet.common.utils.sign.Base64;
import com.ruoyi.common.utils.uuid.IdUtils; import com.stdiet.common.utils.uuid.IdUtils;
/** /**
* 验证码操作处理 * 验证码操作处理
* *
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
public class CaptchaController public class CaptchaController
{ {
@Resource(name = "captchaProducer") @Resource(name = "captchaProducer")
private Producer captchaProducer; private Producer captchaProducer;
@Resource(name = "captchaProducerMath") @Resource(name = "captchaProducerMath")
private Producer captchaProducerMath; private Producer captchaProducerMath;
@Autowired @Autowired
private RedisCache redisCache; private RedisCache redisCache;
// 验证码类型 // 验证码类型
@Value("${ruoyi.captchaType}") @Value("${stdiet.captchaType}")
private String captchaType; private String captchaType;
/** /**
* 生成验证码 * 生成验证码
*/ */
@GetMapping("/captchaImage") @GetMapping("/captchaImage")
public AjaxResult getCode(HttpServletResponse response) throws IOException public AjaxResult getCode(HttpServletResponse response) throws IOException
{ {
// 保存验证码信息 // 保存验证码信息
String uuid = IdUtils.simpleUUID(); String uuid = IdUtils.simpleUUID();
String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid; String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
String capStr = null, code = null; String capStr = null, code = null;
BufferedImage image = null; BufferedImage image = null;
// 生成验证码 // 生成验证码
if ("math".equals(captchaType)) if ("math".equals(captchaType))
{ {
String capText = captchaProducerMath.createText(); String capText = captchaProducerMath.createText();
capStr = capText.substring(0, capText.lastIndexOf("@")); capStr = capText.substring(0, capText.lastIndexOf("@"));
code = capText.substring(capText.lastIndexOf("@") + 1); code = capText.substring(capText.lastIndexOf("@") + 1);
image = captchaProducerMath.createImage(capStr); image = captchaProducerMath.createImage(capStr);
} }
else if ("char".equals(captchaType)) else if ("char".equals(captchaType))
{ {
capStr = code = captchaProducer.createText(); capStr = code = captchaProducer.createText();
image = captchaProducer.createImage(capStr); image = captchaProducer.createImage(capStr);
} }
redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
// 转换流信息写出 // 转换流信息写出
FastByteArrayOutputStream os = new FastByteArrayOutputStream(); FastByteArrayOutputStream os = new FastByteArrayOutputStream();
try try
{ {
ImageIO.write(image, "jpg", os); ImageIO.write(image, "jpg", os);
} }
catch (IOException e) catch (IOException e)
{ {
return AjaxResult.error(e.getMessage()); return AjaxResult.error(e.getMessage());
} }
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
ajax.put("uuid", uuid); ajax.put("uuid", uuid);
ajax.put("img", Base64.encode(os.toByteArray())); ajax.put("img", Base64.encode(os.toByteArray()));
return ajax; return ajax;
} }
} }

View File

@ -1,100 +1,100 @@
package com.ruoyi.web.controller.common; package com.stdiet.web.controller.common;
import com.ruoyi.common.config.RuoYiConfig; import com.stdiet.common.config.RuoYiConfig;
import com.ruoyi.common.constant.Constants; import com.stdiet.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult; import com.stdiet.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils; import com.stdiet.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils; import com.stdiet.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils; import com.stdiet.common.utils.file.FileUtils;
import com.ruoyi.framework.config.ServerConfig; import com.stdiet.framework.config.ServerConfig;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
/** /**
* 通用请求处理 * 通用请求处理
* *
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
public class CommonController { public class CommonController {
private static final Logger log = LoggerFactory.getLogger(CommonController.class); private static final Logger log = LoggerFactory.getLogger(CommonController.class);
@Autowired @Autowired
private ServerConfig serverConfig; private ServerConfig serverConfig;
/** /**
* 通用下载请求 * 通用下载请求
* *
* @param fileName 文件名称 * @param fileName 文件名称
* @param delete 是否删除 * @param delete 是否删除
*/ */
@GetMapping("common/download") @GetMapping("common/download")
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) { public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) {
try { try {
if (!FileUtils.isValidFilename(fileName)) { if (!FileUtils.isValidFilename(fileName)) {
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName)); throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
} }
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
String filePath = RuoYiConfig.getDownloadPath() + fileName; String filePath = RuoYiConfig.getDownloadPath() + fileName;
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
response.setContentType("multipart/form-data"); response.setContentType("multipart/form-data");
response.setHeader("Content-Disposition", response.setHeader("Content-Disposition",
"attachment;fileName=" + FileUtils.setFileDownloadHeader(request, realFileName)); "attachment;fileName=" + FileUtils.setFileDownloadHeader(request, realFileName));
FileUtils.writeBytes(filePath, response.getOutputStream()); FileUtils.writeBytes(filePath, response.getOutputStream());
if (delete) { if (delete) {
FileUtils.deleteFile(filePath); FileUtils.deleteFile(filePath);
} }
} catch (Exception e) { } catch (Exception e) {
log.error("下载文件失败", e); log.error("下载文件失败", e);
} }
} }
/** /**
* 通用上传请求 * 通用上传请求
*/ */
@PostMapping("/common/upload") @PostMapping("/common/upload")
public AjaxResult uploadFile(MultipartFile file) throws Exception { public AjaxResult uploadFile(MultipartFile file) throws Exception {
try { try {
// 上传文件路径 // 上传文件路径
String filePath = RuoYiConfig.getUploadPath(); String filePath = RuoYiConfig.getUploadPath();
// 上传并返回新文件名称 // 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file); String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName; String url = serverConfig.getUrl() + fileName;
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
ajax.put("fileName", fileName); ajax.put("fileName", fileName);
ajax.put("url", url); ajax.put("url", url);
return ajax; return ajax;
} catch (Exception e) { } catch (Exception e) {
return AjaxResult.error(e.getMessage()); return AjaxResult.error(e.getMessage());
} }
} }
/** /**
* 本地资源通用下载 * 本地资源通用下载
*/ */
@GetMapping("/common/download/resource") @GetMapping("/common/download/resource")
public void resourceDownload(String name, HttpServletRequest request, HttpServletResponse response) throws Exception { public void resourceDownload(String name, HttpServletRequest request, HttpServletResponse response) throws Exception {
// 本地资源路径 // 本地资源路径
String localPath = RuoYiConfig.getProfile(); String localPath = RuoYiConfig.getProfile();
// 数据库资源地址 // 数据库资源地址
String downloadPath = localPath + StringUtils.substringAfter(name, Constants.RESOURCE_PREFIX); String downloadPath = localPath + StringUtils.substringAfter(name, Constants.RESOURCE_PREFIX);
// 下载名称 // 下载名称
String downloadName = StringUtils.substringAfterLast(downloadPath, "/"); String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
response.setContentType("multipart/form-data"); response.setContentType("multipart/form-data");
response.setHeader("Content-Disposition", response.setHeader("Content-Disposition",
"attachment;fileName=" + FileUtils.setFileDownloadHeader(request, downloadName)); "attachment;fileName=" + FileUtils.setFileDownloadHeader(request, downloadName));
FileUtils.writeBytes(downloadPath, response.getOutputStream()); FileUtils.writeBytes(downloadPath, response.getOutputStream());
} }
} }

View File

@ -1,9 +1,9 @@
package com.ruoyi.web.controller.custom; package com.stdiet.web.controller.custom;
import com.ruoyi.common.core.controller.BaseController; import com.stdiet.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.stdiet.common.core.domain.AjaxResult;
import com.ruoyi.custom.domain.CusUserPost; import com.stdiet.custom.domain.CusUserPost;
import com.ruoyi.custom.service.ICusUserPostService; import com.stdiet.custom.service.ICusUserPostService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;

View File

@ -0,0 +1,21 @@
package com.stdiet.web.controller.custom;
import com.stdiet.common.core.controller.BaseController;
import com.stdiet.custom.domain.WxPush;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/wx")
public class CusWxController extends BaseController {
// @GetMapping("/push")
// public String msgPushTest(@PathVariable("echostr") String echostr) {
// return echostr;
// }
//
// @PostMapping("/push")
// public void msgPush(@RequestBody WxPush pushMsg) {
//
// }
}

View File

@ -1,184 +1,184 @@
package com.ruoyi.web.controller.custom; package com.stdiet.web.controller.custom;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
import com.ruoyi.framework.web.domain.server.Sys; import com.stdiet.framework.web.domain.server.Sys;
import com.ruoyi.system.domain.CusSalesman; import com.stdiet.system.domain.CusSalesman;
import com.ruoyi.system.service.ISysUserService; import com.stdiet.system.service.ISysUserService;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.stdiet.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.stdiet.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.stdiet.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType; import com.stdiet.common.enums.BusinessType;
import com.ruoyi.custom.domain.SysCommision; import com.stdiet.custom.domain.SysCommision;
import com.ruoyi.custom.service.ISysCommisionService; import com.stdiet.custom.service.ISysCommisionService;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.stdiet.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo; import com.stdiet.common.core.page.TableDataInfo;
/** /**
* 业务提成比例Controller * 业务提成比例Controller
* *
* @author wonder * @author wonder
* @date 2020-09-24 * @date 2020-09-24
*/ */
@RestController @RestController
@RequestMapping("/custom/commision") @RequestMapping("/custom/commision")
public class SysCommisionController extends BaseController { public class SysCommisionController extends BaseController {
@Autowired @Autowired
private ISysCommisionService sysCommisionService; private ISysCommisionService sysCommisionService;
@Autowired @Autowired
private ISysUserService userService; private ISysUserService userService;
/** /**
* 查询业务提成比例列表 * 查询业务提成比例列表
*/ */
@PreAuthorize("@ss.hasPermi('commision:config:list')") @PreAuthorize("@ss.hasPermi('commision:config:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysCommision sysCommision) { public TableDataInfo list(SysCommision sysCommision) {
startPage(); startPage();
List<SysCommision> list = sysCommisionService.selectSysCommisionList(sysCommision); List<SysCommision> list = sysCommisionService.selectSysCommisionList(sysCommision);
return getDataTable(list); return getDataTable(list);
} }
/** /**
* 导出业务提成比例列表 * 导出业务提成比例列表
*/ */
@PreAuthorize("@ss.hasPermi('commision:config:export')") @PreAuthorize("@ss.hasPermi('commision:config:export')")
@Log(title = "业务提成比例", businessType = BusinessType.EXPORT) @Log(title = "业务提成比例", businessType = BusinessType.EXPORT)
@GetMapping("/export") @GetMapping("/export")
public AjaxResult export(SysCommision sysCommision) { public AjaxResult export(SysCommision sysCommision) {
// List<SysCommision> list = sysCommisionService.selectSysCommisionList(sysCommision); // List<SysCommision> list = sysCommisionService.selectSysCommisionList(sysCommision);
ExcelUtil<SysCommision> util = new ExcelUtil<SysCommision>(SysCommision.class); ExcelUtil<SysCommision> util = new ExcelUtil<SysCommision>(SysCommision.class);
List<SysCommision> list = sysCommisionService.selectSysCommisionDetail(sysCommision); List<SysCommision> list = sysCommisionService.selectSysCommisionDetail(sysCommision);
for (SysCommision detail : list) { for (SysCommision detail : list) {
detail.setRate(0F); detail.setRate(0F);
SysCommision tmpQueryCom = new SysCommision(); SysCommision tmpQueryCom = new SysCommision();
tmpQueryCom.setUserId(detail.getUserId()); tmpQueryCom.setUserId(detail.getUserId());
tmpQueryCom.setPostId(detail.getPostId()); tmpQueryCom.setPostId(detail.getPostId());
List<SysCommision> tmpComList = sysCommisionService.selectSysCommisionList(tmpQueryCom); List<SysCommision> tmpComList = sysCommisionService.selectSysCommisionList(tmpQueryCom);
float dAmount = detail.getAmount().floatValue(); float dAmount = detail.getAmount().floatValue();
for (int i = 0; i < tmpComList.size(); i++) { for (int i = 0; i < tmpComList.size(); i++) {
SysCommision com = tmpComList.get(i); SysCommision com = tmpComList.get(i);
float cAmount = com.getAmount().floatValue(); float cAmount = com.getAmount().floatValue();
if (dAmount <= cAmount && i == 0) { if (dAmount <= cAmount && i == 0) {
// 第一条规则 // 第一条规则
detail.setRate(com.getRate()); detail.setRate(com.getRate());
break; break;
} else if (i == tmpComList.size() - 1 && dAmount > cAmount) { } else if (i == tmpComList.size() - 1 && dAmount > cAmount) {
// 最后一条规则 // 最后一条规则
detail.setRate(com.getRate()); detail.setRate(com.getRate());
break; break;
} else if (cAmount < dAmount && dAmount <= tmpComList.get(i + 1).getAmount().floatValue()) { } else if (cAmount < dAmount && dAmount <= tmpComList.get(i + 1).getAmount().floatValue()) {
// 中间规则 // 中间规则
detail.setRate(tmpComList.get(i + 1).getRate()); detail.setRate(tmpComList.get(i + 1).getRate());
break; break;
} }
} }
float amount = detail.getAmount().floatValue(); float amount = detail.getAmount().floatValue();
amount = amount * detail.getRate() / 100F; amount = amount * detail.getRate() / 100F;
detail.setCommision(new BigDecimal(amount)); detail.setCommision(new BigDecimal(amount));
} }
return util.exportExcel(list, "commision"); return util.exportExcel(list, "commision");
} }
/** /**
* 获取业务提成比例详细信息 * 获取业务提成比例详细信息
*/ */
@PreAuthorize("@ss.hasPermi('commision:config:query')") @PreAuthorize("@ss.hasPermi('commision:config:query')")
@GetMapping(value = "/{ruleId}") @GetMapping(value = "/{ruleId}")
public AjaxResult getInfo(@PathVariable("ruleId") Long ruleId, SysCommision sysCommision) { public AjaxResult getInfo(@PathVariable("ruleId") Long ruleId, SysCommision sysCommision) {
sysCommision.setRuleId(ruleId); sysCommision.setRuleId(ruleId);
// System.out.println(sysCommision); // System.out.println(sysCommision);
return AjaxResult.success(sysCommisionService.selectSysCommisionById(sysCommision)); return AjaxResult.success(sysCommisionService.selectSysCommisionById(sysCommision));
} }
/** /**
* 新增业务提成比例 * 新增业务提成比例
*/ */
@PreAuthorize("@ss.hasPermi('commision:config:add')") @PreAuthorize("@ss.hasPermi('commision:config:add')")
@Log(title = "业务提成比例", businessType = BusinessType.INSERT) @Log(title = "业务提成比例", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody SysCommision sysCommision) { public AjaxResult add(@RequestBody SysCommision sysCommision) {
return toAjax(sysCommisionService.insertSysCommision(sysCommision)); return toAjax(sysCommisionService.insertSysCommision(sysCommision));
} }
/** /**
* 修改业务提成比例 * 修改业务提成比例
*/ */
@PreAuthorize("@ss.hasPermi('commision:config:edit')") @PreAuthorize("@ss.hasPermi('commision:config:edit')")
@Log(title = "业务提成比例", businessType = BusinessType.UPDATE) @Log(title = "业务提成比例", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody SysCommision sysCommision) { public AjaxResult edit(@RequestBody SysCommision sysCommision) {
return toAjax(sysCommisionService.updateSysCommision(sysCommision)); return toAjax(sysCommisionService.updateSysCommision(sysCommision));
} }
/** /**
* 删除业务提成比例 * 删除业务提成比例
*/ */
@PreAuthorize("@ss.hasPermi('commision:config:remove')") @PreAuthorize("@ss.hasPermi('commision:config:remove')")
@Log(title = "业务提成比例", businessType = BusinessType.DELETE) @Log(title = "业务提成比例", businessType = BusinessType.DELETE)
@DeleteMapping("/{ruleIds}") @DeleteMapping("/{ruleIds}")
public AjaxResult remove(@PathVariable Long[] ruleIds) { public AjaxResult remove(@PathVariable Long[] ruleIds) {
return toAjax(sysCommisionService.deleteSysCommisionByIds(ruleIds)); return toAjax(sysCommisionService.deleteSysCommisionByIds(ruleIds));
} }
@GetMapping("/salesman") @GetMapping("/salesman")
public AjaxResult getSalesman() { public AjaxResult getSalesman() {
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
List<CusSalesman> list = userService.selectSalesman(); List<CusSalesman> list = userService.selectSalesman();
ajax.put(AjaxResult.DATA_TAG, list); ajax.put(AjaxResult.DATA_TAG, list);
return ajax; return ajax;
} }
@PreAuthorize("@ss.hasPermi('commision:detail:list')") @PreAuthorize("@ss.hasPermi('commision:detail:list')")
@GetMapping("/detail") @GetMapping("/detail")
public TableDataInfo getDetail(SysCommision sysCommision) { public TableDataInfo getDetail(SysCommision sysCommision) {
startPage(); startPage();
List<SysCommision> list = sysCommisionService.selectSysCommisionDetail(sysCommision); List<SysCommision> list = sysCommisionService.selectSysCommisionDetail(sysCommision);
for (SysCommision detail : list) { for (SysCommision detail : list) {
detail.setRate(0F); detail.setRate(0F);
SysCommision tmpQueryCom = new SysCommision(); SysCommision tmpQueryCom = new SysCommision();
tmpQueryCom.setUserId(detail.getUserId()); tmpQueryCom.setUserId(detail.getUserId());
tmpQueryCom.setPostId(detail.getPostId()); tmpQueryCom.setPostId(detail.getPostId());
List<SysCommision> tmpComList = sysCommisionService.selectSysCommisionList(tmpQueryCom); List<SysCommision> tmpComList = sysCommisionService.selectSysCommisionList(tmpQueryCom);
float dAmount = detail.getAmount().floatValue(); float dAmount = detail.getAmount().floatValue();
for (int i = 0; i < tmpComList.size(); i++) { for (int i = 0; i < tmpComList.size(); i++) {
SysCommision com = tmpComList.get(i); SysCommision com = tmpComList.get(i);
float cAmount = com.getAmount().floatValue(); float cAmount = com.getAmount().floatValue();
if (dAmount <= cAmount && i == 0) { if (dAmount <= cAmount && i == 0) {
// 第一条规则 // 第一条规则
detail.setRate(com.getRate()); detail.setRate(com.getRate());
break; break;
} else if (i == tmpComList.size() - 1 && dAmount > cAmount) { } else if (i == tmpComList.size() - 1 && dAmount > cAmount) {
// 最后一条规则 // 最后一条规则
detail.setRate(com.getRate()); detail.setRate(com.getRate());
break; break;
} else if (cAmount < dAmount && dAmount <= tmpComList.get(i + 1).getAmount().floatValue()) { } else if (cAmount < dAmount && dAmount <= tmpComList.get(i + 1).getAmount().floatValue()) {
// 中间规则 // 中间规则
detail.setRate(tmpComList.get(i + 1).getRate()); detail.setRate(tmpComList.get(i + 1).getRate());
break; break;
} }
} }
float amount = detail.getAmount().floatValue(); float amount = detail.getAmount().floatValue();
amount = amount * detail.getRate() / 100F; amount = amount * detail.getRate() / 100F;
detail.setCommision(new BigDecimal(amount)); detail.setCommision(new BigDecimal(amount));
} }
return getDataTable(list); return getDataTable(list);
} }
} }

View File

@ -1,14 +1,14 @@
package com.ruoyi.web.controller.custom; package com.stdiet.web.controller.custom;
import com.ruoyi.common.annotation.Log; import com.stdiet.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.stdiet.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.stdiet.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.stdiet.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.stdiet.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.stdiet.common.utils.poi.ExcelUtil;
import com.ruoyi.custom.domain.SysContract; import com.stdiet.custom.domain.SysContract;
import com.ruoyi.custom.page.PdfProcessInfo; import com.stdiet.custom.page.PdfProcessInfo;
import com.ruoyi.custom.service.ISysContractService; import com.stdiet.custom.service.ISysContractService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -38,9 +38,12 @@ public class SysContractController extends BaseController {
startPage(); startPage();
List<SysContract> list = sysContractService.selectSysContractList(sysContract); List<SysContract> list = sysContractService.selectSysContractList(sysContract);
for (SysContract contract : list) { for (SysContract contract : list) {
if (contract.getSignName() != null && !contract.getSignName().equals("") && !contract.getName().equals(contract.getSignName())) { if (contract.getSignName() != null && !contract.getSignName().equals("") && !contract.getName().trim().equals(contract.getSignName())) {
contract.setName(contract.getName() + "" + contract.getSignName() + ""); contract.setName(contract.getName() + "" + contract.getSignName() + "");
} }
if(contract.getPhone() != null && !contract.getPhone().equals("")) {
contract.setPhone(contract.getPhone().replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"));
}
} }
return getDataTable(list); return getDataTable(list);
} }
@ -110,6 +113,7 @@ public class SysContractController extends BaseController {
data.put("serveTime", contract.getServeTime() + ""); data.put("serveTime", contract.getServeTime() + "");
data.put("tutor", contract.getTutor()); data.put("tutor", contract.getTutor());
data.put("servePromise", contract.getServePromise()); data.put("servePromise", contract.getServePromise());
data.put("remark", contract.getRemark());
ajax.put("data", data); ajax.put("data", data);
} }
return ajax; return ajax;

View File

@ -1,14 +1,14 @@
package com.ruoyi.web.controller.custom; package com.stdiet.web.controller.custom;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
import com.ruoyi.common.core.domain.entity.SysDictData; import com.stdiet.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.domain.entity.SysUser; import com.stdiet.common.core.domain.entity.SysUser;
import com.ruoyi.custom.controller.OrderBaseController; import com.stdiet.custom.controller.OrderBaseController;
import com.ruoyi.custom.page.OrderTableDataInfo; import com.stdiet.custom.page.OrderTableDataInfo;
import com.ruoyi.system.service.ISysDictDataService; import com.stdiet.system.service.ISysDictDataService;
import com.ruoyi.system.service.ISysUserService; import com.stdiet.system.service.ISysUserService;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -19,14 +19,14 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.stdiet.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.stdiet.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.stdiet.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType; import com.stdiet.common.enums.BusinessType;
import com.ruoyi.custom.domain.SysOrder; import com.stdiet.custom.domain.SysOrder;
import com.ruoyi.custom.service.ISysOrderService; import com.stdiet.custom.service.ISysOrderService;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.stdiet.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo; import com.stdiet.common.core.page.TableDataInfo;
/** /**
* 销售订单Controller * 销售订单Controller
@ -80,8 +80,11 @@ public class SysOrderController extends OrderBaseController {
order.setOperatorAssis(user.getNickName()); order.setOperatorAssis(user.getNickName());
} }
} }
if(order.getPhone() != null && !order.getPhone().equals("")) {
order.setPhone(order.getPhone().replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"));
}
} }
return getOrderDataTable(list, totalAmount.longValue()); return getOrderDataTable(list, totalAmount);
} }

View File

@ -1,28 +1,28 @@
package com.ruoyi.web.controller.monitor; package com.stdiet.web.controller.monitor;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController; import com.stdiet.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.stdiet.common.core.domain.AjaxResult;
import com.ruoyi.framework.web.domain.Server; import com.stdiet.framework.web.domain.Server;
/** /**
* 服务器监控 * 服务器监控
* *
* @author ruoyi * @author stdiet
*/ */
@RestController @RestController
@RequestMapping("/monitor/server") @RequestMapping("/monitor/server")
public class ServerController extends BaseController public class ServerController extends BaseController
{ {
@PreAuthorize("@ss.hasPermi('monitor:server:list')") @PreAuthorize("@ss.hasPermi('monitor:server:list')")
@GetMapping() @GetMapping()
public AjaxResult getInfo() throws Exception public AjaxResult getInfo() throws Exception
{ {
Server server = new Server(); Server server = new Server();
server.copyTo(); server.copyTo();
return AjaxResult.success(server); return AjaxResult.success(server);
} }
} }

View File

@ -1,67 +1,67 @@
package com.ruoyi.web.controller.monitor; package com.stdiet.web.controller.monitor;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.stdiet.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.stdiet.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.stdiet.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.stdiet.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.stdiet.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.stdiet.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysLogininfor; import com.stdiet.system.domain.SysLogininfor;
import com.ruoyi.system.service.ISysLogininforService; import com.stdiet.system.service.ISysLogininforService;
/** /**
* 系统访问记录 * 系统访问记录
* *
* @author ruoyi * @author stdiet
*/ */
@RestController @RestController
@RequestMapping("/monitor/logininfor") @RequestMapping("/monitor/logininfor")
public class SysLogininforController extends BaseController public class SysLogininforController extends BaseController
{ {
@Autowired @Autowired
private ISysLogininforService logininforService; private ISysLogininforService logininforService;
@PreAuthorize("@ss.hasPermi('monitor:logininfor:list')") @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysLogininfor logininfor) public TableDataInfo list(SysLogininfor logininfor)
{ {
startPage(); startPage();
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
return getDataTable(list); return getDataTable(list);
} }
@Log(title = "登录日志", businessType = BusinessType.EXPORT) @Log(title = "登录日志", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')") @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
@GetMapping("/export") @GetMapping("/export")
public AjaxResult export(SysLogininfor logininfor) public AjaxResult export(SysLogininfor logininfor)
{ {
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class); ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
return util.exportExcel(list, "登录日志"); return util.exportExcel(list, "登录日志");
} }
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
@Log(title = "登录日志", businessType = BusinessType.DELETE) @Log(title = "登录日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{infoIds}") @DeleteMapping("/{infoIds}")
public AjaxResult remove(@PathVariable Long[] infoIds) public AjaxResult remove(@PathVariable Long[] infoIds)
{ {
return toAjax(logininforService.deleteLogininforByIds(infoIds)); return toAjax(logininforService.deleteLogininforByIds(infoIds));
} }
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
@Log(title = "登录日志", businessType = BusinessType.CLEAN) @Log(title = "登录日志", businessType = BusinessType.CLEAN)
@DeleteMapping("/clean") @DeleteMapping("/clean")
public AjaxResult clean() public AjaxResult clean()
{ {
logininforService.cleanLogininfor(); logininforService.cleanLogininfor();
return AjaxResult.success(); return AjaxResult.success();
} }
} }

View File

@ -1,66 +1,66 @@
package com.ruoyi.web.controller.monitor; package com.stdiet.web.controller.monitor;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.stdiet.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.stdiet.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.stdiet.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.stdiet.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.stdiet.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.stdiet.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysOperLog; import com.stdiet.system.domain.SysOperLog;
import com.ruoyi.system.service.ISysOperLogService; import com.stdiet.system.service.ISysOperLogService;
/** /**
* 操作日志记录 * 操作日志记录
* *
* @author ruoyi * @author stdiet
*/ */
@RestController @RestController
@RequestMapping("/monitor/operlog") @RequestMapping("/monitor/operlog")
public class SysOperlogController extends BaseController public class SysOperlogController extends BaseController
{ {
@Autowired @Autowired
private ISysOperLogService operLogService; private ISysOperLogService operLogService;
@PreAuthorize("@ss.hasPermi('monitor:operlog:list')") @PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysOperLog operLog) public TableDataInfo list(SysOperLog operLog)
{ {
startPage(); startPage();
List<SysOperLog> list = operLogService.selectOperLogList(operLog); List<SysOperLog> list = operLogService.selectOperLogList(operLog);
return getDataTable(list); return getDataTable(list);
} }
@Log(title = "操作日志", businessType = BusinessType.EXPORT) @Log(title = "操作日志", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('monitor:operlog:export')") @PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
@GetMapping("/export") @GetMapping("/export")
public AjaxResult export(SysOperLog operLog) public AjaxResult export(SysOperLog operLog)
{ {
List<SysOperLog> list = operLogService.selectOperLogList(operLog); List<SysOperLog> list = operLogService.selectOperLogList(operLog);
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class); ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
return util.exportExcel(list, "操作日志"); return util.exportExcel(list, "操作日志");
} }
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')") @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
@DeleteMapping("/{operIds}") @DeleteMapping("/{operIds}")
public AjaxResult remove(@PathVariable Long[] operIds) public AjaxResult remove(@PathVariable Long[] operIds)
{ {
return toAjax(operLogService.deleteOperLogByIds(operIds)); return toAjax(operLogService.deleteOperLogByIds(operIds));
} }
@Log(title = "操作日志", businessType = BusinessType.CLEAN) @Log(title = "操作日志", businessType = BusinessType.CLEAN)
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')") @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
@DeleteMapping("/clean") @DeleteMapping("/clean")
public AjaxResult clean() public AjaxResult clean()
{ {
operLogService.cleanOperLog(); operLogService.cleanOperLog();
return AjaxResult.success(); return AjaxResult.success();
} }
} }

View File

@ -1,92 +1,92 @@
package com.ruoyi.web.controller.monitor; package com.stdiet.web.controller.monitor;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.stdiet.common.annotation.Log;
import com.ruoyi.common.constant.Constants; import com.stdiet.common.constant.Constants;
import com.ruoyi.common.core.controller.BaseController; import com.stdiet.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.stdiet.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.LoginUser; import com.stdiet.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo; import com.stdiet.common.core.page.TableDataInfo;
import com.ruoyi.common.core.redis.RedisCache; import com.stdiet.common.core.redis.RedisCache;
import com.ruoyi.common.enums.BusinessType; import com.stdiet.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils; import com.stdiet.common.utils.StringUtils;
import com.ruoyi.system.domain.SysUserOnline; import com.stdiet.system.domain.SysUserOnline;
import com.ruoyi.system.service.ISysUserOnlineService; import com.stdiet.system.service.ISysUserOnlineService;
/** /**
* 在线用户监控 * 在线用户监控
* *
* @author ruoyi * @author stdiet
*/ */
@RestController @RestController
@RequestMapping("/monitor/online") @RequestMapping("/monitor/online")
public class SysUserOnlineController extends BaseController public class SysUserOnlineController extends BaseController
{ {
@Autowired @Autowired
private ISysUserOnlineService userOnlineService; private ISysUserOnlineService userOnlineService;
@Autowired @Autowired
private RedisCache redisCache; private RedisCache redisCache;
@PreAuthorize("@ss.hasPermi('monitor:online:list')") @PreAuthorize("@ss.hasPermi('monitor:online:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(String ipaddr, String userName) public TableDataInfo list(String ipaddr, String userName)
{ {
Collection<String> keys = redisCache.keys(Constants.LOGIN_TOKEN_KEY + "*"); Collection<String> keys = redisCache.keys(Constants.LOGIN_TOKEN_KEY + "*");
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>(); List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
for (String key : keys) for (String key : keys)
{ {
LoginUser user = redisCache.getCacheObject(key); LoginUser user = redisCache.getCacheObject(key);
if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName)) if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
{ {
if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername())) if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername()))
{ {
userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user)); userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
} }
} }
else if (StringUtils.isNotEmpty(ipaddr)) else if (StringUtils.isNotEmpty(ipaddr))
{ {
if (StringUtils.equals(ipaddr, user.getIpaddr())) if (StringUtils.equals(ipaddr, user.getIpaddr()))
{ {
userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user)); userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
} }
} }
else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser())) else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
{ {
if (StringUtils.equals(userName, user.getUsername())) if (StringUtils.equals(userName, user.getUsername()))
{ {
userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user)); userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
} }
} }
else else
{ {
userOnlineList.add(userOnlineService.loginUserToUserOnline(user)); userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
} }
} }
Collections.reverse(userOnlineList); Collections.reverse(userOnlineList);
userOnlineList.removeAll(Collections.singleton(null)); userOnlineList.removeAll(Collections.singleton(null));
return getDataTable(userOnlineList); return getDataTable(userOnlineList);
} }
/** /**
* 强退用户 * 强退用户
*/ */
@PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')") @PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
@Log(title = "在线用户", businessType = BusinessType.FORCE) @Log(title = "在线用户", businessType = BusinessType.FORCE)
@DeleteMapping("/{tokenId}") @DeleteMapping("/{tokenId}")
public AjaxResult forceLogout(@PathVariable String tokenId) public AjaxResult forceLogout(@PathVariable String tokenId)
{ {
redisCache.deleteObject(Constants.LOGIN_TOKEN_KEY + tokenId); redisCache.deleteObject(Constants.LOGIN_TOKEN_KEY + tokenId);
return AjaxResult.success(); return AjaxResult.success();
} }
} }

View File

@ -1,135 +1,135 @@
package com.ruoyi.web.controller.system; package com.stdiet.web.controller.system;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.stdiet.common.annotation.Log;
import com.ruoyi.common.annotation.RepeatSubmit; import com.stdiet.common.annotation.RepeatSubmit;
import com.ruoyi.common.constant.UserConstants; import com.stdiet.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController; import com.stdiet.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.stdiet.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.stdiet.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.stdiet.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils; import com.stdiet.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.stdiet.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysConfig; import com.stdiet.system.domain.SysConfig;
import com.ruoyi.system.service.ISysConfigService; import com.stdiet.system.service.ISysConfigService;
/** /**
* 参数配置 信息操作处理 * 参数配置 信息操作处理
* *
* @author ruoyi * @author stdiet
*/ */
@RestController @RestController
@RequestMapping("/system/config") @RequestMapping("/system/config")
public class SysConfigController extends BaseController public class SysConfigController extends BaseController
{ {
@Autowired @Autowired
private ISysConfigService configService; private ISysConfigService configService;
/** /**
* 获取参数配置列表 * 获取参数配置列表
*/ */
@PreAuthorize("@ss.hasPermi('system:config:list')") @PreAuthorize("@ss.hasPermi('system:config:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysConfig config) public TableDataInfo list(SysConfig config)
{ {
startPage(); startPage();
List<SysConfig> list = configService.selectConfigList(config); List<SysConfig> list = configService.selectConfigList(config);
return getDataTable(list); return getDataTable(list);
} }
@Log(title = "参数管理", businessType = BusinessType.EXPORT) @Log(title = "参数管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:config:export')") @PreAuthorize("@ss.hasPermi('system:config:export')")
@GetMapping("/export") @GetMapping("/export")
public AjaxResult export(SysConfig config) public AjaxResult export(SysConfig config)
{ {
List<SysConfig> list = configService.selectConfigList(config); List<SysConfig> list = configService.selectConfigList(config);
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class); ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
return util.exportExcel(list, "参数数据"); return util.exportExcel(list, "参数数据");
} }
/** /**
* 根据参数编号获取详细信息 * 根据参数编号获取详细信息
*/ */
@PreAuthorize("@ss.hasPermi('system:config:query')") @PreAuthorize("@ss.hasPermi('system:config:query')")
@GetMapping(value = "/{configId}") @GetMapping(value = "/{configId}")
public AjaxResult getInfo(@PathVariable Long configId) public AjaxResult getInfo(@PathVariable Long configId)
{ {
return AjaxResult.success(configService.selectConfigById(configId)); return AjaxResult.success(configService.selectConfigById(configId));
} }
/** /**
* 根据参数键名查询参数值 * 根据参数键名查询参数值
*/ */
@GetMapping(value = "/configKey/{configKey}") @GetMapping(value = "/configKey/{configKey}")
public AjaxResult getConfigKey(@PathVariable String configKey) public AjaxResult getConfigKey(@PathVariable String configKey)
{ {
return AjaxResult.success(configService.selectConfigByKey(configKey)); return AjaxResult.success(configService.selectConfigByKey(configKey));
} }
/** /**
* 新增参数配置 * 新增参数配置
*/ */
@PreAuthorize("@ss.hasPermi('system:config:add')") @PreAuthorize("@ss.hasPermi('system:config:add')")
@Log(title = "参数管理", businessType = BusinessType.INSERT) @Log(title = "参数管理", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
@RepeatSubmit @RepeatSubmit
public AjaxResult add(@Validated @RequestBody SysConfig config) public AjaxResult add(@Validated @RequestBody SysConfig config)
{ {
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
{ {
return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
} }
config.setCreateBy(SecurityUtils.getUsername()); config.setCreateBy(SecurityUtils.getUsername());
return toAjax(configService.insertConfig(config)); return toAjax(configService.insertConfig(config));
} }
/** /**
* 修改参数配置 * 修改参数配置
*/ */
@PreAuthorize("@ss.hasPermi('system:config:edit')") @PreAuthorize("@ss.hasPermi('system:config:edit')")
@Log(title = "参数管理", businessType = BusinessType.UPDATE) @Log(title = "参数管理", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody SysConfig config) public AjaxResult edit(@Validated @RequestBody SysConfig config)
{ {
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
{ {
return AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); return AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
} }
config.setUpdateBy(SecurityUtils.getUsername()); config.setUpdateBy(SecurityUtils.getUsername());
return toAjax(configService.updateConfig(config)); return toAjax(configService.updateConfig(config));
} }
/** /**
* 删除参数配置 * 删除参数配置
*/ */
@PreAuthorize("@ss.hasPermi('system:config:remove')") @PreAuthorize("@ss.hasPermi('system:config:remove')")
@Log(title = "参数管理", businessType = BusinessType.DELETE) @Log(title = "参数管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{configIds}") @DeleteMapping("/{configIds}")
public AjaxResult remove(@PathVariable Long[] configIds) public AjaxResult remove(@PathVariable Long[] configIds)
{ {
return toAjax(configService.deleteConfigByIds(configIds)); return toAjax(configService.deleteConfigByIds(configIds));
} }
/** /**
* 清空缓存 * 清空缓存
*/ */
@PreAuthorize("@ss.hasPermi('system:config:remove')") @PreAuthorize("@ss.hasPermi('system:config:remove')")
@Log(title = "参数管理", businessType = BusinessType.CLEAN) @Log(title = "参数管理", businessType = BusinessType.CLEAN)
@DeleteMapping("/clearCache") @DeleteMapping("/clearCache")
public AjaxResult clearCache() public AjaxResult clearCache()
{ {
configService.clearCache(); configService.clearCache();
return AjaxResult.success(); return AjaxResult.success();
} }
} }

View File

@ -1,163 +1,163 @@
package com.ruoyi.web.controller.system; package com.stdiet.web.controller.system;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.stdiet.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants; import com.stdiet.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController; import com.stdiet.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.stdiet.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDept; import com.stdiet.common.core.domain.entity.SysDept;
import com.ruoyi.common.enums.BusinessType; import com.stdiet.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils; import com.stdiet.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils; import com.stdiet.common.utils.StringUtils;
import com.ruoyi.system.service.ISysDeptService; import com.stdiet.system.service.ISysDeptService;
/** /**
* 部门信息 * 部门信息
* *
* @author ruoyi * @author stdiet
*/ */
@RestController @RestController
@RequestMapping("/system/dept") @RequestMapping("/system/dept")
public class SysDeptController extends BaseController public class SysDeptController extends BaseController
{ {
@Autowired @Autowired
private ISysDeptService deptService; private ISysDeptService deptService;
/** /**
* 获取部门列表 * 获取部门列表
*/ */
@PreAuthorize("@ss.hasPermi('system:dept:list')") @PreAuthorize("@ss.hasPermi('system:dept:list')")
@GetMapping("/list") @GetMapping("/list")
public AjaxResult list(SysDept dept) public AjaxResult list(SysDept dept)
{ {
List<SysDept> depts = deptService.selectDeptList(dept); List<SysDept> depts = deptService.selectDeptList(dept);
return AjaxResult.success(depts); return AjaxResult.success(depts);
} }
/** /**
* 查询部门列表排除节点 * 查询部门列表排除节点
*/ */
@PreAuthorize("@ss.hasPermi('system:dept:list')") @PreAuthorize("@ss.hasPermi('system:dept:list')")
@GetMapping("/list/exclude/{deptId}") @GetMapping("/list/exclude/{deptId}")
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
{ {
List<SysDept> depts = deptService.selectDeptList(new SysDept()); List<SysDept> depts = deptService.selectDeptList(new SysDept());
Iterator<SysDept> it = depts.iterator(); Iterator<SysDept> it = depts.iterator();
while (it.hasNext()) while (it.hasNext())
{ {
SysDept d = (SysDept) it.next(); SysDept d = (SysDept) it.next();
if (d.getDeptId().intValue() == deptId if (d.getDeptId().intValue() == deptId
|| ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")) || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""))
{ {
it.remove(); it.remove();
} }
} }
return AjaxResult.success(depts); return AjaxResult.success(depts);
} }
/** /**
* 根据部门编号获取详细信息 * 根据部门编号获取详细信息
*/ */
@PreAuthorize("@ss.hasPermi('system:dept:query')") @PreAuthorize("@ss.hasPermi('system:dept:query')")
@GetMapping(value = "/{deptId}") @GetMapping(value = "/{deptId}")
public AjaxResult getInfo(@PathVariable Long deptId) public AjaxResult getInfo(@PathVariable Long deptId)
{ {
return AjaxResult.success(deptService.selectDeptById(deptId)); return AjaxResult.success(deptService.selectDeptById(deptId));
} }
/** /**
* 获取部门下拉树列表 * 获取部门下拉树列表
*/ */
@GetMapping("/treeselect") @GetMapping("/treeselect")
public AjaxResult treeselect(SysDept dept) public AjaxResult treeselect(SysDept dept)
{ {
List<SysDept> depts = deptService.selectDeptList(dept); List<SysDept> depts = deptService.selectDeptList(dept);
return AjaxResult.success(deptService.buildDeptTreeSelect(depts)); return AjaxResult.success(deptService.buildDeptTreeSelect(depts));
} }
/** /**
* 加载对应角色部门列表树 * 加载对应角色部门列表树
*/ */
@GetMapping(value = "/roleDeptTreeselect/{roleId}") @GetMapping(value = "/roleDeptTreeselect/{roleId}")
public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId) public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId)
{ {
List<SysDept> depts = deptService.selectDeptList(new SysDept()); List<SysDept> depts = deptService.selectDeptList(new SysDept());
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId)); ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
ajax.put("depts", deptService.buildDeptTreeSelect(depts)); ajax.put("depts", deptService.buildDeptTreeSelect(depts));
return ajax; return ajax;
} }
/** /**
* 新增部门 * 新增部门
*/ */
@PreAuthorize("@ss.hasPermi('system:dept:add')") @PreAuthorize("@ss.hasPermi('system:dept:add')")
@Log(title = "部门管理", businessType = BusinessType.INSERT) @Log(title = "部门管理", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@Validated @RequestBody SysDept dept) public AjaxResult add(@Validated @RequestBody SysDept dept)
{ {
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
{ {
return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在"); return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
} }
dept.setCreateBy(SecurityUtils.getUsername()); dept.setCreateBy(SecurityUtils.getUsername());
return toAjax(deptService.insertDept(dept)); return toAjax(deptService.insertDept(dept));
} }
/** /**
* 修改部门 * 修改部门
*/ */
@PreAuthorize("@ss.hasPermi('system:dept:edit')") @PreAuthorize("@ss.hasPermi('system:dept:edit')")
@Log(title = "部门管理", businessType = BusinessType.UPDATE) @Log(title = "部门管理", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody SysDept dept) public AjaxResult edit(@Validated @RequestBody SysDept dept)
{ {
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
{ {
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在"); return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
} }
else if (dept.getParentId().equals(dept.getDeptId())) else if (dept.getParentId().equals(dept.getDeptId()))
{ {
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己"); return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
} }
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
&& deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0) && deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0)
{ {
return AjaxResult.error("该部门包含未停用的子部门!"); return AjaxResult.error("该部门包含未停用的子部门!");
} }
dept.setUpdateBy(SecurityUtils.getUsername()); dept.setUpdateBy(SecurityUtils.getUsername());
return toAjax(deptService.updateDept(dept)); return toAjax(deptService.updateDept(dept));
} }
/** /**
* 删除部门 * 删除部门
*/ */
@PreAuthorize("@ss.hasPermi('system:dept:remove')") @PreAuthorize("@ss.hasPermi('system:dept:remove')")
@Log(title = "部门管理", businessType = BusinessType.DELETE) @Log(title = "部门管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{deptId}") @DeleteMapping("/{deptId}")
public AjaxResult remove(@PathVariable Long deptId) public AjaxResult remove(@PathVariable Long deptId)
{ {
if (deptService.hasChildByDeptId(deptId)) if (deptService.hasChildByDeptId(deptId))
{ {
return AjaxResult.error("存在下级部门,不允许删除"); return AjaxResult.error("存在下级部门,不允许删除");
} }
if (deptService.checkDeptExistUser(deptId)) if (deptService.checkDeptExistUser(deptId))
{ {
return AjaxResult.error("部门存在用户,不允许删除"); return AjaxResult.error("部门存在用户,不允许删除");
} }
return toAjax(deptService.deleteDeptById(deptId)); return toAjax(deptService.deleteDeptById(deptId));
} }
} }

View File

@ -1,113 +1,113 @@
package com.ruoyi.web.controller.system; package com.stdiet.web.controller.system;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.stdiet.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.stdiet.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.stdiet.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDictData; import com.stdiet.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.page.TableDataInfo; import com.stdiet.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.stdiet.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils; import com.stdiet.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.stdiet.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysDictDataService; import com.stdiet.system.service.ISysDictDataService;
import com.ruoyi.system.service.ISysDictTypeService; import com.stdiet.system.service.ISysDictTypeService;
/** /**
* 数据字典信息 * 数据字典信息
* *
* @author ruoyi * @author stdiet
*/ */
@RestController @RestController
@RequestMapping("/system/dict/data") @RequestMapping("/system/dict/data")
public class SysDictDataController extends BaseController public class SysDictDataController extends BaseController
{ {
@Autowired @Autowired
private ISysDictDataService dictDataService; private ISysDictDataService dictDataService;
@Autowired @Autowired
private ISysDictTypeService dictTypeService; private ISysDictTypeService dictTypeService;
@PreAuthorize("@ss.hasPermi('system:dict:list')") @PreAuthorize("@ss.hasPermi('system:dict:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysDictData dictData) public TableDataInfo list(SysDictData dictData)
{ {
startPage(); startPage();
List<SysDictData> list = dictDataService.selectDictDataList(dictData); List<SysDictData> list = dictDataService.selectDictDataList(dictData);
return getDataTable(list); return getDataTable(list);
} }
@Log(title = "字典数据", businessType = BusinessType.EXPORT) @Log(title = "字典数据", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:dict:export')") @PreAuthorize("@ss.hasPermi('system:dict:export')")
@GetMapping("/export") @GetMapping("/export")
public AjaxResult export(SysDictData dictData) public AjaxResult export(SysDictData dictData)
{ {
List<SysDictData> list = dictDataService.selectDictDataList(dictData); List<SysDictData> list = dictDataService.selectDictDataList(dictData);
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class); ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
return util.exportExcel(list, "字典数据"); return util.exportExcel(list, "字典数据");
} }
/** /**
* 查询字典数据详细 * 查询字典数据详细
*/ */
@PreAuthorize("@ss.hasPermi('system:dict:query')") @PreAuthorize("@ss.hasPermi('system:dict:query')")
@GetMapping(value = "/{dictCode}") @GetMapping(value = "/{dictCode}")
public AjaxResult getInfo(@PathVariable Long dictCode) public AjaxResult getInfo(@PathVariable Long dictCode)
{ {
return AjaxResult.success(dictDataService.selectDictDataById(dictCode)); return AjaxResult.success(dictDataService.selectDictDataById(dictCode));
} }
/** /**
* 根据字典类型查询字典数据信息 * 根据字典类型查询字典数据信息
*/ */
@GetMapping(value = "/type/{dictType}") @GetMapping(value = "/type/{dictType}")
public AjaxResult dictType(@PathVariable String dictType) public AjaxResult dictType(@PathVariable String dictType)
{ {
return AjaxResult.success(dictTypeService.selectDictDataByType(dictType)); return AjaxResult.success(dictTypeService.selectDictDataByType(dictType));
} }
/** /**
* 新增字典类型 * 新增字典类型
*/ */
@PreAuthorize("@ss.hasPermi('system:dict:add')") @PreAuthorize("@ss.hasPermi('system:dict:add')")
@Log(title = "字典数据", businessType = BusinessType.INSERT) @Log(title = "字典数据", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@Validated @RequestBody SysDictData dict) public AjaxResult add(@Validated @RequestBody SysDictData dict)
{ {
dict.setCreateBy(SecurityUtils.getUsername()); dict.setCreateBy(SecurityUtils.getUsername());
return toAjax(dictDataService.insertDictData(dict)); return toAjax(dictDataService.insertDictData(dict));
} }
/** /**
* 修改保存字典类型 * 修改保存字典类型
*/ */
@PreAuthorize("@ss.hasPermi('system:dict:edit')") @PreAuthorize("@ss.hasPermi('system:dict:edit')")
@Log(title = "字典数据", businessType = BusinessType.UPDATE) @Log(title = "字典数据", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody SysDictData dict) public AjaxResult edit(@Validated @RequestBody SysDictData dict)
{ {
dict.setUpdateBy(SecurityUtils.getUsername()); dict.setUpdateBy(SecurityUtils.getUsername());
return toAjax(dictDataService.updateDictData(dict)); return toAjax(dictDataService.updateDictData(dict));
} }
/** /**
* 删除字典类型 * 删除字典类型
*/ */
@PreAuthorize("@ss.hasPermi('system:dict:remove')") @PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.DELETE) @Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictCodes}") @DeleteMapping("/{dictCodes}")
public AjaxResult remove(@PathVariable Long[] dictCodes) public AjaxResult remove(@PathVariable Long[] dictCodes)
{ {
return toAjax(dictDataService.deleteDictDataByIds(dictCodes)); return toAjax(dictDataService.deleteDictDataByIds(dictCodes));
} }
} }

View File

@ -1,131 +1,131 @@
package com.ruoyi.web.controller.system; package com.stdiet.web.controller.system;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.stdiet.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants; import com.stdiet.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController; import com.stdiet.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.stdiet.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDictType; import com.stdiet.common.core.domain.entity.SysDictType;
import com.ruoyi.common.core.page.TableDataInfo; import com.stdiet.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.stdiet.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils; import com.stdiet.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.stdiet.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysDictTypeService; import com.stdiet.system.service.ISysDictTypeService;
/** /**
* 数据字典信息 * 数据字典信息
* *
* @author ruoyi * @author stdiet
*/ */
@RestController @RestController
@RequestMapping("/system/dict/type") @RequestMapping("/system/dict/type")
public class SysDictTypeController extends BaseController public class SysDictTypeController extends BaseController
{ {
@Autowired @Autowired
private ISysDictTypeService dictTypeService; private ISysDictTypeService dictTypeService;
@PreAuthorize("@ss.hasPermi('system:dict:list')") @PreAuthorize("@ss.hasPermi('system:dict:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysDictType dictType) public TableDataInfo list(SysDictType dictType)
{ {
startPage(); startPage();
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
return getDataTable(list); return getDataTable(list);
} }
@Log(title = "字典类型", businessType = BusinessType.EXPORT) @Log(title = "字典类型", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:dict:export')") @PreAuthorize("@ss.hasPermi('system:dict:export')")
@GetMapping("/export") @GetMapping("/export")
public AjaxResult export(SysDictType dictType) public AjaxResult export(SysDictType dictType)
{ {
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class); ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
return util.exportExcel(list, "字典类型"); return util.exportExcel(list, "字典类型");
} }
/** /**
* 查询字典类型详细 * 查询字典类型详细
*/ */
@PreAuthorize("@ss.hasPermi('system:dict:query')") @PreAuthorize("@ss.hasPermi('system:dict:query')")
@GetMapping(value = "/{dictId}") @GetMapping(value = "/{dictId}")
public AjaxResult getInfo(@PathVariable Long dictId) public AjaxResult getInfo(@PathVariable Long dictId)
{ {
return AjaxResult.success(dictTypeService.selectDictTypeById(dictId)); return AjaxResult.success(dictTypeService.selectDictTypeById(dictId));
} }
/** /**
* 新增字典类型 * 新增字典类型
*/ */
@PreAuthorize("@ss.hasPermi('system:dict:add')") @PreAuthorize("@ss.hasPermi('system:dict:add')")
@Log(title = "字典类型", businessType = BusinessType.INSERT) @Log(title = "字典类型", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@Validated @RequestBody SysDictType dict) public AjaxResult add(@Validated @RequestBody SysDictType dict)
{ {
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
{ {
return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在"); return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
} }
dict.setCreateBy(SecurityUtils.getUsername()); dict.setCreateBy(SecurityUtils.getUsername());
return toAjax(dictTypeService.insertDictType(dict)); return toAjax(dictTypeService.insertDictType(dict));
} }
/** /**
* 修改字典类型 * 修改字典类型
*/ */
@PreAuthorize("@ss.hasPermi('system:dict:edit')") @PreAuthorize("@ss.hasPermi('system:dict:edit')")
@Log(title = "字典类型", businessType = BusinessType.UPDATE) @Log(title = "字典类型", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody SysDictType dict) public AjaxResult edit(@Validated @RequestBody SysDictType dict)
{ {
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
{ {
return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在"); return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
} }
dict.setUpdateBy(SecurityUtils.getUsername()); dict.setUpdateBy(SecurityUtils.getUsername());
return toAjax(dictTypeService.updateDictType(dict)); return toAjax(dictTypeService.updateDictType(dict));
} }
/** /**
* 删除字典类型 * 删除字典类型
*/ */
@PreAuthorize("@ss.hasPermi('system:dict:remove')") @PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.DELETE) @Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictIds}") @DeleteMapping("/{dictIds}")
public AjaxResult remove(@PathVariable Long[] dictIds) public AjaxResult remove(@PathVariable Long[] dictIds)
{ {
return toAjax(dictTypeService.deleteDictTypeByIds(dictIds)); return toAjax(dictTypeService.deleteDictTypeByIds(dictIds));
} }
/** /**
* 清空缓存 * 清空缓存
*/ */
@PreAuthorize("@ss.hasPermi('system:dict:remove')") @PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.CLEAN) @Log(title = "字典类型", businessType = BusinessType.CLEAN)
@DeleteMapping("/clearCache") @DeleteMapping("/clearCache")
public AjaxResult clearCache() public AjaxResult clearCache()
{ {
dictTypeService.clearCache(); dictTypeService.clearCache();
return AjaxResult.success(); return AjaxResult.success();
} }
/** /**
* 获取字典选择框列表 * 获取字典选择框列表
*/ */
@GetMapping("/optionselect") @GetMapping("/optionselect")
public AjaxResult optionselect() public AjaxResult optionselect()
{ {
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll(); List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
return AjaxResult.success(dictTypes); return AjaxResult.success(dictTypes);
} }
} }

View File

@ -1,94 +1,94 @@
package com.ruoyi.web.controller.system; package com.stdiet.web.controller.system;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.constant.Constants; import com.stdiet.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult; import com.stdiet.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysMenu; import com.stdiet.common.core.domain.entity.SysMenu;
import com.ruoyi.common.core.domain.entity.SysUser; import com.stdiet.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginBody; import com.stdiet.common.core.domain.model.LoginBody;
import com.ruoyi.common.core.domain.model.LoginUser; import com.stdiet.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.ServletUtils; import com.stdiet.common.utils.ServletUtils;
import com.ruoyi.framework.web.service.SysLoginService; import com.stdiet.framework.web.service.SysLoginService;
import com.ruoyi.framework.web.service.SysPermissionService; import com.stdiet.framework.web.service.SysPermissionService;
import com.ruoyi.framework.web.service.TokenService; import com.stdiet.framework.web.service.TokenService;
import com.ruoyi.system.service.ISysMenuService; import com.stdiet.system.service.ISysMenuService;
/** /**
* 登录验证 * 登录验证
* *
* @author ruoyi * @author stdiet
*/ */
@RestController @RestController
public class SysLoginController public class SysLoginController
{ {
@Autowired @Autowired
private SysLoginService loginService; private SysLoginService loginService;
@Autowired @Autowired
private ISysMenuService menuService; private ISysMenuService menuService;
@Autowired @Autowired
private SysPermissionService permissionService; private SysPermissionService permissionService;
@Autowired @Autowired
private TokenService tokenService; private TokenService tokenService;
/** /**
* 登录方法 * 登录方法
* *
* @param loginBody 登录信息 * @param loginBody 登录信息
* @return 结果 * @return 结果
*/ */
@PostMapping("/login") @PostMapping("/login")
public AjaxResult login(@RequestBody LoginBody loginBody) public AjaxResult login(@RequestBody LoginBody loginBody)
{ {
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
// 生成令牌 // 生成令牌
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
loginBody.getUuid()); loginBody.getUuid());
ajax.put(Constants.TOKEN, token); ajax.put(Constants.TOKEN, token);
return ajax; return ajax;
} }
/** /**
* 获取用户信息 * 获取用户信息
* *
* @return 用户信息 * @return 用户信息
*/ */
@GetMapping("getInfo") @GetMapping("getInfo")
public AjaxResult getInfo() public AjaxResult getInfo()
{ {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
SysUser user = loginUser.getUser(); SysUser user = loginUser.getUser();
// 角色集合 // 角色集合
Set<String> roles = permissionService.getRolePermission(user); Set<String> roles = permissionService.getRolePermission(user);
// 权限集合 // 权限集合
Set<String> permissions = permissionService.getMenuPermission(user); Set<String> permissions = permissionService.getMenuPermission(user);
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
ajax.put("user", user); ajax.put("user", user);
ajax.put("roles", roles); ajax.put("roles", roles);
ajax.put("permissions", permissions); ajax.put("permissions", permissions);
return ajax; return ajax;
} }
/** /**
* 获取路由信息 * 获取路由信息
* *
* @return 路由信息 * @return 路由信息
*/ */
@GetMapping("getRouters") @GetMapping("getRouters")
public AjaxResult getRouters() public AjaxResult getRouters()
{ {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
// 用户信息 // 用户信息
SysUser user = loginUser.getUser(); SysUser user = loginUser.getUser();
List<SysMenu> menus = menuService.selectMenuTreeByUserId(user.getUserId()); List<SysMenu> menus = menuService.selectMenuTreeByUserId(user.getUserId());
return AjaxResult.success(menuService.buildMenus(menus)); return AjaxResult.success(menuService.buildMenus(menus));
} }
} }

View File

@ -1,157 +1,157 @@
package com.ruoyi.web.controller.system; package com.stdiet.web.controller.system;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.stdiet.common.annotation.Log;
import com.ruoyi.common.constant.Constants; import com.stdiet.common.constant.Constants;
import com.ruoyi.common.constant.UserConstants; import com.stdiet.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController; import com.stdiet.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.stdiet.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysMenu; import com.stdiet.common.core.domain.entity.SysMenu;
import com.ruoyi.common.core.domain.model.LoginUser; import com.stdiet.common.core.domain.model.LoginUser;
import com.ruoyi.common.enums.BusinessType; import com.stdiet.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils; import com.stdiet.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ServletUtils; import com.stdiet.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils; import com.stdiet.common.utils.StringUtils;
import com.ruoyi.framework.web.service.TokenService; import com.stdiet.framework.web.service.TokenService;
import com.ruoyi.system.service.ISysMenuService; import com.stdiet.system.service.ISysMenuService;
/** /**
* 菜单信息 * 菜单信息
* *
* @author ruoyi * @author stdiet
*/ */
@RestController @RestController
@RequestMapping("/system/menu") @RequestMapping("/system/menu")
public class SysMenuController extends BaseController public class SysMenuController extends BaseController
{ {
@Autowired @Autowired
private ISysMenuService menuService; private ISysMenuService menuService;
@Autowired @Autowired
private TokenService tokenService; private TokenService tokenService;
/** /**
* 获取菜单列表 * 获取菜单列表
*/ */
@PreAuthorize("@ss.hasPermi('system:menu:list')") @PreAuthorize("@ss.hasPermi('system:menu:list')")
@GetMapping("/list") @GetMapping("/list")
public AjaxResult list(SysMenu menu) public AjaxResult list(SysMenu menu)
{ {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
Long userId = loginUser.getUser().getUserId(); Long userId = loginUser.getUser().getUserId();
List<SysMenu> menus = menuService.selectMenuList(menu, userId); List<SysMenu> menus = menuService.selectMenuList(menu, userId);
return AjaxResult.success(menus); return AjaxResult.success(menus);
} }
/** /**
* 根据菜单编号获取详细信息 * 根据菜单编号获取详细信息
*/ */
@PreAuthorize("@ss.hasPermi('system:menu:query')") @PreAuthorize("@ss.hasPermi('system:menu:query')")
@GetMapping(value = "/{menuId}") @GetMapping(value = "/{menuId}")
public AjaxResult getInfo(@PathVariable Long menuId) public AjaxResult getInfo(@PathVariable Long menuId)
{ {
return AjaxResult.success(menuService.selectMenuById(menuId)); return AjaxResult.success(menuService.selectMenuById(menuId));
} }
/** /**
* 获取菜单下拉树列表 * 获取菜单下拉树列表
*/ */
@GetMapping("/treeselect") @GetMapping("/treeselect")
public AjaxResult treeselect(SysMenu menu) public AjaxResult treeselect(SysMenu menu)
{ {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
Long userId = loginUser.getUser().getUserId(); Long userId = loginUser.getUser().getUserId();
List<SysMenu> menus = menuService.selectMenuList(menu, userId); List<SysMenu> menus = menuService.selectMenuList(menu, userId);
return AjaxResult.success(menuService.buildMenuTreeSelect(menus)); return AjaxResult.success(menuService.buildMenuTreeSelect(menus));
} }
/** /**
* 加载对应角色菜单列表树 * 加载对应角色菜单列表树
*/ */
@GetMapping(value = "/roleMenuTreeselect/{roleId}") @GetMapping(value = "/roleMenuTreeselect/{roleId}")
public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId)
{ {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
List<SysMenu> menus = menuService.selectMenuList(loginUser.getUser().getUserId()); List<SysMenu> menus = menuService.selectMenuList(loginUser.getUser().getUserId());
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId)); ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
ajax.put("menus", menuService.buildMenuTreeSelect(menus)); ajax.put("menus", menuService.buildMenuTreeSelect(menus));
return ajax; return ajax;
} }
/** /**
* 新增菜单 * 新增菜单
*/ */
@PreAuthorize("@ss.hasPermi('system:menu:add')") @PreAuthorize("@ss.hasPermi('system:menu:add')")
@Log(title = "菜单管理", businessType = BusinessType.INSERT) @Log(title = "菜单管理", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@Validated @RequestBody SysMenu menu) public AjaxResult add(@Validated @RequestBody SysMenu menu)
{ {
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
{ {
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
} }
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) else if (UserConstants.YES_FRAME.equals(menu.getIsFrame())
&& !StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS)) && !StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS))
{ {
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败地址必须以http(s)://开头"); return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败地址必须以http(s)://开头");
} }
menu.setCreateBy(SecurityUtils.getUsername()); menu.setCreateBy(SecurityUtils.getUsername());
return toAjax(menuService.insertMenu(menu)); return toAjax(menuService.insertMenu(menu));
} }
/** /**
* 修改菜单 * 修改菜单
*/ */
@PreAuthorize("@ss.hasPermi('system:menu:edit')") @PreAuthorize("@ss.hasPermi('system:menu:edit')")
@Log(title = "菜单管理", businessType = BusinessType.UPDATE) @Log(title = "菜单管理", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody SysMenu menu) public AjaxResult edit(@Validated @RequestBody SysMenu menu)
{ {
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
{ {
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
} }
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) else if (UserConstants.YES_FRAME.equals(menu.getIsFrame())
&& !StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS)) && !StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS))
{ {
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败地址必须以http(s)://开头"); return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败地址必须以http(s)://开头");
} }
else if (menu.getMenuId().equals(menu.getParentId())) else if (menu.getMenuId().equals(menu.getParentId()))
{ {
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己"); return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
} }
menu.setUpdateBy(SecurityUtils.getUsername()); menu.setUpdateBy(SecurityUtils.getUsername());
return toAjax(menuService.updateMenu(menu)); return toAjax(menuService.updateMenu(menu));
} }
/** /**
* 删除菜单 * 删除菜单
*/ */
@PreAuthorize("@ss.hasPermi('system:menu:remove')") @PreAuthorize("@ss.hasPermi('system:menu:remove')")
@Log(title = "菜单管理", businessType = BusinessType.DELETE) @Log(title = "菜单管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{menuId}") @DeleteMapping("/{menuId}")
public AjaxResult remove(@PathVariable("menuId") Long menuId) public AjaxResult remove(@PathVariable("menuId") Long menuId)
{ {
if (menuService.hasChildByMenuId(menuId)) if (menuService.hasChildByMenuId(menuId))
{ {
return AjaxResult.error("存在子菜单,不允许删除"); return AjaxResult.error("存在子菜单,不允许删除");
} }
if (menuService.checkMenuExistRole(menuId)) if (menuService.checkMenuExistRole(menuId))
{ {
return AjaxResult.error("菜单已分配,不允许删除"); return AjaxResult.error("菜单已分配,不允许删除");
} }
return toAjax(menuService.deleteMenuById(menuId)); return toAjax(menuService.deleteMenuById(menuId));
} }
} }

View File

@ -1,92 +1,92 @@
package com.ruoyi.web.controller.system; package com.stdiet.web.controller.system;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.stdiet.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.stdiet.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.stdiet.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.stdiet.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.stdiet.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils; import com.stdiet.common.utils.SecurityUtils;
import com.ruoyi.system.domain.SysNotice; import com.stdiet.system.domain.SysNotice;
import com.ruoyi.system.service.ISysNoticeService; import com.stdiet.system.service.ISysNoticeService;
/** /**
* 公告 信息操作处理 * 公告 信息操作处理
* *
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
@RequestMapping("/system/notice") @RequestMapping("/system/notice")
public class SysNoticeController extends BaseController public class SysNoticeController extends BaseController
{ {
@Autowired @Autowired
private ISysNoticeService noticeService; private ISysNoticeService noticeService;
/** /**
* 获取通知公告列表 * 获取通知公告列表
*/ */
@PreAuthorize("@ss.hasPermi('system:notice:list')") @PreAuthorize("@ss.hasPermi('system:notice:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysNotice notice) public TableDataInfo list(SysNotice notice)
{ {
startPage(); startPage();
List<SysNotice> list = noticeService.selectNoticeList(notice); List<SysNotice> list = noticeService.selectNoticeList(notice);
return getDataTable(list); return getDataTable(list);
} }
/** /**
* 根据通知公告编号获取详细信息 * 根据通知公告编号获取详细信息
*/ */
@PreAuthorize("@ss.hasPermi('system:notice:query')") @PreAuthorize("@ss.hasPermi('system:notice:query')")
@GetMapping(value = "/{noticeId}") @GetMapping(value = "/{noticeId}")
public AjaxResult getInfo(@PathVariable Long noticeId) public AjaxResult getInfo(@PathVariable Long noticeId)
{ {
return AjaxResult.success(noticeService.selectNoticeById(noticeId)); return AjaxResult.success(noticeService.selectNoticeById(noticeId));
} }
/** /**
* 新增通知公告 * 新增通知公告
*/ */
@PreAuthorize("@ss.hasPermi('system:notice:add')") @PreAuthorize("@ss.hasPermi('system:notice:add')")
@Log(title = "通知公告", businessType = BusinessType.INSERT) @Log(title = "通知公告", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@Validated @RequestBody SysNotice notice) public AjaxResult add(@Validated @RequestBody SysNotice notice)
{ {
notice.setCreateBy(SecurityUtils.getUsername()); notice.setCreateBy(SecurityUtils.getUsername());
return toAjax(noticeService.insertNotice(notice)); return toAjax(noticeService.insertNotice(notice));
} }
/** /**
* 修改通知公告 * 修改通知公告
*/ */
@PreAuthorize("@ss.hasPermi('system:notice:edit')") @PreAuthorize("@ss.hasPermi('system:notice:edit')")
@Log(title = "通知公告", businessType = BusinessType.UPDATE) @Log(title = "通知公告", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody SysNotice notice) public AjaxResult edit(@Validated @RequestBody SysNotice notice)
{ {
notice.setUpdateBy(SecurityUtils.getUsername()); notice.setUpdateBy(SecurityUtils.getUsername());
return toAjax(noticeService.updateNotice(notice)); return toAjax(noticeService.updateNotice(notice));
} }
/** /**
* 删除通知公告 * 删除通知公告
*/ */
@PreAuthorize("@ss.hasPermi('system:notice:remove')") @PreAuthorize("@ss.hasPermi('system:notice:remove')")
@Log(title = "通知公告", businessType = BusinessType.DELETE) @Log(title = "通知公告", businessType = BusinessType.DELETE)
@DeleteMapping("/{noticeIds}") @DeleteMapping("/{noticeIds}")
public AjaxResult remove(@PathVariable Long[] noticeIds) public AjaxResult remove(@PathVariable Long[] noticeIds)
{ {
return toAjax(noticeService.deleteNoticeByIds(noticeIds)); return toAjax(noticeService.deleteNoticeByIds(noticeIds));
} }
} }

View File

@ -1,130 +1,130 @@
package com.ruoyi.web.controller.system; package com.stdiet.web.controller.system;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.stdiet.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants; import com.stdiet.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController; import com.stdiet.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.stdiet.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.stdiet.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.stdiet.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils; import com.stdiet.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.stdiet.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysPost; import com.stdiet.system.domain.SysPost;
import com.ruoyi.system.service.ISysPostService; import com.stdiet.system.service.ISysPostService;
/** /**
* 岗位信息操作处理 * 岗位信息操作处理
* *
* @author ruoyi * @author stdiet
*/ */
@RestController @RestController
@RequestMapping("/system/post") @RequestMapping("/system/post")
public class SysPostController extends BaseController public class SysPostController extends BaseController
{ {
@Autowired @Autowired
private ISysPostService postService; private ISysPostService postService;
/** /**
* 获取岗位列表 * 获取岗位列表
*/ */
@PreAuthorize("@ss.hasPermi('system:post:list')") @PreAuthorize("@ss.hasPermi('system:post:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysPost post) public TableDataInfo list(SysPost post)
{ {
startPage(); startPage();
List<SysPost> list = postService.selectPostList(post); List<SysPost> list = postService.selectPostList(post);
return getDataTable(list); return getDataTable(list);
} }
@Log(title = "岗位管理", businessType = BusinessType.EXPORT) @Log(title = "岗位管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:post:export')") @PreAuthorize("@ss.hasPermi('system:post:export')")
@GetMapping("/export") @GetMapping("/export")
public AjaxResult export(SysPost post) public AjaxResult export(SysPost post)
{ {
List<SysPost> list = postService.selectPostList(post); List<SysPost> list = postService.selectPostList(post);
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class); ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
return util.exportExcel(list, "岗位数据"); return util.exportExcel(list, "岗位数据");
} }
/** /**
* 根据岗位编号获取详细信息 * 根据岗位编号获取详细信息
*/ */
@PreAuthorize("@ss.hasPermi('system:post:query')") @PreAuthorize("@ss.hasPermi('system:post:query')")
@GetMapping(value = "/{postId}") @GetMapping(value = "/{postId}")
public AjaxResult getInfo(@PathVariable Long postId) public AjaxResult getInfo(@PathVariable Long postId)
{ {
return AjaxResult.success(postService.selectPostById(postId)); return AjaxResult.success(postService.selectPostById(postId));
} }
/** /**
* 新增岗位 * 新增岗位
*/ */
@PreAuthorize("@ss.hasPermi('system:post:add')") @PreAuthorize("@ss.hasPermi('system:post:add')")
@Log(title = "岗位管理", businessType = BusinessType.INSERT) @Log(title = "岗位管理", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@Validated @RequestBody SysPost post) public AjaxResult add(@Validated @RequestBody SysPost post)
{ {
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
{ {
return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在"); return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
} }
else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
{ {
return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在"); return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
} }
post.setCreateBy(SecurityUtils.getUsername()); post.setCreateBy(SecurityUtils.getUsername());
return toAjax(postService.insertPost(post)); return toAjax(postService.insertPost(post));
} }
/** /**
* 修改岗位 * 修改岗位
*/ */
@PreAuthorize("@ss.hasPermi('system:post:edit')") @PreAuthorize("@ss.hasPermi('system:post:edit')")
@Log(title = "岗位管理", businessType = BusinessType.UPDATE) @Log(title = "岗位管理", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody SysPost post) public AjaxResult edit(@Validated @RequestBody SysPost post)
{ {
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
{ {
return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在"); return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
} }
else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
{ {
return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在"); return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
} }
post.setUpdateBy(SecurityUtils.getUsername()); post.setUpdateBy(SecurityUtils.getUsername());
return toAjax(postService.updatePost(post)); return toAjax(postService.updatePost(post));
} }
/** /**
* 删除岗位 * 删除岗位
*/ */
@PreAuthorize("@ss.hasPermi('system:post:remove')") @PreAuthorize("@ss.hasPermi('system:post:remove')")
@Log(title = "岗位管理", businessType = BusinessType.DELETE) @Log(title = "岗位管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{postIds}") @DeleteMapping("/{postIds}")
public AjaxResult remove(@PathVariable Long[] postIds) public AjaxResult remove(@PathVariable Long[] postIds)
{ {
return toAjax(postService.deletePostByIds(postIds)); return toAjax(postService.deletePostByIds(postIds));
} }
/** /**
* 获取岗位选择框列表 * 获取岗位选择框列表
*/ */
@GetMapping("/optionselect") @GetMapping("/optionselect")
public AjaxResult optionselect() public AjaxResult optionselect()
{ {
List<SysPost> posts = postService.selectPostAll(); List<SysPost> posts = postService.selectPostAll();
return AjaxResult.success(posts); return AjaxResult.success(posts);
} }
} }

View File

@ -1,127 +1,127 @@
package com.ruoyi.web.controller.system; package com.stdiet.web.controller.system;
import java.io.IOException; import java.io.IOException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.annotation.Log; import com.stdiet.common.annotation.Log;
import com.ruoyi.common.config.RuoYiConfig; import com.stdiet.common.config.RuoYiConfig;
import com.ruoyi.common.core.controller.BaseController; import com.stdiet.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.stdiet.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser; import com.stdiet.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser; import com.stdiet.common.core.domain.model.LoginUser;
import com.ruoyi.common.enums.BusinessType; import com.stdiet.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils; import com.stdiet.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ServletUtils; import com.stdiet.common.utils.ServletUtils;
import com.ruoyi.common.utils.file.FileUploadUtils; import com.stdiet.common.utils.file.FileUploadUtils;
import com.ruoyi.framework.web.service.TokenService; import com.stdiet.framework.web.service.TokenService;
import com.ruoyi.system.service.ISysUserService; import com.stdiet.system.service.ISysUserService;
/** /**
* 个人信息 业务处理 * 个人信息 业务处理
* *
* @author ruoyi * @author stdiet
*/ */
@RestController @RestController
@RequestMapping("/system/user/profile") @RequestMapping("/system/user/profile")
public class SysProfileController extends BaseController public class SysProfileController extends BaseController
{ {
@Autowired @Autowired
private ISysUserService userService; private ISysUserService userService;
@Autowired @Autowired
private TokenService tokenService; private TokenService tokenService;
/** /**
* 个人信息 * 个人信息
*/ */
@GetMapping @GetMapping
public AjaxResult profile() public AjaxResult profile()
{ {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
SysUser user = loginUser.getUser(); SysUser user = loginUser.getUser();
AjaxResult ajax = AjaxResult.success(user); AjaxResult ajax = AjaxResult.success(user);
ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername())); ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername())); ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername()));
return ajax; return ajax;
} }
/** /**
* 修改用户 * 修改用户
*/ */
@Log(title = "个人信息", businessType = BusinessType.UPDATE) @Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult updateProfile(@RequestBody SysUser user) public AjaxResult updateProfile(@RequestBody SysUser user)
{ {
if (userService.updateUserProfile(user) > 0) if (userService.updateUserProfile(user) > 0)
{ {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
// 更新缓存用户信息 // 更新缓存用户信息
loginUser.getUser().setNickName(user.getNickName()); loginUser.getUser().setNickName(user.getNickName());
loginUser.getUser().setPhonenumber(user.getPhonenumber()); loginUser.getUser().setPhonenumber(user.getPhonenumber());
loginUser.getUser().setEmail(user.getEmail()); loginUser.getUser().setEmail(user.getEmail());
loginUser.getUser().setSex(user.getSex()); loginUser.getUser().setSex(user.getSex());
tokenService.setLoginUser(loginUser); tokenService.setLoginUser(loginUser);
return AjaxResult.success(); return AjaxResult.success();
} }
return AjaxResult.error("修改个人信息异常,请联系管理员"); return AjaxResult.error("修改个人信息异常,请联系管理员");
} }
/** /**
* 重置密码 * 重置密码
*/ */
@Log(title = "个人信息", businessType = BusinessType.UPDATE) @Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PutMapping("/updatePwd") @PutMapping("/updatePwd")
public AjaxResult updatePwd(String oldPassword, String newPassword) public AjaxResult updatePwd(String oldPassword, String newPassword)
{ {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
String userName = loginUser.getUsername(); String userName = loginUser.getUsername();
String password = loginUser.getPassword(); String password = loginUser.getPassword();
if (!SecurityUtils.matchesPassword(oldPassword, password)) if (!SecurityUtils.matchesPassword(oldPassword, password))
{ {
return AjaxResult.error("修改密码失败,旧密码错误"); return AjaxResult.error("修改密码失败,旧密码错误");
} }
if (SecurityUtils.matchesPassword(newPassword, password)) if (SecurityUtils.matchesPassword(newPassword, password))
{ {
return AjaxResult.error("新密码不能与旧密码相同"); return AjaxResult.error("新密码不能与旧密码相同");
} }
if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0) if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0)
{ {
// 更新缓存用户密码 // 更新缓存用户密码
loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword)); loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword));
tokenService.setLoginUser(loginUser); tokenService.setLoginUser(loginUser);
return AjaxResult.success(); return AjaxResult.success();
} }
return AjaxResult.error("修改密码异常,请联系管理员"); return AjaxResult.error("修改密码异常,请联系管理员");
} }
/** /**
* 头像上传 * 头像上传
*/ */
@Log(title = "用户头像", businessType = BusinessType.UPDATE) @Log(title = "用户头像", businessType = BusinessType.UPDATE)
@PostMapping("/avatar") @PostMapping("/avatar")
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws IOException public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws IOException
{ {
if (!file.isEmpty()) if (!file.isEmpty())
{ {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file); String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file);
if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) if (userService.updateUserAvatar(loginUser.getUsername(), avatar))
{ {
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
ajax.put("imgUrl", avatar); ajax.put("imgUrl", avatar);
// 更新缓存用户头像 // 更新缓存用户头像
loginUser.getUser().setAvatar(avatar); loginUser.getUser().setAvatar(avatar);
tokenService.setLoginUser(loginUser); tokenService.setLoginUser(loginUser);
return ajax; return ajax;
} }
} }
return AjaxResult.error("上传图片异常,请联系管理员"); return AjaxResult.error("上传图片异常,请联系管理员");
} }
} }

View File

@ -1,182 +1,182 @@
package com.ruoyi.web.controller.system; package com.stdiet.web.controller.system;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.stdiet.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants; import com.stdiet.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController; import com.stdiet.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.stdiet.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysRole; import com.stdiet.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.model.LoginUser; import com.stdiet.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo; import com.stdiet.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.stdiet.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils; import com.stdiet.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ServletUtils; import com.stdiet.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils; import com.stdiet.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.stdiet.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.service.SysPermissionService; import com.stdiet.framework.web.service.SysPermissionService;
import com.ruoyi.framework.web.service.TokenService; import com.stdiet.framework.web.service.TokenService;
import com.ruoyi.system.service.ISysRoleService; import com.stdiet.system.service.ISysRoleService;
import com.ruoyi.system.service.ISysUserService; import com.stdiet.system.service.ISysUserService;
/** /**
* 角色信息 * 角色信息
* *
* @author ruoyi * @author stdiet
*/ */
@RestController @RestController
@RequestMapping("/system/role") @RequestMapping("/system/role")
public class SysRoleController extends BaseController public class SysRoleController extends BaseController
{ {
@Autowired @Autowired
private ISysRoleService roleService; private ISysRoleService roleService;
@Autowired @Autowired
private TokenService tokenService; private TokenService tokenService;
@Autowired @Autowired
private SysPermissionService permissionService; private SysPermissionService permissionService;
@Autowired @Autowired
private ISysUserService userService; private ISysUserService userService;
@PreAuthorize("@ss.hasPermi('system:role:list')") @PreAuthorize("@ss.hasPermi('system:role:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysRole role) public TableDataInfo list(SysRole role)
{ {
startPage(); startPage();
List<SysRole> list = roleService.selectRoleList(role); List<SysRole> list = roleService.selectRoleList(role);
return getDataTable(list); return getDataTable(list);
} }
@Log(title = "角色管理", businessType = BusinessType.EXPORT) @Log(title = "角色管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:role:export')") @PreAuthorize("@ss.hasPermi('system:role:export')")
@GetMapping("/export") @GetMapping("/export")
public AjaxResult export(SysRole role) public AjaxResult export(SysRole role)
{ {
List<SysRole> list = roleService.selectRoleList(role); List<SysRole> list = roleService.selectRoleList(role);
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class); ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
return util.exportExcel(list, "角色数据"); return util.exportExcel(list, "角色数据");
} }
/** /**
* 根据角色编号获取详细信息 * 根据角色编号获取详细信息
*/ */
@PreAuthorize("@ss.hasPermi('system:role:query')") @PreAuthorize("@ss.hasPermi('system:role:query')")
@GetMapping(value = "/{roleId}") @GetMapping(value = "/{roleId}")
public AjaxResult getInfo(@PathVariable Long roleId) public AjaxResult getInfo(@PathVariable Long roleId)
{ {
return AjaxResult.success(roleService.selectRoleById(roleId)); return AjaxResult.success(roleService.selectRoleById(roleId));
} }
/** /**
* 新增角色 * 新增角色
*/ */
@PreAuthorize("@ss.hasPermi('system:role:add')") @PreAuthorize("@ss.hasPermi('system:role:add')")
@Log(title = "角色管理", businessType = BusinessType.INSERT) @Log(title = "角色管理", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@Validated @RequestBody SysRole role) public AjaxResult add(@Validated @RequestBody SysRole role)
{ {
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
{ {
return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在"); return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
} }
else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
{ {
return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在"); return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
} }
role.setCreateBy(SecurityUtils.getUsername()); role.setCreateBy(SecurityUtils.getUsername());
return toAjax(roleService.insertRole(role)); return toAjax(roleService.insertRole(role));
} }
/** /**
* 修改保存角色 * 修改保存角色
*/ */
@PreAuthorize("@ss.hasPermi('system:role:edit')") @PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.UPDATE) @Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody SysRole role) public AjaxResult edit(@Validated @RequestBody SysRole role)
{ {
roleService.checkRoleAllowed(role); roleService.checkRoleAllowed(role);
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
{ {
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在"); return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
} }
else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
{ {
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在"); return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
} }
role.setUpdateBy(SecurityUtils.getUsername()); role.setUpdateBy(SecurityUtils.getUsername());
if (roleService.updateRole(role) > 0) if (roleService.updateRole(role) > 0)
{ {
// 更新缓存用户权限 // 更新缓存用户权限
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin()) if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
{ {
loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser())); loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName())); loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
tokenService.setLoginUser(loginUser); tokenService.setLoginUser(loginUser);
} }
return AjaxResult.success(); return AjaxResult.success();
} }
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,请联系管理员"); return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
} }
/** /**
* 修改保存数据权限 * 修改保存数据权限
*/ */
@PreAuthorize("@ss.hasPermi('system:role:edit')") @PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.UPDATE) @Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping("/dataScope") @PutMapping("/dataScope")
public AjaxResult dataScope(@RequestBody SysRole role) public AjaxResult dataScope(@RequestBody SysRole role)
{ {
roleService.checkRoleAllowed(role); roleService.checkRoleAllowed(role);
return toAjax(roleService.authDataScope(role)); return toAjax(roleService.authDataScope(role));
} }
/** /**
* 状态修改 * 状态修改
*/ */
@PreAuthorize("@ss.hasPermi('system:role:edit')") @PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.UPDATE) @Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus") @PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody SysRole role) public AjaxResult changeStatus(@RequestBody SysRole role)
{ {
roleService.checkRoleAllowed(role); roleService.checkRoleAllowed(role);
role.setUpdateBy(SecurityUtils.getUsername()); role.setUpdateBy(SecurityUtils.getUsername());
return toAjax(roleService.updateRoleStatus(role)); return toAjax(roleService.updateRoleStatus(role));
} }
/** /**
* 删除角色 * 删除角色
*/ */
@PreAuthorize("@ss.hasPermi('system:role:remove')") @PreAuthorize("@ss.hasPermi('system:role:remove')")
@Log(title = "角色管理", businessType = BusinessType.DELETE) @Log(title = "角色管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{roleIds}") @DeleteMapping("/{roleIds}")
public AjaxResult remove(@PathVariable Long[] roleIds) public AjaxResult remove(@PathVariable Long[] roleIds)
{ {
return toAjax(roleService.deleteRoleByIds(roleIds)); return toAjax(roleService.deleteRoleByIds(roleIds));
} }
/** /**
* 获取角色选择框列表 * 获取角色选择框列表
*/ */
@PreAuthorize("@ss.hasPermi('system:role:query')") @PreAuthorize("@ss.hasPermi('system:role:query')")
@GetMapping("/optionselect") @GetMapping("/optionselect")
public AjaxResult optionselect() public AjaxResult optionselect()
{ {
return AjaxResult.success(roleService.selectRoleAll()); return AjaxResult.success(roleService.selectRoleAll());
} }
} }

View File

@ -1,201 +1,201 @@
package com.ruoyi.web.controller.system; package com.stdiet.web.controller.system;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.annotation.Log; import com.stdiet.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants; import com.stdiet.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController; import com.stdiet.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.stdiet.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysRole; import com.stdiet.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser; import com.stdiet.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser; import com.stdiet.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo; import com.stdiet.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.stdiet.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils; import com.stdiet.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ServletUtils; import com.stdiet.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils; import com.stdiet.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.stdiet.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.service.TokenService; import com.stdiet.framework.web.service.TokenService;
import com.ruoyi.system.service.ISysPostService; import com.stdiet.system.service.ISysPostService;
import com.ruoyi.system.service.ISysRoleService; import com.stdiet.system.service.ISysRoleService;
import com.ruoyi.system.service.ISysUserService; import com.stdiet.system.service.ISysUserService;
/** /**
* 用户信息 * 用户信息
* *
* @author ruoyi * @author stdiet
*/ */
@RestController @RestController
@RequestMapping("/system/user") @RequestMapping("/system/user")
public class SysUserController extends BaseController public class SysUserController extends BaseController
{ {
@Autowired @Autowired
private ISysUserService userService; private ISysUserService userService;
@Autowired @Autowired
private ISysRoleService roleService; private ISysRoleService roleService;
@Autowired @Autowired
private ISysPostService postService; private ISysPostService postService;
@Autowired @Autowired
private TokenService tokenService; private TokenService tokenService;
/** /**
* 获取用户列表 * 获取用户列表
*/ */
@PreAuthorize("@ss.hasPermi('system:user:list')") @PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysUser user) public TableDataInfo list(SysUser user)
{ {
startPage(); startPage();
List<SysUser> list = userService.selectUserList(user); List<SysUser> list = userService.selectUserList(user);
return getDataTable(list); return getDataTable(list);
} }
@Log(title = "用户管理", businessType = BusinessType.EXPORT) @Log(title = "用户管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:user:export')") @PreAuthorize("@ss.hasPermi('system:user:export')")
@GetMapping("/export") @GetMapping("/export")
public AjaxResult export(SysUser user) public AjaxResult export(SysUser user)
{ {
List<SysUser> list = userService.selectUserList(user); List<SysUser> list = userService.selectUserList(user);
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
return util.exportExcel(list, "用户数据"); return util.exportExcel(list, "用户数据");
} }
@Log(title = "用户管理", businessType = BusinessType.IMPORT) @Log(title = "用户管理", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('system:user:import')") @PreAuthorize("@ss.hasPermi('system:user:import')")
@PostMapping("/importData") @PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
{ {
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
List<SysUser> userList = util.importExcel(file.getInputStream()); List<SysUser> userList = util.importExcel(file.getInputStream());
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
String operName = loginUser.getUsername(); String operName = loginUser.getUsername();
String message = userService.importUser(userList, updateSupport, operName); String message = userService.importUser(userList, updateSupport, operName);
return AjaxResult.success(message); return AjaxResult.success(message);
} }
@GetMapping("/importTemplate") @GetMapping("/importTemplate")
public AjaxResult importTemplate() public AjaxResult importTemplate()
{ {
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
return util.importTemplateExcel("用户数据"); return util.importTemplateExcel("用户数据");
} }
/** /**
* 根据用户编号获取详细信息 * 根据用户编号获取详细信息
*/ */
@PreAuthorize("@ss.hasPermi('system:user:query')") @PreAuthorize("@ss.hasPermi('system:user:query')")
@GetMapping(value = { "/", "/{userId}" }) @GetMapping(value = { "/", "/{userId}" })
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
{ {
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
List<SysRole> roles = roleService.selectRoleAll(); List<SysRole> roles = roleService.selectRoleAll();
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
ajax.put("posts", postService.selectPostAll()); ajax.put("posts", postService.selectPostAll());
if (StringUtils.isNotNull(userId)) if (StringUtils.isNotNull(userId))
{ {
ajax.put(AjaxResult.DATA_TAG, userService.selectUserById(userId)); ajax.put(AjaxResult.DATA_TAG, userService.selectUserById(userId));
ajax.put("postIds", postService.selectPostListByUserId(userId)); ajax.put("postIds", postService.selectPostListByUserId(userId));
ajax.put("roleIds", roleService.selectRoleListByUserId(userId)); ajax.put("roleIds", roleService.selectRoleListByUserId(userId));
} }
return ajax; return ajax;
} }
/** /**
* 新增用户 * 新增用户
*/ */
@PreAuthorize("@ss.hasPermi('system:user:add')") @PreAuthorize("@ss.hasPermi('system:user:add')")
@Log(title = "用户管理", businessType = BusinessType.INSERT) @Log(title = "用户管理", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@Validated @RequestBody SysUser user) public AjaxResult add(@Validated @RequestBody SysUser user)
{ {
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName()))) if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName())))
{ {
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在"); return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
} }
// else if (UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) // else if (UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
// { // {
// return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在"); // return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
// } // }
// else if (UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) // else if (UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
// { // {
// return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"); // return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
// } // }
user.setCreateBy(SecurityUtils.getUsername()); user.setCreateBy(SecurityUtils.getUsername());
user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
return toAjax(userService.insertUser(user)); return toAjax(userService.insertUser(user));
} }
/** /**
* 修改用户 * 修改用户
*/ */
@PreAuthorize("@ss.hasPermi('system:user:edit')") @PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "用户管理", businessType = BusinessType.UPDATE) @Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody SysUser user) public AjaxResult edit(@Validated @RequestBody SysUser user)
{ {
userService.checkUserAllowed(user); userService.checkUserAllowed(user);
// if (UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) // if (UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
// { // {
// return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); // return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
// } // }
// else if (UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) // else if (UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
// { // {
// return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); // return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
// } // }
user.setUpdateBy(SecurityUtils.getUsername()); user.setUpdateBy(SecurityUtils.getUsername());
return toAjax(userService.updateUser(user)); return toAjax(userService.updateUser(user));
} }
/** /**
* 删除用户 * 删除用户
*/ */
@PreAuthorize("@ss.hasPermi('system:user:remove')") @PreAuthorize("@ss.hasPermi('system:user:remove')")
@Log(title = "用户管理", businessType = BusinessType.DELETE) @Log(title = "用户管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{userIds}") @DeleteMapping("/{userIds}")
public AjaxResult remove(@PathVariable Long[] userIds) public AjaxResult remove(@PathVariable Long[] userIds)
{ {
return toAjax(userService.deleteUserByIds(userIds)); return toAjax(userService.deleteUserByIds(userIds));
} }
/** /**
* 重置密码 * 重置密码
*/ */
@PreAuthorize("@ss.hasPermi('system:user:edit')") @PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "用户管理", businessType = BusinessType.UPDATE) @Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping("/resetPwd") @PutMapping("/resetPwd")
public AjaxResult resetPwd(@RequestBody SysUser user) public AjaxResult resetPwd(@RequestBody SysUser user)
{ {
userService.checkUserAllowed(user); userService.checkUserAllowed(user);
user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
user.setUpdateBy(SecurityUtils.getUsername()); user.setUpdateBy(SecurityUtils.getUsername());
return toAjax(userService.resetPwd(user)); return toAjax(userService.resetPwd(user));
} }
/** /**
* 状态修改 * 状态修改
*/ */
@PreAuthorize("@ss.hasPermi('system:user:edit')") @PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "用户管理", businessType = BusinessType.UPDATE) @Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus") @PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody SysUser user) public AjaxResult changeStatus(@RequestBody SysUser user)
{ {
userService.checkUserAllowed(user); userService.checkUserAllowed(user);
user.setUpdateBy(SecurityUtils.getUsername()); user.setUpdateBy(SecurityUtils.getUsername());
return toAjax(userService.updateUserStatus(user)); return toAjax(userService.updateUserStatus(user));
} }
} }

View File

@ -1,24 +1,24 @@
package com.ruoyi.web.controller.tool; package com.stdiet.web.controller.tool;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.common.core.controller.BaseController; import com.stdiet.common.core.controller.BaseController;
/** /**
* swagger 接口 * swagger 接口
* *
* @author ruoyi * @author ruoyi
*/ */
@Controller @Controller
@RequestMapping("/tool/swagger") @RequestMapping("/tool/swagger")
public class SwaggerController extends BaseController public class SwaggerController extends BaseController
{ {
@PreAuthorize("@ss.hasPermi('tool:swagger:view')") @PreAuthorize("@ss.hasPermi('tool:swagger:view')")
@GetMapping() @GetMapping()
public String index() public String index()
{ {
return redirect("/swagger-ui.html"); return redirect("/swagger-ui.html");
} }
} }

View File

@ -1,175 +1,175 @@
package com.ruoyi.web.controller.tool; package com.stdiet.web.controller.tool;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController; import com.stdiet.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.stdiet.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils; import com.stdiet.common.utils.StringUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
/** /**
* swagger 用户测试方法 * swagger 用户测试方法
* *
* @author ruoyi * @author ruoyi
*/ */
@Api("用户信息管理") @Api("用户信息管理")
@RestController @RestController
@RequestMapping("/test/user") @RequestMapping("/test/user")
public class TestController extends BaseController public class TestController extends BaseController
{ {
private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>(); private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
{ {
users.put(1, new UserEntity(1, "admin", "admin123", "15888888888")); users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
users.put(2, new UserEntity(2, "ry", "admin123", "15666666666")); users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
} }
@ApiOperation("获取用户列表") @ApiOperation("获取用户列表")
@GetMapping("/list") @GetMapping("/list")
public AjaxResult userList() public AjaxResult userList()
{ {
List<UserEntity> userList = new ArrayList<UserEntity>(users.values()); List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
return AjaxResult.success(userList); return AjaxResult.success(userList);
} }
@ApiOperation("获取用户详细") @ApiOperation("获取用户详细")
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path") @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
@GetMapping("/{userId}") @GetMapping("/{userId}")
public AjaxResult getUser(@PathVariable Integer userId) public AjaxResult getUser(@PathVariable Integer userId)
{ {
if (!users.isEmpty() && users.containsKey(userId)) if (!users.isEmpty() && users.containsKey(userId))
{ {
return AjaxResult.success(users.get(userId)); return AjaxResult.success(users.get(userId));
} }
else else
{ {
return AjaxResult.error("用户不存在"); return AjaxResult.error("用户不存在");
} }
} }
@ApiOperation("新增用户") @ApiOperation("新增用户")
@ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity") @ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
@PostMapping("/save") @PostMapping("/save")
public AjaxResult save(UserEntity user) public AjaxResult save(UserEntity user)
{ {
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
{ {
return AjaxResult.error("用户ID不能为空"); return AjaxResult.error("用户ID不能为空");
} }
return AjaxResult.success(users.put(user.getUserId(), user)); return AjaxResult.success(users.put(user.getUserId(), user));
} }
@ApiOperation("更新用户") @ApiOperation("更新用户")
@ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity") @ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
@PutMapping("/update") @PutMapping("/update")
public AjaxResult update(UserEntity user) public AjaxResult update(UserEntity user)
{ {
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
{ {
return AjaxResult.error("用户ID不能为空"); return AjaxResult.error("用户ID不能为空");
} }
if (users.isEmpty() || !users.containsKey(user.getUserId())) if (users.isEmpty() || !users.containsKey(user.getUserId()))
{ {
return AjaxResult.error("用户不存在"); return AjaxResult.error("用户不存在");
} }
users.remove(user.getUserId()); users.remove(user.getUserId());
return AjaxResult.success(users.put(user.getUserId(), user)); return AjaxResult.success(users.put(user.getUserId(), user));
} }
@ApiOperation("删除用户信息") @ApiOperation("删除用户信息")
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path") @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
@DeleteMapping("/{userId}") @DeleteMapping("/{userId}")
public AjaxResult delete(@PathVariable Integer userId) public AjaxResult delete(@PathVariable Integer userId)
{ {
if (!users.isEmpty() && users.containsKey(userId)) if (!users.isEmpty() && users.containsKey(userId))
{ {
users.remove(userId); users.remove(userId);
return AjaxResult.success(); return AjaxResult.success();
} }
else else
{ {
return AjaxResult.error("用户不存在"); return AjaxResult.error("用户不存在");
} }
} }
} }
@ApiModel("用户实体") @ApiModel("用户实体")
class UserEntity class UserEntity
{ {
@ApiModelProperty("用户ID") @ApiModelProperty("用户ID")
private Integer userId; private Integer userId;
@ApiModelProperty("用户名称") @ApiModelProperty("用户名称")
private String username; private String username;
@ApiModelProperty("用户密码") @ApiModelProperty("用户密码")
private String password; private String password;
@ApiModelProperty("用户手机") @ApiModelProperty("用户手机")
private String mobile; private String mobile;
public UserEntity() public UserEntity()
{ {
} }
public UserEntity(Integer userId, String username, String password, String mobile) public UserEntity(Integer userId, String username, String password, String mobile)
{ {
this.userId = userId; this.userId = userId;
this.username = username; this.username = username;
this.password = password; this.password = password;
this.mobile = mobile; this.mobile = mobile;
} }
public Integer getUserId() public Integer getUserId()
{ {
return userId; return userId;
} }
public void setUserId(Integer userId) public void setUserId(Integer userId)
{ {
this.userId = userId; this.userId = userId;
} }
public String getUsername() public String getUsername()
{ {
return username; return username;
} }
public void setUsername(String username) public void setUsername(String username)
{ {
this.username = username; this.username = username;
} }
public String getPassword() public String getPassword()
{ {
return password; return password;
} }
public void setPassword(String password) public void setPassword(String password)
{ {
this.password = password; this.password = password;
} }
public String getMobile() public String getMobile()
{ {
return mobile; return mobile;
} }
public void setMobile(String mobile) public void setMobile(String mobile)
{ {
this.mobile = mobile; this.mobile = mobile;
} }
} }

View File

@ -1,125 +1,125 @@
package com.ruoyi.web.core.config; package com.stdiet.web.core.config;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import com.ruoyi.common.config.RuoYiConfig; import com.stdiet.common.config.RuoYiConfig;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo; import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.ApiKey; import springfox.documentation.service.ApiKey;
import springfox.documentation.service.AuthorizationScope; import springfox.documentation.service.AuthorizationScope;
import springfox.documentation.service.Contact; import springfox.documentation.service.Contact;
import springfox.documentation.service.SecurityReference; import springfox.documentation.service.SecurityReference;
import springfox.documentation.spi.DocumentationType; import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.contexts.SecurityContext; import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2; import springfox.documentation.swagger2.annotations.EnableSwagger2;
/** /**
* Swagger2的接口配置 * Swagger2的接口配置
* *
* @author ruoyi * @author ruoyi
*/ */
@Configuration @Configuration
@EnableSwagger2 @EnableSwagger2
public class SwaggerConfig public class SwaggerConfig
{ {
/** 系统基础配置 */ /** 系统基础配置 */
@Autowired @Autowired
private RuoYiConfig ruoyiConfig; private RuoYiConfig ruoyiConfig;
/** 是否开启swagger */ /** 是否开启swagger */
@Value("${swagger.enabled}") @Value("${swagger.enabled}")
private boolean enabled; private boolean enabled;
/** 设置请求的统一前缀 */ /** 设置请求的统一前缀 */
@Value("${swagger.pathMapping}") @Value("${swagger.pathMapping}")
private String pathMapping; private String pathMapping;
/** /**
* 创建API * 创建API
*/ */
@Bean @Bean
public Docket createRestApi() public Docket createRestApi()
{ {
return new Docket(DocumentationType.SWAGGER_2) return new Docket(DocumentationType.SWAGGER_2)
// 是否启用Swagger // 是否启用Swagger
.enable(enabled) .enable(enabled)
// 用来创建该API的基本信息展示在文档的页面中自定义展示的信息 // 用来创建该API的基本信息展示在文档的页面中自定义展示的信息
.apiInfo(apiInfo()) .apiInfo(apiInfo())
// 设置哪些接口暴露给Swagger展示 // 设置哪些接口暴露给Swagger展示
.select() .select()
// 扫描所有有注解的api用这种方式更灵活 // 扫描所有有注解的api用这种方式更灵活
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
// 扫描指定包中的swagger注解 // 扫描指定包中的swagger注解
// .apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger")) // .apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger"))
// 扫描所有 .apis(RequestHandlerSelectors.any()) // 扫描所有 .apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any()) .paths(PathSelectors.any())
.build() .build()
/* 设置安全模式swagger可以设置访问token */ /* 设置安全模式swagger可以设置访问token */
.securitySchemes(securitySchemes()) .securitySchemes(securitySchemes())
.securityContexts(securityContexts()) .securityContexts(securityContexts())
.pathMapping(pathMapping); .pathMapping(pathMapping);
} }
/** /**
* 安全模式这里指定token通过Authorization头请求头传递 * 安全模式这里指定token通过Authorization头请求头传递
*/ */
private List<ApiKey> securitySchemes() private List<ApiKey> securitySchemes()
{ {
List<ApiKey> apiKeyList = new ArrayList<ApiKey>(); List<ApiKey> apiKeyList = new ArrayList<ApiKey>();
apiKeyList.add(new ApiKey("Authorization", "Authorization", "header")); apiKeyList.add(new ApiKey("Authorization", "Authorization", "header"));
return apiKeyList; return apiKeyList;
} }
/** /**
* 安全上下文 * 安全上下文
*/ */
private List<SecurityContext> securityContexts() private List<SecurityContext> securityContexts()
{ {
List<SecurityContext> securityContexts = new ArrayList<>(); List<SecurityContext> securityContexts = new ArrayList<>();
securityContexts.add( securityContexts.add(
SecurityContext.builder() SecurityContext.builder()
.securityReferences(defaultAuth()) .securityReferences(defaultAuth())
.forPaths(PathSelectors.regex("^(?!auth).*$")) .forPaths(PathSelectors.regex("^(?!auth).*$"))
.build()); .build());
return securityContexts; return securityContexts;
} }
/** /**
* 默认的安全上引用 * 默认的安全上引用
*/ */
private List<SecurityReference> defaultAuth() private List<SecurityReference> defaultAuth()
{ {
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
authorizationScopes[0] = authorizationScope; authorizationScopes[0] = authorizationScope;
List<SecurityReference> securityReferences = new ArrayList<>(); List<SecurityReference> securityReferences = new ArrayList<>();
securityReferences.add(new SecurityReference("Authorization", authorizationScopes)); securityReferences.add(new SecurityReference("Authorization", authorizationScopes));
return securityReferences; return securityReferences;
} }
/** /**
* 添加摘要信息 * 添加摘要信息
*/ */
private ApiInfo apiInfo() private ApiInfo apiInfo()
{ {
// 用ApiInfoBuilder进行定制 // 用ApiInfoBuilder进行定制
return new ApiInfoBuilder() return new ApiInfoBuilder()
// 设置标题 // 设置标题
.title("标题管理系统_接口文档") .title("标题管理系统_接口文档")
// 描述 // 描述
.description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...") .description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
// 作者信息 // 作者信息
.contact(new Contact(ruoyiConfig.getName(), null, null)) .contact(new Contact(ruoyiConfig.getName(), null, null))
// 版本 // 版本
.version("版本号:" + ruoyiConfig.getVersion()) .version("版本号:" + ruoyiConfig.getVersion())
.build(); .build();
} }
} }

View File

@ -1,24 +1,24 @@
Application Version: ${ruoyi.version} Application Version: ${stdiet.version}
Spring Boot Version: ${spring-boot.version} Spring Boot Version: ${spring-boot.version}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// _ooOoo_ // // _ooOoo_ //
// o8888888o // // o8888888o //
// 88" . "88 // // 88" . "88 //
// (| ^_^ |) // // (| ^_^ |) //
// O\ = /O // // O\ = /O //
// ____/`---'\____ // // ____/`---'\____ //
// .' \\| |// `. // // .' \\| |// `. //
// / \\||| : |||// \ // // / \\||| : |||// \ //
// / _||||| -:- |||||- \ // // / _||||| -:- |||||- \ //
// | | \\\ - /// | | // // | | \\\ - /// | | //
// | \_| ''\---/'' | | // // | \_| ''\---/'' | | //
// \ .-\__ `-` ___/-. / // // \ .-\__ `-` ___/-. / //
// ___`. .' /--.--\ `. . ___ // // ___`. .' /--.--\ `. . ___ //
// ."" '< `.___\_<|>_/___.' >'"". // // ."" '< `.___\_<|>_/___.' >'"". //
// | | : `- \`.;`\ _ /`;.`/ - ` : | | // // | | : `- \`.;`\ _ /`;.`/ - ` : | | //
// \ \ `-. \_ __\ /__ _/ .-` / / // // \ \ `-. \_ __\ /__ _/ .-` / / //
// ========`-.____`-.___\_____/___.-`____.-'======== // // ========`-.____`-.___\_____/___.-`____.-'======== //
// `=---=' // // `=---=' //
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
// 佛祖保佑 永不宕机 永无BUG // // 佛祖保佑 永不宕机 永无BUG //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////

View File

@ -1,36 +1,36 @@
#错误消息 #错误消息
not.null=* 必须填写 not.null=* 必须填写
user.jcaptcha.error=验证码错误 user.jcaptcha.error=验证码错误
user.jcaptcha.expire=验证码已失效 user.jcaptcha.expire=验证码已失效
user.not.exists=用户不存在/密码错误 user.not.exists=用户不存在/密码错误
user.password.not.match=用户不存在/密码错误 user.password.not.match=用户不存在/密码错误
user.password.retry.limit.count=密码输入错误{0}次 user.password.retry.limit.count=密码输入错误{0}次
user.password.retry.limit.exceed=密码输入错误{0}次帐户锁定10分钟 user.password.retry.limit.exceed=密码输入错误{0}次帐户锁定10分钟
user.password.delete=对不起,您的账号已被删除 user.password.delete=对不起,您的账号已被删除
user.blocked=用户已封禁,请联系管理员 user.blocked=用户已封禁,请联系管理员
role.blocked=角色已封禁,请联系管理员 role.blocked=角色已封禁,请联系管理员
user.logout.success=退出成功 user.logout.success=退出成功
length.not.valid=长度必须在{min}到{max}个字符之间 length.not.valid=长度必须在{min}到{max}个字符之间
user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成且必须以非数字开头 user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成且必须以非数字开头
user.password.not.valid=* 5-50个字符 user.password.not.valid=* 5-50个字符
user.email.not.valid=邮箱格式错误 user.email.not.valid=邮箱格式错误
user.mobile.phone.number.not.valid=手机号格式错误 user.mobile.phone.number.not.valid=手机号格式错误
user.login.success=登录成功 user.login.success=登录成功
user.notfound=请重新登录 user.notfound=请重新登录
user.forcelogout=管理员强制退出,请重新登录 user.forcelogout=管理员强制退出,请重新登录
user.unknown.error=未知错误,请重新登录 user.unknown.error=未知错误,请重新登录
##文件上传消息 ##文件上传消息
upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB
upload.filename.exceed.length=上传的文件名最长{0}个字符 upload.filename.exceed.length=上传的文件名最长{0}个字符
##权限 ##权限
no.permission=您没有数据的权限,请联系管理员添加权限 [{0}] no.permission=您没有数据的权限,请联系管理员添加权限 [{0}]
no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}] no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}]
no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}] no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}]
no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}] no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}]
no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}] no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}]
no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}] no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}]

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration <!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN" PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd"> "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration> <configuration>
<settings> <settings>
<setting name="cacheEnabled" value="true" /> <!-- 全局映射器启用缓存 --> <setting name="cacheEnabled" value="true" /> <!-- 全局映射器启用缓存 -->
<setting name="useGeneratedKeys" value="true" /> <!-- 允许 JDBC 支持自动生成主键 --> <setting name="useGeneratedKeys" value="true" /> <!-- 允许 JDBC 支持自动生成主键 -->
<setting name="defaultExecutorType" value="REUSE" /> <!-- 配置默认的执行器 --> <setting name="defaultExecutorType" value="REUSE" /> <!-- 配置默认的执行器 -->
<setting name="logImpl" value="SLF4J" /> <!-- 指定 MyBatis 所用日志的具体实现 --> <setting name="logImpl" value="SLF4J" /> <!-- 指定 MyBatis 所用日志的具体实现 -->
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> 驼峰式命名 --> <!-- <setting name="mapUnderscoreToCamelCase" value="true"/> 驼峰式命名 -->
</settings> </settings>
</configuration> </configuration>

View File

@ -1,124 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<artifactId>ruoyi</artifactId> <artifactId>stdiet</artifactId>
<groupId>com.ruoyi</groupId> <groupId>com.stdiet</groupId>
<version>3.1.0</version> <version>3.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>ruoyi-common</artifactId> <artifactId>stdiet-common</artifactId>
<description> <description>
common通用工具 common通用工具
</description> </description>
<dependencies> <dependencies>
<!-- Spring框架基本的核心工具 --> <!-- Spring框架基本的核心工具 -->
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId> <artifactId>spring-context-support</artifactId>
</dependency> </dependency>
<!-- SpringWeb模块 --> <!-- SpringWeb模块 -->
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId> <artifactId>spring-web</artifactId>
</dependency> </dependency>
<!-- spring security 安全认证 --> <!-- spring security 安全认证 -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId> <artifactId>spring-boot-starter-security</artifactId>
</dependency> </dependency>
<!-- pagehelper 分页插件 --> <!-- pagehelper 分页插件 -->
<dependency> <dependency>
<groupId>com.github.pagehelper</groupId> <groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId> <artifactId>pagehelper-spring-boot-starter</artifactId>
</dependency> </dependency>
<!-- 自定义验证注解 --> <!-- 自定义验证注解 -->
<dependency> <dependency>
<groupId>javax.validation</groupId> <groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId> <artifactId>validation-api</artifactId>
</dependency> </dependency>
<!--常用工具类 --> <!--常用工具类 -->
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
</dependency> </dependency>
<!-- JSON工具类 --> <!-- JSON工具类 -->
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId> <artifactId>jackson-databind</artifactId>
</dependency> </dependency>
<!-- 阿里JSON解析器 --> <!-- 阿里JSON解析器 -->
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId> <artifactId>fastjson</artifactId>
</dependency> </dependency>
<!-- io常用工具类 --> <!-- io常用工具类 -->
<dependency> <dependency>
<groupId>commons-io</groupId> <groupId>commons-io</groupId>
<artifactId>commons-io</artifactId> <artifactId>commons-io</artifactId>
</dependency> </dependency>
<!-- 文件上传工具类 --> <!-- 文件上传工具类 -->
<dependency> <dependency>
<groupId>commons-fileupload</groupId> <groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId> <artifactId>commons-fileupload</artifactId>
</dependency> </dependency>
<!-- excel工具 --> <!-- excel工具 -->
<dependency> <dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId> <artifactId>poi-ooxml</artifactId>
</dependency> </dependency>
<!-- yml解析器 --> <!-- yml解析器 -->
<dependency> <dependency>
<groupId>org.yaml</groupId> <groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId> <artifactId>snakeyaml</artifactId>
</dependency> </dependency>
<!--Token生成与解析--> <!--Token生成与解析-->
<dependency> <dependency>
<groupId>io.jsonwebtoken</groupId> <groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId> <artifactId>jjwt</artifactId>
</dependency> </dependency>
<!-- redis 缓存操作 --> <!-- redis 缓存操作 -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId> <artifactId>spring-boot-starter-data-redis</artifactId>
</dependency> </dependency>
<!-- pool 对象池 --> <!-- pool 对象池 -->
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId> <artifactId>commons-pool2</artifactId>
</dependency> </dependency>
<!-- 解析客户端操作系统、浏览器等 --> <!-- 解析客户端操作系统、浏览器等 -->
<dependency> <dependency>
<groupId>eu.bitwalker</groupId> <groupId>eu.bitwalker</groupId>
<artifactId>UserAgentUtils</artifactId> <artifactId>UserAgentUtils</artifactId>
</dependency> </dependency>
<!-- servlet包 --> <!-- servlet包 -->
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId> <artifactId>javax.servlet-api</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -1,28 +1,28 @@
package com.ruoyi.common.annotation; package com.stdiet.common.annotation;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
/** /**
* 数据权限过滤注解 * 数据权限过滤注解
* *
* @author ruoyi * @author stdiet
*/ */
@Target(ElementType.METHOD) @Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Documented @Documented
public @interface DataScope public @interface DataScope
{ {
/** /**
* 部门表的别名 * 部门表的别名
*/ */
public String deptAlias() default ""; public String deptAlias() default "";
/** /**
* 用户表的别名 * 用户表的别名
*/ */
public String userAlias() default ""; public String userAlias() default "";
} }

View File

@ -1,28 +1,28 @@
package com.ruoyi.common.annotation; package com.stdiet.common.annotation;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited; import java.lang.annotation.Inherited;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import com.ruoyi.common.enums.DataSourceType; import com.stdiet.common.enums.DataSourceType;
/** /**
* 自定义多数据源切换注解 * 自定义多数据源切换注解
* *
* 优先级先方法后类如果方法覆盖了类上的数据源类型以方法的为准否则以类上的为准 * 优先级先方法后类如果方法覆盖了类上的数据源类型以方法的为准否则以类上的为准
* *
* @author ruoyi * @author stdiet
*/ */
@Target({ ElementType.METHOD, ElementType.TYPE }) @Target({ ElementType.METHOD, ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Documented @Documented
@Inherited @Inherited
public @interface DataSource public @interface DataSource
{ {
/** /**
* 切换数据源名称 * 切换数据源名称
*/ */
public DataSourceType value() default DataSourceType.MASTER; public DataSourceType value() default DataSourceType.MASTER;
} }

View File

@ -1,144 +1,144 @@
package com.ruoyi.common.annotation; package com.stdiet.common.annotation;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
* 自定义导出Excel数据注解 * 自定义导出Excel数据注解
* *
* @author ruoyi * @author stdiet
*/ */
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD) @Target(ElementType.FIELD)
public @interface Excel public @interface Excel
{ {
/** /**
* 导出时在excel中排序 * 导出时在excel中排序
*/ */
public int sort() default Integer.MAX_VALUE; public int sort() default Integer.MAX_VALUE;
/** /**
* 导出到Excel中的名字. * 导出到Excel中的名字.
*/ */
public String name() default ""; public String name() default "";
/** /**
* 日期格式, : yyyy-MM-dd * 日期格式, : yyyy-MM-dd
*/ */
public String dateFormat() default ""; public String dateFormat() default "";
/** /**
* 如果是字典类型请设置字典的type值 (: sys_user_sex) * 如果是字典类型请设置字典的type值 (: sys_user_sex)
*/ */
public String dictType() default ""; public String dictType() default "";
/** /**
* 读取内容转表达式 (: 0=,1=,2=未知) * 读取内容转表达式 (: 0=,1=,2=未知)
*/ */
public String readConverterExp() default ""; public String readConverterExp() default "";
/** /**
* 分隔符读取字符串组内容 * 分隔符读取字符串组内容
*/ */
public String separator() default ","; public String separator() default ",";
/** /**
* BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化) * BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化)
*/ */
public int scale() default -1; public int scale() default -1;
/** /**
* BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN * BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
*/ */
public int roundingMode() default BigDecimal.ROUND_HALF_EVEN; public int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
/** /**
* 导出类型0数字 1字符串 * 导出类型0数字 1字符串
*/ */
public ColumnType cellType() default ColumnType.STRING; public ColumnType cellType() default ColumnType.STRING;
/** /**
* 导出时在excel中每个列的高度 单位为字符 * 导出时在excel中每个列的高度 单位为字符
*/ */
public double height() default 14; public double height() default 14;
/** /**
* 导出时在excel中每个列的宽 单位为字符 * 导出时在excel中每个列的宽 单位为字符
*/ */
public double width() default 16; public double width() default 16;
/** /**
* 文字后缀,% 90 变成90% * 文字后缀,% 90 变成90%
*/ */
public String suffix() default ""; public String suffix() default "";
/** /**
* 当值为空时,字段的默认值 * 当值为空时,字段的默认值
*/ */
public String defaultValue() default ""; public String defaultValue() default "";
/** /**
* 提示信息 * 提示信息
*/ */
public String prompt() default ""; public String prompt() default "";
/** /**
* 设置只能选择不能输入的列内容. * 设置只能选择不能输入的列内容.
*/ */
public String[] combo() default {}; public String[] combo() default {};
/** /**
* 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写. * 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
*/ */
public boolean isExport() default true; public boolean isExport() default true;
/** /**
* 另一个类中的属性名称,支持多级获取,以小数点隔开 * 另一个类中的属性名称,支持多级获取,以小数点隔开
*/ */
public String targetAttr() default ""; public String targetAttr() default "";
/** /**
* 是否自动统计数据,在最后追加一行统计数据总和 * 是否自动统计数据,在最后追加一行统计数据总和
*/ */
public boolean isStatistics() default false; public boolean isStatistics() default false;
/** /**
* 字段类型0导出导入1仅导出2仅导入 * 字段类型0导出导入1仅导出2仅导入
*/ */
Type type() default Type.ALL; Type type() default Type.ALL;
public enum Type public enum Type
{ {
ALL(0), EXPORT(1), IMPORT(2); ALL(0), EXPORT(1), IMPORT(2);
private final int value; private final int value;
Type(int value) Type(int value)
{ {
this.value = value; this.value = value;
} }
public int value() public int value()
{ {
return this.value; return this.value;
} }
} }
public enum ColumnType public enum ColumnType
{ {
NUMERIC(0), STRING(1); NUMERIC(0), STRING(1);
private final int value; private final int value;
ColumnType(int value) ColumnType(int value)
{ {
this.value = value; this.value = value;
} }
public int value() public int value()
{ {
return this.value; return this.value;
} }
} }
} }

View File

@ -1,18 +1,18 @@
package com.ruoyi.common.annotation; package com.stdiet.common.annotation;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
/** /**
* Excel注解集 * Excel注解集
* *
* @author ruoyi * @author stdiet
*/ */
@Target(ElementType.FIELD) @Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
public @interface Excels public @interface Excels
{ {
Excel[] value(); Excel[] value();
} }

View File

@ -1,41 +1,41 @@
package com.ruoyi.common.annotation; package com.stdiet.common.annotation;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import com.ruoyi.common.enums.BusinessType; import com.stdiet.common.enums.BusinessType;
import com.ruoyi.common.enums.OperatorType; import com.stdiet.common.enums.OperatorType;
/** /**
* 自定义操作日志记录注解 * 自定义操作日志记录注解
* *
* @author ruoyi * @author stdiet
* *
*/ */
@Target({ ElementType.PARAMETER, ElementType.METHOD }) @Target({ ElementType.PARAMETER, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Documented @Documented
public @interface Log public @interface Log
{ {
/** /**
* 模块 * 模块
*/ */
public String title() default ""; public String title() default "";
/** /**
* 功能 * 功能
*/ */
public BusinessType businessType() default BusinessType.OTHER; public BusinessType businessType() default BusinessType.OTHER;
/** /**
* 操作人类别 * 操作人类别
*/ */
public OperatorType operatorType() default OperatorType.MANAGE; public OperatorType operatorType() default OperatorType.MANAGE;
/** /**
* 是否保存请求的参数 * 是否保存请求的参数
*/ */
public boolean isSaveRequestData() default true; public boolean isSaveRequestData() default true;
} }

View File

@ -1,23 +1,23 @@
package com.ruoyi.common.annotation; package com.stdiet.common.annotation;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited; import java.lang.annotation.Inherited;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
/** /**
* 自定义注解防止表单重复提交 * 自定义注解防止表单重复提交
* *
* @author ruoyi * @author stdiet
* *
*/ */
@Inherited @Inherited
@Target(ElementType.METHOD) @Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Documented @Documented
public @interface RepeatSubmit public @interface RepeatSubmit
{ {
} }

View File

@ -1,116 +1,116 @@
package com.ruoyi.common.config; package com.stdiet.common.config;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* 读取项目相关配置 * 读取项目相关配置
* *
* @author ruoyi * @author stdiet
*/ */
@Component @Component
@ConfigurationProperties(prefix = "ruoyi") @ConfigurationProperties(prefix = "stdiet")
public class RuoYiConfig public class RuoYiConfig
{ {
/** 项目名称 */ /** 项目名称 */
private String name; private String name;
/** 版本 */ /** 版本 */
private String version; private String version;
/** 版权年份 */ /** 版权年份 */
private String copyrightYear; private String copyrightYear;
/** 实例演示开关 */ /** 实例演示开关 */
private boolean demoEnabled; private boolean demoEnabled;
/** 上传路径 */ /** 上传路径 */
private static String profile; private static String profile;
/** 获取地址开关 */ /** 获取地址开关 */
private static boolean addressEnabled; private static boolean addressEnabled;
public String getName() public String getName()
{ {
return name; return name;
} }
public void setName(String name) public void setName(String name)
{ {
this.name = name; this.name = name;
} }
public String getVersion() public String getVersion()
{ {
return version; return version;
} }
public void setVersion(String version) public void setVersion(String version)
{ {
this.version = version; this.version = version;
} }
public String getCopyrightYear() public String getCopyrightYear()
{ {
return copyrightYear; return copyrightYear;
} }
public void setCopyrightYear(String copyrightYear) public void setCopyrightYear(String copyrightYear)
{ {
this.copyrightYear = copyrightYear; this.copyrightYear = copyrightYear;
} }
public boolean isDemoEnabled() public boolean isDemoEnabled()
{ {
return demoEnabled; return demoEnabled;
} }
public void setDemoEnabled(boolean demoEnabled) public void setDemoEnabled(boolean demoEnabled)
{ {
this.demoEnabled = demoEnabled; this.demoEnabled = demoEnabled;
} }
public static String getProfile() public static String getProfile()
{ {
return profile; return profile;
} }
public void setProfile(String profile) public void setProfile(String profile)
{ {
RuoYiConfig.profile = profile; RuoYiConfig.profile = profile;
} }
public static boolean isAddressEnabled() public static boolean isAddressEnabled()
{ {
return addressEnabled; return addressEnabled;
} }
public void setAddressEnabled(boolean addressEnabled) public void setAddressEnabled(boolean addressEnabled)
{ {
RuoYiConfig.addressEnabled = addressEnabled; RuoYiConfig.addressEnabled = addressEnabled;
} }
/** /**
* 获取头像上传路径 * 获取头像上传路径
*/ */
public static String getAvatarPath() public static String getAvatarPath()
{ {
return getProfile() + "/avatar"; return getProfile() + "/avatar";
} }
/** /**
* 获取下载路径 * 获取下载路径
*/ */
public static String getDownloadPath() public static String getDownloadPath()
{ {
return getProfile() + "/download/"; return getProfile() + "/download/";
} }
/** /**
* 获取上传路径 * 获取上传路径
*/ */
public static String getUploadPath() public static String getUploadPath()
{ {
return getProfile() + "/upload"; return getProfile() + "/upload";
} }
} }

View File

@ -1,129 +1,129 @@
package com.ruoyi.common.constant; package com.stdiet.common.constant;
/** /**
* 通用常量信息 * 通用常量信息
* *
* @author ruoyi * @author stdiet
*/ */
public class Constants public class Constants
{ {
/** /**
* UTF-8 字符集 * UTF-8 字符集
*/ */
public static final String UTF8 = "UTF-8"; public static final String UTF8 = "UTF-8";
/** /**
* GBK 字符集 * GBK 字符集
*/ */
public static final String GBK = "GBK"; public static final String GBK = "GBK";
/** /**
* http请求 * http请求
*/ */
public static final String HTTP = "http://"; public static final String HTTP = "http://";
/** /**
* https请求 * https请求
*/ */
public static final String HTTPS = "https://"; public static final String HTTPS = "https://";
/** /**
* 通用成功标识 * 通用成功标识
*/ */
public static final String SUCCESS = "0"; public static final String SUCCESS = "0";
/** /**
* 通用失败标识 * 通用失败标识
*/ */
public static final String FAIL = "1"; public static final String FAIL = "1";
/** /**
* 登录成功 * 登录成功
*/ */
public static final String LOGIN_SUCCESS = "Success"; public static final String LOGIN_SUCCESS = "Success";
/** /**
* 注销 * 注销
*/ */
public static final String LOGOUT = "Logout"; public static final String LOGOUT = "Logout";
/** /**
* 登录失败 * 登录失败
*/ */
public static final String LOGIN_FAIL = "Error"; public static final String LOGIN_FAIL = "Error";
/** /**
* 验证码 redis key * 验证码 redis key
*/ */
public static final String CAPTCHA_CODE_KEY = "captcha_codes:"; public static final String CAPTCHA_CODE_KEY = "captcha_codes:";
/** /**
* 登录用户 redis key * 登录用户 redis key
*/ */
public static final String LOGIN_TOKEN_KEY = "login_tokens:"; public static final String LOGIN_TOKEN_KEY = "login_tokens:";
/** /**
* 防重提交 redis key * 防重提交 redis key
*/ */
public static final String REPEAT_SUBMIT_KEY = "repeat_submit:"; public static final String REPEAT_SUBMIT_KEY = "repeat_submit:";
/** /**
* 验证码有效期分钟 * 验证码有效期分钟
*/ */
public static final Integer CAPTCHA_EXPIRATION = 2; public static final Integer CAPTCHA_EXPIRATION = 2;
/** /**
* 令牌 * 令牌
*/ */
public static final String TOKEN = "token"; public static final String TOKEN = "token";
/** /**
* 令牌前缀 * 令牌前缀
*/ */
public static final String TOKEN_PREFIX = "Bearer "; public static final String TOKEN_PREFIX = "Bearer ";
/** /**
* 令牌前缀 * 令牌前缀
*/ */
public static final String LOGIN_USER_KEY = "login_user_key"; public static final String LOGIN_USER_KEY = "login_user_key";
/** /**
* 用户ID * 用户ID
*/ */
public static final String JWT_USERID = "userid"; public static final String JWT_USERID = "userid";
/** /**
* 用户名称 * 用户名称
*/ */
public static final String JWT_USERNAME = "sub"; public static final String JWT_USERNAME = "sub";
/** /**
* 用户头像 * 用户头像
*/ */
public static final String JWT_AVATAR = "avatar"; public static final String JWT_AVATAR = "avatar";
/** /**
* 创建时间 * 创建时间
*/ */
public static final String JWT_CREATED = "created"; public static final String JWT_CREATED = "created";
/** /**
* 用户权限 * 用户权限
*/ */
public static final String JWT_AUTHORITIES = "authorities"; public static final String JWT_AUTHORITIES = "authorities";
/** /**
* 参数管理 cache key * 参数管理 cache key
*/ */
public static final String SYS_CONFIG_KEY = "sys_config:"; public static final String SYS_CONFIG_KEY = "sys_config:";
/** /**
* 字典管理 cache key * 字典管理 cache key
*/ */
public static final String SYS_DICT_KEY = "sys_dict:"; public static final String SYS_DICT_KEY = "sys_dict:";
/** /**
* 资源映射路径 前缀 * 资源映射路径 前缀
*/ */
public static final String RESOURCE_PREFIX = "/profile"; public static final String RESOURCE_PREFIX = "/profile";
} }

View File

@ -1,103 +1,103 @@
package com.ruoyi.common.constant; package com.stdiet.common.constant;
/** /**
* 代码生成通用常量 * 代码生成通用常量
* *
* @author ruoyi * @author stdiet
*/ */
public class GenConstants public class GenConstants
{ {
/** 单表(增删改查) */ /** 单表(增删改查) */
public static final String TPL_CRUD = "crud"; public static final String TPL_CRUD = "crud";
/** 树表(增删改查) */ /** 树表(增删改查) */
public static final String TPL_TREE = "tree"; public static final String TPL_TREE = "tree";
/** 树编码字段 */ /** 树编码字段 */
public static final String TREE_CODE = "treeCode"; public static final String TREE_CODE = "treeCode";
/** 树父编码字段 */ /** 树父编码字段 */
public static final String TREE_PARENT_CODE = "treeParentCode"; public static final String TREE_PARENT_CODE = "treeParentCode";
/** 树名称字段 */ /** 树名称字段 */
public static final String TREE_NAME = "treeName"; public static final String TREE_NAME = "treeName";
/** 上级菜单ID字段 */ /** 上级菜单ID字段 */
public static final String PARENT_MENU_ID = "parentMenuId"; public static final String PARENT_MENU_ID = "parentMenuId";
/** 上级菜单名称字段 */ /** 上级菜单名称字段 */
public static final String PARENT_MENU_NAME = "parentMenuName"; public static final String PARENT_MENU_NAME = "parentMenuName";
/** 数据库字符串类型 */ /** 数据库字符串类型 */
public static final String[] COLUMNTYPE_STR = { "char", "varchar", "nvarchar", "varchar2", "tinytext", "text", public static final String[] COLUMNTYPE_STR = { "char", "varchar", "nvarchar", "varchar2", "tinytext", "text",
"mediumtext", "longtext" }; "mediumtext", "longtext" };
/** 数据库时间类型 */ /** 数据库时间类型 */
public static final String[] COLUMNTYPE_TIME = { "datetime", "time", "date", "timestamp" }; public static final String[] COLUMNTYPE_TIME = { "datetime", "time", "date", "timestamp" };
/** 数据库数字类型 */ /** 数据库数字类型 */
public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer", public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer",
"bigint", "float", "float", "double", "decimal" }; "bigint", "float", "float", "double", "decimal" };
/** 页面不需要编辑字段 */ /** 页面不需要编辑字段 */
public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" }; public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" };
/** 页面不需要显示的列表字段 */ /** 页面不需要显示的列表字段 */
public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by", public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by",
"update_time" }; "update_time" };
/** 页面不需要查询字段 */ /** 页面不需要查询字段 */
public static final String[] COLUMNNAME_NOT_QUERY = { "id", "create_by", "create_time", "del_flag", "update_by", public static final String[] COLUMNNAME_NOT_QUERY = { "id", "create_by", "create_time", "del_flag", "update_by",
"update_time", "remark" }; "update_time", "remark" };
/** Entity基类字段 */ /** Entity基类字段 */
public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "remark" }; public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "remark" };
/** Tree基类字段 */ /** Tree基类字段 */
public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "ancestors", "children" }; public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "ancestors", "children" };
/** 文本框 */ /** 文本框 */
public static final String HTML_INPUT = "input"; public static final String HTML_INPUT = "input";
/** 文本域 */ /** 文本域 */
public static final String HTML_TEXTAREA = "textarea"; public static final String HTML_TEXTAREA = "textarea";
/** 下拉框 */ /** 下拉框 */
public static final String HTML_SELECT = "select"; public static final String HTML_SELECT = "select";
/** 单选框 */ /** 单选框 */
public static final String HTML_RADIO = "radio"; public static final String HTML_RADIO = "radio";
/** 复选框 */ /** 复选框 */
public static final String HTML_CHECKBOX = "checkbox"; public static final String HTML_CHECKBOX = "checkbox";
/** 日期控件 */ /** 日期控件 */
public static final String HTML_DATETIME = "datetime"; public static final String HTML_DATETIME = "datetime";
/** 富文本控件 */ /** 富文本控件 */
public static final String HTML_EDITOR = "editor"; public static final String HTML_EDITOR = "editor";
/** 字符串类型 */ /** 字符串类型 */
public static final String TYPE_STRING = "String"; public static final String TYPE_STRING = "String";
/** 整型 */ /** 整型 */
public static final String TYPE_INTEGER = "Integer"; public static final String TYPE_INTEGER = "Integer";
/** 长整型 */ /** 长整型 */
public static final String TYPE_LONG = "Long"; public static final String TYPE_LONG = "Long";
/** 浮点型 */ /** 浮点型 */
public static final String TYPE_DOUBLE = "Double"; public static final String TYPE_DOUBLE = "Double";
/** 高精度计算类型 */ /** 高精度计算类型 */
public static final String TYPE_BIGDECIMAL = "BigDecimal"; public static final String TYPE_BIGDECIMAL = "BigDecimal";
/** 时间类型 */ /** 时间类型 */
public static final String TYPE_DATE = "Date"; public static final String TYPE_DATE = "Date";
/** 模糊查询 */ /** 模糊查询 */
public static final String QUERY_LIKE = "LIKE"; public static final String QUERY_LIKE = "LIKE";
/** 需要 */ /** 需要 */
public static final String REQUIRE = "1"; public static final String REQUIRE = "1";
} }

View File

@ -1,89 +1,89 @@
package com.ruoyi.common.constant; package com.stdiet.common.constant;
/** /**
* 返回状态码 * 返回状态码
* *
* @author ruoyi * @author stdiet
*/ */
public class HttpStatus public class HttpStatus
{ {
/** /**
* 操作成功 * 操作成功
*/ */
public static final int SUCCESS = 200; public static final int SUCCESS = 200;
/** /**
* 对象创建成功 * 对象创建成功
*/ */
public static final int CREATED = 201; public static final int CREATED = 201;
/** /**
* 请求已经被接受 * 请求已经被接受
*/ */
public static final int ACCEPTED = 202; public static final int ACCEPTED = 202;
/** /**
* 操作已经执行成功但是没有返回数据 * 操作已经执行成功但是没有返回数据
*/ */
public static final int NO_CONTENT = 204; public static final int NO_CONTENT = 204;
/** /**
* 资源已被移除 * 资源已被移除
*/ */
public static final int MOVED_PERM = 301; public static final int MOVED_PERM = 301;
/** /**
* 重定向 * 重定向
*/ */
public static final int SEE_OTHER = 303; public static final int SEE_OTHER = 303;
/** /**
* 资源没有被修改 * 资源没有被修改
*/ */
public static final int NOT_MODIFIED = 304; public static final int NOT_MODIFIED = 304;
/** /**
* 参数列表错误缺少格式不匹配 * 参数列表错误缺少格式不匹配
*/ */
public static final int BAD_REQUEST = 400; public static final int BAD_REQUEST = 400;
/** /**
* 未授权 * 未授权
*/ */
public static final int UNAUTHORIZED = 401; public static final int UNAUTHORIZED = 401;
/** /**
* 访问受限授权过期 * 访问受限授权过期
*/ */
public static final int FORBIDDEN = 403; public static final int FORBIDDEN = 403;
/** /**
* 资源服务未找到 * 资源服务未找到
*/ */
public static final int NOT_FOUND = 404; public static final int NOT_FOUND = 404;
/** /**
* 不允许的http方法 * 不允许的http方法
*/ */
public static final int BAD_METHOD = 405; public static final int BAD_METHOD = 405;
/** /**
* 资源冲突或者资源被锁 * 资源冲突或者资源被锁
*/ */
public static final int CONFLICT = 409; public static final int CONFLICT = 409;
/** /**
* 不支持的数据媒体类型 * 不支持的数据媒体类型
*/ */
public static final int UNSUPPORTED_TYPE = 415; public static final int UNSUPPORTED_TYPE = 415;
/** /**
* 系统内部错误 * 系统内部错误
*/ */
public static final int ERROR = 500; public static final int ERROR = 500;
/** /**
* 接口未实现 * 接口未实现
*/ */
public static final int NOT_IMPLEMENTED = 501; public static final int NOT_IMPLEMENTED = 501;
} }

View File

@ -1,50 +1,50 @@
package com.ruoyi.common.constant; package com.stdiet.common.constant;
/** /**
* 任务调度通用常量 * 任务调度通用常量
* *
* @author ruoyi * @author stdiet
*/ */
public class ScheduleConstants public class ScheduleConstants
{ {
public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME"; public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME";
/** 执行目标key */ /** 执行目标key */
public static final String TASK_PROPERTIES = "TASK_PROPERTIES"; public static final String TASK_PROPERTIES = "TASK_PROPERTIES";
/** 默认 */ /** 默认 */
public static final String MISFIRE_DEFAULT = "0"; public static final String MISFIRE_DEFAULT = "0";
/** 立即触发执行 */ /** 立即触发执行 */
public static final String MISFIRE_IGNORE_MISFIRES = "1"; public static final String MISFIRE_IGNORE_MISFIRES = "1";
/** 触发一次执行 */ /** 触发一次执行 */
public static final String MISFIRE_FIRE_AND_PROCEED = "2"; public static final String MISFIRE_FIRE_AND_PROCEED = "2";
/** 不触发立即执行 */ /** 不触发立即执行 */
public static final String MISFIRE_DO_NOTHING = "3"; public static final String MISFIRE_DO_NOTHING = "3";
public enum Status public enum Status
{ {
/** /**
* 正常 * 正常
*/ */
NORMAL("0"), NORMAL("0"),
/** /**
* 暂停 * 暂停
*/ */
PAUSE("1"); PAUSE("1");
private String value; private String value;
private Status(String value) private Status(String value)
{ {
this.value = value; this.value = value;
} }
public String getValue() public String getValue()
{ {
return value; return value;
} }
} }
} }

View File

@ -1,60 +1,60 @@
package com.ruoyi.common.constant; package com.stdiet.common.constant;
/** /**
* 用户常量信息 * 用户常量信息
* *
* @author ruoyi * @author stdiet
*/ */
public class UserConstants public class UserConstants
{ {
/** /**
* 平台内系统用户的唯一标志 * 平台内系统用户的唯一标志
*/ */
public static final String SYS_USER = "SYS_USER"; public static final String SYS_USER = "SYS_USER";
/** 正常状态 */ /** 正常状态 */
public static final String NORMAL = "0"; public static final String NORMAL = "0";
/** 异常状态 */ /** 异常状态 */
public static final String EXCEPTION = "1"; public static final String EXCEPTION = "1";
/** 用户封禁状态 */ /** 用户封禁状态 */
public static final String USER_DISABLE = "1"; public static final String USER_DISABLE = "1";
/** 角色封禁状态 */ /** 角色封禁状态 */
public static final String ROLE_DISABLE = "1"; public static final String ROLE_DISABLE = "1";
/** 部门正常状态 */ /** 部门正常状态 */
public static final String DEPT_NORMAL = "0"; public static final String DEPT_NORMAL = "0";
/** 部门停用状态 */ /** 部门停用状态 */
public static final String DEPT_DISABLE = "1"; public static final String DEPT_DISABLE = "1";
/** 字典正常状态 */ /** 字典正常状态 */
public static final String DICT_NORMAL = "0"; public static final String DICT_NORMAL = "0";
/** 是否为系统默认(是) */ /** 是否为系统默认(是) */
public static final String YES = "Y"; public static final String YES = "Y";
/** 是否菜单外链(是) */ /** 是否菜单外链(是) */
public static final String YES_FRAME = "0"; public static final String YES_FRAME = "0";
/** 是否菜单外链(否) */ /** 是否菜单外链(否) */
public static final String NO_FRAME = "1"; public static final String NO_FRAME = "1";
/** 菜单类型(目录) */ /** 菜单类型(目录) */
public static final String TYPE_DIR = "M"; public static final String TYPE_DIR = "M";
/** 菜单类型(菜单) */ /** 菜单类型(菜单) */
public static final String TYPE_MENU = "C"; public static final String TYPE_MENU = "C";
/** 菜单类型(按钮) */ /** 菜单类型(按钮) */
public static final String TYPE_BUTTON = "F"; public static final String TYPE_BUTTON = "F";
/** Layout组件标识 */ /** Layout组件标识 */
public final static String LAYOUT = "Layout"; public final static String LAYOUT = "Layout";
/** 校验返回结果码 */ /** 校验返回结果码 */
public final static String UNIQUE = "0"; public final static String UNIQUE = "0";
public final static String NOT_UNIQUE = "1"; public final static String NOT_UNIQUE = "1";
} }

View File

@ -1,94 +1,94 @@
package com.ruoyi.common.core.controller; package com.stdiet.common.core.controller;
import java.beans.PropertyEditorSupport; import java.beans.PropertyEditorSupport;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.InitBinder;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.ruoyi.common.constant.HttpStatus; import com.stdiet.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.AjaxResult; import com.stdiet.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.PageDomain; import com.stdiet.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableDataInfo; import com.stdiet.common.core.page.TableDataInfo;
import com.ruoyi.common.core.page.TableSupport; import com.stdiet.common.core.page.TableSupport;
import com.ruoyi.common.utils.DateUtils; import com.stdiet.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils; import com.stdiet.common.utils.StringUtils;
import com.ruoyi.common.utils.sql.SqlUtil; import com.stdiet.common.utils.sql.SqlUtil;
/** /**
* web层通用数据处理 * web层通用数据处理
* *
* @author ruoyi * @author stdiet
*/ */
public class BaseController public class BaseController
{ {
protected final Logger logger = LoggerFactory.getLogger(BaseController.class); protected final Logger logger = LoggerFactory.getLogger(BaseController.class);
/** /**
* 将前台传递过来的日期格式的字符串自动转化为Date类型 * 将前台传递过来的日期格式的字符串自动转化为Date类型
*/ */
@InitBinder @InitBinder
public void initBinder(WebDataBinder binder) public void initBinder(WebDataBinder binder)
{ {
// Date 类型转换 // Date 类型转换
binder.registerCustomEditor(Date.class, new PropertyEditorSupport() binder.registerCustomEditor(Date.class, new PropertyEditorSupport()
{ {
@Override @Override
public void setAsText(String text) public void setAsText(String text)
{ {
setValue(DateUtils.parseDate(text)); setValue(DateUtils.parseDate(text));
} }
}); });
} }
/** /**
* 设置请求分页数据 * 设置请求分页数据
*/ */
protected void startPage() protected void startPage()
{ {
PageDomain pageDomain = TableSupport.buildPageRequest(); PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum(); Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize(); Integer pageSize = pageDomain.getPageSize();
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize))
{ {
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
PageHelper.startPage(pageNum, pageSize, orderBy); PageHelper.startPage(pageNum, pageSize, orderBy);
} }
} }
/** /**
* 响应请求分页数据 * 响应请求分页数据
*/ */
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({ "rawtypes", "unchecked" })
protected TableDataInfo getDataTable(List<?> list) protected TableDataInfo getDataTable(List<?> list)
{ {
TableDataInfo rspData = new TableDataInfo(); TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.SUCCESS); rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功"); rspData.setMsg("查询成功");
rspData.setRows(list); rspData.setRows(list);
rspData.setTotal(new PageInfo(list).getTotal()); rspData.setTotal(new PageInfo(list).getTotal());
return rspData; return rspData;
} }
/** /**
* 响应返回结果 * 响应返回结果
* *
* @param rows 影响行数 * @param rows 影响行数
* @return 操作结果 * @return 操作结果
*/ */
protected AjaxResult toAjax(int rows) protected AjaxResult toAjax(int rows)
{ {
return rows > 0 ? AjaxResult.success() : AjaxResult.error(); return rows > 0 ? AjaxResult.success() : AjaxResult.error();
} }
/** /**
* 页面跳转 * 页面跳转
*/ */
public String redirect(String url) public String redirect(String url)
{ {
return StringUtils.format("redirect:{}", url); return StringUtils.format("redirect:{}", url);
} }
} }

View File

@ -1,148 +1,148 @@
package com.ruoyi.common.core.domain; package com.stdiet.common.core.domain;
import java.util.HashMap; import java.util.HashMap;
import com.ruoyi.common.constant.HttpStatus; import com.stdiet.common.constant.HttpStatus;
import com.ruoyi.common.utils.StringUtils; import com.stdiet.common.utils.StringUtils;
/** /**
* 操作消息提醒 * 操作消息提醒
* *
* @author ruoyi * @author stdiet
*/ */
public class AjaxResult extends HashMap<String, Object> public class AjaxResult extends HashMap<String, Object>
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 状态码 */ /** 状态码 */
public static final String CODE_TAG = "code"; public static final String CODE_TAG = "code";
/** 返回内容 */ /** 返回内容 */
public static final String MSG_TAG = "msg"; public static final String MSG_TAG = "msg";
/** 数据对象 */ /** 数据对象 */
public static final String DATA_TAG = "data"; public static final String DATA_TAG = "data";
/** /**
* 初始化一个新创建的 AjaxResult 对象使其表示一个空消息 * 初始化一个新创建的 AjaxResult 对象使其表示一个空消息
*/ */
public AjaxResult() public AjaxResult()
{ {
} }
/** /**
* 初始化一个新创建的 AjaxResult 对象 * 初始化一个新创建的 AjaxResult 对象
* *
* @param code 状态码 * @param code 状态码
* @param msg 返回内容 * @param msg 返回内容
*/ */
public AjaxResult(int code, String msg) public AjaxResult(int code, String msg)
{ {
super.put(CODE_TAG, code); super.put(CODE_TAG, code);
super.put(MSG_TAG, msg); super.put(MSG_TAG, msg);
} }
/** /**
* 初始化一个新创建的 AjaxResult 对象 * 初始化一个新创建的 AjaxResult 对象
* *
* @param code 状态码 * @param code 状态码
* @param msg 返回内容 * @param msg 返回内容
* @param data 数据对象 * @param data 数据对象
*/ */
public AjaxResult(int code, String msg, Object data) public AjaxResult(int code, String msg, Object data)
{ {
super.put(CODE_TAG, code); super.put(CODE_TAG, code);
super.put(MSG_TAG, msg); super.put(MSG_TAG, msg);
if (StringUtils.isNotNull(data)) if (StringUtils.isNotNull(data))
{ {
super.put(DATA_TAG, data); super.put(DATA_TAG, data);
} }
} }
/** /**
* 返回成功消息 * 返回成功消息
* *
* @return 成功消息 * @return 成功消息
*/ */
public static AjaxResult success() public static AjaxResult success()
{ {
return AjaxResult.success("操作成功"); return AjaxResult.success("操作成功");
} }
/** /**
* 返回成功数据 * 返回成功数据
* *
* @return 成功消息 * @return 成功消息
*/ */
public static AjaxResult success(Object data) public static AjaxResult success(Object data)
{ {
return AjaxResult.success("操作成功", data); return AjaxResult.success("操作成功", data);
} }
/** /**
* 返回成功消息 * 返回成功消息
* *
* @param msg 返回内容 * @param msg 返回内容
* @return 成功消息 * @return 成功消息
*/ */
public static AjaxResult success(String msg) public static AjaxResult success(String msg)
{ {
return AjaxResult.success(msg, null); return AjaxResult.success(msg, null);
} }
/** /**
* 返回成功消息 * 返回成功消息
* *
* @param msg 返回内容 * @param msg 返回内容
* @param data 数据对象 * @param data 数据对象
* @return 成功消息 * @return 成功消息
*/ */
public static AjaxResult success(String msg, Object data) public static AjaxResult success(String msg, Object data)
{ {
return new AjaxResult(HttpStatus.SUCCESS, msg, data); return new AjaxResult(HttpStatus.SUCCESS, msg, data);
} }
/** /**
* 返回错误消息 * 返回错误消息
* *
* @return * @return
*/ */
public static AjaxResult error() public static AjaxResult error()
{ {
return AjaxResult.error("操作失败"); return AjaxResult.error("操作失败");
} }
/** /**
* 返回错误消息 * 返回错误消息
* *
* @param msg 返回内容 * @param msg 返回内容
* @return 警告消息 * @return 警告消息
*/ */
public static AjaxResult error(String msg) public static AjaxResult error(String msg)
{ {
return AjaxResult.error(msg, null); return AjaxResult.error(msg, null);
} }
/** /**
* 返回错误消息 * 返回错误消息
* *
* @param msg 返回内容 * @param msg 返回内容
* @param data 数据对象 * @param data 数据对象
* @return 警告消息 * @return 警告消息
*/ */
public static AjaxResult error(String msg, Object data) public static AjaxResult error(String msg, Object data)
{ {
return new AjaxResult(HttpStatus.ERROR, msg, data); return new AjaxResult(HttpStatus.ERROR, msg, data);
} }
/** /**
* 返回错误消息 * 返回错误消息
* *
* @param code 状态码 * @param code 状态码
* @param msg 返回内容 * @param msg 返回内容
* @return 警告消息 * @return 警告消息
*/ */
public static AjaxResult error(int code, String msg) public static AjaxResult error(int code, String msg)
{ {
return new AjaxResult(code, msg, null); return new AjaxResult(code, msg, null);
} }
} }

View File

@ -1,143 +1,143 @@
package com.ruoyi.common.core.domain; package com.stdiet.common.core.domain;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
/** /**
* Entity基类 * Entity基类
* *
* @author ruoyi * @author stdiet
*/ */
public class BaseEntity implements Serializable public class BaseEntity implements Serializable
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 搜索值 */ /** 搜索值 */
private String searchValue; private String searchValue;
/** 创建者 */ /** 创建者 */
private String createBy; private String createBy;
/** 创建时间 */ /** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime; private Date createTime;
/** 更新者 */ /** 更新者 */
private String updateBy; private String updateBy;
/** 更新时间 */ /** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime; private Date updateTime;
/** 备注 */ /** 备注 */
private String remark; private String remark;
/** 开始时间 */ /** 开始时间 */
@JsonIgnore @JsonIgnore
private String beginTime; private String beginTime;
/** 结束时间 */ /** 结束时间 */
@JsonIgnore @JsonIgnore
private String endTime; private String endTime;
/** 请求参数 */ /** 请求参数 */
private Map<String, Object> params; private Map<String, Object> params;
public String getSearchValue() public String getSearchValue()
{ {
return searchValue; return searchValue;
} }
public void setSearchValue(String searchValue) public void setSearchValue(String searchValue)
{ {
this.searchValue = searchValue; this.searchValue = searchValue;
} }
public String getCreateBy() public String getCreateBy()
{ {
return createBy; return createBy;
} }
public void setCreateBy(String createBy) public void setCreateBy(String createBy)
{ {
this.createBy = createBy; this.createBy = createBy;
} }
public Date getCreateTime() public Date getCreateTime()
{ {
return createTime; return createTime;
} }
public void setCreateTime(Date createTime) public void setCreateTime(Date createTime)
{ {
this.createTime = createTime; this.createTime = createTime;
} }
public String getUpdateBy() public String getUpdateBy()
{ {
return updateBy; return updateBy;
} }
public void setUpdateBy(String updateBy) public void setUpdateBy(String updateBy)
{ {
this.updateBy = updateBy; this.updateBy = updateBy;
} }
public Date getUpdateTime() public Date getUpdateTime()
{ {
return updateTime; return updateTime;
} }
public void setUpdateTime(Date updateTime) public void setUpdateTime(Date updateTime)
{ {
this.updateTime = updateTime; this.updateTime = updateTime;
} }
public String getRemark() public String getRemark()
{ {
return remark; return remark;
} }
public void setRemark(String remark) public void setRemark(String remark)
{ {
this.remark = remark; this.remark = remark;
} }
public String getBeginTime() public String getBeginTime()
{ {
return beginTime; return beginTime;
} }
public void setBeginTime(String beginTime) public void setBeginTime(String beginTime)
{ {
this.beginTime = beginTime; this.beginTime = beginTime;
} }
public String getEndTime() public String getEndTime()
{ {
return endTime; return endTime;
} }
public void setEndTime(String endTime) public void setEndTime(String endTime)
{ {
this.endTime = endTime; this.endTime = endTime;
} }
public Map<String, Object> getParams() public Map<String, Object> getParams()
{ {
if (params == null) if (params == null)
{ {
params = new HashMap<>(); params = new HashMap<>();
} }
return params; return params;
} }
public void setParams(Map<String, Object> params) public void setParams(Map<String, Object> params)
{ {
this.params = params; this.params = params;
} }
} }

View File

@ -1,79 +1,79 @@
package com.ruoyi.common.core.domain; package com.stdiet.common.core.domain;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* Tree基类 * Tree基类
* *
* @author ruoyi * @author stdiet
*/ */
public class TreeEntity extends BaseEntity public class TreeEntity extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 父菜单名称 */ /** 父菜单名称 */
private String parentName; private String parentName;
/** 父菜单ID */ /** 父菜单ID */
private Long parentId; private Long parentId;
/** 显示顺序 */ /** 显示顺序 */
private Integer orderNum; private Integer orderNum;
/** 祖级列表 */ /** 祖级列表 */
private String ancestors; private String ancestors;
/** 子部门 */ /** 子部门 */
private List<?> children = new ArrayList<>(); private List<?> children = new ArrayList<>();
public String getParentName() public String getParentName()
{ {
return parentName; return parentName;
} }
public void setParentName(String parentName) public void setParentName(String parentName)
{ {
this.parentName = parentName; this.parentName = parentName;
} }
public Long getParentId() public Long getParentId()
{ {
return parentId; return parentId;
} }
public void setParentId(Long parentId) public void setParentId(Long parentId)
{ {
this.parentId = parentId; this.parentId = parentId;
} }
public Integer getOrderNum() public Integer getOrderNum()
{ {
return orderNum; return orderNum;
} }
public void setOrderNum(Integer orderNum) public void setOrderNum(Integer orderNum)
{ {
this.orderNum = orderNum; this.orderNum = orderNum;
} }
public String getAncestors() public String getAncestors()
{ {
return ancestors; return ancestors;
} }
public void setAncestors(String ancestors) public void setAncestors(String ancestors)
{ {
this.ancestors = ancestors; this.ancestors = ancestors;
} }
public List<?> getChildren() public List<?> getChildren()
{ {
return children; return children;
} }
public void setChildren(List<?> children) public void setChildren(List<?> children)
{ {
this.children = children; this.children = children;
} }
} }

View File

@ -1,77 +1,77 @@
package com.ruoyi.common.core.domain; package com.stdiet.common.core.domain;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.ruoyi.common.core.domain.entity.SysDept; import com.stdiet.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysMenu; import com.stdiet.common.core.domain.entity.SysMenu;
/** /**
* Treeselect树结构实体类 * Treeselect树结构实体类
* *
* @author ruoyi * @author stdiet
*/ */
public class TreeSelect implements Serializable public class TreeSelect implements Serializable
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 节点ID */ /** 节点ID */
private Long id; private Long id;
/** 节点名称 */ /** 节点名称 */
private String label; private String label;
/** 子节点 */ /** 子节点 */
@JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<TreeSelect> children; private List<TreeSelect> children;
public TreeSelect() public TreeSelect()
{ {
} }
public TreeSelect(SysDept dept) public TreeSelect(SysDept dept)
{ {
this.id = dept.getDeptId(); this.id = dept.getDeptId();
this.label = dept.getDeptName(); this.label = dept.getDeptName();
this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
} }
public TreeSelect(SysMenu menu) public TreeSelect(SysMenu menu)
{ {
this.id = menu.getMenuId(); this.id = menu.getMenuId();
this.label = menu.getMenuName(); this.label = menu.getMenuName();
this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
} }
public Long getId() public Long getId()
{ {
return id; return id;
} }
public void setId(Long id) public void setId(Long id)
{ {
this.id = id; this.id = id;
} }
public String getLabel() public String getLabel()
{ {
return label; return label;
} }
public void setLabel(String label) public void setLabel(String label)
{ {
this.label = label; this.label = label;
} }
public List<TreeSelect> getChildren() public List<TreeSelect> getChildren()
{ {
return children; return children;
} }
public void setChildren(List<TreeSelect> children) public void setChildren(List<TreeSelect> children)
{ {
this.children = children; this.children = children;
} }
} }

View File

@ -1,202 +1,202 @@
package com.ruoyi.common.core.domain.entity; package com.stdiet.common.core.domain.entity;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.validation.constraints.Email; import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.domain.BaseEntity; import com.stdiet.common.core.domain.BaseEntity;
/** /**
* 部门表 sys_dept * 部门表 sys_dept
* *
* @author ruoyi * @author stdiet
*/ */
public class SysDept extends BaseEntity public class SysDept extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 部门ID */ /** 部门ID */
private Long deptId; private Long deptId;
/** 父部门ID */ /** 父部门ID */
private Long parentId; private Long parentId;
/** 祖级列表 */ /** 祖级列表 */
private String ancestors; private String ancestors;
/** 部门名称 */ /** 部门名称 */
private String deptName; private String deptName;
/** 显示顺序 */ /** 显示顺序 */
private String orderNum; private String orderNum;
/** 负责人 */ /** 负责人 */
private String leader; private String leader;
/** 联系电话 */ /** 联系电话 */
private String phone; private String phone;
/** 邮箱 */ /** 邮箱 */
private String email; private String email;
/** 部门状态:0正常,1停用 */ /** 部门状态:0正常,1停用 */
private String status; private String status;
/** 删除标志0代表存在 2代表删除 */ /** 删除标志0代表存在 2代表删除 */
private String delFlag; private String delFlag;
/** 父部门名称 */ /** 父部门名称 */
private String parentName; private String parentName;
/** 子部门 */ /** 子部门 */
private List<SysDept> children = new ArrayList<SysDept>(); private List<SysDept> children = new ArrayList<SysDept>();
public Long getDeptId() public Long getDeptId()
{ {
return deptId; return deptId;
} }
public void setDeptId(Long deptId) public void setDeptId(Long deptId)
{ {
this.deptId = deptId; this.deptId = deptId;
} }
public Long getParentId() public Long getParentId()
{ {
return parentId; return parentId;
} }
public void setParentId(Long parentId) public void setParentId(Long parentId)
{ {
this.parentId = parentId; this.parentId = parentId;
} }
public String getAncestors() public String getAncestors()
{ {
return ancestors; return ancestors;
} }
public void setAncestors(String ancestors) public void setAncestors(String ancestors)
{ {
this.ancestors = ancestors; this.ancestors = ancestors;
} }
@NotBlank(message = "部门名称不能为空") @NotBlank(message = "部门名称不能为空")
@Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符") @Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符")
public String getDeptName() public String getDeptName()
{ {
return deptName; return deptName;
} }
public void setDeptName(String deptName) public void setDeptName(String deptName)
{ {
this.deptName = deptName; this.deptName = deptName;
} }
@NotBlank(message = "显示顺序不能为空") @NotBlank(message = "显示顺序不能为空")
public String getOrderNum() public String getOrderNum()
{ {
return orderNum; return orderNum;
} }
public void setOrderNum(String orderNum) public void setOrderNum(String orderNum)
{ {
this.orderNum = orderNum; this.orderNum = orderNum;
} }
public String getLeader() public String getLeader()
{ {
return leader; return leader;
} }
public void setLeader(String leader) public void setLeader(String leader)
{ {
this.leader = leader; this.leader = leader;
} }
@Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符") @Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
public String getPhone() public String getPhone()
{ {
return phone; return phone;
} }
public void setPhone(String phone) public void setPhone(String phone)
{ {
this.phone = phone; this.phone = phone;
} }
@Email(message = "邮箱格式不正确") @Email(message = "邮箱格式不正确")
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
public String getEmail() public String getEmail()
{ {
return email; return email;
} }
public void setEmail(String email) public void setEmail(String email)
{ {
this.email = email; this.email = email;
} }
public String getStatus() public String getStatus()
{ {
return status; return status;
} }
public void setStatus(String status) public void setStatus(String status)
{ {
this.status = status; this.status = status;
} }
public String getDelFlag() public String getDelFlag()
{ {
return delFlag; return delFlag;
} }
public void setDelFlag(String delFlag) public void setDelFlag(String delFlag)
{ {
this.delFlag = delFlag; this.delFlag = delFlag;
} }
public String getParentName() public String getParentName()
{ {
return parentName; return parentName;
} }
public void setParentName(String parentName) public void setParentName(String parentName)
{ {
this.parentName = parentName; this.parentName = parentName;
} }
public List<SysDept> getChildren() public List<SysDept> getChildren()
{ {
return children; return children;
} }
public void setChildren(List<SysDept> children) public void setChildren(List<SysDept> children)
{ {
this.children = children; this.children = children;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("deptId", getDeptId()) .append("deptId", getDeptId())
.append("parentId", getParentId()) .append("parentId", getParentId())
.append("ancestors", getAncestors()) .append("ancestors", getAncestors())
.append("deptName", getDeptName()) .append("deptName", getDeptName())
.append("orderNum", getOrderNum()) .append("orderNum", getOrderNum())
.append("leader", getLeader()) .append("leader", getLeader())
.append("phone", getPhone()) .append("phone", getPhone())
.append("email", getEmail()) .append("email", getEmail())
.append("status", getStatus()) .append("status", getStatus())
.append("delFlag", getDelFlag()) .append("delFlag", getDelFlag())
.append("createBy", getCreateBy()) .append("createBy", getCreateBy())
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime()) .append("updateTime", getUpdateTime())
.toString(); .toString();
} }
} }

View File

@ -1,176 +1,176 @@
package com.ruoyi.common.core.domain.entity; package com.stdiet.common.core.domain.entity;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel; import com.stdiet.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.ColumnType; import com.stdiet.common.annotation.Excel.ColumnType;
import com.ruoyi.common.constant.UserConstants; import com.stdiet.common.constant.UserConstants;
import com.ruoyi.common.core.domain.BaseEntity; import com.stdiet.common.core.domain.BaseEntity;
/** /**
* 字典数据表 sys_dict_data * 字典数据表 sys_dict_data
* *
* @author ruoyi * @author stdiet
*/ */
public class SysDictData extends BaseEntity public class SysDictData extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 字典编码 */ /** 字典编码 */
@Excel(name = "字典编码", cellType = ColumnType.NUMERIC) @Excel(name = "字典编码", cellType = ColumnType.NUMERIC)
private Long dictCode; private Long dictCode;
/** 字典排序 */ /** 字典排序 */
@Excel(name = "字典排序", cellType = ColumnType.NUMERIC) @Excel(name = "字典排序", cellType = ColumnType.NUMERIC)
private Long dictSort; private Long dictSort;
/** 字典标签 */ /** 字典标签 */
@Excel(name = "字典标签") @Excel(name = "字典标签")
private String dictLabel; private String dictLabel;
/** 字典键值 */ /** 字典键值 */
@Excel(name = "字典键值") @Excel(name = "字典键值")
private String dictValue; private String dictValue;
/** 字典类型 */ /** 字典类型 */
@Excel(name = "字典类型") @Excel(name = "字典类型")
private String dictType; private String dictType;
/** 样式属性(其他样式扩展) */ /** 样式属性(其他样式扩展) */
private String cssClass; private String cssClass;
/** 表格字典样式 */ /** 表格字典样式 */
private String listClass; private String listClass;
/** 是否默认Y是 N否 */ /** 是否默认Y是 N否 */
@Excel(name = "是否默认", readConverterExp = "Y=是,N=否") @Excel(name = "是否默认", readConverterExp = "Y=是,N=否")
private String isDefault; private String isDefault;
/** 状态0正常 1停用 */ /** 状态0正常 1停用 */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用") @Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status; private String status;
public Long getDictCode() public Long getDictCode()
{ {
return dictCode; return dictCode;
} }
public void setDictCode(Long dictCode) public void setDictCode(Long dictCode)
{ {
this.dictCode = dictCode; this.dictCode = dictCode;
} }
public Long getDictSort() public Long getDictSort()
{ {
return dictSort; return dictSort;
} }
public void setDictSort(Long dictSort) public void setDictSort(Long dictSort)
{ {
this.dictSort = dictSort; this.dictSort = dictSort;
} }
@NotBlank(message = "字典标签不能为空") @NotBlank(message = "字典标签不能为空")
@Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符") @Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符")
public String getDictLabel() public String getDictLabel()
{ {
return dictLabel; return dictLabel;
} }
public void setDictLabel(String dictLabel) public void setDictLabel(String dictLabel)
{ {
this.dictLabel = dictLabel; this.dictLabel = dictLabel;
} }
@NotBlank(message = "字典键值不能为空") @NotBlank(message = "字典键值不能为空")
@Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符") @Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符")
public String getDictValue() public String getDictValue()
{ {
return dictValue; return dictValue;
} }
public void setDictValue(String dictValue) public void setDictValue(String dictValue)
{ {
this.dictValue = dictValue; this.dictValue = dictValue;
} }
@NotBlank(message = "字典类型不能为空") @NotBlank(message = "字典类型不能为空")
@Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符") @Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符")
public String getDictType() public String getDictType()
{ {
return dictType; return dictType;
} }
public void setDictType(String dictType) public void setDictType(String dictType)
{ {
this.dictType = dictType; this.dictType = dictType;
} }
@Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符") @Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符")
public String getCssClass() public String getCssClass()
{ {
return cssClass; return cssClass;
} }
public void setCssClass(String cssClass) public void setCssClass(String cssClass)
{ {
this.cssClass = cssClass; this.cssClass = cssClass;
} }
public String getListClass() public String getListClass()
{ {
return listClass; return listClass;
} }
public void setListClass(String listClass) public void setListClass(String listClass)
{ {
this.listClass = listClass; this.listClass = listClass;
} }
public boolean getDefault() public boolean getDefault()
{ {
return UserConstants.YES.equals(this.isDefault) ? true : false; return UserConstants.YES.equals(this.isDefault) ? true : false;
} }
public String getIsDefault() public String getIsDefault()
{ {
return isDefault; return isDefault;
} }
public void setIsDefault(String isDefault) public void setIsDefault(String isDefault)
{ {
this.isDefault = isDefault; this.isDefault = isDefault;
} }
public String getStatus() public String getStatus()
{ {
return status; return status;
} }
public void setStatus(String status) public void setStatus(String status)
{ {
this.status = status; this.status = status;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("dictCode", getDictCode()) .append("dictCode", getDictCode())
.append("dictSort", getDictSort()) .append("dictSort", getDictSort())
.append("dictLabel", getDictLabel()) .append("dictLabel", getDictLabel())
.append("dictValue", getDictValue()) .append("dictValue", getDictValue())
.append("dictType", getDictType()) .append("dictType", getDictType())
.append("cssClass", getCssClass()) .append("cssClass", getCssClass())
.append("listClass", getListClass()) .append("listClass", getListClass())
.append("isDefault", getIsDefault()) .append("isDefault", getIsDefault())
.append("status", getStatus()) .append("status", getStatus())
.append("createBy", getCreateBy()) .append("createBy", getCreateBy())
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime()) .append("updateTime", getUpdateTime())
.append("remark", getRemark()) .append("remark", getRemark())
.toString(); .toString();
} }
} }

View File

@ -1,94 +1,94 @@
package com.ruoyi.common.core.domain.entity; package com.stdiet.common.core.domain.entity;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel; import com.stdiet.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.ColumnType; import com.stdiet.common.annotation.Excel.ColumnType;
import com.ruoyi.common.core.domain.BaseEntity; import com.stdiet.common.core.domain.BaseEntity;
/** /**
* 字典类型表 sys_dict_type * 字典类型表 sys_dict_type
* *
* @author ruoyi * @author ruoyi
*/ */
public class SysDictType extends BaseEntity public class SysDictType extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 字典主键 */ /** 字典主键 */
@Excel(name = "字典主键", cellType = ColumnType.NUMERIC) @Excel(name = "字典主键", cellType = ColumnType.NUMERIC)
private Long dictId; private Long dictId;
/** 字典名称 */ /** 字典名称 */
@Excel(name = "字典名称") @Excel(name = "字典名称")
private String dictName; private String dictName;
/** 字典类型 */ /** 字典类型 */
@Excel(name = "字典类型") @Excel(name = "字典类型")
private String dictType; private String dictType;
/** 状态0正常 1停用 */ /** 状态0正常 1停用 */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用") @Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status; private String status;
public Long getDictId() public Long getDictId()
{ {
return dictId; return dictId;
} }
public void setDictId(Long dictId) public void setDictId(Long dictId)
{ {
this.dictId = dictId; this.dictId = dictId;
} }
@NotBlank(message = "字典名称不能为空") @NotBlank(message = "字典名称不能为空")
@Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符") @Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符")
public String getDictName() public String getDictName()
{ {
return dictName; return dictName;
} }
public void setDictName(String dictName) public void setDictName(String dictName)
{ {
this.dictName = dictName; this.dictName = dictName;
} }
@NotBlank(message = "字典类型不能为空") @NotBlank(message = "字典类型不能为空")
@Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符") @Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符")
public String getDictType() public String getDictType()
{ {
return dictType; return dictType;
} }
public void setDictType(String dictType) public void setDictType(String dictType)
{ {
this.dictType = dictType; this.dictType = dictType;
} }
public String getStatus() public String getStatus()
{ {
return status; return status;
} }
public void setStatus(String status) public void setStatus(String status)
{ {
this.status = status; this.status = status;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("dictId", getDictId()) .append("dictId", getDictId())
.append("dictName", getDictName()) .append("dictName", getDictName())
.append("dictType", getDictType()) .append("dictType", getDictType())
.append("status", getStatus()) .append("status", getStatus())
.append("createBy", getCreateBy()) .append("createBy", getCreateBy())
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime()) .append("updateTime", getUpdateTime())
.append("remark", getRemark()) .append("remark", getRemark())
.toString(); .toString();
} }
} }

View File

@ -1,245 +1,245 @@
package com.ruoyi.common.core.domain.entity; package com.stdiet.common.core.domain.entity;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.domain.BaseEntity; import com.stdiet.common.core.domain.BaseEntity;
/** /**
* 菜单权限表 sys_menu * 菜单权限表 sys_menu
* *
* @author ruoyi * @author stdiet
*/ */
public class SysMenu extends BaseEntity public class SysMenu extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 菜单ID */ /** 菜单ID */
private Long menuId; private Long menuId;
/** 菜单名称 */ /** 菜单名称 */
private String menuName; private String menuName;
/** 父菜单名称 */ /** 父菜单名称 */
private String parentName; private String parentName;
/** 父菜单ID */ /** 父菜单ID */
private Long parentId; private Long parentId;
/** 显示顺序 */ /** 显示顺序 */
private String orderNum; private String orderNum;
/** 路由地址 */ /** 路由地址 */
private String path; private String path;
/** 组件路径 */ /** 组件路径 */
private String component; private String component;
/** 是否为外链0是 1否 */ /** 是否为外链0是 1否 */
private String isFrame; private String isFrame;
/** 是否缓存0缓存 1不缓存 */ /** 是否缓存0缓存 1不缓存 */
private String isCache; private String isCache;
/** 类型M目录 C菜单 F按钮 */ /** 类型M目录 C菜单 F按钮 */
private String menuType; private String menuType;
/** 显示状态0显示 1隐藏 */ /** 显示状态0显示 1隐藏 */
private String visible; private String visible;
/** 菜单状态0显示 1隐藏 */ /** 菜单状态0显示 1隐藏 */
private String status; private String status;
/** 权限字符串 */ /** 权限字符串 */
private String perms; private String perms;
/** 菜单图标 */ /** 菜单图标 */
private String icon; private String icon;
/** 子菜单 */ /** 子菜单 */
private List<SysMenu> children = new ArrayList<SysMenu>(); private List<SysMenu> children = new ArrayList<SysMenu>();
public Long getMenuId() public Long getMenuId()
{ {
return menuId; return menuId;
} }
public void setMenuId(Long menuId) public void setMenuId(Long menuId)
{ {
this.menuId = menuId; this.menuId = menuId;
} }
@NotBlank(message = "菜单名称不能为空") @NotBlank(message = "菜单名称不能为空")
@Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符") @Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符")
public String getMenuName() public String getMenuName()
{ {
return menuName; return menuName;
} }
public void setMenuName(String menuName) public void setMenuName(String menuName)
{ {
this.menuName = menuName; this.menuName = menuName;
} }
public String getParentName() public String getParentName()
{ {
return parentName; return parentName;
} }
public void setParentName(String parentName) public void setParentName(String parentName)
{ {
this.parentName = parentName; this.parentName = parentName;
} }
public Long getParentId() public Long getParentId()
{ {
return parentId; return parentId;
} }
public void setParentId(Long parentId) public void setParentId(Long parentId)
{ {
this.parentId = parentId; this.parentId = parentId;
} }
@NotBlank(message = "显示顺序不能为空") @NotBlank(message = "显示顺序不能为空")
public String getOrderNum() public String getOrderNum()
{ {
return orderNum; return orderNum;
} }
public void setOrderNum(String orderNum) public void setOrderNum(String orderNum)
{ {
this.orderNum = orderNum; this.orderNum = orderNum;
} }
@Size(min = 0, max = 200, message = "路由地址不能超过200个字符") @Size(min = 0, max = 200, message = "路由地址不能超过200个字符")
public String getPath() public String getPath()
{ {
return path; return path;
} }
public void setPath(String path) public void setPath(String path)
{ {
this.path = path; this.path = path;
} }
@Size(min = 0, max = 200, message = "组件路径不能超过255个字符") @Size(min = 0, max = 200, message = "组件路径不能超过255个字符")
public String getComponent() public String getComponent()
{ {
return component; return component;
} }
public void setComponent(String component) public void setComponent(String component)
{ {
this.component = component; this.component = component;
} }
public String getIsFrame() public String getIsFrame()
{ {
return isFrame; return isFrame;
} }
public void setIsFrame(String isFrame) public void setIsFrame(String isFrame)
{ {
this.isFrame = isFrame; this.isFrame = isFrame;
} }
public String getIsCache() public String getIsCache()
{ {
return isCache; return isCache;
} }
public void setIsCache(String isCache) public void setIsCache(String isCache)
{ {
this.isCache = isCache; this.isCache = isCache;
} }
@NotBlank(message = "菜单类型不能为空") @NotBlank(message = "菜单类型不能为空")
public String getMenuType() public String getMenuType()
{ {
return menuType; return menuType;
} }
public void setMenuType(String menuType) public void setMenuType(String menuType)
{ {
this.menuType = menuType; this.menuType = menuType;
} }
public String getVisible() public String getVisible()
{ {
return visible; return visible;
} }
public void setVisible(String visible) public void setVisible(String visible)
{ {
this.visible = visible; this.visible = visible;
} }
public String getStatus() public String getStatus()
{ {
return status; return status;
} }
public void setStatus(String status) public void setStatus(String status)
{ {
this.status = status; this.status = status;
} }
@Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符") @Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符")
public String getPerms() public String getPerms()
{ {
return perms; return perms;
} }
public void setPerms(String perms) public void setPerms(String perms)
{ {
this.perms = perms; this.perms = perms;
} }
public String getIcon() public String getIcon()
{ {
return icon; return icon;
} }
public void setIcon(String icon) public void setIcon(String icon)
{ {
this.icon = icon; this.icon = icon;
} }
public List<SysMenu> getChildren() public List<SysMenu> getChildren()
{ {
return children; return children;
} }
public void setChildren(List<SysMenu> children) public void setChildren(List<SysMenu> children)
{ {
this.children = children; this.children = children;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("menuId", getMenuId()) .append("menuId", getMenuId())
.append("menuName", getMenuName()) .append("menuName", getMenuName())
.append("parentId", getParentId()) .append("parentId", getParentId())
.append("orderNum", getOrderNum()) .append("orderNum", getOrderNum())
.append("path", getPath()) .append("path", getPath())
.append("component", getComponent()) .append("component", getComponent())
.append("isFrame", getIsFrame()) .append("isFrame", getIsFrame())
.append("IsCache", getIsCache()) .append("IsCache", getIsCache())
.append("menuType", getMenuType()) .append("menuType", getMenuType())
.append("visible", getVisible()) .append("visible", getVisible())
.append("status ", getStatus()) .append("status ", getStatus())
.append("perms", getPerms()) .append("perms", getPerms())
.append("icon", getIcon()) .append("icon", getIcon())
.append("createBy", getCreateBy()) .append("createBy", getCreateBy())
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime()) .append("updateTime", getUpdateTime())
.append("remark", getRemark()) .append("remark", getRemark())
.toString(); .toString();
} }
} }

View File

@ -1,226 +1,226 @@
package com.ruoyi.common.core.domain.entity; package com.stdiet.common.core.domain.entity;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel; import com.stdiet.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.ColumnType; import com.stdiet.common.annotation.Excel.ColumnType;
import com.ruoyi.common.core.domain.BaseEntity; import com.stdiet.common.core.domain.BaseEntity;
/** /**
* 角色表 sys_role * 角色表 sys_role
* *
* @author ruoyi * @author stdiet
*/ */
public class SysRole extends BaseEntity public class SysRole extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 角色ID */ /** 角色ID */
@Excel(name = "角色序号", cellType = ColumnType.NUMERIC) @Excel(name = "角色序号", cellType = ColumnType.NUMERIC)
private Long roleId; private Long roleId;
/** 角色名称 */ /** 角色名称 */
@Excel(name = "角色名称") @Excel(name = "角色名称")
private String roleName; private String roleName;
/** 角色权限 */ /** 角色权限 */
@Excel(name = "角色权限") @Excel(name = "角色权限")
private String roleKey; private String roleKey;
/** 角色排序 */ /** 角色排序 */
@Excel(name = "角色排序") @Excel(name = "角色排序")
private String roleSort; private String roleSort;
/** 数据范围1所有数据权限2自定义数据权限3本部门数据权限4本部门及以下数据权限 */ /** 数据范围1所有数据权限2自定义数据权限3本部门数据权限4本部门及以下数据权限 */
@Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限") @Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限")
private String dataScope; private String dataScope;
/** 菜单树选择项是否关联显示( 0父子不互相关联显示 1父子互相关联显示 */ /** 菜单树选择项是否关联显示( 0父子不互相关联显示 1父子互相关联显示 */
private boolean menuCheckStrictly; private boolean menuCheckStrictly;
/** 部门树选择项是否关联显示0父子不互相关联显示 1父子互相关联显示 */ /** 部门树选择项是否关联显示0父子不互相关联显示 1父子互相关联显示 */
private boolean deptCheckStrictly; private boolean deptCheckStrictly;
/** 角色状态0正常 1停用 */ /** 角色状态0正常 1停用 */
@Excel(name = "角色状态", readConverterExp = "0=正常,1=停用") @Excel(name = "角色状态", readConverterExp = "0=正常,1=停用")
private String status; private String status;
/** 删除标志0代表存在 2代表删除 */ /** 删除标志0代表存在 2代表删除 */
private String delFlag; private String delFlag;
/** 用户是否存在此角色标识 默认不存在 */ /** 用户是否存在此角色标识 默认不存在 */
private boolean flag = false; private boolean flag = false;
/** 菜单组 */ /** 菜单组 */
private Long[] menuIds; private Long[] menuIds;
/** 部门组(数据权限) */ /** 部门组(数据权限) */
private Long[] deptIds; private Long[] deptIds;
public SysRole() public SysRole()
{ {
} }
public SysRole(Long roleId) public SysRole(Long roleId)
{ {
this.roleId = roleId; this.roleId = roleId;
} }
public Long getRoleId() public Long getRoleId()
{ {
return roleId; return roleId;
} }
public void setRoleId(Long roleId) public void setRoleId(Long roleId)
{ {
this.roleId = roleId; this.roleId = roleId;
} }
public boolean isAdmin() public boolean isAdmin()
{ {
return isAdmin(this.roleId); return isAdmin(this.roleId);
} }
public static boolean isAdmin(Long roleId) public static boolean isAdmin(Long roleId)
{ {
return roleId != null && 1L == roleId; return roleId != null && 1L == roleId;
} }
@NotBlank(message = "角色名称不能为空") @NotBlank(message = "角色名称不能为空")
@Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符") @Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符")
public String getRoleName() public String getRoleName()
{ {
return roleName; return roleName;
} }
public void setRoleName(String roleName) public void setRoleName(String roleName)
{ {
this.roleName = roleName; this.roleName = roleName;
} }
@NotBlank(message = "权限字符不能为空") @NotBlank(message = "权限字符不能为空")
@Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符") @Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符")
public String getRoleKey() public String getRoleKey()
{ {
return roleKey; return roleKey;
} }
public void setRoleKey(String roleKey) public void setRoleKey(String roleKey)
{ {
this.roleKey = roleKey; this.roleKey = roleKey;
} }
@NotBlank(message = "显示顺序不能为空") @NotBlank(message = "显示顺序不能为空")
public String getRoleSort() public String getRoleSort()
{ {
return roleSort; return roleSort;
} }
public void setRoleSort(String roleSort) public void setRoleSort(String roleSort)
{ {
this.roleSort = roleSort; this.roleSort = roleSort;
} }
public String getDataScope() public String getDataScope()
{ {
return dataScope; return dataScope;
} }
public void setDataScope(String dataScope) public void setDataScope(String dataScope)
{ {
this.dataScope = dataScope; this.dataScope = dataScope;
} }
public boolean isMenuCheckStrictly() public boolean isMenuCheckStrictly()
{ {
return menuCheckStrictly; return menuCheckStrictly;
} }
public void setMenuCheckStrictly(boolean menuCheckStrictly) public void setMenuCheckStrictly(boolean menuCheckStrictly)
{ {
this.menuCheckStrictly = menuCheckStrictly; this.menuCheckStrictly = menuCheckStrictly;
} }
public boolean isDeptCheckStrictly() public boolean isDeptCheckStrictly()
{ {
return deptCheckStrictly; return deptCheckStrictly;
} }
public void setDeptCheckStrictly(boolean deptCheckStrictly) public void setDeptCheckStrictly(boolean deptCheckStrictly)
{ {
this.deptCheckStrictly = deptCheckStrictly; this.deptCheckStrictly = deptCheckStrictly;
} }
public String getStatus() public String getStatus()
{ {
return status; return status;
} }
public void setStatus(String status) public void setStatus(String status)
{ {
this.status = status; this.status = status;
} }
public String getDelFlag() public String getDelFlag()
{ {
return delFlag; return delFlag;
} }
public void setDelFlag(String delFlag) public void setDelFlag(String delFlag)
{ {
this.delFlag = delFlag; this.delFlag = delFlag;
} }
public boolean isFlag() public boolean isFlag()
{ {
return flag; return flag;
} }
public void setFlag(boolean flag) public void setFlag(boolean flag)
{ {
this.flag = flag; this.flag = flag;
} }
public Long[] getMenuIds() public Long[] getMenuIds()
{ {
return menuIds; return menuIds;
} }
public void setMenuIds(Long[] menuIds) public void setMenuIds(Long[] menuIds)
{ {
this.menuIds = menuIds; this.menuIds = menuIds;
} }
public Long[] getDeptIds() public Long[] getDeptIds()
{ {
return deptIds; return deptIds;
} }
public void setDeptIds(Long[] deptIds) public void setDeptIds(Long[] deptIds)
{ {
this.deptIds = deptIds; this.deptIds = deptIds;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("roleId", getRoleId()) .append("roleId", getRoleId())
.append("roleName", getRoleName()) .append("roleName", getRoleName())
.append("roleKey", getRoleKey()) .append("roleKey", getRoleKey())
.append("roleSort", getRoleSort()) .append("roleSort", getRoleSort())
.append("dataScope", getDataScope()) .append("dataScope", getDataScope())
.append("menuCheckStrictly", isMenuCheckStrictly()) .append("menuCheckStrictly", isMenuCheckStrictly())
.append("deptCheckStrictly", isDeptCheckStrictly()) .append("deptCheckStrictly", isDeptCheckStrictly())
.append("status", getStatus()) .append("status", getStatus())
.append("delFlag", getDelFlag()) .append("delFlag", getDelFlag())
.append("createBy", getCreateBy()) .append("createBy", getCreateBy())
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime()) .append("updateTime", getUpdateTime())
.append("remark", getRemark()) .append("remark", getRemark())
.toString(); .toString();
} }
} }

View File

@ -1,347 +1,347 @@
package com.ruoyi.common.core.domain.entity; package com.stdiet.common.core.domain.entity;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.validation.constraints.Email; import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.ruoyi.common.annotation.Excel; import com.stdiet.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.ColumnType; import com.stdiet.common.annotation.Excel.ColumnType;
import com.ruoyi.common.annotation.Excel.Type; import com.stdiet.common.annotation.Excel.Type;
import com.ruoyi.common.annotation.Excels; import com.stdiet.common.annotation.Excels;
import com.ruoyi.common.core.domain.BaseEntity; import com.stdiet.common.core.domain.BaseEntity;
/** /**
* 用户对象 sys_user * 用户对象 sys_user
* *
* @author ruoyi * @author stdiet
*/ */
public class SysUser extends BaseEntity { public class SysUser extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 用户ID * 用户ID
*/ */
@Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号") @Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号")
private Long userId; private Long userId;
/** /**
* 部门ID * 部门ID
*/ */
@Excel(name = "部门编号", type = Type.IMPORT) @Excel(name = "部门编号", type = Type.IMPORT)
private Long deptId; private Long deptId;
/** /**
* 用户账号 * 用户账号
*/ */
@Excel(name = "登录名称") @Excel(name = "登录名称")
private String userName; private String userName;
/** /**
* 用户昵称 * 用户昵称
*/ */
@Excel(name = "用户名称") @Excel(name = "用户名称")
private String nickName; private String nickName;
/** /**
* 用户邮箱 * 用户邮箱
*/ */
@Excel(name = "用户邮箱") @Excel(name = "用户邮箱")
private String email; private String email;
/** /**
* 手机号码 * 手机号码
*/ */
@Excel(name = "手机号码") @Excel(name = "手机号码")
private String phonenumber; private String phonenumber;
/** /**
* 用户性别 * 用户性别
*/ */
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知") @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
private String sex; private String sex;
/** /**
* 用户头像 * 用户头像
*/ */
private String avatar; private String avatar;
/** /**
* 密码 * 密码
*/ */
private String password; private String password;
/** /**
* 盐加密 * 盐加密
*/ */
private String salt; private String salt;
/** /**
* 帐号状态0正常 1停用 * 帐号状态0正常 1停用
*/ */
@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用") @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
private String status; private String status;
/** /**
* 删除标志0代表存在 2代表删除 * 删除标志0代表存在 2代表删除
*/ */
private String delFlag; private String delFlag;
/** /**
* 最后登录IP * 最后登录IP
*/ */
@Excel(name = "最后登录IP", type = Type.EXPORT) @Excel(name = "最后登录IP", type = Type.EXPORT)
private String loginIp; private String loginIp;
/** /**
* 最后登录时间 * 最后登录时间
*/ */
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT) @Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
private Date loginDate; private Date loginDate;
/** /**
* 部门对象 * 部门对象
*/ */
@Excels({ @Excels({
@Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT), @Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT),
@Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT) @Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT)
}) })
private SysDept dept; private SysDept dept;
/** /**
* 角色对象 * 角色对象
*/ */
private List<SysRole> roles; private List<SysRole> roles;
/** /**
* 角色组 * 角色组
*/ */
private Long[] roleIds; private Long[] roleIds;
/** /**
* 岗位组 * 岗位组
*/ */
private Long[] postIds; private Long[] postIds;
private Long postId; private Long postId;
@Excel(name = "岗位") @Excel(name = "岗位")
private String postName; private String postName;
public SysUser() { public SysUser() {
} }
public Long getPostId() { public Long getPostId() {
return postId; return postId;
} }
public String getPostName() { public String getPostName() {
return postName; return postName;
} }
public void setPostId(Long postId) { public void setPostId(Long postId) {
this.postId = postId; this.postId = postId;
} }
public void setPostName(String postName) { public void setPostName(String postName) {
this.postName = postName; this.postName = postName;
} }
public SysUser(Long userId) { public SysUser(Long userId) {
this.userId = userId; this.userId = userId;
} }
public Long getUserId() { public Long getUserId() {
return userId; return userId;
} }
public void setUserId(Long userId) { public void setUserId(Long userId) {
this.userId = userId; this.userId = userId;
} }
public boolean isAdmin() { public boolean isAdmin() {
return isAdmin(this.userId); return isAdmin(this.userId);
} }
public static boolean isAdmin(Long userId) { public static boolean isAdmin(Long userId) {
return userId != null && 1L == userId; return userId != null && 1L == userId;
} }
public Long getDeptId() { public Long getDeptId() {
return deptId; return deptId;
} }
public void setDeptId(Long deptId) { public void setDeptId(Long deptId) {
this.deptId = deptId; this.deptId = deptId;
} }
@Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符") @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
public String getNickName() { public String getNickName() {
return nickName; return nickName;
} }
public void setNickName(String nickName) { public void setNickName(String nickName) {
this.nickName = nickName; this.nickName = nickName;
} }
@NotBlank(message = "用户账号不能为空") @NotBlank(message = "用户账号不能为空")
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符") @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
public String getUserName() { public String getUserName() {
return userName; return userName;
} }
public void setUserName(String userName) { public void setUserName(String userName) {
this.userName = userName; this.userName = userName;
} }
@Email(message = "邮箱格式不正确") @Email(message = "邮箱格式不正确")
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
public String getEmail() { public String getEmail() {
return email; return email;
} }
public void setEmail(String email) { public void setEmail(String email) {
this.email = email; this.email = email;
} }
@Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符") @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
public String getPhonenumber() { public String getPhonenumber() {
return phonenumber; return phonenumber;
} }
public void setPhonenumber(String phonenumber) { public void setPhonenumber(String phonenumber) {
this.phonenumber = phonenumber; this.phonenumber = phonenumber;
} }
public String getSex() { public String getSex() {
return sex; return sex;
} }
public void setSex(String sex) { public void setSex(String sex) {
this.sex = sex; this.sex = sex;
} }
public String getAvatar() { public String getAvatar() {
return avatar; return avatar;
} }
public void setAvatar(String avatar) { public void setAvatar(String avatar) {
this.avatar = avatar; this.avatar = avatar;
} }
@JsonIgnore @JsonIgnore
@JsonProperty @JsonProperty
public String getPassword() { public String getPassword() {
return password; return password;
} }
public void setPassword(String password) { public void setPassword(String password) {
this.password = password; this.password = password;
} }
public String getSalt() { public String getSalt() {
return salt; return salt;
} }
public void setSalt(String salt) { public void setSalt(String salt) {
this.salt = salt; this.salt = salt;
} }
public String getStatus() { public String getStatus() {
return status; return status;
} }
public void setStatus(String status) { public void setStatus(String status) {
this.status = status; this.status = status;
} }
public String getDelFlag() { public String getDelFlag() {
return delFlag; return delFlag;
} }
public void setDelFlag(String delFlag) { public void setDelFlag(String delFlag) {
this.delFlag = delFlag; this.delFlag = delFlag;
} }
public String getLoginIp() { public String getLoginIp() {
return loginIp; return loginIp;
} }
public void setLoginIp(String loginIp) { public void setLoginIp(String loginIp) {
this.loginIp = loginIp; this.loginIp = loginIp;
} }
public Date getLoginDate() { public Date getLoginDate() {
return loginDate; return loginDate;
} }
public void setLoginDate(Date loginDate) { public void setLoginDate(Date loginDate) {
this.loginDate = loginDate; this.loginDate = loginDate;
} }
public SysDept getDept() { public SysDept getDept() {
return dept; return dept;
} }
public void setDept(SysDept dept) { public void setDept(SysDept dept) {
this.dept = dept; this.dept = dept;
} }
public List<SysRole> getRoles() { public List<SysRole> getRoles() {
return roles; return roles;
} }
public void setRoles(List<SysRole> roles) { public void setRoles(List<SysRole> roles) {
this.roles = roles; this.roles = roles;
} }
public Long[] getRoleIds() { public Long[] getRoleIds() {
return roleIds; return roleIds;
} }
public void setRoleIds(Long[] roleIds) { public void setRoleIds(Long[] roleIds) {
this.roleIds = roleIds; this.roleIds = roleIds;
} }
public Long[] getPostIds() { public Long[] getPostIds() {
return postIds; return postIds;
} }
public void setPostIds(Long[] postIds) { public void setPostIds(Long[] postIds) {
this.postIds = postIds; this.postIds = postIds;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("userId", getUserId()) .append("userId", getUserId())
.append("deptId", getDeptId()) .append("deptId", getDeptId())
.append("userName", getUserName()) .append("userName", getUserName())
.append("nickName", getNickName()) .append("nickName", getNickName())
.append("email", getEmail()) .append("email", getEmail())
.append("phonenumber", getPhonenumber()) .append("phonenumber", getPhonenumber())
.append("sex", getSex()) .append("sex", getSex())
.append("avatar", getAvatar()) .append("avatar", getAvatar())
.append("password", getPassword()) .append("password", getPassword())
.append("salt", getSalt()) .append("salt", getSalt())
.append("status", getStatus()) .append("status", getStatus())
.append("delFlag", getDelFlag()) .append("delFlag", getDelFlag())
.append("loginIp", getLoginIp()) .append("loginIp", getLoginIp())
.append("loginDate", getLoginDate()) .append("loginDate", getLoginDate())
.append("createBy", getCreateBy()) .append("createBy", getCreateBy())
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime()) .append("updateTime", getUpdateTime())
.append("remark", getRemark()) .append("remark", getRemark())
.append("dept", getDept()) .append("dept", getDept())
.append("postId", getPostId()) .append("postId", getPostId())
.append("postName", getPostName()) .append("postName", getPostName())
.toString(); .toString();
} }
} }

View File

@ -1,69 +1,69 @@
package com.ruoyi.common.core.domain.model; package com.stdiet.common.core.domain.model;
/** /**
* 用户登录对象 * 用户登录对象
* *
* @author ruoyi * @author stdiet
*/ */
public class LoginBody public class LoginBody
{ {
/** /**
* 用户名 * 用户名
*/ */
private String username; private String username;
/** /**
* 用户密码 * 用户密码
*/ */
private String password; private String password;
/** /**
* 验证码 * 验证码
*/ */
private String code; private String code;
/** /**
* 唯一标识 * 唯一标识
*/ */
private String uuid = ""; private String uuid = "";
public String getUsername() public String getUsername()
{ {
return username; return username;
} }
public void setUsername(String username) public void setUsername(String username)
{ {
this.username = username; this.username = username;
} }
public String getPassword() public String getPassword()
{ {
return password; return password;
} }
public void setPassword(String password) public void setPassword(String password)
{ {
this.password = password; this.password = password;
} }
public String getCode() public String getCode()
{ {
return code; return code;
} }
public void setCode(String code) public void setCode(String code)
{ {
this.code = code; this.code = code;
} }
public String getUuid() public String getUuid()
{ {
return uuid; return uuid;
} }
public void setUuid(String uuid) public void setUuid(String uuid)
{ {
this.uuid = uuid; this.uuid = uuid;
} }
} }

View File

@ -1,228 +1,228 @@
package com.ruoyi.common.core.domain.model; package com.stdiet.common.core.domain.model;
import java.util.Collection; import java.util.Collection;
import java.util.Set; import java.util.Set;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetails;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ruoyi.common.core.domain.entity.SysUser; import com.stdiet.common.core.domain.entity.SysUser;
/** /**
* 登录用户身份权限 * 登录用户身份权限
* *
* @author ruoyi * @author stdiet
*/ */
public class LoginUser implements UserDetails public class LoginUser implements UserDetails
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 用户唯一标识 * 用户唯一标识
*/ */
private String token; private String token;
/** /**
* 登录时间 * 登录时间
*/ */
private Long loginTime; private Long loginTime;
/** /**
* 过期时间 * 过期时间
*/ */
private Long expireTime; private Long expireTime;
/** /**
* 登录IP地址 * 登录IP地址
*/ */
private String ipaddr; private String ipaddr;
/** /**
* 登录地点 * 登录地点
*/ */
private String loginLocation; private String loginLocation;
/** /**
* 浏览器类型 * 浏览器类型
*/ */
private String browser; private String browser;
/** /**
* 操作系统 * 操作系统
*/ */
private String os; private String os;
/** /**
* 权限列表 * 权限列表
*/ */
private Set<String> permissions; private Set<String> permissions;
/** /**
* 用户信息 * 用户信息
*/ */
private SysUser user; private SysUser user;
public String getToken() public String getToken()
{ {
return token; return token;
} }
public void setToken(String token) public void setToken(String token)
{ {
this.token = token; this.token = token;
} }
public LoginUser() public LoginUser()
{ {
} }
public LoginUser(SysUser user, Set<String> permissions) public LoginUser(SysUser user, Set<String> permissions)
{ {
this.user = user; this.user = user;
this.permissions = permissions; this.permissions = permissions;
} }
@JsonIgnore @JsonIgnore
@Override @Override
public String getPassword() public String getPassword()
{ {
return user.getPassword(); return user.getPassword();
} }
@Override @Override
public String getUsername() public String getUsername()
{ {
return user.getUserName(); return user.getUserName();
} }
/** /**
* 账户是否未过期,过期无法验证 * 账户是否未过期,过期无法验证
*/ */
@JsonIgnore @JsonIgnore
@Override @Override
public boolean isAccountNonExpired() public boolean isAccountNonExpired()
{ {
return true; return true;
} }
/** /**
* 指定用户是否解锁,锁定的用户无法进行身份验证 * 指定用户是否解锁,锁定的用户无法进行身份验证
* *
* @return * @return
*/ */
@JsonIgnore @JsonIgnore
@Override @Override
public boolean isAccountNonLocked() public boolean isAccountNonLocked()
{ {
return true; return true;
} }
/** /**
* 指示是否已过期的用户的凭据(密码),过期的凭据防止认证 * 指示是否已过期的用户的凭据(密码),过期的凭据防止认证
* *
* @return * @return
*/ */
@JsonIgnore @JsonIgnore
@Override @Override
public boolean isCredentialsNonExpired() public boolean isCredentialsNonExpired()
{ {
return true; return true;
} }
/** /**
* 是否可用 ,禁用的用户不能身份验证 * 是否可用 ,禁用的用户不能身份验证
* *
* @return * @return
*/ */
@JsonIgnore @JsonIgnore
@Override @Override
public boolean isEnabled() public boolean isEnabled()
{ {
return true; return true;
} }
public Long getLoginTime() public Long getLoginTime()
{ {
return loginTime; return loginTime;
} }
public void setLoginTime(Long loginTime) public void setLoginTime(Long loginTime)
{ {
this.loginTime = loginTime; this.loginTime = loginTime;
} }
public String getIpaddr() public String getIpaddr()
{ {
return ipaddr; return ipaddr;
} }
public void setIpaddr(String ipaddr) public void setIpaddr(String ipaddr)
{ {
this.ipaddr = ipaddr; this.ipaddr = ipaddr;
} }
public String getLoginLocation() public String getLoginLocation()
{ {
return loginLocation; return loginLocation;
} }
public void setLoginLocation(String loginLocation) public void setLoginLocation(String loginLocation)
{ {
this.loginLocation = loginLocation; this.loginLocation = loginLocation;
} }
public String getBrowser() public String getBrowser()
{ {
return browser; return browser;
} }
public void setBrowser(String browser) public void setBrowser(String browser)
{ {
this.browser = browser; this.browser = browser;
} }
public String getOs() public String getOs()
{ {
return os; return os;
} }
public void setOs(String os) public void setOs(String os)
{ {
this.os = os; this.os = os;
} }
public Long getExpireTime() public Long getExpireTime()
{ {
return expireTime; return expireTime;
} }
public void setExpireTime(Long expireTime) public void setExpireTime(Long expireTime)
{ {
this.expireTime = expireTime; this.expireTime = expireTime;
} }
public Set<String> getPermissions() public Set<String> getPermissions()
{ {
return permissions; return permissions;
} }
public void setPermissions(Set<String> permissions) public void setPermissions(Set<String> permissions)
{ {
this.permissions = permissions; this.permissions = permissions;
} }
public SysUser getUser() public SysUser getUser()
{ {
return user; return user;
} }
public void setUser(SysUser user) public void setUser(SysUser user)
{ {
this.user = user; this.user = user;
} }
@Override @Override
public Collection<? extends GrantedAuthority> getAuthorities() public Collection<? extends GrantedAuthority> getAuthorities()
{ {
return null; return null;
} }
} }

View File

@ -1,72 +1,72 @@
package com.ruoyi.common.core.page; package com.stdiet.common.core.page;
import com.ruoyi.common.utils.StringUtils; import com.stdiet.common.utils.StringUtils;
/** /**
* 分页数据 * 分页数据
* *
* @author ruoyi * @author stdiet
*/ */
public class PageDomain public class PageDomain
{ {
/** 当前记录起始索引 */ /** 当前记录起始索引 */
private Integer pageNum; private Integer pageNum;
/** 每页显示记录数 */ /** 每页显示记录数 */
private Integer pageSize; private Integer pageSize;
/** 排序列 */ /** 排序列 */
private String orderByColumn; private String orderByColumn;
/** 排序的方向desc或者asc */ /** 排序的方向desc或者asc */
private String isAsc = "asc"; private String isAsc = "asc";
public String getOrderBy() public String getOrderBy()
{ {
if (StringUtils.isEmpty(orderByColumn)) if (StringUtils.isEmpty(orderByColumn))
{ {
return ""; return "";
} }
return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc; return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc;
} }
public Integer getPageNum() public Integer getPageNum()
{ {
return pageNum; return pageNum;
} }
public void setPageNum(Integer pageNum) public void setPageNum(Integer pageNum)
{ {
this.pageNum = pageNum; this.pageNum = pageNum;
} }
public Integer getPageSize() public Integer getPageSize()
{ {
return pageSize; return pageSize;
} }
public void setPageSize(Integer pageSize) public void setPageSize(Integer pageSize)
{ {
this.pageSize = pageSize; this.pageSize = pageSize;
} }
public String getOrderByColumn() public String getOrderByColumn()
{ {
return orderByColumn; return orderByColumn;
} }
public void setOrderByColumn(String orderByColumn) public void setOrderByColumn(String orderByColumn)
{ {
this.orderByColumn = orderByColumn; this.orderByColumn = orderByColumn;
} }
public String getIsAsc() public String getIsAsc()
{ {
return isAsc; return isAsc;
} }
public void setIsAsc(String isAsc) public void setIsAsc(String isAsc)
{ {
this.isAsc = isAsc; this.isAsc = isAsc;
} }
} }

View File

@ -1,85 +1,85 @@
package com.ruoyi.common.core.page; package com.stdiet.common.core.page;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
/** /**
* 表格分页数据对象 * 表格分页数据对象
* *
* @author ruoyi * @author stdiet
*/ */
public class TableDataInfo implements Serializable public class TableDataInfo implements Serializable
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 总记录数 */ /** 总记录数 */
private long total; private long total;
/** 列表数据 */ /** 列表数据 */
private List<?> rows; private List<?> rows;
/** 消息状态码 */ /** 消息状态码 */
private int code; private int code;
/** 消息内容 */ /** 消息内容 */
private String msg; private String msg;
/** /**
* 表格数据对象 * 表格数据对象
*/ */
public TableDataInfo() public TableDataInfo()
{ {
} }
/** /**
* 分页 * 分页
* *
* @param list 列表数据 * @param list 列表数据
* @param total 总记录数 * @param total 总记录数
*/ */
public TableDataInfo(List<?> list, int total) public TableDataInfo(List<?> list, int total)
{ {
this.rows = list; this.rows = list;
this.total = total; this.total = total;
} }
public long getTotal() public long getTotal()
{ {
return total; return total;
} }
public void setTotal(long total) public void setTotal(long total)
{ {
this.total = total; this.total = total;
} }
public List<?> getRows() public List<?> getRows()
{ {
return rows; return rows;
} }
public void setRows(List<?> rows) public void setRows(List<?> rows)
{ {
this.rows = rows; this.rows = rows;
} }
public int getCode() public int getCode()
{ {
return code; return code;
} }
public void setCode(int code) public void setCode(int code)
{ {
this.code = code; this.code = code;
} }
public String getMsg() public String getMsg()
{ {
return msg; return msg;
} }
public void setMsg(String msg) public void setMsg(String msg)
{ {
this.msg = msg; this.msg = msg;
} }
} }

View File

@ -1,49 +1,49 @@
package com.ruoyi.common.core.page; package com.stdiet.common.core.page;
import com.ruoyi.common.utils.ServletUtils; import com.stdiet.common.utils.ServletUtils;
/** /**
* 表格数据处理 * 表格数据处理
* *
* @author ruoyi * @author stdiet
*/ */
public class TableSupport public class TableSupport
{ {
/** /**
* 当前记录起始索引 * 当前记录起始索引
*/ */
public static final String PAGE_NUM = "pageNum"; public static final String PAGE_NUM = "pageNum";
/** /**
* 每页显示记录数 * 每页显示记录数
*/ */
public static final String PAGE_SIZE = "pageSize"; public static final String PAGE_SIZE = "pageSize";
/** /**
* 排序列 * 排序列
*/ */
public static final String ORDER_BY_COLUMN = "orderByColumn"; public static final String ORDER_BY_COLUMN = "orderByColumn";
/** /**
* 排序的方向 "desc" 或者 "asc". * 排序的方向 "desc" 或者 "asc".
*/ */
public static final String IS_ASC = "isAsc"; public static final String IS_ASC = "isAsc";
/** /**
* 封装分页对象 * 封装分页对象
*/ */
public static PageDomain getPageDomain() public static PageDomain getPageDomain()
{ {
PageDomain pageDomain = new PageDomain(); PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(ServletUtils.getParameterToInt(PAGE_NUM)); pageDomain.setPageNum(ServletUtils.getParameterToInt(PAGE_NUM));
pageDomain.setPageSize(ServletUtils.getParameterToInt(PAGE_SIZE)); pageDomain.setPageSize(ServletUtils.getParameterToInt(PAGE_SIZE));
pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN)); pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN));
pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC)); pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC));
return pageDomain; return pageDomain;
} }
public static PageDomain buildPageRequest() public static PageDomain buildPageRequest()
{ {
return getPageDomain(); return getPageDomain();
} }
} }

View File

@ -1,227 +1,227 @@
package com.ruoyi.common.core.redis; package com.stdiet.common.core.redis;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.HashOperations; import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations; import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* spring redis 工具类 * spring redis 工具类
* *
* @author ruoyi * @author stdiet
**/ **/
@SuppressWarnings(value = { "unchecked", "rawtypes" }) @SuppressWarnings(value = { "unchecked", "rawtypes" })
@Component @Component
public class RedisCache public class RedisCache
{ {
@Autowired @Autowired
public RedisTemplate redisTemplate; public RedisTemplate redisTemplate;
/** /**
* 缓存基本的对象IntegerString实体类等 * 缓存基本的对象IntegerString实体类等
* *
* @param key 缓存的键值 * @param key 缓存的键值
* @param value 缓存的值 * @param value 缓存的值
*/ */
public <T> void setCacheObject(final String key, final T value) public <T> void setCacheObject(final String key, final T value)
{ {
redisTemplate.opsForValue().set(key, value); redisTemplate.opsForValue().set(key, value);
} }
/** /**
* 缓存基本的对象IntegerString实体类等 * 缓存基本的对象IntegerString实体类等
* *
* @param key 缓存的键值 * @param key 缓存的键值
* @param value 缓存的值 * @param value 缓存的值
* @param timeout 时间 * @param timeout 时间
* @param timeUnit 时间颗粒度 * @param timeUnit 时间颗粒度
*/ */
public <T> void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit) public <T> void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit)
{ {
redisTemplate.opsForValue().set(key, value, timeout, timeUnit); redisTemplate.opsForValue().set(key, value, timeout, timeUnit);
} }
/** /**
* 设置有效时间 * 设置有效时间
* *
* @param key Redis键 * @param key Redis键
* @param timeout 超时时间 * @param timeout 超时时间
* @return true=设置成功false=设置失败 * @return true=设置成功false=设置失败
*/ */
public boolean expire(final String key, final long timeout) public boolean expire(final String key, final long timeout)
{ {
return expire(key, timeout, TimeUnit.SECONDS); return expire(key, timeout, TimeUnit.SECONDS);
} }
/** /**
* 设置有效时间 * 设置有效时间
* *
* @param key Redis键 * @param key Redis键
* @param timeout 超时时间 * @param timeout 超时时间
* @param unit 时间单位 * @param unit 时间单位
* @return true=设置成功false=设置失败 * @return true=设置成功false=设置失败
*/ */
public boolean expire(final String key, final long timeout, final TimeUnit unit) public boolean expire(final String key, final long timeout, final TimeUnit unit)
{ {
return redisTemplate.expire(key, timeout, unit); return redisTemplate.expire(key, timeout, unit);
} }
/** /**
* 获得缓存的基本对象 * 获得缓存的基本对象
* *
* @param key 缓存键值 * @param key 缓存键值
* @return 缓存键值对应的数据 * @return 缓存键值对应的数据
*/ */
public <T> T getCacheObject(final String key) public <T> T getCacheObject(final String key)
{ {
ValueOperations<String, T> operation = redisTemplate.opsForValue(); ValueOperations<String, T> operation = redisTemplate.opsForValue();
return operation.get(key); return operation.get(key);
} }
/** /**
* 删除单个对象 * 删除单个对象
* *
* @param key * @param key
*/ */
public boolean deleteObject(final String key) public boolean deleteObject(final String key)
{ {
return redisTemplate.delete(key); return redisTemplate.delete(key);
} }
/** /**
* 删除集合对象 * 删除集合对象
* *
* @param collection 多个对象 * @param collection 多个对象
* @return * @return
*/ */
public long deleteObject(final Collection collection) public long deleteObject(final Collection collection)
{ {
return redisTemplate.delete(collection); return redisTemplate.delete(collection);
} }
/** /**
* 缓存List数据 * 缓存List数据
* *
* @param key 缓存的键值 * @param key 缓存的键值
* @param dataList 待缓存的List数据 * @param dataList 待缓存的List数据
* @return 缓存的对象 * @return 缓存的对象
*/ */
public <T> long setCacheList(final String key, final List<T> dataList) public <T> long setCacheList(final String key, final List<T> dataList)
{ {
Long count = redisTemplate.opsForList().rightPushAll(key, dataList); Long count = redisTemplate.opsForList().rightPushAll(key, dataList);
return count == null ? 0 : count; return count == null ? 0 : count;
} }
/** /**
* 获得缓存的list对象 * 获得缓存的list对象
* *
* @param key 缓存的键值 * @param key 缓存的键值
* @return 缓存键值对应的数据 * @return 缓存键值对应的数据
*/ */
public <T> List<T> getCacheList(final String key) public <T> List<T> getCacheList(final String key)
{ {
return redisTemplate.opsForList().range(key, 0, -1); return redisTemplate.opsForList().range(key, 0, -1);
} }
/** /**
* 缓存Set * 缓存Set
* *
* @param key 缓存键值 * @param key 缓存键值
* @param dataSet 缓存的数据 * @param dataSet 缓存的数据
* @return 缓存数据的对象 * @return 缓存数据的对象
*/ */
public <T> long setCacheSet(final String key, final Set<T> dataSet) public <T> long setCacheSet(final String key, final Set<T> dataSet)
{ {
Long count = redisTemplate.opsForSet().add(key, dataSet); Long count = redisTemplate.opsForSet().add(key, dataSet);
return count == null ? 0 : count; return count == null ? 0 : count;
} }
/** /**
* 获得缓存的set * 获得缓存的set
* *
* @param key * @param key
* @return * @return
*/ */
public <T> Set<T> getCacheSet(final String key) public <T> Set<T> getCacheSet(final String key)
{ {
return redisTemplate.opsForSet().members(key); return redisTemplate.opsForSet().members(key);
} }
/** /**
* 缓存Map * 缓存Map
* *
* @param key * @param key
* @param dataMap * @param dataMap
*/ */
public <T> void setCacheMap(final String key, final Map<String, T> dataMap) public <T> void setCacheMap(final String key, final Map<String, T> dataMap)
{ {
if (dataMap != null) { if (dataMap != null) {
redisTemplate.opsForHash().putAll(key, dataMap); redisTemplate.opsForHash().putAll(key, dataMap);
} }
} }
/** /**
* 获得缓存的Map * 获得缓存的Map
* *
* @param key * @param key
* @return * @return
*/ */
public <T> Map<String, T> getCacheMap(final String key) public <T> Map<String, T> getCacheMap(final String key)
{ {
return redisTemplate.opsForHash().entries(key); return redisTemplate.opsForHash().entries(key);
} }
/** /**
* 往Hash中存入数据 * 往Hash中存入数据
* *
* @param key Redis键 * @param key Redis键
* @param hKey Hash键 * @param hKey Hash键
* @param value * @param value
*/ */
public <T> void setCacheMapValue(final String key, final String hKey, final T value) public <T> void setCacheMapValue(final String key, final String hKey, final T value)
{ {
redisTemplate.opsForHash().put(key, hKey, value); redisTemplate.opsForHash().put(key, hKey, value);
} }
/** /**
* 获取Hash中的数据 * 获取Hash中的数据
* *
* @param key Redis键 * @param key Redis键
* @param hKey Hash键 * @param hKey Hash键
* @return Hash中的对象 * @return Hash中的对象
*/ */
public <T> T getCacheMapValue(final String key, final String hKey) public <T> T getCacheMapValue(final String key, final String hKey)
{ {
HashOperations<String, String, T> opsForHash = redisTemplate.opsForHash(); HashOperations<String, String, T> opsForHash = redisTemplate.opsForHash();
return opsForHash.get(key, hKey); return opsForHash.get(key, hKey);
} }
/** /**
* 获取多个Hash中的数据 * 获取多个Hash中的数据
* *
* @param key Redis键 * @param key Redis键
* @param hKeys Hash键集合 * @param hKeys Hash键集合
* @return Hash对象集合 * @return Hash对象集合
*/ */
public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys) public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys)
{ {
return redisTemplate.opsForHash().multiGet(key, hKeys); return redisTemplate.opsForHash().multiGet(key, hKeys);
} }
/** /**
* 获得缓存的基本对象列表 * 获得缓存的基本对象列表
* *
* @param pattern 字符串前缀 * @param pattern 字符串前缀
* @return 对象列表 * @return 对象列表
*/ */
public Collection<String> keys(final String pattern) public Collection<String> keys(final String pattern)
{ {
return redisTemplate.keys(pattern); return redisTemplate.keys(pattern);
} }
} }

View File

@ -1,86 +1,86 @@
package com.ruoyi.common.core.text; package com.stdiet.common.core.text;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import com.ruoyi.common.utils.StringUtils; import com.stdiet.common.utils.StringUtils;
/** /**
* 字符集工具类 * 字符集工具类
* *
* @author ruoyi * @author stdiet
*/ */
public class CharsetKit public class CharsetKit
{ {
/** ISO-8859-1 */ /** ISO-8859-1 */
public static final String ISO_8859_1 = "ISO-8859-1"; public static final String ISO_8859_1 = "ISO-8859-1";
/** UTF-8 */ /** UTF-8 */
public static final String UTF_8 = "UTF-8"; public static final String UTF_8 = "UTF-8";
/** GBK */ /** GBK */
public static final String GBK = "GBK"; public static final String GBK = "GBK";
/** ISO-8859-1 */ /** ISO-8859-1 */
public static final Charset CHARSET_ISO_8859_1 = Charset.forName(ISO_8859_1); public static final Charset CHARSET_ISO_8859_1 = Charset.forName(ISO_8859_1);
/** UTF-8 */ /** UTF-8 */
public static final Charset CHARSET_UTF_8 = Charset.forName(UTF_8); public static final Charset CHARSET_UTF_8 = Charset.forName(UTF_8);
/** GBK */ /** GBK */
public static final Charset CHARSET_GBK = Charset.forName(GBK); public static final Charset CHARSET_GBK = Charset.forName(GBK);
/** /**
* 转换为Charset对象 * 转换为Charset对象
* *
* @param charset 字符集为空则返回默认字符集 * @param charset 字符集为空则返回默认字符集
* @return Charset * @return Charset
*/ */
public static Charset charset(String charset) public static Charset charset(String charset)
{ {
return StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset); return StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset);
} }
/** /**
* 转换字符串的字符集编码 * 转换字符串的字符集编码
* *
* @param source 字符串 * @param source 字符串
* @param srcCharset 源字符集默认ISO-8859-1 * @param srcCharset 源字符集默认ISO-8859-1
* @param destCharset 目标字符集默认UTF-8 * @param destCharset 目标字符集默认UTF-8
* @return 转换后的字符集 * @return 转换后的字符集
*/ */
public static String convert(String source, String srcCharset, String destCharset) public static String convert(String source, String srcCharset, String destCharset)
{ {
return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset)); return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset));
} }
/** /**
* 转换字符串的字符集编码 * 转换字符串的字符集编码
* *
* @param source 字符串 * @param source 字符串
* @param srcCharset 源字符集默认ISO-8859-1 * @param srcCharset 源字符集默认ISO-8859-1
* @param destCharset 目标字符集默认UTF-8 * @param destCharset 目标字符集默认UTF-8
* @return 转换后的字符集 * @return 转换后的字符集
*/ */
public static String convert(String source, Charset srcCharset, Charset destCharset) public static String convert(String source, Charset srcCharset, Charset destCharset)
{ {
if (null == srcCharset) if (null == srcCharset)
{ {
srcCharset = StandardCharsets.ISO_8859_1; srcCharset = StandardCharsets.ISO_8859_1;
} }
if (null == destCharset) if (null == destCharset)
{ {
srcCharset = StandardCharsets.UTF_8; srcCharset = StandardCharsets.UTF_8;
} }
if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset)) if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset))
{ {
return source; return source;
} }
return new String(source.getBytes(srcCharset), destCharset); return new String(source.getBytes(srcCharset), destCharset);
} }
/** /**
* @return 系统字符集编码 * @return 系统字符集编码
*/ */
public static String systemCharset() public static String systemCharset()
{ {
return Charset.defaultCharset().name(); return Charset.defaultCharset().name();
} }
} }

View File

@ -1,92 +1,92 @@
package com.ruoyi.common.core.text; package com.stdiet.common.core.text;
import com.ruoyi.common.utils.StringUtils; import com.stdiet.common.utils.StringUtils;
/** /**
* 字符串格式化 * 字符串格式化
* *
* @author ruoyi * @author stdiet
*/ */
public class StrFormatter public class StrFormatter
{ {
public static final String EMPTY_JSON = "{}"; public static final String EMPTY_JSON = "{}";
public static final char C_BACKSLASH = '\\'; public static final char C_BACKSLASH = '\\';
public static final char C_DELIM_START = '{'; public static final char C_DELIM_START = '{';
public static final char C_DELIM_END = '}'; public static final char C_DELIM_END = '}';
/** /**
* 格式化字符串<br> * 格式化字符串<br>
* 此方法只是简单将占位符 {} 按照顺序替换为参数<br> * 此方法只是简单将占位符 {} 按照顺序替换为参数<br>
* 如果想输出 {} 使用 \\转义 { 即可如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可<br> * 如果想输出 {} 使用 \\转义 { 即可如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可<br>
* <br> * <br>
* 通常使用format("this is {} for {}", "a", "b") -> this is a for b<br> * 通常使用format("this is {} for {}", "a", "b") -> this is a for b<br>
* 转义{} format("this is \\{} for {}", "a", "b") -> this is \{} for a<br> * 转义{} format("this is \\{} for {}", "a", "b") -> this is \{} for a<br>
* 转义\ format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br> * 转义\ format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br>
* *
* @param strPattern 字符串模板 * @param strPattern 字符串模板
* @param argArray 参数列表 * @param argArray 参数列表
* @return 结果 * @return 结果
*/ */
public static String format(final String strPattern, final Object... argArray) public static String format(final String strPattern, final Object... argArray)
{ {
if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray)) if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray))
{ {
return strPattern; return strPattern;
} }
final int strPatternLength = strPattern.length(); final int strPatternLength = strPattern.length();
// 初始化定义好的长度以获得更好的性能 // 初始化定义好的长度以获得更好的性能
StringBuilder sbuf = new StringBuilder(strPatternLength + 50); StringBuilder sbuf = new StringBuilder(strPatternLength + 50);
int handledPosition = 0; int handledPosition = 0;
int delimIndex;// 占位符所在位置 int delimIndex;// 占位符所在位置
for (int argIndex = 0; argIndex < argArray.length; argIndex++) for (int argIndex = 0; argIndex < argArray.length; argIndex++)
{ {
delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition); delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition);
if (delimIndex == -1) if (delimIndex == -1)
{ {
if (handledPosition == 0) if (handledPosition == 0)
{ {
return strPattern; return strPattern;
} }
else else
{ // 字符串模板剩余部分不再包含占位符加入剩余部分后返回结果 { // 字符串模板剩余部分不再包含占位符加入剩余部分后返回结果
sbuf.append(strPattern, handledPosition, strPatternLength); sbuf.append(strPattern, handledPosition, strPatternLength);
return sbuf.toString(); return sbuf.toString();
} }
} }
else else
{ {
if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH) if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH)
{ {
if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH) if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH)
{ {
// 转义符之前还有一个转义符占位符依旧有效 // 转义符之前还有一个转义符占位符依旧有效
sbuf.append(strPattern, handledPosition, delimIndex - 1); sbuf.append(strPattern, handledPosition, delimIndex - 1);
sbuf.append(Convert.utf8Str(argArray[argIndex])); sbuf.append(Convert.utf8Str(argArray[argIndex]));
handledPosition = delimIndex + 2; handledPosition = delimIndex + 2;
} }
else else
{ {
// 占位符被转义 // 占位符被转义
argIndex--; argIndex--;
sbuf.append(strPattern, handledPosition, delimIndex - 1); sbuf.append(strPattern, handledPosition, delimIndex - 1);
sbuf.append(C_DELIM_START); sbuf.append(C_DELIM_START);
handledPosition = delimIndex + 1; handledPosition = delimIndex + 1;
} }
} }
else else
{ {
// 正常占位符 // 正常占位符
sbuf.append(strPattern, handledPosition, delimIndex); sbuf.append(strPattern, handledPosition, delimIndex);
sbuf.append(Convert.utf8Str(argArray[argIndex])); sbuf.append(Convert.utf8Str(argArray[argIndex]));
handledPosition = delimIndex + 2; handledPosition = delimIndex + 2;
} }
} }
} }
// 加入最后一个占位符后所有的字符 // 加入最后一个占位符后所有的字符
sbuf.append(strPattern, handledPosition, strPattern.length()); sbuf.append(strPattern, handledPosition, strPattern.length());
return sbuf.toString(); return sbuf.toString();
} }
} }

View File

@ -1,20 +1,20 @@
package com.ruoyi.common.enums; package com.stdiet.common.enums;
/** /**
* 操作状态 * 操作状态
* *
* @author ruoyi * @author ruoyi
* *
*/ */
public enum BusinessStatus public enum BusinessStatus
{ {
/** /**
* 成功 * 成功
*/ */
SUCCESS, SUCCESS,
/** /**
* 失败 * 失败
*/ */
FAIL, FAIL,
} }

View File

@ -1,59 +1,59 @@
package com.ruoyi.common.enums; package com.stdiet.common.enums;
/** /**
* 业务操作类型 * 业务操作类型
* *
* @author ruoyi * @author ruoyi
*/ */
public enum BusinessType public enum BusinessType
{ {
/** /**
* 其它 * 其它
*/ */
OTHER, OTHER,
/** /**
* 新增 * 新增
*/ */
INSERT, INSERT,
/** /**
* 修改 * 修改
*/ */
UPDATE, UPDATE,
/** /**
* 删除 * 删除
*/ */
DELETE, DELETE,
/** /**
* 授权 * 授权
*/ */
GRANT, GRANT,
/** /**
* 导出 * 导出
*/ */
EXPORT, EXPORT,
/** /**
* 导入 * 导入
*/ */
IMPORT, IMPORT,
/** /**
* 强退 * 强退
*/ */
FORCE, FORCE,
/** /**
* 生成代码 * 生成代码
*/ */
GENCODE, GENCODE,
/** /**
* 清空数据 * 清空数据
*/ */
CLEAN, CLEAN,
} }

View File

@ -1,19 +1,19 @@
package com.ruoyi.common.enums; package com.stdiet.common.enums;
/** /**
* 数据源 * 数据源
* *
* @author ruoyi * @author ruoyi
*/ */
public enum DataSourceType public enum DataSourceType
{ {
/** /**
* 主库 * 主库
*/ */
MASTER, MASTER,
/** /**
* 从库 * 从库
*/ */
SLAVE SLAVE
} }

View File

@ -1,36 +1,36 @@
package com.ruoyi.common.enums; package com.stdiet.common.enums;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.springframework.lang.Nullable; import org.springframework.lang.Nullable;
/** /**
* 请求方式 * 请求方式
* *
* @author ruoyi * @author ruoyi
*/ */
public enum HttpMethod public enum HttpMethod
{ {
GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE; GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE;
private static final Map<String, HttpMethod> mappings = new HashMap<>(16); private static final Map<String, HttpMethod> mappings = new HashMap<>(16);
static static
{ {
for (HttpMethod httpMethod : values()) for (HttpMethod httpMethod : values())
{ {
mappings.put(httpMethod.name(), httpMethod); mappings.put(httpMethod.name(), httpMethod);
} }
} }
@Nullable @Nullable
public static HttpMethod resolve(@Nullable String method) public static HttpMethod resolve(@Nullable String method)
{ {
return (method != null ? mappings.get(method) : null); return (method != null ? mappings.get(method) : null);
} }
public boolean matches(String method) public boolean matches(String method)
{ {
return (this == resolve(method)); return (this == resolve(method));
} }
} }

View File

@ -1,24 +1,24 @@
package com.ruoyi.common.enums; package com.stdiet.common.enums;
/** /**
* 操作人类别 * 操作人类别
* *
* @author ruoyi * @author ruoyi
*/ */
public enum OperatorType public enum OperatorType
{ {
/** /**
* 其它 * 其它
*/ */
OTHER, OTHER,
/** /**
* 后台用户 * 后台用户
*/ */
MANAGE, MANAGE,
/** /**
* 手机端用户 * 手机端用户
*/ */
MOBILE MOBILE
} }

View File

@ -1,30 +1,30 @@
package com.ruoyi.common.enums; package com.stdiet.common.enums;
/** /**
* 用户状态 * 用户状态
* *
* @author ruoyi * @author ruoyi
*/ */
public enum UserStatus public enum UserStatus
{ {
OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除"); OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除");
private final String code; private final String code;
private final String info; private final String info;
UserStatus(String code, String info) UserStatus(String code, String info)
{ {
this.code = code; this.code = code;
this.info = info; this.info = info;
} }
public String getCode() public String getCode()
{ {
return code; return code;
} }
public String getInfo() public String getInfo()
{ {
return info; return info;
} }
} }

View File

@ -1,97 +1,97 @@
package com.ruoyi.common.exception; package com.stdiet.common.exception;
import com.ruoyi.common.utils.MessageUtils; import com.stdiet.common.utils.MessageUtils;
import com.ruoyi.common.utils.StringUtils; import com.stdiet.common.utils.StringUtils;
/** /**
* 基础异常 * 基础异常
* *
* @author ruoyi * @author stdiet
*/ */
public class BaseException extends RuntimeException public class BaseException extends RuntimeException
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 所属模块 * 所属模块
*/ */
private String module; private String module;
/** /**
* 错误码 * 错误码
*/ */
private String code; private String code;
/** /**
* 错误码对应的参数 * 错误码对应的参数
*/ */
private Object[] args; private Object[] args;
/** /**
* 错误消息 * 错误消息
*/ */
private String defaultMessage; private String defaultMessage;
public BaseException(String module, String code, Object[] args, String defaultMessage) public BaseException(String module, String code, Object[] args, String defaultMessage)
{ {
this.module = module; this.module = module;
this.code = code; this.code = code;
this.args = args; this.args = args;
this.defaultMessage = defaultMessage; this.defaultMessage = defaultMessage;
} }
public BaseException(String module, String code, Object[] args) public BaseException(String module, String code, Object[] args)
{ {
this(module, code, args, null); this(module, code, args, null);
} }
public BaseException(String module, String defaultMessage) public BaseException(String module, String defaultMessage)
{ {
this(module, null, null, defaultMessage); this(module, null, null, defaultMessage);
} }
public BaseException(String code, Object[] args) public BaseException(String code, Object[] args)
{ {
this(null, code, args, null); this(null, code, args, null);
} }
public BaseException(String defaultMessage) public BaseException(String defaultMessage)
{ {
this(null, null, null, defaultMessage); this(null, null, null, defaultMessage);
} }
@Override @Override
public String getMessage() public String getMessage()
{ {
String message = null; String message = null;
if (!StringUtils.isEmpty(code)) if (!StringUtils.isEmpty(code))
{ {
message = MessageUtils.message(code, args); message = MessageUtils.message(code, args);
} }
if (message == null) if (message == null)
{ {
message = defaultMessage; message = defaultMessage;
} }
return message; return message;
} }
public String getModule() public String getModule()
{ {
return module; return module;
} }
public String getCode() public String getCode()
{ {
return code; return code;
} }
public Object[] getArgs() public Object[] getArgs()
{ {
return args; return args;
} }
public String getDefaultMessage() public String getDefaultMessage()
{ {
return defaultMessage; return defaultMessage;
} }
} }

View File

@ -1,43 +1,43 @@
package com.ruoyi.common.exception; package com.stdiet.common.exception;
/** /**
* 自定义异常 * 自定义异常
* *
* @author ruoyi * @author stdiet
*/ */
public class CustomException extends RuntimeException public class CustomException extends RuntimeException
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Integer code; private Integer code;
private String message; private String message;
public CustomException(String message) public CustomException(String message)
{ {
this.message = message; this.message = message;
} }
public CustomException(String message, Integer code) public CustomException(String message, Integer code)
{ {
this.message = message; this.message = message;
this.code = code; this.code = code;
} }
public CustomException(String message, Throwable e) public CustomException(String message, Throwable e)
{ {
super(message, e); super(message, e);
this.message = message; this.message = message;
} }
@Override @Override
public String getMessage() public String getMessage()
{ {
return message; return message;
} }
public Integer getCode() public Integer getCode()
{ {
return code; return code;
} }
} }

View File

@ -1,15 +1,15 @@
package com.ruoyi.common.exception; package com.stdiet.common.exception;
/** /**
* 演示模式异常 * 演示模式异常
* *
* @author ruoyi * @author stdiet
*/ */
public class DemoModeException extends RuntimeException public class DemoModeException extends RuntimeException
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public DemoModeException() public DemoModeException()
{ {
} }
} }

View File

@ -1,26 +1,26 @@
package com.ruoyi.common.exception; package com.stdiet.common.exception;
/** /**
* 工具类异常 * 工具类异常
* *
* @author ruoyi * @author stdiet
*/ */
public class UtilException extends RuntimeException public class UtilException extends RuntimeException
{ {
private static final long serialVersionUID = 8247610319171014183L; private static final long serialVersionUID = 8247610319171014183L;
public UtilException(Throwable e) public UtilException(Throwable e)
{ {
super(e.getMessage(), e); super(e.getMessage(), e);
} }
public UtilException(String message) public UtilException(String message)
{ {
super(message); super(message);
} }
public UtilException(String message, Throwable throwable) public UtilException(String message, Throwable throwable)
{ {
super(message, throwable); super(message, throwable);
} }
} }

View File

@ -1,19 +1,19 @@
package com.ruoyi.common.exception.file; package com.stdiet.common.exception.file;
import com.ruoyi.common.exception.BaseException; import com.stdiet.common.exception.BaseException;
/** /**
* 文件信息异常类 * 文件信息异常类
* *
* @author ruoyi * @author stdiet
*/ */
public class FileException extends BaseException public class FileException extends BaseException
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public FileException(String code, Object[] args) public FileException(String code, Object[] args)
{ {
super("file", code, args, null); super("file", code, args, null);
} }
} }

View File

@ -1,16 +1,16 @@
package com.ruoyi.common.exception.file; package com.stdiet.common.exception.file;
/** /**
* 文件名称超长限制异常类 * 文件名称超长限制异常类
* *
* @author ruoyi * @author stdiet
*/ */
public class FileNameLengthLimitExceededException extends FileException public class FileNameLengthLimitExceededException extends FileException
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public FileNameLengthLimitExceededException(int defaultFileNameLength) public FileNameLengthLimitExceededException(int defaultFileNameLength)
{ {
super("upload.filename.exceed.length", new Object[] { defaultFileNameLength }); super("upload.filename.exceed.length", new Object[] { defaultFileNameLength });
} }
} }

View File

@ -1,16 +1,16 @@
package com.ruoyi.common.exception.file; package com.stdiet.common.exception.file;
/** /**
* 文件名大小限制异常类 * 文件名大小限制异常类
* *
* @author ruoyi * @author stdiet
*/ */
public class FileSizeLimitExceededException extends FileException public class FileSizeLimitExceededException extends FileException
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public FileSizeLimitExceededException(long defaultMaxSize) public FileSizeLimitExceededException(long defaultMaxSize)
{ {
super("upload.exceed.maxSize", new Object[] { defaultMaxSize }); super("upload.exceed.maxSize", new Object[] { defaultMaxSize });
} }
} }

View File

@ -1,71 +1,71 @@
package com.ruoyi.common.exception.file; package com.stdiet.common.exception.file;
import java.util.Arrays; import java.util.Arrays;
import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.FileUploadException;
/** /**
* 文件上传 误异常类 * 文件上传 误异常类
* *
* @author ruoyi * @author stdiet
*/ */
public class InvalidExtensionException extends FileUploadException public class InvalidExtensionException extends FileUploadException
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String[] allowedExtension; private String[] allowedExtension;
private String extension; private String extension;
private String filename; private String filename;
public InvalidExtensionException(String[] allowedExtension, String extension, String filename) public InvalidExtensionException(String[] allowedExtension, String extension, String filename)
{ {
super("filename : [" + filename + "], extension : [" + extension + "], allowed extension : [" + Arrays.toString(allowedExtension) + "]"); super("filename : [" + filename + "], extension : [" + extension + "], allowed extension : [" + Arrays.toString(allowedExtension) + "]");
this.allowedExtension = allowedExtension; this.allowedExtension = allowedExtension;
this.extension = extension; this.extension = extension;
this.filename = filename; this.filename = filename;
} }
public String[] getAllowedExtension() public String[] getAllowedExtension()
{ {
return allowedExtension; return allowedExtension;
} }
public String getExtension() public String getExtension()
{ {
return extension; return extension;
} }
public String getFilename() public String getFilename()
{ {
return filename; return filename;
} }
public static class InvalidImageExtensionException extends InvalidExtensionException public static class InvalidImageExtensionException extends InvalidExtensionException
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public InvalidImageExtensionException(String[] allowedExtension, String extension, String filename) public InvalidImageExtensionException(String[] allowedExtension, String extension, String filename)
{ {
super(allowedExtension, extension, filename); super(allowedExtension, extension, filename);
} }
} }
public static class InvalidFlashExtensionException extends InvalidExtensionException public static class InvalidFlashExtensionException extends InvalidExtensionException
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public InvalidFlashExtensionException(String[] allowedExtension, String extension, String filename) public InvalidFlashExtensionException(String[] allowedExtension, String extension, String filename)
{ {
super(allowedExtension, extension, filename); super(allowedExtension, extension, filename);
} }
} }
public static class InvalidMediaExtensionException extends InvalidExtensionException public static class InvalidMediaExtensionException extends InvalidExtensionException
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public InvalidMediaExtensionException(String[] allowedExtension, String extension, String filename) public InvalidMediaExtensionException(String[] allowedExtension, String extension, String filename)
{ {
super(allowedExtension, extension, filename); super(allowedExtension, extension, filename);
} }
} }
} }

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