Pre Merge pull request !147 from Quieter/master
This commit is contained in:
commit
36802706d2
36
pom.xml
36
pom.xml
|
|
@ -18,7 +18,6 @@
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
<shiro.version>1.6.0</shiro.version>
|
<shiro.version>1.6.0</shiro.version>
|
||||||
<thymeleaf.extras.shiro.version>2.0.0</thymeleaf.extras.shiro.version>
|
<thymeleaf.extras.shiro.version>2.0.0</thymeleaf.extras.shiro.version>
|
||||||
<mybatis.boot.version>1.3.2</mybatis.boot.version>
|
|
||||||
<druid.version>1.1.22</druid.version>
|
<druid.version>1.1.22</druid.version>
|
||||||
<bitwalker.version>1.19</bitwalker.version>
|
<bitwalker.version>1.19</bitwalker.version>
|
||||||
<kaptcha.version>2.3.2</kaptcha.version>
|
<kaptcha.version>2.3.2</kaptcha.version>
|
||||||
|
|
@ -30,6 +29,7 @@
|
||||||
<commons.fileupload.version>1.3.3</commons.fileupload.version>
|
<commons.fileupload.version>1.3.3</commons.fileupload.version>
|
||||||
<poi.version>3.17</poi.version>
|
<poi.version>3.17</poi.version>
|
||||||
<velocity.version>1.7</velocity.version>
|
<velocity.version>1.7</velocity.version>
|
||||||
|
<querydsl.version>4.2.1</querydsl.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<!-- 依赖声明 -->
|
<!-- 依赖声明 -->
|
||||||
|
|
@ -202,6 +202,12 @@
|
||||||
<version>${ruoyi.version}</version>
|
<version>${ruoyi.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.querydsl</groupId>
|
||||||
|
<artifactId>querydsl-jpa</artifactId>
|
||||||
|
<version>${querydsl.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
|
@ -215,13 +221,31 @@
|
||||||
</modules>
|
</modules>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>com.mysema.maven</groupId>
|
||||||
|
<artifactId>apt-maven-plugin</artifactId>
|
||||||
|
<version>1.1.3</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>process</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>target/generated-sources/java</outputDirectory>
|
||||||
|
<processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.querydsl</groupId>
|
||||||
|
<artifactId>querydsl-apt</artifactId>
|
||||||
|
<version>${querydsl.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,17 @@
|
||||||
<artifactId>ruoyi-generator</artifactId>
|
<artifactId>ruoyi-generator</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.flywaydb</groupId>
|
||||||
|
<artifactId>flyway-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype-hibernate5 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
<artifactId>jackson-datatype-hibernate5</artifactId>
|
||||||
|
<version>2.10.1</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,46 @@
|
||||||
package com.ruoyi;
|
package com.ruoyi;
|
||||||
|
|
||||||
|
import org.springframework.boot.CommandLineRunner;
|
||||||
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;
|
||||||
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||||
|
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启动程序
|
* 启动程序
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
|
||||||
public class RuoYiApplication
|
public class RuoYiApplication extends SpringBootServletInitializer {
|
||||||
{
|
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(RuoYiApplication.class, args);
|
||||||
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +
|
}
|
||||||
" .-------. ____ __ \n" +
|
|
||||||
" | _ _ \\ \\ \\ / / \n" +
|
@Override
|
||||||
" | ( ' ) | \\ _. / ' \n" +
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
|
||||||
" |(_ o _) / _( )_ .' \n" +
|
return builder.sources(RuoYiApplication.class);
|
||||||
" | (_,_).' __ ___(_ o _)' \n" +
|
}
|
||||||
" | |\\ \\ | || |(_,_)' \n" +
|
|
||||||
" | | \\ `' /| `-' / \n" +
|
@Bean
|
||||||
" | | \\ / \\ / \n" +
|
public CommandLineRunner startupCommandLineRunner() {
|
||||||
" ''-' `'-' `-..-' ");
|
return new CommandLineRunner() {
|
||||||
|
@Override
|
||||||
|
public void run(String... args) throws Exception {
|
||||||
|
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +
|
||||||
|
" .-------. ____ __ \n" +
|
||||||
|
" | _ _ \\ \\ \\ / / \n" +
|
||||||
|
" | ( ' ) | \\ _. / ' \n" +
|
||||||
|
" |(_ o _) / _( )_ .' \n" +
|
||||||
|
" | (_,_).' __ ___(_ o _)' \n" +
|
||||||
|
" | |\\ \\ | || |(_,_)' \n" +
|
||||||
|
" | | \\ `' /| `-' / \n" +
|
||||||
|
" | | \\ / \\ / \n" +
|
||||||
|
" ''-' `'-' `-..-' ");
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
package com.ruoyi;
|
|
||||||
|
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
|
||||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* web容器中进行部署
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
*/
|
|
||||||
public class RuoYiServletInitializer extends SpringBootServletInitializer
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
|
|
||||||
{
|
|
||||||
return application.sources(RuoYiApplication.class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.ruoyi.web.controller.common;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
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;
|
||||||
|
|
@ -25,8 +26,7 @@ import com.ruoyi.common.utils.file.FileUtils;
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
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
|
||||||
|
|
@ -36,15 +36,12 @@ public class CommonController
|
||||||
* 通用下载请求
|
* 通用下载请求
|
||||||
*
|
*
|
||||||
* @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);
|
||||||
|
|
@ -54,13 +51,10 @@ public class CommonController
|
||||||
FileUtils.setAttachmentResponseHeader(response, realFileName);
|
FileUtils.setAttachmentResponseHeader(response, 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -70,10 +64,8 @@ public class CommonController
|
||||||
*/
|
*/
|
||||||
@PostMapping("/common/upload")
|
@PostMapping("/common/upload")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult uploadFile(MultipartFile file) throws Exception
|
public AjaxResult uploadFile(MultipartFile file) throws Exception {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
// 上传文件路径
|
// 上传文件路径
|
||||||
String filePath = Global.getUploadPath();
|
String filePath = Global.getUploadPath();
|
||||||
// 上传并返回新文件名称
|
// 上传并返回新文件名称
|
||||||
|
|
@ -83,9 +75,7 @@ public class CommonController
|
||||||
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -95,8 +85,7 @@ public class CommonController
|
||||||
*/
|
*/
|
||||||
@GetMapping("/common/download/resource")
|
@GetMapping("/common/download/resource")
|
||||||
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
|
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
|
||||||
throws Exception
|
throws Exception {
|
||||||
{
|
|
||||||
// 本地资源路径
|
// 本地资源路径
|
||||||
String localPath = Global.getProfile();
|
String localPath = Global.getProfile();
|
||||||
// 数据库资源地址
|
// 数据库资源地址
|
||||||
|
|
|
||||||
|
|
@ -11,16 +11,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/demo/modal")
|
@RequestMapping("/demo/modal")
|
||||||
public class DemoDialogController
|
public class DemoDialogController {
|
||||||
{
|
|
||||||
private String prefix = "demo/modal";
|
private String prefix = "demo/modal";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模态窗口
|
* 模态窗口
|
||||||
*/
|
*/
|
||||||
@GetMapping("/dialog")
|
@GetMapping("/dialog")
|
||||||
public String dialog()
|
public String dialog() {
|
||||||
{
|
|
||||||
return prefix + "/dialog";
|
return prefix + "/dialog";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -28,8 +26,7 @@ public class DemoDialogController
|
||||||
* 弹层组件
|
* 弹层组件
|
||||||
*/
|
*/
|
||||||
@GetMapping("/layer")
|
@GetMapping("/layer")
|
||||||
public String layer()
|
public String layer() {
|
||||||
{
|
|
||||||
return prefix + "/layer";
|
return prefix + "/layer";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -37,8 +34,7 @@ public class DemoDialogController
|
||||||
* 表单
|
* 表单
|
||||||
*/
|
*/
|
||||||
@GetMapping("/form")
|
@GetMapping("/form")
|
||||||
public String form()
|
public String form() {
|
||||||
{
|
|
||||||
return prefix + "/form";
|
return prefix + "/form";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -46,8 +42,7 @@ public class DemoDialogController
|
||||||
* 表格
|
* 表格
|
||||||
*/
|
*/
|
||||||
@GetMapping("/table")
|
@GetMapping("/table")
|
||||||
public String table()
|
public String table() {
|
||||||
{
|
|
||||||
return prefix + "/table";
|
return prefix + "/table";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -55,8 +50,7 @@ public class DemoDialogController
|
||||||
* 表格check
|
* 表格check
|
||||||
*/
|
*/
|
||||||
@GetMapping("/check")
|
@GetMapping("/check")
|
||||||
public String check()
|
public String check() {
|
||||||
{
|
|
||||||
return prefix + "/table/check";
|
return prefix + "/table/check";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -64,8 +58,7 @@ public class DemoDialogController
|
||||||
* 表格radio
|
* 表格radio
|
||||||
*/
|
*/
|
||||||
@GetMapping("/radio")
|
@GetMapping("/radio")
|
||||||
public String radio()
|
public String radio() {
|
||||||
{
|
|
||||||
return prefix + "/table/radio";
|
return prefix + "/table/radio";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -73,8 +66,7 @@ public class DemoDialogController
|
||||||
* 表格回传父窗体
|
* 表格回传父窗体
|
||||||
*/
|
*/
|
||||||
@GetMapping("/parent")
|
@GetMapping("/parent")
|
||||||
public String parent()
|
public String parent() {
|
||||||
{
|
|
||||||
return prefix + "/table/parent";
|
return prefix + "/table/parent";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,16 +11,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/demo/icon")
|
@RequestMapping("/demo/icon")
|
||||||
public class DemoIconController
|
public class DemoIconController {
|
||||||
{
|
|
||||||
private String prefix = "demo/icon";
|
private String prefix = "demo/icon";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FontAwesome图标
|
* FontAwesome图标
|
||||||
*/
|
*/
|
||||||
@GetMapping("/fontawesome")
|
@GetMapping("/fontawesome")
|
||||||
public String fontAwesome()
|
public String fontAwesome() {
|
||||||
{
|
|
||||||
return prefix + "/fontawesome";
|
return prefix + "/fontawesome";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -28,8 +26,7 @@ public class DemoIconController
|
||||||
* Glyphicons图标
|
* Glyphicons图标
|
||||||
*/
|
*/
|
||||||
@GetMapping("/glyphicons")
|
@GetMapping("/glyphicons")
|
||||||
public String glyphicons()
|
public String glyphicons() {
|
||||||
{
|
|
||||||
return prefix + "/glyphicons";
|
return prefix + "/glyphicons";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,16 +11,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/demo/report")
|
@RequestMapping("/demo/report")
|
||||||
public class DemoReportController
|
public class DemoReportController {
|
||||||
{
|
|
||||||
private String prefix = "demo/report";
|
private String prefix = "demo/report";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 百度ECharts
|
* 百度ECharts
|
||||||
*/
|
*/
|
||||||
@GetMapping("/echarts")
|
@GetMapping("/echarts")
|
||||||
public String echarts()
|
public String echarts() {
|
||||||
{
|
|
||||||
return prefix + "/echarts";
|
return prefix + "/echarts";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -28,8 +26,7 @@ public class DemoReportController
|
||||||
* 图表插件
|
* 图表插件
|
||||||
*/
|
*/
|
||||||
@GetMapping("/peity")
|
@GetMapping("/peity")
|
||||||
public String peity()
|
public String peity() {
|
||||||
{
|
|
||||||
return prefix + "/peity";
|
return prefix + "/peity";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -37,8 +34,7 @@ public class DemoReportController
|
||||||
* 线状图插件
|
* 线状图插件
|
||||||
*/
|
*/
|
||||||
@GetMapping("/sparkline")
|
@GetMapping("/sparkline")
|
||||||
public String sparkline()
|
public String sparkline() {
|
||||||
{
|
|
||||||
return prefix + "/sparkline";
|
return prefix + "/sparkline";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -46,8 +42,7 @@ public class DemoReportController
|
||||||
* 图表组合
|
* 图表组合
|
||||||
*/
|
*/
|
||||||
@GetMapping("/metrics")
|
@GetMapping("/metrics")
|
||||||
public String metrics()
|
public String metrics() {
|
||||||
{
|
|
||||||
return prefix + "/metrics";
|
return prefix + "/metrics";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,14 +13,12 @@ import com.ruoyi.common.core.controller.BaseController;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/monitor/data")
|
@RequestMapping("/monitor/data")
|
||||||
public class DruidController extends BaseController
|
public class DruidController extends BaseController {
|
||||||
{
|
|
||||||
private String prefix = "/druid";
|
private String prefix = "/druid";
|
||||||
|
|
||||||
@RequiresPermissions("monitor:data:view")
|
@RequiresPermissions("monitor:data:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String index()
|
public String index() {
|
||||||
{
|
|
||||||
return redirect(prefix + "/index");
|
return redirect(prefix + "/index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,14 +15,12 @@ import com.ruoyi.framework.web.domain.Server;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/monitor/server")
|
@RequestMapping("/monitor/server")
|
||||||
public class ServerController extends BaseController
|
public class ServerController extends BaseController {
|
||||||
{
|
|
||||||
private String prefix = "monitor/server";
|
private String prefix = "monitor/server";
|
||||||
|
|
||||||
@RequiresPermissions("monitor:server:view")
|
@RequiresPermissions("monitor:server:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String server(ModelMap mmap) throws Exception
|
public String server(ModelMap mmap) throws Exception {
|
||||||
{
|
|
||||||
Server server = new Server();
|
Server server = new Server();
|
||||||
server.copyTo();
|
server.copyTo();
|
||||||
mmap.put("server", server);
|
mmap.put("server", server);
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,24 @@
|
||||||
package com.ruoyi.web.controller.monitor;
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
||||||
import com.ruoyi.system.domain.SysLogininfor;
|
import com.ruoyi.system.domain.SysLogininfor;
|
||||||
import com.ruoyi.system.service.ISysLogininforService;
|
import com.ruoyi.system.service.ISysLogininforService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统访问记录
|
* 系统访问记录
|
||||||
|
|
@ -25,8 +27,7 @@ import com.ruoyi.system.service.ISysLogininforService;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/monitor/logininfor")
|
@RequestMapping("/monitor/logininfor")
|
||||||
public class SysLogininforController extends BaseController
|
public class SysLogininforController extends BaseController {
|
||||||
{
|
|
||||||
private String prefix = "monitor/logininfor";
|
private String prefix = "monitor/logininfor";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -37,28 +38,23 @@ public class SysLogininforController extends BaseController
|
||||||
|
|
||||||
@RequiresPermissions("monitor:logininfor:view")
|
@RequiresPermissions("monitor:logininfor:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String logininfor()
|
public String logininfor() {
|
||||||
{
|
|
||||||
return prefix + "/logininfor";
|
return prefix + "/logininfor";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("monitor:logininfor:list")
|
@RequiresPermissions("monitor:logininfor:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(SysLogininfor logininfor)
|
public TableDataInfo list(SysLogininfor logininfor) {
|
||||||
{
|
return getDataTable(logininforService.selectLogininforList(logininfor, getPageRequest()));
|
||||||
startPage();
|
|
||||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = "登陆日志", businessType = BusinessType.EXPORT)
|
@Log(title = "登陆日志", businessType = BusinessType.EXPORT)
|
||||||
@RequiresPermissions("monitor:logininfor:export")
|
@RequiresPermissions("monitor:logininfor:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(SysLogininfor logininfor)
|
public AjaxResult export(SysLogininfor logininfor) {
|
||||||
{
|
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor, Pageable.unpaged()).getContent();
|
||||||
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, "登陆日志");
|
||||||
}
|
}
|
||||||
|
|
@ -67,8 +63,7 @@ public class SysLogininforController extends BaseController
|
||||||
@Log(title = "登陆日志", businessType = BusinessType.DELETE)
|
@Log(title = "登陆日志", businessType = BusinessType.DELETE)
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(String ids)
|
public AjaxResult remove(String ids) {
|
||||||
{
|
|
||||||
return toAjax(logininforService.deleteLogininforByIds(ids));
|
return toAjax(logininforService.deleteLogininforByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -76,8 +71,7 @@ public class SysLogininforController extends BaseController
|
||||||
@Log(title = "登陆日志", businessType = BusinessType.CLEAN)
|
@Log(title = "登陆日志", businessType = BusinessType.CLEAN)
|
||||||
@PostMapping("/clean")
|
@PostMapping("/clean")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult clean()
|
public AjaxResult clean() {
|
||||||
{
|
|
||||||
logininforService.cleanLogininfor();
|
logininforService.cleanLogininfor();
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
@ -86,8 +80,7 @@ public class SysLogininforController extends BaseController
|
||||||
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
|
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
|
||||||
@PostMapping("/unlock")
|
@PostMapping("/unlock")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult unlock(String loginName)
|
public AjaxResult unlock(String loginName) {
|
||||||
{
|
|
||||||
passwordService.unlock(loginName);
|
passwordService.unlock(loginName);
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,5 @@
|
||||||
package com.ruoyi.web.controller.monitor;
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.ModelMap;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
|
@ -18,6 +8,14 @@ import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.system.domain.SysOperLog;
|
import com.ruoyi.system.domain.SysOperLog;
|
||||||
import com.ruoyi.system.service.ISysOperLogService;
|
import com.ruoyi.system.service.ISysOperLogService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作日志记录
|
* 操作日志记录
|
||||||
|
|
@ -26,8 +24,7 @@ import com.ruoyi.system.service.ISysOperLogService;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/monitor/operlog")
|
@RequestMapping("/monitor/operlog")
|
||||||
public class SysOperlogController extends BaseController
|
public class SysOperlogController extends BaseController {
|
||||||
{
|
|
||||||
private String prefix = "monitor/operlog";
|
private String prefix = "monitor/operlog";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -35,28 +32,23 @@ public class SysOperlogController extends BaseController
|
||||||
|
|
||||||
@RequiresPermissions("monitor:operlog:view")
|
@RequiresPermissions("monitor:operlog:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String operlog()
|
public String operlog() {
|
||||||
{
|
|
||||||
return prefix + "/operlog";
|
return prefix + "/operlog";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("monitor:operlog:list")
|
@RequiresPermissions("monitor:operlog:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(SysOperLog operLog)
|
public TableDataInfo list(SysOperLog operLog) {
|
||||||
{
|
return getDataTable(operLogService.selectOperLogList(operLog, getPageRequest()));
|
||||||
startPage();
|
|
||||||
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
||||||
@RequiresPermissions("monitor:operlog:export")
|
@RequiresPermissions("monitor:operlog:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(SysOperLog operLog)
|
public AjaxResult export(SysOperLog operLog) {
|
||||||
{
|
List<SysOperLog> list = operLogService.selectOperLogList(operLog, Pageable.unpaged()).getContent();
|
||||||
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, "操作日志");
|
||||||
}
|
}
|
||||||
|
|
@ -64,15 +56,13 @@ public class SysOperlogController extends BaseController
|
||||||
@RequiresPermissions("monitor:operlog:remove")
|
@RequiresPermissions("monitor:operlog:remove")
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(String ids)
|
public AjaxResult remove(String ids) {
|
||||||
{
|
|
||||||
return toAjax(operLogService.deleteOperLogByIds(ids));
|
return toAjax(operLogService.deleteOperLogByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("monitor:operlog:detail")
|
@RequiresPermissions("monitor:operlog:detail")
|
||||||
@GetMapping("/detail/{operId}")
|
@GetMapping("/detail/{operId}")
|
||||||
public String detail(@PathVariable("operId") Long operId, ModelMap mmap)
|
public String detail(@PathVariable("operId") Long operId, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("operLog", operLogService.selectOperLogById(operId));
|
mmap.put("operLog", operLogService.selectOperLogById(operId));
|
||||||
return prefix + "/detail";
|
return prefix + "/detail";
|
||||||
}
|
}
|
||||||
|
|
@ -81,8 +71,7 @@ public class SysOperlogController extends BaseController
|
||||||
@RequiresPermissions("monitor:operlog:remove")
|
@RequiresPermissions("monitor:operlog:remove")
|
||||||
@PostMapping("/clean")
|
@PostMapping("/clean")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult clean()
|
public AjaxResult clean() {
|
||||||
{
|
|
||||||
operLogService.cleanOperLog();
|
operLogService.cleanOperLog();
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,11 +49,8 @@ public class SysUserOnlineController extends BaseController
|
||||||
@RequiresPermissions("monitor:online:list")
|
@RequiresPermissions("monitor:online:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(SysUserOnline userOnline)
|
public TableDataInfo list(SysUserOnline userOnline) {
|
||||||
{
|
return getDataTable(userOnlineService.selectUserOnlineList(userOnline, getPageRequest()));
|
||||||
startPage();
|
|
||||||
List<SysUserOnline> list = userOnlineService.selectUserOnlineList(userOnline);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions(value = { "monitor:online:batchForceLogout", "monitor:online:forceLogout" }, logical = Logical.OR)
|
@RequiresPermissions(value = { "monitor:online:batchForceLogout", "monitor:online:forceLogout" }, logical = Logical.OR)
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import javax.servlet.ServletOutputStream;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
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;
|
||||||
|
|
@ -23,8 +24,7 @@ import com.ruoyi.common.core.controller.BaseController;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/captcha")
|
@RequestMapping("/captcha")
|
||||||
public class SysCaptchaController extends BaseController
|
public class SysCaptchaController extends BaseController {
|
||||||
{
|
|
||||||
@Resource(name = "captchaProducer")
|
@Resource(name = "captchaProducer")
|
||||||
private Producer captchaProducer;
|
private Producer captchaProducer;
|
||||||
|
|
||||||
|
|
@ -35,11 +35,9 @@ public class SysCaptchaController extends BaseController
|
||||||
* 验证码生成
|
* 验证码生成
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/captchaImage")
|
@GetMapping(value = "/captchaImage")
|
||||||
public ModelAndView getKaptchaImage(HttpServletRequest request, HttpServletResponse response)
|
public ModelAndView getKaptchaImage(HttpServletRequest request, HttpServletResponse response) {
|
||||||
{
|
|
||||||
ServletOutputStream out = null;
|
ServletOutputStream out = null;
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
HttpSession session = request.getSession();
|
HttpSession session = request.getSession();
|
||||||
response.setDateHeader("Expires", 0);
|
response.setDateHeader("Expires", 0);
|
||||||
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
|
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
|
||||||
|
|
@ -51,15 +49,12 @@ public class SysCaptchaController extends BaseController
|
||||||
String capStr = null;
|
String capStr = null;
|
||||||
String code = null;
|
String code = null;
|
||||||
BufferedImage bi = null;
|
BufferedImage bi = null;
|
||||||
if ("math".equals(type))
|
if ("math".equals(type)) {
|
||||||
{
|
|
||||||
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);
|
||||||
bi = captchaProducerMath.createImage(capStr);
|
bi = captchaProducerMath.createImage(capStr);
|
||||||
}
|
} else if ("char".equals(type)) {
|
||||||
else if ("char".equals(type))
|
|
||||||
{
|
|
||||||
capStr = code = captchaProducer.createText();
|
capStr = code = captchaProducer.createText();
|
||||||
bi = captchaProducer.createImage(capStr);
|
bi = captchaProducer.createImage(capStr);
|
||||||
}
|
}
|
||||||
|
|
@ -68,22 +63,14 @@ public class SysCaptchaController extends BaseController
|
||||||
ImageIO.write(bi, "jpg", out);
|
ImageIO.write(bi, "jpg", out);
|
||||||
out.flush();
|
out.flush();
|
||||||
|
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
} finally {
|
||||||
finally
|
try {
|
||||||
{
|
if (out != null) {
|
||||||
try
|
|
||||||
{
|
|
||||||
if (out != null)
|
|
||||||
{
|
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,5 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.ModelMap;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
|
@ -20,6 +9,15 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.framework.util.ShiroUtils;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.system.domain.SysDictData;
|
import com.ruoyi.system.domain.SysDictData;
|
||||||
import com.ruoyi.system.service.ISysDictDataService;
|
import com.ruoyi.system.service.ISysDictDataService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据字典信息
|
* 数据字典信息
|
||||||
|
|
@ -28,8 +26,7 @@ import com.ruoyi.system.service.ISysDictDataService;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/dict/data")
|
@RequestMapping("/system/dict/data")
|
||||||
public class SysDictDataController extends BaseController
|
public class SysDictDataController extends BaseController {
|
||||||
{
|
|
||||||
private String prefix = "system/dict/data";
|
private String prefix = "system/dict/data";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -37,28 +34,23 @@ public class SysDictDataController extends BaseController
|
||||||
|
|
||||||
@RequiresPermissions("system:dict:view")
|
@RequiresPermissions("system:dict:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String dictData()
|
public String dictData() {
|
||||||
{
|
|
||||||
return prefix + "/data";
|
return prefix + "/data";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@RequiresPermissions("system:dict:list")
|
@RequiresPermissions("system:dict:list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(SysDictData dictData)
|
public TableDataInfo list(SysDictData dictData) {
|
||||||
{
|
return getDataTable(dictDataService.selectDictDataList(dictData, getPageRequest()));
|
||||||
startPage();
|
|
||||||
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
|
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
|
||||||
@RequiresPermissions("system:dict:export")
|
@RequiresPermissions("system:dict:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(SysDictData dictData)
|
public AjaxResult export(SysDictData dictData) {
|
||||||
{
|
List<SysDictData> list = dictDataService.selectDictDataList(dictData, Pageable.unpaged()).getContent();
|
||||||
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, "字典数据");
|
||||||
}
|
}
|
||||||
|
|
@ -67,8 +59,7 @@ public class SysDictDataController extends BaseController
|
||||||
* 新增字典类型
|
* 新增字典类型
|
||||||
*/
|
*/
|
||||||
@GetMapping("/add/{dictType}")
|
@GetMapping("/add/{dictType}")
|
||||||
public String add(@PathVariable("dictType") String dictType, ModelMap mmap)
|
public String add(@PathVariable("dictType") String dictType, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("dictType", dictType);
|
mmap.put("dictType", dictType);
|
||||||
return prefix + "/add";
|
return prefix + "/add";
|
||||||
}
|
}
|
||||||
|
|
@ -80,8 +71,7 @@ public class SysDictDataController extends BaseController
|
||||||
@RequiresPermissions("system:dict:add")
|
@RequiresPermissions("system:dict:add")
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(@Validated SysDictData dict)
|
public AjaxResult addSave(@Validated SysDictData dict) {
|
||||||
{
|
|
||||||
dict.setCreateBy(ShiroUtils.getLoginName());
|
dict.setCreateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(dictDataService.insertDictData(dict));
|
return toAjax(dictDataService.insertDictData(dict));
|
||||||
}
|
}
|
||||||
|
|
@ -90,8 +80,7 @@ public class SysDictDataController extends BaseController
|
||||||
* 修改字典类型
|
* 修改字典类型
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit/{dictCode}")
|
@GetMapping("/edit/{dictCode}")
|
||||||
public String edit(@PathVariable("dictCode") Long dictCode, ModelMap mmap)
|
public String edit(@PathVariable("dictCode") Long dictCode, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("dict", dictDataService.selectDictDataById(dictCode));
|
mmap.put("dict", dictDataService.selectDictDataById(dictCode));
|
||||||
return prefix + "/edit";
|
return prefix + "/edit";
|
||||||
}
|
}
|
||||||
|
|
@ -103,8 +92,7 @@ public class SysDictDataController extends BaseController
|
||||||
@RequiresPermissions("system:dict:edit")
|
@RequiresPermissions("system:dict:edit")
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(@Validated SysDictData dict)
|
public AjaxResult editSave(@Validated SysDictData dict) {
|
||||||
{
|
|
||||||
dict.setUpdateBy(ShiroUtils.getLoginName());
|
dict.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(dictDataService.updateDictData(dict));
|
return toAjax(dictDataService.updateDictData(dict));
|
||||||
}
|
}
|
||||||
|
|
@ -113,8 +101,7 @@ public class SysDictDataController extends BaseController
|
||||||
@RequiresPermissions("system:dict:remove")
|
@RequiresPermissions("system:dict:remove")
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(String ids)
|
public AjaxResult remove(String ids) {
|
||||||
{
|
|
||||||
return toAjax(dictDataService.deleteDictDataByIds(ids));
|
return toAjax(dictDataService.deleteDictDataByIds(ids));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.apache.shiro.authc.AuthenticationException;
|
import org.apache.shiro.authc.AuthenticationException;
|
||||||
import org.apache.shiro.authc.UsernamePasswordToken;
|
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||||
|
|
@ -21,14 +22,11 @@ import com.ruoyi.common.utils.StringUtils;
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
public class SysLoginController extends BaseController
|
public class SysLoginController extends BaseController {
|
||||||
{
|
|
||||||
@GetMapping("/login")
|
@GetMapping("/login")
|
||||||
public String login(HttpServletRequest request, HttpServletResponse response)
|
public String login(HttpServletRequest request, HttpServletResponse response) {
|
||||||
{
|
|
||||||
// 如果是Ajax请求,返回Json字符串。
|
// 如果是Ajax请求,返回Json字符串。
|
||||||
if (ServletUtils.isAjaxRequest(request))
|
if (ServletUtils.isAjaxRequest(request)) {
|
||||||
{
|
|
||||||
return ServletUtils.renderString(response, "{\"code\":\"1\",\"msg\":\"未登录或登录超时。请重新登录\"}");
|
return ServletUtils.renderString(response, "{\"code\":\"1\",\"msg\":\"未登录或登录超时。请重新登录\"}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -37,20 +35,15 @@ public class SysLoginController extends BaseController
|
||||||
|
|
||||||
@PostMapping("/login")
|
@PostMapping("/login")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult ajaxLogin(String username, String password, Boolean rememberMe)
|
public AjaxResult ajaxLogin(String username, String password, Boolean rememberMe) {
|
||||||
{
|
|
||||||
UsernamePasswordToken token = new UsernamePasswordToken(username, password, rememberMe);
|
UsernamePasswordToken token = new UsernamePasswordToken(username, password, rememberMe);
|
||||||
Subject subject = SecurityUtils.getSubject();
|
Subject subject = SecurityUtils.getSubject();
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
subject.login(token);
|
subject.login(token);
|
||||||
return success();
|
return success();
|
||||||
}
|
} catch (AuthenticationException e) {
|
||||||
catch (AuthenticationException e)
|
|
||||||
{
|
|
||||||
String msg = "用户或密码错误";
|
String msg = "用户或密码错误";
|
||||||
if (StringUtils.isNotEmpty(e.getMessage()))
|
if (StringUtils.isNotEmpty(e.getMessage())) {
|
||||||
{
|
|
||||||
msg = e.getMessage();
|
msg = e.getMessage();
|
||||||
}
|
}
|
||||||
return error(msg);
|
return error(msg);
|
||||||
|
|
@ -58,8 +51,7 @@ public class SysLoginController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/unauth")
|
@GetMapping("/unauth")
|
||||||
public String unauth()
|
public String unauth() {
|
||||||
{
|
|
||||||
return "error/unauth";
|
return "error/unauth";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
@ -29,8 +30,7 @@ import com.ruoyi.system.service.ISysMenuService;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/menu")
|
@RequestMapping("/system/menu")
|
||||||
public class SysMenuController extends BaseController
|
public class SysMenuController extends BaseController {
|
||||||
{
|
|
||||||
private String prefix = "system/menu";
|
private String prefix = "system/menu";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -38,16 +38,14 @@ public class SysMenuController extends BaseController
|
||||||
|
|
||||||
@RequiresPermissions("system:menu:view")
|
@RequiresPermissions("system:menu:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String menu()
|
public String menu() {
|
||||||
{
|
|
||||||
return prefix + "/menu";
|
return prefix + "/menu";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("system:menu:list")
|
@RequiresPermissions("system:menu:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<SysMenu> list(SysMenu menu)
|
public List<SysMenu> list(SysMenu menu) {
|
||||||
{
|
|
||||||
Long userId = ShiroUtils.getUserId();
|
Long userId = ShiroUtils.getUserId();
|
||||||
List<SysMenu> menuList = menuService.selectMenuList(menu, userId);
|
List<SysMenu> menuList = menuService.selectMenuList(menu, userId);
|
||||||
return menuList;
|
return menuList;
|
||||||
|
|
@ -60,14 +58,11 @@ public class SysMenuController extends BaseController
|
||||||
@RequiresPermissions("system:menu:remove")
|
@RequiresPermissions("system:menu:remove")
|
||||||
@GetMapping("/remove/{menuId}")
|
@GetMapping("/remove/{menuId}")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(@PathVariable("menuId") Long menuId)
|
public AjaxResult remove(@PathVariable("menuId") Long menuId) {
|
||||||
{
|
if (menuService.selectCountMenuByParentId(menuId) > 0) {
|
||||||
if (menuService.selectCountMenuByParentId(menuId) > 0)
|
|
||||||
{
|
|
||||||
return AjaxResult.warn("存在子菜单,不允许删除");
|
return AjaxResult.warn("存在子菜单,不允许删除");
|
||||||
}
|
}
|
||||||
if (menuService.selectCountRoleMenuByMenuId(menuId) > 0)
|
if (menuService.selectCountRoleMenuByMenuId(menuId) > 0) {
|
||||||
{
|
|
||||||
return AjaxResult.warn("菜单已分配,不允许删除");
|
return AjaxResult.warn("菜单已分配,不允许删除");
|
||||||
}
|
}
|
||||||
ShiroUtils.clearCachedAuthorizationInfo();
|
ShiroUtils.clearCachedAuthorizationInfo();
|
||||||
|
|
@ -78,15 +73,11 @@ public class SysMenuController extends BaseController
|
||||||
* 新增
|
* 新增
|
||||||
*/
|
*/
|
||||||
@GetMapping("/add/{parentId}")
|
@GetMapping("/add/{parentId}")
|
||||||
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
|
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap) {
|
||||||
{
|
|
||||||
SysMenu menu = null;
|
SysMenu menu = null;
|
||||||
if (0L != parentId)
|
if (0L != parentId) {
|
||||||
{
|
|
||||||
menu = menuService.selectMenuById(parentId);
|
menu = menuService.selectMenuById(parentId);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
menu = new SysMenu();
|
menu = new SysMenu();
|
||||||
menu.setMenuId(0L);
|
menu.setMenuId(0L);
|
||||||
menu.setMenuName("主目录");
|
menu.setMenuName("主目录");
|
||||||
|
|
@ -102,23 +93,21 @@ public class SysMenuController extends BaseController
|
||||||
@RequiresPermissions("system:menu:add")
|
@RequiresPermissions("system:menu:add")
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(@Validated SysMenu menu)
|
public AjaxResult addSave(@Validated SysMenu menu) {
|
||||||
{
|
if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) {
|
||||||
if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
|
||||||
{
|
|
||||||
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||||
}
|
}
|
||||||
menu.setCreateBy(ShiroUtils.getLoginName());
|
menu.setCreateBy(ShiroUtils.getLoginName());
|
||||||
ShiroUtils.clearCachedAuthorizationInfo();
|
ShiroUtils.clearCachedAuthorizationInfo();
|
||||||
return toAjax(menuService.insertMenu(menu));
|
menuService.insertMenu(menu);
|
||||||
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改菜单
|
* 修改菜单
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit/{menuId}")
|
@GetMapping("/edit/{menuId}")
|
||||||
public String edit(@PathVariable("menuId") Long menuId, ModelMap mmap)
|
public String edit(@PathVariable("menuId") Long menuId, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("menu", menuService.selectMenuById(menuId));
|
mmap.put("menu", menuService.selectMenuById(menuId));
|
||||||
return prefix + "/edit";
|
return prefix + "/edit";
|
||||||
}
|
}
|
||||||
|
|
@ -130,23 +119,21 @@ public class SysMenuController extends BaseController
|
||||||
@RequiresPermissions("system:menu:edit")
|
@RequiresPermissions("system:menu:edit")
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(@Validated SysMenu menu)
|
public AjaxResult editSave(@Validated SysMenu menu) {
|
||||||
{
|
if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) {
|
||||||
if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
|
||||||
{
|
|
||||||
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||||
}
|
}
|
||||||
menu.setUpdateBy(ShiroUtils.getLoginName());
|
menu.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
ShiroUtils.clearCachedAuthorizationInfo();
|
ShiroUtils.clearCachedAuthorizationInfo();
|
||||||
return toAjax(menuService.updateMenu(menu));
|
menuService.updateMenu(menu);
|
||||||
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 选择菜单图标
|
* 选择菜单图标
|
||||||
*/
|
*/
|
||||||
@GetMapping("/icon")
|
@GetMapping("/icon")
|
||||||
public String icon()
|
public String icon() {
|
||||||
{
|
|
||||||
return prefix + "/icon";
|
return prefix + "/icon";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -155,8 +142,7 @@ public class SysMenuController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PostMapping("/checkMenuNameUnique")
|
@PostMapping("/checkMenuNameUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkMenuNameUnique(SysMenu menu)
|
public String checkMenuNameUnique(SysMenu menu) {
|
||||||
{
|
|
||||||
return menuService.checkMenuNameUnique(menu);
|
return menuService.checkMenuNameUnique(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -165,8 +151,7 @@ public class SysMenuController extends BaseController
|
||||||
*/
|
*/
|
||||||
@GetMapping("/roleMenuTreeData")
|
@GetMapping("/roleMenuTreeData")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<Ztree> roleMenuTreeData(SysRole role)
|
public List<Ztree> roleMenuTreeData(SysRole role) {
|
||||||
{
|
|
||||||
Long userId = ShiroUtils.getUserId();
|
Long userId = ShiroUtils.getUserId();
|
||||||
List<Ztree> ztrees = menuService.roleMenuTreeData(role, userId);
|
List<Ztree> ztrees = menuService.roleMenuTreeData(role, userId);
|
||||||
return ztrees;
|
return ztrees;
|
||||||
|
|
@ -177,8 +162,7 @@ public class SysMenuController extends BaseController
|
||||||
*/
|
*/
|
||||||
@GetMapping("/menuTreeData")
|
@GetMapping("/menuTreeData")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<Ztree> menuTreeData()
|
public List<Ztree> menuTreeData() {
|
||||||
{
|
|
||||||
Long userId = ShiroUtils.getUserId();
|
Long userId = ShiroUtils.getUserId();
|
||||||
List<Ztree> ztrees = menuService.menuTreeData(userId);
|
List<Ztree> ztrees = menuService.menuTreeData(userId);
|
||||||
return ztrees;
|
return ztrees;
|
||||||
|
|
@ -188,8 +172,7 @@ public class SysMenuController extends BaseController
|
||||||
* 选择菜单树
|
* 选择菜单树
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectMenuTree/{menuId}")
|
@GetMapping("/selectMenuTree/{menuId}")
|
||||||
public String selectMenuTree(@PathVariable("menuId") Long menuId, ModelMap mmap)
|
public String selectMenuTree(@PathVariable("menuId") Long menuId, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("menu", menuService.selectMenuById(menuId));
|
mmap.put("menu", menuService.selectMenuById(menuId));
|
||||||
return prefix + "/tree";
|
return prefix + "/tree";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
@ -26,8 +27,7 @@ import com.ruoyi.system.service.ISysNoticeService;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/notice")
|
@RequestMapping("/system/notice")
|
||||||
public class SysNoticeController extends BaseController
|
public class SysNoticeController extends BaseController {
|
||||||
{
|
|
||||||
private String prefix = "system/notice";
|
private String prefix = "system/notice";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -35,8 +35,7 @@ public class SysNoticeController extends BaseController
|
||||||
|
|
||||||
@RequiresPermissions("system:notice:view")
|
@RequiresPermissions("system:notice:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String notice()
|
public String notice() {
|
||||||
{
|
|
||||||
return prefix + "/notice";
|
return prefix + "/notice";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -46,19 +45,15 @@ public class SysNoticeController extends BaseController
|
||||||
@RequiresPermissions("system:notice:list")
|
@RequiresPermissions("system:notice:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(SysNotice notice)
|
public TableDataInfo list(SysNotice notice) {
|
||||||
{
|
return getDataTable(noticeService.selectNoticeList(notice, getPageRequest()));
|
||||||
startPage();
|
|
||||||
List<SysNotice> list = noticeService.selectNoticeList(notice);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增公告
|
* 新增公告
|
||||||
*/
|
*/
|
||||||
@GetMapping("/add")
|
@GetMapping("/add")
|
||||||
public String add()
|
public String add() {
|
||||||
{
|
|
||||||
return prefix + "/add";
|
return prefix + "/add";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -69,8 +64,7 @@ public class SysNoticeController extends BaseController
|
||||||
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(SysNotice notice)
|
public AjaxResult addSave(SysNotice notice) {
|
||||||
{
|
|
||||||
notice.setCreateBy(ShiroUtils.getLoginName());
|
notice.setCreateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(noticeService.insertNotice(notice));
|
return toAjax(noticeService.insertNotice(notice));
|
||||||
}
|
}
|
||||||
|
|
@ -79,8 +73,7 @@ public class SysNoticeController extends BaseController
|
||||||
* 修改公告
|
* 修改公告
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit/{noticeId}")
|
@GetMapping("/edit/{noticeId}")
|
||||||
public String edit(@PathVariable("noticeId") Long noticeId, ModelMap mmap)
|
public String edit(@PathVariable("noticeId") Long noticeId, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("notice", noticeService.selectNoticeById(noticeId));
|
mmap.put("notice", noticeService.selectNoticeById(noticeId));
|
||||||
return prefix + "/edit";
|
return prefix + "/edit";
|
||||||
}
|
}
|
||||||
|
|
@ -92,8 +85,7 @@ public class SysNoticeController extends BaseController
|
||||||
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(SysNotice notice)
|
public AjaxResult editSave(SysNotice notice) {
|
||||||
{
|
|
||||||
notice.setUpdateBy(ShiroUtils.getLoginName());
|
notice.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(noticeService.updateNotice(notice));
|
return toAjax(noticeService.updateNotice(notice));
|
||||||
}
|
}
|
||||||
|
|
@ -105,8 +97,7 @@ public class SysNoticeController extends BaseController
|
||||||
@Log(title = "通知公告", businessType = BusinessType.DELETE)
|
@Log(title = "通知公告", businessType = BusinessType.DELETE)
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(String ids)
|
public AjaxResult remove(String ids) {
|
||||||
{
|
|
||||||
return toAjax(noticeService.deleteNoticeByIds(ids));
|
return toAjax(noticeService.deleteNoticeByIds(ids));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,5 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.ModelMap;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
|
@ -21,6 +10,14 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.framework.util.ShiroUtils;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.system.domain.SysPost;
|
import com.ruoyi.system.domain.SysPost;
|
||||||
import com.ruoyi.system.service.ISysPostService;
|
import com.ruoyi.system.service.ISysPostService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 岗位信息操作处理
|
* 岗位信息操作处理
|
||||||
|
|
@ -29,8 +26,7 @@ import com.ruoyi.system.service.ISysPostService;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/post")
|
@RequestMapping("/system/post")
|
||||||
public class SysPostController extends BaseController
|
public class SysPostController extends BaseController {
|
||||||
{
|
|
||||||
private String prefix = "system/post";
|
private String prefix = "system/post";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -38,44 +34,35 @@ public class SysPostController extends BaseController
|
||||||
|
|
||||||
@RequiresPermissions("system:post:view")
|
@RequiresPermissions("system:post:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String operlog()
|
public String operlog() {
|
||||||
{
|
|
||||||
return prefix + "/post";
|
return prefix + "/post";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("system:post:list")
|
@RequiresPermissions("system:post:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(SysPost post)
|
public TableDataInfo list(SysPost post) {
|
||||||
{
|
return getDataTable(postService.selectPostList(post, getPageRequest()));
|
||||||
startPage();
|
|
||||||
List<SysPost> list = postService.selectPostList(post);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
||||||
@RequiresPermissions("system:post:export")
|
@RequiresPermissions("system:post:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(SysPost post)
|
public AjaxResult export(SysPost post) {
|
||||||
{
|
Page<SysPost> list = postService.selectPostList(post, Pageable.unpaged());
|
||||||
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.getContent(), "岗位数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("system:post:remove")
|
@RequiresPermissions("system:post:remove")
|
||||||
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(String ids)
|
public AjaxResult remove(String ids) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
return toAjax(postService.deletePostByIds(ids));
|
return toAjax(postService.deletePostByIds(ids));
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return error(e.getMessage());
|
return error(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -84,8 +71,7 @@ public class SysPostController extends BaseController
|
||||||
* 新增岗位
|
* 新增岗位
|
||||||
*/
|
*/
|
||||||
@GetMapping("/add")
|
@GetMapping("/add")
|
||||||
public String add()
|
public String add() {
|
||||||
{
|
|
||||||
return prefix + "/add";
|
return prefix + "/add";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,26 +82,21 @@ public class SysPostController extends BaseController
|
||||||
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(@Validated SysPost post)
|
public AjaxResult addSave(@Validated SysPost post) {
|
||||||
{
|
if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) {
|
||||||
if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
|
||||||
{
|
|
||||||
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||||
}
|
} else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) {
|
||||||
else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
|
||||||
{
|
|
||||||
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||||
}
|
}
|
||||||
post.setCreateBy(ShiroUtils.getLoginName());
|
post.setCreateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(postService.insertPost(post));
|
return success(postService.insertPost(post));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改岗位
|
* 修改岗位
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit/{postId}")
|
@GetMapping("/edit/{postId}")
|
||||||
public String edit(@PathVariable("postId") Long postId, ModelMap mmap)
|
public String edit(@PathVariable("postId") Long postId, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("post", postService.selectPostById(postId));
|
mmap.put("post", postService.selectPostById(postId));
|
||||||
return prefix + "/edit";
|
return prefix + "/edit";
|
||||||
}
|
}
|
||||||
|
|
@ -127,18 +108,14 @@ public class SysPostController extends BaseController
|
||||||
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(@Validated SysPost post)
|
public AjaxResult editSave(@Validated SysPost post) {
|
||||||
{
|
if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) {
|
||||||
if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
|
||||||
{
|
|
||||||
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||||
}
|
} else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) {
|
||||||
else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
|
||||||
{
|
|
||||||
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||||
}
|
}
|
||||||
post.setUpdateBy(ShiroUtils.getLoginName());
|
post.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(postService.updatePost(post));
|
return success(postService.updatePost(post));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -146,8 +123,7 @@ public class SysPostController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PostMapping("/checkPostNameUnique")
|
@PostMapping("/checkPostNameUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkPostNameUnique(SysPost post)
|
public String checkPostNameUnique(SysPost post) {
|
||||||
{
|
|
||||||
return postService.checkPostNameUnique(post);
|
return postService.checkPostNameUnique(post);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -156,8 +132,7 @@ public class SysPostController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PostMapping("/checkPostCodeUnique")
|
@PostMapping("/checkPostCodeUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkPostCodeUnique(SysPost post)
|
public String checkPostCodeUnique(SysPost post) {
|
||||||
{
|
|
||||||
return postService.checkPostCodeUnique(post);
|
return postService.checkPostCodeUnique(post);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,5 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.ModelMap;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.config.Global;
|
import com.ruoyi.common.config.Global;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
|
@ -20,8 +9,16 @@ import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||||
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
||||||
import com.ruoyi.framework.util.ShiroUtils;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
|
import com.ruoyi.system.domain.SysPost;
|
||||||
import com.ruoyi.system.domain.SysUser;
|
import com.ruoyi.system.domain.SysUser;
|
||||||
import com.ruoyi.system.service.ISysUserService;
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 个人信息 业务处理
|
* 个人信息 业务处理
|
||||||
|
|
@ -30,8 +27,7 @@ import com.ruoyi.system.service.ISysUserService;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/user/profile")
|
@RequestMapping("/system/user/profile")
|
||||||
public class SysProfileController extends BaseController
|
public class SysProfileController extends BaseController {
|
||||||
{
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(SysProfileController.class);
|
private static final Logger log = LoggerFactory.getLogger(SysProfileController.class);
|
||||||
|
|
||||||
private String prefix = "system/user/profile";
|
private String prefix = "system/user/profile";
|
||||||
|
|
@ -46,30 +42,36 @@ public class SysProfileController extends BaseController
|
||||||
* 个人信息
|
* 个人信息
|
||||||
*/
|
*/
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String profile(ModelMap mmap)
|
public String profile(ModelMap mmap) {
|
||||||
{
|
SysUser user = userService.selectUserWithRolesAndPostsById(ShiroUtils.getUserId());
|
||||||
SysUser user = ShiroUtils.getSysUser();
|
|
||||||
mmap.put("user", user);
|
mmap.put("user", user);
|
||||||
mmap.put("roleGroup", userService.selectUserRoleGroup(user.getUserId()));
|
mmap.put("postGroup", concat(user));
|
||||||
mmap.put("postGroup", userService.selectUserPostGroup(user.getUserId()));
|
|
||||||
return prefix + "/profile";
|
return prefix + "/profile";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String concat(SysUser user){
|
||||||
|
StringBuffer idsStr = new StringBuffer();
|
||||||
|
for (SysPost post : user.getPosts()) {
|
||||||
|
idsStr.append(post.getPostName()).append(",");
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(idsStr.toString())) {
|
||||||
|
return idsStr.substring(0, idsStr.length() - 1);
|
||||||
|
}
|
||||||
|
return idsStr.toString();
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/checkPassword")
|
@GetMapping("/checkPassword")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public boolean checkPassword(String password)
|
public boolean checkPassword(String password) {
|
||||||
{
|
|
||||||
SysUser user = ShiroUtils.getSysUser();
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
if (passwordService.matches(user, password))
|
if (passwordService.matches(user, password)) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/resetPwd")
|
@GetMapping("/resetPwd")
|
||||||
public String resetPwd(ModelMap mmap)
|
public String resetPwd(ModelMap mmap) {
|
||||||
{
|
|
||||||
SysUser user = ShiroUtils.getSysUser();
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
mmap.put("user", userService.selectUserById(user.getUserId()));
|
mmap.put("user", userService.selectUserById(user.getUserId()));
|
||||||
return prefix + "/resetPwd";
|
return prefix + "/resetPwd";
|
||||||
|
|
@ -78,22 +80,15 @@ public class SysProfileController extends BaseController
|
||||||
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
|
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/resetPwd")
|
@PostMapping("/resetPwd")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult resetPwd(String oldPassword, String newPassword)
|
public AjaxResult resetPwd(String oldPassword, String newPassword) {
|
||||||
{
|
|
||||||
SysUser user = ShiroUtils.getSysUser();
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
if (StringUtils.isNotEmpty(newPassword) && passwordService.matches(user, oldPassword))
|
if (StringUtils.isNotEmpty(newPassword) && passwordService.matches(user, oldPassword)) {
|
||||||
{
|
|
||||||
user.setSalt(ShiroUtils.randomSalt());
|
user.setSalt(ShiroUtils.randomSalt());
|
||||||
user.setPassword(passwordService.encryptPassword(user.getLoginName(), newPassword, user.getSalt()));
|
user.setPassword(passwordService.encryptPassword(user.getLoginName(), newPassword, user.getSalt()));
|
||||||
if (userService.resetUserPwd(user) > 0)
|
user = userService.resetUserPwd(user);
|
||||||
{
|
ShiroUtils.setSysUser(user);
|
||||||
ShiroUtils.setSysUser(userService.selectUserById(user.getUserId()));
|
return success();
|
||||||
return success();
|
} else {
|
||||||
}
|
|
||||||
return error();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return error("修改密码失败,旧密码错误");
|
return error("修改密码失败,旧密码错误");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -102,8 +97,7 @@ public class SysProfileController extends BaseController
|
||||||
* 修改用户
|
* 修改用户
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit")
|
@GetMapping("/edit")
|
||||||
public String edit(ModelMap mmap)
|
public String edit(ModelMap mmap) {
|
||||||
{
|
|
||||||
SysUser user = ShiroUtils.getSysUser();
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
mmap.put("user", userService.selectUserById(user.getUserId()));
|
mmap.put("user", userService.selectUserById(user.getUserId()));
|
||||||
return prefix + "/edit";
|
return prefix + "/edit";
|
||||||
|
|
@ -113,8 +107,7 @@ public class SysProfileController extends BaseController
|
||||||
* 修改头像
|
* 修改头像
|
||||||
*/
|
*/
|
||||||
@GetMapping("/avatar")
|
@GetMapping("/avatar")
|
||||||
public String avatar(ModelMap mmap)
|
public String avatar(ModelMap mmap) {
|
||||||
{
|
|
||||||
SysUser user = ShiroUtils.getSysUser();
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
mmap.put("user", userService.selectUserById(user.getUserId()));
|
mmap.put("user", userService.selectUserById(user.getUserId()));
|
||||||
return prefix + "/avatar";
|
return prefix + "/avatar";
|
||||||
|
|
@ -126,19 +119,15 @@ public class SysProfileController extends BaseController
|
||||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult update(SysUser user)
|
public AjaxResult update(SysUser user) {
|
||||||
{
|
|
||||||
SysUser currentUser = ShiroUtils.getSysUser();
|
SysUser currentUser = ShiroUtils.getSysUser();
|
||||||
currentUser.setUserName(user.getUserName());
|
currentUser.setUserName(user.getUserName());
|
||||||
currentUser.setEmail(user.getEmail());
|
currentUser.setEmail(user.getEmail());
|
||||||
currentUser.setPhonenumber(user.getPhonenumber());
|
currentUser.setPhonenumber(user.getPhonenumber());
|
||||||
currentUser.setSex(user.getSex());
|
currentUser.setSex(user.getSex());
|
||||||
if (userService.updateUserInfo(currentUser) > 0)
|
userService.updateUserInfo(currentUser);
|
||||||
{
|
ShiroUtils.setSysUser(currentUser);
|
||||||
ShiroUtils.setSysUser(userService.selectUserById(currentUser.getUserId()));
|
return success();
|
||||||
return success();
|
|
||||||
}
|
|
||||||
return error();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -147,25 +136,18 @@ public class SysProfileController extends BaseController
|
||||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/updateAvatar")
|
@PostMapping("/updateAvatar")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult updateAvatar(@RequestParam("avatarfile") MultipartFile file)
|
public AjaxResult updateAvatar(@RequestParam("avatarfile") MultipartFile file) {
|
||||||
{
|
|
||||||
SysUser currentUser = ShiroUtils.getSysUser();
|
SysUser currentUser = ShiroUtils.getSysUser();
|
||||||
try
|
try {
|
||||||
{
|
if (!file.isEmpty()) {
|
||||||
if (!file.isEmpty())
|
|
||||||
{
|
|
||||||
String avatar = FileUploadUtils.upload(Global.getAvatarPath(), file);
|
String avatar = FileUploadUtils.upload(Global.getAvatarPath(), file);
|
||||||
currentUser.setAvatar(avatar);
|
currentUser.setAvatar(avatar);
|
||||||
if (userService.updateUserInfo(currentUser) > 0)
|
userService.updateUserInfo(currentUser);
|
||||||
{
|
ShiroUtils.setSysUser(currentUser);
|
||||||
ShiroUtils.setSysUser(userService.selectUserById(currentUser.getUserId()));
|
return success();
|
||||||
return success();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return error();
|
return error();
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
log.error("修改头像失败!", e);
|
log.error("修改头像失败!", e);
|
||||||
return error(e.getMessage());
|
return error(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,7 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.ModelMap;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
|
@ -24,6 +12,16 @@ import com.ruoyi.system.domain.SysUser;
|
||||||
import com.ruoyi.system.domain.SysUserRole;
|
import com.ruoyi.system.domain.SysUserRole;
|
||||||
import com.ruoyi.system.service.ISysRoleService;
|
import com.ruoyi.system.service.ISysRoleService;
|
||||||
import com.ruoyi.system.service.ISysUserService;
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
import com.ruoyi.web.controller.system.base.WebController;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色信息
|
* 角色信息
|
||||||
|
|
@ -32,8 +30,7 @@ import com.ruoyi.system.service.ISysUserService;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/role")
|
@RequestMapping("/system/role")
|
||||||
public class SysRoleController extends BaseController
|
public class SysRoleController extends WebController {
|
||||||
{
|
|
||||||
private String prefix = "system/role";
|
private String prefix = "system/role";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -44,28 +41,23 @@ public class SysRoleController extends BaseController
|
||||||
|
|
||||||
@RequiresPermissions("system:role:view")
|
@RequiresPermissions("system:role:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String role()
|
public String role() {
|
||||||
{
|
|
||||||
return prefix + "/role";
|
return prefix + "/role";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("system:role:list")
|
@RequiresPermissions("system:role:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(SysRole role)
|
public TableDataInfo list(SysRole role) {
|
||||||
{
|
return getDataTable(roleService.selectRoleList(role, getPageRequest(), getUser()));
|
||||||
startPage();
|
|
||||||
List<SysRole> list = roleService.selectRoleList(role);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
|
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
|
||||||
@RequiresPermissions("system:role:export")
|
@RequiresPermissions("system:role:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(SysRole role)
|
public AjaxResult export(SysRole role) {
|
||||||
{
|
List<SysRole> list = roleService.selectRoleList(role, Pageable.unpaged(), getUser()).getContent();
|
||||||
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, "角色数据");
|
||||||
}
|
}
|
||||||
|
|
@ -74,8 +66,7 @@ public class SysRoleController extends BaseController
|
||||||
* 新增角色
|
* 新增角色
|
||||||
*/
|
*/
|
||||||
@GetMapping("/add")
|
@GetMapping("/add")
|
||||||
public String add()
|
public String add() {
|
||||||
{
|
|
||||||
return prefix + "/add";
|
return prefix + "/add";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -86,19 +77,16 @@ public class SysRoleController extends BaseController
|
||||||
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(@Validated SysRole role)
|
public AjaxResult addSave(@Validated SysRole role) {
|
||||||
{
|
if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) {
|
||||||
if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
|
||||||
{
|
|
||||||
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||||
}
|
} else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) {
|
||||||
else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
|
|
||||||
{
|
|
||||||
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||||
}
|
}
|
||||||
role.setCreateBy(ShiroUtils.getLoginName());
|
role.setCreateBy(ShiroUtils.getLoginName());
|
||||||
ShiroUtils.clearCachedAuthorizationInfo();
|
ShiroUtils.clearCachedAuthorizationInfo();
|
||||||
return toAjax(roleService.insertRole(role));
|
roleService.insertRole(role);
|
||||||
|
return success();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -106,8 +94,7 @@ public class SysRoleController extends BaseController
|
||||||
* 修改角色
|
* 修改角色
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit/{roleId}")
|
@GetMapping("/edit/{roleId}")
|
||||||
public String edit(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
public String edit(@PathVariable("roleId") Long roleId, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("role", roleService.selectRoleById(roleId));
|
mmap.put("role", roleService.selectRoleById(roleId));
|
||||||
return prefix + "/edit";
|
return prefix + "/edit";
|
||||||
}
|
}
|
||||||
|
|
@ -119,28 +106,24 @@ public class SysRoleController extends BaseController
|
||||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(@Validated SysRole role)
|
public AjaxResult editSave(@Validated SysRole role) {
|
||||||
{
|
|
||||||
roleService.checkRoleAllowed(role);
|
roleService.checkRoleAllowed(role);
|
||||||
if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) {
|
||||||
{
|
|
||||||
return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||||
}
|
} else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) {
|
||||||
else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
|
|
||||||
{
|
|
||||||
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||||
}
|
}
|
||||||
role.setUpdateBy(ShiroUtils.getLoginName());
|
role.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
ShiroUtils.clearCachedAuthorizationInfo();
|
ShiroUtils.clearCachedAuthorizationInfo();
|
||||||
return toAjax(roleService.updateRole(role));
|
roleService.updateRole(role);
|
||||||
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色分配数据权限
|
* 角色分配数据权限
|
||||||
*/
|
*/
|
||||||
@GetMapping("/authDataScope/{roleId}")
|
@GetMapping("/authDataScope/{roleId}")
|
||||||
public String authDataScope(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
public String authDataScope(@PathVariable("roleId") Long roleId, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("role", roleService.selectRoleById(roleId));
|
mmap.put("role", roleService.selectRoleById(roleId));
|
||||||
return prefix + "/dataScope";
|
return prefix + "/dataScope";
|
||||||
}
|
}
|
||||||
|
|
@ -152,12 +135,10 @@ public class SysRoleController extends BaseController
|
||||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/authDataScope")
|
@PostMapping("/authDataScope")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult authDataScopeSave(SysRole role)
|
public AjaxResult authDataScopeSave(SysRole role) {
|
||||||
{
|
|
||||||
roleService.checkRoleAllowed(role);
|
roleService.checkRoleAllowed(role);
|
||||||
role.setUpdateBy(ShiroUtils.getLoginName());
|
role.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
if (roleService.authDataScope(role) > 0)
|
if (roleService.authDataScope(role) > 0) {
|
||||||
{
|
|
||||||
ShiroUtils.setSysUser(userService.selectUserById(ShiroUtils.getSysUser().getUserId()));
|
ShiroUtils.setSysUser(userService.selectUserById(ShiroUtils.getSysUser().getUserId()));
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
@ -168,14 +149,10 @@ public class SysRoleController extends BaseController
|
||||||
@Log(title = "角色管理", businessType = BusinessType.DELETE)
|
@Log(title = "角色管理", businessType = BusinessType.DELETE)
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(String ids)
|
public AjaxResult remove(String ids) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
return toAjax(roleService.deleteRoleByIds(ids));
|
return toAjax(roleService.deleteRoleByIds(ids));
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return error(e.getMessage());
|
return error(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -185,8 +162,7 @@ public class SysRoleController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PostMapping("/checkRoleNameUnique")
|
@PostMapping("/checkRoleNameUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkRoleNameUnique(SysRole role)
|
public String checkRoleNameUnique(SysRole role) {
|
||||||
{
|
|
||||||
return roleService.checkRoleNameUnique(role);
|
return roleService.checkRoleNameUnique(role);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -195,8 +171,7 @@ public class SysRoleController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PostMapping("/checkRoleKeyUnique")
|
@PostMapping("/checkRoleKeyUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkRoleKeyUnique(SysRole role)
|
public String checkRoleKeyUnique(SysRole role) {
|
||||||
{
|
|
||||||
return roleService.checkRoleKeyUnique(role);
|
return roleService.checkRoleKeyUnique(role);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -204,8 +179,7 @@ public class SysRoleController extends BaseController
|
||||||
* 选择菜单树
|
* 选择菜单树
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectMenuTree")
|
@GetMapping("/selectMenuTree")
|
||||||
public String selectMenuTree()
|
public String selectMenuTree() {
|
||||||
{
|
|
||||||
return prefix + "/tree";
|
return prefix + "/tree";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -216,8 +190,7 @@ public class SysRoleController extends BaseController
|
||||||
@RequiresPermissions("system:role:edit")
|
@RequiresPermissions("system:role:edit")
|
||||||
@PostMapping("/changeStatus")
|
@PostMapping("/changeStatus")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult changeStatus(SysRole role)
|
public AjaxResult changeStatus(SysRole role) {
|
||||||
{
|
|
||||||
roleService.checkRoleAllowed(role);
|
roleService.checkRoleAllowed(role);
|
||||||
return toAjax(roleService.changeStatus(role));
|
return toAjax(roleService.changeStatus(role));
|
||||||
}
|
}
|
||||||
|
|
@ -227,8 +200,7 @@ public class SysRoleController extends BaseController
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:role:edit")
|
@RequiresPermissions("system:role:edit")
|
||||||
@GetMapping("/authUser/{roleId}")
|
@GetMapping("/authUser/{roleId}")
|
||||||
public String authUser(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
public String authUser(@PathVariable("roleId") Long roleId, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("role", roleService.selectRoleById(roleId));
|
mmap.put("role", roleService.selectRoleById(roleId));
|
||||||
return prefix + "/authUser";
|
return prefix + "/authUser";
|
||||||
}
|
}
|
||||||
|
|
@ -239,11 +211,8 @@ public class SysRoleController extends BaseController
|
||||||
@RequiresPermissions("system:role:list")
|
@RequiresPermissions("system:role:list")
|
||||||
@PostMapping("/authUser/allocatedList")
|
@PostMapping("/authUser/allocatedList")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo allocatedList(SysUser user)
|
public TableDataInfo allocatedList(SysUser user) {
|
||||||
{
|
return getDataTable(userService.selectAllocatedList(user, getPageRequest()));
|
||||||
startPage();
|
|
||||||
List<SysUser> list = userService.selectAllocatedList(user);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -252,8 +221,7 @@ public class SysRoleController extends BaseController
|
||||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
@PostMapping("/authUser/cancel")
|
@PostMapping("/authUser/cancel")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult cancelAuthUser(SysUserRole userRole)
|
public AjaxResult cancelAuthUser(SysUserRole userRole) {
|
||||||
{
|
|
||||||
return toAjax(roleService.deleteAuthUser(userRole));
|
return toAjax(roleService.deleteAuthUser(userRole));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -263,8 +231,7 @@ public class SysRoleController extends BaseController
|
||||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
@PostMapping("/authUser/cancelAll")
|
@PostMapping("/authUser/cancelAll")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult cancelAuthUserAll(Long roleId, String userIds)
|
public AjaxResult cancelAuthUserAll(Long roleId, String userIds) {
|
||||||
{
|
|
||||||
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -272,8 +239,7 @@ public class SysRoleController extends BaseController
|
||||||
* 选择用户
|
* 选择用户
|
||||||
*/
|
*/
|
||||||
@GetMapping("/authUser/selectUser/{roleId}")
|
@GetMapping("/authUser/selectUser/{roleId}")
|
||||||
public String selectUser(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
public String selectUser(@PathVariable("roleId") Long roleId, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("role", roleService.selectRoleById(roleId));
|
mmap.put("role", roleService.selectRoleById(roleId));
|
||||||
return prefix + "/selectUser";
|
return prefix + "/selectUser";
|
||||||
}
|
}
|
||||||
|
|
@ -284,11 +250,8 @@ public class SysRoleController extends BaseController
|
||||||
@RequiresPermissions("system:role:list")
|
@RequiresPermissions("system:role:list")
|
||||||
@PostMapping("/authUser/unallocatedList")
|
@PostMapping("/authUser/unallocatedList")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo unallocatedList(SysUser user)
|
public TableDataInfo unallocatedList(SysUser user) {
|
||||||
{
|
return getDataTable(userService.selectUnallocatedList(user, getPageRequest()));
|
||||||
startPage();
|
|
||||||
List<SysUser> list = userService.selectUnallocatedList(user);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -297,8 +260,7 @@ public class SysRoleController extends BaseController
|
||||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
@PostMapping("/authUser/selectAll")
|
@PostMapping("/authUser/selectAll")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult selectAuthUserAll(Long roleId, String userIds)
|
public AjaxResult selectAuthUserAll(Long roleId, String userIds) {
|
||||||
{
|
|
||||||
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.ruoyi.web.controller.system.base;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
|
import com.ruoyi.system.domain.SysUser;
|
||||||
|
|
||||||
|
public class WebController extends BaseController {
|
||||||
|
|
||||||
|
protected SysUser getUser(){
|
||||||
|
return ShiroUtils.getSysUser();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -13,14 +13,12 @@ import com.ruoyi.common.core.controller.BaseController;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/tool/build")
|
@RequestMapping("/tool/build")
|
||||||
public class BuildController extends BaseController
|
public class BuildController extends BaseController {
|
||||||
{
|
|
||||||
private String prefix = "tool/build";
|
private String prefix = "tool/build";
|
||||||
|
|
||||||
@RequiresPermissions("tool:build:view")
|
@RequiresPermissions("tool:build:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String build()
|
public String build() {
|
||||||
{
|
|
||||||
return prefix + "/build";
|
return prefix + "/build";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,12 +13,10 @@ import com.ruoyi.common.core.controller.BaseController;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/tool/swagger")
|
@RequestMapping("/tool/swagger")
|
||||||
public class SwaggerController extends BaseController
|
public class SwaggerController extends BaseController {
|
||||||
{
|
|
||||||
@RequiresPermissions("tool:swagger:view")
|
@RequiresPermissions("tool:swagger:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String index()
|
public String index() {
|
||||||
{
|
|
||||||
return redirect("/swagger-ui.html");
|
return redirect("/swagger-ui.html");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ 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;
|
||||||
|
|
@ -28,9 +29,9 @@ import io.swagger.annotations.ApiOperation;
|
||||||
@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"));
|
||||||
|
|
@ -38,8 +39,7 @@ public class TestController extends BaseController
|
||||||
|
|
||||||
@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);
|
||||||
}
|
}
|
||||||
|
|
@ -47,14 +47,10 @@ public class TestController extends BaseController
|
||||||
@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 error("用户不存在");
|
return error("用户不存在");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -62,10 +58,8 @@ public class TestController extends BaseController
|
||||||
@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 error("用户ID不能为空");
|
return error("用户ID不能为空");
|
||||||
}
|
}
|
||||||
return AjaxResult.success(users.put(user.getUserId(), user));
|
return AjaxResult.success(users.put(user.getUserId(), user));
|
||||||
|
|
@ -74,14 +68,11 @@ public class TestController extends BaseController
|
||||||
@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 error("用户ID不能为空");
|
return error("用户ID不能为空");
|
||||||
}
|
}
|
||||||
if (users.isEmpty() || !users.containsKey(user.getUserId()))
|
if (users.isEmpty() || !users.containsKey(user.getUserId())) {
|
||||||
{
|
|
||||||
return error("用户不存在");
|
return error("用户不存在");
|
||||||
}
|
}
|
||||||
users.remove(user.getUserId());
|
users.remove(user.getUserId());
|
||||||
|
|
@ -91,23 +82,18 @@ public class TestController extends BaseController
|
||||||
@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 success();
|
return success();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return error("用户不存在");
|
return error("用户不存在");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiModel("用户实体")
|
@ApiModel("用户实体")
|
||||||
class UserEntity
|
class UserEntity {
|
||||||
{
|
|
||||||
@ApiModelProperty("用户ID")
|
@ApiModelProperty("用户ID")
|
||||||
private Integer userId;
|
private Integer userId;
|
||||||
|
|
||||||
|
|
@ -120,56 +106,46 @@ class UserEntity
|
||||||
@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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.ruoyi.web.core.config;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
|
import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class WebmvcConfig implements WebMvcConfigurer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||||
|
for ( HttpMessageConverter<?> converter : converters ) {
|
||||||
|
if ( converter instanceof MappingJackson2HttpMessageConverter) {
|
||||||
|
MappingJackson2HttpMessageConverter jacksonConverter = (MappingJackson2HttpMessageConverter) converter;
|
||||||
|
ObjectMapper objectMapper = jacksonConverter.getObjectMapper();
|
||||||
|
|
||||||
|
//--- register hibernateModule in MappingJackson2HttpMessageConverter.objectMapper
|
||||||
|
Hibernate5Module hibernate5Module = new Hibernate5Module();
|
||||||
|
hibernate5Module.disable(Hibernate5Module.Feature.FORCE_LAZY_LOADING);
|
||||||
|
hibernate5Module.enable(Hibernate5Module.Feature.WRITE_MISSING_ENTITIES_AS_NULL);
|
||||||
|
hibernate5Module.disable(Hibernate5Module.Feature.USE_TRANSIENT_ANNOTATION);
|
||||||
|
objectMapper.registerModule(hibernate5Module);
|
||||||
|
|
||||||
|
//--- other configurations
|
||||||
|
jacksonConverter.setPrettyPrint( true );
|
||||||
|
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
||||||
|
objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,3 +1,10 @@
|
||||||
|
#flyway会自动建立该数据库
|
||||||
|
db:
|
||||||
|
# mysql, oracle, sqlserver
|
||||||
|
type: mysql
|
||||||
|
name: framework
|
||||||
|
username: root
|
||||||
|
password: root
|
||||||
# 数据源配置
|
# 数据源配置
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
|
|
@ -6,9 +13,9 @@ spring:
|
||||||
druid:
|
druid:
|
||||||
# 主库数据源
|
# 主库数据源
|
||||||
master:
|
master:
|
||||||
url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
url: jdbc:mysql://localhost:3306/${db.name}?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
username: root
|
username: ${db.username}
|
||||||
password: password
|
password: ${db.password}
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
slave:
|
slave:
|
||||||
# 从数据源开关/默认关闭
|
# 从数据源开关/默认关闭
|
||||||
|
|
@ -55,3 +62,19 @@ spring:
|
||||||
wall:
|
wall:
|
||||||
config:
|
config:
|
||||||
multi-statement-allow: true
|
multi-statement-allow: true
|
||||||
|
|
||||||
|
flyway:
|
||||||
|
enabled: true
|
||||||
|
url: jdbc:mysql://localhost:3306/mysql?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
|
user: ${db.username}
|
||||||
|
password: ${db.password}
|
||||||
|
#目标数据库已经存在,不自动升级
|
||||||
|
baseline-on-migrate: false
|
||||||
|
encoding: utf-8
|
||||||
|
clean-on-validation-error: false
|
||||||
|
clean-disabled: true
|
||||||
|
#数据库自动迁移的位置
|
||||||
|
locations: classpath:db/migration/${db.type}
|
||||||
|
# 需要管理的数据库
|
||||||
|
schemas: ${db.name}
|
||||||
|
sql-migration-prefix: v
|
||||||
|
|
@ -31,8 +31,10 @@ server:
|
||||||
# 日志配置
|
# 日志配置
|
||||||
logging:
|
logging:
|
||||||
level:
|
level:
|
||||||
|
root: warn
|
||||||
com.ruoyi: debug
|
com.ruoyi: debug
|
||||||
org.springframework: warn
|
com.ruoyi.quartz.mapper: warn
|
||||||
|
com.ruoyi.system.mapper: warn
|
||||||
|
|
||||||
# 用户配置
|
# 用户配置
|
||||||
user:
|
user:
|
||||||
|
|
@ -68,7 +70,21 @@ spring:
|
||||||
devtools:
|
devtools:
|
||||||
restart:
|
restart:
|
||||||
# 热部署开关
|
# 热部署开关
|
||||||
enabled: true
|
enabled: false
|
||||||
|
jpa:
|
||||||
|
hibernate:
|
||||||
|
ddl-auto: update
|
||||||
|
use-new-id-generator-mappings: true
|
||||||
|
show-sql: true
|
||||||
|
database-platform: org.hibernate.dialect.MySQL55Dialect
|
||||||
|
open-in-view: false
|
||||||
|
properties:
|
||||||
|
hibernate:
|
||||||
|
format_sql: false
|
||||||
|
cache:
|
||||||
|
type: jcache
|
||||||
|
jcache:
|
||||||
|
provider: org.ehcache.jsr107.EhcacheCachingProvider
|
||||||
|
|
||||||
# MyBatis
|
# MyBatis
|
||||||
mybatis:
|
mybatis:
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,706 @@
|
||||||
|
-- ----------------------------
|
||||||
|
-- 1、部门表
|
||||||
|
-- ----------------------------
|
||||||
|
drop table if exists sys_dept;
|
||||||
|
create table sys_dept (
|
||||||
|
dept_id bigint(20) not null auto_increment comment '部门id',
|
||||||
|
parent_id bigint(20) default 0 comment '父部门id',
|
||||||
|
ancestors varchar(50) default '' comment '祖级列表',
|
||||||
|
dept_name varchar(30) default '' comment '部门名称',
|
||||||
|
order_num int(4) default 0 comment '显示顺序',
|
||||||
|
leader varchar(20) default null comment '负责人',
|
||||||
|
phone varchar(11) default null comment '联系电话',
|
||||||
|
email varchar(50) default null comment '邮箱',
|
||||||
|
status char(1) default '0' comment '部门状态(0正常 1停用)',
|
||||||
|
del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)',
|
||||||
|
create_by varchar(64) default '' comment '创建者',
|
||||||
|
create_time datetime comment '创建时间',
|
||||||
|
update_by varchar(64) default '' comment '更新者',
|
||||||
|
update_time datetime comment '更新时间',
|
||||||
|
primary key (dept_id)
|
||||||
|
) engine=innodb auto_increment=200 comment = '部门表';
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 初始化-部门表数据
|
||||||
|
-- ----------------------------
|
||||||
|
insert into sys_dept values(100, 0, '0', '若依科技', 0, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||||
|
insert into sys_dept values(101, 100, '0,100', '深圳总公司', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||||
|
insert into sys_dept values(102, 100, '0,100', '长沙分公司', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||||
|
insert into sys_dept values(103, 101, '0,100,101', '研发部门', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||||
|
insert into sys_dept values(104, 101, '0,100,101', '市场部门', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||||
|
insert into sys_dept values(105, 101, '0,100,101', '测试部门', 3, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||||
|
insert into sys_dept values(106, 101, '0,100,101', '财务部门', 4, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||||
|
insert into sys_dept values(107, 101, '0,100,101', '运维部门', 5, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||||
|
insert into sys_dept values(108, 102, '0,100,102', '市场部门', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||||
|
insert into sys_dept values(109, 102, '0,100,102', '财务部门', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00');
|
||||||
|
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 2、用户信息表
|
||||||
|
-- ----------------------------
|
||||||
|
drop table if exists sys_user;
|
||||||
|
create table sys_user (
|
||||||
|
user_id bigint(20) not null auto_increment comment '用户ID',
|
||||||
|
dept_id bigint(20) default null comment '部门ID',
|
||||||
|
login_name varchar(30) not null comment '登录账号',
|
||||||
|
user_name varchar(30) default '' comment '用户昵称',
|
||||||
|
user_type varchar(2) default '00' comment '用户类型(00系统用户 01注册用户)',
|
||||||
|
email varchar(50) default '' comment '用户邮箱',
|
||||||
|
phonenumber varchar(11) default '' comment '手机号码',
|
||||||
|
sex char(1) default '0' comment '用户性别(0男 1女 2未知)',
|
||||||
|
avatar varchar(100) default '' comment '头像路径',
|
||||||
|
password varchar(50) default '' comment '密码',
|
||||||
|
salt varchar(20) default '' comment '盐加密',
|
||||||
|
status char(1) default '0' comment '帐号状态(0正常 1停用)',
|
||||||
|
del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)',
|
||||||
|
login_ip varchar(50) default '' comment '最后登陆IP',
|
||||||
|
login_date datetime comment '最后登陆时间',
|
||||||
|
create_by varchar(64) default '' comment '创建者',
|
||||||
|
create_time datetime comment '创建时间',
|
||||||
|
update_by varchar(64) default '' comment '更新者',
|
||||||
|
update_time datetime comment '更新时间',
|
||||||
|
remark varchar(500) default null comment '备注',
|
||||||
|
primary key (user_id)
|
||||||
|
) engine=innodb auto_increment=100 comment = '用户信息表';
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 初始化-用户信息表数据
|
||||||
|
-- ----------------------------
|
||||||
|
insert into sys_user values(1, 103, 'admin', '若依', '00', 'ry@163.com', '15888888888', '1', '', '29c67a30398638269fe600f73a054934', '111111', '0', '0', '127.0.0.1', '2018-03-16 11-33-00', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '管理员');
|
||||||
|
insert into sys_user values(2, 105, 'ry', '若依', '00', 'ry@qq.com', '15666666666', '1', '', '8e6d98b90472783cc73c17047ddccf36', '222222', '0', '0', '127.0.0.1', '2018-03-16 11-33-00', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '测试员');
|
||||||
|
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 3、岗位信息表
|
||||||
|
-- ----------------------------
|
||||||
|
drop table if exists sys_post;
|
||||||
|
create table sys_post
|
||||||
|
(
|
||||||
|
post_id bigint(20) not null auto_increment comment '岗位ID',
|
||||||
|
post_code varchar(64) not null comment '岗位编码',
|
||||||
|
post_name varchar(50) not null comment '岗位名称',
|
||||||
|
post_sort int(4) not null comment '显示顺序',
|
||||||
|
status char(1) not null comment '状态(0正常 1停用)',
|
||||||
|
create_by varchar(64) default '' comment '创建者',
|
||||||
|
create_time datetime comment '创建时间',
|
||||||
|
update_by varchar(64) default '' comment '更新者',
|
||||||
|
update_time datetime comment '更新时间',
|
||||||
|
remark varchar(500) default null comment '备注',
|
||||||
|
primary key (post_id)
|
||||||
|
) engine=innodb comment = '岗位信息表';
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 初始化-岗位信息表数据
|
||||||
|
-- ----------------------------
|
||||||
|
insert into sys_post values(1, 'ceo', '董事长', 1, '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_post values(2, 'se', '项目经理', 2, '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_post values(3, 'hr', '人力资源', 3, '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_post values(4, 'user', '普通员工', 4, '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 4、角色信息表
|
||||||
|
-- ----------------------------
|
||||||
|
drop table if exists sys_role;
|
||||||
|
create table sys_role (
|
||||||
|
role_id bigint(20) not null auto_increment comment '角色ID',
|
||||||
|
role_name varchar(30) not null comment '角色名称',
|
||||||
|
role_key varchar(100) not null comment '角色权限字符串',
|
||||||
|
role_sort int(4) not null comment '显示顺序',
|
||||||
|
data_scope char(1) default '1' comment '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)',
|
||||||
|
status char(1) not null comment '角色状态(0正常 1停用)',
|
||||||
|
del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)',
|
||||||
|
create_by varchar(64) default '' comment '创建者',
|
||||||
|
create_time datetime comment '创建时间',
|
||||||
|
update_by varchar(64) default '' comment '更新者',
|
||||||
|
update_time datetime comment '更新时间',
|
||||||
|
remark varchar(500) default null comment '备注',
|
||||||
|
primary key (role_id)
|
||||||
|
) engine=innodb auto_increment=100 comment = '角色信息表';
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 初始化-角色信息表数据
|
||||||
|
-- ----------------------------
|
||||||
|
insert into sys_role values('1', '超级管理员', 'admin', 1, 1, '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '超级管理员');
|
||||||
|
insert into sys_role values('2', '普通角色', 'common', 2, 2, '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '普通角色');
|
||||||
|
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 5、菜单权限表
|
||||||
|
-- ----------------------------
|
||||||
|
drop table if exists sys_menu;
|
||||||
|
create table sys_menu (
|
||||||
|
menu_id bigint(20) not null auto_increment comment '菜单ID',
|
||||||
|
menu_name varchar(50) not null comment '菜单名称',
|
||||||
|
parent_id bigint(20) default 0 comment '父菜单ID',
|
||||||
|
order_num int(4) default 0 comment '显示顺序',
|
||||||
|
url varchar(200) default '#' comment '请求地址',
|
||||||
|
target varchar(20) default '' comment '打开方式(menuItem页签 menuBlank新窗口)',
|
||||||
|
menu_type char(1) default '' comment '菜单类型(M目录 C菜单 F按钮)',
|
||||||
|
visible char(1) default 0 comment '菜单状态(0显示 1隐藏)',
|
||||||
|
perms varchar(100) default null comment '权限标识',
|
||||||
|
icon varchar(100) default '#' comment '菜单图标',
|
||||||
|
create_by varchar(64) default '' comment '创建者',
|
||||||
|
create_time datetime comment '创建时间',
|
||||||
|
update_by varchar(64) default '' comment '更新者',
|
||||||
|
update_time datetime comment '更新时间',
|
||||||
|
remark varchar(500) default '' comment '备注',
|
||||||
|
primary key (menu_id)
|
||||||
|
) engine=innodb auto_increment=2000 comment = '菜单权限表';
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 初始化-菜单信息表数据
|
||||||
|
-- ----------------------------
|
||||||
|
-- 一级菜单
|
||||||
|
insert into sys_menu values('1', '系统管理', '0', '1', '#', '', 'M', '0', '', 'fa fa-gear', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统管理目录');
|
||||||
|
insert into sys_menu values('2', '系统监控', '0', '2', '#', '', 'M', '0', '', 'fa fa-video-camera', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统监控目录');
|
||||||
|
insert into sys_menu values('3', '系统工具', '0', '3', '#', '', 'M', '0', '', 'fa fa-bars', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统工具目录');
|
||||||
|
insert into sys_menu values('4', '若依官网', '0', '4', 'http://ruoyi.vip', 'menuBlank', 'C', '0', '', 'fa fa-location-arrow', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '若依官网地址');
|
||||||
|
-- 二级菜单
|
||||||
|
insert into sys_menu values('100', '用户管理', '1', '1', '/system/user', '', 'C', '0', 'system:user:view', 'fa fa-user-o', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '用户管理菜单');
|
||||||
|
insert into sys_menu values('101', '角色管理', '1', '2', '/system/role', '', 'C', '0', 'system:role:view', 'fa fa-user-secret', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '角色管理菜单');
|
||||||
|
insert into sys_menu values('102', '菜单管理', '1', '3', '/system/menu', '', 'C', '0', 'system:menu:view', 'fa fa-th-list', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '菜单管理菜单');
|
||||||
|
insert into sys_menu values('103', '部门管理', '1', '4', '/system/dept', '', 'C', '0', 'system:dept:view', 'fa fa-outdent', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '部门管理菜单');
|
||||||
|
insert into sys_menu values('104', '岗位管理', '1', '5', '/system/post', '', 'C', '0', 'system:post:view', 'fa fa-address-card-o', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '岗位管理菜单');
|
||||||
|
insert into sys_menu values('105', '字典管理', '1', '6', '/system/dict', '', 'C', '0', 'system:dict:view', 'fa fa-bookmark-o', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '字典管理菜单');
|
||||||
|
insert into sys_menu values('106', '参数设置', '1', '7', '/system/config', '', 'C', '0', 'system:config:view', 'fa fa-sun-o', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '参数设置菜单');
|
||||||
|
insert into sys_menu values('107', '通知公告', '1', '8', '/system/notice', '', 'C', '0', 'system:notice:view', 'fa fa-bullhorn', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '通知公告菜单');
|
||||||
|
insert into sys_menu values('108', '日志管理', '1', '9', '#', '', 'M', '0', '', 'fa fa-pencil-square-o', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '日志管理菜单');
|
||||||
|
insert into sys_menu values('109', '在线用户', '2', '1', '/monitor/online', '', 'C', '0', 'monitor:online:view', 'fa fa-user-circle', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '在线用户菜单');
|
||||||
|
insert into sys_menu values('110', '定时任务', '2', '2', '/monitor/job', '', 'C', '0', 'monitor:job:view', 'fa fa-tasks', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '定时任务菜单');
|
||||||
|
insert into sys_menu values('111', '数据监控', '2', '3', '/monitor/data', '', 'C', '0', 'monitor:data:view', 'fa fa-bug', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '数据监控菜单');
|
||||||
|
insert into sys_menu values('112', '服务监控', '2', '3', '/monitor/server', '', 'C', '0', 'monitor:server:view', 'fa fa-server', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '服务监控菜单');
|
||||||
|
insert into sys_menu values('113', '表单构建', '3', '1', '/tool/build', '', 'C', '0', 'tool:build:view', 'fa fa-wpforms', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '表单构建菜单');
|
||||||
|
insert into sys_menu values('114', '代码生成', '3', '2', '/tool/gen', '', 'C', '0', 'tool:gen:view', 'fa fa-code', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '代码生成菜单');
|
||||||
|
insert into sys_menu values('115', '系统接口', '3', '3', '/tool/swagger', '', 'C', '0', 'tool:swagger:view', 'fa fa-gg', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统接口菜单');
|
||||||
|
-- 三级菜单
|
||||||
|
insert into sys_menu values('500', '操作日志', '108', '1', '/monitor/operlog', '', 'C', '0', 'monitor:operlog:view', 'fa fa-address-book', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '操作日志菜单');
|
||||||
|
insert into sys_menu values('501', '登录日志', '108', '2', '/monitor/logininfor', '', 'C', '0', 'monitor:logininfor:view', 'fa fa-file-image-o', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '登录日志菜单');
|
||||||
|
-- 用户管理按钮
|
||||||
|
insert into sys_menu values('1000', '用户查询', '100', '1', '#', '', 'F', '0', 'system:user:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1001', '用户新增', '100', '2', '#', '', 'F', '0', 'system:user:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1002', '用户修改', '100', '3', '#', '', 'F', '0', 'system:user:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1003', '用户删除', '100', '4', '#', '', 'F', '0', 'system:user:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1004', '用户导出', '100', '5', '#', '', 'F', '0', 'system:user:export', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1005', '用户导入', '100', '6', '#', '', 'F', '0', 'system:user:import', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1006', '重置密码', '100', '7', '#', '', 'F', '0', 'system:user:resetPwd', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
-- 角色管理按钮
|
||||||
|
insert into sys_menu values('1007', '角色查询', '101', '1', '#', '', 'F', '0', 'system:role:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1008', '角色新增', '101', '2', '#', '', 'F', '0', 'system:role:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1009', '角色修改', '101', '3', '#', '', 'F', '0', 'system:role:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1010', '角色删除', '101', '4', '#', '', 'F', '0', 'system:role:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1011', '角色导出', '101', '5', '#', '', 'F', '0', 'system:role:export', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
-- 菜单管理按钮
|
||||||
|
insert into sys_menu values('1012', '菜单查询', '102', '1', '#', '', 'F', '0', 'system:menu:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1013', '菜单新增', '102', '2', '#', '', 'F', '0', 'system:menu:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1014', '菜单修改', '102', '3', '#', '', 'F', '0', 'system:menu:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1015', '菜单删除', '102', '4', '#', '', 'F', '0', 'system:menu:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
-- 部门管理按钮
|
||||||
|
insert into sys_menu values('1016', '部门查询', '103', '1', '#', '', 'F', '0', 'system:dept:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1017', '部门新增', '103', '2', '#', '', 'F', '0', 'system:dept:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1018', '部门修改', '103', '3', '#', '', 'F', '0', 'system:dept:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1019', '部门删除', '103', '4', '#', '', 'F', '0', 'system:dept:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
-- 岗位管理按钮
|
||||||
|
insert into sys_menu values('1020', '岗位查询', '104', '1', '#', '', 'F', '0', 'system:post:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1021', '岗位新增', '104', '2', '#', '', 'F', '0', 'system:post:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1022', '岗位修改', '104', '3', '#', '', 'F', '0', 'system:post:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1023', '岗位删除', '104', '4', '#', '', 'F', '0', 'system:post:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1024', '岗位导出', '104', '5', '#', '', 'F', '0', 'system:post:export', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
-- 字典管理按钮
|
||||||
|
insert into sys_menu values('1025', '字典查询', '105', '1', '#', '', 'F', '0', 'system:dict:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1026', '字典新增', '105', '2', '#', '', 'F', '0', 'system:dict:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1027', '字典修改', '105', '3', '#', '', 'F', '0', 'system:dict:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1028', '字典删除', '105', '4', '#', '', 'F', '0', 'system:dict:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1029', '字典导出', '105', '5', '#', '', 'F', '0', 'system:dict:export', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
-- 参数设置按钮
|
||||||
|
insert into sys_menu values('1030', '参数查询', '106', '1', '#', '', 'F', '0', 'system:config:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1031', '参数新增', '106', '2', '#', '', 'F', '0', 'system:config:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1032', '参数修改', '106', '3', '#', '', 'F', '0', 'system:config:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1033', '参数删除', '106', '4', '#', '', 'F', '0', 'system:config:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1034', '参数导出', '106', '5', '#', '', 'F', '0', 'system:config:export', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
-- 通知公告按钮
|
||||||
|
insert into sys_menu values('1035', '公告查询', '107', '1', '#', '', 'F', '0', 'system:notice:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1036', '公告新增', '107', '2', '#', '', 'F', '0', 'system:notice:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1037', '公告修改', '107', '3', '#', '', 'F', '0', 'system:notice:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1038', '公告删除', '107', '4', '#', '', 'F', '0', 'system:notice:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
-- 操作日志按钮
|
||||||
|
insert into sys_menu values('1039', '操作查询', '500', '1', '#', '', 'F', '0', 'monitor:operlog:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1040', '操作删除', '500', '2', '#', '', 'F', '0', 'monitor:operlog:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1041', '详细信息', '500', '3', '#', '', 'F', '0', 'monitor:operlog:detail', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1042', '日志导出', '500', '4', '#', '', 'F', '0', 'monitor:operlog:export', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
-- 登录日志按钮
|
||||||
|
insert into sys_menu values('1043', '登录查询', '501', '1', '#', '', 'F', '0', 'monitor:logininfor:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1044', '登录删除', '501', '2', '#', '', 'F', '0', 'monitor:logininfor:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1045', '日志导出', '501', '3', '#', '', 'F', '0', 'monitor:logininfor:export', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1046', '账户解锁', '501', '4', '#', '', 'F', '0', 'monitor:logininfor:unlock', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
-- 在线用户按钮
|
||||||
|
insert into sys_menu values('1047', '在线查询', '109', '1', '#', '', 'F', '0', 'monitor:online:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1048', '批量强退', '109', '2', '#', '', 'F', '0', 'monitor:online:batchForceLogout', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1049', '单条强退', '109', '3', '#', '', 'F', '0', 'monitor:online:forceLogout', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
-- 定时任务按钮
|
||||||
|
insert into sys_menu values('1050', '任务查询', '110', '1', '#', '', 'F', '0', 'monitor:job:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1051', '任务新增', '110', '2', '#', '', 'F', '0', 'monitor:job:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1052', '任务修改', '110', '3', '#', '', 'F', '0', 'monitor:job:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1053', '任务删除', '110', '4', '#', '', 'F', '0', 'monitor:job:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1054', '状态修改', '110', '5', '#', '', 'F', '0', 'monitor:job:changeStatus', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1055', '任务详细', '110', '6', '#', '', 'F', '0', 'monitor:job:detail', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1056', '任务导出', '110', '7', '#', '', 'F', '0', 'monitor:job:export', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
-- 代码生成按钮
|
||||||
|
insert into sys_menu values('1057', '生成查询', '114', '1', '#', '', 'F', '0', 'tool:gen:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1058', '生成修改', '114', '2', '#', '', 'F', '0', 'tool:gen:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1059', '生成删除', '114', '3', '#', '', 'F', '0', 'tool:gen:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1060', '预览代码', '114', '4', '#', '', 'F', '0', 'tool:gen:preview', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_menu values('1061', '生成代码', '114', '5', '#', '', 'F', '0', 'tool:gen:code', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 6、用户和角色关联表 用户N-1角色
|
||||||
|
-- ----------------------------
|
||||||
|
drop table if exists sys_user_role;
|
||||||
|
create table sys_user_role (
|
||||||
|
user_id bigint(20) not null comment '用户ID',
|
||||||
|
role_id bigint(20) not null comment '角色ID',
|
||||||
|
primary key(user_id, role_id)
|
||||||
|
) engine=innodb comment = '用户和角色关联表';
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 初始化-用户和角色关联表数据
|
||||||
|
-- ----------------------------
|
||||||
|
insert into sys_user_role values ('1', '1');
|
||||||
|
insert into sys_user_role values ('2', '2');
|
||||||
|
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 7、角色和菜单关联表 角色1-N菜单
|
||||||
|
-- ----------------------------
|
||||||
|
drop table if exists sys_role_menu;
|
||||||
|
create table sys_role_menu (
|
||||||
|
role_id bigint(20) not null comment '角色ID',
|
||||||
|
menu_id bigint(20) not null comment '菜单ID',
|
||||||
|
primary key(role_id, menu_id)
|
||||||
|
) engine=innodb comment = '角色和菜单关联表';
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 初始化-角色和菜单关联表数据
|
||||||
|
-- ----------------------------
|
||||||
|
insert into sys_role_menu values ('2', '1');
|
||||||
|
insert into sys_role_menu values ('2', '2');
|
||||||
|
insert into sys_role_menu values ('2', '3');
|
||||||
|
insert into sys_role_menu values ('2', '4');
|
||||||
|
insert into sys_role_menu values ('2', '100');
|
||||||
|
insert into sys_role_menu values ('2', '101');
|
||||||
|
insert into sys_role_menu values ('2', '102');
|
||||||
|
insert into sys_role_menu values ('2', '103');
|
||||||
|
insert into sys_role_menu values ('2', '104');
|
||||||
|
insert into sys_role_menu values ('2', '105');
|
||||||
|
insert into sys_role_menu values ('2', '106');
|
||||||
|
insert into sys_role_menu values ('2', '107');
|
||||||
|
insert into sys_role_menu values ('2', '108');
|
||||||
|
insert into sys_role_menu values ('2', '109');
|
||||||
|
insert into sys_role_menu values ('2', '110');
|
||||||
|
insert into sys_role_menu values ('2', '111');
|
||||||
|
insert into sys_role_menu values ('2', '112');
|
||||||
|
insert into sys_role_menu values ('2', '113');
|
||||||
|
insert into sys_role_menu values ('2', '114');
|
||||||
|
insert into sys_role_menu values ('2', '115');
|
||||||
|
insert into sys_role_menu values ('2', '500');
|
||||||
|
insert into sys_role_menu values ('2', '501');
|
||||||
|
insert into sys_role_menu values ('2', '1000');
|
||||||
|
insert into sys_role_menu values ('2', '1001');
|
||||||
|
insert into sys_role_menu values ('2', '1002');
|
||||||
|
insert into sys_role_menu values ('2', '1003');
|
||||||
|
insert into sys_role_menu values ('2', '1004');
|
||||||
|
insert into sys_role_menu values ('2', '1005');
|
||||||
|
insert into sys_role_menu values ('2', '1006');
|
||||||
|
insert into sys_role_menu values ('2', '1007');
|
||||||
|
insert into sys_role_menu values ('2', '1008');
|
||||||
|
insert into sys_role_menu values ('2', '1009');
|
||||||
|
insert into sys_role_menu values ('2', '1010');
|
||||||
|
insert into sys_role_menu values ('2', '1011');
|
||||||
|
insert into sys_role_menu values ('2', '1012');
|
||||||
|
insert into sys_role_menu values ('2', '1013');
|
||||||
|
insert into sys_role_menu values ('2', '1014');
|
||||||
|
insert into sys_role_menu values ('2', '1015');
|
||||||
|
insert into sys_role_menu values ('2', '1016');
|
||||||
|
insert into sys_role_menu values ('2', '1017');
|
||||||
|
insert into sys_role_menu values ('2', '1018');
|
||||||
|
insert into sys_role_menu values ('2', '1019');
|
||||||
|
insert into sys_role_menu values ('2', '1020');
|
||||||
|
insert into sys_role_menu values ('2', '1021');
|
||||||
|
insert into sys_role_menu values ('2', '1022');
|
||||||
|
insert into sys_role_menu values ('2', '1023');
|
||||||
|
insert into sys_role_menu values ('2', '1024');
|
||||||
|
insert into sys_role_menu values ('2', '1025');
|
||||||
|
insert into sys_role_menu values ('2', '1026');
|
||||||
|
insert into sys_role_menu values ('2', '1027');
|
||||||
|
insert into sys_role_menu values ('2', '1028');
|
||||||
|
insert into sys_role_menu values ('2', '1029');
|
||||||
|
insert into sys_role_menu values ('2', '1030');
|
||||||
|
insert into sys_role_menu values ('2', '1031');
|
||||||
|
insert into sys_role_menu values ('2', '1032');
|
||||||
|
insert into sys_role_menu values ('2', '1033');
|
||||||
|
insert into sys_role_menu values ('2', '1034');
|
||||||
|
insert into sys_role_menu values ('2', '1035');
|
||||||
|
insert into sys_role_menu values ('2', '1036');
|
||||||
|
insert into sys_role_menu values ('2', '1037');
|
||||||
|
insert into sys_role_menu values ('2', '1038');
|
||||||
|
insert into sys_role_menu values ('2', '1039');
|
||||||
|
insert into sys_role_menu values ('2', '1040');
|
||||||
|
insert into sys_role_menu values ('2', '1041');
|
||||||
|
insert into sys_role_menu values ('2', '1042');
|
||||||
|
insert into sys_role_menu values ('2', '1043');
|
||||||
|
insert into sys_role_menu values ('2', '1044');
|
||||||
|
insert into sys_role_menu values ('2', '1045');
|
||||||
|
insert into sys_role_menu values ('2', '1046');
|
||||||
|
insert into sys_role_menu values ('2', '1047');
|
||||||
|
insert into sys_role_menu values ('2', '1048');
|
||||||
|
insert into sys_role_menu values ('2', '1049');
|
||||||
|
insert into sys_role_menu values ('2', '1050');
|
||||||
|
insert into sys_role_menu values ('2', '1051');
|
||||||
|
insert into sys_role_menu values ('2', '1052');
|
||||||
|
insert into sys_role_menu values ('2', '1053');
|
||||||
|
insert into sys_role_menu values ('2', '1054');
|
||||||
|
insert into sys_role_menu values ('2', '1055');
|
||||||
|
insert into sys_role_menu values ('2', '1056');
|
||||||
|
insert into sys_role_menu values ('2', '1057');
|
||||||
|
insert into sys_role_menu values ('2', '1058');
|
||||||
|
insert into sys_role_menu values ('2', '1059');
|
||||||
|
insert into sys_role_menu values ('2', '1060');
|
||||||
|
insert into sys_role_menu values ('2', '1061');
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 8、角色和部门关联表 角色1-N部门
|
||||||
|
-- ----------------------------
|
||||||
|
drop table if exists sys_role_dept;
|
||||||
|
create table sys_role_dept (
|
||||||
|
role_id bigint(20) not null comment '角色ID',
|
||||||
|
dept_id bigint(20) not null comment '部门ID',
|
||||||
|
primary key(role_id, dept_id)
|
||||||
|
) engine=innodb comment = '角色和部门关联表';
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 初始化-角色和部门关联表数据
|
||||||
|
-- ----------------------------
|
||||||
|
insert into sys_role_dept values ('2', '100');
|
||||||
|
insert into sys_role_dept values ('2', '101');
|
||||||
|
insert into sys_role_dept values ('2', '105');
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 9、用户与岗位关联表 用户1-N岗位
|
||||||
|
-- ----------------------------
|
||||||
|
drop table if exists sys_user_post;
|
||||||
|
create table sys_user_post
|
||||||
|
(
|
||||||
|
user_id bigint(20) not null comment '用户ID',
|
||||||
|
post_id bigint(20) not null comment '岗位ID',
|
||||||
|
primary key (user_id, post_id)
|
||||||
|
) engine=innodb comment = '用户与岗位关联表';
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 初始化-用户与岗位关联表数据
|
||||||
|
-- ----------------------------
|
||||||
|
insert into sys_user_post values ('1', '1');
|
||||||
|
insert into sys_user_post values ('2', '2');
|
||||||
|
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 10、操作日志记录
|
||||||
|
-- ----------------------------
|
||||||
|
drop table if exists sys_oper_log;
|
||||||
|
create table sys_oper_log (
|
||||||
|
oper_id bigint(20) not null auto_increment comment '日志主键',
|
||||||
|
title varchar(50) default '' comment '模块标题',
|
||||||
|
business_type int(2) default 0 comment '业务类型(0其它 1新增 2修改 3删除)',
|
||||||
|
method varchar(100) default '' comment '方法名称',
|
||||||
|
request_method varchar(10) default '' comment '请求方式',
|
||||||
|
operator_type int(1) default 0 comment '操作类别(0其它 1后台用户 2手机端用户)',
|
||||||
|
oper_name varchar(50) default '' comment '操作人员',
|
||||||
|
dept_name varchar(50) default '' comment '部门名称',
|
||||||
|
oper_url varchar(255) default '' comment '请求URL',
|
||||||
|
oper_ip varchar(50) default '' comment '主机地址',
|
||||||
|
oper_location varchar(255) default '' comment '操作地点',
|
||||||
|
oper_param varchar(2000) default '' comment '请求参数',
|
||||||
|
json_result varchar(2000) default '' comment '返回参数',
|
||||||
|
status int(1) default 0 comment '操作状态(0正常 1异常)',
|
||||||
|
error_msg varchar(2000) default '' comment '错误消息',
|
||||||
|
oper_time datetime comment '操作时间',
|
||||||
|
primary key (oper_id)
|
||||||
|
) engine=innodb auto_increment=100 comment = '操作日志记录';
|
||||||
|
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 11、字典类型表
|
||||||
|
-- ----------------------------
|
||||||
|
drop table if exists sys_dict_type;
|
||||||
|
create table sys_dict_type
|
||||||
|
(
|
||||||
|
dict_id bigint(20) not null auto_increment comment '字典主键',
|
||||||
|
dict_name varchar(100) default '' comment '字典名称',
|
||||||
|
dict_type varchar(100) default '' comment '字典类型',
|
||||||
|
status char(1) default '0' comment '状态(0正常 1停用)',
|
||||||
|
create_by varchar(64) default '' comment '创建者',
|
||||||
|
create_time datetime comment '创建时间',
|
||||||
|
update_by varchar(64) default '' comment '更新者',
|
||||||
|
update_time datetime comment '更新时间',
|
||||||
|
remark varchar(500) default null comment '备注',
|
||||||
|
primary key (dict_id),
|
||||||
|
unique (dict_type)
|
||||||
|
) engine=innodb auto_increment=100 comment = '字典类型表';
|
||||||
|
|
||||||
|
insert into sys_dict_type values(1, '用户性别', 'sys_user_sex', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '用户性别列表');
|
||||||
|
insert into sys_dict_type values(2, '菜单状态', 'sys_show_hide', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '菜单状态列表');
|
||||||
|
insert into sys_dict_type values(3, '系统开关', 'sys_normal_disable', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统开关列表');
|
||||||
|
insert into sys_dict_type values(4, '任务状态', 'sys_job_status', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '任务状态列表');
|
||||||
|
insert into sys_dict_type values(5, '任务分组', 'sys_job_group', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '任务分组列表');
|
||||||
|
insert into sys_dict_type values(6, '系统是否', 'sys_yes_no', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统是否列表');
|
||||||
|
insert into sys_dict_type values(7, '通知类型', 'sys_notice_type', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '通知类型列表');
|
||||||
|
insert into sys_dict_type values(8, '通知状态', 'sys_notice_status', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '通知状态列表');
|
||||||
|
insert into sys_dict_type values(9, '操作类型', 'sys_oper_type', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '操作类型列表');
|
||||||
|
insert into sys_dict_type values(10, '系统状态', 'sys_common_status', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '登录状态列表');
|
||||||
|
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 12、字典数据表
|
||||||
|
-- ----------------------------
|
||||||
|
drop table if exists sys_dict_data;
|
||||||
|
create table sys_dict_data
|
||||||
|
(
|
||||||
|
dict_code bigint(20) not null auto_increment comment '字典编码',
|
||||||
|
dict_sort int(4) default 0 comment '字典排序',
|
||||||
|
dict_label varchar(100) default '' comment '字典标签',
|
||||||
|
dict_value varchar(100) default '' comment '字典键值',
|
||||||
|
dict_type varchar(100) default '' comment '字典类型',
|
||||||
|
css_class varchar(100) default null comment '样式属性(其他样式扩展)',
|
||||||
|
list_class varchar(100) default null comment '表格回显样式',
|
||||||
|
is_default char(1) default 'N' comment '是否默认(Y是 N否)',
|
||||||
|
status char(1) default '0' comment '状态(0正常 1停用)',
|
||||||
|
create_by varchar(64) default '' comment '创建者',
|
||||||
|
create_time datetime comment '创建时间',
|
||||||
|
update_by varchar(64) default '' comment '更新者',
|
||||||
|
update_time datetime comment '更新时间',
|
||||||
|
remark varchar(500) default null comment '备注',
|
||||||
|
primary key (dict_code)
|
||||||
|
) engine=innodb auto_increment=100 comment = '字典数据表';
|
||||||
|
|
||||||
|
insert into sys_dict_data values(1, 1, '男', '0', 'sys_user_sex', '', '', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '性别男');
|
||||||
|
insert into sys_dict_data values(2, 2, '女', '1', 'sys_user_sex', '', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '性别女');
|
||||||
|
insert into sys_dict_data values(3, 3, '未知', '2', 'sys_user_sex', '', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '性别未知');
|
||||||
|
insert into sys_dict_data values(4, 1, '显示', '0', 'sys_show_hide', '', 'primary', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '显示菜单');
|
||||||
|
insert into sys_dict_data values(5, 2, '隐藏', '1', 'sys_show_hide', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '隐藏菜单');
|
||||||
|
insert into sys_dict_data values(6, 1, '正常', '0', 'sys_normal_disable', '', 'primary', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态');
|
||||||
|
insert into sys_dict_data values(7, 2, '停用', '1', 'sys_normal_disable', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '停用状态');
|
||||||
|
insert into sys_dict_data values(8, 1, '正常', '0', 'sys_job_status', '', 'primary', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态');
|
||||||
|
insert into sys_dict_data values(9, 2, '暂停', '1', 'sys_job_status', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '停用状态');
|
||||||
|
insert into sys_dict_data values(10, 1, '默认', 'DEFAULT', 'sys_job_group', '', '', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '默认分组');
|
||||||
|
insert into sys_dict_data values(11, 2, '系统', 'SYSTEM', 'sys_job_group', '', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统分组');
|
||||||
|
insert into sys_dict_data values(12, 1, '是', 'Y', 'sys_yes_no', '', 'primary', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统默认是');
|
||||||
|
insert into sys_dict_data values(13, 2, '否', 'N', 'sys_yes_no', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统默认否');
|
||||||
|
insert into sys_dict_data values(14, 1, '通知', '1', 'sys_notice_type', '', 'warning', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '通知');
|
||||||
|
insert into sys_dict_data values(15, 2, '公告', '2', 'sys_notice_type', '', 'success', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '公告');
|
||||||
|
insert into sys_dict_data values(16, 1, '正常', '0', 'sys_notice_status', '', 'primary', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态');
|
||||||
|
insert into sys_dict_data values(17, 2, '关闭', '1', 'sys_notice_status', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '关闭状态');
|
||||||
|
insert into sys_dict_data values(18, 99, '其他', '0', 'sys_oper_type', '', 'info', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '其他操作');
|
||||||
|
insert into sys_dict_data values(19, 1, '新增', '1', 'sys_oper_type', '', 'info', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作');
|
||||||
|
insert into sys_dict_data values(20, 2, '修改', '2', 'sys_oper_type', '', 'info', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '修改操作');
|
||||||
|
insert into sys_dict_data values(21, 3, '删除', '3', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '删除操作');
|
||||||
|
insert into sys_dict_data values(22, 4, '授权', '4', 'sys_oper_type', '', 'primary', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '授权操作');
|
||||||
|
insert into sys_dict_data values(23, 5, '导出', '5', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '导出操作');
|
||||||
|
insert into sys_dict_data values(24, 6, '导入', '6', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '导入操作');
|
||||||
|
insert into sys_dict_data values(25, 7, '强退', '7', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '强退操作');
|
||||||
|
insert into sys_dict_data values(26, 8, '生成代码', '8', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '生成操作');
|
||||||
|
insert into sys_dict_data values(27, 9, '清空数据', '9', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '清空操作');
|
||||||
|
insert into sys_dict_data values(28, 1, '成功', '0', 'sys_common_status', '', 'primary', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态');
|
||||||
|
insert into sys_dict_data values(29, 2, '失败', '1', 'sys_common_status', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '停用状态');
|
||||||
|
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 13、参数配置表
|
||||||
|
-- ----------------------------
|
||||||
|
drop table if exists sys_config;
|
||||||
|
create table sys_config (
|
||||||
|
config_id int(5) not null auto_increment comment '参数主键',
|
||||||
|
config_name varchar(100) default '' comment '参数名称',
|
||||||
|
config_key varchar(100) default '' comment '参数键名',
|
||||||
|
config_value varchar(500) default '' comment '参数键值',
|
||||||
|
config_type char(1) default 'N' comment '系统内置(Y是 N否)',
|
||||||
|
create_by varchar(64) default '' comment '创建者',
|
||||||
|
create_time datetime comment '创建时间',
|
||||||
|
update_by varchar(64) default '' comment '更新者',
|
||||||
|
update_time datetime comment '更新时间',
|
||||||
|
remark varchar(500) default null comment '备注',
|
||||||
|
primary key (config_id)
|
||||||
|
) engine=innodb auto_increment=100 comment = '参数配置表';
|
||||||
|
|
||||||
|
insert into sys_config values(1, '主框架页-默认皮肤样式名称', 'sys.index.skinName', 'skin-blue', 'Y', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow');
|
||||||
|
insert into sys_config values(2, '用户管理-账号初始密码', 'sys.user.initPassword', '123456', 'Y', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '初始化密码 123456');
|
||||||
|
insert into sys_config values(3, '主框架页-侧边栏主题', 'sys.index.sideTheme', 'theme-dark', 'Y', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '深黑主题theme-dark,浅色主题theme-light,深蓝主题theme-blue');
|
||||||
|
insert into sys_config values(4, '账号自助-是否开启用户注册功能', 'sys.account.registerUser', 'false', 'Y', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '是否开启注册用户功能(true开启,false关闭)');
|
||||||
|
insert into sys_config values(5, '用户管理-密码字符范围', 'sys.account.chrtype', '0', 'Y', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '默认任意字符范围,0任意(密码可以输入任意字符),1数字(密码只能为0-9数字),2英文字母(密码只能为a-z和A-Z字母),3字母和数字(密码必须包含字母,数字),4字母数组和特殊字符(密码必须包含字母,数字,特殊字符-_)');
|
||||||
|
insert into sys_config values(6, '主框架页-菜单导航显示风格', 'sys.index.menuStyle', 'default', 'Y', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '菜单导航显示风格(default为左侧导航菜单,topnav为顶部导航菜单)');
|
||||||
|
insert into sys_config values(7, '主框架页-是否开启页脚', 'sys.index.ignoreFooter', 'true', 'Y', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '是否开启底部页脚显示(true显示,false隐藏)');
|
||||||
|
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 14、系统访问记录
|
||||||
|
-- ----------------------------
|
||||||
|
drop table if exists sys_logininfor;
|
||||||
|
create table sys_logininfor (
|
||||||
|
info_id bigint(20) not null auto_increment comment '访问ID',
|
||||||
|
login_name varchar(50) default '' comment '登录账号',
|
||||||
|
ipaddr varchar(50) default '' comment '登录IP地址',
|
||||||
|
login_location varchar(255) default '' comment '登录地点',
|
||||||
|
browser varchar(50) default '' comment '浏览器类型',
|
||||||
|
os varchar(50) default '' comment '操作系统',
|
||||||
|
status char(1) default '0' comment '登录状态(0成功 1失败)',
|
||||||
|
msg varchar(255) default '' comment '提示消息',
|
||||||
|
login_time datetime comment '访问时间',
|
||||||
|
primary key (info_id)
|
||||||
|
) engine=innodb auto_increment=100 comment = '系统访问记录';
|
||||||
|
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 15、在线用户记录
|
||||||
|
-- ----------------------------
|
||||||
|
drop table if exists sys_user_online;
|
||||||
|
create table sys_user_online (
|
||||||
|
sessionId varchar(50) default '' comment '用户会话id',
|
||||||
|
login_name varchar(50) default '' comment '登录账号',
|
||||||
|
dept_name varchar(50) default '' comment '部门名称',
|
||||||
|
ipaddr varchar(50) default '' comment '登录IP地址',
|
||||||
|
login_location varchar(255) default '' comment '登录地点',
|
||||||
|
browser varchar(50) default '' comment '浏览器类型',
|
||||||
|
os varchar(50) default '' comment '操作系统',
|
||||||
|
status varchar(10) default '' comment '在线状态on_line在线off_line离线',
|
||||||
|
start_timestamp datetime comment 'session创建时间',
|
||||||
|
last_access_time datetime comment 'session最后访问时间',
|
||||||
|
expire_time int(5) default 0 comment '超时时间,单位为分钟',
|
||||||
|
primary key (sessionId)
|
||||||
|
) engine=innodb comment = '在线用户记录';
|
||||||
|
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 16、定时任务调度表
|
||||||
|
-- ----------------------------
|
||||||
|
drop table if exists sys_job;
|
||||||
|
create table sys_job (
|
||||||
|
job_id bigint(20) not null auto_increment comment '任务ID',
|
||||||
|
job_name varchar(64) default '' comment '任务名称',
|
||||||
|
job_group varchar(64) default 'DEFAULT' comment '任务组名',
|
||||||
|
invoke_target varchar(500) not null comment '调用目标字符串',
|
||||||
|
cron_expression varchar(255) default '' comment 'cron执行表达式',
|
||||||
|
misfire_policy varchar(20) default '3' comment '计划执行错误策略(1立即执行 2执行一次 3放弃执行)',
|
||||||
|
concurrent char(1) default '1' comment '是否并发执行(0允许 1禁止)',
|
||||||
|
status char(1) default '0' comment '状态(0正常 1暂停)',
|
||||||
|
create_by varchar(64) default '' comment '创建者',
|
||||||
|
create_time datetime comment '创建时间',
|
||||||
|
update_by varchar(64) default '' comment '更新者',
|
||||||
|
update_time datetime comment '更新时间',
|
||||||
|
remark varchar(500) default '' comment '备注信息',
|
||||||
|
primary key (job_id, job_name, job_group)
|
||||||
|
) engine=innodb auto_increment=100 comment = '定时任务调度表';
|
||||||
|
|
||||||
|
insert into sys_job values(1, '系统默认(无参)', 'DEFAULT', 'ryTask.ryNoParams', '0/10 * * * * ?', '3', '1', '1', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_job values(2, '系统默认(有参)', 'DEFAULT', 'ryTask.ryParams(\'ry\')', '0/15 * * * * ?', '3', '1', '1', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
insert into sys_job values(3, '系统默认(多参)', 'DEFAULT', 'ryTask.ryMultipleParams(\'ry\', true, 2000L, 316.50D, 100)', '0/20 * * * * ?', '3', '1', '1', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '');
|
||||||
|
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 17、定时任务调度日志表
|
||||||
|
-- ----------------------------
|
||||||
|
drop table if exists sys_job_log;
|
||||||
|
create table sys_job_log (
|
||||||
|
job_log_id bigint(20) not null auto_increment comment '任务日志ID',
|
||||||
|
job_name varchar(64) not null comment '任务名称',
|
||||||
|
job_group varchar(64) not null comment '任务组名',
|
||||||
|
invoke_target varchar(500) not null comment '调用目标字符串',
|
||||||
|
job_message varchar(500) comment '日志信息',
|
||||||
|
status char(1) default '0' comment '执行状态(0正常 1失败)',
|
||||||
|
exception_info varchar(2000) default '' comment '异常信息',
|
||||||
|
create_time datetime comment '创建时间',
|
||||||
|
primary key (job_log_id)
|
||||||
|
) engine=innodb comment = '定时任务调度日志表';
|
||||||
|
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 18、通知公告表
|
||||||
|
-- ----------------------------
|
||||||
|
drop table if exists sys_notice;
|
||||||
|
create table sys_notice (
|
||||||
|
notice_id int(4) not null auto_increment comment '公告ID',
|
||||||
|
notice_title varchar(50) not null comment '公告标题',
|
||||||
|
notice_type char(1) not null comment '公告类型(1通知 2公告)',
|
||||||
|
notice_content varchar(2000) default null comment '公告内容',
|
||||||
|
status char(1) default '0' comment '公告状态(0正常 1关闭)',
|
||||||
|
create_by varchar(64) default '' comment '创建者',
|
||||||
|
create_time datetime comment '创建时间',
|
||||||
|
update_by varchar(64) default '' comment '更新者',
|
||||||
|
update_time datetime comment '更新时间',
|
||||||
|
remark varchar(255) default null comment '备注',
|
||||||
|
primary key (notice_id)
|
||||||
|
) engine=innodb auto_increment=10 comment = '通知公告表';
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 初始化-公告信息表数据
|
||||||
|
-- ----------------------------
|
||||||
|
insert into sys_notice values('1', '温馨提醒:2018-07-01 若依新版本发布啦', '2', '新版本内容', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '管理员');
|
||||||
|
insert into sys_notice values('2', '维护通知:2018-07-01 若依系统凌晨维护', '1', '维护内容', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '管理员');
|
||||||
|
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 19、代码生成业务表
|
||||||
|
-- ----------------------------
|
||||||
|
drop table if exists gen_table;
|
||||||
|
create table gen_table (
|
||||||
|
table_id bigint(20) not null auto_increment comment '编号',
|
||||||
|
table_name varchar(200) default '' comment '表名称',
|
||||||
|
table_comment varchar(500) default '' comment '表描述',
|
||||||
|
sub_table_name varchar(64) default null comment '关联子表的表名',
|
||||||
|
sub_table_fk_name varchar(64) default null comment '子表关联的外键名',
|
||||||
|
class_name varchar(100) default '' comment '实体类名称',
|
||||||
|
tpl_category varchar(200) default 'crud' comment '使用的模板(crud单表操作 tree树表操作 sub主子表操作)',
|
||||||
|
package_name varchar(100) comment '生成包路径',
|
||||||
|
module_name varchar(30) comment '生成模块名',
|
||||||
|
business_name varchar(30) comment '生成业务名',
|
||||||
|
function_name varchar(50) comment '生成功能名',
|
||||||
|
function_author varchar(50) comment '生成功能作者',
|
||||||
|
gen_type char(1) default '0' comment '生成代码方式(0zip压缩包 1自定义路径)',
|
||||||
|
gen_path varchar(200) default '/' comment '生成路径(不填默认项目路径)',
|
||||||
|
options varchar(1000) comment '其它生成选项',
|
||||||
|
create_by varchar(64) default '' comment '创建者',
|
||||||
|
create_time datetime comment '创建时间',
|
||||||
|
update_by varchar(64) default '' comment '更新者',
|
||||||
|
update_time datetime comment '更新时间',
|
||||||
|
remark varchar(500) default null comment '备注',
|
||||||
|
primary key (table_id)
|
||||||
|
) engine=innodb auto_increment=1 comment = '代码生成业务表';
|
||||||
|
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 20、代码生成业务表字段
|
||||||
|
-- ----------------------------
|
||||||
|
drop table if exists gen_table_column;
|
||||||
|
create table gen_table_column (
|
||||||
|
column_id bigint(20) not null auto_increment comment '编号',
|
||||||
|
table_id varchar(64) comment '归属表编号',
|
||||||
|
column_name varchar(200) comment '列名称',
|
||||||
|
column_comment varchar(500) comment '列描述',
|
||||||
|
column_type varchar(100) comment '列类型',
|
||||||
|
java_type varchar(500) comment 'JAVA类型',
|
||||||
|
java_field varchar(200) comment 'JAVA字段名',
|
||||||
|
is_pk char(1) comment '是否主键(1是)',
|
||||||
|
is_increment char(1) comment '是否自增(1是)',
|
||||||
|
is_required char(1) comment '是否必填(1是)',
|
||||||
|
is_insert char(1) comment '是否为插入字段(1是)',
|
||||||
|
is_edit char(1) comment '是否编辑字段(1是)',
|
||||||
|
is_list char(1) comment '是否列表字段(1是)',
|
||||||
|
is_query char(1) comment '是否查询字段(1是)',
|
||||||
|
query_type varchar(200) default 'EQ' comment '查询方式(等于、不等于、大于、小于、范围)',
|
||||||
|
html_type varchar(200) comment '显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)',
|
||||||
|
dict_type varchar(200) default '' comment '字典类型',
|
||||||
|
sort int comment '排序',
|
||||||
|
create_by varchar(64) default '' comment '创建者',
|
||||||
|
create_time datetime comment '创建时间',
|
||||||
|
update_by varchar(64) default '' comment '更新者',
|
||||||
|
update_time datetime comment '更新时间',
|
||||||
|
primary key (column_id)
|
||||||
|
) engine=innodb auto_increment=1 comment = '代码生成业务表字段';
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
UPDATE sys_menu SET parent_id = NULL WHERE parent_id = 0;
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
hibernate.cache.use_second_level_cache=true
|
||||||
|
hibernate.cache.region.factory_class=com.ruoyi.framework.ehcache.MyJCacheRegionFactory
|
||||||
|
hibernate.cache.use_query_cache=true
|
||||||
|
hibernate.generate_statistics=true
|
||||||
|
hibernate.javax.cache.uri=hibernate_2level_ehcache.xml
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
<config xmlns="http://www.ehcache.org/v3"
|
||||||
|
xmlns:jsr107="http://www.ehcache.org/v3/jsr107">
|
||||||
|
|
||||||
|
<service>
|
||||||
|
<jsr107:defaults enable-management="true" enable-statistics="false"/>
|
||||||
|
</service>
|
||||||
|
|
||||||
|
<!--指定缓存目录-->
|
||||||
|
<persistence directory="${java.io.tmpdir}/hibernate-ehcache"/>
|
||||||
|
|
||||||
|
<!--缓存模板-->
|
||||||
|
<cache-template name="default">
|
||||||
|
<expiry>
|
||||||
|
<tti>600</tti>
|
||||||
|
</expiry>
|
||||||
|
<resources>
|
||||||
|
<heap>500</heap>
|
||||||
|
</resources>
|
||||||
|
</cache-template>
|
||||||
|
|
||||||
|
<cache alias="com.ruoyi.system.domain.SysDept" uses-template="default"/>
|
||||||
|
|
||||||
|
</config>
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
<body class="white-bg">
|
<body class="white-bg">
|
||||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||||
<form class="form-horizontal m" id="form-dept-add">
|
<form class="form-horizontal m" id="form-dept-add">
|
||||||
<input id="treeId" name="parentId" type="hidden" th:value="${dept.deptId}" />
|
<input id="treeId" name="parent" type="hidden" th:value="${dept.deptId}" />
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">上级部门:</label>
|
<label class="col-sm-3 control-label">上级部门:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="btn-group-sm" id="toolbar" role="group">
|
<div class="btn-group-sm" id="toolbar" role="group">
|
||||||
<a class="btn btn-success" onclick="$.operate.add(100)" shiro:hasPermission="system:dept:add">
|
<a class="btn btn-success" onclick="$.operate.add(1)" shiro:hasPermission="system:dept:add">
|
||||||
<i class="fa fa-plus"></i> 新增
|
<i class="fa fa-plus"></i> 新增
|
||||||
</a>
|
</a>
|
||||||
<a class="btn btn-primary" onclick="$.operate.edit()" shiro:hasPermission="system:dept:edit">
|
<a class="btn btn-primary" onclick="$.operate.edit()" shiro:hasPermission="system:dept:edit">
|
||||||
|
|
@ -50,13 +50,13 @@
|
||||||
var editFlag = [[${@permission.hasPermi('system:dept:edit')}]];
|
var editFlag = [[${@permission.hasPermi('system:dept:edit')}]];
|
||||||
var removeFlag = [[${@permission.hasPermi('system:dept:remove')}]];
|
var removeFlag = [[${@permission.hasPermi('system:dept:remove')}]];
|
||||||
var datas = [[${@dict.getType('sys_normal_disable')}]];
|
var datas = [[${@dict.getType('sys_normal_disable')}]];
|
||||||
var prefix = ctx + "system/dept"
|
var prefix = ctx + "system/dept";
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
var options = {
|
var options = {
|
||||||
code: "deptId",
|
code: "deptId",
|
||||||
parentCode: "parentId",
|
parentCode: "parentId",
|
||||||
uniqueId: "deptId",
|
uniqueId: "deptId",
|
||||||
|
rootIdValue: null,
|
||||||
url: prefix + "/list",
|
url: prefix + "/list",
|
||||||
createUrl: prefix + "/add/{id}",
|
createUrl: prefix + "/add/{id}",
|
||||||
updateUrl: prefix + "/edit/{id}",
|
updateUrl: prefix + "/edit/{id}",
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,12 @@
|
||||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||||
<form class="form-horizontal m" id="form-dept-edit" th:object="${dept}">
|
<form class="form-horizontal m" id="form-dept-edit" th:object="${dept}">
|
||||||
<input name="deptId" type="hidden" th:field="*{deptId}" />
|
<input name="deptId" type="hidden" th:field="*{deptId}" />
|
||||||
<input id="treeId" name="parentId" type="hidden" th:field="*{parentId}" />
|
<input id="treeId" name="parent" type="hidden" th:field="*{parent.deptId}" />
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">上级部门:</label>
|
<label class="col-sm-3 control-label">上级部门:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input class="form-control" type="text" id="treeName" onclick="selectDeptTree()" readonly="true" th:field="*{parentName}">
|
<input class="form-control" type="text" id="treeName" onclick="selectDeptTree()" readonly="true" th:field="*{parent.deptName}">
|
||||||
<span class="input-group-addon"><i class="fa fa-search"></i></span>
|
<span class="input-group-addon"><i class="fa fa-search"></i></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@
|
||||||
"roleSort": roleSort,
|
"roleSort": roleSort,
|
||||||
"status": status,
|
"status": status,
|
||||||
"remark": remark,
|
"remark": remark,
|
||||||
"menuIds": menuIds
|
"menus": menuIds
|
||||||
},
|
},
|
||||||
async : false,
|
async : false,
|
||||||
error : function(request) {
|
error : function(request) {
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@
|
||||||
|
|
||||||
function queryParams(params) {
|
function queryParams(params) {
|
||||||
var search = $.table.queryParams(params);
|
var search = $.table.queryParams(params);
|
||||||
search.roleId = $("#roleId").val();
|
search.roles = $("#roleId").val();
|
||||||
return search;
|
return search;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
<div class="main-content">
|
<div class="main-content">
|
||||||
<form class="form-horizontal" id="form-user-edit" th:object="${user}">
|
<form class="form-horizontal" id="form-user-edit" th:object="${user}">
|
||||||
<input name="userId" type="hidden" th:field="*{userId}" />
|
<input name="userId" type="hidden" th:field="*{userId}" />
|
||||||
<input name="deptId" type="hidden" th:field="*{deptId}" id="treeId"/>
|
<input name="dept.deptId" type="hidden" th:field="*{dept.deptId}" id="treeId"/>
|
||||||
<h4 class="form-header h4">基本信息</h4>
|
<h4 class="form-header h4">基本信息</h4>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
|
|
@ -58,7 +58,7 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-4 control-label is-required">登录账号:</label>
|
<label class="col-sm-4 control-label"><span style="color: red; ">*</span>登录账号:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input class="form-control" type="text" readonly="true" th:field="*{loginName}"/>
|
<input class="form-control" type="text" readonly="true" th:field="*{loginName}"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -82,7 +82,7 @@
|
||||||
<label class="col-sm-4 control-label">岗位:</label>
|
<label class="col-sm-4 control-label">岗位:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<select id="post" class="form-control select2-multiple" multiple>
|
<select id="post" class="form-control select2-multiple" multiple>
|
||||||
<option th:each="post:${posts}" th:value="${post.postId}" th:text="${post.postName}" th:selected="${post.flag}" th:disabled="${post.status == '1'}"></option>
|
<option th:each="post:${posts}" th:value="${post.postId}" th:text="${post.postName}" th:selected="${post.flag}" th:disabled="${post.status == '1'}" th:field="*{posts}"></option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -104,7 +104,7 @@
|
||||||
<label class="col-xs-2 control-label">角色:</label>
|
<label class="col-xs-2 control-label">角色:</label>
|
||||||
<div class="col-xs-10">
|
<div class="col-xs-10">
|
||||||
<label th:each="role:${roles}" class="check-box">
|
<label th:each="role:${roles}" class="check-box">
|
||||||
<input name="role" type="checkbox" th:value="${role.roleId}" th:text="${role.roleName}" th:checked="${role.flag}" th:disabled="${role.status == '1'}">
|
<input name="role" type="checkbox" th:value="${role.roleId}" th:text="${role.roleName}" th:checked="${role.flag}" th:disabled="${role.status == '1'}" th:field="*{roles}">
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -194,8 +194,8 @@
|
||||||
var roleIds = $.form.selectCheckeds("role");
|
var roleIds = $.form.selectCheckeds("role");
|
||||||
var postIds = $.form.selectSelects("post");
|
var postIds = $.form.selectSelects("post");
|
||||||
data.push({"name": "status", "value": status});
|
data.push({"name": "status", "value": status});
|
||||||
data.push({"name": "roleIds", "value": roleIds});
|
data.push({"name": "roles", "value": roleIds});
|
||||||
data.push({"name": "postIds", "value": postIds});
|
data.push({"name": "posts", "value": postIds});
|
||||||
$.operate.saveTab(prefix + "/edit", data);
|
$.operate.saveTab(prefix + "/edit", data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,23 @@
|
||||||
<artifactId>javax.servlet-api</artifactId>
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- spring.data.jpa -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.querydsl</groupId>
|
||||||
|
<artifactId>querydsl-jpa</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -11,18 +11,13 @@ import java.lang.annotation.Target;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Target(ElementType.METHOD)
|
@Target(ElementType.TYPE)
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Documented
|
@Documented
|
||||||
public @interface DataScope
|
public @interface DataScope {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 部门表的别名
|
* 业务表的所属用户的字段名称:过滤仅本人的数据权限,
|
||||||
|
* 该字段的类型为:{@link com.ruoyi.system.domain.SysUser}
|
||||||
*/
|
*/
|
||||||
public String deptAlias() default "";
|
String userFieldName() default "";
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户表的别名
|
|
||||||
*/
|
|
||||||
public String userAlias() default "";
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.ruoyi.common.annotation;
|
||||||
|
|
||||||
|
public enum DataScopes implements Comparable<DataScopes>{
|
||||||
|
/**
|
||||||
|
* 全部数据权限
|
||||||
|
*/
|
||||||
|
DATA_SCOPE_ALL,
|
||||||
|
/**
|
||||||
|
* 自定数据权限
|
||||||
|
*/
|
||||||
|
DATA_SCOPE_CUSTOM,
|
||||||
|
/**
|
||||||
|
* 部门数据权限
|
||||||
|
*/
|
||||||
|
DATA_SCOPE_DEPT,
|
||||||
|
/**
|
||||||
|
* 部门及以下数据权限
|
||||||
|
*/
|
||||||
|
DATA_SCOPE_DEPT_AND_CHILD,
|
||||||
|
/**
|
||||||
|
* 仅本人数据权限
|
||||||
|
*/
|
||||||
|
DATA_SCOPE_SELF,
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
@ -6,21 +6,19 @@ 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.ruoyi.common.enums.DataSourceType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义多数据源切换注解
|
* 自定义多数据源切换注解
|
||||||
*
|
*
|
||||||
* 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@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 {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 切换数据源名称
|
* 切换数据源名称
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import java.lang.annotation.Target;
|
||||||
*/
|
*/
|
||||||
@Target(ElementType.FIELD)
|
@Target(ElementType.FIELD)
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
public @interface Excels
|
public @interface Excels {
|
||||||
{
|
|
||||||
Excel[] value();
|
Excel[] value();
|
||||||
}
|
}
|
||||||
|
|
@ -5,6 +5,7 @@ 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.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.enums.OperatorType;
|
import com.ruoyi.common.enums.OperatorType;
|
||||||
|
|
||||||
|
|
@ -13,11 +14,10 @@ import com.ruoyi.common.enums.OperatorType;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Target({ ElementType.PARAMETER, ElementType.METHOD })
|
@Target({ElementType.PARAMETER, ElementType.METHOD})
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Documented
|
@Documented
|
||||||
public @interface Log
|
public @interface Log {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 模块
|
* 模块
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,10 @@ import java.lang.annotation.Target;
|
||||||
* 自定义注解防止表单重复提交
|
* 自定义注解防止表单重复提交
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Target(ElementType.METHOD)
|
@Target(ElementType.METHOD)
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Documented
|
@Documented
|
||||||
public @interface RepeatSubmit
|
public @interface RepeatSubmit {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.ruoyi.common.base;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
|
||||||
|
import org.springframework.data.repository.NoRepositoryBean;
|
||||||
|
|
||||||
|
import javax.persistence.criteria.CriteriaBuilder;
|
||||||
|
import javax.persistence.criteria.Predicate;
|
||||||
|
|
||||||
|
@NoRepositoryBean
|
||||||
|
public interface BaseRepository<T, ID> extends JpaRepository<T, ID>,
|
||||||
|
JpaSpecificationExecutor<T>,
|
||||||
|
QuerydslPredicateExecutor<T> {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.ruoyi.common.base;
|
||||||
|
|
||||||
|
import com.querydsl.core.types.dsl.*;
|
||||||
|
import com.ruoyi.common.utils.querydsl.ExpressionUtils;
|
||||||
|
|
||||||
|
public class BaseService {
|
||||||
|
|
||||||
|
protected BooleanExpression buildLike(StringPath path, String value){
|
||||||
|
return ExpressionUtils.buildLike(path, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <T extends Comparable<T>> BooleanExpression buildEqual(ComparableExpressionBase<T> path, T value){
|
||||||
|
return ExpressionUtils.buildEqual(path, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <T extends Number & Comparable<T>> BooleanExpression buildEqual(NumberPath<T> path, T value){
|
||||||
|
return ExpressionUtils.buildEqual(path, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <T extends Comparable<T>> BooleanExpression buildGreaterThanOrEqualTo(ComparableExpression<T> path, T value){
|
||||||
|
return ExpressionUtils.buildGreaterThanOrEqualTo(path, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <T extends Comparable<T>> BooleanExpression buildLessThanOrEqualTo(ComparableExpression<T> path, T value){
|
||||||
|
return ExpressionUtils.buildLessThanOrEqualTo(path, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected BooleanExpression notLike(StringPath path, String value){
|
||||||
|
return ExpressionUtils.notLike(path, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected BooleanExpression notStartWith(StringPath path, String value){
|
||||||
|
return ExpressionUtils.notStartWith(path, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -10,107 +10,103 @@ import org.springframework.stereotype.Component;
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@ConfigurationProperties(prefix = "ruoyi")
|
@ConfigurationProperties(prefix = "ruoyi")
|
||||||
public class Global
|
public class Global {
|
||||||
{
|
/**
|
||||||
/** 项目名称 */
|
* 项目名称
|
||||||
|
*/
|
||||||
private static String name;
|
private static String name;
|
||||||
|
|
||||||
/** 版本 */
|
/**
|
||||||
|
* 版本
|
||||||
|
*/
|
||||||
private static String version;
|
private static String version;
|
||||||
|
|
||||||
/** 版权年份 */
|
/**
|
||||||
|
* 版权年份
|
||||||
|
*/
|
||||||
private static String copyrightYear;
|
private static String copyrightYear;
|
||||||
|
|
||||||
/** 实例演示开关 */
|
/**
|
||||||
|
* 实例演示开关
|
||||||
|
*/
|
||||||
private static boolean demoEnabled;
|
private static boolean demoEnabled;
|
||||||
|
|
||||||
/** 上传路径 */
|
/**
|
||||||
|
* 上传路径
|
||||||
|
*/
|
||||||
private static String profile;
|
private static String profile;
|
||||||
|
|
||||||
/** 获取地址开关 */
|
/**
|
||||||
|
* 获取地址开关
|
||||||
|
*/
|
||||||
private static boolean addressEnabled;
|
private static boolean addressEnabled;
|
||||||
|
|
||||||
public static String getName()
|
public static String getName() {
|
||||||
{
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name)
|
public void setName(String name) {
|
||||||
{
|
|
||||||
Global.name = name;
|
Global.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getVersion()
|
public static String getVersion() {
|
||||||
{
|
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVersion(String version)
|
public void setVersion(String version) {
|
||||||
{
|
|
||||||
Global.version = version;
|
Global.version = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getCopyrightYear()
|
public static String getCopyrightYear() {
|
||||||
{
|
|
||||||
return copyrightYear;
|
return copyrightYear;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCopyrightYear(String copyrightYear)
|
public void setCopyrightYear(String copyrightYear) {
|
||||||
{
|
|
||||||
Global.copyrightYear = copyrightYear;
|
Global.copyrightYear = copyrightYear;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isDemoEnabled()
|
public static boolean isDemoEnabled() {
|
||||||
{
|
|
||||||
return demoEnabled;
|
return demoEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDemoEnabled(boolean demoEnabled)
|
public void setDemoEnabled(boolean demoEnabled) {
|
||||||
{
|
|
||||||
Global.demoEnabled = demoEnabled;
|
Global.demoEnabled = demoEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getProfile()
|
public static String getProfile() {
|
||||||
{
|
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProfile(String profile)
|
public void setProfile(String profile) {
|
||||||
{
|
|
||||||
Global.profile = profile;
|
Global.profile = profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAddressEnabled()
|
public static boolean isAddressEnabled() {
|
||||||
{
|
|
||||||
return addressEnabled;
|
return addressEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAddressEnabled(boolean addressEnabled)
|
public void setAddressEnabled(boolean addressEnabled) {
|
||||||
{
|
|
||||||
Global.addressEnabled = addressEnabled;
|
Global.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";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.ruoyi.common.config;
|
package com.ruoyi.common.config;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import com.ruoyi.common.utils.ServletUtils;
|
import com.ruoyi.common.utils.ServletUtils;
|
||||||
|
|
||||||
|
|
@ -8,24 +9,20 @@ import com.ruoyi.common.utils.ServletUtils;
|
||||||
* 服务相关配置
|
* 服务相关配置
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class ServerConfig
|
public class ServerConfig {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 获取完整的请求路径,包括:域名,端口,上下文访问路径
|
* 获取完整的请求路径,包括:域名,端口,上下文访问路径
|
||||||
*
|
*
|
||||||
* @return 服务地址
|
* @return 服务地址
|
||||||
*/
|
*/
|
||||||
public String getUrl()
|
public String getUrl() {
|
||||||
{
|
|
||||||
HttpServletRequest request = ServletUtils.getRequest();
|
HttpServletRequest request = ServletUtils.getRequest();
|
||||||
return getDomain(request);
|
return getDomain(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getDomain(HttpServletRequest request)
|
public static String getDomain(HttpServletRequest request) {
|
||||||
{
|
|
||||||
StringBuffer url = request.getRequestURL();
|
StringBuffer url = request.getRequestURL();
|
||||||
String contextPath = request.getServletContext().getContextPath();
|
String contextPath = request.getServletContext().getContextPath();
|
||||||
return url.delete(url.length() - request.getRequestURI().length(), url.length()).append(contextPath).toString();
|
return url.delete(url.length() - request.getRequestURI().length(), url.length()).append(contextPath).toString();
|
||||||
|
|
|
||||||
|
|
@ -8,21 +8,19 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class DynamicDataSourceContextHolder
|
public class DynamicDataSourceContextHolder {
|
||||||
{
|
|
||||||
public static final Logger log = LoggerFactory.getLogger(DynamicDataSourceContextHolder.class);
|
public static final Logger log = LoggerFactory.getLogger(DynamicDataSourceContextHolder.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 使用ThreadLocal维护变量,ThreadLocal为每个使用该变量的线程提供独立的变量副本,
|
* 使用ThreadLocal维护变量,ThreadLocal为每个使用该变量的线程提供独立的变量副本,
|
||||||
* 所以每一个线程都可以独立地改变自己的副本,而不会影响其它线程所对应的副本。
|
* 所以每一个线程都可以独立地改变自己的副本,而不会影响其它线程所对应的副本。
|
||||||
*/
|
*/
|
||||||
private static final ThreadLocal<String> CONTEXT_HOLDER = new ThreadLocal<>();
|
private static final ThreadLocal<String> CONTEXT_HOLDER = new ThreadLocal<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置数据源的变量
|
* 设置数据源的变量
|
||||||
*/
|
*/
|
||||||
public static void setDataSourceType(String dsType)
|
public static void setDataSourceType(String dsType) {
|
||||||
{
|
|
||||||
log.info("切换到{}数据源", dsType);
|
log.info("切换到{}数据源", dsType);
|
||||||
CONTEXT_HOLDER.set(dsType);
|
CONTEXT_HOLDER.set(dsType);
|
||||||
}
|
}
|
||||||
|
|
@ -30,16 +28,14 @@ public class DynamicDataSourceContextHolder
|
||||||
/**
|
/**
|
||||||
* 获得数据源的变量
|
* 获得数据源的变量
|
||||||
*/
|
*/
|
||||||
public static String getDataSourceType()
|
public static String getDataSourceType() {
|
||||||
{
|
|
||||||
return CONTEXT_HOLDER.get();
|
return CONTEXT_HOLDER.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清空数据源变量
|
* 清空数据源变量
|
||||||
*/
|
*/
|
||||||
public static void clearDataSourceType()
|
public static void clearDataSourceType() {
|
||||||
{
|
|
||||||
CONTEXT_HOLDER.remove();
|
CONTEXT_HOLDER.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.ruoyi.common.config.thread;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||||
import java.util.concurrent.ThreadPoolExecutor;
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
|
||||||
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
|
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
@ -15,8 +16,7 @@ import com.ruoyi.common.utils.Threads;
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
**/
|
**/
|
||||||
@Configuration
|
@Configuration
|
||||||
public class ThreadPoolConfig
|
public class ThreadPoolConfig {
|
||||||
{
|
|
||||||
// 核心线程池大小
|
// 核心线程池大小
|
||||||
private int corePoolSize = 50;
|
private int corePoolSize = 50;
|
||||||
|
|
||||||
|
|
@ -30,8 +30,7 @@ public class ThreadPoolConfig
|
||||||
private int keepAliveSeconds = 300;
|
private int keepAliveSeconds = 300;
|
||||||
|
|
||||||
@Bean(name = "threadPoolTaskExecutor")
|
@Bean(name = "threadPoolTaskExecutor")
|
||||||
public ThreadPoolTaskExecutor threadPoolTaskExecutor()
|
public ThreadPoolTaskExecutor threadPoolTaskExecutor() {
|
||||||
{
|
|
||||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||||
executor.setMaxPoolSize(maxPoolSize);
|
executor.setMaxPoolSize(maxPoolSize);
|
||||||
executor.setCorePoolSize(corePoolSize);
|
executor.setCorePoolSize(corePoolSize);
|
||||||
|
|
@ -46,14 +45,11 @@ public class ThreadPoolConfig
|
||||||
* 执行周期性或定时任务
|
* 执行周期性或定时任务
|
||||||
*/
|
*/
|
||||||
@Bean(name = "scheduledExecutorService")
|
@Bean(name = "scheduledExecutorService")
|
||||||
protected ScheduledExecutorService scheduledExecutorService()
|
protected ScheduledExecutorService scheduledExecutorService() {
|
||||||
{
|
|
||||||
return new ScheduledThreadPoolExecutor(corePoolSize,
|
return new ScheduledThreadPoolExecutor(corePoolSize,
|
||||||
new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build())
|
new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build()) {
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
protected void afterExecute(Runnable r, Throwable t)
|
protected void afterExecute(Runnable r, Throwable t) {
|
||||||
{
|
|
||||||
super.afterExecute(r, t);
|
super.afterExecute(r, t);
|
||||||
Threads.printException(r, t);
|
Threads.printException(r, t);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,7 @@ package com.ruoyi.common.constant;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class Constants
|
public class Constants {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* UTF-8 字符集
|
* UTF-8 字符集
|
||||||
*/
|
*/
|
||||||
|
|
@ -47,6 +46,11 @@ public class Constants
|
||||||
*/
|
*/
|
||||||
public static final String LOGIN_FAIL = "Error";
|
public static final String LOGIN_FAIL = "Error";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自动去除表前缀
|
||||||
|
*/
|
||||||
|
public static final String AUTO_REOMVE_PRE = "true";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当前记录起始索引
|
* 当前记录起始索引
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -5,23 +5,34 @@ package com.ruoyi.common.constant;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class PermissionConstants
|
public class PermissionConstants {
|
||||||
{
|
/**
|
||||||
/** 新增权限 */
|
* 新增权限
|
||||||
|
*/
|
||||||
public static final String ADD_PERMISSION = "add";
|
public static final String ADD_PERMISSION = "add";
|
||||||
|
|
||||||
/** 修改权限 */
|
/**
|
||||||
|
* 修改权限
|
||||||
|
*/
|
||||||
public static final String EDIT_PERMISSION = "edit";
|
public static final String EDIT_PERMISSION = "edit";
|
||||||
|
|
||||||
/** 删除权限 */
|
/**
|
||||||
|
* 删除权限
|
||||||
|
*/
|
||||||
public static final String REMOVE_PERMISSION = "remove";
|
public static final String REMOVE_PERMISSION = "remove";
|
||||||
|
|
||||||
/** 导出权限 */
|
/**
|
||||||
|
* 导出权限
|
||||||
|
*/
|
||||||
public static final String EXPORT_PERMISSION = "export";
|
public static final String EXPORT_PERMISSION = "export";
|
||||||
|
|
||||||
/** 显示权限 */
|
/**
|
||||||
|
* 显示权限
|
||||||
|
*/
|
||||||
public static final String VIEW_PERMISSION = "view";
|
public static final String VIEW_PERMISSION = "view";
|
||||||
|
|
||||||
/** 查询权限 */
|
/**
|
||||||
|
* 查询权限
|
||||||
|
*/
|
||||||
public static final String LIST_PERMISSION = "list";
|
public static final String LIST_PERMISSION = "list";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,5 @@
|
||||||
package com.ruoyi.common.core.controller;
|
package com.ruoyi.common.core.controller;
|
||||||
|
|
||||||
import java.beans.PropertyEditorSupport;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.web.bind.WebDataBinder;
|
|
||||||
import org.springframework.web.bind.annotation.InitBinder;
|
|
||||||
import com.github.pagehelper.PageHelper;
|
|
||||||
import com.github.pagehelper.PageInfo;
|
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult.Type;
|
import com.ruoyi.common.core.domain.AjaxResult.Type;
|
||||||
import com.ruoyi.common.core.page.PageDomain;
|
import com.ruoyi.common.core.page.PageDomain;
|
||||||
|
|
@ -21,95 +9,98 @@ import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.common.utils.ServletUtils;
|
import com.ruoyi.common.utils.ServletUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.sql.SqlUtil;
|
import com.ruoyi.common.utils.sql.SqlUtil;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.data.domain.Sort;
|
||||||
|
import org.springframework.web.bind.WebDataBinder;
|
||||||
|
import org.springframework.web.bind.annotation.InitBinder;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
import java.beans.PropertyEditorSupport;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* web层通用数据处理
|
* web层通用数据处理
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
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()
|
|
||||||
{
|
|
||||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
|
||||||
Integer pageNum = pageDomain.getPageNum();
|
|
||||||
Integer pageSize = pageDomain.getPageSize();
|
|
||||||
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize))
|
|
||||||
{
|
|
||||||
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
|
||||||
PageHelper.startPage(pageNum, pageSize, orderBy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置请求排序数据
|
|
||||||
*/
|
|
||||||
protected void startOrderBy()
|
|
||||||
{
|
|
||||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
|
||||||
if (StringUtils.isNotEmpty(pageDomain.getOrderBy()))
|
|
||||||
{
|
|
||||||
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
|
||||||
PageHelper.orderBy(orderBy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取request
|
* 获取request
|
||||||
*/
|
*/
|
||||||
public HttpServletRequest getRequest()
|
public HttpServletRequest getRequest() {
|
||||||
{
|
|
||||||
return ServletUtils.getRequest();
|
return ServletUtils.getRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取response
|
* 获取response
|
||||||
*/
|
*/
|
||||||
public HttpServletResponse getResponse()
|
public HttpServletResponse getResponse() {
|
||||||
{
|
|
||||||
return ServletUtils.getResponse();
|
return ServletUtils.getResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取session
|
* 获取session
|
||||||
*/
|
*/
|
||||||
public HttpSession getSession()
|
public HttpSession getSession() {
|
||||||
{
|
|
||||||
return getRequest().getSession();
|
return getRequest().getSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置请求分页数据
|
||||||
|
*/
|
||||||
|
protected Pageable getPageRequest() {
|
||||||
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||||
|
Integer pageNum = pageDomain.getPageNum();
|
||||||
|
Integer pageSize = pageDomain.getPageSize();
|
||||||
|
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
|
||||||
|
String attribute = pageDomain.getOrderByColumn();
|
||||||
|
if(StringUtils.isNotEmpty(attribute)){
|
||||||
|
Sort.Order order = null;
|
||||||
|
if("desc".equals(pageDomain.getIsAsc())){
|
||||||
|
order = Sort.Order.desc(attribute);
|
||||||
|
}else{
|
||||||
|
order = Sort.Order.asc(attribute);
|
||||||
|
}
|
||||||
|
return PageRequest.of(pageNum-1, pageSize, Sort.by(order));
|
||||||
|
}else{
|
||||||
|
return PageRequest.of(pageNum-1, pageSize);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return PageRequest.of(0,10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 响应请求分页数据
|
* 响应请求分页数据
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
protected TableDataInfo getDataTable(List<?> list)
|
protected TableDataInfo getDataTable(org.springframework.data.domain.Page<?> page) {
|
||||||
{
|
|
||||||
TableDataInfo rspData = new TableDataInfo();
|
TableDataInfo rspData = new TableDataInfo();
|
||||||
rspData.setCode(0);
|
rspData.setCode(0);
|
||||||
rspData.setRows(list);
|
rspData.setRows(page.getContent());
|
||||||
rspData.setTotal(new PageInfo(list).getTotal());
|
rspData.setTotal(page.getTotalElements());
|
||||||
return rspData;
|
return rspData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -119,8 +110,7 @@ public class BaseController
|
||||||
* @param rows 影响行数
|
* @param rows 影响行数
|
||||||
* @return 操作结果
|
* @return 操作结果
|
||||||
*/
|
*/
|
||||||
protected AjaxResult toAjax(int rows)
|
protected AjaxResult toAjax(int rows) {
|
||||||
{
|
|
||||||
return rows > 0 ? success() : error();
|
return rows > 0 ? success() : error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -130,56 +120,56 @@ public class BaseController
|
||||||
* @param result 结果
|
* @param result 结果
|
||||||
* @return 操作结果
|
* @return 操作结果
|
||||||
*/
|
*/
|
||||||
protected AjaxResult toAjax(boolean result)
|
protected AjaxResult toAjax(boolean result) {
|
||||||
{
|
|
||||||
return result ? success() : error();
|
return result ? success() : error();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回成功
|
* 返回成功
|
||||||
*/
|
*/
|
||||||
public AjaxResult success()
|
public AjaxResult success() {
|
||||||
{
|
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public <T> AjaxResult success(T data) {
|
||||||
|
AjaxResult result = AjaxResult.success();
|
||||||
|
result.put("data", data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回失败消息
|
* 返回失败消息
|
||||||
*/
|
*/
|
||||||
public AjaxResult error()
|
public AjaxResult error() {
|
||||||
{
|
|
||||||
return AjaxResult.error();
|
return AjaxResult.error();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回成功消息
|
* 返回成功消息
|
||||||
*/
|
*/
|
||||||
public AjaxResult success(String message)
|
public AjaxResult success(String message) {
|
||||||
{
|
|
||||||
return AjaxResult.success(message);
|
return AjaxResult.success(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回失败消息
|
* 返回失败消息
|
||||||
*/
|
*/
|
||||||
public AjaxResult error(String message)
|
public AjaxResult error(String message) {
|
||||||
{
|
|
||||||
return AjaxResult.error(message);
|
return AjaxResult.error(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回错误码消息
|
* 返回错误码消息
|
||||||
*/
|
*/
|
||||||
public AjaxResult error(Type type, String message)
|
public AjaxResult error(Type type, String message) {
|
||||||
{
|
|
||||||
return new AjaxResult(type, message);
|
return new AjaxResult(type, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面跳转
|
* 页面跳转
|
||||||
*/
|
*/
|
||||||
public String redirect(String url)
|
public String redirect(String url) {
|
||||||
{
|
|
||||||
return StringUtils.format("redirect:{}", url);
|
return StringUtils.format("redirect:{}", url);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.ruoyi.common.core.domain;
|
package com.ruoyi.common.core.domain;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -8,39 +9,47 @@ import com.ruoyi.common.utils.StringUtils;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
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";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态类型
|
* 状态类型
|
||||||
*/
|
*/
|
||||||
public enum Type
|
public enum Type {
|
||||||
{
|
/**
|
||||||
/** 成功 */
|
* 成功
|
||||||
|
*/
|
||||||
SUCCESS(0),
|
SUCCESS(0),
|
||||||
/** 警告 */
|
/**
|
||||||
|
* 警告
|
||||||
|
*/
|
||||||
WARN(301),
|
WARN(301),
|
||||||
/** 错误 */
|
/**
|
||||||
|
* 错误
|
||||||
|
*/
|
||||||
ERROR(500);
|
ERROR(500);
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -48,18 +57,16 @@ public class AjaxResult extends HashMap<String, Object>
|
||||||
/**
|
/**
|
||||||
* 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
|
* 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
|
||||||
*/
|
*/
|
||||||
public AjaxResult()
|
public AjaxResult() {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化一个新创建的 AjaxResult 对象
|
* 初始化一个新创建的 AjaxResult 对象
|
||||||
*
|
*
|
||||||
* @param type 状态类型
|
* @param type 状态类型
|
||||||
* @param msg 返回内容
|
* @param msg 返回内容
|
||||||
*/
|
*/
|
||||||
public AjaxResult(Type type, String msg)
|
public AjaxResult(Type type, String msg) {
|
||||||
{
|
|
||||||
super.put(CODE_TAG, type.value);
|
super.put(CODE_TAG, type.value);
|
||||||
super.put(MSG_TAG, msg);
|
super.put(MSG_TAG, msg);
|
||||||
}
|
}
|
||||||
|
|
@ -68,15 +75,13 @@ public class AjaxResult extends HashMap<String, Object>
|
||||||
* 初始化一个新创建的 AjaxResult 对象
|
* 初始化一个新创建的 AjaxResult 对象
|
||||||
*
|
*
|
||||||
* @param type 状态类型
|
* @param type 状态类型
|
||||||
* @param msg 返回内容
|
* @param msg 返回内容
|
||||||
* @param data 数据对象
|
* @param data 数据对象
|
||||||
*/
|
*/
|
||||||
public AjaxResult(Type type, String msg, Object data)
|
public AjaxResult(Type type, String msg, Object data) {
|
||||||
{
|
|
||||||
super.put(CODE_TAG, type.value);
|
super.put(CODE_TAG, type.value);
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -86,8 +91,7 @@ public class AjaxResult extends HashMap<String, Object>
|
||||||
*
|
*
|
||||||
* @return 成功消息
|
* @return 成功消息
|
||||||
*/
|
*/
|
||||||
public static AjaxResult success()
|
public static AjaxResult success() {
|
||||||
{
|
|
||||||
return AjaxResult.success("操作成功");
|
return AjaxResult.success("操作成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,8 +100,7 @@ public class AjaxResult extends HashMap<String, Object>
|
||||||
*
|
*
|
||||||
* @return 成功消息
|
* @return 成功消息
|
||||||
*/
|
*/
|
||||||
public static AjaxResult success(Object data)
|
public static AjaxResult success(Object data) {
|
||||||
{
|
|
||||||
return AjaxResult.success("操作成功", data);
|
return AjaxResult.success("操作成功", data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -107,20 +110,18 @@ public class AjaxResult extends HashMap<String, Object>
|
||||||
* @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(Type.SUCCESS, msg, data);
|
return new AjaxResult(Type.SUCCESS, msg, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -130,20 +131,18 @@ public class AjaxResult extends HashMap<String, Object>
|
||||||
* @param msg 返回内容
|
* @param msg 返回内容
|
||||||
* @return 警告消息
|
* @return 警告消息
|
||||||
*/
|
*/
|
||||||
public static AjaxResult warn(String msg)
|
public static AjaxResult warn(String msg) {
|
||||||
{
|
|
||||||
return AjaxResult.warn(msg, null);
|
return AjaxResult.warn(msg, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回警告消息
|
* 返回警告消息
|
||||||
*
|
*
|
||||||
* @param msg 返回内容
|
* @param msg 返回内容
|
||||||
* @param data 数据对象
|
* @param data 数据对象
|
||||||
* @return 警告消息
|
* @return 警告消息
|
||||||
*/
|
*/
|
||||||
public static AjaxResult warn(String msg, Object data)
|
public static AjaxResult warn(String msg, Object data) {
|
||||||
{
|
|
||||||
return new AjaxResult(Type.WARN, msg, data);
|
return new AjaxResult(Type.WARN, msg, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -152,8 +151,7 @@ public class AjaxResult extends HashMap<String, Object>
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static AjaxResult error()
|
public static AjaxResult error() {
|
||||||
{
|
|
||||||
return AjaxResult.error("操作失败");
|
return AjaxResult.error("操作失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -163,20 +161,18 @@ public class AjaxResult extends HashMap<String, Object>
|
||||||
* @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(Type.ERROR, msg, data);
|
return new AjaxResult(Type.ERROR, msg, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,123 @@
|
||||||
|
package com.ruoyi.common.core.domain;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.enums.ActiveState;
|
||||||
|
import com.ruoyi.common.core.domain.enums.DeleteState;
|
||||||
|
import org.springframework.data.annotation.CreatedBy;
|
||||||
|
import org.springframework.data.annotation.CreatedDate;
|
||||||
|
import org.springframework.data.annotation.LastModifiedBy;
|
||||||
|
import org.springframework.data.annotation.LastModifiedDate;
|
||||||
|
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@MappedSuperclass
|
||||||
|
@EntityListeners(AuditingEntityListener.class)
|
||||||
|
public class BaseDatabaseEntity implements Serializable {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@CreatedDate
|
||||||
|
@Column(updatable = false)
|
||||||
|
private Date createDate;
|
||||||
|
|
||||||
|
@CreatedBy
|
||||||
|
@Column(updatable = false)
|
||||||
|
private Long createBy;
|
||||||
|
|
||||||
|
@LastModifiedDate
|
||||||
|
private Date updateDate;
|
||||||
|
|
||||||
|
@LastModifiedBy
|
||||||
|
private Long updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除状态
|
||||||
|
*/
|
||||||
|
private DeleteState deleteState = DeleteState.NOT_DELETED;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启用状态
|
||||||
|
*/
|
||||||
|
private ActiveState activeState = ActiveState.enabled;
|
||||||
|
|
||||||
|
@Version
|
||||||
|
private Integer version;
|
||||||
|
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateDate() {
|
||||||
|
return createDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateDate(Date createDate) {
|
||||||
|
this.createDate = createDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getCreateBy() {
|
||||||
|
return createBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateBy(Long createBy) {
|
||||||
|
this.createBy = createBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getUpdateDate() {
|
||||||
|
return updateDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateDate(Date updateDate) {
|
||||||
|
this.updateDate = updateDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getUpdateBy() {
|
||||||
|
return updateBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateBy(Long updateBy) {
|
||||||
|
this.updateBy = updateBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DeleteState getDeleteState() {
|
||||||
|
return deleteState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeleteState(DeleteState deleteState) {
|
||||||
|
this.deleteState = deleteState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVersion(Integer version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRemark() {
|
||||||
|
return remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRemark(String remark) {
|
||||||
|
this.remark = remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActiveState getActiveState() {
|
||||||
|
return activeState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActiveState(ActiveState activeState) {
|
||||||
|
this.activeState = activeState;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,114 +1,162 @@
|
||||||
package com.ruoyi.common.core.domain;
|
package com.ruoyi.common.core.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.hibernate.annotations.DynamicUpdate;
|
||||||
|
import org.hibernate.annotations.SelectBeforeUpdate;
|
||||||
|
import org.springframework.data.annotation.CreatedBy;
|
||||||
|
import org.springframework.data.annotation.CreatedDate;
|
||||||
|
import org.springframework.data.annotation.LastModifiedBy;
|
||||||
|
import org.springframework.data.annotation.LastModifiedDate;
|
||||||
|
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.EntityListeners;
|
||||||
|
import javax.persistence.MappedSuperclass;
|
||||||
|
import javax.persistence.Transient;
|
||||||
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;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entity基类
|
* Entity基类
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class BaseEntity implements Serializable
|
@MappedSuperclass
|
||||||
{
|
@EntityListeners(AuditingEntityListener.class)
|
||||||
|
@SelectBeforeUpdate
|
||||||
|
@DynamicUpdate
|
||||||
|
public class BaseEntity implements Serializable {
|
||||||
|
|
||||||
|
public static final String NOT_DELETED = "0";
|
||||||
|
public static final String DELETED = "1";
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 搜索值 */
|
/**
|
||||||
|
* 搜索值
|
||||||
|
*/
|
||||||
|
@Transient
|
||||||
private String searchValue;
|
private String searchValue;
|
||||||
|
|
||||||
/** 创建者 */
|
/**
|
||||||
|
* 创建者
|
||||||
|
*/
|
||||||
|
@CreatedBy
|
||||||
|
@Column(updatable = false)
|
||||||
private String createBy;
|
private String createBy;
|
||||||
|
|
||||||
/** 创建时间 */
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@CreatedDate
|
||||||
|
@Column(updatable = false)
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
/** 更新者 */
|
/**
|
||||||
|
* 更新者
|
||||||
|
*/
|
||||||
|
@LastModifiedBy
|
||||||
private String updateBy;
|
private String updateBy;
|
||||||
|
|
||||||
/** 更新时间 */
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@LastModifiedDate
|
||||||
@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;
|
||||||
|
|
||||||
/** 请求参数 */
|
/**
|
||||||
|
* 请求参数
|
||||||
|
*/
|
||||||
|
@Transient
|
||||||
private Map<String, Object> params;
|
private Map<String, Object> params;
|
||||||
|
|
||||||
public String getSearchValue()
|
@Transient
|
||||||
{
|
private Date startTime;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
private Date endTime;
|
||||||
|
|
||||||
|
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 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Date getStartTime() {
|
||||||
|
return startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartTime(Date startTime) {
|
||||||
|
this.startTime = startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getEndTime() {
|
||||||
|
return endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndTime(Date endTime) {
|
||||||
|
this.endTime = endTime;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,59 +5,58 @@ package com.ruoyi.common.core.domain;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
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;
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -7,98 +7,97 @@ import java.io.Serializable;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class Ztree implements Serializable
|
public class Ztree implements Serializable {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 节点ID */
|
/**
|
||||||
|
* 节点ID
|
||||||
|
*/
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 节点父ID */
|
/**
|
||||||
|
* 节点父ID
|
||||||
|
*/
|
||||||
private Long pId;
|
private Long pId;
|
||||||
|
|
||||||
/** 节点名称 */
|
/**
|
||||||
|
* 节点名称
|
||||||
|
*/
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/** 节点标题 */
|
/**
|
||||||
|
* 节点标题
|
||||||
|
*/
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
/** 是否勾选 */
|
/**
|
||||||
|
* 是否勾选
|
||||||
|
*/
|
||||||
private boolean checked = false;
|
private boolean checked = false;
|
||||||
|
|
||||||
/** 是否展开 */
|
/**
|
||||||
|
* 是否展开
|
||||||
|
*/
|
||||||
private boolean open = false;
|
private boolean open = false;
|
||||||
|
|
||||||
/** 是否能勾选 */
|
/**
|
||||||
|
* 是否能勾选
|
||||||
|
*/
|
||||||
private boolean nocheck = false;
|
private boolean nocheck = false;
|
||||||
|
|
||||||
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 Long getpId()
|
public Long getpId() {
|
||||||
{
|
|
||||||
return pId;
|
return pId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setpId(Long pId)
|
public void setpId(Long pId) {
|
||||||
{
|
|
||||||
this.pId = pId;
|
this.pId = pId;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 getTitle()
|
public String getTitle() {
|
||||||
{
|
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTitle(String title)
|
public void setTitle(String title) {
|
||||||
{
|
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isChecked()
|
public boolean isChecked() {
|
||||||
{
|
|
||||||
return checked;
|
return checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setChecked(boolean checked)
|
public void setChecked(boolean checked) {
|
||||||
{
|
|
||||||
this.checked = checked;
|
this.checked = checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOpen()
|
public boolean isOpen() {
|
||||||
{
|
|
||||||
return open;
|
return open;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOpen(boolean open)
|
public void setOpen(boolean open) {
|
||||||
{
|
|
||||||
this.open = open;
|
this.open = open;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNocheck()
|
public boolean isNocheck() {
|
||||||
{
|
|
||||||
return nocheck;
|
return nocheck;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNocheck(boolean nocheck)
|
public void setNocheck(boolean nocheck) {
|
||||||
{
|
|
||||||
this.nocheck = nocheck;
|
this.nocheck = nocheck;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
package com.ruoyi.common.core.domain.enums;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
|
||||||
|
public enum ActiveState implements BaseEnum{
|
||||||
|
|
||||||
|
enabled(1,"活跃"),
|
||||||
|
disabled(2,"不活跃"),
|
||||||
|
;
|
||||||
|
|
||||||
|
private Integer state;
|
||||||
|
private String desc;
|
||||||
|
|
||||||
|
ActiveState(Integer state, String desc) {
|
||||||
|
this.state = state;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getState() {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setState(Integer state) {
|
||||||
|
this.state = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDesc(String desc) {
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String en() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String zh() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ActiveState of(Integer value){
|
||||||
|
return Arrays.stream(ActiveState.values())
|
||||||
|
.filter(activeState -> activeState.getState().equals(value))
|
||||||
|
.findFirst()
|
||||||
|
.orElseThrow(IllegalArgumentException::new);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.ruoyi.common.core.domain.enums;
|
||||||
|
|
||||||
|
public interface BaseEnum {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 英文显示
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String en();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 汉语显示
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String zh();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.ruoyi.common.core.domain.enums;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
|
||||||
|
public enum DeleteState implements BaseEnum {
|
||||||
|
NOT_DELETED(0, "未删除","Not Deleted"),
|
||||||
|
DELETED(1, "已删除", "Deleted"),
|
||||||
|
;
|
||||||
|
private Integer state;
|
||||||
|
private String desc;
|
||||||
|
private String en;
|
||||||
|
|
||||||
|
public Integer getState() {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setState(Integer state) {
|
||||||
|
this.state = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
DeleteState(Integer state, String desc, String en) {
|
||||||
|
this.state = state;
|
||||||
|
this.desc = desc;
|
||||||
|
this.en = en;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDesc(String desc) {
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DeleteState of(Integer state){
|
||||||
|
return Arrays.stream(DeleteState.values())
|
||||||
|
.filter(deleteState -> deleteState.getState().equals(state))
|
||||||
|
.findFirst()
|
||||||
|
.orElseThrow(IllegalArgumentException::new);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEn() {
|
||||||
|
return en;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEn(String en) {
|
||||||
|
this.en = en;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String en() {
|
||||||
|
return en;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String zh() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.ruoyi.common.core.domain.enums.converter;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.enums.ActiveState;
|
||||||
|
|
||||||
|
import javax.persistence.AttributeConverter;
|
||||||
|
import javax.persistence.Converter;
|
||||||
|
|
||||||
|
@Converter(autoApply = true)
|
||||||
|
public class ActiveStateConverter implements AttributeConverter<ActiveState, Integer> {
|
||||||
|
@Override
|
||||||
|
public Integer convertToDatabaseColumn(ActiveState activeState) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ActiveState convertToEntityAttribute(Integer integer) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.ruoyi.common.core.domain.enums.converter;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.enums.DeleteState;
|
||||||
|
|
||||||
|
import javax.persistence.AttributeConverter;
|
||||||
|
import javax.persistence.Converter;
|
||||||
|
|
||||||
|
@Converter(autoApply = true)
|
||||||
|
public class DeleteStateConverter implements AttributeConverter<DeleteState, Integer> {
|
||||||
|
@Override
|
||||||
|
public Integer convertToDatabaseColumn(DeleteState attribute) {
|
||||||
|
return null == attribute ? null : attribute.getState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeleteState convertToEntityAttribute(Integer dbData) {
|
||||||
|
return DeleteState.of(dbData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.ruoyi.common.core.domain.enums.propertyeditor;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.enums.ActiveState;
|
||||||
|
|
||||||
|
import java.beans.PropertyEditorSupport;
|
||||||
|
|
||||||
|
public class ActiveStatePropertyEditor extends PropertyEditorSupport {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
|
try{
|
||||||
|
Integer enumValue = Integer.parseInt(text);
|
||||||
|
setValue(ActiveState.of(enumValue));
|
||||||
|
}catch (NumberFormatException e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.ruoyi.common.core.domain.enums.propertyeditor;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.enums.DeleteState;
|
||||||
|
|
||||||
|
import java.beans.PropertyEditorSupport;
|
||||||
|
|
||||||
|
public class DeleteStatePropertyEditor extends PropertyEditorSupport {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
|
try{
|
||||||
|
Integer enumValue = Integer.parseInt(text);
|
||||||
|
setValue(DeleteState.of(enumValue));
|
||||||
|
}catch (NumberFormatException e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -8,13 +8,11 @@ import com.ruoyi.common.utils.ServletUtils;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class TableSupport
|
public class TableSupport {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 封装分页对象
|
* 封装分页对象
|
||||||
*/
|
*/
|
||||||
public static PageDomain getPageDomain()
|
public static PageDomain getPageDomain() {
|
||||||
{
|
|
||||||
PageDomain pageDomain = new PageDomain();
|
PageDomain pageDomain = new PageDomain();
|
||||||
pageDomain.setPageNum(ServletUtils.getParameterToInt(Constants.PAGE_NUM));
|
pageDomain.setPageNum(ServletUtils.getParameterToInt(Constants.PAGE_NUM));
|
||||||
pageDomain.setPageSize(ServletUtils.getParameterToInt(Constants.PAGE_SIZE));
|
pageDomain.setPageSize(ServletUtils.getParameterToInt(Constants.PAGE_SIZE));
|
||||||
|
|
@ -23,8 +21,7 @@ public class TableSupport
|
||||||
return pageDomain;
|
return pageDomain;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PageDomain buildPageRequest()
|
public static PageDomain buildPageRequest() {
|
||||||
{
|
|
||||||
return getPageDomain();
|
return getPageDomain();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.ruoyi.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.ruoyi.common.utils.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -9,20 +10,31 @@ import com.ruoyi.common.utils.StringUtils;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
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);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -31,46 +43,40 @@ public class CharsetKit
|
||||||
* @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);
|
||||||
|
|
@ -79,8 +85,7 @@ public class CharsetKit
|
||||||
/**
|
/**
|
||||||
* @return 系统字符集编码
|
* @return 系统字符集编码
|
||||||
*/
|
*/
|
||||||
public static String systemCharset()
|
public static String systemCharset() {
|
||||||
{
|
|
||||||
return Charset.defaultCharset().name();
|
return Charset.defaultCharset().name();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import java.nio.ByteBuffer;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -13,25 +14,21 @@ import com.ruoyi.common.utils.StringUtils;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class Convert
|
public class Convert {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 转换为字符串<br>
|
* 转换为字符串<br>
|
||||||
* 如果给定的值为null,或者转换失败,返回默认值<br>
|
* 如果给定的值为null,或者转换失败,返回默认值<br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static String toStr(Object value, String defaultValue)
|
public static String toStr(Object value, String defaultValue) {
|
||||||
{
|
if (null == value) {
|
||||||
if (null == value)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
if (value instanceof String)
|
if (value instanceof String) {
|
||||||
{
|
|
||||||
return (String) value;
|
return (String) value;
|
||||||
}
|
}
|
||||||
return value.toString();
|
return value.toString();
|
||||||
|
|
@ -45,8 +42,7 @@ public class Convert
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static String toStr(Object value)
|
public static String toStr(Object value) {
|
||||||
{
|
|
||||||
return toStr(value, null);
|
return toStr(value, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -55,18 +51,15 @@ public class Convert
|
||||||
* 如果给定的值为null,或者转换失败,返回默认值<br>
|
* 如果给定的值为null,或者转换失败,返回默认值<br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Character toChar(Object value, Character defaultValue)
|
public static Character toChar(Object value, Character defaultValue) {
|
||||||
{
|
if (null == value) {
|
||||||
if (null == value)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
if (value instanceof Character)
|
if (value instanceof Character) {
|
||||||
{
|
|
||||||
return (Character) value;
|
return (Character) value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -82,8 +75,7 @@ public class Convert
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Character toChar(Object value)
|
public static Character toChar(Object value) {
|
||||||
{
|
|
||||||
return toChar(value, null);
|
return toChar(value, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -92,35 +84,27 @@ public class Convert
|
||||||
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br>
|
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Byte toByte(Object value, Byte defaultValue)
|
public static Byte toByte(Object value, Byte defaultValue) {
|
||||||
{
|
if (value == null) {
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
if (value instanceof Byte)
|
if (value instanceof Byte) {
|
||||||
{
|
|
||||||
return (Byte) value;
|
return (Byte) value;
|
||||||
}
|
}
|
||||||
if (value instanceof Number)
|
if (value instanceof Number) {
|
||||||
{
|
|
||||||
return ((Number) value).byteValue();
|
return ((Number) value).byteValue();
|
||||||
}
|
}
|
||||||
final String valueStr = toStr(value, null);
|
final String valueStr = toStr(value, null);
|
||||||
if (StringUtils.isEmpty(valueStr))
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
return Byte.parseByte(valueStr);
|
return Byte.parseByte(valueStr);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -133,8 +117,7 @@ public class Convert
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Byte toByte(Object value)
|
public static Byte toByte(Object value) {
|
||||||
{
|
|
||||||
return toByte(value, null);
|
return toByte(value, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -143,35 +126,27 @@ public class Convert
|
||||||
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br>
|
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Short toShort(Object value, Short defaultValue)
|
public static Short toShort(Object value, Short defaultValue) {
|
||||||
{
|
if (value == null) {
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
if (value instanceof Short)
|
if (value instanceof Short) {
|
||||||
{
|
|
||||||
return (Short) value;
|
return (Short) value;
|
||||||
}
|
}
|
||||||
if (value instanceof Number)
|
if (value instanceof Number) {
|
||||||
{
|
|
||||||
return ((Number) value).shortValue();
|
return ((Number) value).shortValue();
|
||||||
}
|
}
|
||||||
final String valueStr = toStr(value, null);
|
final String valueStr = toStr(value, null);
|
||||||
if (StringUtils.isEmpty(valueStr))
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
return Short.parseShort(valueStr.trim());
|
return Short.parseShort(valueStr.trim());
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -184,8 +159,7 @@ public class Convert
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Short toShort(Object value)
|
public static Short toShort(Object value) {
|
||||||
{
|
|
||||||
return toShort(value, null);
|
return toShort(value, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -194,31 +168,24 @@ public class Convert
|
||||||
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Number toNumber(Object value, Number defaultValue)
|
public static Number toNumber(Object value, Number defaultValue) {
|
||||||
{
|
if (value == null) {
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
if (value instanceof Number)
|
if (value instanceof Number) {
|
||||||
{
|
|
||||||
return (Number) value;
|
return (Number) value;
|
||||||
}
|
}
|
||||||
final String valueStr = toStr(value, null);
|
final String valueStr = toStr(value, null);
|
||||||
if (StringUtils.isEmpty(valueStr))
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
return NumberFormat.getInstance().parse(valueStr);
|
return NumberFormat.getInstance().parse(valueStr);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -231,8 +198,7 @@ public class Convert
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Number toNumber(Object value)
|
public static Number toNumber(Object value) {
|
||||||
{
|
|
||||||
return toNumber(value, null);
|
return toNumber(value, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -241,35 +207,27 @@ public class Convert
|
||||||
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Integer toInt(Object value, Integer defaultValue)
|
public static Integer toInt(Object value, Integer defaultValue) {
|
||||||
{
|
if (value == null) {
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
if (value instanceof Integer)
|
if (value instanceof Integer) {
|
||||||
{
|
|
||||||
return (Integer) value;
|
return (Integer) value;
|
||||||
}
|
}
|
||||||
if (value instanceof Number)
|
if (value instanceof Number) {
|
||||||
{
|
|
||||||
return ((Number) value).intValue();
|
return ((Number) value).intValue();
|
||||||
}
|
}
|
||||||
final String valueStr = toStr(value, null);
|
final String valueStr = toStr(value, null);
|
||||||
if (StringUtils.isEmpty(valueStr))
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
return Integer.parseInt(valueStr.trim());
|
return Integer.parseInt(valueStr.trim());
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -282,8 +240,7 @@ public class Convert
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Integer toInt(Object value)
|
public static Integer toInt(Object value) {
|
||||||
{
|
|
||||||
return toInt(value, null);
|
return toInt(value, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -293,8 +250,7 @@ public class Convert
|
||||||
* @param str 被转换的值
|
* @param str 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Integer[] toIntArray(String str)
|
public static Integer[] toIntArray(String str) {
|
||||||
{
|
|
||||||
return toIntArray(",", str);
|
return toIntArray(",", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -304,8 +260,7 @@ public class Convert
|
||||||
* @param str 被转换的值
|
* @param str 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Long[] toLongArray(String str)
|
public static Long[] toLongArray(String str) {
|
||||||
{
|
|
||||||
return toLongArray(",", str);
|
return toLongArray(",", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -316,16 +271,13 @@ public class Convert
|
||||||
* @param split 被转换的值
|
* @param split 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Integer[] toIntArray(String split, String str)
|
public static Integer[] toIntArray(String split, String str) {
|
||||||
{
|
if (StringUtils.isEmpty(str)) {
|
||||||
if (StringUtils.isEmpty(str))
|
return new Integer[]{};
|
||||||
{
|
|
||||||
return new Integer[] {};
|
|
||||||
}
|
}
|
||||||
String[] arr = str.split(split);
|
String[] arr = str.split(split);
|
||||||
final Integer[] ints = new Integer[arr.length];
|
final Integer[] ints = new Integer[arr.length];
|
||||||
for (int i = 0; i < arr.length; i++)
|
for (int i = 0; i < arr.length; i++) {
|
||||||
{
|
|
||||||
final Integer v = toInt(arr[i], 0);
|
final Integer v = toInt(arr[i], 0);
|
||||||
ints[i] = v;
|
ints[i] = v;
|
||||||
}
|
}
|
||||||
|
|
@ -336,19 +288,16 @@ public class Convert
|
||||||
* 转换为Long数组<br>
|
* 转换为Long数组<br>
|
||||||
*
|
*
|
||||||
* @param split 分隔符
|
* @param split 分隔符
|
||||||
* @param str 被转换的值
|
* @param str 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Long[] toLongArray(String split, String str)
|
public static Long[] toLongArray(String split, String str) {
|
||||||
{
|
if (StringUtils.isEmpty(str)) {
|
||||||
if (StringUtils.isEmpty(str))
|
return new Long[]{};
|
||||||
{
|
|
||||||
return new Long[] {};
|
|
||||||
}
|
}
|
||||||
String[] arr = str.split(split);
|
String[] arr = str.split(split);
|
||||||
final Long[] longs = new Long[arr.length];
|
final Long[] longs = new Long[arr.length];
|
||||||
for (int i = 0; i < arr.length; i++)
|
for (int i = 0; i < arr.length; i++) {
|
||||||
{
|
|
||||||
final Long v = toLong(arr[i], null);
|
final Long v = toLong(arr[i], null);
|
||||||
longs[i] = v;
|
longs[i] = v;
|
||||||
}
|
}
|
||||||
|
|
@ -361,8 +310,7 @@ public class Convert
|
||||||
* @param str 被转换的值
|
* @param str 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static String[] toStrArray(String str)
|
public static String[] toStrArray(String str) {
|
||||||
{
|
|
||||||
return toStrArray(",", str);
|
return toStrArray(",", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -373,8 +321,7 @@ public class Convert
|
||||||
* @param split 被转换的值
|
* @param split 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static String[] toStrArray(String split, String str)
|
public static String[] toStrArray(String split, String str) {
|
||||||
{
|
|
||||||
return str.split(split);
|
return str.split(split);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -383,36 +330,28 @@ public class Convert
|
||||||
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Long toLong(Object value, Long defaultValue)
|
public static Long toLong(Object value, Long defaultValue) {
|
||||||
{
|
if (value == null) {
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
if (value instanceof Long)
|
if (value instanceof Long) {
|
||||||
{
|
|
||||||
return (Long) value;
|
return (Long) value;
|
||||||
}
|
}
|
||||||
if (value instanceof Number)
|
if (value instanceof Number) {
|
||||||
{
|
|
||||||
return ((Number) value).longValue();
|
return ((Number) value).longValue();
|
||||||
}
|
}
|
||||||
final String valueStr = toStr(value, null);
|
final String valueStr = toStr(value, null);
|
||||||
if (StringUtils.isEmpty(valueStr))
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
// 支持科学计数法
|
// 支持科学计数法
|
||||||
return new BigDecimal(valueStr.trim()).longValue();
|
return new BigDecimal(valueStr.trim()).longValue();
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -425,8 +364,7 @@ public class Convert
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Long toLong(Object value)
|
public static Long toLong(Object value) {
|
||||||
{
|
|
||||||
return toLong(value, null);
|
return toLong(value, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -435,36 +373,28 @@ public class Convert
|
||||||
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Double toDouble(Object value, Double defaultValue)
|
public static Double toDouble(Object value, Double defaultValue) {
|
||||||
{
|
if (value == null) {
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
if (value instanceof Double)
|
if (value instanceof Double) {
|
||||||
{
|
|
||||||
return (Double) value;
|
return (Double) value;
|
||||||
}
|
}
|
||||||
if (value instanceof Number)
|
if (value instanceof Number) {
|
||||||
{
|
|
||||||
return ((Number) value).doubleValue();
|
return ((Number) value).doubleValue();
|
||||||
}
|
}
|
||||||
final String valueStr = toStr(value, null);
|
final String valueStr = toStr(value, null);
|
||||||
if (StringUtils.isEmpty(valueStr))
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
// 支持科学计数法
|
// 支持科学计数法
|
||||||
return new BigDecimal(valueStr.trim()).doubleValue();
|
return new BigDecimal(valueStr.trim()).doubleValue();
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -477,8 +407,7 @@ public class Convert
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Double toDouble(Object value)
|
public static Double toDouble(Object value) {
|
||||||
{
|
|
||||||
return toDouble(value, null);
|
return toDouble(value, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -487,35 +416,27 @@ public class Convert
|
||||||
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Float toFloat(Object value, Float defaultValue)
|
public static Float toFloat(Object value, Float defaultValue) {
|
||||||
{
|
if (value == null) {
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
if (value instanceof Float)
|
if (value instanceof Float) {
|
||||||
{
|
|
||||||
return (Float) value;
|
return (Float) value;
|
||||||
}
|
}
|
||||||
if (value instanceof Number)
|
if (value instanceof Number) {
|
||||||
{
|
|
||||||
return ((Number) value).floatValue();
|
return ((Number) value).floatValue();
|
||||||
}
|
}
|
||||||
final String valueStr = toStr(value, null);
|
final String valueStr = toStr(value, null);
|
||||||
if (StringUtils.isEmpty(valueStr))
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
return Float.parseFloat(valueStr.trim());
|
return Float.parseFloat(valueStr.trim());
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -528,8 +449,7 @@ public class Convert
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Float toFloat(Object value)
|
public static Float toFloat(Object value) {
|
||||||
{
|
|
||||||
return toFloat(value, null);
|
return toFloat(value, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -538,28 +458,23 @@ public class Convert
|
||||||
* String支持的值为:true、false、yes、ok、no,1,0 如果给定的值为空,或者转换失败,返回默认值<br>
|
* String支持的值为:true、false、yes、ok、no,1,0 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Boolean toBool(Object value, Boolean defaultValue)
|
public static Boolean toBool(Object value, Boolean defaultValue) {
|
||||||
{
|
if (value == null) {
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
if (value instanceof Boolean)
|
if (value instanceof Boolean) {
|
||||||
{
|
|
||||||
return (Boolean) value;
|
return (Boolean) value;
|
||||||
}
|
}
|
||||||
String valueStr = toStr(value, null);
|
String valueStr = toStr(value, null);
|
||||||
if (StringUtils.isEmpty(valueStr))
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
valueStr = valueStr.trim().toLowerCase();
|
valueStr = valueStr.trim().toLowerCase();
|
||||||
switch (valueStr)
|
switch (valueStr) {
|
||||||
{
|
|
||||||
case "true":
|
case "true":
|
||||||
return true;
|
return true;
|
||||||
case "false":
|
case "false":
|
||||||
|
|
@ -587,8 +502,7 @@ public class Convert
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Boolean toBool(Object value)
|
public static Boolean toBool(Object value) {
|
||||||
{
|
|
||||||
return toBool(value, null);
|
return toBool(value, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -596,34 +510,27 @@ public class Convert
|
||||||
* 转换为Enum对象<br>
|
* 转换为Enum对象<br>
|
||||||
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
*
|
*
|
||||||
* @param clazz Enum的Class
|
* @param clazz Enum的Class
|
||||||
* @param value 值
|
* @param value 值
|
||||||
* @param defaultValue 默认值
|
* @param defaultValue 默认值
|
||||||
* @return Enum
|
* @return Enum
|
||||||
*/
|
*/
|
||||||
public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value, E defaultValue)
|
public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value, E defaultValue) {
|
||||||
{
|
if (value == null) {
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
if (clazz.isAssignableFrom(value.getClass()))
|
if (clazz.isAssignableFrom(value.getClass())) {
|
||||||
{
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
E myE = (E) value;
|
E myE = (E) value;
|
||||||
return myE;
|
return myE;
|
||||||
}
|
}
|
||||||
final String valueStr = toStr(value, null);
|
final String valueStr = toStr(value, null);
|
||||||
if (StringUtils.isEmpty(valueStr))
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
return Enum.valueOf(clazz, valueStr);
|
return Enum.valueOf(clazz, valueStr);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -636,8 +543,7 @@ public class Convert
|
||||||
* @param value 值
|
* @param value 值
|
||||||
* @return Enum
|
* @return Enum
|
||||||
*/
|
*/
|
||||||
public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value)
|
public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value) {
|
||||||
{
|
|
||||||
return toEnum(clazz, value, null);
|
return toEnum(clazz, value, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -646,35 +552,27 @@ public class Convert
|
||||||
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static BigInteger toBigInteger(Object value, BigInteger defaultValue)
|
public static BigInteger toBigInteger(Object value, BigInteger defaultValue) {
|
||||||
{
|
if (value == null) {
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
if (value instanceof BigInteger)
|
if (value instanceof BigInteger) {
|
||||||
{
|
|
||||||
return (BigInteger) value;
|
return (BigInteger) value;
|
||||||
}
|
}
|
||||||
if (value instanceof Long)
|
if (value instanceof Long) {
|
||||||
{
|
|
||||||
return BigInteger.valueOf((Long) value);
|
return BigInteger.valueOf((Long) value);
|
||||||
}
|
}
|
||||||
final String valueStr = toStr(value, null);
|
final String valueStr = toStr(value, null);
|
||||||
if (StringUtils.isEmpty(valueStr))
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
return new BigInteger(valueStr);
|
return new BigInteger(valueStr);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -687,8 +585,7 @@ public class Convert
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static BigInteger toBigInteger(Object value)
|
public static BigInteger toBigInteger(Object value) {
|
||||||
{
|
|
||||||
return toBigInteger(value, null);
|
return toBigInteger(value, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -697,43 +594,33 @@ public class Convert
|
||||||
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue)
|
public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue) {
|
||||||
{
|
if (value == null) {
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
if (value instanceof BigDecimal)
|
if (value instanceof BigDecimal) {
|
||||||
{
|
|
||||||
return (BigDecimal) value;
|
return (BigDecimal) value;
|
||||||
}
|
}
|
||||||
if (value instanceof Long)
|
if (value instanceof Long) {
|
||||||
{
|
|
||||||
return new BigDecimal((Long) value);
|
return new BigDecimal((Long) value);
|
||||||
}
|
}
|
||||||
if (value instanceof Double)
|
if (value instanceof Double) {
|
||||||
{
|
|
||||||
return new BigDecimal((Double) value);
|
return new BigDecimal((Double) value);
|
||||||
}
|
}
|
||||||
if (value instanceof Integer)
|
if (value instanceof Integer) {
|
||||||
{
|
|
||||||
return new BigDecimal((Integer) value);
|
return new BigDecimal((Integer) value);
|
||||||
}
|
}
|
||||||
final String valueStr = toStr(value, null);
|
final String valueStr = toStr(value, null);
|
||||||
if (StringUtils.isEmpty(valueStr))
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
return new BigDecimal(valueStr);
|
return new BigDecimal(valueStr);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -746,8 +633,7 @@ public class Convert
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static BigDecimal toBigDecimal(Object value)
|
public static BigDecimal toBigDecimal(Object value) {
|
||||||
{
|
|
||||||
return toBigDecimal(value, null);
|
return toBigDecimal(value, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -758,8 +644,7 @@ public class Convert
|
||||||
* @param obj 对象
|
* @param obj 对象
|
||||||
* @return 字符串
|
* @return 字符串
|
||||||
*/
|
*/
|
||||||
public static String utf8Str(Object obj)
|
public static String utf8Str(Object obj) {
|
||||||
{
|
|
||||||
return str(obj, CharsetKit.CHARSET_UTF_8);
|
return str(obj, CharsetKit.CHARSET_UTF_8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -767,12 +652,11 @@ public class Convert
|
||||||
* 将对象转为字符串<br>
|
* 将对象转为字符串<br>
|
||||||
* 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
|
* 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
|
||||||
*
|
*
|
||||||
* @param obj 对象
|
* @param obj 对象
|
||||||
* @param charsetName 字符集
|
* @param charsetName 字符集
|
||||||
* @return 字符串
|
* @return 字符串
|
||||||
*/
|
*/
|
||||||
public static String str(Object obj, String charsetName)
|
public static String str(Object obj, String charsetName) {
|
||||||
{
|
|
||||||
return str(obj, Charset.forName(charsetName));
|
return str(obj, Charset.forName(charsetName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -780,27 +664,20 @@ public class Convert
|
||||||
* 将对象转为字符串<br>
|
* 将对象转为字符串<br>
|
||||||
* 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
|
* 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
|
||||||
*
|
*
|
||||||
* @param obj 对象
|
* @param obj 对象
|
||||||
* @param charset 字符集
|
* @param charset 字符集
|
||||||
* @return 字符串
|
* @return 字符串
|
||||||
*/
|
*/
|
||||||
public static String str(Object obj, Charset charset)
|
public static String str(Object obj, Charset charset) {
|
||||||
{
|
if (null == obj) {
|
||||||
if (null == obj)
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj instanceof String)
|
if (obj instanceof String) {
|
||||||
{
|
|
||||||
return (String) obj;
|
return (String) obj;
|
||||||
}
|
} else if (obj instanceof byte[] || obj instanceof Byte[]) {
|
||||||
else if (obj instanceof byte[] || obj instanceof Byte[])
|
|
||||||
{
|
|
||||||
return str((Byte[]) obj, charset);
|
return str((Byte[]) obj, charset);
|
||||||
}
|
} else if (obj instanceof ByteBuffer) {
|
||||||
else if (obj instanceof ByteBuffer)
|
|
||||||
{
|
|
||||||
return str((ByteBuffer) obj, charset);
|
return str((ByteBuffer) obj, charset);
|
||||||
}
|
}
|
||||||
return obj.toString();
|
return obj.toString();
|
||||||
|
|
@ -809,31 +686,27 @@ public class Convert
|
||||||
/**
|
/**
|
||||||
* 将byte数组转为字符串
|
* 将byte数组转为字符串
|
||||||
*
|
*
|
||||||
* @param bytes byte数组
|
* @param bytes byte数组
|
||||||
* @param charset 字符集
|
* @param charset 字符集
|
||||||
* @return 字符串
|
* @return 字符串
|
||||||
*/
|
*/
|
||||||
public static String str(byte[] bytes, String charset)
|
public static String str(byte[] bytes, String charset) {
|
||||||
{
|
|
||||||
return str(bytes, StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset));
|
return str(bytes, StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解码字节码
|
* 解码字节码
|
||||||
*
|
*
|
||||||
* @param data 字符串
|
* @param data 字符串
|
||||||
* @param charset 字符集,如果此字段为空,则解码的结果取决于平台
|
* @param charset 字符集,如果此字段为空,则解码的结果取决于平台
|
||||||
* @return 解码后的字符串
|
* @return 解码后的字符串
|
||||||
*/
|
*/
|
||||||
public static String str(byte[] data, Charset charset)
|
public static String str(byte[] data, Charset charset) {
|
||||||
{
|
if (data == null) {
|
||||||
if (data == null)
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null == charset)
|
if (null == charset) {
|
||||||
{
|
|
||||||
return new String(data);
|
return new String(data);
|
||||||
}
|
}
|
||||||
return new String(data, charset);
|
return new String(data, charset);
|
||||||
|
|
@ -842,14 +715,12 @@ public class Convert
|
||||||
/**
|
/**
|
||||||
* 将编码的byteBuffer数据转换为字符串
|
* 将编码的byteBuffer数据转换为字符串
|
||||||
*
|
*
|
||||||
* @param data 数据
|
* @param data 数据
|
||||||
* @param charset 字符集,如果为空使用当前系统字符集
|
* @param charset 字符集,如果为空使用当前系统字符集
|
||||||
* @return 字符串
|
* @return 字符串
|
||||||
*/
|
*/
|
||||||
public static String str(ByteBuffer data, String charset)
|
public static String str(ByteBuffer data, String charset) {
|
||||||
{
|
if (data == null) {
|
||||||
if (data == null)
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -859,55 +730,47 @@ public class Convert
|
||||||
/**
|
/**
|
||||||
* 将编码的byteBuffer数据转换为字符串
|
* 将编码的byteBuffer数据转换为字符串
|
||||||
*
|
*
|
||||||
* @param data 数据
|
* @param data 数据
|
||||||
* @param charset 字符集,如果为空使用当前系统字符集
|
* @param charset 字符集,如果为空使用当前系统字符集
|
||||||
* @return 字符串
|
* @return 字符串
|
||||||
*/
|
*/
|
||||||
public static String str(ByteBuffer data, Charset charset)
|
public static String str(ByteBuffer data, Charset charset) {
|
||||||
{
|
if (null == charset) {
|
||||||
if (null == charset)
|
|
||||||
{
|
|
||||||
charset = Charset.defaultCharset();
|
charset = Charset.defaultCharset();
|
||||||
}
|
}
|
||||||
return charset.decode(data).toString();
|
return charset.decode(data).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------- 全角半角转换
|
// ----------------------------------------------------------------------- 全角半角转换
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 半角转全角
|
* 半角转全角
|
||||||
*
|
*
|
||||||
* @param input String.
|
* @param input String.
|
||||||
* @return 全角字符串.
|
* @return 全角字符串.
|
||||||
*/
|
*/
|
||||||
public static String toSBC(String input)
|
public static String toSBC(String input) {
|
||||||
{
|
|
||||||
return toSBC(input, null);
|
return toSBC(input, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 半角转全角
|
* 半角转全角
|
||||||
*
|
*
|
||||||
* @param input String
|
* @param input String
|
||||||
* @param notConvertSet 不替换的字符集合
|
* @param notConvertSet 不替换的字符集合
|
||||||
* @return 全角字符串.
|
* @return 全角字符串.
|
||||||
*/
|
*/
|
||||||
public static String toSBC(String input, Set<Character> notConvertSet)
|
public static String toSBC(String input, Set<Character> notConvertSet) {
|
||||||
{
|
|
||||||
char c[] = input.toCharArray();
|
char c[] = input.toCharArray();
|
||||||
for (int i = 0; i < c.length; i++)
|
for (int i = 0; i < c.length; i++) {
|
||||||
{
|
if (null != notConvertSet && notConvertSet.contains(c[i])) {
|
||||||
if (null != notConvertSet && notConvertSet.contains(c[i]))
|
|
||||||
{
|
|
||||||
// 跳过不替换的字符
|
// 跳过不替换的字符
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c[i] == ' ')
|
if (c[i] == ' ') {
|
||||||
{
|
|
||||||
c[i] = '\u3000';
|
c[i] = '\u3000';
|
||||||
}
|
} else if (c[i] < '\177') {
|
||||||
else if (c[i] < '\177')
|
|
||||||
{
|
|
||||||
c[i] = (char) (c[i] + 65248);
|
c[i] = (char) (c[i] + 65248);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -921,35 +784,28 @@ public class Convert
|
||||||
* @param input String.
|
* @param input String.
|
||||||
* @return 半角字符串
|
* @return 半角字符串
|
||||||
*/
|
*/
|
||||||
public static String toDBC(String input)
|
public static String toDBC(String input) {
|
||||||
{
|
|
||||||
return toDBC(input, null);
|
return toDBC(input, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 替换全角为半角
|
* 替换全角为半角
|
||||||
*
|
*
|
||||||
* @param text 文本
|
* @param text 文本
|
||||||
* @param notConvertSet 不替换的字符集合
|
* @param notConvertSet 不替换的字符集合
|
||||||
* @return 替换后的字符
|
* @return 替换后的字符
|
||||||
*/
|
*/
|
||||||
public static String toDBC(String text, Set<Character> notConvertSet)
|
public static String toDBC(String text, Set<Character> notConvertSet) {
|
||||||
{
|
|
||||||
char c[] = text.toCharArray();
|
char c[] = text.toCharArray();
|
||||||
for (int i = 0; i < c.length; i++)
|
for (int i = 0; i < c.length; i++) {
|
||||||
{
|
if (null != notConvertSet && notConvertSet.contains(c[i])) {
|
||||||
if (null != notConvertSet && notConvertSet.contains(c[i]))
|
|
||||||
{
|
|
||||||
// 跳过不替换的字符
|
// 跳过不替换的字符
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c[i] == '\u3000')
|
if (c[i] == '\u3000') {
|
||||||
{
|
|
||||||
c[i] = ' ';
|
c[i] = ' ';
|
||||||
}
|
} else if (c[i] > '\uFF00' && c[i] < '\uFF5F') {
|
||||||
else if (c[i] > '\uFF00' && c[i] < '\uFF5F')
|
|
||||||
{
|
|
||||||
c[i] = (char) (c[i] - 65248);
|
c[i] = (char) (c[i] - 65248);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -964,31 +820,26 @@ public class Convert
|
||||||
* @param n 数字
|
* @param n 数字
|
||||||
* @return 中文大写数字
|
* @return 中文大写数字
|
||||||
*/
|
*/
|
||||||
public static String digitUppercase(double n)
|
public static String digitUppercase(double n) {
|
||||||
{
|
String[] fraction = {"角", "分"};
|
||||||
String[] fraction = { "角", "分" };
|
String[] digit = {"零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"};
|
||||||
String[] digit = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" };
|
String[][] unit = {{"元", "万", "亿"}, {"", "拾", "佰", "仟"}};
|
||||||
String[][] unit = { { "元", "万", "亿" }, { "", "拾", "佰", "仟" } };
|
|
||||||
|
|
||||||
String head = n < 0 ? "负" : "";
|
String head = n < 0 ? "负" : "";
|
||||||
n = Math.abs(n);
|
n = Math.abs(n);
|
||||||
|
|
||||||
String s = "";
|
String s = "";
|
||||||
for (int i = 0; i < fraction.length; i++)
|
for (int i = 0; i < fraction.length; i++) {
|
||||||
{
|
|
||||||
s += (digit[(int) (Math.floor(n * 10 * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", "");
|
s += (digit[(int) (Math.floor(n * 10 * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", "");
|
||||||
}
|
}
|
||||||
if (s.length() < 1)
|
if (s.length() < 1) {
|
||||||
{
|
|
||||||
s = "整";
|
s = "整";
|
||||||
}
|
}
|
||||||
int integerPart = (int) Math.floor(n);
|
int integerPart = (int) Math.floor(n);
|
||||||
|
|
||||||
for (int i = 0; i < unit[0].length && integerPart > 0; i++)
|
for (int i = 0; i < unit[0].length && integerPart > 0; i++) {
|
||||||
{
|
|
||||||
String p = "";
|
String p = "";
|
||||||
for (int j = 0; j < unit[1].length && n > 0; j++)
|
for (int j = 0; j < unit[1].length && n > 0; j++) {
|
||||||
{
|
|
||||||
p = digit[integerPart % 10] + unit[1][j] + p;
|
p = digit[integerPart % 10] + unit[1][j] + p;
|
||||||
integerPart = integerPart / 10;
|
integerPart = integerPart / 10;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,7 @@ import com.ruoyi.common.utils.StringUtils;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
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 = '{';
|
||||||
|
|
@ -24,13 +23,11 @@ public class StrFormatter
|
||||||
* 转义\: 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();
|
||||||
|
|
@ -40,43 +37,30 @@ public class StrFormatter
|
||||||
|
|
||||||
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 > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH) {
|
||||||
if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == 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]));
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,7 @@ package com.ruoyi.common.enums;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public enum BusinessStatus
|
public enum BusinessStatus {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 成功
|
* 成功
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,7 @@ package com.ruoyi.common.enums;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public enum BusinessType
|
public enum BusinessType {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 其它
|
* 其它
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,7 @@ package com.ruoyi.common.enums;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public enum DataSourceType
|
public enum DataSourceType {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 主库
|
* 主库
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -5,20 +5,19 @@ package com.ruoyi.common.enums;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public enum OnlineStatus
|
public enum OnlineStatus {
|
||||||
{
|
/**
|
||||||
/** 用户状态 */
|
* 用户状态
|
||||||
|
*/
|
||||||
on_line("在线"), off_line("离线");
|
on_line("在线"), off_line("离线");
|
||||||
|
|
||||||
private final String info;
|
private final String info;
|
||||||
|
|
||||||
private OnlineStatus(String info)
|
private OnlineStatus(String info) {
|
||||||
{
|
|
||||||
this.info = info;
|
this.info = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getInfo()
|
public String getInfo() {
|
||||||
{
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,7 @@ package com.ruoyi.common.enums;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public enum OperatorType
|
public enum OperatorType {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 其它
|
* 其它
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -5,26 +5,22 @@ package com.ruoyi.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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.ruoyi.common.enums.converter;
|
||||||
|
|
||||||
|
import com.ruoyi.common.enums.OnlineStatus;
|
||||||
|
|
||||||
|
import javax.persistence.AttributeConverter;
|
||||||
|
import javax.persistence.Converter;
|
||||||
|
|
||||||
|
@Converter(autoApply = true)
|
||||||
|
public class OnlineStatusConverter implements AttributeConverter<OnlineStatus, String> {
|
||||||
|
@Override
|
||||||
|
public String convertToDatabaseColumn(OnlineStatus attribute) {
|
||||||
|
return attribute == null ? null : attribute.name();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OnlineStatus convertToEntityAttribute(String dbData) {
|
||||||
|
return OnlineStatus.valueOf(dbData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -5,26 +5,22 @@ package com.ruoyi.common.exception;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class BusinessException extends RuntimeException
|
public class BusinessException extends RuntimeException {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
protected final String message;
|
protected final String message;
|
||||||
|
|
||||||
public BusinessException(String message)
|
public BusinessException(String message) {
|
||||||
{
|
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BusinessException(String message, Throwable e)
|
public BusinessException(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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,9 @@ package com.ruoyi.common.exception;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
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() {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,7 @@ import com.ruoyi.common.utils.StringUtils;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class BaseException extends RuntimeException
|
public class BaseException extends RuntimeException {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -32,66 +31,54 @@ public class BaseException extends RuntimeException
|
||||||
*/
|
*/
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,10 @@ import com.ruoyi.common.exception.base.BaseException;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,10 @@ package com.ruoyi.common.exception.file;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
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 });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,10 @@ package com.ruoyi.common.exception.file;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
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 });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,30 +5,25 @@ package com.ruoyi.common.exception.job;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class TaskException extends Exception
|
public class TaskException extends Exception {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private Code code;
|
private Code code;
|
||||||
|
|
||||||
public TaskException(String msg, Code code)
|
public TaskException(String msg, Code code) {
|
||||||
{
|
|
||||||
this(msg, code, null);
|
this(msg, code, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TaskException(String msg, Code code, Exception nestedEx)
|
public TaskException(String msg, Code code, Exception nestedEx) {
|
||||||
{
|
|
||||||
super(msg, nestedEx);
|
super(msg, nestedEx);
|
||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Code getCode()
|
public Code getCode() {
|
||||||
{
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Code
|
public enum Code {
|
||||||
{
|
|
||||||
TASK_EXISTS, NO_TASK_EXISTS, TASK_ALREADY_STARTED, UNKNOWN, CONFIG_ERROR, TASK_NODE_NOT_AVAILABLE
|
TASK_EXISTS, NO_TASK_EXISTS, TASK_ALREADY_STARTED, UNKNOWN, CONFIG_ERROR, TASK_NODE_NOT_AVAILABLE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -5,12 +5,10 @@ package com.ruoyi.common.exception.user;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class CaptchaException extends UserException
|
public class CaptchaException extends UserException {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public CaptchaException()
|
public CaptchaException() {
|
||||||
{
|
|
||||||
super("user.jcaptcha.error", null);
|
super("user.jcaptcha.error", null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,10 @@ package com.ruoyi.common.exception.user;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class RoleBlockedException extends UserException
|
public class RoleBlockedException extends UserException {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public RoleBlockedException()
|
public RoleBlockedException() {
|
||||||
{
|
|
||||||
super("role.blocked", null);
|
super("role.blocked", null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,10 @@ package com.ruoyi.common.exception.user;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class UserBlockedException extends UserException
|
public class UserBlockedException extends UserException {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public UserBlockedException()
|
public UserBlockedException() {
|
||||||
{
|
|
||||||
super("user.blocked", null);
|
super("user.blocked", null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,10 @@ package com.ruoyi.common.exception.user;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class UserDeleteException extends UserException
|
public class UserDeleteException extends UserException {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public UserDeleteException()
|
public UserDeleteException() {
|
||||||
{
|
|
||||||
super("user.password.delete", null);
|
super("user.password.delete", null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,10 @@ import com.ruoyi.common.exception.base.BaseException;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class UserException extends BaseException
|
public class UserException extends BaseException {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public UserException(String code, Object[] args)
|
public UserException(String code, Object[] args) {
|
||||||
{
|
|
||||||
super("user", code, args, null);
|
super("user", code, args, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,10 @@ package com.ruoyi.common.exception.user;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class UserNotExistsException extends UserException
|
public class UserNotExistsException extends UserException {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public UserNotExistsException()
|
public UserNotExistsException() {
|
||||||
{
|
|
||||||
super("user.not.exists", null);
|
super("user.not.exists", null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,10 @@ package com.ruoyi.common.exception.user;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class UserPasswordNotMatchException extends UserException
|
public class UserPasswordNotMatchException extends UserException {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public UserPasswordNotMatchException()
|
public UserPasswordNotMatchException() {
|
||||||
{
|
|
||||||
super("user.password.not.match", null);
|
super("user.password.not.match", null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,10 @@ package com.ruoyi.common.exception.user;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class UserPasswordRetryLimitCountException extends UserException
|
public class UserPasswordRetryLimitCountException extends UserException {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public UserPasswordRetryLimitCountException(int retryLimitCount)
|
public UserPasswordRetryLimitCountException(int retryLimitCount) {
|
||||||
{
|
super("user.password.retry.limit.count", new Object[]{retryLimitCount});
|
||||||
super("user.password.retry.limit.count", new Object[] { retryLimitCount });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,10 @@ package com.ruoyi.common.exception.user;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class UserPasswordRetryLimitExceedException extends UserException
|
public class UserPasswordRetryLimitExceedException extends UserException {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public UserPasswordRetryLimitExceedException(int retryLimitCount)
|
public UserPasswordRetryLimitExceedException(int retryLimitCount) {
|
||||||
{
|
super("user.password.retry.limit.exceed", new Object[]{retryLimitCount});
|
||||||
super("user.password.retry.limit.exceed", new Object[] { retryLimitCount });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonGenerationException;
|
import com.fasterxml.jackson.core.JsonGenerationException;
|
||||||
import com.fasterxml.jackson.core.JsonParseException;
|
import com.fasterxml.jackson.core.JsonParseException;
|
||||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||||
|
|
@ -15,172 +16,106 @@ import com.fasterxml.jackson.databind.ObjectWriter;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class JSON
|
public class JSON {
|
||||||
{
|
|
||||||
public static final String DEFAULT_FAIL = "\"Parse failed\"";
|
public static final String DEFAULT_FAIL = "\"Parse failed\"";
|
||||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||||
private static final ObjectWriter objectWriter = objectMapper.writerWithDefaultPrettyPrinter();
|
private static final ObjectWriter objectWriter = objectMapper.writerWithDefaultPrettyPrinter();
|
||||||
|
|
||||||
public static void marshal(File file, Object value) throws Exception
|
public static void marshal(File file, Object value) throws Exception {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
objectWriter.writeValue(file, value);
|
objectWriter.writeValue(file, value);
|
||||||
}
|
} catch (JsonGenerationException e) {
|
||||||
catch (JsonGenerationException e)
|
|
||||||
{
|
|
||||||
throw new Exception(e);
|
throw new Exception(e);
|
||||||
}
|
} catch (JsonMappingException e) {
|
||||||
catch (JsonMappingException e)
|
|
||||||
{
|
|
||||||
throw new Exception(e);
|
throw new Exception(e);
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
throw new Exception(e);
|
throw new Exception(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void marshal(OutputStream os, Object value) throws Exception
|
public static void marshal(OutputStream os, Object value) throws Exception {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
objectWriter.writeValue(os, value);
|
objectWriter.writeValue(os, value);
|
||||||
}
|
} catch (JsonGenerationException e) {
|
||||||
catch (JsonGenerationException e)
|
|
||||||
{
|
|
||||||
throw new Exception(e);
|
throw new Exception(e);
|
||||||
}
|
} catch (JsonMappingException e) {
|
||||||
catch (JsonMappingException e)
|
|
||||||
{
|
|
||||||
throw new Exception(e);
|
throw new Exception(e);
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
throw new Exception(e);
|
throw new Exception(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String marshal(Object value) throws Exception
|
public static String marshal(Object value) throws Exception {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
return objectWriter.writeValueAsString(value);
|
return objectWriter.writeValueAsString(value);
|
||||||
}
|
} catch (JsonGenerationException e) {
|
||||||
catch (JsonGenerationException e)
|
|
||||||
{
|
|
||||||
throw new Exception(e);
|
throw new Exception(e);
|
||||||
}
|
} catch (JsonMappingException e) {
|
||||||
catch (JsonMappingException e)
|
|
||||||
{
|
|
||||||
throw new Exception(e);
|
throw new Exception(e);
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
throw new Exception(e);
|
throw new Exception(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] marshalBytes(Object value) throws Exception
|
public static byte[] marshalBytes(Object value) throws Exception {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
return objectWriter.writeValueAsBytes(value);
|
return objectWriter.writeValueAsBytes(value);
|
||||||
}
|
} catch (JsonGenerationException e) {
|
||||||
catch (JsonGenerationException e)
|
|
||||||
{
|
|
||||||
throw new Exception(e);
|
throw new Exception(e);
|
||||||
}
|
} catch (JsonMappingException e) {
|
||||||
catch (JsonMappingException e)
|
|
||||||
{
|
|
||||||
throw new Exception(e);
|
throw new Exception(e);
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
throw new Exception(e);
|
throw new Exception(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> T unmarshal(File file, Class<T> valueType) throws Exception
|
public static <T> T unmarshal(File file, Class<T> valueType) throws Exception {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
return objectMapper.readValue(file, valueType);
|
return objectMapper.readValue(file, valueType);
|
||||||
}
|
} catch (JsonParseException e) {
|
||||||
catch (JsonParseException e)
|
|
||||||
{
|
|
||||||
throw new Exception(e);
|
throw new Exception(e);
|
||||||
}
|
} catch (JsonMappingException e) {
|
||||||
catch (JsonMappingException e)
|
|
||||||
{
|
|
||||||
throw new Exception(e);
|
throw new Exception(e);
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
throw new Exception(e);
|
throw new Exception(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> T unmarshal(InputStream is, Class<T> valueType) throws Exception
|
public static <T> T unmarshal(InputStream is, Class<T> valueType) throws Exception {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
return objectMapper.readValue(is, valueType);
|
return objectMapper.readValue(is, valueType);
|
||||||
}
|
} catch (JsonParseException e) {
|
||||||
catch (JsonParseException e)
|
|
||||||
{
|
|
||||||
throw new Exception(e);
|
throw new Exception(e);
|
||||||
}
|
} catch (JsonMappingException e) {
|
||||||
catch (JsonMappingException e)
|
|
||||||
{
|
|
||||||
throw new Exception(e);
|
throw new Exception(e);
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
throw new Exception(e);
|
throw new Exception(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> T unmarshal(String str, Class<T> valueType) throws Exception
|
public static <T> T unmarshal(String str, Class<T> valueType) throws Exception {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
return objectMapper.readValue(str, valueType);
|
return objectMapper.readValue(str, valueType);
|
||||||
}
|
} catch (JsonParseException e) {
|
||||||
catch (JsonParseException e)
|
|
||||||
{
|
|
||||||
throw new Exception(e);
|
throw new Exception(e);
|
||||||
}
|
} catch (JsonMappingException e) {
|
||||||
catch (JsonMappingException e)
|
|
||||||
{
|
|
||||||
throw new Exception(e);
|
throw new Exception(e);
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
throw new Exception(e);
|
throw new Exception(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> T unmarshal(byte[] bytes, Class<T> valueType) throws Exception
|
public static <T> T unmarshal(byte[] bytes, Class<T> valueType) throws Exception {
|
||||||
{
|
try {
|
||||||
try
|
if (bytes == null) {
|
||||||
{
|
|
||||||
if (bytes == null)
|
|
||||||
{
|
|
||||||
bytes = new byte[0];
|
bytes = new byte[0];
|
||||||
}
|
}
|
||||||
return objectMapper.readValue(bytes, 0, bytes.length, valueType);
|
return objectMapper.readValue(bytes, 0, bytes.length, valueType);
|
||||||
}
|
} catch (JsonParseException e) {
|
||||||
catch (JsonParseException e)
|
|
||||||
{
|
|
||||||
throw new Exception(e);
|
throw new Exception(e);
|
||||||
}
|
} catch (JsonMappingException e) {
|
||||||
catch (JsonMappingException e)
|
|
||||||
{
|
|
||||||
throw new Exception(e);
|
throw new Exception(e);
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
throw new Exception(e);
|
throw new Exception(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import java.util.Map;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
|
||||||
|
|
@ -16,8 +17,7 @@ import com.ruoyi.common.utils.StringUtils;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class JSONObject extends LinkedHashMap<String, Object>
|
public class JSONObject extends LinkedHashMap<String, Object> {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private static final Pattern arrayNamePattern = Pattern.compile("(\\w+)((\\[\\d+\\])+)");
|
private static final Pattern arrayNamePattern = Pattern.compile("(\\w+)((\\[\\d+\\])+)");
|
||||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
@ -25,71 +25,55 @@ public class JSONObject extends LinkedHashMap<String, Object>
|
||||||
/**
|
/**
|
||||||
* 数组结构。
|
* 数组结构。
|
||||||
*/
|
*/
|
||||||
public static class JSONArray extends ArrayList<Object>
|
public static class JSONArray extends ArrayList<Object> {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public JSONArray()
|
public JSONArray() {
|
||||||
{
|
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONArray(int size)
|
public JSONArray(int size) {
|
||||||
{
|
|
||||||
super(size);
|
super(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
return JSON.marshal(this);
|
return JSON.marshal(this);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object set(int index, Object element)
|
public Object set(int index, Object element) {
|
||||||
{
|
|
||||||
return super.set(index, transfer(element));
|
return super.set(index, transfer(element));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean add(Object element)
|
public boolean add(Object element) {
|
||||||
{
|
|
||||||
return super.add(transfer(element));
|
return super.add(transfer(element));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(int index, Object element)
|
public void add(int index, Object element) {
|
||||||
{
|
|
||||||
super.add(index, transfer(element));
|
super.add(index, transfer(element));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject()
|
public JSONObject() {
|
||||||
{
|
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject(final JSONObject other)
|
public JSONObject(final JSONObject other) {
|
||||||
{
|
|
||||||
super(other);
|
super(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
return JSON.marshal(this);
|
return JSON.marshal(this);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -99,14 +83,10 @@ public class JSONObject extends LinkedHashMap<String, Object>
|
||||||
*
|
*
|
||||||
* @return 返回本对象紧凑格式字符串。
|
* @return 返回本对象紧凑格式字符串。
|
||||||
*/
|
*/
|
||||||
public String toCompactString()
|
public String toCompactString() {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
return objectMapper.writeValueAsString(this);
|
return objectMapper.writeValueAsString(this);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -117,20 +97,18 @@ public class JSONObject extends LinkedHashMap<String, Object>
|
||||||
* @param name 字段名,支持多级。
|
* @param name 字段名,支持多级。
|
||||||
* @return 返回指定的整数值,或者null。
|
* @return 返回指定的整数值,或者null。
|
||||||
*/
|
*/
|
||||||
public Integer intValue(final String name)
|
public Integer intValue(final String name) {
|
||||||
{
|
|
||||||
return valueAsInt(value(name));
|
return valueAsInt(value(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取指定字段的整数值。如果字段不存在,或者无法转换为整数,返回defaultValue。
|
* 获取指定字段的整数值。如果字段不存在,或者无法转换为整数,返回defaultValue。
|
||||||
*
|
*
|
||||||
* @param name 字段名,支持多级。
|
* @param name 字段名,支持多级。
|
||||||
* @param defaultValue 查询失败时,返回的值。
|
* @param defaultValue 查询失败时,返回的值。
|
||||||
* @return 返回指定的整数值,或者defaultValue。
|
* @return 返回指定的整数值,或者defaultValue。
|
||||||
*/
|
*/
|
||||||
public Integer intValue(final String name, final Integer defaultValue)
|
public Integer intValue(final String name, final Integer defaultValue) {
|
||||||
{
|
|
||||||
return StringUtils.nvl(intValue(name), defaultValue);
|
return StringUtils.nvl(intValue(name), defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -140,20 +118,18 @@ public class JSONObject extends LinkedHashMap<String, Object>
|
||||||
* @param name 字段名,支持多级。
|
* @param name 字段名,支持多级。
|
||||||
* @return 返回指定的长整数值,或者null。
|
* @return 返回指定的长整数值,或者null。
|
||||||
*/
|
*/
|
||||||
public Long longValue(final String name)
|
public Long longValue(final String name) {
|
||||||
{
|
|
||||||
return valueAsLong(value(name));
|
return valueAsLong(value(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取指定字段的长整数值。如果字段不存在,或者无法转换为长整数,返回defaultValue。
|
* 获取指定字段的长整数值。如果字段不存在,或者无法转换为长整数,返回defaultValue。
|
||||||
*
|
*
|
||||||
* @param name 字段名,支持多级。
|
* @param name 字段名,支持多级。
|
||||||
* @param defaultValue 查询失败时,返回的值。
|
* @param defaultValue 查询失败时,返回的值。
|
||||||
* @return 返回指定的长整数值,或者defaultValue。
|
* @return 返回指定的长整数值,或者defaultValue。
|
||||||
*/
|
*/
|
||||||
public Long longValue(final String name, final Long defaultValue)
|
public Long longValue(final String name, final Long defaultValue) {
|
||||||
{
|
|
||||||
return StringUtils.nvl(longValue(name), defaultValue);
|
return StringUtils.nvl(longValue(name), defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -163,20 +139,18 @@ public class JSONObject extends LinkedHashMap<String, Object>
|
||||||
* @param name 字段名,支持多级。
|
* @param name 字段名,支持多级。
|
||||||
* @return 返回指定的布尔值,或者null。
|
* @return 返回指定的布尔值,或者null。
|
||||||
*/
|
*/
|
||||||
public Boolean boolValue(final String name)
|
public Boolean boolValue(final String name) {
|
||||||
{
|
|
||||||
return valueAsBool(value(name));
|
return valueAsBool(value(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取指定字段的布尔值。如果字段不存在,或者无法转换为布尔型,返回defaultValue。
|
* 获取指定字段的布尔值。如果字段不存在,或者无法转换为布尔型,返回defaultValue。
|
||||||
*
|
*
|
||||||
* @param name 字段名,支持多级。
|
* @param name 字段名,支持多级。
|
||||||
* @param defaultValue 查询失败时,返回的值。
|
* @param defaultValue 查询失败时,返回的值。
|
||||||
* @return 返回指定的布尔值,或者defaultValue。
|
* @return 返回指定的布尔值,或者defaultValue。
|
||||||
*/
|
*/
|
||||||
public Boolean boolValue(final String name, final Boolean defaultValue)
|
public Boolean boolValue(final String name, final Boolean defaultValue) {
|
||||||
{
|
|
||||||
return StringUtils.nvl(boolValue(name), defaultValue);
|
return StringUtils.nvl(boolValue(name), defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -186,20 +160,18 @@ public class JSONObject extends LinkedHashMap<String, Object>
|
||||||
* @param name 字段名,支持多级。
|
* @param name 字段名,支持多级。
|
||||||
* @return 返回指定的字符串值,或者null。
|
* @return 返回指定的字符串值,或者null。
|
||||||
*/
|
*/
|
||||||
public String strValue(final String name)
|
public String strValue(final String name) {
|
||||||
{
|
|
||||||
return valueAsStr(value(name));
|
return valueAsStr(value(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取指定字段的字符串值。如果字段不存在,返回defaultValue。
|
* 获取指定字段的字符串值。如果字段不存在,返回defaultValue。
|
||||||
*
|
*
|
||||||
* @param name 字段名,支持多级。
|
* @param name 字段名,支持多级。
|
||||||
* @param defaultValue 查询失败时,返回的值。
|
* @param defaultValue 查询失败时,返回的值。
|
||||||
* @return 返回指定的字符串值,或者defaultValue。
|
* @return 返回指定的字符串值,或者defaultValue。
|
||||||
*/
|
*/
|
||||||
public String strValue(final String name, final String defaultValue)
|
public String strValue(final String name, final String defaultValue) {
|
||||||
{
|
|
||||||
return StringUtils.nvl(strValue(name), defaultValue);
|
return StringUtils.nvl(strValue(name), defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -209,29 +181,20 @@ public class JSONObject extends LinkedHashMap<String, Object>
|
||||||
* @param name 字段名,支持多级,支持数组下标。
|
* @param name 字段名,支持多级,支持数组下标。
|
||||||
* @return 返回指定字段的值。
|
* @return 返回指定字段的值。
|
||||||
*/
|
*/
|
||||||
public Object value(final String name)
|
public Object value(final String name) {
|
||||||
{
|
|
||||||
final int indexDot = name.indexOf('.');
|
final int indexDot = name.indexOf('.');
|
||||||
if (indexDot >= 0)
|
if (indexDot >= 0) {
|
||||||
{
|
|
||||||
return obj(name.substring(0, indexDot)).value(name.substring(indexDot + 1));
|
return obj(name.substring(0, indexDot)).value(name.substring(indexDot + 1));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
final Matcher matcher = arrayNamePattern.matcher(name);
|
final Matcher matcher = arrayNamePattern.matcher(name);
|
||||||
if (matcher.find())
|
if (matcher.find()) {
|
||||||
{
|
return endArray(matcher.group(1), matcher.group(2), new EndArrayCallback<Object>() {
|
||||||
return endArray(matcher.group(1), matcher.group(2), new EndArrayCallback<Object>()
|
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public Object callback(JSONArray arr, int index)
|
public Object callback(JSONArray arr, int index) {
|
||||||
{
|
|
||||||
return elementAt(arr, index);
|
return elementAt(arr, index);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return get(name);
|
return get(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -240,34 +203,25 @@ public class JSONObject extends LinkedHashMap<String, Object>
|
||||||
/**
|
/**
|
||||||
* 设置指定字段的值。
|
* 设置指定字段的值。
|
||||||
*
|
*
|
||||||
* @param name 字段名,支持多级,支持数组下标。
|
* @param name 字段名,支持多级,支持数组下标。
|
||||||
* @param value 字段值。
|
* @param value 字段值。
|
||||||
* @return 返回本对象。
|
* @return 返回本对象。
|
||||||
*/
|
*/
|
||||||
public JSONObject value(final String name, final Object value)
|
public JSONObject value(final String name, final Object value) {
|
||||||
{
|
|
||||||
final int indexDot = name.indexOf('.');
|
final int indexDot = name.indexOf('.');
|
||||||
if (indexDot >= 0)
|
if (indexDot >= 0) {
|
||||||
{
|
|
||||||
obj(name.substring(0, indexDot)).value(name.substring(indexDot + 1), value);
|
obj(name.substring(0, indexDot)).value(name.substring(indexDot + 1), value);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
final Matcher matcher = arrayNamePattern.matcher(name);
|
final Matcher matcher = arrayNamePattern.matcher(name);
|
||||||
if (matcher.find())
|
if (matcher.find()) {
|
||||||
{
|
endArray(matcher.group(1), matcher.group(2), new EndArrayCallback<Void>() {
|
||||||
endArray(matcher.group(1), matcher.group(2), new EndArrayCallback<Void>()
|
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public Void callback(JSONArray arr, int index)
|
public Void callback(JSONArray arr, int index) {
|
||||||
{
|
|
||||||
elementAt(arr, index, value);
|
elementAt(arr, index, value);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
set(name, value);
|
set(name, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -280,25 +234,18 @@ public class JSONObject extends LinkedHashMap<String, Object>
|
||||||
* @param name 字段名。不支持多级名字,支持数组下标。
|
* @param name 字段名。不支持多级名字,支持数组下标。
|
||||||
* @return 返回指定的对象。如果对象不存在,则为指定的名字创建一个空的MessageObject对象。
|
* @return 返回指定的对象。如果对象不存在,则为指定的名字创建一个空的MessageObject对象。
|
||||||
*/
|
*/
|
||||||
public JSONObject obj(final String name)
|
public JSONObject obj(final String name) {
|
||||||
{
|
|
||||||
final Matcher matcher = arrayNamePattern.matcher(name);
|
final Matcher matcher = arrayNamePattern.matcher(name);
|
||||||
if (matcher.find())
|
if (matcher.find()) {
|
||||||
{
|
return endArray(matcher.group(1), matcher.group(2), new EndArrayCallback<JSONObject>() {
|
||||||
return endArray(matcher.group(1), matcher.group(2), new EndArrayCallback<JSONObject>()
|
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public JSONObject callback(JSONArray arr, int index)
|
public JSONObject callback(JSONArray arr, int index) {
|
||||||
{
|
|
||||||
return objAt(arr, index);
|
return objAt(arr, index);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
JSONObject obj = getObj(name);
|
JSONObject obj = getObj(name);
|
||||||
if (obj == null)
|
if (obj == null) {
|
||||||
{
|
|
||||||
obj = new JSONObject();
|
obj = new JSONObject();
|
||||||
put(name, obj);
|
put(name, obj);
|
||||||
}
|
}
|
||||||
|
|
@ -312,11 +259,9 @@ public class JSONObject extends LinkedHashMap<String, Object>
|
||||||
* @param name 字段名。不支持多级名字,不支持下标。
|
* @param name 字段名。不支持多级名字,不支持下标。
|
||||||
* @return 返回一个数组(List)。
|
* @return 返回一个数组(List)。
|
||||||
*/
|
*/
|
||||||
public JSONArray arr(final String name)
|
public JSONArray arr(final String name) {
|
||||||
{
|
|
||||||
JSONArray arr = getArr(name);
|
JSONArray arr = getArr(name);
|
||||||
if (arr == null)
|
if (arr == null) {
|
||||||
{
|
|
||||||
arr = new JSONArray();
|
arr = new JSONArray();
|
||||||
put(name, arr);
|
put(name, arr);
|
||||||
}
|
}
|
||||||
|
|
@ -329,8 +274,7 @@ public class JSONObject extends LinkedHashMap<String, Object>
|
||||||
* @param name 字段名。
|
* @param name 字段名。
|
||||||
* @return 返回指定的对象字段。
|
* @return 返回指定的对象字段。
|
||||||
*/
|
*/
|
||||||
public JSONObject getObj(final String name)
|
public JSONObject getObj(final String name) {
|
||||||
{
|
|
||||||
return (JSONObject) get(name);
|
return (JSONObject) get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -340,8 +284,7 @@ public class JSONObject extends LinkedHashMap<String, Object>
|
||||||
* @param name 字段名。
|
* @param name 字段名。
|
||||||
* @return 返回数组类型字段。
|
* @return 返回数组类型字段。
|
||||||
*/
|
*/
|
||||||
public JSONArray getArr(final String name)
|
public JSONArray getArr(final String name) {
|
||||||
{
|
|
||||||
return (JSONArray) get(name);
|
return (JSONArray) get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -351,20 +294,18 @@ public class JSONObject extends LinkedHashMap<String, Object>
|
||||||
* @param name 字段名。
|
* @param name 字段名。
|
||||||
* @return 返回指定字段整数值。
|
* @return 返回指定字段整数值。
|
||||||
*/
|
*/
|
||||||
public Integer getInt(final String name)
|
public Integer getInt(final String name) {
|
||||||
{
|
|
||||||
return valueAsInt(get(name));
|
return valueAsInt(get(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回字段整数值。如果不存在,返回defaultValue。
|
* 返回字段整数值。如果不存在,返回defaultValue。
|
||||||
*
|
*
|
||||||
* @param name 字段名。
|
* @param name 字段名。
|
||||||
* @param defaultValue 字段不存在时,返回的值。
|
* @param defaultValue 字段不存在时,返回的值。
|
||||||
* @return 返回指定字段整数值。
|
* @return 返回指定字段整数值。
|
||||||
*/
|
*/
|
||||||
public Integer getInt(final String name, Integer defaultValue)
|
public Integer getInt(final String name, Integer defaultValue) {
|
||||||
{
|
|
||||||
return StringUtils.nvl(getInt(name), defaultValue);
|
return StringUtils.nvl(getInt(name), defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -374,20 +315,18 @@ public class JSONObject extends LinkedHashMap<String, Object>
|
||||||
* @param name 字段名。
|
* @param name 字段名。
|
||||||
* @return 返回指定字段长整数值。
|
* @return 返回指定字段长整数值。
|
||||||
*/
|
*/
|
||||||
public Long getLong(final String name)
|
public Long getLong(final String name) {
|
||||||
{
|
|
||||||
return valueAsLong(get(name));
|
return valueAsLong(get(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回字段长整数值。如果不存在,返回defaultValue。
|
* 返回字段长整数值。如果不存在,返回defaultValue。
|
||||||
*
|
*
|
||||||
* @param name 字段名。
|
* @param name 字段名。
|
||||||
* @param defaultValue 字段不存在时,返回的值。
|
* @param defaultValue 字段不存在时,返回的值。
|
||||||
* @return 返回指定字段长整数值。
|
* @return 返回指定字段长整数值。
|
||||||
*/
|
*/
|
||||||
public Long getLong(final String name, Long defaultValue)
|
public Long getLong(final String name, Long defaultValue) {
|
||||||
{
|
|
||||||
return StringUtils.nvl(getLong(name), defaultValue);
|
return StringUtils.nvl(getLong(name), defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -397,20 +336,18 @@ public class JSONObject extends LinkedHashMap<String, Object>
|
||||||
* @param name 字段名。
|
* @param name 字段名。
|
||||||
* @return 返回指定字段字符串值。
|
* @return 返回指定字段字符串值。
|
||||||
*/
|
*/
|
||||||
public String getStr(final String name)
|
public String getStr(final String name) {
|
||||||
{
|
|
||||||
return valueAsStr(get(name));
|
return valueAsStr(get(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回字段字符串值。如果不存在,返回defaultValue。
|
* 返回字段字符串值。如果不存在,返回defaultValue。
|
||||||
*
|
*
|
||||||
* @param name 字段名。
|
* @param name 字段名。
|
||||||
* @param defaultValue 字段不存在时,返回的值。
|
* @param defaultValue 字段不存在时,返回的值。
|
||||||
* @return 返回指定字段字符串值。
|
* @return 返回指定字段字符串值。
|
||||||
*/
|
*/
|
||||||
public String getStr(final String name, final String defaultValue)
|
public String getStr(final String name, final String defaultValue) {
|
||||||
{
|
|
||||||
return StringUtils.nvl(getStr(name), defaultValue);
|
return StringUtils.nvl(getStr(name), defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -420,33 +357,30 @@ public class JSONObject extends LinkedHashMap<String, Object>
|
||||||
* @param name 字段名。
|
* @param name 字段名。
|
||||||
* @return 字段值。
|
* @return 字段值。
|
||||||
*/
|
*/
|
||||||
public Boolean getBool(final String name)
|
public Boolean getBool(final String name) {
|
||||||
{
|
|
||||||
return valueAsBool(get(name));
|
return valueAsBool(get(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字段值按照布尔类型返回。如果不存在,返回defaultValue。
|
* 字段值按照布尔类型返回。如果不存在,返回defaultValue。
|
||||||
*
|
*
|
||||||
* @param name 字段名。
|
* @param name 字段名。
|
||||||
* @param defaultValue 字段不存在时,返回的值。
|
* @param defaultValue 字段不存在时,返回的值。
|
||||||
* @return 字段值。
|
* @return 字段值。
|
||||||
*/
|
*/
|
||||||
public Boolean getBool(final String name, final Boolean defaultValue)
|
public Boolean getBool(final String name, final Boolean defaultValue) {
|
||||||
{
|
|
||||||
return StringUtils.nvl(getBool(name), defaultValue);
|
return StringUtils.nvl(getBool(name), defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置字段值
|
* 设置字段值
|
||||||
*
|
*
|
||||||
* @param name 字段名
|
* @param name 字段名
|
||||||
* @param value 字段值(标量:数字、字符串、布尔型;结构体:MessageObject)。 如果是Map类型同时非MessageObject类型,则自动转换为MessageObject类型再存入
|
* @param value 字段值(标量:数字、字符串、布尔型;结构体:MessageObject)。 如果是Map类型同时非MessageObject类型,则自动转换为MessageObject类型再存入
|
||||||
* (此时,再修改Map中的数据,将不会体现到本对象中)。
|
* (此时,再修改Map中的数据,将不会体现到本对象中)。
|
||||||
* @return 返回本对象
|
* @return 返回本对象
|
||||||
*/
|
*/
|
||||||
public JSONObject set(final String name, final Object value)
|
public JSONObject set(final String name, final Object value) {
|
||||||
{
|
|
||||||
put(name, value);
|
put(name, value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
@ -457,14 +391,10 @@ public class JSONObject extends LinkedHashMap<String, Object>
|
||||||
* @param beanClass Java Bean的类对象。
|
* @param beanClass Java Bean的类对象。
|
||||||
* @return 返回转换后的Java Bean。
|
* @return 返回转换后的Java Bean。
|
||||||
*/
|
*/
|
||||||
public <T> T asBean(Class<T> beanClass)
|
public <T> T asBean(Class<T> beanClass) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
return JSON.unmarshal(JSON.marshal(this), beanClass);
|
return JSON.unmarshal(JSON.marshal(this), beanClass);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -474,91 +404,56 @@ public class JSONObject extends LinkedHashMap<String, Object>
|
||||||
* MessageObject 中)。 重载此方法的目的是为了使JSON能够正确地解析为MessageObject对象。不建议直接调用此方法,请使用 set(name, value)方法设置字段值。
|
* MessageObject 中)。 重载此方法的目的是为了使JSON能够正确地解析为MessageObject对象。不建议直接调用此方法,请使用 set(name, value)方法设置字段值。
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Object put(String key, Object value)
|
public Object put(String key, Object value) {
|
||||||
{
|
|
||||||
return super.put(key, transfer(value));
|
return super.put(key, transfer(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Integer valueAsInt(Object value)
|
public static Integer valueAsInt(Object value) {
|
||||||
{
|
if (value instanceof Integer) {
|
||||||
if (value instanceof Integer)
|
|
||||||
{
|
|
||||||
return (Integer) value;
|
return (Integer) value;
|
||||||
}
|
} else if (value instanceof Number) {
|
||||||
else if (value instanceof Number)
|
|
||||||
{
|
|
||||||
return ((Number) value).intValue();
|
return ((Number) value).intValue();
|
||||||
}
|
} else if (value instanceof String) {
|
||||||
else if (value instanceof String)
|
|
||||||
{
|
|
||||||
return Integer.valueOf((String) value);
|
return Integer.valueOf((String) value);
|
||||||
}
|
} else if (value instanceof Boolean) {
|
||||||
else if (value instanceof Boolean)
|
|
||||||
{
|
|
||||||
return ((Boolean) value) ? 1 : 0;
|
return ((Boolean) value) ? 1 : 0;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Long valueAsLong(Object value)
|
public static Long valueAsLong(Object value) {
|
||||||
{
|
if (value instanceof Long) {
|
||||||
if (value instanceof Long)
|
|
||||||
{
|
|
||||||
return (Long) value;
|
return (Long) value;
|
||||||
}
|
} else if (value instanceof Number) {
|
||||||
else if (value instanceof Number)
|
|
||||||
{
|
|
||||||
return ((Number) value).longValue();
|
return ((Number) value).longValue();
|
||||||
}
|
} else if (value instanceof String) {
|
||||||
else if (value instanceof String)
|
|
||||||
{
|
|
||||||
return Long.valueOf((String) value);
|
return Long.valueOf((String) value);
|
||||||
}
|
} else if (value instanceof Boolean) {
|
||||||
else if (value instanceof Boolean)
|
|
||||||
{
|
|
||||||
return ((Boolean) value) ? 1L : 0L;
|
return ((Boolean) value) ? 1L : 0L;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String valueAsStr(Object value)
|
public static String valueAsStr(Object value) {
|
||||||
{
|
if (value instanceof String) {
|
||||||
if (value instanceof String)
|
|
||||||
{
|
|
||||||
return (String) value;
|
return (String) value;
|
||||||
}
|
} else if (value != null) {
|
||||||
else if (value != null)
|
|
||||||
{
|
|
||||||
return value.toString();
|
return value.toString();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean valueAsBool(Object value)
|
public static Boolean valueAsBool(Object value) {
|
||||||
{
|
if (value instanceof Boolean) {
|
||||||
if (value instanceof Boolean)
|
|
||||||
{
|
|
||||||
return (Boolean) value;
|
return (Boolean) value;
|
||||||
}
|
} else if (value instanceof Number) {
|
||||||
else if (value instanceof Number)
|
|
||||||
{
|
|
||||||
return ((Number) value).doubleValue() != 0.0;
|
return ((Number) value).doubleValue() != 0.0;
|
||||||
}
|
} else if (value instanceof String) {
|
||||||
else if (value instanceof String)
|
|
||||||
{
|
|
||||||
return Boolean.valueOf((String) value);
|
return Boolean.valueOf((String) value);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -570,37 +465,27 @@ public class JSONObject extends LinkedHashMap<String, Object>
|
||||||
* @return 返回转换后的值。
|
* @return 返回转换后的值。
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private static Object transfer(final Object value)
|
private static Object transfer(final Object value) {
|
||||||
{
|
if (!(value instanceof JSONObject) && value instanceof Map) {
|
||||||
if (!(value instanceof JSONObject) && value instanceof Map)
|
|
||||||
{
|
|
||||||
return toObj((Map<String, Object>) value);
|
return toObj((Map<String, Object>) value);
|
||||||
}
|
} else if (!(value instanceof JSONArray) && value instanceof Collection) {
|
||||||
else if (!(value instanceof JSONArray) && value instanceof Collection)
|
|
||||||
{
|
|
||||||
return toArr((Collection<Object>) value);
|
return toArr((Collection<Object>) value);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static JSONArray toArr(final Collection<Object> list)
|
private static JSONArray toArr(final Collection<Object> list) {
|
||||||
{
|
|
||||||
final JSONArray arr = new JSONArray(list.size());
|
final JSONArray arr = new JSONArray(list.size());
|
||||||
for (final Object element : list)
|
for (final Object element : list) {
|
||||||
{
|
|
||||||
arr.add(element);
|
arr.add(element);
|
||||||
}
|
}
|
||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static JSONObject toObj(final Map<String, Object> map)
|
private static JSONObject toObj(final Map<String, Object> map) {
|
||||||
{
|
|
||||||
final JSONObject obj = new JSONObject();
|
final JSONObject obj = new JSONObject();
|
||||||
for (final Map.Entry<String, Object> ent : map.entrySet())
|
for (final Map.Entry<String, Object> ent : map.entrySet()) {
|
||||||
{
|
|
||||||
obj.put(ent.getKey(), transfer(ent.getValue()));
|
obj.put(ent.getKey(), transfer(ent.getValue()));
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
|
|
@ -609,15 +494,13 @@ public class JSONObject extends LinkedHashMap<String, Object>
|
||||||
/**
|
/**
|
||||||
* 将指定下标元素作为数组返回,如果不存在,则在该位置创建一个空的数组。
|
* 将指定下标元素作为数组返回,如果不存在,则在该位置创建一个空的数组。
|
||||||
*
|
*
|
||||||
* @param arr 当前数组。
|
* @param arr 当前数组。
|
||||||
* @param index 下标。
|
* @param index 下标。
|
||||||
* @return 返回当前数组指定下标的元素,该元素应该是一个数组。
|
* @return 返回当前数组指定下标的元素,该元素应该是一个数组。
|
||||||
*/
|
*/
|
||||||
private static JSONArray arrayAt(JSONArray arr, int index)
|
private static JSONArray arrayAt(JSONArray arr, int index) {
|
||||||
{
|
|
||||||
expand(arr, index);
|
expand(arr, index);
|
||||||
if (arr.get(index) == null)
|
if (arr.get(index) == null) {
|
||||||
{
|
|
||||||
arr.set(index, new JSONArray());
|
arr.set(index, new JSONArray());
|
||||||
}
|
}
|
||||||
return (JSONArray) arr.get(index);
|
return (JSONArray) arr.get(index);
|
||||||
|
|
@ -626,15 +509,13 @@ public class JSONObject extends LinkedHashMap<String, Object>
|
||||||
/**
|
/**
|
||||||
* 将指定下标元素作为结构体返回,如果不存在,则在该位置创建一个空的结构体。
|
* 将指定下标元素作为结构体返回,如果不存在,则在该位置创建一个空的结构体。
|
||||||
*
|
*
|
||||||
* @param arr 当前数组。
|
* @param arr 当前数组。
|
||||||
* @param index 下标。
|
* @param index 下标。
|
||||||
* @return 返回当前数组指定下标元素,该元素是一个结构体。
|
* @return 返回当前数组指定下标元素,该元素是一个结构体。
|
||||||
*/
|
*/
|
||||||
private static JSONObject objAt(final JSONArray arr, int index)
|
private static JSONObject objAt(final JSONArray arr, int index) {
|
||||||
{
|
|
||||||
expand(arr, index);
|
expand(arr, index);
|
||||||
if (arr.get(index) == null)
|
if (arr.get(index) == null) {
|
||||||
{
|
|
||||||
arr.set(index, new JSONObject());
|
arr.set(index, new JSONObject());
|
||||||
}
|
}
|
||||||
return (JSONObject) arr.get(index);
|
return (JSONObject) arr.get(index);
|
||||||
|
|
@ -643,38 +524,34 @@ public class JSONObject extends LinkedHashMap<String, Object>
|
||||||
/**
|
/**
|
||||||
* 设置数组指定下标位置的值。
|
* 设置数组指定下标位置的值。
|
||||||
*
|
*
|
||||||
* @param arr 数组。
|
* @param arr 数组。
|
||||||
* @param index 下标。
|
* @param index 下标。
|
||||||
* @param value 值。
|
* @param value 值。
|
||||||
*/
|
*/
|
||||||
private static void elementAt(final JSONArray arr, final int index, final Object value)
|
private static void elementAt(final JSONArray arr, final int index, final Object value) {
|
||||||
{
|
|
||||||
expand(arr, index).set(index, value);
|
expand(arr, index).set(index, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取数组指定下标元素的值。
|
* 获取数组指定下标元素的值。
|
||||||
*
|
*
|
||||||
* @param arr 数组。
|
* @param arr 数组。
|
||||||
* @param index 下标。
|
* @param index 下标。
|
||||||
* @return 值。
|
* @return 值。
|
||||||
*/
|
*/
|
||||||
private static Object elementAt(final JSONArray arr, final int index)
|
private static Object elementAt(final JSONArray arr, final int index) {
|
||||||
{
|
|
||||||
return expand(arr, index).get(index);
|
return expand(arr, index).get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 扩展数组到指定下标,以防止访问时下标越界。
|
* 扩展数组到指定下标,以防止访问时下标越界。
|
||||||
*
|
*
|
||||||
* @param arr 数组
|
* @param arr 数组
|
||||||
* @param index 下标
|
* @param index 下标
|
||||||
* @return 返回传入的数组
|
* @return 返回传入的数组
|
||||||
*/
|
*/
|
||||||
private static JSONArray expand(final JSONArray arr, final int index)
|
private static JSONArray expand(final JSONArray arr, final int index) {
|
||||||
{
|
while (arr.size() <= index) {
|
||||||
while (arr.size() <= index)
|
|
||||||
{
|
|
||||||
arr.add(null);
|
arr.add(null);
|
||||||
}
|
}
|
||||||
return arr;
|
return arr;
|
||||||
|
|
@ -683,16 +560,14 @@ public class JSONObject extends LinkedHashMap<String, Object>
|
||||||
/**
|
/**
|
||||||
* 最后数组回调。
|
* 最后数组回调。
|
||||||
*
|
*
|
||||||
* @author Mike
|
|
||||||
*
|
|
||||||
* @param <T> 回调返回数据类型。
|
* @param <T> 回调返回数据类型。
|
||||||
|
* @author Mike
|
||||||
*/
|
*/
|
||||||
private interface EndArrayCallback<T>
|
private interface EndArrayCallback<T> {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 当定位到最后一级数组,将调用本方法。
|
* 当定位到最后一级数组,将调用本方法。
|
||||||
*
|
*
|
||||||
* @param arr 最后一级数组对象。
|
* @param arr 最后一级数组对象。
|
||||||
* @param index 最后一级索引。
|
* @param index 最后一级索引。
|
||||||
* @return 返回回调的返回值。
|
* @return 返回回调的返回值。
|
||||||
*/
|
*/
|
||||||
|
|
@ -703,34 +578,29 @@ public class JSONObject extends LinkedHashMap<String, Object>
|
||||||
* 处理多维数组的工具函数(包括一维数组)。多维数组的名字如:arrary[1][2][3], 则name=array,indexStr=[1][2][3],在callback中,endArr将是
|
* 处理多维数组的工具函数(包括一维数组)。多维数组的名字如:arrary[1][2][3], 则name=array,indexStr=[1][2][3],在callback中,endArr将是
|
||||||
* array[1][2]指定的对象,indexe=3。
|
* array[1][2]指定的对象,indexe=3。
|
||||||
*
|
*
|
||||||
* @param name 不带下标的名字,不支持多级名字。
|
* @param name 不带下标的名字,不支持多级名字。
|
||||||
* @param indexesStr 索引部分的字符串,如:[1][2][3]
|
* @param indexesStr 索引部分的字符串,如:[1][2][3]
|
||||||
* @param callback 回调函数。
|
* @param callback 回调函数。
|
||||||
* @return 返回回调函数的返回值。
|
* @return 返回回调函数的返回值。
|
||||||
*/
|
*/
|
||||||
private <T> T endArray(final String name, final String indexesStr, final EndArrayCallback<T> callback)
|
private <T> T endArray(final String name, final String indexesStr, final EndArrayCallback<T> callback) {
|
||||||
{
|
|
||||||
JSONArray endArr = arr(name);
|
JSONArray endArr = arr(name);
|
||||||
final int[] indexes = parseIndexes(indexesStr);
|
final int[] indexes = parseIndexes(indexesStr);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < indexes.length - 1)
|
while (i < indexes.length - 1) {
|
||||||
{
|
|
||||||
endArr = arrayAt(endArr, indexes[i++]);
|
endArr = arrayAt(endArr, indexes[i++]);
|
||||||
}
|
}
|
||||||
return callback.callback(endArr, indexes[i]);
|
return callback.callback(endArr, indexes[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int[] parseIndexes(final String s)
|
private static int[] parseIndexes(final String s) {
|
||||||
{
|
|
||||||
int[] indexes = null;
|
int[] indexes = null;
|
||||||
List<Integer> list = new ArrayList<Integer>();
|
List<Integer> list = new ArrayList<Integer>();
|
||||||
|
|
||||||
final StringTokenizer st = new StringTokenizer(s, "[]");
|
final StringTokenizer st = new StringTokenizer(s, "[]");
|
||||||
while (st.hasMoreTokens())
|
while (st.hasMoreTokens()) {
|
||||||
{
|
|
||||||
final int index = Integer.valueOf(st.nextToken());
|
final int index = Integer.valueOf(st.nextToken());
|
||||||
if (index < 0)
|
if (index < 0) {
|
||||||
{
|
|
||||||
throw new RuntimeException(String.format("Illegal index %1$d in \"%2$s\"", index, s));
|
throw new RuntimeException(String.format("Illegal index %1$d in \"%2$s\"", index, s));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -739,8 +609,7 @@ public class JSONObject extends LinkedHashMap<String, Object>
|
||||||
|
|
||||||
indexes = new int[list.size()];
|
indexes = new int[list.size()];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (Integer tmp : list.toArray(new Integer[list.size()]))
|
for (Integer tmp : list.toArray(new Integer[list.size()])) {
|
||||||
{
|
|
||||||
indexes[i++] = tmp;
|
indexes[i++] = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,230 @@
|
||||||
|
package com.ruoyi.common.repository;
|
||||||
|
|
||||||
|
import com.querydsl.core.types.OrderSpecifier;
|
||||||
|
import com.querydsl.core.types.Predicate;
|
||||||
|
import org.springframework.data.domain.Example;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.data.domain.Sort;
|
||||||
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
|
import org.springframework.data.jpa.repository.support.*;
|
||||||
|
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
|
||||||
|
import org.springframework.lang.Nullable;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
|
||||||
|
public class DataScopeRepository<T, ID extends Serializable> implements JpaRepositoryImplementation<T, ID>,
|
||||||
|
QuerydslPredicateExecutor<T> {
|
||||||
|
|
||||||
|
private @Nullable
|
||||||
|
CrudMethodMetadata metadata;
|
||||||
|
|
||||||
|
private SimpleJpaRepository<T, ID> simpleJpaRepository;
|
||||||
|
private QuerydslPredicateExecutor<T> querydslPredicateExecutor;
|
||||||
|
|
||||||
|
public DataScopeRepository(JpaEntityInformation<T, ?> entityInformation, EntityManager entityManager) {
|
||||||
|
Assert.notNull(entityInformation, "JpaEntityInformation must not be null!");
|
||||||
|
Assert.notNull(entityManager, "EntityManager must not be null!");
|
||||||
|
this.simpleJpaRepository = new SimpleJpaRepository<T, ID>(entityInformation, entityManager);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataScopeRepository(Class<T> domainClass, EntityManager em) {
|
||||||
|
this.simpleJpaRepository = new SimpleJpaRepository<T, ID>(JpaEntityInformationSupport.getEntityInformation(domainClass, em), em);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setRepositoryMethodMetadata(CrudMethodMetadata crudMethodMetadata) {
|
||||||
|
this.metadata = crudMethodMetadata;
|
||||||
|
simpleJpaRepository.setRepositoryMethodMetadata(crudMethodMetadata);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<T> findAll() {
|
||||||
|
return simpleJpaRepository.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<T> findAll(Sort sort) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<T> findAll(Pageable pageable) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<T> findAllById(Iterable<ID> ids) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long count() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteById(ID id) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(T entity) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteAll(Iterable<? extends T> entities) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteAll() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S extends T> S save(S entity) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S extends T> List<S> saveAll(Iterable<S> entities) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<T> findById(ID id) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean existsById(ID id) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void flush() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S extends T> S saveAndFlush(S entity) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteInBatch(Iterable<T> entities) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteAllInBatch() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public T getOne(ID id) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S extends T> Optional<S> findOne(Example<S> example) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S extends T> List<S> findAll(Example<S> example) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S extends T> List<S> findAll(Example<S> example, Sort sort) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S extends T> Page<S> findAll(Example<S> example, Pageable pageable) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S extends T> long count(Example<S> example) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S extends T> boolean exists(Example<S> example) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<T> findOne(Specification<T> spec) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<T> findAll(Specification<T> spec) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<T> findAll(Specification<T> spec, Pageable pageable) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<T> findAll(Specification<T> spec, Sort sort) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long count(Specification<T> spec) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<T> findOne(Predicate predicate) {
|
||||||
|
return querydslPredicateExecutor.findOne(predicate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterable<T> findAll(Predicate predicate) {
|
||||||
|
return querydslPredicateExecutor.findAll(predicate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterable<T> findAll(Predicate predicate, Sort sort) {
|
||||||
|
return querydslPredicateExecutor.findAll(predicate, sort);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterable<T> findAll(Predicate predicate, OrderSpecifier<?>... orders) {
|
||||||
|
return querydslPredicateExecutor.findAll(predicate, orders);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterable<T> findAll(OrderSpecifier<?>... orders) {
|
||||||
|
return querydslPredicateExecutor.findAll(orders);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<T> findAll(Predicate predicate, Pageable pageable) {
|
||||||
|
return querydslPredicateExecutor.findAll(predicate, pageable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long count(Predicate predicate) {
|
||||||
|
return querydslPredicateExecutor.count(predicate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean exists(Predicate predicate) {
|
||||||
|
return querydslPredicateExecutor.exists(predicate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -8,25 +8,27 @@ import java.math.RoundingMode;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class Arith
|
public class Arith {
|
||||||
{
|
|
||||||
|
|
||||||
/** 默认除法运算精度 */
|
/**
|
||||||
|
* 默认除法运算精度
|
||||||
|
*/
|
||||||
private static final int DEF_DIV_SCALE = 10;
|
private static final int DEF_DIV_SCALE = 10;
|
||||||
|
|
||||||
/** 这个类不能实例化 */
|
/**
|
||||||
private Arith()
|
* 这个类不能实例化
|
||||||
{
|
*/
|
||||||
|
private Arith() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提供精确的加法运算。
|
* 提供精确的加法运算。
|
||||||
|
*
|
||||||
* @param v1 被加数
|
* @param v1 被加数
|
||||||
* @param v2 加数
|
* @param v2 加数
|
||||||
* @return 两个参数的和
|
* @return 两个参数的和
|
||||||
*/
|
*/
|
||||||
public static double add(double v1, double v2)
|
public static double add(double v1, double v2) {
|
||||||
{
|
|
||||||
BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
||||||
BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
||||||
return b1.add(b2).doubleValue();
|
return b1.add(b2).doubleValue();
|
||||||
|
|
@ -34,12 +36,12 @@ public class Arith
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提供精确的减法运算。
|
* 提供精确的减法运算。
|
||||||
|
*
|
||||||
* @param v1 被减数
|
* @param v1 被减数
|
||||||
* @param v2 减数
|
* @param v2 减数
|
||||||
* @return 两个参数的差
|
* @return 两个参数的差
|
||||||
*/
|
*/
|
||||||
public static double sub(double v1, double v2)
|
public static double sub(double v1, double v2) {
|
||||||
{
|
|
||||||
BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
||||||
BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
||||||
return b1.subtract(b2).doubleValue();
|
return b1.subtract(b2).doubleValue();
|
||||||
|
|
@ -47,12 +49,12 @@ public class Arith
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提供精确的乘法运算。
|
* 提供精确的乘法运算。
|
||||||
|
*
|
||||||
* @param v1 被乘数
|
* @param v1 被乘数
|
||||||
* @param v2 乘数
|
* @param v2 乘数
|
||||||
* @return 两个参数的积
|
* @return 两个参数的积
|
||||||
*/
|
*/
|
||||||
public static double mul(double v1, double v2)
|
public static double mul(double v1, double v2) {
|
||||||
{
|
|
||||||
BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
||||||
BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
||||||
return b1.multiply(b2).doubleValue();
|
return b1.multiply(b2).doubleValue();
|
||||||
|
|
@ -61,34 +63,32 @@ public class Arith
|
||||||
/**
|
/**
|
||||||
* 提供(相对)精确的除法运算,当发生除不尽的情况时,精确到
|
* 提供(相对)精确的除法运算,当发生除不尽的情况时,精确到
|
||||||
* 小数点以后10位,以后的数字四舍五入。
|
* 小数点以后10位,以后的数字四舍五入。
|
||||||
|
*
|
||||||
* @param v1 被除数
|
* @param v1 被除数
|
||||||
* @param v2 除数
|
* @param v2 除数
|
||||||
* @return 两个参数的商
|
* @return 两个参数的商
|
||||||
*/
|
*/
|
||||||
public static double div(double v1, double v2)
|
public static double div(double v1, double v2) {
|
||||||
{
|
|
||||||
return div(v1, v2, DEF_DIV_SCALE);
|
return div(v1, v2, DEF_DIV_SCALE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提供(相对)精确的除法运算。当发生除不尽的情况时,由scale参数指
|
* 提供(相对)精确的除法运算。当发生除不尽的情况时,由scale参数指
|
||||||
* 定精度,以后的数字四舍五入。
|
* 定精度,以后的数字四舍五入。
|
||||||
* @param v1 被除数
|
*
|
||||||
* @param v2 除数
|
* @param v1 被除数
|
||||||
|
* @param v2 除数
|
||||||
* @param scale 表示表示需要精确到小数点以后几位。
|
* @param scale 表示表示需要精确到小数点以后几位。
|
||||||
* @return 两个参数的商
|
* @return 两个参数的商
|
||||||
*/
|
*/
|
||||||
public static double div(double v1, double v2, int scale)
|
public static double div(double v1, double v2, int scale) {
|
||||||
{
|
if (scale < 0) {
|
||||||
if (scale < 0)
|
|
||||||
{
|
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"The scale must be a positive integer or zero");
|
"The scale must be a positive integer or zero");
|
||||||
}
|
}
|
||||||
BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
||||||
BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
||||||
if (b1.compareTo(BigDecimal.ZERO) == 0)
|
if (b1.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
{
|
|
||||||
return BigDecimal.ZERO.doubleValue();
|
return BigDecimal.ZERO.doubleValue();
|
||||||
}
|
}
|
||||||
return b1.divide(b2, scale, RoundingMode.HALF_UP).doubleValue();
|
return b1.divide(b2, scale, RoundingMode.HALF_UP).doubleValue();
|
||||||
|
|
@ -96,14 +96,13 @@ public class Arith
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提供精确的小数位四舍五入处理。
|
* 提供精确的小数位四舍五入处理。
|
||||||
* @param v 需要四舍五入的数字
|
*
|
||||||
|
* @param v 需要四舍五入的数字
|
||||||
* @param scale 小数点后保留几位
|
* @param scale 小数点后保留几位
|
||||||
* @return 四舍五入后的结果
|
* @return 四舍五入后的结果
|
||||||
*/
|
*/
|
||||||
public static double round(double v, int scale)
|
public static double round(double v, int scale) {
|
||||||
{
|
if (scale < 0) {
|
||||||
if (scale < 0)
|
|
||||||
{
|
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"The scale must be a positive integer or zero");
|
"The scale must be a positive integer or zero");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import java.lang.management.ManagementFactory;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -11,8 +12,7 @@ import org.apache.commons.lang3.time.DateFormatUtils;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||||
{
|
|
||||||
public static String YYYY = "yyyy";
|
public static String YYYY = "yyyy";
|
||||||
|
|
||||||
public static String YYYY_MM = "yyyy-MM";
|
public static String YYYY_MM = "yyyy-MM";
|
||||||
|
|
@ -33,8 +33,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||||
*
|
*
|
||||||
* @return Date() 当前日期
|
* @return Date() 当前日期
|
||||||
*/
|
*/
|
||||||
public static Date getNowDate()
|
public static Date getNowDate() {
|
||||||
{
|
|
||||||
return new Date();
|
return new Date();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -43,44 +42,34 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||||
*
|
*
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public static String getDate()
|
public static String getDate() {
|
||||||
{
|
|
||||||
return dateTimeNow(YYYY_MM_DD);
|
return dateTimeNow(YYYY_MM_DD);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String getTime()
|
public static final String getTime() {
|
||||||
{
|
|
||||||
return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
|
return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String dateTimeNow()
|
public static final String dateTimeNow() {
|
||||||
{
|
|
||||||
return dateTimeNow(YYYYMMDDHHMMSS);
|
return dateTimeNow(YYYYMMDDHHMMSS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String dateTimeNow(final String format)
|
public static final String dateTimeNow(final String format) {
|
||||||
{
|
|
||||||
return parseDateToStr(format, new Date());
|
return parseDateToStr(format, new Date());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String dateTime(final Date date)
|
public static final String dateTime(final Date date) {
|
||||||
{
|
|
||||||
return parseDateToStr(YYYY_MM_DD, date);
|
return parseDateToStr(YYYY_MM_DD, date);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String parseDateToStr(final String format, final Date date)
|
public static final String parseDateToStr(final String format, final Date date) {
|
||||||
{
|
|
||||||
return new SimpleDateFormat(format).format(date);
|
return new SimpleDateFormat(format).format(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Date dateTime(final String format, final String ts)
|
public static final Date dateTime(final String format, final String ts) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
return new SimpleDateFormat(format).parse(ts);
|
return new SimpleDateFormat(format).parse(ts);
|
||||||
}
|
} catch (ParseException e) {
|
||||||
catch (ParseException e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -88,8 +77,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||||
/**
|
/**
|
||||||
* 日期路径 即年/月/日 如2018/08/08
|
* 日期路径 即年/月/日 如2018/08/08
|
||||||
*/
|
*/
|
||||||
public static final String datePath()
|
public static final String datePath() {
|
||||||
{
|
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
return DateFormatUtils.format(now, "yyyy/MM/dd");
|
return DateFormatUtils.format(now, "yyyy/MM/dd");
|
||||||
}
|
}
|
||||||
|
|
@ -97,8 +85,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||||
/**
|
/**
|
||||||
* 日期路径 即年/月/日 如20180808
|
* 日期路径 即年/月/日 如20180808
|
||||||
*/
|
*/
|
||||||
public static final String dateTime()
|
public static final String dateTime() {
|
||||||
{
|
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
return DateFormatUtils.format(now, "yyyyMMdd");
|
return DateFormatUtils.format(now, "yyyyMMdd");
|
||||||
}
|
}
|
||||||
|
|
@ -106,18 +93,13 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||||
/**
|
/**
|
||||||
* 日期型字符串转化为日期 格式
|
* 日期型字符串转化为日期 格式
|
||||||
*/
|
*/
|
||||||
public static Date parseDate(Object str)
|
public static Date parseDate(Object str) {
|
||||||
{
|
if (str == null) {
|
||||||
if (str == null)
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
return parseDate(str.toString(), parsePatterns);
|
return parseDate(str.toString(), parsePatterns);
|
||||||
}
|
} catch (ParseException e) {
|
||||||
catch (ParseException e)
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -125,8 +107,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||||
/**
|
/**
|
||||||
* 获取服务器启动时间
|
* 获取服务器启动时间
|
||||||
*/
|
*/
|
||||||
public static Date getServerStartDate()
|
public static Date getServerStartDate() {
|
||||||
{
|
|
||||||
long time = ManagementFactory.getRuntimeMXBean().getStartTime();
|
long time = ManagementFactory.getRuntimeMXBean().getStartTime();
|
||||||
return new Date(time);
|
return new Date(time);
|
||||||
}
|
}
|
||||||
|
|
@ -134,8 +115,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||||
/**
|
/**
|
||||||
* 计算两个时间差
|
* 计算两个时间差
|
||||||
*/
|
*/
|
||||||
public static String getDatePoor(Date endDate, Date nowDate)
|
public static String getDatePoor(Date endDate, Date nowDate) {
|
||||||
{
|
|
||||||
long nd = 1000 * 24 * 60 * 60;
|
long nd = 1000 * 24 * 60 * 60;
|
||||||
long nh = 1000 * 60 * 60;
|
long nh = 1000 * 60 * 60;
|
||||||
long nm = 1000 * 60;
|
long nm = 1000 * 60;
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.ruoyi.common.utils;
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
|
|
||||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -9,30 +10,25 @@ import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class ExceptionUtil
|
public class ExceptionUtil {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 获取exception的详细错误信息。
|
* 获取exception的详细错误信息。
|
||||||
*/
|
*/
|
||||||
public static String getExceptionMessage(Throwable e)
|
public static String getExceptionMessage(Throwable e) {
|
||||||
{
|
|
||||||
StringWriter sw = new StringWriter();
|
StringWriter sw = new StringWriter();
|
||||||
e.printStackTrace(new PrintWriter(sw, true));
|
e.printStackTrace(new PrintWriter(sw, true));
|
||||||
String str = sw.toString();
|
String str = sw.toString();
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getRootErrorMseeage(Exception e)
|
public static String getRootErrorMseeage(Exception e) {
|
||||||
{
|
|
||||||
Throwable root = ExceptionUtils.getRootCause(e);
|
Throwable root = ExceptionUtils.getRootCause(e);
|
||||||
root = (root == null ? e : root);
|
root = (root == null ? e : root);
|
||||||
if (root == null)
|
if (root == null) {
|
||||||
{
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
String msg = root.getMessage();
|
String msg = root.getMessage();
|
||||||
if (msg == null)
|
if (msg == null) {
|
||||||
{
|
|
||||||
return "null";
|
return "null";
|
||||||
}
|
}
|
||||||
return StringUtils.defaultString(msg);
|
return StringUtils.defaultString(msg);
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue