diff --git a/pom.xml b/pom.xml
index 212e88264..cc03afb23 100644
--- a/pom.xml
+++ b/pom.xml
@@ -215,6 +215,8 @@
ruoyi-common
ruoyi-imark
ruoyi-cloud
+ ruoyi-alg
+ ruoyi-tts
pom
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java
index a0e726bd4..0e890c109 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java
@@ -1,30 +1,30 @@
-package com.ruoyi;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
-
-/**
- * 启动程序
- *
- * @author ruoyi
- */
-@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
-public class RuoYiApplication
-{
- public static void main(String[] args)
- {
- // System.setProperty("spring.devtools.restart.enabled", "false");
- SpringApplication.run(RuoYiApplication.class, args);
- System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +
- " .-------. ____ __ \n" +
- " | _ _ \\ \\ \\ / / \n" +
- " | ( ' ) | \\ _. / ' \n" +
- " |(_ o _) / _( )_ .' \n" +
- " | (_,_).' __ ___(_ o _)' \n" +
- " | |\\ \\ | || |(_,_)' \n" +
- " | | \\ `' /| `-' / \n" +
- " | | \\ / \\ / \n" +
- " ''-' `'-' `-..-' ");
- }
+package com.ruoyi;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+
+/**
+ * 启动程序
+ *
+ * @author ruoyi
+ */
+@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
+public class RuoYiApplication
+{
+ public static void main(String[] args)
+ {
+ // System.setProperty("spring.devtools.restart.enabled", "false");
+ SpringApplication.run(RuoYiApplication.class, args);
+ System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +
+ " .-------. ____ __ \n" +
+ " | _ _ \\ \\ \\ / / \n" +
+ " | ( ' ) | \\ _. / ' \n" +
+ " |(_ o _) / _( )_ .' \n" +
+ " | (_,_).' __ ___(_ o _)' \n" +
+ " | |\\ \\ | || |(_,_)' \n" +
+ " | | \\ `' /| `-' / \n" +
+ " | | \\ / \\ / \n" +
+ " ''-' `'-' `-..-' ");
+ }
}
\ No newline at end of file
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiServletInitializer.java b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiServletInitializer.java
index 9d82a2378..6de67dc76 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiServletInitializer.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiServletInitializer.java
@@ -1,18 +1,18 @@
-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);
- }
-}
+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);
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
index c8f7e3ad0..a0bb7d667 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
@@ -1,112 +1,112 @@
-package com.ruoyi.web.controller.common;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-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.ResponseBody;
-import org.springframework.web.multipart.MultipartFile;
-import com.ruoyi.common.config.Global;
-import com.ruoyi.common.config.ServerConfig;
-import com.ruoyi.common.constant.Constants;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.common.utils.file.FileUploadUtils;
-import com.ruoyi.common.utils.file.FileUtils;
-
-/**
- * 通用请求处理
- *
- * @author ruoyi
- */
-@Controller
-public class CommonController
-{
- private static final Logger log = LoggerFactory.getLogger(CommonController.class);
-
- @Autowired
- private ServerConfig serverConfig;
-
- /**
- * 通用下载请求
- *
- * @param fileName 文件名称
- * @param delete 是否删除
- */
- @GetMapping("common/download")
- public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
- {
- try
- {
- if (!FileUtils.isValidFilename(fileName))
- {
- throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
- }
- String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
- String filePath = Global.getDownloadPath() + fileName;
-
- response.setCharacterEncoding("utf-8");
- response.setContentType("multipart/form-data");
- response.setHeader("Content-Disposition",
- "attachment;fileName=" + FileUtils.setFileDownloadHeader(request, realFileName));
- FileUtils.writeBytes(filePath, response.getOutputStream());
- if (delete)
- {
- FileUtils.deleteFile(filePath);
- }
- }
- catch (Exception e)
- {
- log.error("下载文件失败", e);
- }
- }
-
- /**
- * 通用上传请求
- */
- @PostMapping("/common/upload")
- @ResponseBody
- public AjaxResult uploadFile(MultipartFile file) throws Exception
- {
- try
- {
- // 上传文件路径
- String filePath = Global.getUploadPath();
- // 上传并返回新文件名称
- String fileName = FileUploadUtils.upload(filePath, file);
- String url = serverConfig.getUrl() + fileName;
- AjaxResult ajax = AjaxResult.success();
- ajax.put("fileName", fileName);
- ajax.put("url", url);
- return ajax;
- }
- catch (Exception e)
- {
- return AjaxResult.error(e.getMessage());
- }
- }
-
- /**
- * 本地资源通用下载
- */
- @GetMapping("/common/download/resource")
- public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
- throws Exception
- {
- // 本地资源路径
- String localPath = Global.getProfile();
- // 数据库资源地址
- String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
- // 下载名称
- String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
- response.setCharacterEncoding("utf-8");
- response.setContentType("multipart/form-data");
- response.setHeader("Content-Disposition",
- "attachment;fileName=" + FileUtils.setFileDownloadHeader(request, downloadName));
- FileUtils.writeBytes(downloadPath, response.getOutputStream());
- }
-}
+package com.ruoyi.web.controller.common;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+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.ResponseBody;
+import org.springframework.web.multipart.MultipartFile;
+import com.ruoyi.common.config.Global;
+import com.ruoyi.common.config.ServerConfig;
+import com.ruoyi.common.constant.Constants;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.file.FileUploadUtils;
+import com.ruoyi.common.utils.file.FileUtils;
+
+/**
+ * 通用请求处理
+ *
+ * @author ruoyi
+ */
+@Controller
+public class CommonController
+{
+ private static final Logger log = LoggerFactory.getLogger(CommonController.class);
+
+ @Autowired
+ private ServerConfig serverConfig;
+
+ /**
+ * 通用下载请求
+ *
+ * @param fileName 文件名称
+ * @param delete 是否删除
+ */
+ @GetMapping("common/download")
+ public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
+ {
+ try
+ {
+ if (!FileUtils.isValidFilename(fileName))
+ {
+ throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
+ }
+ String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
+ String filePath = Global.getDownloadPath() + fileName;
+
+ response.setCharacterEncoding("utf-8");
+ response.setContentType("multipart/form-data");
+ response.setHeader("Content-Disposition",
+ "attachment;fileName=" + FileUtils.setFileDownloadHeader(request, realFileName));
+ FileUtils.writeBytes(filePath, response.getOutputStream());
+ if (delete)
+ {
+ FileUtils.deleteFile(filePath);
+ }
+ }
+ catch (Exception e)
+ {
+ log.error("下载文件失败", e);
+ }
+ }
+
+ /**
+ * 通用上传请求
+ */
+ @PostMapping("/common/upload")
+ @ResponseBody
+ public AjaxResult uploadFile(MultipartFile file) throws Exception
+ {
+ try
+ {
+ // 上传文件路径
+ String filePath = Global.getUploadPath();
+ // 上传并返回新文件名称
+ String fileName = FileUploadUtils.upload(filePath, file);
+ String url = serverConfig.getUrl() + fileName;
+ AjaxResult ajax = AjaxResult.success();
+ ajax.put("fileName", fileName);
+ ajax.put("url", url);
+ return ajax;
+ }
+ catch (Exception e)
+ {
+ return AjaxResult.error(e.getMessage());
+ }
+ }
+
+ /**
+ * 本地资源通用下载
+ */
+ @GetMapping("/common/download/resource")
+ public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
+ throws Exception
+ {
+ // 本地资源路径
+ String localPath = Global.getProfile();
+ // 数据库资源地址
+ String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
+ // 下载名称
+ String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
+ response.setCharacterEncoding("utf-8");
+ response.setContentType("multipart/form-data");
+ response.setHeader("Content-Disposition",
+ "attachment;fileName=" + FileUtils.setFileDownloadHeader(request, downloadName));
+ FileUtils.writeBytes(downloadPath, response.getOutputStream());
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoDialogController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoDialogController.java
index 78d6da74b..cf52245f0 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoDialogController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoDialogController.java
@@ -1,80 +1,80 @@
-package com.ruoyi.web.controller.demo.controller;
-
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-/**
- * 模态窗口
- *
- * @author ruoyi
- */
-@Controller
-@RequestMapping("/demo/modal")
-public class DemoDialogController
-{
- private String prefix = "demo/modal";
-
- /**
- * 模态窗口
- */
- @GetMapping("/dialog")
- public String dialog()
- {
- return prefix + "/dialog";
- }
-
- /**
- * 弹层组件
- */
- @GetMapping("/layer")
- public String layer()
- {
- return prefix + "/layer";
- }
-
- /**
- * 表单
- */
- @GetMapping("/form")
- public String form()
- {
- return prefix + "/form";
- }
-
- /**
- * 表格
- */
- @GetMapping("/table")
- public String table()
- {
- return prefix + "/table";
- }
-
- /**
- * 表格check
- */
- @GetMapping("/check")
- public String check()
- {
- return prefix + "/table/check";
- }
-
- /**
- * 表格radio
- */
- @GetMapping("/radio")
- public String radio()
- {
- return prefix + "/table/radio";
- }
-
- /**
- * 表格回传父窗体
- */
- @GetMapping("/parent")
- public String parent()
- {
- return prefix + "/table/parent";
- }
-}
+package com.ruoyi.web.controller.demo.controller;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+/**
+ * 模态窗口
+ *
+ * @author ruoyi
+ */
+@Controller
+@RequestMapping("/demo/modal")
+public class DemoDialogController
+{
+ private String prefix = "demo/modal";
+
+ /**
+ * 模态窗口
+ */
+ @GetMapping("/dialog")
+ public String dialog()
+ {
+ return prefix + "/dialog";
+ }
+
+ /**
+ * 弹层组件
+ */
+ @GetMapping("/layer")
+ public String layer()
+ {
+ return prefix + "/layer";
+ }
+
+ /**
+ * 表单
+ */
+ @GetMapping("/form")
+ public String form()
+ {
+ return prefix + "/form";
+ }
+
+ /**
+ * 表格
+ */
+ @GetMapping("/table")
+ public String table()
+ {
+ return prefix + "/table";
+ }
+
+ /**
+ * 表格check
+ */
+ @GetMapping("/check")
+ public String check()
+ {
+ return prefix + "/table/check";
+ }
+
+ /**
+ * 表格radio
+ */
+ @GetMapping("/radio")
+ public String radio()
+ {
+ return prefix + "/table/radio";
+ }
+
+ /**
+ * 表格回传父窗体
+ */
+ @GetMapping("/parent")
+ public String parent()
+ {
+ return prefix + "/table/parent";
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoFormController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoFormController.java
index 8c2f38bad..080f5be8d 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoFormController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoFormController.java
@@ -1,326 +1,326 @@
-package com.ruoyi.web.controller.demo.controller;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.ModelMap;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-import com.alibaba.fastjson.JSON;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.core.domain.CxSelect;
-
-/**
- * 表单相关
- *
- * @author ruoyi
- */
-@Controller
-@RequestMapping("/demo/form")
-public class DemoFormController
-{
- private String prefix = "demo/form";
-
- private final static List users = new ArrayList();
- {
- users.add(new UserFormModel(1, "1000001", "测试1", "15888888888"));
- users.add(new UserFormModel(2, "1000002", "测试2", "15666666666"));
- users.add(new UserFormModel(3, "1000003", "测试3", "15666666666"));
- users.add(new UserFormModel(4, "1000004", "测试4", "15666666666"));
- users.add(new UserFormModel(5, "1000005", "测试5", "15666666666"));
- }
-
- /**
- * 按钮页
- */
- @GetMapping("/button")
- public String button()
- {
- return prefix + "/button";
- }
-
- /**
- * 下拉框
- */
- @GetMapping("/select")
- public String select()
- {
- return prefix + "/select";
- }
-
- /**
- * 时间轴
- */
- @GetMapping("/timeline")
- public String timeline()
- {
- return prefix + "/timeline";
- }
-
- /**
- * 表单校验
- */
- @GetMapping("/validate")
- public String validate()
- {
- return prefix + "/validate";
- }
-
- /**
- * 功能扩展(包含文件上传)
- */
- @GetMapping("/jasny")
- public String jasny()
- {
- return prefix + "/jasny";
- }
-
- /**
- * 拖动排序
- */
- @GetMapping("/sortable")
- public String sortable()
- {
- return prefix + "/sortable";
- }
-
- /**
- * 选项卡 & 面板
- */
- @GetMapping("/tabs_panels")
- public String tabs_panels()
- {
- return prefix + "/tabs_panels";
- }
-
- /**
- * 栅格
- */
- @GetMapping("/grid")
- public String grid()
- {
- return prefix + "/grid";
- }
-
- /**
- * 表单向导
- */
- @GetMapping("/wizard")
- public String wizard()
- {
- return prefix + "/wizard";
- }
-
- /**
- * 文件上传
- */
- @GetMapping("/upload")
- public String upload()
- {
- return prefix + "/upload";
- }
-
- /**
- * 日期和时间页
- */
- @GetMapping("/datetime")
- public String datetime()
- {
- return prefix + "/datetime";
- }
-
- /**
- * 左右互选组件
- */
- @GetMapping("/duallistbox")
- public String duallistbox()
- {
- return prefix + "/duallistbox";
- }
-
- /**
- * 基本表单
- */
- @GetMapping("/basic")
- public String basic()
- {
- return prefix + "/basic";
- }
-
- /**
- * 卡片列表
- */
- @GetMapping("/cards")
- public String cards()
- {
- return prefix + "/cards";
- }
-
- /**
- * summernote 富文本编辑器
- */
- @GetMapping("/summernote")
- public String summernote()
- {
- return prefix + "/summernote";
- }
-
- /**
- * 搜索自动补全
- */
- @GetMapping("/autocomplete")
- public String autocomplete()
- {
- return prefix + "/autocomplete";
- }
-
- /**
- * 多级联动下拉
- */
- @GetMapping("/cxselect")
- public String cxselect(ModelMap mmap)
- {
- CxSelect cxSelectTB = new CxSelect();
- cxSelectTB.setN("淘宝");
- cxSelectTB.setV("taobao");
- CxSelect cxSelectTm = new CxSelect();
- cxSelectTm.setN("天猫");
- cxSelectTm.setV("tm");
- CxSelect cxSelectJhs = new CxSelect();
- cxSelectJhs.setN("聚划算");
- cxSelectJhs.setV("jhs");
- List tmList = new ArrayList();
- tmList.add(cxSelectTm);
- tmList.add(cxSelectJhs);
- cxSelectTB.setS(tmList);
-
- CxSelect cxSelectJD = new CxSelect();
- cxSelectJD.setN("京东");
- cxSelectJD.setV("jd");
- CxSelect cxSelectCs = new CxSelect();
- cxSelectCs.setN("京东超市");
- cxSelectCs.setV("jdcs");
- CxSelect cxSelectSx = new CxSelect();
- cxSelectSx.setN("京东生鲜");
- cxSelectSx.setV("jdsx");
- List jdList = new ArrayList();
- jdList.add(cxSelectCs);
- jdList.add(cxSelectSx);
- cxSelectJD.setS(jdList);
-
- List cxList = new ArrayList();
- cxList.add(cxSelectTB);
- cxList.add(cxSelectJD);
-
- mmap.put("data", JSON.toJSON(cxList));
- return prefix + "/cxselect";
- }
-
- /**
- * 模拟数据
- */
- @GetMapping("/cityData")
- @ResponseBody
- public String cityData()
- {
- String data = "[{\"n\":\"湖南省\",\"s\":[{\"n\":\"长沙市\",\"s\":[{\"n\":\"芙蓉区\"},{\"n\":\"天心区\"},{\"n\":\"岳麓区\"},{\"n\":\"开福区\"},{\"n\":\"雨花区\"},{\"n\":\"望城区\"},{\"n\":\"长沙县\"},{\"n\":\"宁乡县\"},{\"n\":\"浏阳市\"}]},{\"n\":\"株洲市\",\"s\":[{\"n\":\"荷塘区\"},{\"n\":\"芦淞区\"},{\"n\":\"石峰区\"},{\"n\":\"天元区\"},{\"n\":\"株洲县\"},{\"n\":\"攸县\"},{\"n\":\"茶陵县\"},{\"n\":\"炎陵县\"},{\"n\":\"醴陵市\"}]},{\"n\":\"湘潭市\",\"s\":[{\"n\":\"雨湖区\"},{\"n\":\"岳塘区\"},{\"n\":\"湘潭县\"},{\"n\":\"湘乡市\"},{\"n\":\"韶山市\"}]},{\"n\":\"衡阳市\",\"s\":[{\"n\":\"珠晖区\"},{\"n\":\"雁峰区\"},{\"n\":\"石鼓区\"},{\"n\":\"蒸湘区\"},{\"n\":\"南岳区\"},{\"n\":\"衡阳县\"},{\"n\":\"衡南县\"},{\"n\":\"衡山县\"},{\"n\":\"衡东县\"},{\"n\":\"祁东县\"},{\"n\":\"耒阳市\"},{\"n\":\"常宁市\"}]},{\"n\":\"邵阳市\",\"s\":[{\"n\":\"双清区\"},{\"n\":\"大祥区\"},{\"n\":\"北塔区\"},{\"n\":\"邵东县\"},{\"n\":\"新邵县\"},{\"n\":\"邵阳县\"},{\"n\":\"隆回县\"},{\"n\":\"洞口县\"},{\"n\":\"绥宁县\"},{\"n\":\"新宁县\"},{\"n\":\"城步苗族自治县\"},{\"n\":\"武冈市\"}]},{\"n\":\"岳阳市\",\"s\":[{\"n\":\"岳阳楼区\"},{\"n\":\"云溪区\"},{\"n\":\"君山区\"},{\"n\":\"岳阳县\"},{\"n\":\"华容县\"},{\"n\":\"湘阴县\"},{\"n\":\"平江县\"},{\"n\":\"汨罗市\"},{\"n\":\"临湘市\"}]},{\"n\":\"常德市\",\"s\":[{\"n\":\"武陵区\"},{\"n\":\"鼎城区\"},{\"n\":\"安乡县\"},{\"n\":\"汉寿县\"},{\"n\":\"澧县\"},{\"n\":\"临澧县\"},{\"n\":\"桃源县\"},{\"n\":\"石门县\"},{\"n\":\"津市市\"}]},{\"n\":\"张家界市\",\"s\":[{\"n\":\"永定区\"},{\"n\":\"武陵源区\"},{\"n\":\"慈利县\"},{\"n\":\"桑植县\"}]},{\"n\":\"益阳市\",\"s\":[{\"n\":\"资阳区\"},{\"n\":\"赫山区\"},{\"n\":\"南县\"},{\"n\":\"桃江县\"},{\"n\":\"安化县\"},{\"n\":\"沅江市\"}]},{\"n\":\"郴州市\",\"s\":[{\"n\":\"北湖区\"},{\"n\":\"苏仙区\"},{\"n\":\"桂阳县\"},{\"n\":\"宜章县\"},{\"n\":\"永兴县\"},{\"n\":\"嘉禾县\"},{\"n\":\"临武县\"},{\"n\":\"汝城县\"},{\"n\":\"桂东县\"},{\"n\":\"安仁县\"},{\"n\":\"资兴市\"}]},{\"n\":\"永州市\",\"s\":[{\"n\":\"零陵区\"},{\"n\":\"冷水滩区\"},{\"n\":\"祁阳县\"},{\"n\":\"东安县\"},{\"n\":\"双牌县\"},{\"n\":\"道县\"},{\"n\":\"江永县\"},{\"n\":\"宁远县\"},{\"n\":\"蓝山县\"},{\"n\":\"新田县\"},{\"n\":\"江华瑶族自治县\"}]},{\"n\":\"怀化市\",\"s\":[{\"n\":\"鹤城区\"},{\"n\":\"中方县\"},{\"n\":\"沅陵县\"},{\"n\":\"辰溪县\"},{\"n\":\"溆浦县\"},{\"n\":\"会同县\"},{\"n\":\"麻阳苗族自治县\"},{\"n\":\"新晃侗族自治县\"},{\"n\":\"芷江侗族自治县\"},{\"n\":\"靖州苗族侗族自治县\"},{\"n\":\"通道侗族自治县\"},{\"n\":\"洪江市\"}]},{\"n\":\"娄底市\",\"s\":[{\"n\":\"娄星区\"},{\"n\":\"双峰县\"},{\"n\":\"新化县\"},{\"n\":\"冷水江市\"},{\"n\":\"涟源市\"}]},{\"n\":\"湘西土家族苗族自治州\",\"s\":[{\"n\":\"吉首市\"},{\"n\":\"泸溪县\"},{\"n\":\"凤凰县\"},{\"n\":\"花垣县\"},{\"n\":\"保靖县\"},{\"n\":\"古丈县\"},{\"n\":\"永顺县\"},{\"n\":\"龙山县\"}]}]},{\"n\":\"广东省\",\"s\":[{\"n\":\"广州市\",\"s\":[{\"n\":\"荔湾区\"},{\"n\":\"越秀区\"},{\"n\":\"海珠区\"},{\"n\":\"天河区\"},{\"n\":\"白云区\"},{\"n\":\"黄埔区\"},{\"n\":\"番禺区\"},{\"n\":\"花都区\"},{\"n\":\"南沙区\"},{\"n\":\"萝岗区\"},{\"n\":\"增城市\"},{\"n\":\"从化市\"}]},{\"n\":\"韶关市\",\"s\":[{\"n\":\"武江区\"},{\"n\":\"浈江区\"},{\"n\":\"曲江区\"},{\"n\":\"始兴县\"},{\"n\":\"仁化县\"},{\"n\":\"翁源县\"},{\"n\":\"乳源瑶族自治县\"},{\"n\":\"新丰县\"},{\"n\":\"乐昌市\"},{\"n\":\"南雄市\"}]},{\"n\":\"深圳市\",\"s\":[{\"n\":\"罗湖区\"},{\"n\":\"福田区\"},{\"n\":\"南山区\"},{\"n\":\"宝安区\"},{\"n\":\"龙岗区\"},{\"n\":\"盐田区\"}]},{\"n\":\"珠海市\",\"s\":[{\"n\":\"香洲区\"},{\"n\":\"斗门区\"},{\"n\":\"金湾区\"}]},{\"n\":\"汕头市\",\"s\":[{\"n\":\"龙湖区\"},{\"n\":\"金平区\"},{\"n\":\"濠江区\"},{\"n\":\"潮阳区\"},{\"n\":\"潮南区\"},{\"n\":\"澄海区\"},{\"n\":\"南澳县\"}]},{\"n\":\"佛山市\",\"s\":[{\"n\":\"禅城区\"},{\"n\":\"南海区\"},{\"n\":\"顺德区\"},{\"n\":\"三水区\"},{\"n\":\"高明区\"}]},{\"n\":\"江门市\",\"s\":[{\"n\":\"蓬江区\"},{\"n\":\"江海区\"},{\"n\":\"新会区\"},{\"n\":\"台山市\"},{\"n\":\"开平市\"},{\"n\":\"鹤山市\"},{\"n\":\"恩平市\"}]},{\"n\":\"湛江市\",\"s\":[{\"n\":\"赤坎区\"},{\"n\":\"霞山区\"},{\"n\":\"坡头区\"},{\"n\":\"麻章区\"},{\"n\":\"遂溪县\"},{\"n\":\"徐闻县\"},{\"n\":\"廉江市\"},{\"n\":\"雷州市\"},{\"n\":\"吴川市\"}]},{\"n\":\"茂名市\",\"s\":[{\"n\":\"茂南区\"},{\"n\":\"茂港区\"},{\"n\":\"电白县\"},{\"n\":\"高州市\"},{\"n\":\"化州市\"},{\"n\":\"信宜市\"}]},{\"n\":\"肇庆市\",\"s\":[{\"n\":\"端州区\"},{\"n\":\"鼎湖区\"},{\"n\":\"广宁县\"},{\"n\":\"怀集县\"},{\"n\":\"封开县\"},{\"n\":\"德庆县\"},{\"n\":\"高要市\"},{\"n\":\"四会市\"}]},{\"n\":\"惠州市\",\"s\":[{\"n\":\"惠城区\"},{\"n\":\"惠阳区\"},{\"n\":\"博罗县\"},{\"n\":\"惠东县\"},{\"n\":\"龙门县\"}]},{\"n\":\"梅州市\",\"s\":[{\"n\":\"梅江区\"},{\"n\":\"梅县\"},{\"n\":\"大埔县\"},{\"n\":\"丰顺县\"},{\"n\":\"五华县\"},{\"n\":\"平远县\"},{\"n\":\"蕉岭县\"},{\"n\":\"兴宁市\"}]},{\"n\":\"汕尾市\",\"s\":[{\"n\":\"城区\"},{\"n\":\"海丰县\"},{\"n\":\"陆河县\"},{\"n\":\"陆丰市\"}]},{\"n\":\"河源市\",\"s\":[{\"n\":\"源城区\"},{\"n\":\"紫金县\"},{\"n\":\"龙川县\"},{\"n\":\"连平县\"},{\"n\":\"和平县\"},{\"n\":\"东源县\"}]},{\"n\":\"阳江市\",\"s\":[{\"n\":\"江城区\"},{\"n\":\"阳西县\"},{\"n\":\"阳东县\"},{\"n\":\"阳春市\"}]},{\"n\":\"清远市\",\"s\":[{\"n\":\"清城区\"},{\"n\":\"清新区\"},{\"n\":\"佛冈县\"},{\"n\":\"阳山县\"},{\"n\":\"连山壮族瑶族自治县\"},{\"n\":\"连南瑶族自治县\"},{\"n\":\"英德市\"},{\"n\":\"连州市\"}]},{\"n\":\"东莞市\"},{\"n\":\"中山市\"},{\"n\":\"潮州市\",\"s\":[{\"n\":\"湘桥区\"},{\"n\":\"潮安区\"},{\"n\":\"饶平县\"}]},{\"n\":\"揭阳市\",\"s\":[{\"n\":\"榕城区\"},{\"n\":\"揭东区\"},{\"n\":\"揭西县\"},{\"n\":\"惠来县\"},{\"n\":\"普宁市\"}]},{\"n\":\"云浮市\",\"s\":[{\"n\":\"云城区\"},{\"n\":\"新兴县\"},{\"n\":\"郁南县\"},{\"n\":\"云安县\"},{\"n\":\"罗定市\"}]}]}]";
- return data;
- }
-
- /**
- * 获取用户数据
- */
- @GetMapping("/userModel")
- @ResponseBody
- public AjaxResult userModel()
- {
- AjaxResult ajax = new AjaxResult();
-
- ajax.put("code", 200);
- ajax.put("value", users);
- return ajax;
- }
-
- /**
- * 获取数据集合
- */
- @GetMapping("/collection")
- @ResponseBody
- public AjaxResult collection()
- {
- String[] array = { "ruoyi 1", "ruoyi 2", "ruoyi 3", "ruoyi 4", "ruoyi 5" };
- AjaxResult ajax = new AjaxResult();
- ajax.put("value", array);
- return ajax;
- }
-}
-
-class UserFormModel
-{
- /** 用户ID */
- private int userId;
-
- /** 用户编号 */
- private String userCode;
-
- /** 用户姓名 */
- private String userName;
-
- /** 用户手机 */
- private String userPhone;
-
- public UserFormModel()
- {
-
- }
-
- public UserFormModel(int userId, String userCode, String userName, String userPhone)
- {
- this.userId = userId;
- this.userCode = userCode;
- this.userName = userName;
- this.userPhone = userPhone;
- }
-
- public int getUserId()
- {
- return userId;
- }
-
- public void setUserId(int userId)
- {
- this.userId = userId;
- }
-
- public String getUserCode()
- {
- return userCode;
- }
-
- public void setUserCode(String userCode)
- {
- this.userCode = userCode;
- }
-
- public String getUserName()
- {
- return userName;
- }
-
- public void setUserName(String userName)
- {
- this.userName = userName;
- }
-
- public String getUserPhone()
- {
- return userPhone;
- }
-
- public void setUserPhone(String userPhone)
- {
- this.userPhone = userPhone;
- }
-
-}
+package com.ruoyi.web.controller.demo.controller;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import com.alibaba.fastjson.JSON;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.CxSelect;
+
+/**
+ * 表单相关
+ *
+ * @author ruoyi
+ */
+@Controller
+@RequestMapping("/demo/form")
+public class DemoFormController
+{
+ private String prefix = "demo/form";
+
+ private final static List users = new ArrayList();
+ {
+ users.add(new UserFormModel(1, "1000001", "测试1", "15888888888"));
+ users.add(new UserFormModel(2, "1000002", "测试2", "15666666666"));
+ users.add(new UserFormModel(3, "1000003", "测试3", "15666666666"));
+ users.add(new UserFormModel(4, "1000004", "测试4", "15666666666"));
+ users.add(new UserFormModel(5, "1000005", "测试5", "15666666666"));
+ }
+
+ /**
+ * 按钮页
+ */
+ @GetMapping("/button")
+ public String button()
+ {
+ return prefix + "/button";
+ }
+
+ /**
+ * 下拉框
+ */
+ @GetMapping("/select")
+ public String select()
+ {
+ return prefix + "/select";
+ }
+
+ /**
+ * 时间轴
+ */
+ @GetMapping("/timeline")
+ public String timeline()
+ {
+ return prefix + "/timeline";
+ }
+
+ /**
+ * 表单校验
+ */
+ @GetMapping("/validate")
+ public String validate()
+ {
+ return prefix + "/validate";
+ }
+
+ /**
+ * 功能扩展(包含文件上传)
+ */
+ @GetMapping("/jasny")
+ public String jasny()
+ {
+ return prefix + "/jasny";
+ }
+
+ /**
+ * 拖动排序
+ */
+ @GetMapping("/sortable")
+ public String sortable()
+ {
+ return prefix + "/sortable";
+ }
+
+ /**
+ * 选项卡 & 面板
+ */
+ @GetMapping("/tabs_panels")
+ public String tabs_panels()
+ {
+ return prefix + "/tabs_panels";
+ }
+
+ /**
+ * 栅格
+ */
+ @GetMapping("/grid")
+ public String grid()
+ {
+ return prefix + "/grid";
+ }
+
+ /**
+ * 表单向导
+ */
+ @GetMapping("/wizard")
+ public String wizard()
+ {
+ return prefix + "/wizard";
+ }
+
+ /**
+ * 文件上传
+ */
+ @GetMapping("/upload")
+ public String upload()
+ {
+ return prefix + "/upload";
+ }
+
+ /**
+ * 日期和时间页
+ */
+ @GetMapping("/datetime")
+ public String datetime()
+ {
+ return prefix + "/datetime";
+ }
+
+ /**
+ * 左右互选组件
+ */
+ @GetMapping("/duallistbox")
+ public String duallistbox()
+ {
+ return prefix + "/duallistbox";
+ }
+
+ /**
+ * 基本表单
+ */
+ @GetMapping("/basic")
+ public String basic()
+ {
+ return prefix + "/basic";
+ }
+
+ /**
+ * 卡片列表
+ */
+ @GetMapping("/cards")
+ public String cards()
+ {
+ return prefix + "/cards";
+ }
+
+ /**
+ * summernote 富文本编辑器
+ */
+ @GetMapping("/summernote")
+ public String summernote()
+ {
+ return prefix + "/summernote";
+ }
+
+ /**
+ * 搜索自动补全
+ */
+ @GetMapping("/autocomplete")
+ public String autocomplete()
+ {
+ return prefix + "/autocomplete";
+ }
+
+ /**
+ * 多级联动下拉
+ */
+ @GetMapping("/cxselect")
+ public String cxselect(ModelMap mmap)
+ {
+ CxSelect cxSelectTB = new CxSelect();
+ cxSelectTB.setN("淘宝");
+ cxSelectTB.setV("taobao");
+ CxSelect cxSelectTm = new CxSelect();
+ cxSelectTm.setN("天猫");
+ cxSelectTm.setV("tm");
+ CxSelect cxSelectJhs = new CxSelect();
+ cxSelectJhs.setN("聚划算");
+ cxSelectJhs.setV("jhs");
+ List tmList = new ArrayList();
+ tmList.add(cxSelectTm);
+ tmList.add(cxSelectJhs);
+ cxSelectTB.setS(tmList);
+
+ CxSelect cxSelectJD = new CxSelect();
+ cxSelectJD.setN("京东");
+ cxSelectJD.setV("jd");
+ CxSelect cxSelectCs = new CxSelect();
+ cxSelectCs.setN("京东超市");
+ cxSelectCs.setV("jdcs");
+ CxSelect cxSelectSx = new CxSelect();
+ cxSelectSx.setN("京东生鲜");
+ cxSelectSx.setV("jdsx");
+ List jdList = new ArrayList();
+ jdList.add(cxSelectCs);
+ jdList.add(cxSelectSx);
+ cxSelectJD.setS(jdList);
+
+ List cxList = new ArrayList();
+ cxList.add(cxSelectTB);
+ cxList.add(cxSelectJD);
+
+ mmap.put("data", JSON.toJSON(cxList));
+ return prefix + "/cxselect";
+ }
+
+ /**
+ * 模拟数据
+ */
+ @GetMapping("/cityData")
+ @ResponseBody
+ public String cityData()
+ {
+ String data = "[{\"n\":\"湖南省\",\"s\":[{\"n\":\"长沙市\",\"s\":[{\"n\":\"芙蓉区\"},{\"n\":\"天心区\"},{\"n\":\"岳麓区\"},{\"n\":\"开福区\"},{\"n\":\"雨花区\"},{\"n\":\"望城区\"},{\"n\":\"长沙县\"},{\"n\":\"宁乡县\"},{\"n\":\"浏阳市\"}]},{\"n\":\"株洲市\",\"s\":[{\"n\":\"荷塘区\"},{\"n\":\"芦淞区\"},{\"n\":\"石峰区\"},{\"n\":\"天元区\"},{\"n\":\"株洲县\"},{\"n\":\"攸县\"},{\"n\":\"茶陵县\"},{\"n\":\"炎陵县\"},{\"n\":\"醴陵市\"}]},{\"n\":\"湘潭市\",\"s\":[{\"n\":\"雨湖区\"},{\"n\":\"岳塘区\"},{\"n\":\"湘潭县\"},{\"n\":\"湘乡市\"},{\"n\":\"韶山市\"}]},{\"n\":\"衡阳市\",\"s\":[{\"n\":\"珠晖区\"},{\"n\":\"雁峰区\"},{\"n\":\"石鼓区\"},{\"n\":\"蒸湘区\"},{\"n\":\"南岳区\"},{\"n\":\"衡阳县\"},{\"n\":\"衡南县\"},{\"n\":\"衡山县\"},{\"n\":\"衡东县\"},{\"n\":\"祁东县\"},{\"n\":\"耒阳市\"},{\"n\":\"常宁市\"}]},{\"n\":\"邵阳市\",\"s\":[{\"n\":\"双清区\"},{\"n\":\"大祥区\"},{\"n\":\"北塔区\"},{\"n\":\"邵东县\"},{\"n\":\"新邵县\"},{\"n\":\"邵阳县\"},{\"n\":\"隆回县\"},{\"n\":\"洞口县\"},{\"n\":\"绥宁县\"},{\"n\":\"新宁县\"},{\"n\":\"城步苗族自治县\"},{\"n\":\"武冈市\"}]},{\"n\":\"岳阳市\",\"s\":[{\"n\":\"岳阳楼区\"},{\"n\":\"云溪区\"},{\"n\":\"君山区\"},{\"n\":\"岳阳县\"},{\"n\":\"华容县\"},{\"n\":\"湘阴县\"},{\"n\":\"平江县\"},{\"n\":\"汨罗市\"},{\"n\":\"临湘市\"}]},{\"n\":\"常德市\",\"s\":[{\"n\":\"武陵区\"},{\"n\":\"鼎城区\"},{\"n\":\"安乡县\"},{\"n\":\"汉寿县\"},{\"n\":\"澧县\"},{\"n\":\"临澧县\"},{\"n\":\"桃源县\"},{\"n\":\"石门县\"},{\"n\":\"津市市\"}]},{\"n\":\"张家界市\",\"s\":[{\"n\":\"永定区\"},{\"n\":\"武陵源区\"},{\"n\":\"慈利县\"},{\"n\":\"桑植县\"}]},{\"n\":\"益阳市\",\"s\":[{\"n\":\"资阳区\"},{\"n\":\"赫山区\"},{\"n\":\"南县\"},{\"n\":\"桃江县\"},{\"n\":\"安化县\"},{\"n\":\"沅江市\"}]},{\"n\":\"郴州市\",\"s\":[{\"n\":\"北湖区\"},{\"n\":\"苏仙区\"},{\"n\":\"桂阳县\"},{\"n\":\"宜章县\"},{\"n\":\"永兴县\"},{\"n\":\"嘉禾县\"},{\"n\":\"临武县\"},{\"n\":\"汝城县\"},{\"n\":\"桂东县\"},{\"n\":\"安仁县\"},{\"n\":\"资兴市\"}]},{\"n\":\"永州市\",\"s\":[{\"n\":\"零陵区\"},{\"n\":\"冷水滩区\"},{\"n\":\"祁阳县\"},{\"n\":\"东安县\"},{\"n\":\"双牌县\"},{\"n\":\"道县\"},{\"n\":\"江永县\"},{\"n\":\"宁远县\"},{\"n\":\"蓝山县\"},{\"n\":\"新田县\"},{\"n\":\"江华瑶族自治县\"}]},{\"n\":\"怀化市\",\"s\":[{\"n\":\"鹤城区\"},{\"n\":\"中方县\"},{\"n\":\"沅陵县\"},{\"n\":\"辰溪县\"},{\"n\":\"溆浦县\"},{\"n\":\"会同县\"},{\"n\":\"麻阳苗族自治县\"},{\"n\":\"新晃侗族自治县\"},{\"n\":\"芷江侗族自治县\"},{\"n\":\"靖州苗族侗族自治县\"},{\"n\":\"通道侗族自治县\"},{\"n\":\"洪江市\"}]},{\"n\":\"娄底市\",\"s\":[{\"n\":\"娄星区\"},{\"n\":\"双峰县\"},{\"n\":\"新化县\"},{\"n\":\"冷水江市\"},{\"n\":\"涟源市\"}]},{\"n\":\"湘西土家族苗族自治州\",\"s\":[{\"n\":\"吉首市\"},{\"n\":\"泸溪县\"},{\"n\":\"凤凰县\"},{\"n\":\"花垣县\"},{\"n\":\"保靖县\"},{\"n\":\"古丈县\"},{\"n\":\"永顺县\"},{\"n\":\"龙山县\"}]}]},{\"n\":\"广东省\",\"s\":[{\"n\":\"广州市\",\"s\":[{\"n\":\"荔湾区\"},{\"n\":\"越秀区\"},{\"n\":\"海珠区\"},{\"n\":\"天河区\"},{\"n\":\"白云区\"},{\"n\":\"黄埔区\"},{\"n\":\"番禺区\"},{\"n\":\"花都区\"},{\"n\":\"南沙区\"},{\"n\":\"萝岗区\"},{\"n\":\"增城市\"},{\"n\":\"从化市\"}]},{\"n\":\"韶关市\",\"s\":[{\"n\":\"武江区\"},{\"n\":\"浈江区\"},{\"n\":\"曲江区\"},{\"n\":\"始兴县\"},{\"n\":\"仁化县\"},{\"n\":\"翁源县\"},{\"n\":\"乳源瑶族自治县\"},{\"n\":\"新丰县\"},{\"n\":\"乐昌市\"},{\"n\":\"南雄市\"}]},{\"n\":\"深圳市\",\"s\":[{\"n\":\"罗湖区\"},{\"n\":\"福田区\"},{\"n\":\"南山区\"},{\"n\":\"宝安区\"},{\"n\":\"龙岗区\"},{\"n\":\"盐田区\"}]},{\"n\":\"珠海市\",\"s\":[{\"n\":\"香洲区\"},{\"n\":\"斗门区\"},{\"n\":\"金湾区\"}]},{\"n\":\"汕头市\",\"s\":[{\"n\":\"龙湖区\"},{\"n\":\"金平区\"},{\"n\":\"濠江区\"},{\"n\":\"潮阳区\"},{\"n\":\"潮南区\"},{\"n\":\"澄海区\"},{\"n\":\"南澳县\"}]},{\"n\":\"佛山市\",\"s\":[{\"n\":\"禅城区\"},{\"n\":\"南海区\"},{\"n\":\"顺德区\"},{\"n\":\"三水区\"},{\"n\":\"高明区\"}]},{\"n\":\"江门市\",\"s\":[{\"n\":\"蓬江区\"},{\"n\":\"江海区\"},{\"n\":\"新会区\"},{\"n\":\"台山市\"},{\"n\":\"开平市\"},{\"n\":\"鹤山市\"},{\"n\":\"恩平市\"}]},{\"n\":\"湛江市\",\"s\":[{\"n\":\"赤坎区\"},{\"n\":\"霞山区\"},{\"n\":\"坡头区\"},{\"n\":\"麻章区\"},{\"n\":\"遂溪县\"},{\"n\":\"徐闻县\"},{\"n\":\"廉江市\"},{\"n\":\"雷州市\"},{\"n\":\"吴川市\"}]},{\"n\":\"茂名市\",\"s\":[{\"n\":\"茂南区\"},{\"n\":\"茂港区\"},{\"n\":\"电白县\"},{\"n\":\"高州市\"},{\"n\":\"化州市\"},{\"n\":\"信宜市\"}]},{\"n\":\"肇庆市\",\"s\":[{\"n\":\"端州区\"},{\"n\":\"鼎湖区\"},{\"n\":\"广宁县\"},{\"n\":\"怀集县\"},{\"n\":\"封开县\"},{\"n\":\"德庆县\"},{\"n\":\"高要市\"},{\"n\":\"四会市\"}]},{\"n\":\"惠州市\",\"s\":[{\"n\":\"惠城区\"},{\"n\":\"惠阳区\"},{\"n\":\"博罗县\"},{\"n\":\"惠东县\"},{\"n\":\"龙门县\"}]},{\"n\":\"梅州市\",\"s\":[{\"n\":\"梅江区\"},{\"n\":\"梅县\"},{\"n\":\"大埔县\"},{\"n\":\"丰顺县\"},{\"n\":\"五华县\"},{\"n\":\"平远县\"},{\"n\":\"蕉岭县\"},{\"n\":\"兴宁市\"}]},{\"n\":\"汕尾市\",\"s\":[{\"n\":\"城区\"},{\"n\":\"海丰县\"},{\"n\":\"陆河县\"},{\"n\":\"陆丰市\"}]},{\"n\":\"河源市\",\"s\":[{\"n\":\"源城区\"},{\"n\":\"紫金县\"},{\"n\":\"龙川县\"},{\"n\":\"连平县\"},{\"n\":\"和平县\"},{\"n\":\"东源县\"}]},{\"n\":\"阳江市\",\"s\":[{\"n\":\"江城区\"},{\"n\":\"阳西县\"},{\"n\":\"阳东县\"},{\"n\":\"阳春市\"}]},{\"n\":\"清远市\",\"s\":[{\"n\":\"清城区\"},{\"n\":\"清新区\"},{\"n\":\"佛冈县\"},{\"n\":\"阳山县\"},{\"n\":\"连山壮族瑶族自治县\"},{\"n\":\"连南瑶族自治县\"},{\"n\":\"英德市\"},{\"n\":\"连州市\"}]},{\"n\":\"东莞市\"},{\"n\":\"中山市\"},{\"n\":\"潮州市\",\"s\":[{\"n\":\"湘桥区\"},{\"n\":\"潮安区\"},{\"n\":\"饶平县\"}]},{\"n\":\"揭阳市\",\"s\":[{\"n\":\"榕城区\"},{\"n\":\"揭东区\"},{\"n\":\"揭西县\"},{\"n\":\"惠来县\"},{\"n\":\"普宁市\"}]},{\"n\":\"云浮市\",\"s\":[{\"n\":\"云城区\"},{\"n\":\"新兴县\"},{\"n\":\"郁南县\"},{\"n\":\"云安县\"},{\"n\":\"罗定市\"}]}]}]";
+ return data;
+ }
+
+ /**
+ * 获取用户数据
+ */
+ @GetMapping("/userModel")
+ @ResponseBody
+ public AjaxResult userModel()
+ {
+ AjaxResult ajax = new AjaxResult();
+
+ ajax.put("code", 200);
+ ajax.put("value", users);
+ return ajax;
+ }
+
+ /**
+ * 获取数据集合
+ */
+ @GetMapping("/collection")
+ @ResponseBody
+ public AjaxResult collection()
+ {
+ String[] array = { "ruoyi 1", "ruoyi 2", "ruoyi 3", "ruoyi 4", "ruoyi 5" };
+ AjaxResult ajax = new AjaxResult();
+ ajax.put("value", array);
+ return ajax;
+ }
+}
+
+class UserFormModel
+{
+ /** 用户ID */
+ private int userId;
+
+ /** 用户编号 */
+ private String userCode;
+
+ /** 用户姓名 */
+ private String userName;
+
+ /** 用户手机 */
+ private String userPhone;
+
+ public UserFormModel()
+ {
+
+ }
+
+ public UserFormModel(int userId, String userCode, String userName, String userPhone)
+ {
+ this.userId = userId;
+ this.userCode = userCode;
+ this.userName = userName;
+ this.userPhone = userPhone;
+ }
+
+ public int getUserId()
+ {
+ return userId;
+ }
+
+ public void setUserId(int userId)
+ {
+ this.userId = userId;
+ }
+
+ public String getUserCode()
+ {
+ return userCode;
+ }
+
+ public void setUserCode(String userCode)
+ {
+ this.userCode = userCode;
+ }
+
+ public String getUserName()
+ {
+ return userName;
+ }
+
+ public void setUserName(String userName)
+ {
+ this.userName = userName;
+ }
+
+ public String getUserPhone()
+ {
+ return userPhone;
+ }
+
+ public void setUserPhone(String userPhone)
+ {
+ this.userPhone = userPhone;
+ }
+
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoIconController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoIconController.java
index 490c3e061..b6884cc1e 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoIconController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoIconController.java
@@ -1,35 +1,35 @@
-package com.ruoyi.web.controller.demo.controller;
-
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-/**
- * 图标相关
- *
- * @author ruoyi
- */
-@Controller
-@RequestMapping("/demo/icon")
-public class DemoIconController
-{
- private String prefix = "demo/icon";
-
- /**
- * FontAwesome图标
- */
- @GetMapping("/fontawesome")
- public String fontAwesome()
- {
- return prefix + "/fontawesome";
- }
-
- /**
- * Glyphicons图标
- */
- @GetMapping("/glyphicons")
- public String glyphicons()
- {
- return prefix + "/glyphicons";
- }
-}
+package com.ruoyi.web.controller.demo.controller;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+/**
+ * 图标相关
+ *
+ * @author ruoyi
+ */
+@Controller
+@RequestMapping("/demo/icon")
+public class DemoIconController
+{
+ private String prefix = "demo/icon";
+
+ /**
+ * FontAwesome图标
+ */
+ @GetMapping("/fontawesome")
+ public String fontAwesome()
+ {
+ return prefix + "/fontawesome";
+ }
+
+ /**
+ * Glyphicons图标
+ */
+ @GetMapping("/glyphicons")
+ public String glyphicons()
+ {
+ return prefix + "/glyphicons";
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoOperateController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoOperateController.java
index c7544a325..10b9df688 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoOperateController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoOperateController.java
@@ -1,326 +1,326 @@
-package com.ruoyi.web.controller.demo.controller;
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-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 org.springframework.web.multipart.MultipartFile;
-import com.ruoyi.common.core.controller.BaseController;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.core.page.PageDomain;
-import com.ruoyi.common.core.page.TableDataInfo;
-import com.ruoyi.common.core.page.TableSupport;
-import com.ruoyi.common.core.text.Convert;
-import com.ruoyi.common.exception.BusinessException;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.web.controller.demo.domain.CustomerModel;
-import com.ruoyi.web.controller.demo.domain.UserOperateModel;
-
-/**
- * 操作控制
- *
- * @author ruoyi
- */
-@Controller
-@RequestMapping("/demo/operate")
-public class DemoOperateController extends BaseController
-{
- private String prefix = "demo/operate";
-
- private final static Map users = new LinkedHashMap();
- {
- users.put(1, new UserOperateModel(1, "1000001", "测试1", "0", "15888888888", "ry@qq.com", 150.0, "0"));
- users.put(2, new UserOperateModel(2, "1000002", "测试2", "1", "15666666666", "ry@qq.com", 180.0, "1"));
- users.put(3, new UserOperateModel(3, "1000003", "测试3", "0", "15666666666", "ry@qq.com", 110.0, "1"));
- users.put(4, new UserOperateModel(4, "1000004", "测试4", "1", "15666666666", "ry@qq.com", 220.0, "1"));
- users.put(5, new UserOperateModel(5, "1000005", "测试5", "0", "15666666666", "ry@qq.com", 140.0, "1"));
- users.put(6, new UserOperateModel(6, "1000006", "测试6", "1", "15666666666", "ry@qq.com", 330.0, "1"));
- users.put(7, new UserOperateModel(7, "1000007", "测试7", "0", "15666666666", "ry@qq.com", 160.0, "1"));
- users.put(8, new UserOperateModel(8, "1000008", "测试8", "1", "15666666666", "ry@qq.com", 170.0, "1"));
- users.put(9, new UserOperateModel(9, "1000009", "测试9", "0", "15666666666", "ry@qq.com", 180.0, "1"));
- users.put(10, new UserOperateModel(10, "1000010", "测试10", "0", "15666666666", "ry@qq.com", 210.0, "1"));
- users.put(11, new UserOperateModel(11, "1000011", "测试11", "1", "15666666666", "ry@qq.com", 110.0, "1"));
- users.put(12, new UserOperateModel(12, "1000012", "测试12", "0", "15666666666", "ry@qq.com", 120.0, "1"));
- users.put(13, new UserOperateModel(13, "1000013", "测试13", "1", "15666666666", "ry@qq.com", 380.0, "1"));
- users.put(14, new UserOperateModel(14, "1000014", "测试14", "0", "15666666666", "ry@qq.com", 280.0, "1"));
- users.put(15, new UserOperateModel(15, "1000015", "测试15", "0", "15666666666", "ry@qq.com", 570.0, "1"));
- users.put(16, new UserOperateModel(16, "1000016", "测试16", "1", "15666666666", "ry@qq.com", 260.0, "1"));
- users.put(17, new UserOperateModel(17, "1000017", "测试17", "1", "15666666666", "ry@qq.com", 210.0, "1"));
- users.put(18, new UserOperateModel(18, "1000018", "测试18", "1", "15666666666", "ry@qq.com", 340.0, "1"));
- users.put(19, new UserOperateModel(19, "1000019", "测试19", "1", "15666666666", "ry@qq.com", 160.0, "1"));
- users.put(20, new UserOperateModel(20, "1000020", "测试20", "1", "15666666666", "ry@qq.com", 220.0, "1"));
- users.put(21, new UserOperateModel(21, "1000021", "测试21", "1", "15666666666", "ry@qq.com", 120.0, "1"));
- users.put(22, new UserOperateModel(22, "1000022", "测试22", "1", "15666666666", "ry@qq.com", 130.0, "1"));
- users.put(23, new UserOperateModel(23, "1000023", "测试23", "1", "15666666666", "ry@qq.com", 490.0, "1"));
- users.put(24, new UserOperateModel(24, "1000024", "测试24", "1", "15666666666", "ry@qq.com", 570.0, "1"));
- users.put(25, new UserOperateModel(25, "1000025", "测试25", "1", "15666666666", "ry@qq.com", 250.0, "1"));
- users.put(26, new UserOperateModel(26, "1000026", "测试26", "1", "15666666666", "ry@qq.com", 250.0, "1"));
- }
-
- /**
- * 表格
- */
- @GetMapping("/table")
- public String table()
- {
- return prefix + "/table";
- }
-
- /**
- * 其他
- */
- @GetMapping("/other")
- public String other()
- {
- return prefix + "/other";
- }
-
- /**
- * 查询数据
- */
- @PostMapping("/list")
- @ResponseBody
- public TableDataInfo list(UserOperateModel userModel)
- {
- TableDataInfo rspData = new TableDataInfo();
- List userList = new ArrayList(users.values());
- // 查询条件过滤
- if (StringUtils.isNotEmpty(userModel.getSearchValue()))
- {
- userList.clear();
- for (Map.Entry entry : users.entrySet())
- {
- if (entry.getValue().getUserName().equals(userModel.getSearchValue()))
- {
- userList.add(entry.getValue());
- }
- }
- }
- else if (StringUtils.isNotEmpty(userModel.getUserName()))
- {
- userList.clear();
- for (Map.Entry entry : users.entrySet())
- {
- if (entry.getValue().getUserName().equals(userModel.getUserName()))
- {
- userList.add(entry.getValue());
- }
- }
- }
- PageDomain pageDomain = TableSupport.buildPageRequest();
- if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize())
- {
- rspData.setRows(userList);
- rspData.setTotal(userList.size());
- return rspData;
- }
- Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
- Integer pageSize = pageDomain.getPageNum() * 10;
- if (pageSize > userList.size())
- {
- pageSize = userList.size();
- }
- rspData.setRows(userList.subList(pageNum, pageSize));
- rspData.setTotal(userList.size());
- return rspData;
- }
-
- /**
- * 新增用户
- */
- @GetMapping("/add")
- public String add(ModelMap mmap)
- {
- return prefix + "/add";
- }
-
- /**
- * 新增保存用户
- */
- @PostMapping("/add")
- @ResponseBody
- public AjaxResult addSave(UserOperateModel user)
- {
- Integer userId = users.size() + 1;
- user.setUserId(userId);
- return AjaxResult.success(users.put(userId, user));
- }
-
- /**
- * 新增保存主子表信息
- */
- @PostMapping("/customer/add")
- @ResponseBody
- public AjaxResult addSave(CustomerModel customerModel)
- {
- System.out.println(customerModel.toString());
- return AjaxResult.success();
- }
-
- /**
- * 修改用户
- */
- @GetMapping("/edit/{userId}")
- public String edit(@PathVariable("userId") Integer userId, ModelMap mmap)
- {
- mmap.put("user", users.get(userId));
- return prefix + "/edit";
- }
-
- /**
- * 修改保存用户
- */
- @PostMapping("/edit")
- @ResponseBody
- public AjaxResult editSave(UserOperateModel user)
- {
- return AjaxResult.success(users.put(user.getUserId(), user));
- }
-
- /**
- * 导出
- */
- @PostMapping("/export")
- @ResponseBody
- public AjaxResult export(UserOperateModel user)
- {
- List list = new ArrayList(users.values());
- ExcelUtil util = new ExcelUtil(UserOperateModel.class);
- return util.exportExcel(list, "用户数据");
- }
-
- /**
- * 下载模板
- */
- @GetMapping("/importTemplate")
- @ResponseBody
- public AjaxResult importTemplate()
- {
- ExcelUtil util = new ExcelUtil(UserOperateModel.class);
- return util.importTemplateExcel("用户数据");
- }
-
- /**
- * 导入数据
- */
- @PostMapping("/importData")
- @ResponseBody
- public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
- {
- ExcelUtil util = new ExcelUtil(UserOperateModel.class);
- List userList = util.importExcel(file.getInputStream());
- String message = importUser(userList, updateSupport);
- return AjaxResult.success(message);
- }
-
- /**
- * 删除用户
- */
- @PostMapping("/remove")
- @ResponseBody
- public AjaxResult remove(String ids)
- {
- Integer[] userIds = Convert.toIntArray(ids);
- for (Integer userId : userIds)
- {
- users.remove(userId);
- }
- return AjaxResult.success();
- }
-
- /**
- * 查看详细
- */
- @GetMapping("/detail/{userId}")
- public String detail(@PathVariable("userId") Integer userId, ModelMap mmap)
- {
- mmap.put("user", users.get(userId));
- return prefix + "/detail";
- }
-
- @PostMapping("/clean")
- @ResponseBody
- public AjaxResult clean()
- {
- users.clear();
- return success();
- }
-
- /**
- * 导入用户数据
- *
- * @param userList 用户数据列表
- * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
- * @return 结果
- */
- public String importUser(List userList, Boolean isUpdateSupport)
- {
- if (StringUtils.isNull(userList) || userList.size() == 0)
- {
- throw new BusinessException("导入用户数据不能为空!");
- }
- int successNum = 0;
- int failureNum = 0;
- StringBuilder successMsg = new StringBuilder();
- StringBuilder failureMsg = new StringBuilder();
- for (UserOperateModel user : userList)
- {
- try
- {
- // 验证是否存在这个用户
- boolean userFlag = false;
- for (Map.Entry entry : users.entrySet())
- {
- if (entry.getValue().getUserName().equals(user.getUserName()))
- {
- userFlag = true;
- break;
- }
- }
- if (!userFlag)
- {
- Integer userId = users.size() + 1;
- user.setUserId(userId);
- users.put(userId, user);
- successNum++;
- successMsg.append("
" + successNum + "、用户 " + user.getUserName() + " 导入成功");
- }
- else if (isUpdateSupport)
- {
- users.put(user.getUserId(), user);
- successNum++;
- successMsg.append("
" + successNum + "、用户 " + user.getUserName() + " 更新成功");
- }
- else
- {
- failureNum++;
- failureMsg.append("
" + failureNum + "、用户 " + user.getUserName() + " 已存在");
- }
- }
- catch (Exception e)
- {
- failureNum++;
- String msg = "
" + failureNum + "、账号 " + user.getUserName() + " 导入失败:";
- failureMsg.append(msg + e.getMessage());
- }
- }
- if (failureNum > 0)
- {
- failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
- throw new BusinessException(failureMsg.toString());
- }
- else
- {
- successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
- }
- return successMsg.toString();
- }
-}
+package com.ruoyi.web.controller.demo.controller;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+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 org.springframework.web.multipart.MultipartFile;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.PageDomain;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.core.page.TableSupport;
+import com.ruoyi.common.core.text.Convert;
+import com.ruoyi.common.exception.BusinessException;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.web.controller.demo.domain.CustomerModel;
+import com.ruoyi.web.controller.demo.domain.UserOperateModel;
+
+/**
+ * 操作控制
+ *
+ * @author ruoyi
+ */
+@Controller
+@RequestMapping("/demo/operate")
+public class DemoOperateController extends BaseController
+{
+ private String prefix = "demo/operate";
+
+ private final static Map users = new LinkedHashMap();
+ {
+ users.put(1, new UserOperateModel(1, "1000001", "测试1", "0", "15888888888", "ry@qq.com", 150.0, "0"));
+ users.put(2, new UserOperateModel(2, "1000002", "测试2", "1", "15666666666", "ry@qq.com", 180.0, "1"));
+ users.put(3, new UserOperateModel(3, "1000003", "测试3", "0", "15666666666", "ry@qq.com", 110.0, "1"));
+ users.put(4, new UserOperateModel(4, "1000004", "测试4", "1", "15666666666", "ry@qq.com", 220.0, "1"));
+ users.put(5, new UserOperateModel(5, "1000005", "测试5", "0", "15666666666", "ry@qq.com", 140.0, "1"));
+ users.put(6, new UserOperateModel(6, "1000006", "测试6", "1", "15666666666", "ry@qq.com", 330.0, "1"));
+ users.put(7, new UserOperateModel(7, "1000007", "测试7", "0", "15666666666", "ry@qq.com", 160.0, "1"));
+ users.put(8, new UserOperateModel(8, "1000008", "测试8", "1", "15666666666", "ry@qq.com", 170.0, "1"));
+ users.put(9, new UserOperateModel(9, "1000009", "测试9", "0", "15666666666", "ry@qq.com", 180.0, "1"));
+ users.put(10, new UserOperateModel(10, "1000010", "测试10", "0", "15666666666", "ry@qq.com", 210.0, "1"));
+ users.put(11, new UserOperateModel(11, "1000011", "测试11", "1", "15666666666", "ry@qq.com", 110.0, "1"));
+ users.put(12, new UserOperateModel(12, "1000012", "测试12", "0", "15666666666", "ry@qq.com", 120.0, "1"));
+ users.put(13, new UserOperateModel(13, "1000013", "测试13", "1", "15666666666", "ry@qq.com", 380.0, "1"));
+ users.put(14, new UserOperateModel(14, "1000014", "测试14", "0", "15666666666", "ry@qq.com", 280.0, "1"));
+ users.put(15, new UserOperateModel(15, "1000015", "测试15", "0", "15666666666", "ry@qq.com", 570.0, "1"));
+ users.put(16, new UserOperateModel(16, "1000016", "测试16", "1", "15666666666", "ry@qq.com", 260.0, "1"));
+ users.put(17, new UserOperateModel(17, "1000017", "测试17", "1", "15666666666", "ry@qq.com", 210.0, "1"));
+ users.put(18, new UserOperateModel(18, "1000018", "测试18", "1", "15666666666", "ry@qq.com", 340.0, "1"));
+ users.put(19, new UserOperateModel(19, "1000019", "测试19", "1", "15666666666", "ry@qq.com", 160.0, "1"));
+ users.put(20, new UserOperateModel(20, "1000020", "测试20", "1", "15666666666", "ry@qq.com", 220.0, "1"));
+ users.put(21, new UserOperateModel(21, "1000021", "测试21", "1", "15666666666", "ry@qq.com", 120.0, "1"));
+ users.put(22, new UserOperateModel(22, "1000022", "测试22", "1", "15666666666", "ry@qq.com", 130.0, "1"));
+ users.put(23, new UserOperateModel(23, "1000023", "测试23", "1", "15666666666", "ry@qq.com", 490.0, "1"));
+ users.put(24, new UserOperateModel(24, "1000024", "测试24", "1", "15666666666", "ry@qq.com", 570.0, "1"));
+ users.put(25, new UserOperateModel(25, "1000025", "测试25", "1", "15666666666", "ry@qq.com", 250.0, "1"));
+ users.put(26, new UserOperateModel(26, "1000026", "测试26", "1", "15666666666", "ry@qq.com", 250.0, "1"));
+ }
+
+ /**
+ * 表格
+ */
+ @GetMapping("/table")
+ public String table()
+ {
+ return prefix + "/table";
+ }
+
+ /**
+ * 其他
+ */
+ @GetMapping("/other")
+ public String other()
+ {
+ return prefix + "/other";
+ }
+
+ /**
+ * 查询数据
+ */
+ @PostMapping("/list")
+ @ResponseBody
+ public TableDataInfo list(UserOperateModel userModel)
+ {
+ TableDataInfo rspData = new TableDataInfo();
+ List userList = new ArrayList(users.values());
+ // 查询条件过滤
+ if (StringUtils.isNotEmpty(userModel.getSearchValue()))
+ {
+ userList.clear();
+ for (Map.Entry entry : users.entrySet())
+ {
+ if (entry.getValue().getUserName().equals(userModel.getSearchValue()))
+ {
+ userList.add(entry.getValue());
+ }
+ }
+ }
+ else if (StringUtils.isNotEmpty(userModel.getUserName()))
+ {
+ userList.clear();
+ for (Map.Entry entry : users.entrySet())
+ {
+ if (entry.getValue().getUserName().equals(userModel.getUserName()))
+ {
+ userList.add(entry.getValue());
+ }
+ }
+ }
+ PageDomain pageDomain = TableSupport.buildPageRequest();
+ if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize())
+ {
+ rspData.setRows(userList);
+ rspData.setTotal(userList.size());
+ return rspData;
+ }
+ Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
+ Integer pageSize = pageDomain.getPageNum() * 10;
+ if (pageSize > userList.size())
+ {
+ pageSize = userList.size();
+ }
+ rspData.setRows(userList.subList(pageNum, pageSize));
+ rspData.setTotal(userList.size());
+ return rspData;
+ }
+
+ /**
+ * 新增用户
+ */
+ @GetMapping("/add")
+ public String add(ModelMap mmap)
+ {
+ return prefix + "/add";
+ }
+
+ /**
+ * 新增保存用户
+ */
+ @PostMapping("/add")
+ @ResponseBody
+ public AjaxResult addSave(UserOperateModel user)
+ {
+ Integer userId = users.size() + 1;
+ user.setUserId(userId);
+ return AjaxResult.success(users.put(userId, user));
+ }
+
+ /**
+ * 新增保存主子表信息
+ */
+ @PostMapping("/customer/add")
+ @ResponseBody
+ public AjaxResult addSave(CustomerModel customerModel)
+ {
+ System.out.println(customerModel.toString());
+ return AjaxResult.success();
+ }
+
+ /**
+ * 修改用户
+ */
+ @GetMapping("/edit/{userId}")
+ public String edit(@PathVariable("userId") Integer userId, ModelMap mmap)
+ {
+ mmap.put("user", users.get(userId));
+ return prefix + "/edit";
+ }
+
+ /**
+ * 修改保存用户
+ */
+ @PostMapping("/edit")
+ @ResponseBody
+ public AjaxResult editSave(UserOperateModel user)
+ {
+ return AjaxResult.success(users.put(user.getUserId(), user));
+ }
+
+ /**
+ * 导出
+ */
+ @PostMapping("/export")
+ @ResponseBody
+ public AjaxResult export(UserOperateModel user)
+ {
+ List list = new ArrayList(users.values());
+ ExcelUtil util = new ExcelUtil(UserOperateModel.class);
+ return util.exportExcel(list, "用户数据");
+ }
+
+ /**
+ * 下载模板
+ */
+ @GetMapping("/importTemplate")
+ @ResponseBody
+ public AjaxResult importTemplate()
+ {
+ ExcelUtil util = new ExcelUtil(UserOperateModel.class);
+ return util.importTemplateExcel("用户数据");
+ }
+
+ /**
+ * 导入数据
+ */
+ @PostMapping("/importData")
+ @ResponseBody
+ public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
+ {
+ ExcelUtil util = new ExcelUtil(UserOperateModel.class);
+ List userList = util.importExcel(file.getInputStream());
+ String message = importUser(userList, updateSupport);
+ return AjaxResult.success(message);
+ }
+
+ /**
+ * 删除用户
+ */
+ @PostMapping("/remove")
+ @ResponseBody
+ public AjaxResult remove(String ids)
+ {
+ Integer[] userIds = Convert.toIntArray(ids);
+ for (Integer userId : userIds)
+ {
+ users.remove(userId);
+ }
+ return AjaxResult.success();
+ }
+
+ /**
+ * 查看详细
+ */
+ @GetMapping("/detail/{userId}")
+ public String detail(@PathVariable("userId") Integer userId, ModelMap mmap)
+ {
+ mmap.put("user", users.get(userId));
+ return prefix + "/detail";
+ }
+
+ @PostMapping("/clean")
+ @ResponseBody
+ public AjaxResult clean()
+ {
+ users.clear();
+ return success();
+ }
+
+ /**
+ * 导入用户数据
+ *
+ * @param userList 用户数据列表
+ * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
+ * @return 结果
+ */
+ public String importUser(List userList, Boolean isUpdateSupport)
+ {
+ if (StringUtils.isNull(userList) || userList.size() == 0)
+ {
+ throw new BusinessException("导入用户数据不能为空!");
+ }
+ int successNum = 0;
+ int failureNum = 0;
+ StringBuilder successMsg = new StringBuilder();
+ StringBuilder failureMsg = new StringBuilder();
+ for (UserOperateModel user : userList)
+ {
+ try
+ {
+ // 验证是否存在这个用户
+ boolean userFlag = false;
+ for (Map.Entry entry : users.entrySet())
+ {
+ if (entry.getValue().getUserName().equals(user.getUserName()))
+ {
+ userFlag = true;
+ break;
+ }
+ }
+ if (!userFlag)
+ {
+ Integer userId = users.size() + 1;
+ user.setUserId(userId);
+ users.put(userId, user);
+ successNum++;
+ successMsg.append("
" + successNum + "、用户 " + user.getUserName() + " 导入成功");
+ }
+ else if (isUpdateSupport)
+ {
+ users.put(user.getUserId(), user);
+ successNum++;
+ successMsg.append("
" + successNum + "、用户 " + user.getUserName() + " 更新成功");
+ }
+ else
+ {
+ failureNum++;
+ failureMsg.append("
" + failureNum + "、用户 " + user.getUserName() + " 已存在");
+ }
+ }
+ catch (Exception e)
+ {
+ failureNum++;
+ String msg = "
" + failureNum + "、账号 " + user.getUserName() + " 导入失败:";
+ failureMsg.append(msg + e.getMessage());
+ }
+ }
+ if (failureNum > 0)
+ {
+ failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
+ throw new BusinessException(failureMsg.toString());
+ }
+ else
+ {
+ successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
+ }
+ return successMsg.toString();
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoReportController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoReportController.java
index 318e8f08b..610100874 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoReportController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoReportController.java
@@ -1,53 +1,53 @@
-package com.ruoyi.web.controller.demo.controller;
-
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-/**
- * 报表
- *
- * @author ruoyi
- */
-@Controller
-@RequestMapping("/demo/report")
-public class DemoReportController
-{
- private String prefix = "demo/report";
-
- /**
- * 百度ECharts
- */
- @GetMapping("/echarts")
- public String echarts()
- {
- return prefix + "/echarts";
- }
-
- /**
- * 图表插件
- */
- @GetMapping("/peity")
- public String peity()
- {
- return prefix + "/peity";
- }
-
- /**
- * 线状图插件
- */
- @GetMapping("/sparkline")
- public String sparkline()
- {
- return prefix + "/sparkline";
- }
-
- /**
- * 图表组合
- */
- @GetMapping("/metrics")
- public String metrics()
- {
- return prefix + "/metrics";
- }
-}
+package com.ruoyi.web.controller.demo.controller;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+/**
+ * 报表
+ *
+ * @author ruoyi
+ */
+@Controller
+@RequestMapping("/demo/report")
+public class DemoReportController
+{
+ private String prefix = "demo/report";
+
+ /**
+ * 百度ECharts
+ */
+ @GetMapping("/echarts")
+ public String echarts()
+ {
+ return prefix + "/echarts";
+ }
+
+ /**
+ * 图表插件
+ */
+ @GetMapping("/peity")
+ public String peity()
+ {
+ return prefix + "/peity";
+ }
+
+ /**
+ * 线状图插件
+ */
+ @GetMapping("/sparkline")
+ public String sparkline()
+ {
+ return prefix + "/sparkline";
+ }
+
+ /**
+ * 图表组合
+ */
+ @GetMapping("/metrics")
+ public String metrics()
+ {
+ return prefix + "/metrics";
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoTableController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoTableController.java
index 511e75cbb..e98186432 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoTableController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoTableController.java
@@ -1,423 +1,423 @@
-package com.ruoyi.web.controller.demo.controller;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-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.ResponseBody;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.common.core.controller.BaseController;
-import com.ruoyi.common.core.page.PageDomain;
-import com.ruoyi.common.core.page.TableDataInfo;
-import com.ruoyi.common.core.page.TableSupport;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.common.utils.StringUtils;
-
-/**
- * 表格相关
- *
- * @author ruoyi
- */
-@Controller
-@RequestMapping("/demo/table")
-public class DemoTableController extends BaseController
-{
- private String prefix = "demo/table";
-
- private final static List users = new ArrayList();
- {
- users.add(new UserTableModel(1, "1000001", "测试1", "0", "15888888888", "ry@qq.com", 150.0, "0"));
- users.add(new UserTableModel(2, "1000002", "测试2", "1", "15666666666", "ry@qq.com", 180.0, "1"));
- users.add(new UserTableModel(3, "1000003", "测试3", "0", "15666666666", "ry@qq.com", 110.0, "1"));
- users.add(new UserTableModel(4, "1000004", "测试4", "1", "15666666666", "ry@qq.com", 220.0, "1"));
- users.add(new UserTableModel(5, "1000005", "测试5", "0", "15666666666", "ry@qq.com", 140.0, "1"));
- users.add(new UserTableModel(6, "1000006", "测试6", "1", "15666666666", "ry@qq.com", 330.0, "1"));
- users.add(new UserTableModel(7, "1000007", "测试7", "0", "15666666666", "ry@qq.com", 160.0, "1"));
- users.add(new UserTableModel(8, "1000008", "测试8", "1", "15666666666", "ry@qq.com", 170.0, "1"));
- users.add(new UserTableModel(9, "1000009", "测试9", "0", "15666666666", "ry@qq.com", 180.0, "1"));
- users.add(new UserTableModel(10, "1000010", "测试10", "0", "15666666666", "ry@qq.com", 210.0, "1"));
- users.add(new UserTableModel(11, "1000011", "测试11", "1", "15666666666", "ry@qq.com", 110.0, "1"));
- users.add(new UserTableModel(12, "1000012", "测试12", "0", "15666666666", "ry@qq.com", 120.0, "1"));
- users.add(new UserTableModel(13, "1000013", "测试13", "1", "15666666666", "ry@qq.com", 380.0, "1"));
- users.add(new UserTableModel(14, "1000014", "测试14", "0", "15666666666", "ry@qq.com", 280.0, "1"));
- users.add(new UserTableModel(15, "1000015", "测试15", "0", "15666666666", "ry@qq.com", 570.0, "1"));
- users.add(new UserTableModel(16, "1000016", "测试16", "1", "15666666666", "ry@qq.com", 260.0, "1"));
- users.add(new UserTableModel(17, "1000017", "测试17", "1", "15666666666", "ry@qq.com", 210.0, "1"));
- users.add(new UserTableModel(18, "1000018", "测试18", "1", "15666666666", "ry@qq.com", 340.0, "1"));
- users.add(new UserTableModel(19, "1000019", "测试19", "1", "15666666666", "ry@qq.com", 160.0, "1"));
- users.add(new UserTableModel(20, "1000020", "测试20", "1", "15666666666", "ry@qq.com", 220.0, "1"));
- users.add(new UserTableModel(21, "1000021", "测试21", "1", "15666666666", "ry@qq.com", 120.0, "1"));
- users.add(new UserTableModel(22, "1000022", "测试22", "1", "15666666666", "ry@qq.com", 130.0, "1"));
- users.add(new UserTableModel(23, "1000023", "测试23", "1", "15666666666", "ry@qq.com", 490.0, "1"));
- users.add(new UserTableModel(24, "1000024", "测试24", "1", "15666666666", "ry@qq.com", 570.0, "1"));
- users.add(new UserTableModel(25, "1000025", "测试25", "1", "15666666666", "ry@qq.com", 250.0, "1"));
- users.add(new UserTableModel(26, "1000026", "测试26", "1", "15666666666", "ry@qq.com", 250.0, "1"));
- }
-
- /**
- * 搜索相关
- */
- @GetMapping("/search")
- public String search()
- {
- return prefix + "/search";
- }
-
- /**
- * 数据汇总
- */
- @GetMapping("/footer")
- public String footer()
- {
- return prefix + "/footer";
- }
-
- /**
- * 组合表头
- */
- @GetMapping("/groupHeader")
- public String groupHeader()
- {
- return prefix + "/groupHeader";
- }
-
- /**
- * 表格导出
- */
- @GetMapping("/export")
- public String export()
- {
- return prefix + "/export";
- }
-
- /**
- * 翻页记住选择
- */
- @GetMapping("/remember")
- public String remember()
- {
- return prefix + "/remember";
- }
-
- /**
- * 跳转至指定页
- */
- @GetMapping("/pageGo")
- public String pageGo()
- {
- return prefix + "/pageGo";
- }
-
- /**
- * 自定义查询参数
- */
- @GetMapping("/params")
- public String params()
- {
- return prefix + "/params";
- }
-
- /**
- * 多表格
- */
- @GetMapping("/multi")
- public String multi()
- {
- return prefix + "/multi";
- }
-
- /**
- * 点击按钮加载表格
- */
- @GetMapping("/button")
- public String button()
- {
- return prefix + "/button";
- }
-
- /**
- * 直接加载表格数据
- */
- @GetMapping("/data")
- public String data(ModelMap mmap)
- {
- mmap.put("users", users);
- return prefix + "/data";
- }
-
- /**
- * 表格冻结列
- */
- @GetMapping("/fixedColumns")
- public String fixedColumns()
- {
- return prefix + "/fixedColumns";
- }
-
- /**
- * 自定义触发事件
- */
- @GetMapping("/event")
- public String event()
- {
- return prefix + "/event";
- }
-
- /**
- * 表格细节视图
- */
- @GetMapping("/detail")
- public String detail()
- {
- return prefix + "/detail";
- }
-
- /**
- * 表格父子视图
- */
- @GetMapping("/child")
- public String child()
- {
- return prefix + "/child";
- }
-
- /**
- * 表格图片预览
- */
- @GetMapping("/image")
- public String image()
- {
- return prefix + "/image";
- }
-
- /**
- * 动态增删改查
- */
- @GetMapping("/curd")
- public String curd()
- {
- return prefix + "/curd";
- }
-
- /**
- * 表格拖拽操作
- */
- @GetMapping("/reorder")
- public String reorder()
- {
- return prefix + "/reorder";
- }
-
- /**
- * 表格行内编辑操作
- */
- @GetMapping("/editable")
- public String editable()
- {
- return prefix + "/editable";
- }
-
- /**
- * 主子表提交
- */
- @GetMapping("/subdata")
- public String subdata()
- {
- return prefix + "/subdata";
- }
-
- /**
- * 表格其他操作
- */
- @GetMapping("/other")
- public String other()
- {
- return prefix + "/other";
- }
-
- /**
- * 查询数据
- */
- @PostMapping("/list")
- @ResponseBody
- public TableDataInfo list(UserTableModel userModel)
- {
- TableDataInfo rspData = new TableDataInfo();
- List userList = new ArrayList(Arrays.asList(new UserTableModel[users.size()]));
- Collections.copy(userList, users);
- // 查询条件过滤
- if (StringUtils.isNotEmpty(userModel.getUserName()))
- {
- userList.clear();
- for (UserTableModel user : users)
- {
- if (user.getUserName().equals(userModel.getUserName()))
- {
- userList.add(user);
- }
- }
- }
- PageDomain pageDomain = TableSupport.buildPageRequest();
- if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize())
- {
- rspData.setRows(userList);
- rspData.setTotal(userList.size());
- return rspData;
- }
- Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
- Integer pageSize = pageDomain.getPageNum() * 10;
- if (pageSize > userList.size())
- {
- pageSize = userList.size();
- }
- rspData.setRows(userList.subList(pageNum, pageSize));
- rspData.setTotal(userList.size());
- return rspData;
- }
-}
-
-class UserTableModel
-{
- /** 用户ID */
- private int userId;
-
- /** 用户编号 */
- private String userCode;
-
- /** 用户姓名 */
- private String userName;
-
- /** 用户性别 */
- private String userSex;
-
- /** 用户手机 */
- private String userPhone;
-
- /** 用户邮箱 */
- private String userEmail;
-
- /** 用户余额 */
- private double userBalance;
-
- /** 用户状态(0正常 1停用) */
- private String status;
-
- /** 创建时间 */
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
- private Date createTime;
-
- public UserTableModel()
- {
-
- }
-
- public UserTableModel(int userId, String userCode, String userName, String userSex, String userPhone,
- String userEmail, double userBalance, String status)
- {
- this.userId = userId;
- this.userCode = userCode;
- this.userName = userName;
- this.userSex = userSex;
- this.userPhone = userPhone;
- this.userEmail = userEmail;
- this.userBalance = userBalance;
- this.status = status;
- this.createTime = DateUtils.getNowDate();
- }
-
- public int getUserId()
- {
- return userId;
- }
-
- public void setUserId(int userId)
- {
- this.userId = userId;
- }
-
- public String getUserCode()
- {
- return userCode;
- }
-
- public void setUserCode(String userCode)
- {
- this.userCode = userCode;
- }
-
- public String getUserName()
- {
- return userName;
- }
-
- public void setUserName(String userName)
- {
- this.userName = userName;
- }
-
- public String getUserSex()
- {
- return userSex;
- }
-
- public void setUserSex(String userSex)
- {
- this.userSex = userSex;
- }
-
- public String getUserPhone()
- {
- return userPhone;
- }
-
- public void setUserPhone(String userPhone)
- {
- this.userPhone = userPhone;
- }
-
- public String getUserEmail()
- {
- return userEmail;
- }
-
- public void setUserEmail(String userEmail)
- {
- this.userEmail = userEmail;
- }
-
- public double getUserBalance()
- {
- return userBalance;
- }
-
- public void setUserBalance(double userBalance)
- {
- this.userBalance = userBalance;
- }
-
- public String getStatus()
- {
- return status;
- }
-
- public void setStatus(String status)
- {
- this.status = status;
- }
-
- public Date getCreateTime()
- {
- return createTime;
- }
-
- public void setCreateTime(Date createTime)
- {
- this.createTime = createTime;
- }
-}
+package com.ruoyi.web.controller.demo.controller;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+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.ResponseBody;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.page.PageDomain;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.core.page.TableSupport;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.StringUtils;
+
+/**
+ * 表格相关
+ *
+ * @author ruoyi
+ */
+@Controller
+@RequestMapping("/demo/table")
+public class DemoTableController extends BaseController
+{
+ private String prefix = "demo/table";
+
+ private final static List users = new ArrayList();
+ {
+ users.add(new UserTableModel(1, "1000001", "测试1", "0", "15888888888", "ry@qq.com", 150.0, "0"));
+ users.add(new UserTableModel(2, "1000002", "测试2", "1", "15666666666", "ry@qq.com", 180.0, "1"));
+ users.add(new UserTableModel(3, "1000003", "测试3", "0", "15666666666", "ry@qq.com", 110.0, "1"));
+ users.add(new UserTableModel(4, "1000004", "测试4", "1", "15666666666", "ry@qq.com", 220.0, "1"));
+ users.add(new UserTableModel(5, "1000005", "测试5", "0", "15666666666", "ry@qq.com", 140.0, "1"));
+ users.add(new UserTableModel(6, "1000006", "测试6", "1", "15666666666", "ry@qq.com", 330.0, "1"));
+ users.add(new UserTableModel(7, "1000007", "测试7", "0", "15666666666", "ry@qq.com", 160.0, "1"));
+ users.add(new UserTableModel(8, "1000008", "测试8", "1", "15666666666", "ry@qq.com", 170.0, "1"));
+ users.add(new UserTableModel(9, "1000009", "测试9", "0", "15666666666", "ry@qq.com", 180.0, "1"));
+ users.add(new UserTableModel(10, "1000010", "测试10", "0", "15666666666", "ry@qq.com", 210.0, "1"));
+ users.add(new UserTableModel(11, "1000011", "测试11", "1", "15666666666", "ry@qq.com", 110.0, "1"));
+ users.add(new UserTableModel(12, "1000012", "测试12", "0", "15666666666", "ry@qq.com", 120.0, "1"));
+ users.add(new UserTableModel(13, "1000013", "测试13", "1", "15666666666", "ry@qq.com", 380.0, "1"));
+ users.add(new UserTableModel(14, "1000014", "测试14", "0", "15666666666", "ry@qq.com", 280.0, "1"));
+ users.add(new UserTableModel(15, "1000015", "测试15", "0", "15666666666", "ry@qq.com", 570.0, "1"));
+ users.add(new UserTableModel(16, "1000016", "测试16", "1", "15666666666", "ry@qq.com", 260.0, "1"));
+ users.add(new UserTableModel(17, "1000017", "测试17", "1", "15666666666", "ry@qq.com", 210.0, "1"));
+ users.add(new UserTableModel(18, "1000018", "测试18", "1", "15666666666", "ry@qq.com", 340.0, "1"));
+ users.add(new UserTableModel(19, "1000019", "测试19", "1", "15666666666", "ry@qq.com", 160.0, "1"));
+ users.add(new UserTableModel(20, "1000020", "测试20", "1", "15666666666", "ry@qq.com", 220.0, "1"));
+ users.add(new UserTableModel(21, "1000021", "测试21", "1", "15666666666", "ry@qq.com", 120.0, "1"));
+ users.add(new UserTableModel(22, "1000022", "测试22", "1", "15666666666", "ry@qq.com", 130.0, "1"));
+ users.add(new UserTableModel(23, "1000023", "测试23", "1", "15666666666", "ry@qq.com", 490.0, "1"));
+ users.add(new UserTableModel(24, "1000024", "测试24", "1", "15666666666", "ry@qq.com", 570.0, "1"));
+ users.add(new UserTableModel(25, "1000025", "测试25", "1", "15666666666", "ry@qq.com", 250.0, "1"));
+ users.add(new UserTableModel(26, "1000026", "测试26", "1", "15666666666", "ry@qq.com", 250.0, "1"));
+ }
+
+ /**
+ * 搜索相关
+ */
+ @GetMapping("/search")
+ public String search()
+ {
+ return prefix + "/search";
+ }
+
+ /**
+ * 数据汇总
+ */
+ @GetMapping("/footer")
+ public String footer()
+ {
+ return prefix + "/footer";
+ }
+
+ /**
+ * 组合表头
+ */
+ @GetMapping("/groupHeader")
+ public String groupHeader()
+ {
+ return prefix + "/groupHeader";
+ }
+
+ /**
+ * 表格导出
+ */
+ @GetMapping("/export")
+ public String export()
+ {
+ return prefix + "/export";
+ }
+
+ /**
+ * 翻页记住选择
+ */
+ @GetMapping("/remember")
+ public String remember()
+ {
+ return prefix + "/remember";
+ }
+
+ /**
+ * 跳转至指定页
+ */
+ @GetMapping("/pageGo")
+ public String pageGo()
+ {
+ return prefix + "/pageGo";
+ }
+
+ /**
+ * 自定义查询参数
+ */
+ @GetMapping("/params")
+ public String params()
+ {
+ return prefix + "/params";
+ }
+
+ /**
+ * 多表格
+ */
+ @GetMapping("/multi")
+ public String multi()
+ {
+ return prefix + "/multi";
+ }
+
+ /**
+ * 点击按钮加载表格
+ */
+ @GetMapping("/button")
+ public String button()
+ {
+ return prefix + "/button";
+ }
+
+ /**
+ * 直接加载表格数据
+ */
+ @GetMapping("/data")
+ public String data(ModelMap mmap)
+ {
+ mmap.put("users", users);
+ return prefix + "/data";
+ }
+
+ /**
+ * 表格冻结列
+ */
+ @GetMapping("/fixedColumns")
+ public String fixedColumns()
+ {
+ return prefix + "/fixedColumns";
+ }
+
+ /**
+ * 自定义触发事件
+ */
+ @GetMapping("/event")
+ public String event()
+ {
+ return prefix + "/event";
+ }
+
+ /**
+ * 表格细节视图
+ */
+ @GetMapping("/detail")
+ public String detail()
+ {
+ return prefix + "/detail";
+ }
+
+ /**
+ * 表格父子视图
+ */
+ @GetMapping("/child")
+ public String child()
+ {
+ return prefix + "/child";
+ }
+
+ /**
+ * 表格图片预览
+ */
+ @GetMapping("/image")
+ public String image()
+ {
+ return prefix + "/image";
+ }
+
+ /**
+ * 动态增删改查
+ */
+ @GetMapping("/curd")
+ public String curd()
+ {
+ return prefix + "/curd";
+ }
+
+ /**
+ * 表格拖拽操作
+ */
+ @GetMapping("/reorder")
+ public String reorder()
+ {
+ return prefix + "/reorder";
+ }
+
+ /**
+ * 表格行内编辑操作
+ */
+ @GetMapping("/editable")
+ public String editable()
+ {
+ return prefix + "/editable";
+ }
+
+ /**
+ * 主子表提交
+ */
+ @GetMapping("/subdata")
+ public String subdata()
+ {
+ return prefix + "/subdata";
+ }
+
+ /**
+ * 表格其他操作
+ */
+ @GetMapping("/other")
+ public String other()
+ {
+ return prefix + "/other";
+ }
+
+ /**
+ * 查询数据
+ */
+ @PostMapping("/list")
+ @ResponseBody
+ public TableDataInfo list(UserTableModel userModel)
+ {
+ TableDataInfo rspData = new TableDataInfo();
+ List userList = new ArrayList(Arrays.asList(new UserTableModel[users.size()]));
+ Collections.copy(userList, users);
+ // 查询条件过滤
+ if (StringUtils.isNotEmpty(userModel.getUserName()))
+ {
+ userList.clear();
+ for (UserTableModel user : users)
+ {
+ if (user.getUserName().equals(userModel.getUserName()))
+ {
+ userList.add(user);
+ }
+ }
+ }
+ PageDomain pageDomain = TableSupport.buildPageRequest();
+ if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize())
+ {
+ rspData.setRows(userList);
+ rspData.setTotal(userList.size());
+ return rspData;
+ }
+ Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
+ Integer pageSize = pageDomain.getPageNum() * 10;
+ if (pageSize > userList.size())
+ {
+ pageSize = userList.size();
+ }
+ rspData.setRows(userList.subList(pageNum, pageSize));
+ rspData.setTotal(userList.size());
+ return rspData;
+ }
+}
+
+class UserTableModel
+{
+ /** 用户ID */
+ private int userId;
+
+ /** 用户编号 */
+ private String userCode;
+
+ /** 用户姓名 */
+ private String userName;
+
+ /** 用户性别 */
+ private String userSex;
+
+ /** 用户手机 */
+ private String userPhone;
+
+ /** 用户邮箱 */
+ private String userEmail;
+
+ /** 用户余额 */
+ private double userBalance;
+
+ /** 用户状态(0正常 1停用) */
+ private String status;
+
+ /** 创建时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private Date createTime;
+
+ public UserTableModel()
+ {
+
+ }
+
+ public UserTableModel(int userId, String userCode, String userName, String userSex, String userPhone,
+ String userEmail, double userBalance, String status)
+ {
+ this.userId = userId;
+ this.userCode = userCode;
+ this.userName = userName;
+ this.userSex = userSex;
+ this.userPhone = userPhone;
+ this.userEmail = userEmail;
+ this.userBalance = userBalance;
+ this.status = status;
+ this.createTime = DateUtils.getNowDate();
+ }
+
+ public int getUserId()
+ {
+ return userId;
+ }
+
+ public void setUserId(int userId)
+ {
+ this.userId = userId;
+ }
+
+ public String getUserCode()
+ {
+ return userCode;
+ }
+
+ public void setUserCode(String userCode)
+ {
+ this.userCode = userCode;
+ }
+
+ public String getUserName()
+ {
+ return userName;
+ }
+
+ public void setUserName(String userName)
+ {
+ this.userName = userName;
+ }
+
+ public String getUserSex()
+ {
+ return userSex;
+ }
+
+ public void setUserSex(String userSex)
+ {
+ this.userSex = userSex;
+ }
+
+ public String getUserPhone()
+ {
+ return userPhone;
+ }
+
+ public void setUserPhone(String userPhone)
+ {
+ this.userPhone = userPhone;
+ }
+
+ public String getUserEmail()
+ {
+ return userEmail;
+ }
+
+ public void setUserEmail(String userEmail)
+ {
+ this.userEmail = userEmail;
+ }
+
+ public double getUserBalance()
+ {
+ return userBalance;
+ }
+
+ public void setUserBalance(double userBalance)
+ {
+ this.userBalance = userBalance;
+ }
+
+ public String getStatus()
+ {
+ return status;
+ }
+
+ public void setStatus(String status)
+ {
+ this.status = status;
+ }
+
+ public Date getCreateTime()
+ {
+ return createTime;
+ }
+
+ public void setCreateTime(Date createTime)
+ {
+ this.createTime = createTime;
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/CustomerModel.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/CustomerModel.java
index d1aebf2ba..5e7d6e55d 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/CustomerModel.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/CustomerModel.java
@@ -1,116 +1,116 @@
-package com.ruoyi.web.controller.demo.domain;
-
-import java.util.List;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-
-/**
- * 客户测试信息
- *
- * @author ruoyi
- */
-public class CustomerModel
-{
- /**
- * 客户姓名
- */
- private String name;
-
- /**
- * 客户手机
- */
- private String phonenumber;
-
- /**
- * 客户性别
- */
- private String sex;
-
- /**
- * 客户生日
- */
- private String birthday;
-
- /**
- * 客户描述
- */
- private String remark;
-
- /**
- * 商品信息
- */
- private List goods;
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public String getPhonenumber()
- {
- return phonenumber;
- }
-
- public void setPhonenumber(String phonenumber)
- {
- this.phonenumber = phonenumber;
- }
-
-
- public String getSex()
- {
- return sex;
- }
-
- public void setSex(String sex)
- {
- this.sex = sex;
- }
-
- public String getBirthday()
- {
- return birthday;
- }
-
- public void setBirthday(String birthday)
- {
- this.birthday = birthday;
- }
-
- public String getRemark()
- {
- return remark;
- }
-
- public void setRemark(String remark)
- {
- this.remark = remark;
- }
-
- public List getGoods()
- {
- return goods;
- }
-
- public void setGoods(List goods)
- {
- this.goods = goods;
- }
-
- @Override
- public String toString() {
- return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
- .append("name", getName())
- .append("phonenumber", getPhonenumber())
- .append("sex", getSex())
- .append("birthday", getBirthday())
- .append("goods", getGoods())
- .append("remark", getRemark())
- .toString();
- }
-}
+package com.ruoyi.web.controller.demo.domain;
+
+import java.util.List;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 客户测试信息
+ *
+ * @author ruoyi
+ */
+public class CustomerModel
+{
+ /**
+ * 客户姓名
+ */
+ private String name;
+
+ /**
+ * 客户手机
+ */
+ private String phonenumber;
+
+ /**
+ * 客户性别
+ */
+ private String sex;
+
+ /**
+ * 客户生日
+ */
+ private String birthday;
+
+ /**
+ * 客户描述
+ */
+ private String remark;
+
+ /**
+ * 商品信息
+ */
+ private List goods;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getPhonenumber()
+ {
+ return phonenumber;
+ }
+
+ public void setPhonenumber(String phonenumber)
+ {
+ this.phonenumber = phonenumber;
+ }
+
+
+ public String getSex()
+ {
+ return sex;
+ }
+
+ public void setSex(String sex)
+ {
+ this.sex = sex;
+ }
+
+ public String getBirthday()
+ {
+ return birthday;
+ }
+
+ public void setBirthday(String birthday)
+ {
+ this.birthday = birthday;
+ }
+
+ public String getRemark()
+ {
+ return remark;
+ }
+
+ public void setRemark(String remark)
+ {
+ this.remark = remark;
+ }
+
+ public List getGoods()
+ {
+ return goods;
+ }
+
+ public void setGoods(List goods)
+ {
+ this.goods = goods;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("name", getName())
+ .append("phonenumber", getPhonenumber())
+ .append("sex", getSex())
+ .append("birthday", getBirthday())
+ .append("goods", getGoods())
+ .append("remark", getRemark())
+ .toString();
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/GoodsModel.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/GoodsModel.java
index 5cf7d3734..2b7e604df 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/GoodsModel.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/GoodsModel.java
@@ -1,82 +1,82 @@
-package com.ruoyi.web.controller.demo.domain;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-
-/**
- * 商品测试信息
- *
- * @author ruoyi
- */
-public class GoodsModel
-{
- /**
- * 商品名称
- */
- private String name;
-
- /**
- * 商品重量
- */
- private Integer weight;
-
- /**
- * 商品价格
- */
- private Double price;
-
- /**
- * 商品种类
- */
- private String type;
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public Integer getWeight()
- {
- return weight;
- }
-
- public void setWeight(Integer weight)
- {
- this.weight = weight;
- }
-
- public Double getPrice()
- {
- return price;
- }
-
- public void setPrice(Double price)
- {
- this.price = price;
- }
-
- public String getType()
- {
- return type;
- }
-
- public void setType(String type)
- {
- this.type = type;
- }
-
- @Override
- public String toString() {
- return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
- .append("name", getName())
- .append("weight", getWeight())
- .append("price", getPrice())
- .append("type", getType())
- .toString();
- }
-}
+package com.ruoyi.web.controller.demo.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 商品测试信息
+ *
+ * @author ruoyi
+ */
+public class GoodsModel
+{
+ /**
+ * 商品名称
+ */
+ private String name;
+
+ /**
+ * 商品重量
+ */
+ private Integer weight;
+
+ /**
+ * 商品价格
+ */
+ private Double price;
+
+ /**
+ * 商品种类
+ */
+ private String type;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public Integer getWeight()
+ {
+ return weight;
+ }
+
+ public void setWeight(Integer weight)
+ {
+ this.weight = weight;
+ }
+
+ public Double getPrice()
+ {
+ return price;
+ }
+
+ public void setPrice(Double price)
+ {
+ this.price = price;
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("name", getName())
+ .append("weight", getWeight())
+ .append("price", getPrice())
+ .append("type", getType())
+ .toString();
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/UserOperateModel.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/UserOperateModel.java
index 3324cc7ca..8b158aa10 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/UserOperateModel.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/UserOperateModel.java
@@ -1,149 +1,149 @@
-package com.ruoyi.web.controller.demo.domain;
-
-import java.util.Date;
-import com.ruoyi.common.annotation.Excel;
-import com.ruoyi.common.annotation.Excel.Type;
-import com.ruoyi.common.core.domain.BaseEntity;
-import com.ruoyi.common.utils.DateUtils;
-
-public class UserOperateModel extends BaseEntity
-{
- private static final long serialVersionUID = 1L;
-
- private int userId;
-
- @Excel(name = "用户编号")
- private String userCode;
-
- @Excel(name = "用户姓名")
- private String userName;
-
- @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
- private String userSex;
-
- @Excel(name = "用户手机")
- private String userPhone;
-
- @Excel(name = "用户邮箱")
- private String userEmail;
-
- @Excel(name = "用户余额")
- private double userBalance;
-
- @Excel(name = "用户状态", readConverterExp = "0=正常,1=停用")
- private String status;
-
- @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
- private Date createTime;
-
- public UserOperateModel()
- {
-
- }
-
- public UserOperateModel(int userId, String userCode, String userName, String userSex, String userPhone,
- String userEmail, double userBalance, String status)
- {
- this.userId = userId;
- this.userCode = userCode;
- this.userName = userName;
- this.userSex = userSex;
- this.userPhone = userPhone;
- this.userEmail = userEmail;
- this.userBalance = userBalance;
- this.status = status;
- this.createTime = DateUtils.getNowDate();
- }
-
- public int getUserId()
- {
- return userId;
- }
-
- public void setUserId(int userId)
- {
- this.userId = userId;
- }
-
- public String getUserCode()
- {
- return userCode;
- }
-
- public void setUserCode(String userCode)
- {
- this.userCode = userCode;
- }
-
- public String getUserName()
- {
- return userName;
- }
-
- public void setUserName(String userName)
- {
- this.userName = userName;
- }
-
- public String getUserSex()
- {
- return userSex;
- }
-
- public void setUserSex(String userSex)
- {
- this.userSex = userSex;
- }
-
- public String getUserPhone()
- {
- return userPhone;
- }
-
- public void setUserPhone(String userPhone)
- {
- this.userPhone = userPhone;
- }
-
- public String getUserEmail()
- {
- return userEmail;
- }
-
- public void setUserEmail(String userEmail)
- {
- this.userEmail = userEmail;
- }
-
- public double getUserBalance()
- {
- return userBalance;
- }
-
- public void setUserBalance(double userBalance)
- {
- this.userBalance = userBalance;
- }
-
- public String getStatus()
- {
- return status;
- }
-
- public void setStatus(String status)
- {
- this.status = status;
- }
-
- @Override
- public Date getCreateTime()
- {
- return createTime;
- }
-
- @Override
- public void setCreateTime(Date createTime)
- {
- this.createTime = createTime;
- }
+package com.ruoyi.web.controller.demo.domain;
+
+import java.util.Date;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.annotation.Excel.Type;
+import com.ruoyi.common.core.domain.BaseEntity;
+import com.ruoyi.common.utils.DateUtils;
+
+public class UserOperateModel extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ private int userId;
+
+ @Excel(name = "用户编号")
+ private String userCode;
+
+ @Excel(name = "用户姓名")
+ private String userName;
+
+ @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
+ private String userSex;
+
+ @Excel(name = "用户手机")
+ private String userPhone;
+
+ @Excel(name = "用户邮箱")
+ private String userEmail;
+
+ @Excel(name = "用户余额")
+ private double userBalance;
+
+ @Excel(name = "用户状态", readConverterExp = "0=正常,1=停用")
+ private String status;
+
+ @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
+ private Date createTime;
+
+ public UserOperateModel()
+ {
+
+ }
+
+ public UserOperateModel(int userId, String userCode, String userName, String userSex, String userPhone,
+ String userEmail, double userBalance, String status)
+ {
+ this.userId = userId;
+ this.userCode = userCode;
+ this.userName = userName;
+ this.userSex = userSex;
+ this.userPhone = userPhone;
+ this.userEmail = userEmail;
+ this.userBalance = userBalance;
+ this.status = status;
+ this.createTime = DateUtils.getNowDate();
+ }
+
+ public int getUserId()
+ {
+ return userId;
+ }
+
+ public void setUserId(int userId)
+ {
+ this.userId = userId;
+ }
+
+ public String getUserCode()
+ {
+ return userCode;
+ }
+
+ public void setUserCode(String userCode)
+ {
+ this.userCode = userCode;
+ }
+
+ public String getUserName()
+ {
+ return userName;
+ }
+
+ public void setUserName(String userName)
+ {
+ this.userName = userName;
+ }
+
+ public String getUserSex()
+ {
+ return userSex;
+ }
+
+ public void setUserSex(String userSex)
+ {
+ this.userSex = userSex;
+ }
+
+ public String getUserPhone()
+ {
+ return userPhone;
+ }
+
+ public void setUserPhone(String userPhone)
+ {
+ this.userPhone = userPhone;
+ }
+
+ public String getUserEmail()
+ {
+ return userEmail;
+ }
+
+ public void setUserEmail(String userEmail)
+ {
+ this.userEmail = userEmail;
+ }
+
+ public double getUserBalance()
+ {
+ return userBalance;
+ }
+
+ public void setUserBalance(double userBalance)
+ {
+ this.userBalance = userBalance;
+ }
+
+ public String getStatus()
+ {
+ return status;
+ }
+
+ public void setStatus(String status)
+ {
+ this.status = status;
+ }
+
+ @Override
+ public Date getCreateTime()
+ {
+ return createTime;
+ }
+
+ @Override
+ public void setCreateTime(Date createTime)
+ {
+ this.createTime = createTime;
+ }
}
\ No newline at end of file
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/DruidController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/DruidController.java
index b2647893c..336bf8f10 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/DruidController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/DruidController.java
@@ -1,26 +1,26 @@
-package com.ruoyi.web.controller.monitor;
-
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import com.ruoyi.common.core.controller.BaseController;
-
-/**
- * druid 监控
- *
- * @author ruoyi
- */
-@Controller
-@RequestMapping("/monitor/data")
-public class DruidController extends BaseController
-{
- private String prefix = "/druid";
-
- @RequiresPermissions("monitor:data:view")
- @GetMapping()
- public String index()
- {
- return redirect(prefix + "/index");
- }
-}
+package com.ruoyi.web.controller.monitor;
+
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import com.ruoyi.common.core.controller.BaseController;
+
+/**
+ * druid 监控
+ *
+ * @author ruoyi
+ */
+@Controller
+@RequestMapping("/monitor/data")
+public class DruidController extends BaseController
+{
+ private String prefix = "/druid";
+
+ @RequiresPermissions("monitor:data:view")
+ @GetMapping()
+ public String index()
+ {
+ return redirect(prefix + "/index");
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java
index 764197d39..386b5c7da 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java
@@ -1,31 +1,31 @@
-package com.ruoyi.web.controller.monitor;
-
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.ModelMap;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import com.ruoyi.common.core.controller.BaseController;
-import com.ruoyi.framework.web.domain.Server;
-
-/**
- * 服务器监控
- *
- * @author ruoyi
- */
-@Controller
-@RequestMapping("/monitor/server")
-public class ServerController extends BaseController
-{
- private String prefix = "monitor/server";
-
- @RequiresPermissions("monitor:server:view")
- @GetMapping()
- public String server(ModelMap mmap) throws Exception
- {
- Server server = new Server();
- server.copyTo();
- mmap.put("server", server);
- return prefix + "/server";
- }
-}
+package com.ruoyi.web.controller.monitor;
+
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.framework.web.domain.Server;
+
+/**
+ * 服务器监控
+ *
+ * @author ruoyi
+ */
+@Controller
+@RequestMapping("/monitor/server")
+public class ServerController extends BaseController
+{
+ private String prefix = "monitor/server";
+
+ @RequiresPermissions("monitor:server:view")
+ @GetMapping()
+ public String server(ModelMap mmap) throws Exception
+ {
+ Server server = new Server();
+ server.copyTo();
+ mmap.put("server", server);
+ return prefix + "/server";
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java
index 688c088b2..db0da7af1 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java
@@ -1,94 +1,94 @@
-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.core.controller.BaseController;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.core.page.TableDataInfo;
-import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.system.domain.SysLogininfor;
-import com.ruoyi.system.service.ISysLogininforService;
-
-/**
- * 系统访问记录
- *
- * @author ruoyi
- */
-@Controller
-@RequestMapping("/monitor/logininfor")
-public class SysLogininforController extends BaseController
-{
- private String prefix = "monitor/logininfor";
-
- @Autowired
- private ISysLogininforService logininforService;
-
- @Autowired
- private SysPasswordService passwordService;
-
- @RequiresPermissions("monitor:logininfor:view")
- @GetMapping()
- public String logininfor()
- {
- return prefix + "/logininfor";
- }
-
- @RequiresPermissions("monitor:logininfor:list")
- @PostMapping("/list")
- @ResponseBody
- public TableDataInfo list(SysLogininfor logininfor)
- {
- startPage();
- List list = logininforService.selectLogininforList(logininfor);
- return getDataTable(list);
- }
-
- @Log(title = "登陆日志", businessType = BusinessType.EXPORT)
- @RequiresPermissions("monitor:logininfor:export")
- @PostMapping("/export")
- @ResponseBody
- public AjaxResult export(SysLogininfor logininfor)
- {
- List list = logininforService.selectLogininforList(logininfor);
- ExcelUtil util = new ExcelUtil(SysLogininfor.class);
- return util.exportExcel(list, "登陆日志");
- }
-
- @RequiresPermissions("monitor:logininfor:remove")
- @Log(title = "登陆日志", businessType = BusinessType.DELETE)
- @PostMapping("/remove")
- @ResponseBody
- public AjaxResult remove(String ids)
- {
- return toAjax(logininforService.deleteLogininforByIds(ids));
- }
-
- @RequiresPermissions("monitor:logininfor:remove")
- @Log(title = "登陆日志", businessType = BusinessType.CLEAN)
- @PostMapping("/clean")
- @ResponseBody
- public AjaxResult clean()
- {
- logininforService.cleanLogininfor();
- return success();
- }
-
- @RequiresPermissions("monitor:logininfor:unlock")
- @Log(title = "账户解锁", businessType = BusinessType.OTHER)
- @PostMapping("/unlock")
- @ResponseBody
- public AjaxResult unlock(String loginName)
- {
- passwordService.unlock(loginName);
- return success();
- }
-}
+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.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.system.domain.SysLogininfor;
+import com.ruoyi.system.service.ISysLogininforService;
+
+/**
+ * 系统访问记录
+ *
+ * @author ruoyi
+ */
+@Controller
+@RequestMapping("/monitor/logininfor")
+public class SysLogininforController extends BaseController
+{
+ private String prefix = "monitor/logininfor";
+
+ @Autowired
+ private ISysLogininforService logininforService;
+
+ @Autowired
+ private SysPasswordService passwordService;
+
+ @RequiresPermissions("monitor:logininfor:view")
+ @GetMapping()
+ public String logininfor()
+ {
+ return prefix + "/logininfor";
+ }
+
+ @RequiresPermissions("monitor:logininfor:list")
+ @PostMapping("/list")
+ @ResponseBody
+ public TableDataInfo list(SysLogininfor logininfor)
+ {
+ startPage();
+ List list = logininforService.selectLogininforList(logininfor);
+ return getDataTable(list);
+ }
+
+ @Log(title = "登陆日志", businessType = BusinessType.EXPORT)
+ @RequiresPermissions("monitor:logininfor:export")
+ @PostMapping("/export")
+ @ResponseBody
+ public AjaxResult export(SysLogininfor logininfor)
+ {
+ List list = logininforService.selectLogininforList(logininfor);
+ ExcelUtil util = new ExcelUtil(SysLogininfor.class);
+ return util.exportExcel(list, "登陆日志");
+ }
+
+ @RequiresPermissions("monitor:logininfor:remove")
+ @Log(title = "登陆日志", businessType = BusinessType.DELETE)
+ @PostMapping("/remove")
+ @ResponseBody
+ public AjaxResult remove(String ids)
+ {
+ return toAjax(logininforService.deleteLogininforByIds(ids));
+ }
+
+ @RequiresPermissions("monitor:logininfor:remove")
+ @Log(title = "登陆日志", businessType = BusinessType.CLEAN)
+ @PostMapping("/clean")
+ @ResponseBody
+ public AjaxResult clean()
+ {
+ logininforService.cleanLogininfor();
+ return success();
+ }
+
+ @RequiresPermissions("monitor:logininfor:unlock")
+ @Log(title = "账户解锁", businessType = BusinessType.OTHER)
+ @PostMapping("/unlock")
+ @ResponseBody
+ public AjaxResult unlock(String loginName)
+ {
+ passwordService.unlock(loginName);
+ return success();
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java
index 468866e18..bde7c26a4 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java
@@ -1,89 +1,89 @@
-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.core.controller.BaseController;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.core.page.TableDataInfo;
-import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.system.domain.SysOperLog;
-import com.ruoyi.system.service.ISysOperLogService;
-
-/**
- * 操作日志记录
- *
- * @author ruoyi
- */
-@Controller
-@RequestMapping("/monitor/operlog")
-public class SysOperlogController extends BaseController
-{
- private String prefix = "monitor/operlog";
-
- @Autowired
- private ISysOperLogService operLogService;
-
- @RequiresPermissions("monitor:operlog:view")
- @GetMapping()
- public String operlog()
- {
- return prefix + "/operlog";
- }
-
- @RequiresPermissions("monitor:operlog:list")
- @PostMapping("/list")
- @ResponseBody
- public TableDataInfo list(SysOperLog operLog)
- {
- startPage();
- List list = operLogService.selectOperLogList(operLog);
- return getDataTable(list);
- }
-
- @Log(title = "操作日志", businessType = BusinessType.EXPORT)
- @RequiresPermissions("monitor:operlog:export")
- @PostMapping("/export")
- @ResponseBody
- public AjaxResult export(SysOperLog operLog)
- {
- List list = operLogService.selectOperLogList(operLog);
- ExcelUtil util = new ExcelUtil(SysOperLog.class);
- return util.exportExcel(list, "操作日志");
- }
-
- @RequiresPermissions("monitor:operlog:remove")
- @PostMapping("/remove")
- @ResponseBody
- public AjaxResult remove(String ids)
- {
- return toAjax(operLogService.deleteOperLogByIds(ids));
- }
-
- @RequiresPermissions("monitor:operlog:detail")
- @GetMapping("/detail/{operId}")
- public String detail(@PathVariable("operId") Long operId, ModelMap mmap)
- {
- mmap.put("operLog", operLogService.selectOperLogById(operId));
- return prefix + "/detail";
- }
-
- @Log(title = "操作日志", businessType = BusinessType.CLEAN)
- @RequiresPermissions("monitor:operlog:remove")
- @PostMapping("/clean")
- @ResponseBody
- public AjaxResult clean()
- {
- operLogService.cleanOperLog();
- return success();
- }
-}
+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.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.system.domain.SysOperLog;
+import com.ruoyi.system.service.ISysOperLogService;
+
+/**
+ * 操作日志记录
+ *
+ * @author ruoyi
+ */
+@Controller
+@RequestMapping("/monitor/operlog")
+public class SysOperlogController extends BaseController
+{
+ private String prefix = "monitor/operlog";
+
+ @Autowired
+ private ISysOperLogService operLogService;
+
+ @RequiresPermissions("monitor:operlog:view")
+ @GetMapping()
+ public String operlog()
+ {
+ return prefix + "/operlog";
+ }
+
+ @RequiresPermissions("monitor:operlog:list")
+ @PostMapping("/list")
+ @ResponseBody
+ public TableDataInfo list(SysOperLog operLog)
+ {
+ startPage();
+ List list = operLogService.selectOperLogList(operLog);
+ return getDataTable(list);
+ }
+
+ @Log(title = "操作日志", businessType = BusinessType.EXPORT)
+ @RequiresPermissions("monitor:operlog:export")
+ @PostMapping("/export")
+ @ResponseBody
+ public AjaxResult export(SysOperLog operLog)
+ {
+ List list = operLogService.selectOperLogList(operLog);
+ ExcelUtil util = new ExcelUtil(SysOperLog.class);
+ return util.exportExcel(list, "操作日志");
+ }
+
+ @RequiresPermissions("monitor:operlog:remove")
+ @PostMapping("/remove")
+ @ResponseBody
+ public AjaxResult remove(String ids)
+ {
+ return toAjax(operLogService.deleteOperLogByIds(ids));
+ }
+
+ @RequiresPermissions("monitor:operlog:detail")
+ @GetMapping("/detail/{operId}")
+ public String detail(@PathVariable("operId") Long operId, ModelMap mmap)
+ {
+ mmap.put("operLog", operLogService.selectOperLogById(operId));
+ return prefix + "/detail";
+ }
+
+ @Log(title = "操作日志", businessType = BusinessType.CLEAN)
+ @RequiresPermissions("monitor:operlog:remove")
+ @PostMapping("/clean")
+ @ResponseBody
+ public AjaxResult clean()
+ {
+ operLogService.cleanOperLog();
+ return success();
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java
index 1c36b111b..c7c4fb181 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java
@@ -1,88 +1,88 @@
-package com.ruoyi.web.controller.monitor;
-
-import java.util.List;
-import org.apache.shiro.authz.annotation.Logical;
-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.core.controller.BaseController;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.core.page.TableDataInfo;
-import com.ruoyi.common.core.text.Convert;
-import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.common.enums.OnlineStatus;
-import com.ruoyi.framework.shiro.session.OnlineSession;
-import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
-import com.ruoyi.framework.util.ShiroUtils;
-import com.ruoyi.system.domain.SysUserOnline;
-import com.ruoyi.system.service.ISysUserOnlineService;
-
-/**
- * 在线用户监控
- *
- * @author ruoyi
- */
-@Controller
-@RequestMapping("/monitor/online")
-public class SysUserOnlineController extends BaseController
-{
- private String prefix = "monitor/online";
-
- @Autowired
- private ISysUserOnlineService userOnlineService;
-
- @Autowired
- private OnlineSessionDAO onlineSessionDAO;
-
- @RequiresPermissions("monitor:online:view")
- @GetMapping()
- public String online()
- {
- return prefix + "/online";
- }
-
- @RequiresPermissions("monitor:online:list")
- @PostMapping("/list")
- @ResponseBody
- public TableDataInfo list(SysUserOnline userOnline)
- {
- startPage();
- List list = userOnlineService.selectUserOnlineList(userOnline);
- return getDataTable(list);
- }
-
- @RequiresPermissions(value = { "monitor:online:batchForceLogout", "monitor:online:forceLogout" }, logical = Logical.OR)
- @Log(title = "在线用户", businessType = BusinessType.FORCE)
- @PostMapping("/batchForceLogout")
- @ResponseBody
- public AjaxResult batchForceLogout(String ids)
- {
- for (String sessionId : Convert.toStrArray(ids))
- {
- SysUserOnline online = userOnlineService.selectOnlineById(sessionId);
- if (online == null)
- {
- return error("用户已下线");
- }
- OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId());
- if (onlineSession == null)
- {
- return error("用户已下线");
- }
- if (sessionId.equals(ShiroUtils.getSessionId()))
- {
- return error("当前登陆用户无法强退");
- }
- onlineSession.setStatus(OnlineStatus.off_line);
- onlineSessionDAO.update(onlineSession);
- online.setStatus(OnlineStatus.off_line);
- userOnlineService.saveOnline(online);
- }
- return success();
- }
-}
+package com.ruoyi.web.controller.monitor;
+
+import java.util.List;
+import org.apache.shiro.authz.annotation.Logical;
+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.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.core.text.Convert;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.enums.OnlineStatus;
+import com.ruoyi.framework.shiro.session.OnlineSession;
+import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
+import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.system.domain.SysUserOnline;
+import com.ruoyi.system.service.ISysUserOnlineService;
+
+/**
+ * 在线用户监控
+ *
+ * @author ruoyi
+ */
+@Controller
+@RequestMapping("/monitor/online")
+public class SysUserOnlineController extends BaseController
+{
+ private String prefix = "monitor/online";
+
+ @Autowired
+ private ISysUserOnlineService userOnlineService;
+
+ @Autowired
+ private OnlineSessionDAO onlineSessionDAO;
+
+ @RequiresPermissions("monitor:online:view")
+ @GetMapping()
+ public String online()
+ {
+ return prefix + "/online";
+ }
+
+ @RequiresPermissions("monitor:online:list")
+ @PostMapping("/list")
+ @ResponseBody
+ public TableDataInfo list(SysUserOnline userOnline)
+ {
+ startPage();
+ List list = userOnlineService.selectUserOnlineList(userOnline);
+ return getDataTable(list);
+ }
+
+ @RequiresPermissions(value = { "monitor:online:batchForceLogout", "monitor:online:forceLogout" }, logical = Logical.OR)
+ @Log(title = "在线用户", businessType = BusinessType.FORCE)
+ @PostMapping("/batchForceLogout")
+ @ResponseBody
+ public AjaxResult batchForceLogout(String ids)
+ {
+ for (String sessionId : Convert.toStrArray(ids))
+ {
+ SysUserOnline online = userOnlineService.selectOnlineById(sessionId);
+ if (online == null)
+ {
+ return error("用户已下线");
+ }
+ OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId());
+ if (onlineSession == null)
+ {
+ return error("用户已下线");
+ }
+ if (sessionId.equals(ShiroUtils.getSessionId()))
+ {
+ return error("当前登陆用户无法强退");
+ }
+ onlineSession.setStatus(OnlineStatus.off_line);
+ onlineSessionDAO.update(onlineSession);
+ online.setStatus(OnlineStatus.off_line);
+ userOnlineService.saveOnline(online);
+ }
+ return success();
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysCaptchaController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysCaptchaController.java
index 230cc3b29..739c46934 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysCaptchaController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysCaptchaController.java
@@ -1,92 +1,92 @@
-package com.ruoyi.web.controller.system;
-
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-import javax.annotation.Resource;
-import javax.imageio.ImageIO;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.servlet.ModelAndView;
-import com.google.code.kaptcha.Constants;
-import com.google.code.kaptcha.Producer;
-import com.ruoyi.common.core.controller.BaseController;
-
-/**
- * 图片验证码(支持算术形式)
- *
- * @author ruoyi
- */
-@Controller
-@RequestMapping("/captcha")
-public class SysCaptchaController extends BaseController
-{
- @Resource(name = "captchaProducer")
- private Producer captchaProducer;
-
- @Resource(name = "captchaProducerMath")
- private Producer captchaProducerMath;
-
- /**
- * 验证码生成
- */
- @GetMapping(value = "/captchaImage")
- public ModelAndView getKaptchaImage(HttpServletRequest request, HttpServletResponse response)
- {
- ServletOutputStream out = null;
- try
- {
- HttpSession session = request.getSession();
- response.setDateHeader("Expires", 0);
- response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
- response.addHeader("Cache-Control", "post-check=0, pre-check=0");
- response.setHeader("Pragma", "no-cache");
- response.setContentType("image/jpeg");
-
- String type = request.getParameter("type");
- String capStr = null;
- String code = null;
- BufferedImage bi = null;
- if ("math".equals(type))
- {
- String capText = captchaProducerMath.createText();
- capStr = capText.substring(0, capText.lastIndexOf("@"));
- code = capText.substring(capText.lastIndexOf("@") + 1);
- bi = captchaProducerMath.createImage(capStr);
- }
- else if ("char".equals(type))
- {
- capStr = code = captchaProducer.createText();
- bi = captchaProducer.createImage(capStr);
- }
- session.setAttribute(Constants.KAPTCHA_SESSION_KEY, code);
- out = response.getOutputStream();
- ImageIO.write(bi, "jpg", out);
- out.flush();
-
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- finally
- {
- try
- {
- if (out != null)
- {
- out.close();
- }
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- }
- return null;
- }
+package com.ruoyi.web.controller.system;
+
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import javax.annotation.Resource;
+import javax.imageio.ImageIO;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.servlet.ModelAndView;
+import com.google.code.kaptcha.Constants;
+import com.google.code.kaptcha.Producer;
+import com.ruoyi.common.core.controller.BaseController;
+
+/**
+ * 图片验证码(支持算术形式)
+ *
+ * @author ruoyi
+ */
+@Controller
+@RequestMapping("/captcha")
+public class SysCaptchaController extends BaseController
+{
+ @Resource(name = "captchaProducer")
+ private Producer captchaProducer;
+
+ @Resource(name = "captchaProducerMath")
+ private Producer captchaProducerMath;
+
+ /**
+ * 验证码生成
+ */
+ @GetMapping(value = "/captchaImage")
+ public ModelAndView getKaptchaImage(HttpServletRequest request, HttpServletResponse response)
+ {
+ ServletOutputStream out = null;
+ try
+ {
+ HttpSession session = request.getSession();
+ response.setDateHeader("Expires", 0);
+ response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
+ response.addHeader("Cache-Control", "post-check=0, pre-check=0");
+ response.setHeader("Pragma", "no-cache");
+ response.setContentType("image/jpeg");
+
+ String type = request.getParameter("type");
+ String capStr = null;
+ String code = null;
+ BufferedImage bi = null;
+ if ("math".equals(type))
+ {
+ String capText = captchaProducerMath.createText();
+ capStr = capText.substring(0, capText.lastIndexOf("@"));
+ code = capText.substring(capText.lastIndexOf("@") + 1);
+ bi = captchaProducerMath.createImage(capStr);
+ }
+ else if ("char".equals(type))
+ {
+ capStr = code = captchaProducer.createText();
+ bi = captchaProducer.createImage(capStr);
+ }
+ session.setAttribute(Constants.KAPTCHA_SESSION_KEY, code);
+ out = response.getOutputStream();
+ ImageIO.write(bi, "jpg", out);
+ out.flush();
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ try
+ {
+ if (out != null)
+ {
+ out.close();
+ }
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ return null;
+ }
}
\ No newline at end of file
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java
index 1937c795f..086b764bc 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java
@@ -1,157 +1,157 @@
-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.constant.UserConstants;
-import com.ruoyi.common.core.controller.BaseController;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.core.page.TableDataInfo;
-import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.util.ShiroUtils;
-import com.ruoyi.system.domain.SysConfig;
-import com.ruoyi.system.service.ISysConfigService;
-
-/**
- * 参数配置 信息操作处理
- *
- * @author ruoyi
- */
-@Controller
-@RequestMapping("/system/config")
-public class SysConfigController extends BaseController
-{
- private String prefix = "system/config";
-
- @Autowired
- private ISysConfigService configService;
-
- @RequiresPermissions("system:config:view")
- @GetMapping()
- public String config()
- {
- return prefix + "/config";
- }
-
- /**
- * 查询参数配置列表
- */
- @RequiresPermissions("system:config:list")
- @PostMapping("/list")
- @ResponseBody
- public TableDataInfo list(SysConfig config)
- {
- startPage();
- List list = configService.selectConfigList(config);
- return getDataTable(list);
- }
-
- @Log(title = "参数管理", businessType = BusinessType.EXPORT)
- @RequiresPermissions("system:config:export")
- @PostMapping("/export")
- @ResponseBody
- public AjaxResult export(SysConfig config)
- {
- List list = configService.selectConfigList(config);
- ExcelUtil util = new ExcelUtil(SysConfig.class);
- return util.exportExcel(list, "参数数据");
- }
-
- /**
- * 新增参数配置
- */
- @GetMapping("/add")
- public String add()
- {
- return prefix + "/add";
- }
-
- /**
- * 新增保存参数配置
- */
- @RequiresPermissions("system:config:add")
- @Log(title = "参数管理", businessType = BusinessType.INSERT)
- @PostMapping("/add")
- @ResponseBody
- public AjaxResult addSave(@Validated SysConfig config)
- {
- if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
- {
- return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
- }
- config.setCreateBy(ShiroUtils.getLoginName());
- return toAjax(configService.insertConfig(config));
- }
-
- /**
- * 修改参数配置
- */
- @GetMapping("/edit/{configId}")
- public String edit(@PathVariable("configId") Long configId, ModelMap mmap)
- {
- mmap.put("config", configService.selectConfigById(configId));
- return prefix + "/edit";
- }
-
- /**
- * 修改保存参数配置
- */
- @RequiresPermissions("system:config:edit")
- @Log(title = "参数管理", businessType = BusinessType.UPDATE)
- @PostMapping("/edit")
- @ResponseBody
- public AjaxResult editSave(@Validated SysConfig config)
- {
- if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
- {
- return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
- }
- config.setUpdateBy(ShiroUtils.getLoginName());
- return toAjax(configService.updateConfig(config));
- }
-
- /**
- * 删除参数配置
- */
- @RequiresPermissions("system:config:remove")
- @Log(title = "参数管理", businessType = BusinessType.DELETE)
- @PostMapping("/remove")
- @ResponseBody
- public AjaxResult remove(String ids)
- {
- return toAjax(configService.deleteConfigByIds(ids));
- }
-
- /**
- * 清空缓存
- */
- @RequiresPermissions("system:config:remove")
- @Log(title = "参数管理", businessType = BusinessType.CLEAN)
- @GetMapping("/clearCache")
- @ResponseBody
- public AjaxResult clearCache()
- {
- configService.clearCache();
- return success();
- }
-
- /**
- * 校验参数键名
- */
- @PostMapping("/checkConfigKeyUnique")
- @ResponseBody
- public String checkConfigKeyUnique(SysConfig config)
- {
- return configService.checkConfigKeyUnique(config);
- }
-}
+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.constant.UserConstants;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.system.domain.SysConfig;
+import com.ruoyi.system.service.ISysConfigService;
+
+/**
+ * 参数配置 信息操作处理
+ *
+ * @author ruoyi
+ */
+@Controller
+@RequestMapping("/system/config")
+public class SysConfigController extends BaseController
+{
+ private String prefix = "system/config";
+
+ @Autowired
+ private ISysConfigService configService;
+
+ @RequiresPermissions("system:config:view")
+ @GetMapping()
+ public String config()
+ {
+ return prefix + "/config";
+ }
+
+ /**
+ * 查询参数配置列表
+ */
+ @RequiresPermissions("system:config:list")
+ @PostMapping("/list")
+ @ResponseBody
+ public TableDataInfo list(SysConfig config)
+ {
+ startPage();
+ List list = configService.selectConfigList(config);
+ return getDataTable(list);
+ }
+
+ @Log(title = "参数管理", businessType = BusinessType.EXPORT)
+ @RequiresPermissions("system:config:export")
+ @PostMapping("/export")
+ @ResponseBody
+ public AjaxResult export(SysConfig config)
+ {
+ List list = configService.selectConfigList(config);
+ ExcelUtil util = new ExcelUtil(SysConfig.class);
+ return util.exportExcel(list, "参数数据");
+ }
+
+ /**
+ * 新增参数配置
+ */
+ @GetMapping("/add")
+ public String add()
+ {
+ return prefix + "/add";
+ }
+
+ /**
+ * 新增保存参数配置
+ */
+ @RequiresPermissions("system:config:add")
+ @Log(title = "参数管理", businessType = BusinessType.INSERT)
+ @PostMapping("/add")
+ @ResponseBody
+ public AjaxResult addSave(@Validated SysConfig config)
+ {
+ if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
+ {
+ return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
+ }
+ config.setCreateBy(ShiroUtils.getLoginName());
+ return toAjax(configService.insertConfig(config));
+ }
+
+ /**
+ * 修改参数配置
+ */
+ @GetMapping("/edit/{configId}")
+ public String edit(@PathVariable("configId") Long configId, ModelMap mmap)
+ {
+ mmap.put("config", configService.selectConfigById(configId));
+ return prefix + "/edit";
+ }
+
+ /**
+ * 修改保存参数配置
+ */
+ @RequiresPermissions("system:config:edit")
+ @Log(title = "参数管理", businessType = BusinessType.UPDATE)
+ @PostMapping("/edit")
+ @ResponseBody
+ public AjaxResult editSave(@Validated SysConfig config)
+ {
+ if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
+ {
+ return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
+ }
+ config.setUpdateBy(ShiroUtils.getLoginName());
+ return toAjax(configService.updateConfig(config));
+ }
+
+ /**
+ * 删除参数配置
+ */
+ @RequiresPermissions("system:config:remove")
+ @Log(title = "参数管理", businessType = BusinessType.DELETE)
+ @PostMapping("/remove")
+ @ResponseBody
+ public AjaxResult remove(String ids)
+ {
+ return toAjax(configService.deleteConfigByIds(ids));
+ }
+
+ /**
+ * 清空缓存
+ */
+ @RequiresPermissions("system:config:remove")
+ @Log(title = "参数管理", businessType = BusinessType.CLEAN)
+ @GetMapping("/clearCache")
+ @ResponseBody
+ public AjaxResult clearCache()
+ {
+ configService.clearCache();
+ return success();
+ }
+
+ /**
+ * 校验参数键名
+ */
+ @PostMapping("/checkConfigKeyUnique")
+ @ResponseBody
+ public String checkConfigKeyUnique(SysConfig config)
+ {
+ return configService.checkConfigKeyUnique(config);
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java
index 91cb80ec9..55362e6e6 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java
@@ -1,203 +1,203 @@
-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.constant.UserConstants;
-import com.ruoyi.common.core.controller.BaseController;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.core.domain.Ztree;
-import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.framework.util.ShiroUtils;
-import com.ruoyi.system.domain.SysDept;
-import com.ruoyi.system.domain.SysRole;
-import com.ruoyi.system.service.ISysDeptService;
-
-/**
- * 部门信息
- *
- * @author ruoyi
- */
-@Controller
-@RequestMapping("/system/dept")
-public class SysDeptController extends BaseController
-{
- private String prefix = "system/dept";
-
- @Autowired
- private ISysDeptService deptService;
-
- @RequiresPermissions("system:dept:view")
- @GetMapping()
- public String dept()
- {
- return prefix + "/dept";
- }
-
- @RequiresPermissions("system:dept:list")
- @PostMapping("/list")
- @ResponseBody
- public List list(SysDept dept)
- {
- List deptList = deptService.selectDeptList(dept);
- return deptList;
- }
-
- /**
- * 新增部门
- */
- @GetMapping("/add/{parentId}")
- public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
- {
- mmap.put("dept", deptService.selectDeptById(parentId));
- return prefix + "/add";
- }
-
- /**
- * 新增保存部门
- */
- @Log(title = "部门管理", businessType = BusinessType.INSERT)
- @RequiresPermissions("system:dept:add")
- @PostMapping("/add")
- @ResponseBody
- public AjaxResult addSave(@Validated SysDept dept)
- {
- if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
- {
- return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
- }
- dept.setCreateBy(ShiroUtils.getLoginName());
- return toAjax(deptService.insertDept(dept));
- }
-
- /**
- * 修改
- */
- @GetMapping("/edit/{deptId}")
- public String edit(@PathVariable("deptId") Long deptId, ModelMap mmap)
- {
- SysDept dept = deptService.selectDeptById(deptId);
- if (StringUtils.isNotNull(dept) && 100L == deptId)
- {
- dept.setParentName("无");
- }
- mmap.put("dept", dept);
- return prefix + "/edit";
- }
-
- /**
- * 保存
- */
- @Log(title = "部门管理", businessType = BusinessType.UPDATE)
- @RequiresPermissions("system:dept:edit")
- @PostMapping("/edit")
- @ResponseBody
- public AjaxResult editSave(@Validated SysDept dept)
- {
- if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
- {
- return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
- }
- else if (dept.getParentId().equals(dept.getDeptId()))
- {
- return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
- }
- else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
- && deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0)
- {
- return AjaxResult.error("该部门包含未停用的子部门!");
- }
- dept.setUpdateBy(ShiroUtils.getLoginName());
- return toAjax(deptService.updateDept(dept));
- }
-
- /**
- * 删除
- */
- @Log(title = "部门管理", businessType = BusinessType.DELETE)
- @RequiresPermissions("system:dept:remove")
- @GetMapping("/remove/{deptId}")
- @ResponseBody
- public AjaxResult remove(@PathVariable("deptId") Long deptId)
- {
- if (deptService.selectDeptCount(deptId) > 0)
- {
- return AjaxResult.warn("存在下级部门,不允许删除");
- }
- if (deptService.checkDeptExistUser(deptId))
- {
- return AjaxResult.warn("部门存在用户,不允许删除");
- }
- return toAjax(deptService.deleteDeptById(deptId));
- }
-
- /**
- * 校验部门名称
- */
- @PostMapping("/checkDeptNameUnique")
- @ResponseBody
- public String checkDeptNameUnique(SysDept dept)
- {
- return deptService.checkDeptNameUnique(dept);
- }
-
- /**
- * 选择部门树
- *
- * @param deptId 部门ID
- * @param excludeId 排除ID
- */
- @GetMapping(value = { "/selectDeptTree/{deptId}", "/selectDeptTree/{deptId}/{excludeId}" })
- public String selectDeptTree(@PathVariable("deptId") Long deptId,
- @PathVariable(value = "excludeId", required = false) String excludeId, ModelMap mmap)
- {
- mmap.put("dept", deptService.selectDeptById(deptId));
- mmap.put("excludeId", excludeId);
- return prefix + "/tree";
- }
-
- /**
- * 加载部门列表树
- */
- @GetMapping("/treeData")
- @ResponseBody
- public List treeData()
- {
- List ztrees = deptService.selectDeptTree(new SysDept());
- return ztrees;
- }
-
- /**
- * 加载部门列表树(排除下级)
- */
- @GetMapping("/treeData/{excludeId}")
- @ResponseBody
- public List treeDataExcludeChild(@PathVariable(value = "excludeId", required = false) Long excludeId)
- {
- SysDept dept = new SysDept();
- dept.setDeptId(excludeId);
- List ztrees = deptService.selectDeptTreeExcludeChild(dept);
- return ztrees;
- }
-
- /**
- * 加载角色部门(数据权限)列表树
- */
- @GetMapping("/roleDeptTreeData")
- @ResponseBody
- public List deptTreeData(SysRole role)
- {
- List ztrees = deptService.roleDeptTreeData(role);
- return ztrees;
- }
-}
+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.constant.UserConstants;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.Ztree;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.system.domain.SysDept;
+import com.ruoyi.system.domain.SysRole;
+import com.ruoyi.system.service.ISysDeptService;
+
+/**
+ * 部门信息
+ *
+ * @author ruoyi
+ */
+@Controller
+@RequestMapping("/system/dept")
+public class SysDeptController extends BaseController
+{
+ private String prefix = "system/dept";
+
+ @Autowired
+ private ISysDeptService deptService;
+
+ @RequiresPermissions("system:dept:view")
+ @GetMapping()
+ public String dept()
+ {
+ return prefix + "/dept";
+ }
+
+ @RequiresPermissions("system:dept:list")
+ @PostMapping("/list")
+ @ResponseBody
+ public List list(SysDept dept)
+ {
+ List deptList = deptService.selectDeptList(dept);
+ return deptList;
+ }
+
+ /**
+ * 新增部门
+ */
+ @GetMapping("/add/{parentId}")
+ public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
+ {
+ mmap.put("dept", deptService.selectDeptById(parentId));
+ return prefix + "/add";
+ }
+
+ /**
+ * 新增保存部门
+ */
+ @Log(title = "部门管理", businessType = BusinessType.INSERT)
+ @RequiresPermissions("system:dept:add")
+ @PostMapping("/add")
+ @ResponseBody
+ public AjaxResult addSave(@Validated SysDept dept)
+ {
+ if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
+ {
+ return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
+ }
+ dept.setCreateBy(ShiroUtils.getLoginName());
+ return toAjax(deptService.insertDept(dept));
+ }
+
+ /**
+ * 修改
+ */
+ @GetMapping("/edit/{deptId}")
+ public String edit(@PathVariable("deptId") Long deptId, ModelMap mmap)
+ {
+ SysDept dept = deptService.selectDeptById(deptId);
+ if (StringUtils.isNotNull(dept) && 100L == deptId)
+ {
+ dept.setParentName("无");
+ }
+ mmap.put("dept", dept);
+ return prefix + "/edit";
+ }
+
+ /**
+ * 保存
+ */
+ @Log(title = "部门管理", businessType = BusinessType.UPDATE)
+ @RequiresPermissions("system:dept:edit")
+ @PostMapping("/edit")
+ @ResponseBody
+ public AjaxResult editSave(@Validated SysDept dept)
+ {
+ if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
+ {
+ return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
+ }
+ else if (dept.getParentId().equals(dept.getDeptId()))
+ {
+ return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
+ }
+ else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
+ && deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0)
+ {
+ return AjaxResult.error("该部门包含未停用的子部门!");
+ }
+ dept.setUpdateBy(ShiroUtils.getLoginName());
+ return toAjax(deptService.updateDept(dept));
+ }
+
+ /**
+ * 删除
+ */
+ @Log(title = "部门管理", businessType = BusinessType.DELETE)
+ @RequiresPermissions("system:dept:remove")
+ @GetMapping("/remove/{deptId}")
+ @ResponseBody
+ public AjaxResult remove(@PathVariable("deptId") Long deptId)
+ {
+ if (deptService.selectDeptCount(deptId) > 0)
+ {
+ return AjaxResult.warn("存在下级部门,不允许删除");
+ }
+ if (deptService.checkDeptExistUser(deptId))
+ {
+ return AjaxResult.warn("部门存在用户,不允许删除");
+ }
+ return toAjax(deptService.deleteDeptById(deptId));
+ }
+
+ /**
+ * 校验部门名称
+ */
+ @PostMapping("/checkDeptNameUnique")
+ @ResponseBody
+ public String checkDeptNameUnique(SysDept dept)
+ {
+ return deptService.checkDeptNameUnique(dept);
+ }
+
+ /**
+ * 选择部门树
+ *
+ * @param deptId 部门ID
+ * @param excludeId 排除ID
+ */
+ @GetMapping(value = { "/selectDeptTree/{deptId}", "/selectDeptTree/{deptId}/{excludeId}" })
+ public String selectDeptTree(@PathVariable("deptId") Long deptId,
+ @PathVariable(value = "excludeId", required = false) String excludeId, ModelMap mmap)
+ {
+ mmap.put("dept", deptService.selectDeptById(deptId));
+ mmap.put("excludeId", excludeId);
+ return prefix + "/tree";
+ }
+
+ /**
+ * 加载部门列表树
+ */
+ @GetMapping("/treeData")
+ @ResponseBody
+ public List treeData()
+ {
+ List ztrees = deptService.selectDeptTree(new SysDept());
+ return ztrees;
+ }
+
+ /**
+ * 加载部门列表树(排除下级)
+ */
+ @GetMapping("/treeData/{excludeId}")
+ @ResponseBody
+ public List treeDataExcludeChild(@PathVariable(value = "excludeId", required = false) Long excludeId)
+ {
+ SysDept dept = new SysDept();
+ dept.setDeptId(excludeId);
+ List ztrees = deptService.selectDeptTreeExcludeChild(dept);
+ return ztrees;
+ }
+
+ /**
+ * 加载角色部门(数据权限)列表树
+ */
+ @GetMapping("/roleDeptTreeData")
+ @ResponseBody
+ public List deptTreeData(SysRole role)
+ {
+ List ztrees = deptService.roleDeptTreeData(role);
+ return ztrees;
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java
index 945109858..ae7aa9278 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java
@@ -1,120 +1,120 @@
-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.core.controller.BaseController;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.core.page.TableDataInfo;
-import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.util.ShiroUtils;
-import com.ruoyi.system.domain.SysDictData;
-import com.ruoyi.system.service.ISysDictDataService;
-
-/**
- * 数据字典信息
- *
- * @author ruoyi
- */
-@Controller
-@RequestMapping("/system/dict/data")
-public class SysDictDataController extends BaseController
-{
- private String prefix = "system/dict/data";
-
- @Autowired
- private ISysDictDataService dictDataService;
-
- @RequiresPermissions("system:dict:view")
- @GetMapping()
- public String dictData()
- {
- return prefix + "/data";
- }
-
- @PostMapping("/list")
- @RequiresPermissions("system:dict:list")
- @ResponseBody
- public TableDataInfo list(SysDictData dictData)
- {
- startPage();
- List list = dictDataService.selectDictDataList(dictData);
- return getDataTable(list);
- }
-
- @Log(title = "字典数据", businessType = BusinessType.EXPORT)
- @RequiresPermissions("system:dict:export")
- @PostMapping("/export")
- @ResponseBody
- public AjaxResult export(SysDictData dictData)
- {
- List list = dictDataService.selectDictDataList(dictData);
- ExcelUtil util = new ExcelUtil(SysDictData.class);
- return util.exportExcel(list, "字典数据");
- }
-
- /**
- * 新增字典类型
- */
- @GetMapping("/add/{dictType}")
- public String add(@PathVariable("dictType") String dictType, ModelMap mmap)
- {
- mmap.put("dictType", dictType);
- return prefix + "/add";
- }
-
- /**
- * 新增保存字典类型
- */
- @Log(title = "字典数据", businessType = BusinessType.INSERT)
- @RequiresPermissions("system:dict:add")
- @PostMapping("/add")
- @ResponseBody
- public AjaxResult addSave(@Validated SysDictData dict)
- {
- dict.setCreateBy(ShiroUtils.getLoginName());
- return toAjax(dictDataService.insertDictData(dict));
- }
-
- /**
- * 修改字典类型
- */
- @GetMapping("/edit/{dictCode}")
- public String edit(@PathVariable("dictCode") Long dictCode, ModelMap mmap)
- {
- mmap.put("dict", dictDataService.selectDictDataById(dictCode));
- return prefix + "/edit";
- }
-
- /**
- * 修改保存字典类型
- */
- @Log(title = "字典数据", businessType = BusinessType.UPDATE)
- @RequiresPermissions("system:dict:edit")
- @PostMapping("/edit")
- @ResponseBody
- public AjaxResult editSave(@Validated SysDictData dict)
- {
- dict.setUpdateBy(ShiroUtils.getLoginName());
- return toAjax(dictDataService.updateDictData(dict));
- }
-
- @Log(title = "字典数据", businessType = BusinessType.DELETE)
- @RequiresPermissions("system:dict:remove")
- @PostMapping("/remove")
- @ResponseBody
- public AjaxResult remove(String ids)
- {
- return toAjax(dictDataService.deleteDictDataByIds(ids));
- }
-}
+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.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.system.domain.SysDictData;
+import com.ruoyi.system.service.ISysDictDataService;
+
+/**
+ * 数据字典信息
+ *
+ * @author ruoyi
+ */
+@Controller
+@RequestMapping("/system/dict/data")
+public class SysDictDataController extends BaseController
+{
+ private String prefix = "system/dict/data";
+
+ @Autowired
+ private ISysDictDataService dictDataService;
+
+ @RequiresPermissions("system:dict:view")
+ @GetMapping()
+ public String dictData()
+ {
+ return prefix + "/data";
+ }
+
+ @PostMapping("/list")
+ @RequiresPermissions("system:dict:list")
+ @ResponseBody
+ public TableDataInfo list(SysDictData dictData)
+ {
+ startPage();
+ List list = dictDataService.selectDictDataList(dictData);
+ return getDataTable(list);
+ }
+
+ @Log(title = "字典数据", businessType = BusinessType.EXPORT)
+ @RequiresPermissions("system:dict:export")
+ @PostMapping("/export")
+ @ResponseBody
+ public AjaxResult export(SysDictData dictData)
+ {
+ List list = dictDataService.selectDictDataList(dictData);
+ ExcelUtil util = new ExcelUtil(SysDictData.class);
+ return util.exportExcel(list, "字典数据");
+ }
+
+ /**
+ * 新增字典类型
+ */
+ @GetMapping("/add/{dictType}")
+ public String add(@PathVariable("dictType") String dictType, ModelMap mmap)
+ {
+ mmap.put("dictType", dictType);
+ return prefix + "/add";
+ }
+
+ /**
+ * 新增保存字典类型
+ */
+ @Log(title = "字典数据", businessType = BusinessType.INSERT)
+ @RequiresPermissions("system:dict:add")
+ @PostMapping("/add")
+ @ResponseBody
+ public AjaxResult addSave(@Validated SysDictData dict)
+ {
+ dict.setCreateBy(ShiroUtils.getLoginName());
+ return toAjax(dictDataService.insertDictData(dict));
+ }
+
+ /**
+ * 修改字典类型
+ */
+ @GetMapping("/edit/{dictCode}")
+ public String edit(@PathVariable("dictCode") Long dictCode, ModelMap mmap)
+ {
+ mmap.put("dict", dictDataService.selectDictDataById(dictCode));
+ return prefix + "/edit";
+ }
+
+ /**
+ * 修改保存字典类型
+ */
+ @Log(title = "字典数据", businessType = BusinessType.UPDATE)
+ @RequiresPermissions("system:dict:edit")
+ @PostMapping("/edit")
+ @ResponseBody
+ public AjaxResult editSave(@Validated SysDictData dict)
+ {
+ dict.setUpdateBy(ShiroUtils.getLoginName());
+ return toAjax(dictDataService.updateDictData(dict));
+ }
+
+ @Log(title = "字典数据", businessType = BusinessType.DELETE)
+ @RequiresPermissions("system:dict:remove")
+ @PostMapping("/remove")
+ @ResponseBody
+ public AjaxResult remove(String ids)
+ {
+ return toAjax(dictDataService.deleteDictDataByIds(ids));
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java
index cde8ae798..4769dc74e 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java
@@ -1,188 +1,188 @@
-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.constant.UserConstants;
-import com.ruoyi.common.core.controller.BaseController;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.core.domain.Ztree;
-import com.ruoyi.common.core.page.TableDataInfo;
-import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.util.ShiroUtils;
-import com.ruoyi.system.domain.SysDictType;
-import com.ruoyi.system.service.ISysDictTypeService;
-
-/**
- * 数据字典信息
- *
- * @author ruoyi
- */
-@Controller
-@RequestMapping("/system/dict")
-public class SysDictTypeController extends BaseController
-{
- private String prefix = "system/dict/type";
-
- @Autowired
- private ISysDictTypeService dictTypeService;
-
- @RequiresPermissions("system:dict:view")
- @GetMapping()
- public String dictType()
- {
- return prefix + "/type";
- }
-
- @PostMapping("/list")
- @RequiresPermissions("system:dict:list")
- @ResponseBody
- public TableDataInfo list(SysDictType dictType)
- {
- startPage();
- List list = dictTypeService.selectDictTypeList(dictType);
- return getDataTable(list);
- }
-
- @Log(title = "字典类型", businessType = BusinessType.EXPORT)
- @RequiresPermissions("system:dict:export")
- @PostMapping("/export")
- @ResponseBody
- public AjaxResult export(SysDictType dictType)
- {
-
- List list = dictTypeService.selectDictTypeList(dictType);
- ExcelUtil util = new ExcelUtil(SysDictType.class);
- return util.exportExcel(list, "字典类型");
- }
-
- /**
- * 新增字典类型
- */
- @GetMapping("/add")
- public String add()
- {
- return prefix + "/add";
- }
-
- /**
- * 新增保存字典类型
- */
- @Log(title = "字典类型", businessType = BusinessType.INSERT)
- @RequiresPermissions("system:dict:add")
- @PostMapping("/add")
- @ResponseBody
- public AjaxResult addSave(@Validated SysDictType dict)
- {
- if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
- {
- return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
- }
- dict.setCreateBy(ShiroUtils.getLoginName());
- return toAjax(dictTypeService.insertDictType(dict));
- }
-
- /**
- * 修改字典类型
- */
- @GetMapping("/edit/{dictId}")
- public String edit(@PathVariable("dictId") Long dictId, ModelMap mmap)
- {
- mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
- return prefix + "/edit";
- }
-
- /**
- * 修改保存字典类型
- */
- @Log(title = "字典类型", businessType = BusinessType.UPDATE)
- @RequiresPermissions("system:dict:edit")
- @PostMapping("/edit")
- @ResponseBody
- public AjaxResult editSave(@Validated SysDictType dict)
- {
- if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
- {
- return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
- }
- dict.setUpdateBy(ShiroUtils.getLoginName());
- return toAjax(dictTypeService.updateDictType(dict));
- }
-
- @Log(title = "字典类型", businessType = BusinessType.DELETE)
- @RequiresPermissions("system:dict:remove")
- @PostMapping("/remove")
- @ResponseBody
- public AjaxResult remove(String ids)
- {
- return toAjax(dictTypeService.deleteDictTypeByIds(ids));
- }
-
- /**
- * 清空缓存
- */
- @RequiresPermissions("system:dict:remove")
- @Log(title = "字典类型", businessType = BusinessType.CLEAN)
- @GetMapping("/clearCache")
- @ResponseBody
- public AjaxResult clearCache()
- {
- dictTypeService.clearCache();
- return success();
- }
-
- /**
- * 查询字典详细
- */
- @RequiresPermissions("system:dict:list")
- @GetMapping("/detail/{dictId}")
- public String detail(@PathVariable("dictId") Long dictId, ModelMap mmap)
- {
- mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
- mmap.put("dictList", dictTypeService.selectDictTypeAll());
- return "system/dict/data/data";
- }
-
- /**
- * 校验字典类型
- */
- @PostMapping("/checkDictTypeUnique")
- @ResponseBody
- public String checkDictTypeUnique(SysDictType dictType)
- {
- return dictTypeService.checkDictTypeUnique(dictType);
- }
-
- /**
- * 选择字典树
- */
- @GetMapping("/selectDictTree/{columnId}/{dictType}")
- public String selectDeptTree(@PathVariable("columnId") Long columnId, @PathVariable("dictType") String dictType,
- ModelMap mmap)
- {
- mmap.put("columnId", columnId);
- mmap.put("dict", dictTypeService.selectDictTypeByType(dictType));
- return prefix + "/tree";
- }
-
- /**
- * 加载字典列表树
- */
- @GetMapping("/treeData")
- @ResponseBody
- public List treeData()
- {
- List ztrees = dictTypeService.selectDictTree(new SysDictType());
- return ztrees;
- }
-}
+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.constant.UserConstants;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.Ztree;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.system.domain.SysDictType;
+import com.ruoyi.system.service.ISysDictTypeService;
+
+/**
+ * 数据字典信息
+ *
+ * @author ruoyi
+ */
+@Controller
+@RequestMapping("/system/dict")
+public class SysDictTypeController extends BaseController
+{
+ private String prefix = "system/dict/type";
+
+ @Autowired
+ private ISysDictTypeService dictTypeService;
+
+ @RequiresPermissions("system:dict:view")
+ @GetMapping()
+ public String dictType()
+ {
+ return prefix + "/type";
+ }
+
+ @PostMapping("/list")
+ @RequiresPermissions("system:dict:list")
+ @ResponseBody
+ public TableDataInfo list(SysDictType dictType)
+ {
+ startPage();
+ List list = dictTypeService.selectDictTypeList(dictType);
+ return getDataTable(list);
+ }
+
+ @Log(title = "字典类型", businessType = BusinessType.EXPORT)
+ @RequiresPermissions("system:dict:export")
+ @PostMapping("/export")
+ @ResponseBody
+ public AjaxResult export(SysDictType dictType)
+ {
+
+ List list = dictTypeService.selectDictTypeList(dictType);
+ ExcelUtil util = new ExcelUtil(SysDictType.class);
+ return util.exportExcel(list, "字典类型");
+ }
+
+ /**
+ * 新增字典类型
+ */
+ @GetMapping("/add")
+ public String add()
+ {
+ return prefix + "/add";
+ }
+
+ /**
+ * 新增保存字典类型
+ */
+ @Log(title = "字典类型", businessType = BusinessType.INSERT)
+ @RequiresPermissions("system:dict:add")
+ @PostMapping("/add")
+ @ResponseBody
+ public AjaxResult addSave(@Validated SysDictType dict)
+ {
+ if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
+ {
+ return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
+ }
+ dict.setCreateBy(ShiroUtils.getLoginName());
+ return toAjax(dictTypeService.insertDictType(dict));
+ }
+
+ /**
+ * 修改字典类型
+ */
+ @GetMapping("/edit/{dictId}")
+ public String edit(@PathVariable("dictId") Long dictId, ModelMap mmap)
+ {
+ mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
+ return prefix + "/edit";
+ }
+
+ /**
+ * 修改保存字典类型
+ */
+ @Log(title = "字典类型", businessType = BusinessType.UPDATE)
+ @RequiresPermissions("system:dict:edit")
+ @PostMapping("/edit")
+ @ResponseBody
+ public AjaxResult editSave(@Validated SysDictType dict)
+ {
+ if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
+ {
+ return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
+ }
+ dict.setUpdateBy(ShiroUtils.getLoginName());
+ return toAjax(dictTypeService.updateDictType(dict));
+ }
+
+ @Log(title = "字典类型", businessType = BusinessType.DELETE)
+ @RequiresPermissions("system:dict:remove")
+ @PostMapping("/remove")
+ @ResponseBody
+ public AjaxResult remove(String ids)
+ {
+ return toAjax(dictTypeService.deleteDictTypeByIds(ids));
+ }
+
+ /**
+ * 清空缓存
+ */
+ @RequiresPermissions("system:dict:remove")
+ @Log(title = "字典类型", businessType = BusinessType.CLEAN)
+ @GetMapping("/clearCache")
+ @ResponseBody
+ public AjaxResult clearCache()
+ {
+ dictTypeService.clearCache();
+ return success();
+ }
+
+ /**
+ * 查询字典详细
+ */
+ @RequiresPermissions("system:dict:list")
+ @GetMapping("/detail/{dictId}")
+ public String detail(@PathVariable("dictId") Long dictId, ModelMap mmap)
+ {
+ mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
+ mmap.put("dictList", dictTypeService.selectDictTypeAll());
+ return "system/dict/data/data";
+ }
+
+ /**
+ * 校验字典类型
+ */
+ @PostMapping("/checkDictTypeUnique")
+ @ResponseBody
+ public String checkDictTypeUnique(SysDictType dictType)
+ {
+ return dictTypeService.checkDictTypeUnique(dictType);
+ }
+
+ /**
+ * 选择字典树
+ */
+ @GetMapping("/selectDictTree/{columnId}/{dictType}")
+ public String selectDeptTree(@PathVariable("columnId") Long columnId, @PathVariable("dictType") String dictType,
+ ModelMap mmap)
+ {
+ mmap.put("columnId", columnId);
+ mmap.put("dict", dictTypeService.selectDictTypeByType(dictType));
+ return prefix + "/tree";
+ }
+
+ /**
+ * 加载字典列表树
+ */
+ @GetMapping("/treeData")
+ @ResponseBody
+ public List treeData()
+ {
+ List ztrees = dictTypeService.selectDictTree(new SysDictType());
+ return ztrees;
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java
index 28d4bf068..14e2ebf21 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java
@@ -1,61 +1,61 @@
-package com.ruoyi.web.controller.system;
-
-import java.util.List;
-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 com.ruoyi.common.config.Global;
-import com.ruoyi.common.core.controller.BaseController;
-import com.ruoyi.framework.util.ShiroUtils;
-import com.ruoyi.system.domain.SysMenu;
-import com.ruoyi.system.domain.SysUser;
-import com.ruoyi.system.service.ISysConfigService;
-import com.ruoyi.system.service.ISysMenuService;
-
-/**
- * 首页 业务处理
- *
- * @author ruoyi
- */
-@Controller
-public class SysIndexController extends BaseController
-{
- @Autowired
- private ISysMenuService menuService;
-
- @Autowired
- private ISysConfigService configService;
-
- // 系统首页
- @GetMapping("/index")
- public String index(ModelMap mmap)
- {
- // 取身份信息
- SysUser user = ShiroUtils.getSysUser();
- // 根据用户id取出菜单
- List menus = menuService.selectMenusByUser(user);
- mmap.put("menus", menus);
- mmap.put("user", user);
- mmap.put("sideTheme", configService.selectConfigByKey("sys.index.sideTheme"));
- mmap.put("skinName", configService.selectConfigByKey("sys.index.skinName"));
- mmap.put("copyrightYear", Global.getCopyrightYear());
- mmap.put("demoEnabled", Global.isDemoEnabled());
- return "index";
- }
-
- // 切换主题
- @GetMapping("/system/switchSkin")
- public String switchSkin(ModelMap mmap)
- {
- return "skin";
- }
-
- // 系统介绍
- @GetMapping("/system/main")
- public String main(ModelMap mmap)
- {
- mmap.put("version", Global.getVersion());
- return "main";
- }
-}
+package com.ruoyi.web.controller.system;
+
+import java.util.List;
+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 com.ruoyi.common.config.Global;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.system.domain.SysMenu;
+import com.ruoyi.system.domain.SysUser;
+import com.ruoyi.system.service.ISysConfigService;
+import com.ruoyi.system.service.ISysMenuService;
+
+/**
+ * 首页 业务处理
+ *
+ * @author ruoyi
+ */
+@Controller
+public class SysIndexController extends BaseController
+{
+ @Autowired
+ private ISysMenuService menuService;
+
+ @Autowired
+ private ISysConfigService configService;
+
+ // 系统首页
+ @GetMapping("/index")
+ public String index(ModelMap mmap)
+ {
+ // 取身份信息
+ SysUser user = ShiroUtils.getSysUser();
+ // 根据用户id取出菜单
+ List menus = menuService.selectMenusByUser(user);
+ mmap.put("menus", menus);
+ mmap.put("user", user);
+ mmap.put("sideTheme", configService.selectConfigByKey("sys.index.sideTheme"));
+ mmap.put("skinName", configService.selectConfigByKey("sys.index.skinName"));
+ mmap.put("copyrightYear", Global.getCopyrightYear());
+ mmap.put("demoEnabled", Global.isDemoEnabled());
+ return "index";
+ }
+
+ // 切换主题
+ @GetMapping("/system/switchSkin")
+ public String switchSkin(ModelMap mmap)
+ {
+ return "skin";
+ }
+
+ // 系统介绍
+ @GetMapping("/system/main")
+ public String main(ModelMap mmap)
+ {
+ mmap.put("version", Global.getVersion());
+ return "main";
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java
index 3615c7599..d1a4e5336 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java
@@ -1,196 +1,196 @@
-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.constant.UserConstants;
-import com.ruoyi.common.core.controller.BaseController;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.core.domain.Ztree;
-import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.framework.util.ShiroUtils;
-import com.ruoyi.system.domain.SysMenu;
-import com.ruoyi.system.domain.SysRole;
-import com.ruoyi.system.service.ISysMenuService;
-
-/**
- * 菜单信息
- *
- * @author ruoyi
- */
-@Controller
-@RequestMapping("/system/menu")
-public class SysMenuController extends BaseController
-{
- private String prefix = "system/menu";
-
- @Autowired
- private ISysMenuService menuService;
-
- @RequiresPermissions("system:menu:view")
- @GetMapping()
- public String menu()
- {
- return prefix + "/menu";
- }
-
- @RequiresPermissions("system:menu:list")
- @PostMapping("/list")
- @ResponseBody
- public List list(SysMenu menu)
- {
- Long userId = ShiroUtils.getUserId();
- List menuList = menuService.selectMenuList(menu, userId);
- return menuList;
- }
-
- /**
- * 删除菜单
- */
- @Log(title = "菜单管理", businessType = BusinessType.DELETE)
- @RequiresPermissions("system:menu:remove")
- @GetMapping("/remove/{menuId}")
- @ResponseBody
- public AjaxResult remove(@PathVariable("menuId") Long menuId)
- {
- if (menuService.selectCountMenuByParentId(menuId) > 0)
- {
- return AjaxResult.warn("存在子菜单,不允许删除");
- }
- if (menuService.selectCountRoleMenuByMenuId(menuId) > 0)
- {
- return AjaxResult.warn("菜单已分配,不允许删除");
- }
- ShiroUtils.clearCachedAuthorizationInfo();
- return toAjax(menuService.deleteMenuById(menuId));
- }
-
- /**
- * 新增
- */
- @GetMapping("/add/{parentId}")
- public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
- {
- SysMenu menu = null;
- if (0L != parentId)
- {
- menu = menuService.selectMenuById(parentId);
- }
- else
- {
- menu = new SysMenu();
- menu.setMenuId(0L);
- menu.setMenuName("主目录");
- }
- mmap.put("menu", menu);
- return prefix + "/add";
- }
-
- /**
- * 新增保存菜单
- */
- @Log(title = "菜单管理", businessType = BusinessType.INSERT)
- @RequiresPermissions("system:menu:add")
- @PostMapping("/add")
- @ResponseBody
- public AjaxResult addSave(@Validated SysMenu menu)
- {
- if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
- {
- return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
- }
- menu.setCreateBy(ShiroUtils.getLoginName());
- ShiroUtils.clearCachedAuthorizationInfo();
- return toAjax(menuService.insertMenu(menu));
- }
-
- /**
- * 修改菜单
- */
- @GetMapping("/edit/{menuId}")
- public String edit(@PathVariable("menuId") Long menuId, ModelMap mmap)
- {
- mmap.put("menu", menuService.selectMenuById(menuId));
- return prefix + "/edit";
- }
-
- /**
- * 修改保存菜单
- */
- @Log(title = "菜单管理", businessType = BusinessType.UPDATE)
- @RequiresPermissions("system:menu:edit")
- @PostMapping("/edit")
- @ResponseBody
- public AjaxResult editSave(@Validated SysMenu menu)
- {
- if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
- {
- return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
- }
- menu.setUpdateBy(ShiroUtils.getLoginName());
- ShiroUtils.clearCachedAuthorizationInfo();
- return toAjax(menuService.updateMenu(menu));
- }
-
- /**
- * 选择菜单图标
- */
- @GetMapping("/icon")
- public String icon()
- {
- return prefix + "/icon";
- }
-
- /**
- * 校验菜单名称
- */
- @PostMapping("/checkMenuNameUnique")
- @ResponseBody
- public String checkMenuNameUnique(SysMenu menu)
- {
- return menuService.checkMenuNameUnique(menu);
- }
-
- /**
- * 加载角色菜单列表树
- */
- @GetMapping("/roleMenuTreeData")
- @ResponseBody
- public List roleMenuTreeData(SysRole role)
- {
- Long userId = ShiroUtils.getUserId();
- List ztrees = menuService.roleMenuTreeData(role, userId);
- return ztrees;
- }
-
- /**
- * 加载所有菜单列表树
- */
- @GetMapping("/menuTreeData")
- @ResponseBody
- public List menuTreeData()
- {
- Long userId = ShiroUtils.getUserId();
- List ztrees = menuService.menuTreeData(userId);
- return ztrees;
- }
-
- /**
- * 选择菜单树
- */
- @GetMapping("/selectMenuTree/{menuId}")
- public String selectMenuTree(@PathVariable("menuId") Long menuId, ModelMap mmap)
- {
- mmap.put("menu", menuService.selectMenuById(menuId));
- return prefix + "/tree";
- }
+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.constant.UserConstants;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.Ztree;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.system.domain.SysMenu;
+import com.ruoyi.system.domain.SysRole;
+import com.ruoyi.system.service.ISysMenuService;
+
+/**
+ * 菜单信息
+ *
+ * @author ruoyi
+ */
+@Controller
+@RequestMapping("/system/menu")
+public class SysMenuController extends BaseController
+{
+ private String prefix = "system/menu";
+
+ @Autowired
+ private ISysMenuService menuService;
+
+ @RequiresPermissions("system:menu:view")
+ @GetMapping()
+ public String menu()
+ {
+ return prefix + "/menu";
+ }
+
+ @RequiresPermissions("system:menu:list")
+ @PostMapping("/list")
+ @ResponseBody
+ public List list(SysMenu menu)
+ {
+ Long userId = ShiroUtils.getUserId();
+ List menuList = menuService.selectMenuList(menu, userId);
+ return menuList;
+ }
+
+ /**
+ * 删除菜单
+ */
+ @Log(title = "菜单管理", businessType = BusinessType.DELETE)
+ @RequiresPermissions("system:menu:remove")
+ @GetMapping("/remove/{menuId}")
+ @ResponseBody
+ public AjaxResult remove(@PathVariable("menuId") Long menuId)
+ {
+ if (menuService.selectCountMenuByParentId(menuId) > 0)
+ {
+ return AjaxResult.warn("存在子菜单,不允许删除");
+ }
+ if (menuService.selectCountRoleMenuByMenuId(menuId) > 0)
+ {
+ return AjaxResult.warn("菜单已分配,不允许删除");
+ }
+ ShiroUtils.clearCachedAuthorizationInfo();
+ return toAjax(menuService.deleteMenuById(menuId));
+ }
+
+ /**
+ * 新增
+ */
+ @GetMapping("/add/{parentId}")
+ public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
+ {
+ SysMenu menu = null;
+ if (0L != parentId)
+ {
+ menu = menuService.selectMenuById(parentId);
+ }
+ else
+ {
+ menu = new SysMenu();
+ menu.setMenuId(0L);
+ menu.setMenuName("主目录");
+ }
+ mmap.put("menu", menu);
+ return prefix + "/add";
+ }
+
+ /**
+ * 新增保存菜单
+ */
+ @Log(title = "菜单管理", businessType = BusinessType.INSERT)
+ @RequiresPermissions("system:menu:add")
+ @PostMapping("/add")
+ @ResponseBody
+ public AjaxResult addSave(@Validated SysMenu menu)
+ {
+ if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
+ {
+ return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
+ }
+ menu.setCreateBy(ShiroUtils.getLoginName());
+ ShiroUtils.clearCachedAuthorizationInfo();
+ return toAjax(menuService.insertMenu(menu));
+ }
+
+ /**
+ * 修改菜单
+ */
+ @GetMapping("/edit/{menuId}")
+ public String edit(@PathVariable("menuId") Long menuId, ModelMap mmap)
+ {
+ mmap.put("menu", menuService.selectMenuById(menuId));
+ return prefix + "/edit";
+ }
+
+ /**
+ * 修改保存菜单
+ */
+ @Log(title = "菜单管理", businessType = BusinessType.UPDATE)
+ @RequiresPermissions("system:menu:edit")
+ @PostMapping("/edit")
+ @ResponseBody
+ public AjaxResult editSave(@Validated SysMenu menu)
+ {
+ if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
+ {
+ return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
+ }
+ menu.setUpdateBy(ShiroUtils.getLoginName());
+ ShiroUtils.clearCachedAuthorizationInfo();
+ return toAjax(menuService.updateMenu(menu));
+ }
+
+ /**
+ * 选择菜单图标
+ */
+ @GetMapping("/icon")
+ public String icon()
+ {
+ return prefix + "/icon";
+ }
+
+ /**
+ * 校验菜单名称
+ */
+ @PostMapping("/checkMenuNameUnique")
+ @ResponseBody
+ public String checkMenuNameUnique(SysMenu menu)
+ {
+ return menuService.checkMenuNameUnique(menu);
+ }
+
+ /**
+ * 加载角色菜单列表树
+ */
+ @GetMapping("/roleMenuTreeData")
+ @ResponseBody
+ public List roleMenuTreeData(SysRole role)
+ {
+ Long userId = ShiroUtils.getUserId();
+ List ztrees = menuService.roleMenuTreeData(role, userId);
+ return ztrees;
+ }
+
+ /**
+ * 加载所有菜单列表树
+ */
+ @GetMapping("/menuTreeData")
+ @ResponseBody
+ public List menuTreeData()
+ {
+ Long userId = ShiroUtils.getUserId();
+ List ztrees = menuService.menuTreeData(userId);
+ return ztrees;
+ }
+
+ /**
+ * 选择菜单树
+ */
+ @GetMapping("/selectMenuTree/{menuId}")
+ public String selectMenuTree(@PathVariable("menuId") Long menuId, ModelMap mmap)
+ {
+ mmap.put("menu", menuService.selectMenuById(menuId));
+ return prefix + "/tree";
+ }
}
\ No newline at end of file
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java
index 671dc11e3..c7f654e50 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java
@@ -1,112 +1,112 @@
-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.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.core.controller.BaseController;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.core.page.TableDataInfo;
-import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.framework.util.ShiroUtils;
-import com.ruoyi.system.domain.SysNotice;
-import com.ruoyi.system.service.ISysNoticeService;
-
-/**
- * 公告 信息操作处理
- *
- * @author ruoyi
- */
-@Controller
-@RequestMapping("/system/notice")
-public class SysNoticeController extends BaseController
-{
- private String prefix = "system/notice";
-
- @Autowired
- private ISysNoticeService noticeService;
-
- @RequiresPermissions("system:notice:view")
- @GetMapping()
- public String notice()
- {
- return prefix + "/notice";
- }
-
- /**
- * 查询公告列表
- */
- @RequiresPermissions("system:notice:list")
- @PostMapping("/list")
- @ResponseBody
- public TableDataInfo list(SysNotice notice)
- {
- startPage();
- List list = noticeService.selectNoticeList(notice);
- return getDataTable(list);
- }
-
- /**
- * 新增公告
- */
- @GetMapping("/add")
- public String add()
- {
- return prefix + "/add";
- }
-
- /**
- * 新增保存公告
- */
- @RequiresPermissions("system:notice:add")
- @Log(title = "通知公告", businessType = BusinessType.INSERT)
- @PostMapping("/add")
- @ResponseBody
- public AjaxResult addSave(SysNotice notice)
- {
- notice.setCreateBy(ShiroUtils.getLoginName());
- return toAjax(noticeService.insertNotice(notice));
- }
-
- /**
- * 修改公告
- */
- @GetMapping("/edit/{noticeId}")
- public String edit(@PathVariable("noticeId") Long noticeId, ModelMap mmap)
- {
- mmap.put("notice", noticeService.selectNoticeById(noticeId));
- return prefix + "/edit";
- }
-
- /**
- * 修改保存公告
- */
- @RequiresPermissions("system:notice:edit")
- @Log(title = "通知公告", businessType = BusinessType.UPDATE)
- @PostMapping("/edit")
- @ResponseBody
- public AjaxResult editSave(SysNotice notice)
- {
- notice.setUpdateBy(ShiroUtils.getLoginName());
- return toAjax(noticeService.updateNotice(notice));
- }
-
- /**
- * 删除公告
- */
- @RequiresPermissions("system:notice:remove")
- @Log(title = "通知公告", businessType = BusinessType.DELETE)
- @PostMapping("/remove")
- @ResponseBody
- public AjaxResult remove(String ids)
- {
- return toAjax(noticeService.deleteNoticeByIds(ids));
- }
-}
+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.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.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.system.domain.SysNotice;
+import com.ruoyi.system.service.ISysNoticeService;
+
+/**
+ * 公告 信息操作处理
+ *
+ * @author ruoyi
+ */
+@Controller
+@RequestMapping("/system/notice")
+public class SysNoticeController extends BaseController
+{
+ private String prefix = "system/notice";
+
+ @Autowired
+ private ISysNoticeService noticeService;
+
+ @RequiresPermissions("system:notice:view")
+ @GetMapping()
+ public String notice()
+ {
+ return prefix + "/notice";
+ }
+
+ /**
+ * 查询公告列表
+ */
+ @RequiresPermissions("system:notice:list")
+ @PostMapping("/list")
+ @ResponseBody
+ public TableDataInfo list(SysNotice notice)
+ {
+ startPage();
+ List list = noticeService.selectNoticeList(notice);
+ return getDataTable(list);
+ }
+
+ /**
+ * 新增公告
+ */
+ @GetMapping("/add")
+ public String add()
+ {
+ return prefix + "/add";
+ }
+
+ /**
+ * 新增保存公告
+ */
+ @RequiresPermissions("system:notice:add")
+ @Log(title = "通知公告", businessType = BusinessType.INSERT)
+ @PostMapping("/add")
+ @ResponseBody
+ public AjaxResult addSave(SysNotice notice)
+ {
+ notice.setCreateBy(ShiroUtils.getLoginName());
+ return toAjax(noticeService.insertNotice(notice));
+ }
+
+ /**
+ * 修改公告
+ */
+ @GetMapping("/edit/{noticeId}")
+ public String edit(@PathVariable("noticeId") Long noticeId, ModelMap mmap)
+ {
+ mmap.put("notice", noticeService.selectNoticeById(noticeId));
+ return prefix + "/edit";
+ }
+
+ /**
+ * 修改保存公告
+ */
+ @RequiresPermissions("system:notice:edit")
+ @Log(title = "通知公告", businessType = BusinessType.UPDATE)
+ @PostMapping("/edit")
+ @ResponseBody
+ public AjaxResult editSave(SysNotice notice)
+ {
+ notice.setUpdateBy(ShiroUtils.getLoginName());
+ return toAjax(noticeService.updateNotice(notice));
+ }
+
+ /**
+ * 删除公告
+ */
+ @RequiresPermissions("system:notice:remove")
+ @Log(title = "通知公告", businessType = BusinessType.DELETE)
+ @PostMapping("/remove")
+ @ResponseBody
+ public AjaxResult remove(String ids)
+ {
+ return toAjax(noticeService.deleteNoticeByIds(ids));
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java
index d6db9fdf0..7091f5d77 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java
@@ -1,163 +1,163 @@
-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.constant.UserConstants;
-import com.ruoyi.common.core.controller.BaseController;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.core.page.TableDataInfo;
-import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.util.ShiroUtils;
-import com.ruoyi.system.domain.SysPost;
-import com.ruoyi.system.service.ISysPostService;
-
-/**
- * 岗位信息操作处理
- *
- * @author ruoyi
- */
-@Controller
-@RequestMapping("/system/post")
-public class SysPostController extends BaseController
-{
- private String prefix = "system/post";
-
- @Autowired
- private ISysPostService postService;
-
- @RequiresPermissions("system:post:view")
- @GetMapping()
- public String operlog()
- {
- return prefix + "/post";
- }
-
- @RequiresPermissions("system:post:list")
- @PostMapping("/list")
- @ResponseBody
- public TableDataInfo list(SysPost post)
- {
- startPage();
- List list = postService.selectPostList(post);
- return getDataTable(list);
- }
-
- @Log(title = "岗位管理", businessType = BusinessType.EXPORT)
- @RequiresPermissions("system:post:export")
- @PostMapping("/export")
- @ResponseBody
- public AjaxResult export(SysPost post)
- {
- List list = postService.selectPostList(post);
- ExcelUtil util = new ExcelUtil(SysPost.class);
- return util.exportExcel(list, "岗位数据");
- }
-
- @RequiresPermissions("system:post:remove")
- @Log(title = "岗位管理", businessType = BusinessType.DELETE)
- @PostMapping("/remove")
- @ResponseBody
- public AjaxResult remove(String ids)
- {
- try
- {
- return toAjax(postService.deletePostByIds(ids));
- }
- catch (Exception e)
- {
- return error(e.getMessage());
- }
- }
-
- /**
- * 新增岗位
- */
- @GetMapping("/add")
- public String add()
- {
- return prefix + "/add";
- }
-
- /**
- * 新增保存岗位
- */
- @RequiresPermissions("system:post:add")
- @Log(title = "岗位管理", businessType = BusinessType.INSERT)
- @PostMapping("/add")
- @ResponseBody
- public AjaxResult addSave(@Validated SysPost post)
- {
- if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
- {
- return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
- }
- else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
- {
- return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
- }
- post.setCreateBy(ShiroUtils.getLoginName());
- return toAjax(postService.insertPost(post));
- }
-
- /**
- * 修改岗位
- */
- @GetMapping("/edit/{postId}")
- public String edit(@PathVariable("postId") Long postId, ModelMap mmap)
- {
- mmap.put("post", postService.selectPostById(postId));
- return prefix + "/edit";
- }
-
- /**
- * 修改保存岗位
- */
- @RequiresPermissions("system:post:edit")
- @Log(title = "岗位管理", businessType = BusinessType.UPDATE)
- @PostMapping("/edit")
- @ResponseBody
- public AjaxResult editSave(@Validated SysPost post)
- {
- if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
- {
- return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
- }
- else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
- {
- return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
- }
- post.setUpdateBy(ShiroUtils.getLoginName());
- return toAjax(postService.updatePost(post));
- }
-
- /**
- * 校验岗位名称
- */
- @PostMapping("/checkPostNameUnique")
- @ResponseBody
- public String checkPostNameUnique(SysPost post)
- {
- return postService.checkPostNameUnique(post);
- }
-
- /**
- * 校验岗位编码
- */
- @PostMapping("/checkPostCodeUnique")
- @ResponseBody
- public String checkPostCodeUnique(SysPost post)
- {
- return postService.checkPostCodeUnique(post);
- }
-}
+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.constant.UserConstants;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.system.domain.SysPost;
+import com.ruoyi.system.service.ISysPostService;
+
+/**
+ * 岗位信息操作处理
+ *
+ * @author ruoyi
+ */
+@Controller
+@RequestMapping("/system/post")
+public class SysPostController extends BaseController
+{
+ private String prefix = "system/post";
+
+ @Autowired
+ private ISysPostService postService;
+
+ @RequiresPermissions("system:post:view")
+ @GetMapping()
+ public String operlog()
+ {
+ return prefix + "/post";
+ }
+
+ @RequiresPermissions("system:post:list")
+ @PostMapping("/list")
+ @ResponseBody
+ public TableDataInfo list(SysPost post)
+ {
+ startPage();
+ List list = postService.selectPostList(post);
+ return getDataTable(list);
+ }
+
+ @Log(title = "岗位管理", businessType = BusinessType.EXPORT)
+ @RequiresPermissions("system:post:export")
+ @PostMapping("/export")
+ @ResponseBody
+ public AjaxResult export(SysPost post)
+ {
+ List list = postService.selectPostList(post);
+ ExcelUtil util = new ExcelUtil(SysPost.class);
+ return util.exportExcel(list, "岗位数据");
+ }
+
+ @RequiresPermissions("system:post:remove")
+ @Log(title = "岗位管理", businessType = BusinessType.DELETE)
+ @PostMapping("/remove")
+ @ResponseBody
+ public AjaxResult remove(String ids)
+ {
+ try
+ {
+ return toAjax(postService.deletePostByIds(ids));
+ }
+ catch (Exception e)
+ {
+ return error(e.getMessage());
+ }
+ }
+
+ /**
+ * 新增岗位
+ */
+ @GetMapping("/add")
+ public String add()
+ {
+ return prefix + "/add";
+ }
+
+ /**
+ * 新增保存岗位
+ */
+ @RequiresPermissions("system:post:add")
+ @Log(title = "岗位管理", businessType = BusinessType.INSERT)
+ @PostMapping("/add")
+ @ResponseBody
+ public AjaxResult addSave(@Validated SysPost post)
+ {
+ if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
+ {
+ return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
+ }
+ else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
+ {
+ return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
+ }
+ post.setCreateBy(ShiroUtils.getLoginName());
+ return toAjax(postService.insertPost(post));
+ }
+
+ /**
+ * 修改岗位
+ */
+ @GetMapping("/edit/{postId}")
+ public String edit(@PathVariable("postId") Long postId, ModelMap mmap)
+ {
+ mmap.put("post", postService.selectPostById(postId));
+ return prefix + "/edit";
+ }
+
+ /**
+ * 修改保存岗位
+ */
+ @RequiresPermissions("system:post:edit")
+ @Log(title = "岗位管理", businessType = BusinessType.UPDATE)
+ @PostMapping("/edit")
+ @ResponseBody
+ public AjaxResult editSave(@Validated SysPost post)
+ {
+ if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
+ {
+ return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
+ }
+ else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
+ {
+ return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
+ }
+ post.setUpdateBy(ShiroUtils.getLoginName());
+ return toAjax(postService.updatePost(post));
+ }
+
+ /**
+ * 校验岗位名称
+ */
+ @PostMapping("/checkPostNameUnique")
+ @ResponseBody
+ public String checkPostNameUnique(SysPost post)
+ {
+ return postService.checkPostNameUnique(post);
+ }
+
+ /**
+ * 校验岗位编码
+ */
+ @PostMapping("/checkPostCodeUnique")
+ @ResponseBody
+ public String checkPostCodeUnique(SysPost post)
+ {
+ return postService.checkPostCodeUnique(post);
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java
index f8a462dda..59127b0c5 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java
@@ -1,173 +1,173 @@
-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.config.Global;
-import com.ruoyi.common.core.controller.BaseController;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.common.utils.file.FileUploadUtils;
-import com.ruoyi.framework.shiro.service.SysPasswordService;
-import com.ruoyi.framework.util.ShiroUtils;
-import com.ruoyi.system.domain.SysUser;
-import com.ruoyi.system.service.ISysUserService;
-
-/**
- * 个人信息 业务处理
- *
- * @author ruoyi
- */
-@Controller
-@RequestMapping("/system/user/profile")
-public class SysProfileController extends BaseController
-{
- private static final Logger log = LoggerFactory.getLogger(SysProfileController.class);
-
- private String prefix = "system/user/profile";
-
- @Autowired
- private ISysUserService userService;
-
- @Autowired
- private SysPasswordService passwordService;
-
- /**
- * 个人信息
- */
- @GetMapping()
- public String profile(ModelMap mmap)
- {
- SysUser user = ShiroUtils.getSysUser();
- mmap.put("user", user);
- mmap.put("roleGroup", userService.selectUserRoleGroup(user.getUserId()));
- mmap.put("postGroup", userService.selectUserPostGroup(user.getUserId()));
- return prefix + "/profile";
- }
-
- @GetMapping("/checkPassword")
- @ResponseBody
- public boolean checkPassword(String password)
- {
- SysUser user = ShiroUtils.getSysUser();
- if (passwordService.matches(user, password))
- {
- return true;
- }
- return false;
- }
-
- @GetMapping("/resetPwd")
- public String resetPwd(ModelMap mmap)
- {
- SysUser user = ShiroUtils.getSysUser();
- mmap.put("user", userService.selectUserById(user.getUserId()));
- return prefix + "/resetPwd";
- }
-
- @Log(title = "重置密码", businessType = BusinessType.UPDATE)
- @PostMapping("/resetPwd")
- @ResponseBody
- public AjaxResult resetPwd(String oldPassword, String newPassword)
- {
- SysUser user = ShiroUtils.getSysUser();
- if (StringUtils.isNotEmpty(newPassword) && passwordService.matches(user, oldPassword))
- {
- user.setSalt(ShiroUtils.randomSalt());
- user.setPassword(passwordService.encryptPassword(user.getLoginName(), newPassword, user.getSalt()));
- if (userService.resetUserPwd(user) > 0)
- {
- ShiroUtils.setSysUser(userService.selectUserById(user.getUserId()));
- return success();
- }
- return error();
- }
- else
- {
- return error("修改密码失败,旧密码错误");
- }
- }
-
- /**
- * 修改用户
- */
- @GetMapping("/edit")
- public String edit(ModelMap mmap)
- {
- SysUser user = ShiroUtils.getSysUser();
- mmap.put("user", userService.selectUserById(user.getUserId()));
- return prefix + "/edit";
- }
-
- /**
- * 修改头像
- */
- @GetMapping("/avatar")
- public String avatar(ModelMap mmap)
- {
- SysUser user = ShiroUtils.getSysUser();
- mmap.put("user", userService.selectUserById(user.getUserId()));
- return prefix + "/avatar";
- }
-
- /**
- * 修改用户
- */
- @Log(title = "个人信息", businessType = BusinessType.UPDATE)
- @PostMapping("/update")
- @ResponseBody
- public AjaxResult update(SysUser user)
- {
- SysUser currentUser = ShiroUtils.getSysUser();
- currentUser.setUserName(user.getUserName());
- currentUser.setEmail(user.getEmail());
- currentUser.setPhonenumber(user.getPhonenumber());
- currentUser.setSex(user.getSex());
- if (userService.updateUserInfo(currentUser) > 0)
- {
- ShiroUtils.setSysUser(userService.selectUserById(currentUser.getUserId()));
- return success();
- }
- return error();
- }
-
- /**
- * 保存头像
- */
- @Log(title = "个人信息", businessType = BusinessType.UPDATE)
- @PostMapping("/updateAvatar")
- @ResponseBody
- public AjaxResult updateAvatar(@RequestParam("avatarfile") MultipartFile file)
- {
- SysUser currentUser = ShiroUtils.getSysUser();
- try
- {
- if (!file.isEmpty())
- {
- String avatar = FileUploadUtils.upload(Global.getAvatarPath(), file);
- currentUser.setAvatar(avatar);
- if (userService.updateUserInfo(currentUser) > 0)
- {
- ShiroUtils.setSysUser(userService.selectUserById(currentUser.getUserId()));
- return success();
- }
- }
- return error();
- }
- catch (Exception e)
- {
- log.error("修改头像失败!", e);
- return error(e.getMessage());
- }
- }
-}
+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.config.Global;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.file.FileUploadUtils;
+import com.ruoyi.framework.shiro.service.SysPasswordService;
+import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.system.domain.SysUser;
+import com.ruoyi.system.service.ISysUserService;
+
+/**
+ * 个人信息 业务处理
+ *
+ * @author ruoyi
+ */
+@Controller
+@RequestMapping("/system/user/profile")
+public class SysProfileController extends BaseController
+{
+ private static final Logger log = LoggerFactory.getLogger(SysProfileController.class);
+
+ private String prefix = "system/user/profile";
+
+ @Autowired
+ private ISysUserService userService;
+
+ @Autowired
+ private SysPasswordService passwordService;
+
+ /**
+ * 个人信息
+ */
+ @GetMapping()
+ public String profile(ModelMap mmap)
+ {
+ SysUser user = ShiroUtils.getSysUser();
+ mmap.put("user", user);
+ mmap.put("roleGroup", userService.selectUserRoleGroup(user.getUserId()));
+ mmap.put("postGroup", userService.selectUserPostGroup(user.getUserId()));
+ return prefix + "/profile";
+ }
+
+ @GetMapping("/checkPassword")
+ @ResponseBody
+ public boolean checkPassword(String password)
+ {
+ SysUser user = ShiroUtils.getSysUser();
+ if (passwordService.matches(user, password))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ @GetMapping("/resetPwd")
+ public String resetPwd(ModelMap mmap)
+ {
+ SysUser user = ShiroUtils.getSysUser();
+ mmap.put("user", userService.selectUserById(user.getUserId()));
+ return prefix + "/resetPwd";
+ }
+
+ @Log(title = "重置密码", businessType = BusinessType.UPDATE)
+ @PostMapping("/resetPwd")
+ @ResponseBody
+ public AjaxResult resetPwd(String oldPassword, String newPassword)
+ {
+ SysUser user = ShiroUtils.getSysUser();
+ if (StringUtils.isNotEmpty(newPassword) && passwordService.matches(user, oldPassword))
+ {
+ user.setSalt(ShiroUtils.randomSalt());
+ user.setPassword(passwordService.encryptPassword(user.getLoginName(), newPassword, user.getSalt()));
+ if (userService.resetUserPwd(user) > 0)
+ {
+ ShiroUtils.setSysUser(userService.selectUserById(user.getUserId()));
+ return success();
+ }
+ return error();
+ }
+ else
+ {
+ return error("修改密码失败,旧密码错误");
+ }
+ }
+
+ /**
+ * 修改用户
+ */
+ @GetMapping("/edit")
+ public String edit(ModelMap mmap)
+ {
+ SysUser user = ShiroUtils.getSysUser();
+ mmap.put("user", userService.selectUserById(user.getUserId()));
+ return prefix + "/edit";
+ }
+
+ /**
+ * 修改头像
+ */
+ @GetMapping("/avatar")
+ public String avatar(ModelMap mmap)
+ {
+ SysUser user = ShiroUtils.getSysUser();
+ mmap.put("user", userService.selectUserById(user.getUserId()));
+ return prefix + "/avatar";
+ }
+
+ /**
+ * 修改用户
+ */
+ @Log(title = "个人信息", businessType = BusinessType.UPDATE)
+ @PostMapping("/update")
+ @ResponseBody
+ public AjaxResult update(SysUser user)
+ {
+ SysUser currentUser = ShiroUtils.getSysUser();
+ currentUser.setUserName(user.getUserName());
+ currentUser.setEmail(user.getEmail());
+ currentUser.setPhonenumber(user.getPhonenumber());
+ currentUser.setSex(user.getSex());
+ if (userService.updateUserInfo(currentUser) > 0)
+ {
+ ShiroUtils.setSysUser(userService.selectUserById(currentUser.getUserId()));
+ return success();
+ }
+ return error();
+ }
+
+ /**
+ * 保存头像
+ */
+ @Log(title = "个人信息", businessType = BusinessType.UPDATE)
+ @PostMapping("/updateAvatar")
+ @ResponseBody
+ public AjaxResult updateAvatar(@RequestParam("avatarfile") MultipartFile file)
+ {
+ SysUser currentUser = ShiroUtils.getSysUser();
+ try
+ {
+ if (!file.isEmpty())
+ {
+ String avatar = FileUploadUtils.upload(Global.getAvatarPath(), file);
+ currentUser.setAvatar(avatar);
+ if (userService.updateUserInfo(currentUser) > 0)
+ {
+ ShiroUtils.setSysUser(userService.selectUserById(currentUser.getUserId()));
+ return success();
+ }
+ }
+ return error();
+ }
+ catch (Exception e)
+ {
+ log.error("修改头像失败!", e);
+ return error(e.getMessage());
+ }
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java
index a0f0a4848..4803785c7 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java
@@ -1,46 +1,46 @@
-package com.ruoyi.web.controller.system;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.util.StringUtils;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-import com.ruoyi.common.core.controller.BaseController;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.framework.shiro.service.SysRegisterService;
-import com.ruoyi.system.domain.SysUser;
-import com.ruoyi.system.service.ISysConfigService;
-
-/**
- * 注册验证
- *
- * @author ruoyi
- */
-@Controller
-public class SysRegisterController extends BaseController
-{
- @Autowired
- private SysRegisterService registerService;
-
- @Autowired
- private ISysConfigService configService;
-
- @GetMapping("/register")
- public String register()
- {
- return "register";
- }
-
- @PostMapping("/register")
- @ResponseBody
- public AjaxResult ajaxRegister(SysUser user)
- {
- if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
- {
- return error("当前系统没有开启注册功能!");
- }
- String msg = registerService.register(user);
- return StringUtils.isEmpty(msg) ? success() : error(msg);
- }
-}
+package com.ruoyi.web.controller.system;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.framework.shiro.service.SysRegisterService;
+import com.ruoyi.system.domain.SysUser;
+import com.ruoyi.system.service.ISysConfigService;
+
+/**
+ * 注册验证
+ *
+ * @author ruoyi
+ */
+@Controller
+public class SysRegisterController extends BaseController
+{
+ @Autowired
+ private SysRegisterService registerService;
+
+ @Autowired
+ private ISysConfigService configService;
+
+ @GetMapping("/register")
+ public String register()
+ {
+ return "register";
+ }
+
+ @PostMapping("/register")
+ @ResponseBody
+ public AjaxResult ajaxRegister(SysUser user)
+ {
+ if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
+ {
+ return error("当前系统没有开启注册功能!");
+ }
+ String msg = registerService.register(user);
+ return StringUtils.isEmpty(msg) ? success() : error(msg);
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java
index 0f7379d1a..5ae341f88 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java
@@ -1,304 +1,304 @@
-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.constant.UserConstants;
-import com.ruoyi.common.core.controller.BaseController;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.core.page.TableDataInfo;
-import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.util.ShiroUtils;
-import com.ruoyi.system.domain.SysRole;
-import com.ruoyi.system.domain.SysUser;
-import com.ruoyi.system.domain.SysUserRole;
-import com.ruoyi.system.service.ISysRoleService;
-import com.ruoyi.system.service.ISysUserService;
-
-/**
- * 角色信息
- *
- * @author ruoyi
- */
-@Controller
-@RequestMapping("/system/role")
-public class SysRoleController extends BaseController
-{
- private String prefix = "system/role";
-
- @Autowired
- private ISysRoleService roleService;
-
- @Autowired
- private ISysUserService userService;
-
- @RequiresPermissions("system:role:view")
- @GetMapping()
- public String role()
- {
- return prefix + "/role";
- }
-
- @RequiresPermissions("system:role:list")
- @PostMapping("/list")
- @ResponseBody
- public TableDataInfo list(SysRole role)
- {
- startPage();
- List list = roleService.selectRoleList(role);
- return getDataTable(list);
- }
-
- @Log(title = "角色管理", businessType = BusinessType.EXPORT)
- @RequiresPermissions("system:role:export")
- @PostMapping("/export")
- @ResponseBody
- public AjaxResult export(SysRole role)
- {
- List list = roleService.selectRoleList(role);
- ExcelUtil util = new ExcelUtil(SysRole.class);
- return util.exportExcel(list, "角色数据");
- }
-
- /**
- * 新增角色
- */
- @GetMapping("/add")
- public String add()
- {
- return prefix + "/add";
- }
-
- /**
- * 新增保存角色
- */
- @RequiresPermissions("system:role:add")
- @Log(title = "角色管理", businessType = BusinessType.INSERT)
- @PostMapping("/add")
- @ResponseBody
- public AjaxResult addSave(@Validated SysRole role)
- {
- if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
- {
- return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
- }
- else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
- {
- return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
- }
- role.setCreateBy(ShiroUtils.getLoginName());
- ShiroUtils.clearCachedAuthorizationInfo();
- return toAjax(roleService.insertRole(role));
-
- }
-
- /**
- * 修改角色
- */
- @GetMapping("/edit/{roleId}")
- public String edit(@PathVariable("roleId") Long roleId, ModelMap mmap)
- {
- mmap.put("role", roleService.selectRoleById(roleId));
- return prefix + "/edit";
- }
-
- /**
- * 修改保存角色
- */
- @RequiresPermissions("system:role:edit")
- @Log(title = "角色管理", businessType = BusinessType.UPDATE)
- @PostMapping("/edit")
- @ResponseBody
- public AjaxResult editSave(@Validated SysRole role)
- {
- roleService.checkRoleAllowed(role);
- if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
- {
- return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
- }
- else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
- {
- return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
- }
- role.setUpdateBy(ShiroUtils.getLoginName());
- ShiroUtils.clearCachedAuthorizationInfo();
- return toAjax(roleService.updateRole(role));
- }
-
- /**
- * 角色分配数据权限
- */
- @GetMapping("/authDataScope/{roleId}")
- public String authDataScope(@PathVariable("roleId") Long roleId, ModelMap mmap)
- {
- mmap.put("role", roleService.selectRoleById(roleId));
- return prefix + "/dataScope";
- }
-
- /**
- * 保存角色分配数据权限
- */
- @RequiresPermissions("system:role:edit")
- @Log(title = "角色管理", businessType = BusinessType.UPDATE)
- @PostMapping("/authDataScope")
- @ResponseBody
- public AjaxResult authDataScopeSave(SysRole role)
- {
- roleService.checkRoleAllowed(role);
- role.setUpdateBy(ShiroUtils.getLoginName());
- if (roleService.authDataScope(role) > 0)
- {
- ShiroUtils.setSysUser(userService.selectUserById(ShiroUtils.getSysUser().getUserId()));
- return success();
- }
- return error();
- }
-
- @RequiresPermissions("system:role:remove")
- @Log(title = "角色管理", businessType = BusinessType.DELETE)
- @PostMapping("/remove")
- @ResponseBody
- public AjaxResult remove(String ids)
- {
- try
- {
- return toAjax(roleService.deleteRoleByIds(ids));
- }
- catch (Exception e)
- {
- return error(e.getMessage());
- }
- }
-
- /**
- * 校验角色名称
- */
- @PostMapping("/checkRoleNameUnique")
- @ResponseBody
- public String checkRoleNameUnique(SysRole role)
- {
- return roleService.checkRoleNameUnique(role);
- }
-
- /**
- * 校验角色权限
- */
- @PostMapping("/checkRoleKeyUnique")
- @ResponseBody
- public String checkRoleKeyUnique(SysRole role)
- {
- return roleService.checkRoleKeyUnique(role);
- }
-
- /**
- * 选择菜单树
- */
- @GetMapping("/selectMenuTree")
- public String selectMenuTree()
- {
- return prefix + "/tree";
- }
-
- /**
- * 角色状态修改
- */
- @Log(title = "角色管理", businessType = BusinessType.UPDATE)
- @RequiresPermissions("system:role:edit")
- @PostMapping("/changeStatus")
- @ResponseBody
- public AjaxResult changeStatus(SysRole role)
- {
- roleService.checkRoleAllowed(role);
- return toAjax(roleService.changeStatus(role));
- }
-
- /**
- * 分配用户
- */
- @RequiresPermissions("system:role:edit")
- @GetMapping("/authUser/{roleId}")
- public String authUser(@PathVariable("roleId") Long roleId, ModelMap mmap)
- {
- mmap.put("role", roleService.selectRoleById(roleId));
- return prefix + "/authUser";
- }
-
- /**
- * 查询已分配用户角色列表
- */
- @RequiresPermissions("system:role:list")
- @PostMapping("/authUser/allocatedList")
- @ResponseBody
- public TableDataInfo allocatedList(SysUser user)
- {
- startPage();
- List list = userService.selectAllocatedList(user);
- return getDataTable(list);
- }
-
- /**
- * 取消授权
- */
- @Log(title = "角色管理", businessType = BusinessType.GRANT)
- @PostMapping("/authUser/cancel")
- @ResponseBody
- public AjaxResult cancelAuthUser(SysUserRole userRole)
- {
- return toAjax(roleService.deleteAuthUser(userRole));
- }
-
- /**
- * 批量取消授权
- */
- @Log(title = "角色管理", businessType = BusinessType.GRANT)
- @PostMapping("/authUser/cancelAll")
- @ResponseBody
- public AjaxResult cancelAuthUserAll(Long roleId, String userIds)
- {
- return toAjax(roleService.deleteAuthUsers(roleId, userIds));
- }
-
- /**
- * 选择用户
- */
- @GetMapping("/authUser/selectUser/{roleId}")
- public String selectUser(@PathVariable("roleId") Long roleId, ModelMap mmap)
- {
- mmap.put("role", roleService.selectRoleById(roleId));
- return prefix + "/selectUser";
- }
-
- /**
- * 查询未分配用户角色列表
- */
- @RequiresPermissions("system:role:list")
- @PostMapping("/authUser/unallocatedList")
- @ResponseBody
- public TableDataInfo unallocatedList(SysUser user)
- {
- startPage();
- List list = userService.selectUnallocatedList(user);
- return getDataTable(list);
- }
-
- /**
- * 批量选择用户授权
- */
- @Log(title = "角色管理", businessType = BusinessType.GRANT)
- @PostMapping("/authUser/selectAll")
- @ResponseBody
- public AjaxResult selectAuthUserAll(Long roleId, String userIds)
- {
- return toAjax(roleService.insertAuthUsers(roleId, userIds));
- }
+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.constant.UserConstants;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.system.domain.SysRole;
+import com.ruoyi.system.domain.SysUser;
+import com.ruoyi.system.domain.SysUserRole;
+import com.ruoyi.system.service.ISysRoleService;
+import com.ruoyi.system.service.ISysUserService;
+
+/**
+ * 角色信息
+ *
+ * @author ruoyi
+ */
+@Controller
+@RequestMapping("/system/role")
+public class SysRoleController extends BaseController
+{
+ private String prefix = "system/role";
+
+ @Autowired
+ private ISysRoleService roleService;
+
+ @Autowired
+ private ISysUserService userService;
+
+ @RequiresPermissions("system:role:view")
+ @GetMapping()
+ public String role()
+ {
+ return prefix + "/role";
+ }
+
+ @RequiresPermissions("system:role:list")
+ @PostMapping("/list")
+ @ResponseBody
+ public TableDataInfo list(SysRole role)
+ {
+ startPage();
+ List list = roleService.selectRoleList(role);
+ return getDataTable(list);
+ }
+
+ @Log(title = "角色管理", businessType = BusinessType.EXPORT)
+ @RequiresPermissions("system:role:export")
+ @PostMapping("/export")
+ @ResponseBody
+ public AjaxResult export(SysRole role)
+ {
+ List list = roleService.selectRoleList(role);
+ ExcelUtil util = new ExcelUtil(SysRole.class);
+ return util.exportExcel(list, "角色数据");
+ }
+
+ /**
+ * 新增角色
+ */
+ @GetMapping("/add")
+ public String add()
+ {
+ return prefix + "/add";
+ }
+
+ /**
+ * 新增保存角色
+ */
+ @RequiresPermissions("system:role:add")
+ @Log(title = "角色管理", businessType = BusinessType.INSERT)
+ @PostMapping("/add")
+ @ResponseBody
+ public AjaxResult addSave(@Validated SysRole role)
+ {
+ if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
+ {
+ return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
+ }
+ else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
+ {
+ return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
+ }
+ role.setCreateBy(ShiroUtils.getLoginName());
+ ShiroUtils.clearCachedAuthorizationInfo();
+ return toAjax(roleService.insertRole(role));
+
+ }
+
+ /**
+ * 修改角色
+ */
+ @GetMapping("/edit/{roleId}")
+ public String edit(@PathVariable("roleId") Long roleId, ModelMap mmap)
+ {
+ mmap.put("role", roleService.selectRoleById(roleId));
+ return prefix + "/edit";
+ }
+
+ /**
+ * 修改保存角色
+ */
+ @RequiresPermissions("system:role:edit")
+ @Log(title = "角色管理", businessType = BusinessType.UPDATE)
+ @PostMapping("/edit")
+ @ResponseBody
+ public AjaxResult editSave(@Validated SysRole role)
+ {
+ roleService.checkRoleAllowed(role);
+ if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
+ {
+ return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
+ }
+ else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
+ {
+ return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
+ }
+ role.setUpdateBy(ShiroUtils.getLoginName());
+ ShiroUtils.clearCachedAuthorizationInfo();
+ return toAjax(roleService.updateRole(role));
+ }
+
+ /**
+ * 角色分配数据权限
+ */
+ @GetMapping("/authDataScope/{roleId}")
+ public String authDataScope(@PathVariable("roleId") Long roleId, ModelMap mmap)
+ {
+ mmap.put("role", roleService.selectRoleById(roleId));
+ return prefix + "/dataScope";
+ }
+
+ /**
+ * 保存角色分配数据权限
+ */
+ @RequiresPermissions("system:role:edit")
+ @Log(title = "角色管理", businessType = BusinessType.UPDATE)
+ @PostMapping("/authDataScope")
+ @ResponseBody
+ public AjaxResult authDataScopeSave(SysRole role)
+ {
+ roleService.checkRoleAllowed(role);
+ role.setUpdateBy(ShiroUtils.getLoginName());
+ if (roleService.authDataScope(role) > 0)
+ {
+ ShiroUtils.setSysUser(userService.selectUserById(ShiroUtils.getSysUser().getUserId()));
+ return success();
+ }
+ return error();
+ }
+
+ @RequiresPermissions("system:role:remove")
+ @Log(title = "角色管理", businessType = BusinessType.DELETE)
+ @PostMapping("/remove")
+ @ResponseBody
+ public AjaxResult remove(String ids)
+ {
+ try
+ {
+ return toAjax(roleService.deleteRoleByIds(ids));
+ }
+ catch (Exception e)
+ {
+ return error(e.getMessage());
+ }
+ }
+
+ /**
+ * 校验角色名称
+ */
+ @PostMapping("/checkRoleNameUnique")
+ @ResponseBody
+ public String checkRoleNameUnique(SysRole role)
+ {
+ return roleService.checkRoleNameUnique(role);
+ }
+
+ /**
+ * 校验角色权限
+ */
+ @PostMapping("/checkRoleKeyUnique")
+ @ResponseBody
+ public String checkRoleKeyUnique(SysRole role)
+ {
+ return roleService.checkRoleKeyUnique(role);
+ }
+
+ /**
+ * 选择菜单树
+ */
+ @GetMapping("/selectMenuTree")
+ public String selectMenuTree()
+ {
+ return prefix + "/tree";
+ }
+
+ /**
+ * 角色状态修改
+ */
+ @Log(title = "角色管理", businessType = BusinessType.UPDATE)
+ @RequiresPermissions("system:role:edit")
+ @PostMapping("/changeStatus")
+ @ResponseBody
+ public AjaxResult changeStatus(SysRole role)
+ {
+ roleService.checkRoleAllowed(role);
+ return toAjax(roleService.changeStatus(role));
+ }
+
+ /**
+ * 分配用户
+ */
+ @RequiresPermissions("system:role:edit")
+ @GetMapping("/authUser/{roleId}")
+ public String authUser(@PathVariable("roleId") Long roleId, ModelMap mmap)
+ {
+ mmap.put("role", roleService.selectRoleById(roleId));
+ return prefix + "/authUser";
+ }
+
+ /**
+ * 查询已分配用户角色列表
+ */
+ @RequiresPermissions("system:role:list")
+ @PostMapping("/authUser/allocatedList")
+ @ResponseBody
+ public TableDataInfo allocatedList(SysUser user)
+ {
+ startPage();
+ List list = userService.selectAllocatedList(user);
+ return getDataTable(list);
+ }
+
+ /**
+ * 取消授权
+ */
+ @Log(title = "角色管理", businessType = BusinessType.GRANT)
+ @PostMapping("/authUser/cancel")
+ @ResponseBody
+ public AjaxResult cancelAuthUser(SysUserRole userRole)
+ {
+ return toAjax(roleService.deleteAuthUser(userRole));
+ }
+
+ /**
+ * 批量取消授权
+ */
+ @Log(title = "角色管理", businessType = BusinessType.GRANT)
+ @PostMapping("/authUser/cancelAll")
+ @ResponseBody
+ public AjaxResult cancelAuthUserAll(Long roleId, String userIds)
+ {
+ return toAjax(roleService.deleteAuthUsers(roleId, userIds));
+ }
+
+ /**
+ * 选择用户
+ */
+ @GetMapping("/authUser/selectUser/{roleId}")
+ public String selectUser(@PathVariable("roleId") Long roleId, ModelMap mmap)
+ {
+ mmap.put("role", roleService.selectRoleById(roleId));
+ return prefix + "/selectUser";
+ }
+
+ /**
+ * 查询未分配用户角色列表
+ */
+ @RequiresPermissions("system:role:list")
+ @PostMapping("/authUser/unallocatedList")
+ @ResponseBody
+ public TableDataInfo unallocatedList(SysUser user)
+ {
+ startPage();
+ List list = userService.selectUnallocatedList(user);
+ return getDataTable(list);
+ }
+
+ /**
+ * 批量选择用户授权
+ */
+ @Log(title = "角色管理", businessType = BusinessType.GRANT)
+ @PostMapping("/authUser/selectAll")
+ @ResponseBody
+ public AjaxResult selectAuthUserAll(Long roleId, String userIds)
+ {
+ return toAjax(roleService.insertAuthUsers(roleId, userIds));
+ }
}
\ No newline at end of file
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
index c9431ec77..606bcd2f2 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
@@ -1,292 +1,292 @@
-package com.ruoyi.web.controller.system;
-
-import java.util.List;
-import java.util.stream.Collectors;
-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 org.springframework.web.multipart.MultipartFile;
-import com.ruoyi.common.annotation.Log;
-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.page.TableDataInfo;
-import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.shiro.service.SysPasswordService;
-import com.ruoyi.framework.util.ShiroUtils;
-import com.ruoyi.system.domain.SysRole;
-import com.ruoyi.system.domain.SysUser;
-import com.ruoyi.system.domain.SysUserRole;
-import com.ruoyi.system.service.ISysPostService;
-import com.ruoyi.system.service.ISysRoleService;
-import com.ruoyi.system.service.ISysUserService;
-
-/**
- * 用户信息
- *
- * @author ruoyi
- */
-@Controller
-@RequestMapping("/system/user")
-public class SysUserController extends BaseController
-{
- private String prefix = "system/user";
-
- @Autowired
- private ISysUserService userService;
-
- @Autowired
- private ISysRoleService roleService;
-
- @Autowired
- private ISysPostService postService;
-
- @Autowired
- private SysPasswordService passwordService;
-
- @RequiresPermissions("system:user:view")
- @GetMapping()
- public String user()
- {
- return prefix + "/user";
- }
-
- @RequiresPermissions("system:user:list")
- @PostMapping("/list")
- @ResponseBody
- public TableDataInfo list(SysUser user)
- {
- startPage();
- List list = userService.selectUserList(user);
- return getDataTable(list);
- }
-
- @Log(title = "用户管理", businessType = BusinessType.EXPORT)
- @RequiresPermissions("system:user:export")
- @PostMapping("/export")
- @ResponseBody
- public AjaxResult export(SysUser user)
- {
- List list = userService.selectUserList(user);
- ExcelUtil util = new ExcelUtil(SysUser.class);
- return util.exportExcel(list, "用户数据");
- }
-
- @Log(title = "用户管理", businessType = BusinessType.IMPORT)
- @RequiresPermissions("system:user:import")
- @PostMapping("/importData")
- @ResponseBody
- public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
- {
- ExcelUtil util = new ExcelUtil(SysUser.class);
- List userList = util.importExcel(file.getInputStream());
- String operName = ShiroUtils.getSysUser().getLoginName();
- String message = userService.importUser(userList, updateSupport, operName);
- return AjaxResult.success(message);
- }
-
- @RequiresPermissions("system:user:view")
- @GetMapping("/importTemplate")
- @ResponseBody
- public AjaxResult importTemplate()
- {
- ExcelUtil util = new ExcelUtil(SysUser.class);
- return util.importTemplateExcel("用户数据");
- }
-
- /**
- * 新增用户
- */
- @GetMapping("/add")
- public String add(ModelMap mmap)
- {
- mmap.put("roles", roleService.selectRoleAll().stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
- mmap.put("posts", postService.selectPostAll());
- return prefix + "/add";
- }
-
- /**
- * 新增保存用户
- */
- @RequiresPermissions("system:user:add")
- @Log(title = "用户管理", businessType = BusinessType.INSERT)
- @PostMapping("/add")
- @ResponseBody
- public AjaxResult addSave(@Validated SysUser user)
- {
- if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(user.getLoginName())))
- {
- return error("新增用户'" + user.getLoginName() + "'失败,登录账号已存在");
- }
- else if (UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
- {
- return error("新增用户'" + user.getLoginName() + "'失败,手机号码已存在");
- }
- else if (UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
- {
- return error("新增用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
- }
- user.setSalt(ShiroUtils.randomSalt());
- user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
- user.setCreateBy(ShiroUtils.getLoginName());
- return toAjax(userService.insertUser(user));
- }
-
- /**
- * 修改用户
- */
- @GetMapping("/edit/{userId}")
- public String edit(@PathVariable("userId") Long userId, ModelMap mmap)
- {
- List roles = roleService.selectRolesByUserId(userId);
- mmap.put("user", userService.selectUserById(userId));
- mmap.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
- mmap.put("posts", postService.selectPostsByUserId(userId));
- return prefix + "/edit";
- }
-
- /**
- * 修改保存用户
- */
- @RequiresPermissions("system:user:edit")
- @Log(title = "用户管理", businessType = BusinessType.UPDATE)
- @PostMapping("/edit")
- @ResponseBody
- public AjaxResult editSave(@Validated SysUser user)
- {
- userService.checkUserAllowed(user);
- if (UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
- {
- return error("修改用户'" + user.getLoginName() + "'失败,手机号码已存在");
- }
- else if (UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
- {
- return error("修改用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
- }
- user.setUpdateBy(ShiroUtils.getLoginName());
- return toAjax(userService.updateUser(user));
- }
-
- @RequiresPermissions("system:user:resetPwd")
- @Log(title = "重置密码", businessType = BusinessType.UPDATE)
- @GetMapping("/resetPwd/{userId}")
- public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap)
- {
- mmap.put("user", userService.selectUserById(userId));
- return prefix + "/resetPwd";
- }
-
- @RequiresPermissions("system:user:resetPwd")
- @Log(title = "重置密码", businessType = BusinessType.UPDATE)
- @PostMapping("/resetPwd")
- @ResponseBody
- public AjaxResult resetPwdSave(SysUser user)
- {
- userService.checkUserAllowed(user);
- user.setSalt(ShiroUtils.randomSalt());
- user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
- if (userService.resetUserPwd(user) > 0)
- {
- if (ShiroUtils.getUserId().longValue() == user.getUserId().longValue())
- {
- ShiroUtils.setSysUser(userService.selectUserById(user.getUserId()));
- }
- return success();
- }
- return error();
- }
-
- /**
- * 进入授权角色页
- */
- @GetMapping("/authRole/{userId}")
- public String authRole(@PathVariable("userId") Long userId, ModelMap mmap)
- {
- SysUser user = userService.selectUserById(userId);
- // 获取用户所属的角色列表
- List userRoles = userService.selectUserRoleByUserId(userId);
- mmap.put("user", user);
- mmap.put("userRoles", userRoles);
- return prefix + "/authRole";
- }
-
- /**
- * 用户授权角色
- */
- @RequiresPermissions("system:user:add")
- @Log(title = "用户管理", businessType = BusinessType.GRANT)
- @PostMapping("/authRole/insertAuthRole")
- @ResponseBody
- public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
- {
- userService.insertUserAuth(userId, roleIds);
- return success();
- }
-
- @RequiresPermissions("system:user:remove")
- @Log(title = "用户管理", businessType = BusinessType.DELETE)
- @PostMapping("/remove")
- @ResponseBody
- public AjaxResult remove(String ids)
- {
- try
- {
- return toAjax(userService.deleteUserByIds(ids));
- }
- catch (Exception e)
- {
- return error(e.getMessage());
- }
- }
-
- /**
- * 校验用户名
- */
- @PostMapping("/checkLoginNameUnique")
- @ResponseBody
- public String checkLoginNameUnique(SysUser user)
- {
- return userService.checkLoginNameUnique(user.getLoginName());
- }
-
- /**
- * 校验手机号码
- */
- @PostMapping("/checkPhoneUnique")
- @ResponseBody
- public String checkPhoneUnique(SysUser user)
- {
- return userService.checkPhoneUnique(user);
- }
-
- /**
- * 校验email邮箱
- */
- @PostMapping("/checkEmailUnique")
- @ResponseBody
- public String checkEmailUnique(SysUser user)
- {
- return userService.checkEmailUnique(user);
- }
-
- /**
- * 用户状态修改
- */
- @Log(title = "用户管理", businessType = BusinessType.UPDATE)
- @RequiresPermissions("system:user:edit")
- @PostMapping("/changeStatus")
- @ResponseBody
- public AjaxResult changeStatus(SysUser user)
- {
- userService.checkUserAllowed(user);
- return toAjax(userService.changeStatus(user));
- }
+package com.ruoyi.web.controller.system;
+
+import java.util.List;
+import java.util.stream.Collectors;
+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 org.springframework.web.multipart.MultipartFile;
+import com.ruoyi.common.annotation.Log;
+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.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.shiro.service.SysPasswordService;
+import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.system.domain.SysRole;
+import com.ruoyi.system.domain.SysUser;
+import com.ruoyi.system.domain.SysUserRole;
+import com.ruoyi.system.service.ISysPostService;
+import com.ruoyi.system.service.ISysRoleService;
+import com.ruoyi.system.service.ISysUserService;
+
+/**
+ * 用户信息
+ *
+ * @author ruoyi
+ */
+@Controller
+@RequestMapping("/system/user")
+public class SysUserController extends BaseController
+{
+ private String prefix = "system/user";
+
+ @Autowired
+ private ISysUserService userService;
+
+ @Autowired
+ private ISysRoleService roleService;
+
+ @Autowired
+ private ISysPostService postService;
+
+ @Autowired
+ private SysPasswordService passwordService;
+
+ @RequiresPermissions("system:user:view")
+ @GetMapping()
+ public String user()
+ {
+ return prefix + "/user";
+ }
+
+ @RequiresPermissions("system:user:list")
+ @PostMapping("/list")
+ @ResponseBody
+ public TableDataInfo list(SysUser user)
+ {
+ startPage();
+ List list = userService.selectUserList(user);
+ return getDataTable(list);
+ }
+
+ @Log(title = "用户管理", businessType = BusinessType.EXPORT)
+ @RequiresPermissions("system:user:export")
+ @PostMapping("/export")
+ @ResponseBody
+ public AjaxResult export(SysUser user)
+ {
+ List list = userService.selectUserList(user);
+ ExcelUtil util = new ExcelUtil(SysUser.class);
+ return util.exportExcel(list, "用户数据");
+ }
+
+ @Log(title = "用户管理", businessType = BusinessType.IMPORT)
+ @RequiresPermissions("system:user:import")
+ @PostMapping("/importData")
+ @ResponseBody
+ public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
+ {
+ ExcelUtil util = new ExcelUtil(SysUser.class);
+ List userList = util.importExcel(file.getInputStream());
+ String operName = ShiroUtils.getSysUser().getLoginName();
+ String message = userService.importUser(userList, updateSupport, operName);
+ return AjaxResult.success(message);
+ }
+
+ @RequiresPermissions("system:user:view")
+ @GetMapping("/importTemplate")
+ @ResponseBody
+ public AjaxResult importTemplate()
+ {
+ ExcelUtil util = new ExcelUtil(SysUser.class);
+ return util.importTemplateExcel("用户数据");
+ }
+
+ /**
+ * 新增用户
+ */
+ @GetMapping("/add")
+ public String add(ModelMap mmap)
+ {
+ mmap.put("roles", roleService.selectRoleAll().stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
+ mmap.put("posts", postService.selectPostAll());
+ return prefix + "/add";
+ }
+
+ /**
+ * 新增保存用户
+ */
+ @RequiresPermissions("system:user:add")
+ @Log(title = "用户管理", businessType = BusinessType.INSERT)
+ @PostMapping("/add")
+ @ResponseBody
+ public AjaxResult addSave(@Validated SysUser user)
+ {
+ if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(user.getLoginName())))
+ {
+ return error("新增用户'" + user.getLoginName() + "'失败,登录账号已存在");
+ }
+ else if (UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
+ {
+ return error("新增用户'" + user.getLoginName() + "'失败,手机号码已存在");
+ }
+ else if (UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
+ {
+ return error("新增用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
+ }
+ user.setSalt(ShiroUtils.randomSalt());
+ user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
+ user.setCreateBy(ShiroUtils.getLoginName());
+ return toAjax(userService.insertUser(user));
+ }
+
+ /**
+ * 修改用户
+ */
+ @GetMapping("/edit/{userId}")
+ public String edit(@PathVariable("userId") Long userId, ModelMap mmap)
+ {
+ List roles = roleService.selectRolesByUserId(userId);
+ mmap.put("user", userService.selectUserById(userId));
+ mmap.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
+ mmap.put("posts", postService.selectPostsByUserId(userId));
+ return prefix + "/edit";
+ }
+
+ /**
+ * 修改保存用户
+ */
+ @RequiresPermissions("system:user:edit")
+ @Log(title = "用户管理", businessType = BusinessType.UPDATE)
+ @PostMapping("/edit")
+ @ResponseBody
+ public AjaxResult editSave(@Validated SysUser user)
+ {
+ userService.checkUserAllowed(user);
+ if (UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
+ {
+ return error("修改用户'" + user.getLoginName() + "'失败,手机号码已存在");
+ }
+ else if (UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
+ {
+ return error("修改用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
+ }
+ user.setUpdateBy(ShiroUtils.getLoginName());
+ return toAjax(userService.updateUser(user));
+ }
+
+ @RequiresPermissions("system:user:resetPwd")
+ @Log(title = "重置密码", businessType = BusinessType.UPDATE)
+ @GetMapping("/resetPwd/{userId}")
+ public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap)
+ {
+ mmap.put("user", userService.selectUserById(userId));
+ return prefix + "/resetPwd";
+ }
+
+ @RequiresPermissions("system:user:resetPwd")
+ @Log(title = "重置密码", businessType = BusinessType.UPDATE)
+ @PostMapping("/resetPwd")
+ @ResponseBody
+ public AjaxResult resetPwdSave(SysUser user)
+ {
+ userService.checkUserAllowed(user);
+ user.setSalt(ShiroUtils.randomSalt());
+ user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
+ if (userService.resetUserPwd(user) > 0)
+ {
+ if (ShiroUtils.getUserId().longValue() == user.getUserId().longValue())
+ {
+ ShiroUtils.setSysUser(userService.selectUserById(user.getUserId()));
+ }
+ return success();
+ }
+ return error();
+ }
+
+ /**
+ * 进入授权角色页
+ */
+ @GetMapping("/authRole/{userId}")
+ public String authRole(@PathVariable("userId") Long userId, ModelMap mmap)
+ {
+ SysUser user = userService.selectUserById(userId);
+ // 获取用户所属的角色列表
+ List userRoles = userService.selectUserRoleByUserId(userId);
+ mmap.put("user", user);
+ mmap.put("userRoles", userRoles);
+ return prefix + "/authRole";
+ }
+
+ /**
+ * 用户授权角色
+ */
+ @RequiresPermissions("system:user:add")
+ @Log(title = "用户管理", businessType = BusinessType.GRANT)
+ @PostMapping("/authRole/insertAuthRole")
+ @ResponseBody
+ public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
+ {
+ userService.insertUserAuth(userId, roleIds);
+ return success();
+ }
+
+ @RequiresPermissions("system:user:remove")
+ @Log(title = "用户管理", businessType = BusinessType.DELETE)
+ @PostMapping("/remove")
+ @ResponseBody
+ public AjaxResult remove(String ids)
+ {
+ try
+ {
+ return toAjax(userService.deleteUserByIds(ids));
+ }
+ catch (Exception e)
+ {
+ return error(e.getMessage());
+ }
+ }
+
+ /**
+ * 校验用户名
+ */
+ @PostMapping("/checkLoginNameUnique")
+ @ResponseBody
+ public String checkLoginNameUnique(SysUser user)
+ {
+ return userService.checkLoginNameUnique(user.getLoginName());
+ }
+
+ /**
+ * 校验手机号码
+ */
+ @PostMapping("/checkPhoneUnique")
+ @ResponseBody
+ public String checkPhoneUnique(SysUser user)
+ {
+ return userService.checkPhoneUnique(user);
+ }
+
+ /**
+ * 校验email邮箱
+ */
+ @PostMapping("/checkEmailUnique")
+ @ResponseBody
+ public String checkEmailUnique(SysUser user)
+ {
+ return userService.checkEmailUnique(user);
+ }
+
+ /**
+ * 用户状态修改
+ */
+ @Log(title = "用户管理", businessType = BusinessType.UPDATE)
+ @RequiresPermissions("system:user:edit")
+ @PostMapping("/changeStatus")
+ @ResponseBody
+ public AjaxResult changeStatus(SysUser user)
+ {
+ userService.checkUserAllowed(user);
+ return toAjax(userService.changeStatus(user));
+ }
}
\ No newline at end of file
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/BuildController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/BuildController.java
index 53ce0f1ba..4d3c1287a 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/BuildController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/BuildController.java
@@ -1,26 +1,26 @@
-package com.ruoyi.web.controller.tool;
-
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import com.ruoyi.common.core.controller.BaseController;
-
-/**
- * build 表单构建
- *
- * @author ruoyi
- */
-@Controller
-@RequestMapping("/tool/build")
-public class BuildController extends BaseController
-{
- private String prefix = "tool/build";
-
- @RequiresPermissions("tool:build:view")
- @GetMapping()
- public String build()
- {
- return prefix + "/build";
- }
-}
+package com.ruoyi.web.controller.tool;
+
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import com.ruoyi.common.core.controller.BaseController;
+
+/**
+ * build 表单构建
+ *
+ * @author ruoyi
+ */
+@Controller
+@RequestMapping("/tool/build")
+public class BuildController extends BaseController
+{
+ private String prefix = "tool/build";
+
+ @RequiresPermissions("tool:build:view")
+ @GetMapping()
+ public String build()
+ {
+ return prefix + "/build";
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/SwaggerController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/SwaggerController.java
index cfa748f30..7a3bf225e 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/SwaggerController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/SwaggerController.java
@@ -1,24 +1,24 @@
-package com.ruoyi.web.controller.tool;
-
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import com.ruoyi.common.core.controller.BaseController;
-
-/**
- * swagger 接口
- *
- * @author ruoyi
- */
-@Controller
-@RequestMapping("/tool/swagger")
-public class SwaggerController extends BaseController
-{
- @RequiresPermissions("tool:swagger:view")
- @GetMapping()
- public String index()
- {
- return redirect("/swagger-ui.html");
- }
-}
+package com.ruoyi.web.controller.tool;
+
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import com.ruoyi.common.core.controller.BaseController;
+
+/**
+ * swagger 接口
+ *
+ * @author ruoyi
+ */
+@Controller
+@RequestMapping("/tool/swagger")
+public class SwaggerController extends BaseController
+{
+ @RequiresPermissions("tool:swagger:view")
+ @GetMapping()
+ public String index()
+ {
+ return redirect("/swagger-ui.html");
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java
index bddbe7789..4b1c3dea1 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java
@@ -1,175 +1,175 @@
-package com.ruoyi.web.controller.tool;
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import org.springframework.web.bind.annotation.DeleteMapping;
-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.PutMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import com.ruoyi.common.core.controller.BaseController;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.utils.StringUtils;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import io.swagger.annotations.ApiOperation;
-
-/**
- * swagger 用户测试方法
- *
- * @author ruoyi
- */
-@Api("用户信息管理")
-@RestController
-@RequestMapping("/test/user")
-public class TestController extends BaseController
-{
- private final static Map users = new LinkedHashMap();
- {
- users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
- users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
- }
-
- @ApiOperation("获取用户列表")
- @GetMapping("/list")
- public AjaxResult userList()
- {
- List userList = new ArrayList(users.values());
- return AjaxResult.success(userList);
- }
-
- @ApiOperation("获取用户详细")
- @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
- @GetMapping("/{userId}")
- public AjaxResult getUser(@PathVariable Integer userId)
- {
- if (!users.isEmpty() && users.containsKey(userId))
- {
- return AjaxResult.success(users.get(userId));
- }
- else
- {
- return error("用户不存在");
- }
- }
-
- @ApiOperation("新增用户")
- @ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
- @PostMapping("/save")
- public AjaxResult save(UserEntity user)
- {
- if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
- {
- return error("用户ID不能为空");
- }
- return AjaxResult.success(users.put(user.getUserId(), user));
- }
-
- @ApiOperation("更新用户")
- @ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
- @PutMapping("/update")
- public AjaxResult update(UserEntity user)
- {
- if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
- {
- return error("用户ID不能为空");
- }
- if (users.isEmpty() || !users.containsKey(user.getUserId()))
- {
- return error("用户不存在");
- }
- users.remove(user.getUserId());
- return AjaxResult.success(users.put(user.getUserId(), user));
- }
-
- @ApiOperation("删除用户信息")
- @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
- @DeleteMapping("/{userId}")
- public AjaxResult delete(@PathVariable Integer userId)
- {
- if (!users.isEmpty() && users.containsKey(userId))
- {
- users.remove(userId);
- return success();
- }
- else
- {
- return error("用户不存在");
- }
- }
-}
-
-@ApiModel("用户实体")
-class UserEntity
-{
- @ApiModelProperty("用户ID")
- private Integer userId;
-
- @ApiModelProperty("用户名称")
- private String username;
-
- @ApiModelProperty("用户密码")
- private String password;
-
- @ApiModelProperty("用户手机")
- private String mobile;
-
- public UserEntity()
- {
-
- }
-
- public UserEntity(Integer userId, String username, String password, String mobile)
- {
- this.userId = userId;
- this.username = username;
- this.password = password;
- this.mobile = mobile;
- }
-
- public Integer getUserId()
- {
- return userId;
- }
-
- public void setUserId(Integer userId)
- {
- this.userId = userId;
- }
-
- public String getUsername()
- {
- return username;
- }
-
- public void setUsername(String username)
- {
- this.username = username;
- }
-
- public String getPassword()
- {
- return password;
- }
-
- public void setPassword(String password)
- {
- this.password = password;
- }
-
- public String getMobile()
- {
- return mobile;
- }
-
- public void setMobile(String mobile)
- {
- this.mobile = mobile;
- }
-}
+package com.ruoyi.web.controller.tool;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import org.springframework.web.bind.annotation.DeleteMapping;
+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.PutMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.utils.StringUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * swagger 用户测试方法
+ *
+ * @author ruoyi
+ */
+@Api("用户信息管理")
+@RestController
+@RequestMapping("/test/user")
+public class TestController extends BaseController
+{
+ private final static Map users = new LinkedHashMap();
+ {
+ users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
+ users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
+ }
+
+ @ApiOperation("获取用户列表")
+ @GetMapping("/list")
+ public AjaxResult userList()
+ {
+ List userList = new ArrayList(users.values());
+ return AjaxResult.success(userList);
+ }
+
+ @ApiOperation("获取用户详细")
+ @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
+ @GetMapping("/{userId}")
+ public AjaxResult getUser(@PathVariable Integer userId)
+ {
+ if (!users.isEmpty() && users.containsKey(userId))
+ {
+ return AjaxResult.success(users.get(userId));
+ }
+ else
+ {
+ return error("用户不存在");
+ }
+ }
+
+ @ApiOperation("新增用户")
+ @ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
+ @PostMapping("/save")
+ public AjaxResult save(UserEntity user)
+ {
+ if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
+ {
+ return error("用户ID不能为空");
+ }
+ return AjaxResult.success(users.put(user.getUserId(), user));
+ }
+
+ @ApiOperation("更新用户")
+ @ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
+ @PutMapping("/update")
+ public AjaxResult update(UserEntity user)
+ {
+ if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
+ {
+ return error("用户ID不能为空");
+ }
+ if (users.isEmpty() || !users.containsKey(user.getUserId()))
+ {
+ return error("用户不存在");
+ }
+ users.remove(user.getUserId());
+ return AjaxResult.success(users.put(user.getUserId(), user));
+ }
+
+ @ApiOperation("删除用户信息")
+ @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
+ @DeleteMapping("/{userId}")
+ public AjaxResult delete(@PathVariable Integer userId)
+ {
+ if (!users.isEmpty() && users.containsKey(userId))
+ {
+ users.remove(userId);
+ return success();
+ }
+ else
+ {
+ return error("用户不存在");
+ }
+ }
+}
+
+@ApiModel("用户实体")
+class UserEntity
+{
+ @ApiModelProperty("用户ID")
+ private Integer userId;
+
+ @ApiModelProperty("用户名称")
+ private String username;
+
+ @ApiModelProperty("用户密码")
+ private String password;
+
+ @ApiModelProperty("用户手机")
+ private String mobile;
+
+ public UserEntity()
+ {
+
+ }
+
+ public UserEntity(Integer userId, String username, String password, String mobile)
+ {
+ this.userId = userId;
+ this.username = username;
+ this.password = password;
+ this.mobile = mobile;
+ }
+
+ public Integer getUserId()
+ {
+ return userId;
+ }
+
+ public void setUserId(Integer userId)
+ {
+ this.userId = userId;
+ }
+
+ public String getUsername()
+ {
+ return username;
+ }
+
+ public void setUsername(String username)
+ {
+ this.username = username;
+ }
+
+ public String getPassword()
+ {
+ return password;
+ }
+
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
+
+ public String getMobile()
+ {
+ return mobile;
+ }
+
+ public void setMobile(String mobile)
+ {
+ this.mobile = mobile;
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java
index f0dad1cda..1105c2749 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java
@@ -1,69 +1,69 @@
-package com.ruoyi.web.core.config;
-
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import com.ruoyi.common.config.Global;
-import io.swagger.annotations.ApiOperation;
-import springfox.documentation.builders.ApiInfoBuilder;
-import springfox.documentation.builders.PathSelectors;
-import springfox.documentation.builders.RequestHandlerSelectors;
-import springfox.documentation.service.ApiInfo;
-import springfox.documentation.service.Contact;
-import springfox.documentation.spi.DocumentationType;
-import springfox.documentation.spring.web.plugins.Docket;
-import springfox.documentation.swagger2.annotations.EnableSwagger2;
-
-/**
- * Swagger2的接口配置
- *
- * @author ruoyi
- */
-@Configuration
-@EnableSwagger2
-public class SwaggerConfig
-{
- /** 是否开启swagger */
- @Value("${swagger.enabled}")
- private boolean enabled;
-
- /**
- * 创建API
- */
- @Bean
- public Docket createRestApi()
- {
- return new Docket(DocumentationType.SWAGGER_2)
- // 是否启用Swagger
- .enable(enabled)
- // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息)
- .apiInfo(apiInfo())
- // 设置哪些接口暴露给Swagger展示
- .select()
- // 扫描所有有注解的api,用这种方式更灵活
- .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
- // 扫描指定包中的swagger注解
- //.apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger"))
- // 扫描所有 .apis(RequestHandlerSelectors.any())
- .paths(PathSelectors.any())
- .build();
- }
-
- /**
- * 添加摘要信息
- */
- private ApiInfo apiInfo()
- {
- // 用ApiInfoBuilder进行定制
- return new ApiInfoBuilder()
- // 设置标题
- .title("标题:若依管理系统_接口文档")
- // 描述
- .description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
- // 作者信息
- .contact(new Contact(Global.getName(), null, null))
- // 版本
- .version("版本号:" + Global.getVersion())
- .build();
- }
-}
+package com.ruoyi.web.core.config;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import com.ruoyi.common.config.Global;
+import io.swagger.annotations.ApiOperation;
+import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.builders.PathSelectors;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.service.Contact;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+/**
+ * Swagger2的接口配置
+ *
+ * @author ruoyi
+ */
+@Configuration
+@EnableSwagger2
+public class SwaggerConfig
+{
+ /** 是否开启swagger */
+ @Value("${swagger.enabled}")
+ private boolean enabled;
+
+ /**
+ * 创建API
+ */
+ @Bean
+ public Docket createRestApi()
+ {
+ return new Docket(DocumentationType.SWAGGER_2)
+ // 是否启用Swagger
+ .enable(enabled)
+ // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息)
+ .apiInfo(apiInfo())
+ // 设置哪些接口暴露给Swagger展示
+ .select()
+ // 扫描所有有注解的api,用这种方式更灵活
+ .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
+ // 扫描指定包中的swagger注解
+ //.apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger"))
+ // 扫描所有 .apis(RequestHandlerSelectors.any())
+ .paths(PathSelectors.any())
+ .build();
+ }
+
+ /**
+ * 添加摘要信息
+ */
+ private ApiInfo apiInfo()
+ {
+ // 用ApiInfoBuilder进行定制
+ return new ApiInfoBuilder()
+ // 设置标题
+ .title("标题:若依管理系统_接口文档")
+ // 描述
+ .description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
+ // 作者信息
+ .contact(new Contact(Global.getName(), null, null))
+ // 版本
+ .version("版本号:" + Global.getVersion())
+ .build();
+ }
+}
diff --git a/ruoyi-alg/pom.xml b/ruoyi-alg/pom.xml
new file mode 100644
index 000000000..ea6050ac6
--- /dev/null
+++ b/ruoyi-alg/pom.xml
@@ -0,0 +1,15 @@
+
+
+
+ ruoyi
+ com.ruoyi
+ 4.3.1
+
+ 4.0.0
+
+ ruoyi-alg
+
+
+
\ No newline at end of file
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataScope.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataScope.java
index fe5a01f55..176878e9d 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataScope.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataScope.java
@@ -1,28 +1,28 @@
-package com.ruoyi.common.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * 数据权限过滤注解
- *
- * @author ruoyi
- */
-@Target(ElementType.METHOD)
-@Retention(RetentionPolicy.RUNTIME)
-@Documented
-public @interface DataScope
-{
- /**
- * 部门表的别名
- */
- public String deptAlias() default "";
-
- /**
- * 用户表的别名
- */
- public String userAlias() default "";
-}
+package com.ruoyi.common.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * 数据权限过滤注解
+ *
+ * @author ruoyi
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface DataScope
+{
+ /**
+ * 部门表的别名
+ */
+ public String deptAlias() default "";
+
+ /**
+ * 用户表的别名
+ */
+ public String userAlias() default "";
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataSource.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataSource.java
index 6b41ee739..79cd191f8 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataSource.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataSource.java
@@ -1,28 +1,28 @@
-package com.ruoyi.common.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import com.ruoyi.common.enums.DataSourceType;
-
-/**
- * 自定义多数据源切换注解
- *
- * 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准
- *
- * @author ruoyi
- */
-@Target({ ElementType.METHOD, ElementType.TYPE })
-@Retention(RetentionPolicy.RUNTIME)
-@Documented
-@Inherited
-public @interface DataSource
-{
- /**
- * 切换数据源名称
- */
- public DataSourceType value() default DataSourceType.MASTER;
-}
+package com.ruoyi.common.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import com.ruoyi.common.enums.DataSourceType;
+
+/**
+ * 自定义多数据源切换注解
+ *
+ * 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准
+ *
+ * @author ruoyi
+ */
+@Target({ ElementType.METHOD, ElementType.TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@Inherited
+public @interface DataSource
+{
+ /**
+ * 切换数据源名称
+ */
+ public DataSourceType value() default DataSourceType.MASTER;
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java
index 4a30cc557..b32b10f2d 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java
@@ -1,123 +1,123 @@
-package com.ruoyi.common.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * 自定义导出Excel数据注解
- *
- * @author ruoyi
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.FIELD)
-public @interface Excel
-{
- /**
- * 导出到Excel中的名字.
- */
- public String name() default "";
-
- /**
- * 日期格式, 如: yyyy-MM-dd
- */
- public String dateFormat() default "";
-
- /**
- * 如果是字典类型,请设置字典的type值 (如: sys_user_sex)
- */
- public String dictType() default "";
-
- /**
- * 读取内容转表达式 (如: 0=男,1=女,2=未知)
- */
- public String readConverterExp() default "";
-
- /**
- * 分隔符,读取字符串组内容
- */
- public String separator() default ",";
-
- /**
- * 导出类型(0数字 1字符串)
- */
- public ColumnType cellType() default ColumnType.STRING;
-
- /**
- * 导出时在excel中每个列的高度 单位为字符
- */
- public double height() default 14;
-
- /**
- * 导出时在excel中每个列的宽 单位为字符
- */
- public double width() default 16;
-
- /**
- * 文字后缀,如% 90 变成90%
- */
- public String suffix() default "";
-
- /**
- * 当值为空时,字段的默认值
- */
- public String defaultValue() default "";
-
- /**
- * 提示信息
- */
- public String prompt() default "";
-
- /**
- * 设置只能选择不能输入的列内容.
- */
- public String[] combo() default {};
-
- /**
- * 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
- */
- public boolean isExport() default true;
-
- /**
- * 另一个类中的属性名称,支持多级获取,以小数点隔开
- */
- public String targetAttr() default "";
-
- /**
- * 字段类型(0:导出导入;1:仅导出;2:仅导入)
- */
- Type type() default Type.ALL;
-
- public enum Type
- {
- ALL(0), EXPORT(1), IMPORT(2);
- private final int value;
-
- Type(int value)
- {
- this.value = value;
- }
-
- public int value()
- {
- return this.value;
- }
- }
-
- public enum ColumnType
- {
- NUMERIC(0), STRING(1);
- private final int value;
-
- ColumnType(int value)
- {
- this.value = value;
- }
-
- public int value()
- {
- return this.value;
- }
- }
+package com.ruoyi.common.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * 自定义导出Excel数据注解
+ *
+ * @author ruoyi
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface Excel
+{
+ /**
+ * 导出到Excel中的名字.
+ */
+ public String name() default "";
+
+ /**
+ * 日期格式, 如: yyyy-MM-dd
+ */
+ public String dateFormat() default "";
+
+ /**
+ * 如果是字典类型,请设置字典的type值 (如: sys_user_sex)
+ */
+ public String dictType() default "";
+
+ /**
+ * 读取内容转表达式 (如: 0=男,1=女,2=未知)
+ */
+ public String readConverterExp() default "";
+
+ /**
+ * 分隔符,读取字符串组内容
+ */
+ public String separator() default ",";
+
+ /**
+ * 导出类型(0数字 1字符串)
+ */
+ public ColumnType cellType() default ColumnType.STRING;
+
+ /**
+ * 导出时在excel中每个列的高度 单位为字符
+ */
+ public double height() default 14;
+
+ /**
+ * 导出时在excel中每个列的宽 单位为字符
+ */
+ public double width() default 16;
+
+ /**
+ * 文字后缀,如% 90 变成90%
+ */
+ public String suffix() default "";
+
+ /**
+ * 当值为空时,字段的默认值
+ */
+ public String defaultValue() default "";
+
+ /**
+ * 提示信息
+ */
+ public String prompt() default "";
+
+ /**
+ * 设置只能选择不能输入的列内容.
+ */
+ public String[] combo() default {};
+
+ /**
+ * 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
+ */
+ public boolean isExport() default true;
+
+ /**
+ * 另一个类中的属性名称,支持多级获取,以小数点隔开
+ */
+ public String targetAttr() default "";
+
+ /**
+ * 字段类型(0:导出导入;1:仅导出;2:仅导入)
+ */
+ Type type() default Type.ALL;
+
+ public enum Type
+ {
+ ALL(0), EXPORT(1), IMPORT(2);
+ private final int value;
+
+ Type(int value)
+ {
+ this.value = value;
+ }
+
+ public int value()
+ {
+ return this.value;
+ }
+ }
+
+ public enum ColumnType
+ {
+ NUMERIC(0), STRING(1);
+ private final int value;
+
+ ColumnType(int value)
+ {
+ this.value = value;
+ }
+
+ public int value()
+ {
+ return this.value;
+ }
+ }
}
\ No newline at end of file
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Log.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Log.java
index 8982f07be..157ecff6b 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Log.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Log.java
@@ -1,40 +1,40 @@
-package com.ruoyi.common.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.common.enums.OperatorType;
-
-/**
- * 自定义操作日志记录注解
- *
- * @author ruoyi
- */
-@Target({ ElementType.PARAMETER, ElementType.METHOD })
-@Retention(RetentionPolicy.RUNTIME)
-@Documented
-public @interface Log
-{
- /**
- * 模块
- */
- public String title() default "";
-
- /**
- * 功能
- */
- public BusinessType businessType() default BusinessType.OTHER;
-
- /**
- * 操作人类别
- */
- public OperatorType operatorType() default OperatorType.MANAGE;
-
- /**
- * 是否保存请求的参数
- */
- public boolean isSaveRequestData() default true;
-}
+package com.ruoyi.common.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.enums.OperatorType;
+
+/**
+ * 自定义操作日志记录注解
+ *
+ * @author ruoyi
+ */
+@Target({ ElementType.PARAMETER, ElementType.METHOD })
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface Log
+{
+ /**
+ * 模块
+ */
+ public String title() default "";
+
+ /**
+ * 功能
+ */
+ public BusinessType businessType() default BusinessType.OTHER;
+
+ /**
+ * 操作人类别
+ */
+ public OperatorType operatorType() default OperatorType.MANAGE;
+
+ /**
+ * 是否保存请求的参数
+ */
+ public boolean isSaveRequestData() default true;
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/Global.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/Global.java
index 34a47fa0c..d1f04c8fd 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/config/Global.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/Global.java
@@ -1,116 +1,116 @@
-package com.ruoyi.common.config;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.stereotype.Component;
-
-/**
- * 全局配置类
- *
- * @author ruoyi
- */
-@Component
-@ConfigurationProperties(prefix = "ruoyi")
-public class Global
-{
- /** 项目名称 */
- private static String name;
-
- /** 版本 */
- private static String version;
-
- /** 版权年份 */
- private static String copyrightYear;
-
- /** 实例演示开关 */
- private static boolean demoEnabled;
-
- /** 上传路径 */
- private static String profile;
-
- /** 获取地址开关 */
- private static boolean addressEnabled;
-
- public static String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- Global.name = name;
- }
-
- public static String getVersion()
- {
- return version;
- }
-
- public void setVersion(String version)
- {
- Global.version = version;
- }
-
- public static String getCopyrightYear()
- {
- return copyrightYear;
- }
-
- public void setCopyrightYear(String copyrightYear)
- {
- Global.copyrightYear = copyrightYear;
- }
-
- public static boolean isDemoEnabled()
- {
- return demoEnabled;
- }
-
- public void setDemoEnabled(boolean demoEnabled)
- {
- Global.demoEnabled = demoEnabled;
- }
-
- public static String getProfile()
- {
- return profile;
- }
-
- public void setProfile(String profile)
- {
- Global.profile = profile;
- }
-
- public static boolean isAddressEnabled()
- {
- return addressEnabled;
- }
-
- public void setAddressEnabled(boolean addressEnabled)
- {
- Global.addressEnabled = addressEnabled;
- }
-
- /**
- * 获取头像上传路径
- */
- public static String getAvatarPath()
- {
- return getProfile() + "/avatar";
- }
-
- /**
- * 获取下载路径
- */
- public static String getDownloadPath()
- {
- return getProfile() + "/download/";
- }
-
- /**
- * 获取上传路径
- */
- public static String getUploadPath()
- {
- return getProfile() + "/upload";
- }
-}
+package com.ruoyi.common.config;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+/**
+ * 全局配置类
+ *
+ * @author ruoyi
+ */
+@Component
+@ConfigurationProperties(prefix = "ruoyi")
+public class Global
+{
+ /** 项目名称 */
+ private static String name;
+
+ /** 版本 */
+ private static String version;
+
+ /** 版权年份 */
+ private static String copyrightYear;
+
+ /** 实例演示开关 */
+ private static boolean demoEnabled;
+
+ /** 上传路径 */
+ private static String profile;
+
+ /** 获取地址开关 */
+ private static boolean addressEnabled;
+
+ public static String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ Global.name = name;
+ }
+
+ public static String getVersion()
+ {
+ return version;
+ }
+
+ public void setVersion(String version)
+ {
+ Global.version = version;
+ }
+
+ public static String getCopyrightYear()
+ {
+ return copyrightYear;
+ }
+
+ public void setCopyrightYear(String copyrightYear)
+ {
+ Global.copyrightYear = copyrightYear;
+ }
+
+ public static boolean isDemoEnabled()
+ {
+ return demoEnabled;
+ }
+
+ public void setDemoEnabled(boolean demoEnabled)
+ {
+ Global.demoEnabled = demoEnabled;
+ }
+
+ public static String getProfile()
+ {
+ return profile;
+ }
+
+ public void setProfile(String profile)
+ {
+ Global.profile = profile;
+ }
+
+ public static boolean isAddressEnabled()
+ {
+ return addressEnabled;
+ }
+
+ public void setAddressEnabled(boolean addressEnabled)
+ {
+ Global.addressEnabled = addressEnabled;
+ }
+
+ /**
+ * 获取头像上传路径
+ */
+ public static String getAvatarPath()
+ {
+ return getProfile() + "/avatar";
+ }
+
+ /**
+ * 获取下载路径
+ */
+ public static String getDownloadPath()
+ {
+ return getProfile() + "/download/";
+ }
+
+ /**
+ * 获取上传路径
+ */
+ public static String getUploadPath()
+ {
+ return getProfile() + "/upload";
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/ServerConfig.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/ServerConfig.java
index ddb873097..b6b35e481 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/config/ServerConfig.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/ServerConfig.java
@@ -1,33 +1,33 @@
-package com.ruoyi.common.config;
-
-import javax.servlet.http.HttpServletRequest;
-import org.springframework.stereotype.Component;
-import com.ruoyi.common.utils.ServletUtils;
-
-/**
- * 服务相关配置
- *
- * @author ruoyi
- *
- */
-@Component
-public class ServerConfig
-{
- /**
- * 获取完整的请求路径,包括:域名,端口,上下文访问路径
- *
- * @return 服务地址
- */
- public String getUrl()
- {
- HttpServletRequest request = ServletUtils.getRequest();
- return getDomain(request);
- }
-
- public static String getDomain(HttpServletRequest request)
- {
- StringBuffer url = request.getRequestURL();
- String contextPath = request.getServletContext().getContextPath();
- return url.delete(url.length() - request.getRequestURI().length(), url.length()).append(contextPath).toString();
- }
-}
+package com.ruoyi.common.config;
+
+import javax.servlet.http.HttpServletRequest;
+import org.springframework.stereotype.Component;
+import com.ruoyi.common.utils.ServletUtils;
+
+/**
+ * 服务相关配置
+ *
+ * @author ruoyi
+ *
+ */
+@Component
+public class ServerConfig
+{
+ /**
+ * 获取完整的请求路径,包括:域名,端口,上下文访问路径
+ *
+ * @return 服务地址
+ */
+ public String getUrl()
+ {
+ HttpServletRequest request = ServletUtils.getRequest();
+ return getDomain(request);
+ }
+
+ public static String getDomain(HttpServletRequest request)
+ {
+ StringBuffer url = request.getRequestURL();
+ String contextPath = request.getServletContext().getContextPath();
+ return url.delete(url.length() - request.getRequestURI().length(), url.length()).append(contextPath).toString();
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/datasource/DynamicDataSourceContextHolder.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/datasource/DynamicDataSourceContextHolder.java
index 6bc9e6178..6937dca75 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/config/datasource/DynamicDataSourceContextHolder.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/datasource/DynamicDataSourceContextHolder.java
@@ -1,45 +1,45 @@
-package com.ruoyi.common.config.datasource;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * 数据源切换处理
- *
- * @author ruoyi
- */
-public class DynamicDataSourceContextHolder
-{
- public static final Logger log = LoggerFactory.getLogger(DynamicDataSourceContextHolder.class);
-
- /**
- * 使用ThreadLocal维护变量,ThreadLocal为每个使用该变量的线程提供独立的变量副本,
- * 所以每一个线程都可以独立地改变自己的副本,而不会影响其它线程所对应的副本。
- */
- private static final ThreadLocal CONTEXT_HOLDER = new ThreadLocal<>();
-
- /**
- * 设置数据源的变量
- */
- public static void setDataSourceType(String dsType)
- {
- log.info("切换到{}数据源", dsType);
- CONTEXT_HOLDER.set(dsType);
- }
-
- /**
- * 获得数据源的变量
- */
- public static String getDataSourceType()
- {
- return CONTEXT_HOLDER.get();
- }
-
- /**
- * 清空数据源变量
- */
- public static void clearDataSourceType()
- {
- CONTEXT_HOLDER.remove();
- }
-}
+package com.ruoyi.common.config.datasource;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * 数据源切换处理
+ *
+ * @author ruoyi
+ */
+public class DynamicDataSourceContextHolder
+{
+ public static final Logger log = LoggerFactory.getLogger(DynamicDataSourceContextHolder.class);
+
+ /**
+ * 使用ThreadLocal维护变量,ThreadLocal为每个使用该变量的线程提供独立的变量副本,
+ * 所以每一个线程都可以独立地改变自己的副本,而不会影响其它线程所对应的副本。
+ */
+ private static final ThreadLocal CONTEXT_HOLDER = new ThreadLocal<>();
+
+ /**
+ * 设置数据源的变量
+ */
+ public static void setDataSourceType(String dsType)
+ {
+ log.info("切换到{}数据源", dsType);
+ CONTEXT_HOLDER.set(dsType);
+ }
+
+ /**
+ * 获得数据源的变量
+ */
+ public static String getDataSourceType()
+ {
+ return CONTEXT_HOLDER.get();
+ }
+
+ /**
+ * 清空数据源变量
+ */
+ public static void clearDataSourceType()
+ {
+ CONTEXT_HOLDER.remove();
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/thread/ThreadPoolConfig.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/thread/ThreadPoolConfig.java
index 1ff207552..4c63c9f45 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/config/thread/ThreadPoolConfig.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/thread/ThreadPoolConfig.java
@@ -1,62 +1,62 @@
-package com.ruoyi.common.config.thread;
-
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
-import java.util.concurrent.ThreadPoolExecutor;
-import org.apache.commons.lang3.concurrent.BasicThreadFactory;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
-import com.ruoyi.common.utils.Threads;
-
-/**
- * 线程池配置
- *
- * @author ruoyi
- **/
-@Configuration
-public class ThreadPoolConfig
-{
- // 核心线程池大小
- private int corePoolSize = 50;
-
- // 最大可创建的线程数
- private int maxPoolSize = 200;
-
- // 队列最大长度
- private int queueCapacity = 1000;
-
- // 线程池维护线程所允许的空闲时间
- private int keepAliveSeconds = 300;
-
- @Bean(name = "threadPoolTaskExecutor")
- public ThreadPoolTaskExecutor threadPoolTaskExecutor()
- {
- ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
- executor.setMaxPoolSize(maxPoolSize);
- executor.setCorePoolSize(corePoolSize);
- executor.setQueueCapacity(queueCapacity);
- executor.setKeepAliveSeconds(keepAliveSeconds);
- // 线程池对拒绝任务(无线程可用)的处理策略
- executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
- return executor;
- }
-
- /**
- * 执行周期性或定时任务
- */
- @Bean(name = "scheduledExecutorService")
- protected ScheduledExecutorService scheduledExecutorService()
- {
- return new ScheduledThreadPoolExecutor(corePoolSize,
- new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build())
- {
- @Override
- protected void afterExecute(Runnable r, Throwable t)
- {
- super.afterExecute(r, t);
- Threads.printException(r, t);
- }
- };
- }
-}
+package com.ruoyi.common.config.thread;
+
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.ThreadPoolExecutor;
+import org.apache.commons.lang3.concurrent.BasicThreadFactory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+import com.ruoyi.common.utils.Threads;
+
+/**
+ * 线程池配置
+ *
+ * @author ruoyi
+ **/
+@Configuration
+public class ThreadPoolConfig
+{
+ // 核心线程池大小
+ private int corePoolSize = 50;
+
+ // 最大可创建的线程数
+ private int maxPoolSize = 200;
+
+ // 队列最大长度
+ private int queueCapacity = 1000;
+
+ // 线程池维护线程所允许的空闲时间
+ private int keepAliveSeconds = 300;
+
+ @Bean(name = "threadPoolTaskExecutor")
+ public ThreadPoolTaskExecutor threadPoolTaskExecutor()
+ {
+ ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+ executor.setMaxPoolSize(maxPoolSize);
+ executor.setCorePoolSize(corePoolSize);
+ executor.setQueueCapacity(queueCapacity);
+ executor.setKeepAliveSeconds(keepAliveSeconds);
+ // 线程池对拒绝任务(无线程可用)的处理策略
+ executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
+ return executor;
+ }
+
+ /**
+ * 执行周期性或定时任务
+ */
+ @Bean(name = "scheduledExecutorService")
+ protected ScheduledExecutorService scheduledExecutorService()
+ {
+ return new ScheduledThreadPoolExecutor(corePoolSize,
+ new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build())
+ {
+ @Override
+ protected void afterExecute(Runnable r, Throwable t)
+ {
+ super.afterExecute(r, t);
+ Threads.printException(r, t);
+ }
+ };
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java
index 109511b18..66c6da284 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java
@@ -1,94 +1,94 @@
-package com.ruoyi.common.constant;
-
-/**
- * 通用常量信息
- *
- * @author ruoyi
- */
-public class Constants
-{
- /**
- * UTF-8 字符集
- */
- public static final String UTF8 = "UTF-8";
-
- /**
- * GBK 字符集
- */
- public static final String GBK = "GBK";
-
- /**
- * 通用成功标识
- */
- public static final String SUCCESS = "0";
-
- /**
- * 通用失败标识
- */
- public static final String FAIL = "1";
-
- /**
- * 登录成功
- */
- public static final String LOGIN_SUCCESS = "Success";
-
- /**
- * 注销
- */
- public static final String LOGOUT = "Logout";
-
- /**
- * 注册
- */
- public static final String REGISTER = "Register";
-
- /**
- * 登录失败
- */
- public static final String LOGIN_FAIL = "Error";
-
- /**
- * 当前记录起始索引
- */
- public static final String PAGE_NUM = "pageNum";
-
- /**
- * 每页显示记录数
- */
- public static final String PAGE_SIZE = "pageSize";
-
- /**
- * 排序列
- */
- public static final String ORDER_BY_COLUMN = "orderByColumn";
-
- /**
- * 排序的方向 "desc" 或者 "asc".
- */
- public static final String IS_ASC = "isAsc";
-
- /**
- * 参数管理 cache name
- */
- public static final String SYS_CONFIG_CACHE = "sys-config";
-
- /**
- * 参数管理 cache key
- */
- public static final String SYS_CONFIG_KEY = "sys_config:";
-
- /**
- * 字典管理 cache name
- */
- public static final String SYS_DICT_CACHE = "sys-dict";
-
- /**
- * 字典管理 cache key
- */
- public static final String SYS_DICT_KEY = "sys_dict:";
-
- /**
- * 资源映射路径 前缀
- */
- public static final String RESOURCE_PREFIX = "/profile";
-}
+package com.ruoyi.common.constant;
+
+/**
+ * 通用常量信息
+ *
+ * @author ruoyi
+ */
+public class Constants
+{
+ /**
+ * UTF-8 字符集
+ */
+ public static final String UTF8 = "UTF-8";
+
+ /**
+ * GBK 字符集
+ */
+ public static final String GBK = "GBK";
+
+ /**
+ * 通用成功标识
+ */
+ public static final String SUCCESS = "0";
+
+ /**
+ * 通用失败标识
+ */
+ public static final String FAIL = "1";
+
+ /**
+ * 登录成功
+ */
+ public static final String LOGIN_SUCCESS = "Success";
+
+ /**
+ * 注销
+ */
+ public static final String LOGOUT = "Logout";
+
+ /**
+ * 注册
+ */
+ public static final String REGISTER = "Register";
+
+ /**
+ * 登录失败
+ */
+ public static final String LOGIN_FAIL = "Error";
+
+ /**
+ * 当前记录起始索引
+ */
+ public static final String PAGE_NUM = "pageNum";
+
+ /**
+ * 每页显示记录数
+ */
+ public static final String PAGE_SIZE = "pageSize";
+
+ /**
+ * 排序列
+ */
+ public static final String ORDER_BY_COLUMN = "orderByColumn";
+
+ /**
+ * 排序的方向 "desc" 或者 "asc".
+ */
+ public static final String IS_ASC = "isAsc";
+
+ /**
+ * 参数管理 cache name
+ */
+ public static final String SYS_CONFIG_CACHE = "sys-config";
+
+ /**
+ * 参数管理 cache key
+ */
+ public static final String SYS_CONFIG_KEY = "sys_config:";
+
+ /**
+ * 字典管理 cache name
+ */
+ public static final String SYS_DICT_CACHE = "sys-dict";
+
+ /**
+ * 字典管理 cache key
+ */
+ public static final String SYS_DICT_KEY = "sys_dict:";
+
+ /**
+ * 资源映射路径 前缀
+ */
+ public static final String RESOURCE_PREFIX = "/profile";
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java
index ae8ab42ed..0b68873a5 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java
@@ -1,97 +1,97 @@
-package com.ruoyi.common.constant;
-
-/**
- * 代码生成通用常量
- *
- * @author ruoyi
- */
-public class GenConstants
-{
- /** 单表(增删改查) */
- public static final String TPL_CRUD = "crud";
-
- /** 树表(增删改查) */
- public static final String TPL_TREE = "tree";
-
- /** 主子表(增删改查) */
- public static final String TPL_SUB = "sub";
-
- /** 树编码字段 */
- public static final String TREE_CODE = "treeCode";
-
- /** 树父编码字段 */
- public static final String TREE_PARENT_CODE = "treeParentCode";
-
- /** 树名称字段 */
- public static final String TREE_NAME = "treeName";
-
- /** 数据库字符串类型 */
- public static final String[] COLUMNTYPE_STR = { "char", "varchar", "narchar", "varchar2", "tinytext", "text",
- "mediumtext", "longtext" };
-
- /** 数据库时间类型 */
- public static final String[] COLUMNTYPE_TIME = { "datetime", "time", "date", "timestamp" };
-
- /** 数据库数字类型 */
- public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer",
- "bigint", "float", "float", "double", "decimal" };
-
- /** 页面不需要编辑字段 */
- public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" };
-
- /** 页面不需要显示的列表字段 */
- public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by",
- "update_time" };
-
- /** 页面不需要查询字段 */
- public static final String[] COLUMNNAME_NOT_QUERY = { "id", "create_by", "create_time", "del_flag", "update_by",
- "update_time", "remark" };
-
- /** Entity基类字段 */
- public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "remark" };
-
- /** Tree基类字段 */
- public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "ancestors" };
-
- /** 文本框 */
- public static final String HTML_INPUT = "input";
-
- /** 文本域 */
- public static final String HTML_TEXTAREA = "textarea";
-
- /** 下拉框 */
- public static final String HTML_SELECT = "select";
-
- /** 单选框 */
- public static final String HTML_RADIO = "radio";
-
- /** 复选框 */
- public static final String HTML_CHECKBOX = "checkbox";
-
- /** 日期控件 */
- public static final String HTML_DATETIME = "datetime";
-
- /** 字符串类型 */
- public static final String TYPE_STRING = "String";
-
- /** 整型 */
- public static final String TYPE_INTEGER = "Integer";
-
- /** 长整型 */
- public static final String TYPE_LONG = "Long";
-
- /** 浮点型 */
- public static final String TYPE_DOUBLE = "Double";
-
- /** 高精度计算类型 */
- public static final String TYPE_BIGDECIMAL = "BigDecimal";
-
- /** 时间类型 */
- public static final String TYPE_DATE = "Date";
-
- /** 模糊查询 */
- public static final String QUERY_LIKE = "LIKE";
-
- /** 需要 */
- public static final String REQUIRE = "1";
-}
+package com.ruoyi.common.constant;
+
+/**
+ * 代码生成通用常量
+ *
+ * @author ruoyi
+ */
+public class GenConstants
+{
+ /** 单表(增删改查) */
+ public static final String TPL_CRUD = "crud";
+
+ /** 树表(增删改查) */
+ public static final String TPL_TREE = "tree";
+
+ /** 主子表(增删改查) */
+ public static final String TPL_SUB = "sub";
+
+ /** 树编码字段 */
+ public static final String TREE_CODE = "treeCode";
+
+ /** 树父编码字段 */
+ public static final String TREE_PARENT_CODE = "treeParentCode";
+
+ /** 树名称字段 */
+ public static final String TREE_NAME = "treeName";
+
+ /** 数据库字符串类型 */
+ public static final String[] COLUMNTYPE_STR = { "char", "varchar", "narchar", "varchar2", "tinytext", "text",
+ "mediumtext", "longtext" };
+
+ /** 数据库时间类型 */
+ public static final String[] COLUMNTYPE_TIME = { "datetime", "time", "date", "timestamp" };
+
+ /** 数据库数字类型 */
+ public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer",
+ "bigint", "float", "float", "double", "decimal" };
+
+ /** 页面不需要编辑字段 */
+ public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" };
+
+ /** 页面不需要显示的列表字段 */
+ public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by",
+ "update_time" };
+
+ /** 页面不需要查询字段 */
+ public static final String[] COLUMNNAME_NOT_QUERY = { "id", "create_by", "create_time", "del_flag", "update_by",
+ "update_time", "remark" };
+
+ /** Entity基类字段 */
+ public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "remark" };
+
+ /** Tree基类字段 */
+ public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "ancestors" };
+
+ /** 文本框 */
+ public static final String HTML_INPUT = "input";
+
+ /** 文本域 */
+ public static final String HTML_TEXTAREA = "textarea";
+
+ /** 下拉框 */
+ public static final String HTML_SELECT = "select";
+
+ /** 单选框 */
+ public static final String HTML_RADIO = "radio";
+
+ /** 复选框 */
+ public static final String HTML_CHECKBOX = "checkbox";
+
+ /** 日期控件 */
+ public static final String HTML_DATETIME = "datetime";
+
+ /** 字符串类型 */
+ public static final String TYPE_STRING = "String";
+
+ /** 整型 */
+ public static final String TYPE_INTEGER = "Integer";
+
+ /** 长整型 */
+ public static final String TYPE_LONG = "Long";
+
+ /** 浮点型 */
+ public static final String TYPE_DOUBLE = "Double";
+
+ /** 高精度计算类型 */
+ public static final String TYPE_BIGDECIMAL = "BigDecimal";
+
+ /** 时间类型 */
+ public static final String TYPE_DATE = "Date";
+
+ /** 模糊查询 */
+ public static final String QUERY_LIKE = "LIKE";
+
+ /** 需要 */
+ public static final String REQUIRE = "1";
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/PermissionConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/PermissionConstants.java
index 7caf18542..896721454 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/PermissionConstants.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/PermissionConstants.java
@@ -1,27 +1,27 @@
-package com.ruoyi.common.constant;
-
-/**
- * 权限通用常量
- *
- * @author ruoyi
- */
-public class PermissionConstants
-{
- /** 新增权限 */
- public static final String ADD_PERMISSION = "add";
-
- /** 修改权限 */
- public static final String EDIT_PERMISSION = "edit";
-
- /** 删除权限 */
- public static final String REMOVE_PERMISSION = "remove";
-
- /** 导出权限 */
- public static final String EXPORT_PERMISSION = "export";
-
- /** 显示权限 */
- public static final String VIEW_PERMISSION = "view";
-
- /** 查询权限 */
- public static final String LIST_PERMISSION = "list";
-}
+package com.ruoyi.common.constant;
+
+/**
+ * 权限通用常量
+ *
+ * @author ruoyi
+ */
+public class PermissionConstants
+{
+ /** 新增权限 */
+ public static final String ADD_PERMISSION = "add";
+
+ /** 修改权限 */
+ public static final String EDIT_PERMISSION = "edit";
+
+ /** 删除权限 */
+ public static final String REMOVE_PERMISSION = "remove";
+
+ /** 导出权限 */
+ public static final String EXPORT_PERMISSION = "export";
+
+ /** 显示权限 */
+ public static final String VIEW_PERMISSION = "view";
+
+ /** 查询权限 */
+ public static final String LIST_PERMISSION = "list";
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/ScheduleConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/ScheduleConstants.java
index 8318b8f5f..62ad81545 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/ScheduleConstants.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/ScheduleConstants.java
@@ -1,50 +1,50 @@
-package com.ruoyi.common.constant;
-
-/**
- * 任务调度通用常量
- *
- * @author ruoyi
- */
-public class ScheduleConstants
-{
- public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME";
-
- /** 执行目标key */
- public static final String TASK_PROPERTIES = "TASK_PROPERTIES";
-
- /** 默认 */
- public static final String MISFIRE_DEFAULT = "0";
-
- /** 立即触发执行 */
- public static final String MISFIRE_IGNORE_MISFIRES = "1";
-
- /** 触发一次执行 */
- public static final String MISFIRE_FIRE_AND_PROCEED = "2";
-
- /** 不触发立即执行 */
- public static final String MISFIRE_DO_NOTHING = "3";
-
- public enum Status
- {
- /**
- * 正常
- */
- NORMAL("0"),
- /**
- * 暂停
- */
- PAUSE("1");
-
- private String value;
-
- private Status(String value)
- {
- this.value = value;
- }
-
- public String getValue()
- {
- return value;
- }
- }
-}
+package com.ruoyi.common.constant;
+
+/**
+ * 任务调度通用常量
+ *
+ * @author ruoyi
+ */
+public class ScheduleConstants
+{
+ public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME";
+
+ /** 执行目标key */
+ public static final String TASK_PROPERTIES = "TASK_PROPERTIES";
+
+ /** 默认 */
+ public static final String MISFIRE_DEFAULT = "0";
+
+ /** 立即触发执行 */
+ public static final String MISFIRE_IGNORE_MISFIRES = "1";
+
+ /** 触发一次执行 */
+ public static final String MISFIRE_FIRE_AND_PROCEED = "2";
+
+ /** 不触发立即执行 */
+ public static final String MISFIRE_DO_NOTHING = "3";
+
+ public enum Status
+ {
+ /**
+ * 正常
+ */
+ NORMAL("0"),
+ /**
+ * 暂停
+ */
+ PAUSE("1");
+
+ private String value;
+
+ private Status(String value)
+ {
+ this.value = value;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/ShiroConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/ShiroConstants.java
index fa2f5c2fc..2e00a2ab1 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/ShiroConstants.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/ShiroConstants.java
@@ -1,74 +1,74 @@
-package com.ruoyi.common.constant;
-
-/**
- * Shiro通用常量
- *
- * @author ruoyi
- */
-public class ShiroConstants
-{
- /**
- * 当前登录的用户
- */
- public static final String CURRENT_USER = "currentUser";
-
- /**
- * 用户名
- */
- public static final String CURRENT_USERNAME = "username";
-
- /**
- * 消息key
- */
- public static final String MESSAGE = "message";
-
- /**
- * 错误key
- */
- public static final String ERROR = "errorMsg";
-
- /**
- * 编码格式
- */
- public static final String ENCODING = "UTF-8";
-
- /**
- * 当前在线会话
- */
- public static final String ONLINE_SESSION = "online_session";
-
- /**
- * 验证码key
- */
- public static final String CURRENT_CAPTCHA = "captcha";
-
- /**
- * 验证码开关
- */
- public static final String CURRENT_ENABLED = "captchaEnabled";
-
- /**
- * 验证码类型
- */
- public static final String CURRENT_TYPE = "captchaType";
-
- /**
- * 验证码
- */
- public static final String CURRENT_VALIDATECODE = "validateCode";
-
- /**
- * 验证码错误
- */
- public static final String CAPTCHA_ERROR = "captchaError";
-
- /**
- * 登录记录缓存
- */
- public static final String LOGINRECORDCACHE = "loginRecordCache";
-
- /**
- * 系统活跃用户缓存
- */
- public static final String SYS_USERCACHE = "sys-userCache";
-}
+package com.ruoyi.common.constant;
+
+/**
+ * Shiro通用常量
+ *
+ * @author ruoyi
+ */
+public class ShiroConstants
+{
+ /**
+ * 当前登录的用户
+ */
+ public static final String CURRENT_USER = "currentUser";
+
+ /**
+ * 用户名
+ */
+ public static final String CURRENT_USERNAME = "username";
+
+ /**
+ * 消息key
+ */
+ public static final String MESSAGE = "message";
+
+ /**
+ * 错误key
+ */
+ public static final String ERROR = "errorMsg";
+
+ /**
+ * 编码格式
+ */
+ public static final String ENCODING = "UTF-8";
+
+ /**
+ * 当前在线会话
+ */
+ public static final String ONLINE_SESSION = "online_session";
+
+ /**
+ * 验证码key
+ */
+ public static final String CURRENT_CAPTCHA = "captcha";
+
+ /**
+ * 验证码开关
+ */
+ public static final String CURRENT_ENABLED = "captchaEnabled";
+
+ /**
+ * 验证码类型
+ */
+ public static final String CURRENT_TYPE = "captchaType";
+
+ /**
+ * 验证码
+ */
+ public static final String CURRENT_VALIDATECODE = "validateCode";
+
+ /**
+ * 验证码错误
+ */
+ public static final String CAPTCHA_ERROR = "captchaError";
+
+ /**
+ * 登录记录缓存
+ */
+ public static final String LOGINRECORDCACHE = "loginRecordCache";
+
+ /**
+ * 系统活跃用户缓存
+ */
+ public static final String SYS_USERCACHE = "sys-userCache";
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java
index 336652481..b31614169 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java
@@ -1,110 +1,110 @@
-package com.ruoyi.common.constant;
-
-/**
- * 用户常量信息
- *
- * @author ruoyi
- */
-public class UserConstants
-{
- /**
- * 平台内系统用户的唯一标志
- */
- public static final String SYS_USER = "SYS_USER";
-
- /** 正常状态 */
- public static final String NORMAL = "0";
-
- /** 异常状态 */
- public static final String EXCEPTION = "1";
-
- /** 用户封禁状态 */
- public static final String USER_DISABLE = "1";
-
- /** 角色封禁状态 */
- public static final String ROLE_DISABLE = "1";
-
- /** 部门正常状态 */
- public static final String DEPT_NORMAL = "0";
-
- /** 部门停用状态 */
- public static final String DEPT_DISABLE = "1";
-
- /** 字典正常状态 */
- public static final String DICT_NORMAL = "0";
-
- /** 是否为系统默认(是) */
- public static final String YES = "Y";
-
- /**
- * 用户名长度限制
- */
- public static final int USERNAME_MIN_LENGTH = 2;
- public static final int USERNAME_MAX_LENGTH = 20;
-
- /** 登录名称是否唯一的返回结果码 */
- public final static String USER_NAME_UNIQUE = "0";
- public final static String USER_NAME_NOT_UNIQUE = "1";
-
- /** 手机号码是否唯一的返回结果 */
- public final static String USER_PHONE_UNIQUE = "0";
- public final static String USER_PHONE_NOT_UNIQUE = "1";
-
- /** e-mail 是否唯一的返回结果 */
- public final static String USER_EMAIL_UNIQUE = "0";
- public final static String USER_EMAIL_NOT_UNIQUE = "1";
-
- /** 部门名称是否唯一的返回结果码 */
- public final static String DEPT_NAME_UNIQUE = "0";
- public final static String DEPT_NAME_NOT_UNIQUE = "1";
-
- /** 角色名称是否唯一的返回结果码 */
- public final static String ROLE_NAME_UNIQUE = "0";
- public final static String ROLE_NAME_NOT_UNIQUE = "1";
-
- /** 岗位名称是否唯一的返回结果码 */
- public final static String POST_NAME_UNIQUE = "0";
- public final static String POST_NAME_NOT_UNIQUE = "1";
-
- /** 角色权限是否唯一的返回结果码 */
- public final static String ROLE_KEY_UNIQUE = "0";
- public final static String ROLE_KEY_NOT_UNIQUE = "1";
-
- /** 岗位编码是否唯一的返回结果码 */
- public final static String POST_CODE_UNIQUE = "0";
- public final static String POST_CODE_NOT_UNIQUE = "1";
-
- /** 菜单名称是否唯一的返回结果码 */
- public final static String MENU_NAME_UNIQUE = "0";
- public final static String MENU_NAME_NOT_UNIQUE = "1";
-
- /** 字典类型是否唯一的返回结果码 */
- public final static String DICT_TYPE_UNIQUE = "0";
- public final static String DICT_TYPE_NOT_UNIQUE = "1";
-
- /** 参数键名是否唯一的返回结果码 */
- public final static String CONFIG_KEY_UNIQUE = "0";
- public final static String CONFIG_KEY_NOT_UNIQUE = "1";
-
- /**
- * 密码长度限制
- */
- public static final int PASSWORD_MIN_LENGTH = 5;
- public static final int PASSWORD_MAX_LENGTH = 20;
-
- /**
- * 用户类型
- */
- public static final String SYSTEM_USER_TYPE = "00";
- public static final String REGISTER_USER_TYPE = "01";
-
- /**
- * 手机号码格式限制
- */
- public static final String MOBILE_PHONE_NUMBER_PATTERN = "^0{0,1}(13[0-9]|15[0-9]|14[0-9]|18[0-9])[0-9]{8}$";
-
- /**
- * 邮箱格式限制
- */
- public static final String EMAIL_PATTERN = "^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.?";
-}
+package com.ruoyi.common.constant;
+
+/**
+ * 用户常量信息
+ *
+ * @author ruoyi
+ */
+public class UserConstants
+{
+ /**
+ * 平台内系统用户的唯一标志
+ */
+ public static final String SYS_USER = "SYS_USER";
+
+ /** 正常状态 */
+ public static final String NORMAL = "0";
+
+ /** 异常状态 */
+ public static final String EXCEPTION = "1";
+
+ /** 用户封禁状态 */
+ public static final String USER_DISABLE = "1";
+
+ /** 角色封禁状态 */
+ public static final String ROLE_DISABLE = "1";
+
+ /** 部门正常状态 */
+ public static final String DEPT_NORMAL = "0";
+
+ /** 部门停用状态 */
+ public static final String DEPT_DISABLE = "1";
+
+ /** 字典正常状态 */
+ public static final String DICT_NORMAL = "0";
+
+ /** 是否为系统默认(是) */
+ public static final String YES = "Y";
+
+ /**
+ * 用户名长度限制
+ */
+ public static final int USERNAME_MIN_LENGTH = 2;
+ public static final int USERNAME_MAX_LENGTH = 20;
+
+ /** 登录名称是否唯一的返回结果码 */
+ public final static String USER_NAME_UNIQUE = "0";
+ public final static String USER_NAME_NOT_UNIQUE = "1";
+
+ /** 手机号码是否唯一的返回结果 */
+ public final static String USER_PHONE_UNIQUE = "0";
+ public final static String USER_PHONE_NOT_UNIQUE = "1";
+
+ /** e-mail 是否唯一的返回结果 */
+ public final static String USER_EMAIL_UNIQUE = "0";
+ public final static String USER_EMAIL_NOT_UNIQUE = "1";
+
+ /** 部门名称是否唯一的返回结果码 */
+ public final static String DEPT_NAME_UNIQUE = "0";
+ public final static String DEPT_NAME_NOT_UNIQUE = "1";
+
+ /** 角色名称是否唯一的返回结果码 */
+ public final static String ROLE_NAME_UNIQUE = "0";
+ public final static String ROLE_NAME_NOT_UNIQUE = "1";
+
+ /** 岗位名称是否唯一的返回结果码 */
+ public final static String POST_NAME_UNIQUE = "0";
+ public final static String POST_NAME_NOT_UNIQUE = "1";
+
+ /** 角色权限是否唯一的返回结果码 */
+ public final static String ROLE_KEY_UNIQUE = "0";
+ public final static String ROLE_KEY_NOT_UNIQUE = "1";
+
+ /** 岗位编码是否唯一的返回结果码 */
+ public final static String POST_CODE_UNIQUE = "0";
+ public final static String POST_CODE_NOT_UNIQUE = "1";
+
+ /** 菜单名称是否唯一的返回结果码 */
+ public final static String MENU_NAME_UNIQUE = "0";
+ public final static String MENU_NAME_NOT_UNIQUE = "1";
+
+ /** 字典类型是否唯一的返回结果码 */
+ public final static String DICT_TYPE_UNIQUE = "0";
+ public final static String DICT_TYPE_NOT_UNIQUE = "1";
+
+ /** 参数键名是否唯一的返回结果码 */
+ public final static String CONFIG_KEY_UNIQUE = "0";
+ public final static String CONFIG_KEY_NOT_UNIQUE = "1";
+
+ /**
+ * 密码长度限制
+ */
+ public static final int PASSWORD_MIN_LENGTH = 5;
+ public static final int PASSWORD_MAX_LENGTH = 20;
+
+ /**
+ * 用户类型
+ */
+ public static final String SYSTEM_USER_TYPE = "00";
+ public static final String REGISTER_USER_TYPE = "01";
+
+ /**
+ * 手机号码格式限制
+ */
+ public static final String MOBILE_PHONE_NUMBER_PATTERN = "^0{0,1}(13[0-9]|15[0-9]|14[0-9]|18[0-9])[0-9]{8}$";
+
+ /**
+ * 邮箱格式限制
+ */
+ public static final String EMAIL_PATTERN = "^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.?";
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java
index f21285364..23f73e4bc 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java
@@ -1,185 +1,185 @@
-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.Type;
-import com.ruoyi.common.core.page.PageDomain;
-import com.ruoyi.common.core.page.TableDataInfo;
-import com.ruoyi.common.core.page.TableSupport;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.common.utils.ServletUtils;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.common.utils.sql.SqlUtil;
-
-/**
- * web层通用数据处理
- *
- * @author ruoyi
- */
-public class BaseController
-{
- protected final Logger logger = LoggerFactory.getLogger(BaseController.class);
-
- /**
- * 将前台传递过来的日期格式的字符串,自动转化为Date类型
- */
- @InitBinder
- public void initBinder(WebDataBinder binder)
- {
- // Date 类型转换
- binder.registerCustomEditor(Date.class, new PropertyEditorSupport()
- {
- @Override
- public void setAsText(String 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
- */
- public HttpServletRequest getRequest()
- {
- return ServletUtils.getRequest();
- }
-
- /**
- * 获取response
- */
- public HttpServletResponse getResponse()
- {
- return ServletUtils.getResponse();
- }
-
- /**
- * 获取session
- */
- public HttpSession getSession()
- {
- return getRequest().getSession();
- }
-
- /**
- * 响应请求分页数据
- */
- @SuppressWarnings({ "rawtypes", "unchecked" })
- protected TableDataInfo getDataTable(List> list)
- {
- TableDataInfo rspData = new TableDataInfo();
- rspData.setCode(0);
- rspData.setRows(list);
- rspData.setTotal(new PageInfo(list).getTotal());
- return rspData;
- }
-
- /**
- * 响应返回结果
- *
- * @param rows 影响行数
- * @return 操作结果
- */
- protected AjaxResult toAjax(int rows)
- {
- return rows > 0 ? success() : error();
- }
-
- /**
- * 响应返回结果
- *
- * @param result 结果
- * @return 操作结果
- */
- protected AjaxResult toAjax(boolean result)
- {
- return result ? success() : error();
- }
-
- /**
- * 返回成功
- */
- public AjaxResult success()
- {
- return AjaxResult.success();
- }
-
- /**
- * 返回失败消息
- */
- public AjaxResult error()
- {
- return AjaxResult.error();
- }
-
- /**
- * 返回成功消息
- */
- public AjaxResult success(String message)
- {
- return AjaxResult.success(message);
- }
-
- /**
- * 返回失败消息
- */
- public AjaxResult error(String message)
- {
- return AjaxResult.error(message);
- }
-
- /**
- * 返回错误码消息
- */
- public AjaxResult error(Type type, String message)
- {
- return new AjaxResult(type, message);
- }
-
- /**
- * 页面跳转
- */
- public String redirect(String url)
- {
- return StringUtils.format("redirect:{}", url);
- }
-}
+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.Type;
+import com.ruoyi.common.core.page.PageDomain;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.core.page.TableSupport;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.ServletUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.sql.SqlUtil;
+
+/**
+ * web层通用数据处理
+ *
+ * @author ruoyi
+ */
+public class BaseController
+{
+ protected final Logger logger = LoggerFactory.getLogger(BaseController.class);
+
+ /**
+ * 将前台传递过来的日期格式的字符串,自动转化为Date类型
+ */
+ @InitBinder
+ public void initBinder(WebDataBinder binder)
+ {
+ // Date 类型转换
+ binder.registerCustomEditor(Date.class, new PropertyEditorSupport()
+ {
+ @Override
+ public void setAsText(String 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
+ */
+ public HttpServletRequest getRequest()
+ {
+ return ServletUtils.getRequest();
+ }
+
+ /**
+ * 获取response
+ */
+ public HttpServletResponse getResponse()
+ {
+ return ServletUtils.getResponse();
+ }
+
+ /**
+ * 获取session
+ */
+ public HttpSession getSession()
+ {
+ return getRequest().getSession();
+ }
+
+ /**
+ * 响应请求分页数据
+ */
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ protected TableDataInfo getDataTable(List> list)
+ {
+ TableDataInfo rspData = new TableDataInfo();
+ rspData.setCode(0);
+ rspData.setRows(list);
+ rspData.setTotal(new PageInfo(list).getTotal());
+ return rspData;
+ }
+
+ /**
+ * 响应返回结果
+ *
+ * @param rows 影响行数
+ * @return 操作结果
+ */
+ protected AjaxResult toAjax(int rows)
+ {
+ return rows > 0 ? success() : error();
+ }
+
+ /**
+ * 响应返回结果
+ *
+ * @param result 结果
+ * @return 操作结果
+ */
+ protected AjaxResult toAjax(boolean result)
+ {
+ return result ? success() : error();
+ }
+
+ /**
+ * 返回成功
+ */
+ public AjaxResult success()
+ {
+ return AjaxResult.success();
+ }
+
+ /**
+ * 返回失败消息
+ */
+ public AjaxResult error()
+ {
+ return AjaxResult.error();
+ }
+
+ /**
+ * 返回成功消息
+ */
+ public AjaxResult success(String message)
+ {
+ return AjaxResult.success(message);
+ }
+
+ /**
+ * 返回失败消息
+ */
+ public AjaxResult error(String message)
+ {
+ return AjaxResult.error(message);
+ }
+
+ /**
+ * 返回错误码消息
+ */
+ public AjaxResult error(Type type, String message)
+ {
+ return new AjaxResult(type, message);
+ }
+
+ /**
+ * 页面跳转
+ */
+ public String redirect(String url)
+ {
+ return StringUtils.format("redirect:{}", url);
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java
index ef89f5c84..14c9cc412 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java
@@ -1,182 +1,182 @@
-package com.ruoyi.common.core.domain;
-
-import java.util.HashMap;
-import com.ruoyi.common.utils.StringUtils;
-
-/**
- * 操作消息提醒
- *
- * @author ruoyi
- */
-public class AjaxResult extends HashMap
-{
- private static final long serialVersionUID = 1L;
-
- /** 状态码 */
- public static final String CODE_TAG = "code";
-
- /** 返回内容 */
- public static final String MSG_TAG = "msg";
-
- /** 数据对象 */
- public static final String DATA_TAG = "data";
-
- /**
- * 状态类型
- */
- public enum Type
- {
- /** 成功 */
- SUCCESS(0),
- /** 警告 */
- WARN(301),
- /** 错误 */
- ERROR(500);
- private final int value;
-
- Type(int value)
- {
- this.value = value;
- }
-
- public int value()
- {
- return this.value;
- }
- }
-
- /**
- * 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
- */
- public AjaxResult()
- {
- }
-
- /**
- * 初始化一个新创建的 AjaxResult 对象
- *
- * @param type 状态类型
- * @param msg 返回内容
- */
- public AjaxResult(Type type, String msg)
- {
- super.put(CODE_TAG, type.value);
- super.put(MSG_TAG, msg);
- }
-
- /**
- * 初始化一个新创建的 AjaxResult 对象
- *
- * @param type 状态类型
- * @param msg 返回内容
- * @param data 数据对象
- */
- public AjaxResult(Type type, String msg, Object data)
- {
- super.put(CODE_TAG, type.value);
- super.put(MSG_TAG, msg);
- if (StringUtils.isNotNull(data))
- {
- super.put(DATA_TAG, data);
- }
- }
-
- /**
- * 返回成功消息
- *
- * @return 成功消息
- */
- public static AjaxResult success()
- {
- return AjaxResult.success("操作成功");
- }
-
- /**
- * 返回成功数据
- *
- * @return 成功消息
- */
- public static AjaxResult success(Object data)
- {
- return AjaxResult.success("操作成功", data);
- }
-
- /**
- * 返回成功消息
- *
- * @param msg 返回内容
- * @return 成功消息
- */
- public static AjaxResult success(String msg)
- {
- return AjaxResult.success(msg, null);
- }
-
- /**
- * 返回成功消息
- *
- * @param msg 返回内容
- * @param data 数据对象
- * @return 成功消息
- */
- public static AjaxResult success(String msg, Object data)
- {
- return new AjaxResult(Type.SUCCESS, msg, data);
- }
-
- /**
- * 返回警告消息
- *
- * @param msg 返回内容
- * @return 警告消息
- */
- public static AjaxResult warn(String msg)
- {
- return AjaxResult.warn(msg, null);
- }
-
- /**
- * 返回警告消息
- *
- * @param msg 返回内容
- * @param data 数据对象
- * @return 警告消息
- */
- public static AjaxResult warn(String msg, Object data)
- {
- return new AjaxResult(Type.WARN, msg, data);
- }
-
- /**
- * 返回错误消息
- *
- * @return
- */
- public static AjaxResult error()
- {
- return AjaxResult.error("操作失败");
- }
-
- /**
- * 返回错误消息
- *
- * @param msg 返回内容
- * @return 警告消息
- */
- public static AjaxResult error(String msg)
- {
- return AjaxResult.error(msg, null);
- }
-
- /**
- * 返回错误消息
- *
- * @param msg 返回内容
- * @param data 数据对象
- * @return 警告消息
- */
- public static AjaxResult error(String msg, Object data)
- {
- return new AjaxResult(Type.ERROR, msg, data);
- }
-}
+package com.ruoyi.common.core.domain;
+
+import java.util.HashMap;
+import com.ruoyi.common.utils.StringUtils;
+
+/**
+ * 操作消息提醒
+ *
+ * @author ruoyi
+ */
+public class AjaxResult extends HashMap
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 状态码 */
+ public static final String CODE_TAG = "code";
+
+ /** 返回内容 */
+ public static final String MSG_TAG = "msg";
+
+ /** 数据对象 */
+ public static final String DATA_TAG = "data";
+
+ /**
+ * 状态类型
+ */
+ public enum Type
+ {
+ /** 成功 */
+ SUCCESS(0),
+ /** 警告 */
+ WARN(301),
+ /** 错误 */
+ ERROR(500);
+ private final int value;
+
+ Type(int value)
+ {
+ this.value = value;
+ }
+
+ public int value()
+ {
+ return this.value;
+ }
+ }
+
+ /**
+ * 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
+ */
+ public AjaxResult()
+ {
+ }
+
+ /**
+ * 初始化一个新创建的 AjaxResult 对象
+ *
+ * @param type 状态类型
+ * @param msg 返回内容
+ */
+ public AjaxResult(Type type, String msg)
+ {
+ super.put(CODE_TAG, type.value);
+ super.put(MSG_TAG, msg);
+ }
+
+ /**
+ * 初始化一个新创建的 AjaxResult 对象
+ *
+ * @param type 状态类型
+ * @param msg 返回内容
+ * @param data 数据对象
+ */
+ public AjaxResult(Type type, String msg, Object data)
+ {
+ super.put(CODE_TAG, type.value);
+ super.put(MSG_TAG, msg);
+ if (StringUtils.isNotNull(data))
+ {
+ super.put(DATA_TAG, data);
+ }
+ }
+
+ /**
+ * 返回成功消息
+ *
+ * @return 成功消息
+ */
+ public static AjaxResult success()
+ {
+ return AjaxResult.success("操作成功");
+ }
+
+ /**
+ * 返回成功数据
+ *
+ * @return 成功消息
+ */
+ public static AjaxResult success(Object data)
+ {
+ return AjaxResult.success("操作成功", data);
+ }
+
+ /**
+ * 返回成功消息
+ *
+ * @param msg 返回内容
+ * @return 成功消息
+ */
+ public static AjaxResult success(String msg)
+ {
+ return AjaxResult.success(msg, null);
+ }
+
+ /**
+ * 返回成功消息
+ *
+ * @param msg 返回内容
+ * @param data 数据对象
+ * @return 成功消息
+ */
+ public static AjaxResult success(String msg, Object data)
+ {
+ return new AjaxResult(Type.SUCCESS, msg, data);
+ }
+
+ /**
+ * 返回警告消息
+ *
+ * @param msg 返回内容
+ * @return 警告消息
+ */
+ public static AjaxResult warn(String msg)
+ {
+ return AjaxResult.warn(msg, null);
+ }
+
+ /**
+ * 返回警告消息
+ *
+ * @param msg 返回内容
+ * @param data 数据对象
+ * @return 警告消息
+ */
+ public static AjaxResult warn(String msg, Object data)
+ {
+ return new AjaxResult(Type.WARN, msg, data);
+ }
+
+ /**
+ * 返回错误消息
+ *
+ * @return
+ */
+ public static AjaxResult error()
+ {
+ return AjaxResult.error("操作失败");
+ }
+
+ /**
+ * 返回错误消息
+ *
+ * @param msg 返回内容
+ * @return 警告消息
+ */
+ public static AjaxResult error(String msg)
+ {
+ return AjaxResult.error(msg, null);
+ }
+
+ /**
+ * 返回错误消息
+ *
+ * @param msg 返回内容
+ * @param data 数据对象
+ * @return 警告消息
+ */
+ public static AjaxResult error(String msg, Object data)
+ {
+ return new AjaxResult(Type.ERROR, msg, data);
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java
index 0fc68beb5..f7d5bf46d 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java
@@ -1,114 +1,114 @@
-package com.ruoyi.common.core.domain;
-
-import java.io.Serializable;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonFormat;
-
-/**
- * Entity基类
- *
- * @author ruoyi
- */
-public class BaseEntity implements Serializable
-{
- private static final long serialVersionUID = 1L;
-
- /** 搜索值 */
- private String searchValue;
-
- /** 创建者 */
- private String createBy;
-
- /** 创建时间 */
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
- private Date createTime;
-
- /** 更新者 */
- private String updateBy;
-
- /** 更新时间 */
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
- private Date updateTime;
-
- /** 备注 */
- private String remark;
-
- /** 请求参数 */
- private Map params;
-
- public String getSearchValue()
- {
- return searchValue;
- }
-
- public void setSearchValue(String searchValue)
- {
- this.searchValue = searchValue;
- }
-
- public String getCreateBy()
- {
- return createBy;
- }
-
- public void setCreateBy(String createBy)
- {
- this.createBy = createBy;
- }
-
- public Date getCreateTime()
- {
- return createTime;
- }
-
- public void setCreateTime(Date createTime)
- {
- this.createTime = createTime;
- }
-
- public String getUpdateBy()
- {
- return updateBy;
- }
-
- public void setUpdateBy(String updateBy)
- {
- this.updateBy = updateBy;
- }
-
- public Date getUpdateTime()
- {
- return updateTime;
- }
-
- public void setUpdateTime(Date updateTime)
- {
- this.updateTime = updateTime;
- }
-
- public String getRemark()
- {
- return remark;
- }
-
- public void setRemark(String remark)
- {
- this.remark = remark;
- }
-
- public Map getParams()
- {
- if (params == null)
- {
- params = new HashMap<>();
- }
- return params;
- }
-
- public void setParams(Map params)
- {
- this.params = params;
- }
-}
+package com.ruoyi.common.core.domain;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+/**
+ * Entity基类
+ *
+ * @author ruoyi
+ */
+public class BaseEntity implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 搜索值 */
+ private String searchValue;
+
+ /** 创建者 */
+ private String createBy;
+
+ /** 创建时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private Date createTime;
+
+ /** 更新者 */
+ private String updateBy;
+
+ /** 更新时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private Date updateTime;
+
+ /** 备注 */
+ private String remark;
+
+ /** 请求参数 */
+ private Map params;
+
+ public String getSearchValue()
+ {
+ return searchValue;
+ }
+
+ public void setSearchValue(String searchValue)
+ {
+ this.searchValue = searchValue;
+ }
+
+ public String getCreateBy()
+ {
+ return createBy;
+ }
+
+ public void setCreateBy(String createBy)
+ {
+ this.createBy = createBy;
+ }
+
+ public Date getCreateTime()
+ {
+ return createTime;
+ }
+
+ public void setCreateTime(Date createTime)
+ {
+ this.createTime = createTime;
+ }
+
+ public String getUpdateBy()
+ {
+ return updateBy;
+ }
+
+ public void setUpdateBy(String updateBy)
+ {
+ this.updateBy = updateBy;
+ }
+
+ public Date getUpdateTime()
+ {
+ return updateTime;
+ }
+
+ public void setUpdateTime(Date updateTime)
+ {
+ this.updateTime = updateTime;
+ }
+
+ public String getRemark()
+ {
+ return remark;
+ }
+
+ public void setRemark(String remark)
+ {
+ this.remark = remark;
+ }
+
+ public Map getParams()
+ {
+ if (params == null)
+ {
+ params = new HashMap<>();
+ }
+ return params;
+ }
+
+ public void setParams(Map params)
+ {
+ this.params = params;
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/CxSelect.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/CxSelect.java
index 28c123520..3cac0694a 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/CxSelect.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/CxSelect.java
@@ -1,69 +1,69 @@
-package com.ruoyi.common.core.domain;
-
-import java.io.Serializable;
-import java.util.List;
-
-/**
- * CxSelect树结构实体类
- *
- * @author ruoyi
- */
-public class CxSelect implements Serializable
-{
- private static final long serialVersionUID = 1L;
-
- /**
- * 数据值字段名称
- */
- private String v;
-
- /**
- * 数据标题字段名称
- */
- private String n;
-
- /**
- * 子集数据字段名称
- */
- private List s;
-
- public CxSelect()
- {
- }
-
- public CxSelect(String v, String n)
- {
- this.v = v;
- this.n = n;
- }
-
- public List getS()
- {
- return s;
- }
-
- public void setN(String n)
- {
- this.n = n;
- }
-
- public String getN()
- {
- return n;
- }
-
- public void setS(List s)
- {
- this.s = s;
- }
-
- public String getV()
- {
- return v;
- }
-
- public void setV(String v)
- {
- this.v = v;
- }
-}
+package com.ruoyi.common.core.domain;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * CxSelect树结构实体类
+ *
+ * @author ruoyi
+ */
+public class CxSelect implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 数据值字段名称
+ */
+ private String v;
+
+ /**
+ * 数据标题字段名称
+ */
+ private String n;
+
+ /**
+ * 子集数据字段名称
+ */
+ private List s;
+
+ public CxSelect()
+ {
+ }
+
+ public CxSelect(String v, String n)
+ {
+ this.v = v;
+ this.n = n;
+ }
+
+ public List getS()
+ {
+ return s;
+ }
+
+ public void setN(String n)
+ {
+ this.n = n;
+ }
+
+ public String getN()
+ {
+ return n;
+ }
+
+ public void setS(List s)
+ {
+ this.s = s;
+ }
+
+ public String getV()
+ {
+ return v;
+ }
+
+ public void setV(String v)
+ {
+ this.v = v;
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java
index 7a0efe62a..27da2d510 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java
@@ -1,63 +1,63 @@
-package com.ruoyi.common.core.domain;
-
-/**
- * Tree基类
- *
- * @author ruoyi
- */
-public class TreeEntity extends BaseEntity
-{
- private static final long serialVersionUID = 1L;
-
- /** 父菜单名称 */
- private String parentName;
-
- /** 父菜单ID */
- private Long parentId;
-
- /** 显示顺序 */
- private Integer orderNum;
-
- /** 祖级列表 */
- private String ancestors;
-
- public String getParentName()
- {
- return parentName;
- }
-
- public void setParentName(String parentName)
- {
- this.parentName = parentName;
- }
-
- public Long getParentId()
- {
- return parentId;
- }
-
- public void setParentId(Long parentId)
- {
- this.parentId = parentId;
- }
-
- public Integer getOrderNum()
- {
- return orderNum;
- }
-
- public void setOrderNum(Integer orderNum)
- {
- this.orderNum = orderNum;
- }
-
- public String getAncestors()
- {
- return ancestors;
- }
-
- public void setAncestors(String ancestors)
- {
- this.ancestors = ancestors;
- }
+package com.ruoyi.common.core.domain;
+
+/**
+ * Tree基类
+ *
+ * @author ruoyi
+ */
+public class TreeEntity extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 父菜单名称 */
+ private String parentName;
+
+ /** 父菜单ID */
+ private Long parentId;
+
+ /** 显示顺序 */
+ private Integer orderNum;
+
+ /** 祖级列表 */
+ private String ancestors;
+
+ public String getParentName()
+ {
+ return parentName;
+ }
+
+ public void setParentName(String parentName)
+ {
+ this.parentName = parentName;
+ }
+
+ public Long getParentId()
+ {
+ return parentId;
+ }
+
+ public void setParentId(Long parentId)
+ {
+ this.parentId = parentId;
+ }
+
+ public Integer getOrderNum()
+ {
+ return orderNum;
+ }
+
+ public void setOrderNum(Integer orderNum)
+ {
+ this.orderNum = orderNum;
+ }
+
+ public String getAncestors()
+ {
+ return ancestors;
+ }
+
+ public void setAncestors(String ancestors)
+ {
+ this.ancestors = ancestors;
+ }
}
\ No newline at end of file
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/Ztree.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/Ztree.java
index e7fe780e4..5567a4dde 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/Ztree.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/Ztree.java
@@ -1,104 +1,104 @@
-package com.ruoyi.common.core.domain;
-
-import java.io.Serializable;
-
-/**
- * Ztree树结构实体类
- *
- * @author ruoyi
- */
-public class Ztree implements Serializable
-{
- private static final long serialVersionUID = 1L;
-
- /** 节点ID */
- private Long id;
-
- /** 节点父ID */
- private Long pId;
-
- /** 节点名称 */
- private String name;
-
- /** 节点标题 */
- private String title;
-
- /** 是否勾选 */
- private boolean checked = false;
-
- /** 是否展开 */
- private boolean open = false;
-
- /** 是否能勾选 */
- private boolean nocheck = false;
-
- public Long getId()
- {
- return id;
- }
-
- public void setId(Long id)
- {
- this.id = id;
- }
-
- public Long getpId()
- {
- return pId;
- }
-
- public void setpId(Long pId)
- {
- this.pId = pId;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public String getTitle()
- {
- return title;
- }
-
- public void setTitle(String title)
- {
- this.title = title;
- }
-
- public boolean isChecked()
- {
- return checked;
- }
-
- public void setChecked(boolean checked)
- {
- this.checked = checked;
- }
-
- public boolean isOpen()
- {
- return open;
- }
-
- public void setOpen(boolean open)
- {
- this.open = open;
- }
-
- public boolean isNocheck()
- {
- return nocheck;
- }
-
- public void setNocheck(boolean nocheck)
- {
- this.nocheck = nocheck;
- }
-}
+package com.ruoyi.common.core.domain;
+
+import java.io.Serializable;
+
+/**
+ * Ztree树结构实体类
+ *
+ * @author ruoyi
+ */
+public class Ztree implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 节点ID */
+ private Long id;
+
+ /** 节点父ID */
+ private Long pId;
+
+ /** 节点名称 */
+ private String name;
+
+ /** 节点标题 */
+ private String title;
+
+ /** 是否勾选 */
+ private boolean checked = false;
+
+ /** 是否展开 */
+ private boolean open = false;
+
+ /** 是否能勾选 */
+ private boolean nocheck = false;
+
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public Long getpId()
+ {
+ return pId;
+ }
+
+ public void setpId(Long pId)
+ {
+ this.pId = pId;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public void setTitle(String title)
+ {
+ this.title = title;
+ }
+
+ public boolean isChecked()
+ {
+ return checked;
+ }
+
+ public void setChecked(boolean checked)
+ {
+ this.checked = checked;
+ }
+
+ public boolean isOpen()
+ {
+ return open;
+ }
+
+ public void setOpen(boolean open)
+ {
+ this.open = open;
+ }
+
+ public boolean isNocheck()
+ {
+ return nocheck;
+ }
+
+ public void setNocheck(boolean nocheck)
+ {
+ this.nocheck = nocheck;
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageDomain.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageDomain.java
index e6dd98e22..26a069c59 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageDomain.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageDomain.java
@@ -1,72 +1,72 @@
-package com.ruoyi.common.core.page;
-
-import com.ruoyi.common.utils.StringUtils;
-
-/**
- * 分页数据
- *
- * @author ruoyi
- */
-public class PageDomain
-{
- /** 当前记录起始索引 */
- private Integer pageNum;
-
- /** 每页显示记录数 */
- private Integer pageSize;
-
- /** 排序列 */
- private String orderByColumn;
-
- /** 排序的方向 "desc" 或者 "asc". */
- private String isAsc;
-
- public String getOrderBy()
- {
- if (StringUtils.isEmpty(orderByColumn))
- {
- return "";
- }
- return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc;
- }
-
- public Integer getPageNum()
- {
- return pageNum;
- }
-
- public void setPageNum(Integer pageNum)
- {
- this.pageNum = pageNum;
- }
-
- public Integer getPageSize()
- {
- return pageSize;
- }
-
- public void setPageSize(Integer pageSize)
- {
- this.pageSize = pageSize;
- }
-
- public String getOrderByColumn()
- {
- return orderByColumn;
- }
-
- public void setOrderByColumn(String orderByColumn)
- {
- this.orderByColumn = orderByColumn;
- }
-
- public String getIsAsc()
- {
- return isAsc;
- }
-
- public void setIsAsc(String isAsc)
- {
- this.isAsc = isAsc;
- }
-}
+package com.ruoyi.common.core.page;
+
+import com.ruoyi.common.utils.StringUtils;
+
+/**
+ * 分页数据
+ *
+ * @author ruoyi
+ */
+public class PageDomain
+{
+ /** 当前记录起始索引 */
+ private Integer pageNum;
+
+ /** 每页显示记录数 */
+ private Integer pageSize;
+
+ /** 排序列 */
+ private String orderByColumn;
+
+ /** 排序的方向 "desc" 或者 "asc". */
+ private String isAsc;
+
+ public String getOrderBy()
+ {
+ if (StringUtils.isEmpty(orderByColumn))
+ {
+ return "";
+ }
+ return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc;
+ }
+
+ public Integer getPageNum()
+ {
+ return pageNum;
+ }
+
+ public void setPageNum(Integer pageNum)
+ {
+ this.pageNum = pageNum;
+ }
+
+ public Integer getPageSize()
+ {
+ return pageSize;
+ }
+
+ public void setPageSize(Integer pageSize)
+ {
+ this.pageSize = pageSize;
+ }
+
+ public String getOrderByColumn()
+ {
+ return orderByColumn;
+ }
+
+ public void setOrderByColumn(String orderByColumn)
+ {
+ this.orderByColumn = orderByColumn;
+ }
+
+ public String getIsAsc()
+ {
+ return isAsc;
+ }
+
+ public void setIsAsc(String isAsc)
+ {
+ this.isAsc = isAsc;
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java
index 29f60e7fc..373e59283 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java
@@ -1,85 +1,85 @@
-package com.ruoyi.common.core.page;
-
-import java.io.Serializable;
-import java.util.List;
-
-/**
- * 表格分页数据对象
- *
- * @author ruoyi
- */
-public class TableDataInfo implements Serializable
-{
- private static final long serialVersionUID = 1L;
-
- /** 总记录数 */
- private long total;
-
- /** 列表数据 */
- private List> rows;
-
- /** 消息状态码 */
- private int code;
-
- /** 消息内容 */
- private String msg;
-
- /**
- * 表格数据对象
- */
- public TableDataInfo()
- {
- }
-
- /**
- * 分页
- *
- * @param list 列表数据
- * @param total 总记录数
- */
- public TableDataInfo(List> list, int total)
- {
- this.rows = list;
- this.total = total;
- }
-
- public long getTotal()
- {
- return total;
- }
-
- public void setTotal(long total)
- {
- this.total = total;
- }
-
- public List> getRows()
- {
- return rows;
- }
-
- public void setRows(List> rows)
- {
- this.rows = rows;
- }
-
- public int getCode()
- {
- return code;
- }
-
- public void setCode(int code)
- {
- this.code = code;
- }
-
- public String getMsg()
- {
- return msg;
- }
-
- public void setMsg(String msg)
- {
- this.msg = msg;
- }
+package com.ruoyi.common.core.page;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 表格分页数据对象
+ *
+ * @author ruoyi
+ */
+public class TableDataInfo implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 总记录数 */
+ private long total;
+
+ /** 列表数据 */
+ private List> rows;
+
+ /** 消息状态码 */
+ private int code;
+
+ /** 消息内容 */
+ private String msg;
+
+ /**
+ * 表格数据对象
+ */
+ public TableDataInfo()
+ {
+ }
+
+ /**
+ * 分页
+ *
+ * @param list 列表数据
+ * @param total 总记录数
+ */
+ public TableDataInfo(List> list, int total)
+ {
+ this.rows = list;
+ this.total = total;
+ }
+
+ public long getTotal()
+ {
+ return total;
+ }
+
+ public void setTotal(long total)
+ {
+ this.total = total;
+ }
+
+ public List> getRows()
+ {
+ return rows;
+ }
+
+ public void setRows(List> rows)
+ {
+ this.rows = rows;
+ }
+
+ public int getCode()
+ {
+ return code;
+ }
+
+ public void setCode(int code)
+ {
+ this.code = code;
+ }
+
+ public String getMsg()
+ {
+ return msg;
+ }
+
+ public void setMsg(String msg)
+ {
+ this.msg = msg;
+ }
}
\ No newline at end of file
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableSupport.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableSupport.java
index 0efd82b32..8eab41342 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableSupport.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableSupport.java
@@ -1,30 +1,30 @@
-package com.ruoyi.common.core.page;
-
-import com.ruoyi.common.constant.Constants;
-import com.ruoyi.common.utils.ServletUtils;
-
-/**
- * 表格数据处理
- *
- * @author ruoyi
- */
-public class TableSupport
-{
- /**
- * 封装分页对象
- */
- public static PageDomain getPageDomain()
- {
- PageDomain pageDomain = new PageDomain();
- pageDomain.setPageNum(ServletUtils.getParameterToInt(Constants.PAGE_NUM));
- pageDomain.setPageSize(ServletUtils.getParameterToInt(Constants.PAGE_SIZE));
- pageDomain.setOrderByColumn(ServletUtils.getParameter(Constants.ORDER_BY_COLUMN));
- pageDomain.setIsAsc(ServletUtils.getParameter(Constants.IS_ASC));
- return pageDomain;
- }
-
- public static PageDomain buildPageRequest()
- {
- return getPageDomain();
- }
-}
+package com.ruoyi.common.core.page;
+
+import com.ruoyi.common.constant.Constants;
+import com.ruoyi.common.utils.ServletUtils;
+
+/**
+ * 表格数据处理
+ *
+ * @author ruoyi
+ */
+public class TableSupport
+{
+ /**
+ * 封装分页对象
+ */
+ public static PageDomain getPageDomain()
+ {
+ PageDomain pageDomain = new PageDomain();
+ pageDomain.setPageNum(ServletUtils.getParameterToInt(Constants.PAGE_NUM));
+ pageDomain.setPageSize(ServletUtils.getParameterToInt(Constants.PAGE_SIZE));
+ pageDomain.setOrderByColumn(ServletUtils.getParameter(Constants.ORDER_BY_COLUMN));
+ pageDomain.setIsAsc(ServletUtils.getParameter(Constants.IS_ASC));
+ return pageDomain;
+ }
+
+ public static PageDomain buildPageRequest()
+ {
+ return getPageDomain();
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/text/CharsetKit.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/text/CharsetKit.java
index 8297661af..77b1a79dd 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/text/CharsetKit.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/text/CharsetKit.java
@@ -1,86 +1,86 @@
-package com.ruoyi.common.core.text;
-
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-import com.ruoyi.common.utils.StringUtils;
-
-/**
- * 字符集工具类
- *
- * @author ruoyi
- */
-public class CharsetKit
-{
- /** ISO-8859-1 */
- public static final String ISO_8859_1 = "ISO-8859-1";
- /** UTF-8 */
- public static final String UTF_8 = "UTF-8";
- /** GBK */
- public static final String GBK = "GBK";
-
- /** ISO-8859-1 */
- public static final Charset CHARSET_ISO_8859_1 = Charset.forName(ISO_8859_1);
- /** UTF-8 */
- public static final Charset CHARSET_UTF_8 = Charset.forName(UTF_8);
- /** GBK */
- public static final Charset CHARSET_GBK = Charset.forName(GBK);
-
- /**
- * 转换为Charset对象
- *
- * @param charset 字符集,为空则返回默认字符集
- * @return Charset
- */
- public static Charset charset(String charset)
- {
- return StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset);
- }
-
- /**
- * 转换字符串的字符集编码
- *
- * @param source 字符串
- * @param srcCharset 源字符集,默认ISO-8859-1
- * @param destCharset 目标字符集,默认UTF-8
- * @return 转换后的字符集
- */
- public static String convert(String source, String srcCharset, String destCharset)
- {
- return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset));
- }
-
- /**
- * 转换字符串的字符集编码
- *
- * @param source 字符串
- * @param srcCharset 源字符集,默认ISO-8859-1
- * @param destCharset 目标字符集,默认UTF-8
- * @return 转换后的字符集
- */
- public static String convert(String source, Charset srcCharset, Charset destCharset)
- {
- if (null == srcCharset)
- {
- srcCharset = StandardCharsets.ISO_8859_1;
- }
-
- if (null == destCharset)
- {
- srcCharset = StandardCharsets.UTF_8;
- }
-
- if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset))
- {
- return source;
- }
- return new String(source.getBytes(srcCharset), destCharset);
- }
-
- /**
- * @return 系统字符集编码
- */
- public static String systemCharset()
- {
- return Charset.defaultCharset().name();
- }
-}
+package com.ruoyi.common.core.text;
+
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import com.ruoyi.common.utils.StringUtils;
+
+/**
+ * 字符集工具类
+ *
+ * @author ruoyi
+ */
+public class CharsetKit
+{
+ /** ISO-8859-1 */
+ public static final String ISO_8859_1 = "ISO-8859-1";
+ /** UTF-8 */
+ public static final String UTF_8 = "UTF-8";
+ /** GBK */
+ public static final String GBK = "GBK";
+
+ /** ISO-8859-1 */
+ public static final Charset CHARSET_ISO_8859_1 = Charset.forName(ISO_8859_1);
+ /** UTF-8 */
+ public static final Charset CHARSET_UTF_8 = Charset.forName(UTF_8);
+ /** GBK */
+ public static final Charset CHARSET_GBK = Charset.forName(GBK);
+
+ /**
+ * 转换为Charset对象
+ *
+ * @param charset 字符集,为空则返回默认字符集
+ * @return Charset
+ */
+ public static Charset charset(String charset)
+ {
+ return StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset);
+ }
+
+ /**
+ * 转换字符串的字符集编码
+ *
+ * @param source 字符串
+ * @param srcCharset 源字符集,默认ISO-8859-1
+ * @param destCharset 目标字符集,默认UTF-8
+ * @return 转换后的字符集
+ */
+ public static String convert(String source, String srcCharset, String destCharset)
+ {
+ return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset));
+ }
+
+ /**
+ * 转换字符串的字符集编码
+ *
+ * @param source 字符串
+ * @param srcCharset 源字符集,默认ISO-8859-1
+ * @param destCharset 目标字符集,默认UTF-8
+ * @return 转换后的字符集
+ */
+ public static String convert(String source, Charset srcCharset, Charset destCharset)
+ {
+ if (null == srcCharset)
+ {
+ srcCharset = StandardCharsets.ISO_8859_1;
+ }
+
+ if (null == destCharset)
+ {
+ srcCharset = StandardCharsets.UTF_8;
+ }
+
+ if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset))
+ {
+ return source;
+ }
+ return new String(source.getBytes(srcCharset), destCharset);
+ }
+
+ /**
+ * @return 系统字符集编码
+ */
+ public static String systemCharset()
+ {
+ return Charset.defaultCharset().name();
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/text/Convert.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/text/Convert.java
index 9dd076d04..b17dfdda6 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/text/Convert.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/text/Convert.java
@@ -1,999 +1,999 @@
-package com.ruoyi.common.core.text;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.nio.ByteBuffer;
-import java.nio.charset.Charset;
-import java.text.NumberFormat;
-import java.util.Set;
-import com.ruoyi.common.utils.StringUtils;
-
-/**
- * 类型转换器
- *
- * @author ruoyi
- */
-public class Convert
-{
- /**
- * 转换为字符串
- * 如果给定的值为null,或者转换失败,返回默认值
- * 转换失败不会报错
- *
- * @param value 被转换的值
- * @param defaultValue 转换错误时的默认值
- * @return 结果
- */
- public static String toStr(Object value, String defaultValue)
- {
- if (null == value)
- {
- return defaultValue;
- }
- if (value instanceof String)
- {
- return (String) value;
- }
- return value.toString();
- }
-
- /**
- * 转换为字符串
- * 如果给定的值为null,或者转换失败,返回默认值null
- * 转换失败不会报错
- *
- * @param value 被转换的值
- * @return 结果
- */
- public static String toStr(Object value)
- {
- return toStr(value, null);
- }
-
- /**
- * 转换为字符
- * 如果给定的值为null,或者转换失败,返回默认值
- * 转换失败不会报错
- *
- * @param value 被转换的值
- * @param defaultValue 转换错误时的默认值
- * @return 结果
- */
- public static Character toChar(Object value, Character defaultValue)
- {
- if (null == value)
- {
- return defaultValue;
- }
- if (value instanceof Character)
- {
- return (Character) value;
- }
-
- final String valueStr = toStr(value, null);
- return StringUtils.isEmpty(valueStr) ? defaultValue : valueStr.charAt(0);
- }
-
- /**
- * 转换为字符
- * 如果给定的值为null,或者转换失败,返回默认值null
- * 转换失败不会报错
- *
- * @param value 被转换的值
- * @return 结果
- */
- public static Character toChar(Object value)
- {
- return toChar(value, null);
- }
-
- /**
- * 转换为byte
- * 如果给定的值为null,或者转换失败,返回默认值
- * 转换失败不会报错
- *
- * @param value 被转换的值
- * @param defaultValue 转换错误时的默认值
- * @return 结果
- */
- public static Byte toByte(Object value, Byte defaultValue)
- {
- if (value == null)
- {
- return defaultValue;
- }
- if (value instanceof Byte)
- {
- return (Byte) value;
- }
- if (value instanceof Number)
- {
- return ((Number) value).byteValue();
- }
- final String valueStr = toStr(value, null);
- if (StringUtils.isEmpty(valueStr))
- {
- return defaultValue;
- }
- try
- {
- return Byte.parseByte(valueStr);
- }
- catch (Exception e)
- {
- return defaultValue;
- }
- }
-
- /**
- * 转换为byte
- * 如果给定的值为null,或者转换失败,返回默认值null
- * 转换失败不会报错
- *
- * @param value 被转换的值
- * @return 结果
- */
- public static Byte toByte(Object value)
- {
- return toByte(value, null);
- }
-
- /**
- * 转换为Short
- * 如果给定的值为null,或者转换失败,返回默认值
- * 转换失败不会报错
- *
- * @param value 被转换的值
- * @param defaultValue 转换错误时的默认值
- * @return 结果
- */
- public static Short toShort(Object value, Short defaultValue)
- {
- if (value == null)
- {
- return defaultValue;
- }
- if (value instanceof Short)
- {
- return (Short) value;
- }
- if (value instanceof Number)
- {
- return ((Number) value).shortValue();
- }
- final String valueStr = toStr(value, null);
- if (StringUtils.isEmpty(valueStr))
- {
- return defaultValue;
- }
- try
- {
- return Short.parseShort(valueStr.trim());
- }
- catch (Exception e)
- {
- return defaultValue;
- }
- }
-
- /**
- * 转换为Short
- * 如果给定的值为null,或者转换失败,返回默认值null
- * 转换失败不会报错
- *
- * @param value 被转换的值
- * @return 结果
- */
- public static Short toShort(Object value)
- {
- return toShort(value, null);
- }
-
- /**
- * 转换为Number
- * 如果给定的值为空,或者转换失败,返回默认值
- * 转换失败不会报错
- *
- * @param value 被转换的值
- * @param defaultValue 转换错误时的默认值
- * @return 结果
- */
- public static Number toNumber(Object value, Number defaultValue)
- {
- if (value == null)
- {
- return defaultValue;
- }
- if (value instanceof Number)
- {
- return (Number) value;
- }
- final String valueStr = toStr(value, null);
- if (StringUtils.isEmpty(valueStr))
- {
- return defaultValue;
- }
- try
- {
- return NumberFormat.getInstance().parse(valueStr);
- }
- catch (Exception e)
- {
- return defaultValue;
- }
- }
-
- /**
- * 转换为Number
- * 如果给定的值为空,或者转换失败,返回默认值null
- * 转换失败不会报错
- *
- * @param value 被转换的值
- * @return 结果
- */
- public static Number toNumber(Object value)
- {
- return toNumber(value, null);
- }
-
- /**
- * 转换为int
- * 如果给定的值为空,或者转换失败,返回默认值
- * 转换失败不会报错
- *
- * @param value 被转换的值
- * @param defaultValue 转换错误时的默认值
- * @return 结果
- */
- public static Integer toInt(Object value, Integer defaultValue)
- {
- if (value == null)
- {
- return defaultValue;
- }
- if (value instanceof Integer)
- {
- return (Integer) value;
- }
- if (value instanceof Number)
- {
- return ((Number) value).intValue();
- }
- final String valueStr = toStr(value, null);
- if (StringUtils.isEmpty(valueStr))
- {
- return defaultValue;
- }
- try
- {
- return Integer.parseInt(valueStr.trim());
- }
- catch (Exception e)
- {
- return defaultValue;
- }
- }
-
- /**
- * 转换为int
- * 如果给定的值为null,或者转换失败,返回默认值null
- * 转换失败不会报错
- *
- * @param value 被转换的值
- * @return 结果
- */
- public static Integer toInt(Object value)
- {
- return toInt(value, null);
- }
-
- /**
- * 转换为Integer数组
- *
- * @param str 被转换的值
- * @return 结果
- */
- public static Integer[] toIntArray(String str)
- {
- return toIntArray(",", str);
- }
-
- /**
- * 转换为Long数组
- *
- * @param str 被转换的值
- * @return 结果
- */
- public static Long[] toLongArray(String str)
- {
- return toLongArray(",", str);
- }
-
- /**
- * 转换为Integer数组
- *
- * @param split 分隔符
- * @param split 被转换的值
- * @return 结果
- */
- public static Integer[] toIntArray(String split, String str)
- {
- if (StringUtils.isEmpty(str))
- {
- return new Integer[] {};
- }
- String[] arr = str.split(split);
- final Integer[] ints = new Integer[arr.length];
- for (int i = 0; i < arr.length; i++)
- {
- final Integer v = toInt(arr[i], 0);
- ints[i] = v;
- }
- return ints;
- }
-
- /**
- * 转换为Long数组
- *
- * @param split 分隔符
- * @param str 被转换的值
- * @return 结果
- */
- public static Long[] toLongArray(String split, String str)
- {
- if (StringUtils.isEmpty(str))
- {
- return new Long[] {};
- }
- String[] arr = str.split(split);
- final Long[] longs = new Long[arr.length];
- for (int i = 0; i < arr.length; i++)
- {
- final Long v = toLong(arr[i], null);
- longs[i] = v;
- }
- return longs;
- }
-
- /**
- * 转换为String数组
- *
- * @param str 被转换的值
- * @return 结果
- */
- public static String[] toStrArray(String str)
- {
- return toStrArray(",", str);
- }
-
- /**
- * 转换为String数组
- *
- * @param split 分隔符
- * @param split 被转换的值
- * @return 结果
- */
- public static String[] toStrArray(String split, String str)
- {
- return str.split(split);
- }
-
- /**
- * 转换为long
- * 如果给定的值为空,或者转换失败,返回默认值
- * 转换失败不会报错
- *
- * @param value 被转换的值
- * @param defaultValue 转换错误时的默认值
- * @return 结果
- */
- public static Long toLong(Object value, Long defaultValue)
- {
- if (value == null)
- {
- return defaultValue;
- }
- if (value instanceof Long)
- {
- return (Long) value;
- }
- if (value instanceof Number)
- {
- return ((Number) value).longValue();
- }
- final String valueStr = toStr(value, null);
- if (StringUtils.isEmpty(valueStr))
- {
- return defaultValue;
- }
- try
- {
- // 支持科学计数法
- return new BigDecimal(valueStr.trim()).longValue();
- }
- catch (Exception e)
- {
- return defaultValue;
- }
- }
-
- /**
- * 转换为long
- * 如果给定的值为null,或者转换失败,返回默认值null
- * 转换失败不会报错
- *
- * @param value 被转换的值
- * @return 结果
- */
- public static Long toLong(Object value)
- {
- return toLong(value, null);
- }
-
- /**
- * 转换为double
- * 如果给定的值为空,或者转换失败,返回默认值
- * 转换失败不会报错
- *
- * @param value 被转换的值
- * @param defaultValue 转换错误时的默认值
- * @return 结果
- */
- public static Double toDouble(Object value, Double defaultValue)
- {
- if (value == null)
- {
- return defaultValue;
- }
- if (value instanceof Double)
- {
- return (Double) value;
- }
- if (value instanceof Number)
- {
- return ((Number) value).doubleValue();
- }
- final String valueStr = toStr(value, null);
- if (StringUtils.isEmpty(valueStr))
- {
- return defaultValue;
- }
- try
- {
- // 支持科学计数法
- return new BigDecimal(valueStr.trim()).doubleValue();
- }
- catch (Exception e)
- {
- return defaultValue;
- }
- }
-
- /**
- * 转换为double
- * 如果给定的值为空,或者转换失败,返回默认值null
- * 转换失败不会报错
- *
- * @param value 被转换的值
- * @return 结果
- */
- public static Double toDouble(Object value)
- {
- return toDouble(value, null);
- }
-
- /**
- * 转换为Float
- * 如果给定的值为空,或者转换失败,返回默认值
- * 转换失败不会报错
- *
- * @param value 被转换的值
- * @param defaultValue 转换错误时的默认值
- * @return 结果
- */
- public static Float toFloat(Object value, Float defaultValue)
- {
- if (value == null)
- {
- return defaultValue;
- }
- if (value instanceof Float)
- {
- return (Float) value;
- }
- if (value instanceof Number)
- {
- return ((Number) value).floatValue();
- }
- final String valueStr = toStr(value, null);
- if (StringUtils.isEmpty(valueStr))
- {
- return defaultValue;
- }
- try
- {
- return Float.parseFloat(valueStr.trim());
- }
- catch (Exception e)
- {
- return defaultValue;
- }
- }
-
- /**
- * 转换为Float
- * 如果给定的值为空,或者转换失败,返回默认值null
- * 转换失败不会报错
- *
- * @param value 被转换的值
- * @return 结果
- */
- public static Float toFloat(Object value)
- {
- return toFloat(value, null);
- }
-
- /**
- * 转换为boolean
- * String支持的值为:true、false、yes、ok、no,1,0 如果给定的值为空,或者转换失败,返回默认值
- * 转换失败不会报错
- *
- * @param value 被转换的值
- * @param defaultValue 转换错误时的默认值
- * @return 结果
- */
- public static Boolean toBool(Object value, Boolean defaultValue)
- {
- if (value == null)
- {
- return defaultValue;
- }
- if (value instanceof Boolean)
- {
- return (Boolean) value;
- }
- String valueStr = toStr(value, null);
- if (StringUtils.isEmpty(valueStr))
- {
- return defaultValue;
- }
- valueStr = valueStr.trim().toLowerCase();
- switch (valueStr)
- {
- case "true":
- return true;
- case "false":
- return false;
- case "yes":
- return true;
- case "ok":
- return true;
- case "no":
- return false;
- case "1":
- return true;
- case "0":
- return false;
- default:
- return defaultValue;
- }
- }
-
- /**
- * 转换为boolean
- * 如果给定的值为空,或者转换失败,返回默认值null
- * 转换失败不会报错
- *
- * @param value 被转换的值
- * @return 结果
- */
- public static Boolean toBool(Object value)
- {
- return toBool(value, null);
- }
-
- /**
- * 转换为Enum对象
- * 如果给定的值为空,或者转换失败,返回默认值
- *
- * @param clazz Enum的Class
- * @param value 值
- * @param defaultValue 默认值
- * @return Enum
- */
- public static > E toEnum(Class clazz, Object value, E defaultValue)
- {
- if (value == null)
- {
- return defaultValue;
- }
- if (clazz.isAssignableFrom(value.getClass()))
- {
- @SuppressWarnings("unchecked")
- E myE = (E) value;
- return myE;
- }
- final String valueStr = toStr(value, null);
- if (StringUtils.isEmpty(valueStr))
- {
- return defaultValue;
- }
- try
- {
- return Enum.valueOf(clazz, valueStr);
- }
- catch (Exception e)
- {
- return defaultValue;
- }
- }
-
- /**
- * 转换为Enum对象
- * 如果给定的值为空,或者转换失败,返回默认值null
- *
- * @param clazz Enum的Class
- * @param value 值
- * @return Enum
- */
- public static > E toEnum(Class clazz, Object value)
- {
- return toEnum(clazz, value, null);
- }
-
- /**
- * 转换为BigInteger
- * 如果给定的值为空,或者转换失败,返回默认值
- * 转换失败不会报错
- *
- * @param value 被转换的值
- * @param defaultValue 转换错误时的默认值
- * @return 结果
- */
- public static BigInteger toBigInteger(Object value, BigInteger defaultValue)
- {
- if (value == null)
- {
- return defaultValue;
- }
- if (value instanceof BigInteger)
- {
- return (BigInteger) value;
- }
- if (value instanceof Long)
- {
- return BigInteger.valueOf((Long) value);
- }
- final String valueStr = toStr(value, null);
- if (StringUtils.isEmpty(valueStr))
- {
- return defaultValue;
- }
- try
- {
- return new BigInteger(valueStr);
- }
- catch (Exception e)
- {
- return defaultValue;
- }
- }
-
- /**
- * 转换为BigInteger
- * 如果给定的值为空,或者转换失败,返回默认值null
- * 转换失败不会报错
- *
- * @param value 被转换的值
- * @return 结果
- */
- public static BigInteger toBigInteger(Object value)
- {
- return toBigInteger(value, null);
- }
-
- /**
- * 转换为BigDecimal
- * 如果给定的值为空,或者转换失败,返回默认值
- * 转换失败不会报错
- *
- * @param value 被转换的值
- * @param defaultValue 转换错误时的默认值
- * @return 结果
- */
- public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue)
- {
- if (value == null)
- {
- return defaultValue;
- }
- if (value instanceof BigDecimal)
- {
- return (BigDecimal) value;
- }
- if (value instanceof Long)
- {
- return new BigDecimal((Long) value);
- }
- if (value instanceof Double)
- {
- return new BigDecimal((Double) value);
- }
- if (value instanceof Integer)
- {
- return new BigDecimal((Integer) value);
- }
- final String valueStr = toStr(value, null);
- if (StringUtils.isEmpty(valueStr))
- {
- return defaultValue;
- }
- try
- {
- return new BigDecimal(valueStr);
- }
- catch (Exception e)
- {
- return defaultValue;
- }
- }
-
- /**
- * 转换为BigDecimal
- * 如果给定的值为空,或者转换失败,返回默认值
- * 转换失败不会报错
- *
- * @param value 被转换的值
- * @return 结果
- */
- public static BigDecimal toBigDecimal(Object value)
- {
- return toBigDecimal(value, null);
- }
-
- /**
- * 将对象转为字符串
- * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
- *
- * @param obj 对象
- * @return 字符串
- */
- public static String utf8Str(Object obj)
- {
- return str(obj, CharsetKit.CHARSET_UTF_8);
- }
-
- /**
- * 将对象转为字符串
- * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
- *
- * @param obj 对象
- * @param charsetName 字符集
- * @return 字符串
- */
- public static String str(Object obj, String charsetName)
- {
- return str(obj, Charset.forName(charsetName));
- }
-
- /**
- * 将对象转为字符串
- * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
- *
- * @param obj 对象
- * @param charset 字符集
- * @return 字符串
- */
- public static String str(Object obj, Charset charset)
- {
- if (null == obj)
- {
- return null;
- }
-
- if (obj instanceof String)
- {
- return (String) obj;
- }
- else if (obj instanceof byte[] || obj instanceof Byte[])
- {
- return str((Byte[]) obj, charset);
- }
- else if (obj instanceof ByteBuffer)
- {
- return str((ByteBuffer) obj, charset);
- }
- return obj.toString();
- }
-
- /**
- * 将byte数组转为字符串
- *
- * @param bytes byte数组
- * @param charset 字符集
- * @return 字符串
- */
- public static String str(byte[] bytes, String charset)
- {
- return str(bytes, StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset));
- }
-
- /**
- * 解码字节码
- *
- * @param data 字符串
- * @param charset 字符集,如果此字段为空,则解码的结果取决于平台
- * @return 解码后的字符串
- */
- public static String str(byte[] data, Charset charset)
- {
- if (data == null)
- {
- return null;
- }
-
- if (null == charset)
- {
- return new String(data);
- }
- return new String(data, charset);
- }
-
- /**
- * 将编码的byteBuffer数据转换为字符串
- *
- * @param data 数据
- * @param charset 字符集,如果为空使用当前系统字符集
- * @return 字符串
- */
- public static String str(ByteBuffer data, String charset)
- {
- if (data == null)
- {
- return null;
- }
-
- return str(data, Charset.forName(charset));
- }
-
- /**
- * 将编码的byteBuffer数据转换为字符串
- *
- * @param data 数据
- * @param charset 字符集,如果为空使用当前系统字符集
- * @return 字符串
- */
- public static String str(ByteBuffer data, Charset charset)
- {
- if (null == charset)
- {
- charset = Charset.defaultCharset();
- }
- return charset.decode(data).toString();
- }
-
- // ----------------------------------------------------------------------- 全角半角转换
- /**
- * 半角转全角
- *
- * @param input String.
- * @return 全角字符串.
- */
- public static String toSBC(String input)
- {
- return toSBC(input, null);
- }
-
- /**
- * 半角转全角
- *
- * @param input String
- * @param notConvertSet 不替换的字符集合
- * @return 全角字符串.
- */
- public static String toSBC(String input, Set notConvertSet)
- {
- char c[] = input.toCharArray();
- for (int i = 0; i < c.length; i++)
- {
- if (null != notConvertSet && notConvertSet.contains(c[i]))
- {
- // 跳过不替换的字符
- continue;
- }
-
- if (c[i] == ' ')
- {
- c[i] = '\u3000';
- }
- else if (c[i] < '\177')
- {
- c[i] = (char) (c[i] + 65248);
-
- }
- }
- return new String(c);
- }
-
- /**
- * 全角转半角
- *
- * @param input String.
- * @return 半角字符串
- */
- public static String toDBC(String input)
- {
- return toDBC(input, null);
- }
-
- /**
- * 替换全角为半角
- *
- * @param text 文本
- * @param notConvertSet 不替换的字符集合
- * @return 替换后的字符
- */
- public static String toDBC(String text, Set notConvertSet)
- {
- char c[] = text.toCharArray();
- for (int i = 0; i < c.length; i++)
- {
- if (null != notConvertSet && notConvertSet.contains(c[i]))
- {
- // 跳过不替换的字符
- continue;
- }
-
- if (c[i] == '\u3000')
- {
- c[i] = ' ';
- }
- else if (c[i] > '\uFF00' && c[i] < '\uFF5F')
- {
- c[i] = (char) (c[i] - 65248);
- }
- }
- String returnString = new String(c);
-
- return returnString;
- }
-
- /**
- * 数字金额大写转换 先写个完整的然后将如零拾替换成零
- *
- * @param n 数字
- * @return 中文大写数字
- */
- public static String digitUppercase(double n)
- {
- String[] fraction = { "角", "分" };
- String[] digit = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" };
- String[][] unit = { { "元", "万", "亿" }, { "", "拾", "佰", "仟" } };
-
- String head = n < 0 ? "负" : "";
- n = Math.abs(n);
-
- String s = "";
- for (int i = 0; i < fraction.length; i++)
- {
- s += (digit[(int) (Math.floor(n * 10 * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", "");
- }
- if (s.length() < 1)
- {
- s = "整";
- }
- int integerPart = (int) Math.floor(n);
-
- for (int i = 0; i < unit[0].length && integerPart > 0; i++)
- {
- String p = "";
- for (int j = 0; j < unit[1].length && n > 0; j++)
- {
- p = digit[integerPart % 10] + unit[1][j] + p;
- integerPart = integerPart / 10;
- }
- s = p.replaceAll("(零.)*零$", "").replaceAll("^$", "零") + unit[0][i] + s;
- }
- return head + s.replaceAll("(零.)*零元", "元").replaceFirst("(零.)+", "").replaceAll("(零.)+", "零").replaceAll("^整$", "零元整");
- }
-}
+package com.ruoyi.common.core.text;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
+import java.text.NumberFormat;
+import java.util.Set;
+import com.ruoyi.common.utils.StringUtils;
+
+/**
+ * 类型转换器
+ *
+ * @author ruoyi
+ */
+public class Convert
+{
+ /**
+ * 转换为字符串
+ * 如果给定的值为null,或者转换失败,返回默认值
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @param defaultValue 转换错误时的默认值
+ * @return 结果
+ */
+ public static String toStr(Object value, String defaultValue)
+ {
+ if (null == value)
+ {
+ return defaultValue;
+ }
+ if (value instanceof String)
+ {
+ return (String) value;
+ }
+ return value.toString();
+ }
+
+ /**
+ * 转换为字符串
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @return 结果
+ */
+ public static String toStr(Object value)
+ {
+ return toStr(value, null);
+ }
+
+ /**
+ * 转换为字符
+ * 如果给定的值为null,或者转换失败,返回默认值
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @param defaultValue 转换错误时的默认值
+ * @return 结果
+ */
+ public static Character toChar(Object value, Character defaultValue)
+ {
+ if (null == value)
+ {
+ return defaultValue;
+ }
+ if (value instanceof Character)
+ {
+ return (Character) value;
+ }
+
+ final String valueStr = toStr(value, null);
+ return StringUtils.isEmpty(valueStr) ? defaultValue : valueStr.charAt(0);
+ }
+
+ /**
+ * 转换为字符
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @return 结果
+ */
+ public static Character toChar(Object value)
+ {
+ return toChar(value, null);
+ }
+
+ /**
+ * 转换为byte
+ * 如果给定的值为null,或者转换失败,返回默认值
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @param defaultValue 转换错误时的默认值
+ * @return 结果
+ */
+ public static Byte toByte(Object value, Byte defaultValue)
+ {
+ if (value == null)
+ {
+ return defaultValue;
+ }
+ if (value instanceof Byte)
+ {
+ return (Byte) value;
+ }
+ if (value instanceof Number)
+ {
+ return ((Number) value).byteValue();
+ }
+ final String valueStr = toStr(value, null);
+ if (StringUtils.isEmpty(valueStr))
+ {
+ return defaultValue;
+ }
+ try
+ {
+ return Byte.parseByte(valueStr);
+ }
+ catch (Exception e)
+ {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * 转换为byte
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @return 结果
+ */
+ public static Byte toByte(Object value)
+ {
+ return toByte(value, null);
+ }
+
+ /**
+ * 转换为Short
+ * 如果给定的值为null,或者转换失败,返回默认值
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @param defaultValue 转换错误时的默认值
+ * @return 结果
+ */
+ public static Short toShort(Object value, Short defaultValue)
+ {
+ if (value == null)
+ {
+ return defaultValue;
+ }
+ if (value instanceof Short)
+ {
+ return (Short) value;
+ }
+ if (value instanceof Number)
+ {
+ return ((Number) value).shortValue();
+ }
+ final String valueStr = toStr(value, null);
+ if (StringUtils.isEmpty(valueStr))
+ {
+ return defaultValue;
+ }
+ try
+ {
+ return Short.parseShort(valueStr.trim());
+ }
+ catch (Exception e)
+ {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * 转换为Short
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @return 结果
+ */
+ public static Short toShort(Object value)
+ {
+ return toShort(value, null);
+ }
+
+ /**
+ * 转换为Number
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @param defaultValue 转换错误时的默认值
+ * @return 结果
+ */
+ public static Number toNumber(Object value, Number defaultValue)
+ {
+ if (value == null)
+ {
+ return defaultValue;
+ }
+ if (value instanceof Number)
+ {
+ return (Number) value;
+ }
+ final String valueStr = toStr(value, null);
+ if (StringUtils.isEmpty(valueStr))
+ {
+ return defaultValue;
+ }
+ try
+ {
+ return NumberFormat.getInstance().parse(valueStr);
+ }
+ catch (Exception e)
+ {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * 转换为Number
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @return 结果
+ */
+ public static Number toNumber(Object value)
+ {
+ return toNumber(value, null);
+ }
+
+ /**
+ * 转换为int
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @param defaultValue 转换错误时的默认值
+ * @return 结果
+ */
+ public static Integer toInt(Object value, Integer defaultValue)
+ {
+ if (value == null)
+ {
+ return defaultValue;
+ }
+ if (value instanceof Integer)
+ {
+ return (Integer) value;
+ }
+ if (value instanceof Number)
+ {
+ return ((Number) value).intValue();
+ }
+ final String valueStr = toStr(value, null);
+ if (StringUtils.isEmpty(valueStr))
+ {
+ return defaultValue;
+ }
+ try
+ {
+ return Integer.parseInt(valueStr.trim());
+ }
+ catch (Exception e)
+ {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * 转换为int
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @return 结果
+ */
+ public static Integer toInt(Object value)
+ {
+ return toInt(value, null);
+ }
+
+ /**
+ * 转换为Integer数组
+ *
+ * @param str 被转换的值
+ * @return 结果
+ */
+ public static Integer[] toIntArray(String str)
+ {
+ return toIntArray(",", str);
+ }
+
+ /**
+ * 转换为Long数组
+ *
+ * @param str 被转换的值
+ * @return 结果
+ */
+ public static Long[] toLongArray(String str)
+ {
+ return toLongArray(",", str);
+ }
+
+ /**
+ * 转换为Integer数组
+ *
+ * @param split 分隔符
+ * @param split 被转换的值
+ * @return 结果
+ */
+ public static Integer[] toIntArray(String split, String str)
+ {
+ if (StringUtils.isEmpty(str))
+ {
+ return new Integer[] {};
+ }
+ String[] arr = str.split(split);
+ final Integer[] ints = new Integer[arr.length];
+ for (int i = 0; i < arr.length; i++)
+ {
+ final Integer v = toInt(arr[i], 0);
+ ints[i] = v;
+ }
+ return ints;
+ }
+
+ /**
+ * 转换为Long数组
+ *
+ * @param split 分隔符
+ * @param str 被转换的值
+ * @return 结果
+ */
+ public static Long[] toLongArray(String split, String str)
+ {
+ if (StringUtils.isEmpty(str))
+ {
+ return new Long[] {};
+ }
+ String[] arr = str.split(split);
+ final Long[] longs = new Long[arr.length];
+ for (int i = 0; i < arr.length; i++)
+ {
+ final Long v = toLong(arr[i], null);
+ longs[i] = v;
+ }
+ return longs;
+ }
+
+ /**
+ * 转换为String数组
+ *
+ * @param str 被转换的值
+ * @return 结果
+ */
+ public static String[] toStrArray(String str)
+ {
+ return toStrArray(",", str);
+ }
+
+ /**
+ * 转换为String数组
+ *
+ * @param split 分隔符
+ * @param split 被转换的值
+ * @return 结果
+ */
+ public static String[] toStrArray(String split, String str)
+ {
+ return str.split(split);
+ }
+
+ /**
+ * 转换为long
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @param defaultValue 转换错误时的默认值
+ * @return 结果
+ */
+ public static Long toLong(Object value, Long defaultValue)
+ {
+ if (value == null)
+ {
+ return defaultValue;
+ }
+ if (value instanceof Long)
+ {
+ return (Long) value;
+ }
+ if (value instanceof Number)
+ {
+ return ((Number) value).longValue();
+ }
+ final String valueStr = toStr(value, null);
+ if (StringUtils.isEmpty(valueStr))
+ {
+ return defaultValue;
+ }
+ try
+ {
+ // 支持科学计数法
+ return new BigDecimal(valueStr.trim()).longValue();
+ }
+ catch (Exception e)
+ {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * 转换为long
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @return 结果
+ */
+ public static Long toLong(Object value)
+ {
+ return toLong(value, null);
+ }
+
+ /**
+ * 转换为double
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @param defaultValue 转换错误时的默认值
+ * @return 结果
+ */
+ public static Double toDouble(Object value, Double defaultValue)
+ {
+ if (value == null)
+ {
+ return defaultValue;
+ }
+ if (value instanceof Double)
+ {
+ return (Double) value;
+ }
+ if (value instanceof Number)
+ {
+ return ((Number) value).doubleValue();
+ }
+ final String valueStr = toStr(value, null);
+ if (StringUtils.isEmpty(valueStr))
+ {
+ return defaultValue;
+ }
+ try
+ {
+ // 支持科学计数法
+ return new BigDecimal(valueStr.trim()).doubleValue();
+ }
+ catch (Exception e)
+ {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * 转换为double
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @return 结果
+ */
+ public static Double toDouble(Object value)
+ {
+ return toDouble(value, null);
+ }
+
+ /**
+ * 转换为Float
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @param defaultValue 转换错误时的默认值
+ * @return 结果
+ */
+ public static Float toFloat(Object value, Float defaultValue)
+ {
+ if (value == null)
+ {
+ return defaultValue;
+ }
+ if (value instanceof Float)
+ {
+ return (Float) value;
+ }
+ if (value instanceof Number)
+ {
+ return ((Number) value).floatValue();
+ }
+ final String valueStr = toStr(value, null);
+ if (StringUtils.isEmpty(valueStr))
+ {
+ return defaultValue;
+ }
+ try
+ {
+ return Float.parseFloat(valueStr.trim());
+ }
+ catch (Exception e)
+ {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * 转换为Float
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @return 结果
+ */
+ public static Float toFloat(Object value)
+ {
+ return toFloat(value, null);
+ }
+
+ /**
+ * 转换为boolean
+ * String支持的值为:true、false、yes、ok、no,1,0 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @param defaultValue 转换错误时的默认值
+ * @return 结果
+ */
+ public static Boolean toBool(Object value, Boolean defaultValue)
+ {
+ if (value == null)
+ {
+ return defaultValue;
+ }
+ if (value instanceof Boolean)
+ {
+ return (Boolean) value;
+ }
+ String valueStr = toStr(value, null);
+ if (StringUtils.isEmpty(valueStr))
+ {
+ return defaultValue;
+ }
+ valueStr = valueStr.trim().toLowerCase();
+ switch (valueStr)
+ {
+ case "true":
+ return true;
+ case "false":
+ return false;
+ case "yes":
+ return true;
+ case "ok":
+ return true;
+ case "no":
+ return false;
+ case "1":
+ return true;
+ case "0":
+ return false;
+ default:
+ return defaultValue;
+ }
+ }
+
+ /**
+ * 转换为boolean
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @return 结果
+ */
+ public static Boolean toBool(Object value)
+ {
+ return toBool(value, null);
+ }
+
+ /**
+ * 转换为Enum对象
+ * 如果给定的值为空,或者转换失败,返回默认值
+ *
+ * @param clazz Enum的Class
+ * @param value 值
+ * @param defaultValue 默认值
+ * @return Enum
+ */
+ public static > E toEnum(Class clazz, Object value, E defaultValue)
+ {
+ if (value == null)
+ {
+ return defaultValue;
+ }
+ if (clazz.isAssignableFrom(value.getClass()))
+ {
+ @SuppressWarnings("unchecked")
+ E myE = (E) value;
+ return myE;
+ }
+ final String valueStr = toStr(value, null);
+ if (StringUtils.isEmpty(valueStr))
+ {
+ return defaultValue;
+ }
+ try
+ {
+ return Enum.valueOf(clazz, valueStr);
+ }
+ catch (Exception e)
+ {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * 转换为Enum对象
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ *
+ * @param clazz Enum的Class
+ * @param value 值
+ * @return Enum
+ */
+ public static > E toEnum(Class clazz, Object value)
+ {
+ return toEnum(clazz, value, null);
+ }
+
+ /**
+ * 转换为BigInteger
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @param defaultValue 转换错误时的默认值
+ * @return 结果
+ */
+ public static BigInteger toBigInteger(Object value, BigInteger defaultValue)
+ {
+ if (value == null)
+ {
+ return defaultValue;
+ }
+ if (value instanceof BigInteger)
+ {
+ return (BigInteger) value;
+ }
+ if (value instanceof Long)
+ {
+ return BigInteger.valueOf((Long) value);
+ }
+ final String valueStr = toStr(value, null);
+ if (StringUtils.isEmpty(valueStr))
+ {
+ return defaultValue;
+ }
+ try
+ {
+ return new BigInteger(valueStr);
+ }
+ catch (Exception e)
+ {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * 转换为BigInteger
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @return 结果
+ */
+ public static BigInteger toBigInteger(Object value)
+ {
+ return toBigInteger(value, null);
+ }
+
+ /**
+ * 转换为BigDecimal
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @param defaultValue 转换错误时的默认值
+ * @return 结果
+ */
+ public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue)
+ {
+ if (value == null)
+ {
+ return defaultValue;
+ }
+ if (value instanceof BigDecimal)
+ {
+ return (BigDecimal) value;
+ }
+ if (value instanceof Long)
+ {
+ return new BigDecimal((Long) value);
+ }
+ if (value instanceof Double)
+ {
+ return new BigDecimal((Double) value);
+ }
+ if (value instanceof Integer)
+ {
+ return new BigDecimal((Integer) value);
+ }
+ final String valueStr = toStr(value, null);
+ if (StringUtils.isEmpty(valueStr))
+ {
+ return defaultValue;
+ }
+ try
+ {
+ return new BigDecimal(valueStr);
+ }
+ catch (Exception e)
+ {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * 转换为BigDecimal
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @return 结果
+ */
+ public static BigDecimal toBigDecimal(Object value)
+ {
+ return toBigDecimal(value, null);
+ }
+
+ /**
+ * 将对象转为字符串
+ * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
+ *
+ * @param obj 对象
+ * @return 字符串
+ */
+ public static String utf8Str(Object obj)
+ {
+ return str(obj, CharsetKit.CHARSET_UTF_8);
+ }
+
+ /**
+ * 将对象转为字符串
+ * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
+ *
+ * @param obj 对象
+ * @param charsetName 字符集
+ * @return 字符串
+ */
+ public static String str(Object obj, String charsetName)
+ {
+ return str(obj, Charset.forName(charsetName));
+ }
+
+ /**
+ * 将对象转为字符串
+ * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
+ *
+ * @param obj 对象
+ * @param charset 字符集
+ * @return 字符串
+ */
+ public static String str(Object obj, Charset charset)
+ {
+ if (null == obj)
+ {
+ return null;
+ }
+
+ if (obj instanceof String)
+ {
+ return (String) obj;
+ }
+ else if (obj instanceof byte[] || obj instanceof Byte[])
+ {
+ return str((Byte[]) obj, charset);
+ }
+ else if (obj instanceof ByteBuffer)
+ {
+ return str((ByteBuffer) obj, charset);
+ }
+ return obj.toString();
+ }
+
+ /**
+ * 将byte数组转为字符串
+ *
+ * @param bytes byte数组
+ * @param charset 字符集
+ * @return 字符串
+ */
+ public static String str(byte[] bytes, String charset)
+ {
+ return str(bytes, StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset));
+ }
+
+ /**
+ * 解码字节码
+ *
+ * @param data 字符串
+ * @param charset 字符集,如果此字段为空,则解码的结果取决于平台
+ * @return 解码后的字符串
+ */
+ public static String str(byte[] data, Charset charset)
+ {
+ if (data == null)
+ {
+ return null;
+ }
+
+ if (null == charset)
+ {
+ return new String(data);
+ }
+ return new String(data, charset);
+ }
+
+ /**
+ * 将编码的byteBuffer数据转换为字符串
+ *
+ * @param data 数据
+ * @param charset 字符集,如果为空使用当前系统字符集
+ * @return 字符串
+ */
+ public static String str(ByteBuffer data, String charset)
+ {
+ if (data == null)
+ {
+ return null;
+ }
+
+ return str(data, Charset.forName(charset));
+ }
+
+ /**
+ * 将编码的byteBuffer数据转换为字符串
+ *
+ * @param data 数据
+ * @param charset 字符集,如果为空使用当前系统字符集
+ * @return 字符串
+ */
+ public static String str(ByteBuffer data, Charset charset)
+ {
+ if (null == charset)
+ {
+ charset = Charset.defaultCharset();
+ }
+ return charset.decode(data).toString();
+ }
+
+ // ----------------------------------------------------------------------- 全角半角转换
+ /**
+ * 半角转全角
+ *
+ * @param input String.
+ * @return 全角字符串.
+ */
+ public static String toSBC(String input)
+ {
+ return toSBC(input, null);
+ }
+
+ /**
+ * 半角转全角
+ *
+ * @param input String
+ * @param notConvertSet 不替换的字符集合
+ * @return 全角字符串.
+ */
+ public static String toSBC(String input, Set notConvertSet)
+ {
+ char c[] = input.toCharArray();
+ for (int i = 0; i < c.length; i++)
+ {
+ if (null != notConvertSet && notConvertSet.contains(c[i]))
+ {
+ // 跳过不替换的字符
+ continue;
+ }
+
+ if (c[i] == ' ')
+ {
+ c[i] = '\u3000';
+ }
+ else if (c[i] < '\177')
+ {
+ c[i] = (char) (c[i] + 65248);
+
+ }
+ }
+ return new String(c);
+ }
+
+ /**
+ * 全角转半角
+ *
+ * @param input String.
+ * @return 半角字符串
+ */
+ public static String toDBC(String input)
+ {
+ return toDBC(input, null);
+ }
+
+ /**
+ * 替换全角为半角
+ *
+ * @param text 文本
+ * @param notConvertSet 不替换的字符集合
+ * @return 替换后的字符
+ */
+ public static String toDBC(String text, Set notConvertSet)
+ {
+ char c[] = text.toCharArray();
+ for (int i = 0; i < c.length; i++)
+ {
+ if (null != notConvertSet && notConvertSet.contains(c[i]))
+ {
+ // 跳过不替换的字符
+ continue;
+ }
+
+ if (c[i] == '\u3000')
+ {
+ c[i] = ' ';
+ }
+ else if (c[i] > '\uFF00' && c[i] < '\uFF5F')
+ {
+ c[i] = (char) (c[i] - 65248);
+ }
+ }
+ String returnString = new String(c);
+
+ return returnString;
+ }
+
+ /**
+ * 数字金额大写转换 先写个完整的然后将如零拾替换成零
+ *
+ * @param n 数字
+ * @return 中文大写数字
+ */
+ public static String digitUppercase(double n)
+ {
+ String[] fraction = { "角", "分" };
+ String[] digit = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" };
+ String[][] unit = { { "元", "万", "亿" }, { "", "拾", "佰", "仟" } };
+
+ String head = n < 0 ? "负" : "";
+ n = Math.abs(n);
+
+ String s = "";
+ for (int i = 0; i < fraction.length; i++)
+ {
+ s += (digit[(int) (Math.floor(n * 10 * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", "");
+ }
+ if (s.length() < 1)
+ {
+ s = "整";
+ }
+ int integerPart = (int) Math.floor(n);
+
+ for (int i = 0; i < unit[0].length && integerPart > 0; i++)
+ {
+ String p = "";
+ for (int j = 0; j < unit[1].length && n > 0; j++)
+ {
+ p = digit[integerPart % 10] + unit[1][j] + p;
+ integerPart = integerPart / 10;
+ }
+ s = p.replaceAll("(零.)*零$", "").replaceAll("^$", "零") + unit[0][i] + s;
+ }
+ return head + s.replaceAll("(零.)*零元", "元").replaceFirst("(零.)+", "").replaceAll("(零.)+", "零").replaceAll("^整$", "零元整");
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/text/StrFormatter.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/text/StrFormatter.java
index dbf3e2375..c78ac776d 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/text/StrFormatter.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/text/StrFormatter.java
@@ -1,92 +1,92 @@
-package com.ruoyi.common.core.text;
-
-import com.ruoyi.common.utils.StringUtils;
-
-/**
- * 字符串格式化
- *
- * @author ruoyi
- */
-public class StrFormatter
-{
- public static final String EMPTY_JSON = "{}";
- public static final char C_BACKSLASH = '\\';
- public static final char C_DELIM_START = '{';
- public static final char C_DELIM_END = '}';
-
- /**
- * 格式化字符串
- * 此方法只是简单将占位符 {} 按照顺序替换为参数
- * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可
- * 例:
- * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b
- * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a
- * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b
- *
- * @param strPattern 字符串模板
- * @param argArray 参数列表
- * @return 结果
- */
- public static String format(final String strPattern, final Object... argArray)
- {
- if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray))
- {
- return strPattern;
- }
- final int strPatternLength = strPattern.length();
-
- // 初始化定义好的长度以获得更好的性能
- StringBuilder sbuf = new StringBuilder(strPatternLength + 50);
-
- int handledPosition = 0;
- int delimIndex;// 占位符所在位置
- for (int argIndex = 0; argIndex < argArray.length; argIndex++)
- {
- delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition);
- if (delimIndex == -1)
- {
- if (handledPosition == 0)
- {
- return strPattern;
- }
- else
- { // 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果
- sbuf.append(strPattern, handledPosition, strPatternLength);
- return sbuf.toString();
- }
- }
- else
- {
- 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(Convert.utf8Str(argArray[argIndex]));
- handledPosition = delimIndex + 2;
- }
- else
- {
- // 占位符被转义
- argIndex--;
- sbuf.append(strPattern, handledPosition, delimIndex - 1);
- sbuf.append(C_DELIM_START);
- handledPosition = delimIndex + 1;
- }
- }
- else
- {
- // 正常占位符
- sbuf.append(strPattern, handledPosition, delimIndex);
- sbuf.append(Convert.utf8Str(argArray[argIndex]));
- handledPosition = delimIndex + 2;
- }
- }
- }
- // 加入最后一个占位符后所有的字符
- sbuf.append(strPattern, handledPosition, strPattern.length());
-
- return sbuf.toString();
- }
-}
+package com.ruoyi.common.core.text;
+
+import com.ruoyi.common.utils.StringUtils;
+
+/**
+ * 字符串格式化
+ *
+ * @author ruoyi
+ */
+public class StrFormatter
+{
+ public static final String EMPTY_JSON = "{}";
+ public static final char C_BACKSLASH = '\\';
+ public static final char C_DELIM_START = '{';
+ public static final char C_DELIM_END = '}';
+
+ /**
+ * 格式化字符串
+ * 此方法只是简单将占位符 {} 按照顺序替换为参数
+ * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可
+ * 例:
+ * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b
+ * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a
+ * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b
+ *
+ * @param strPattern 字符串模板
+ * @param argArray 参数列表
+ * @return 结果
+ */
+ public static String format(final String strPattern, final Object... argArray)
+ {
+ if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray))
+ {
+ return strPattern;
+ }
+ final int strPatternLength = strPattern.length();
+
+ // 初始化定义好的长度以获得更好的性能
+ StringBuilder sbuf = new StringBuilder(strPatternLength + 50);
+
+ int handledPosition = 0;
+ int delimIndex;// 占位符所在位置
+ for (int argIndex = 0; argIndex < argArray.length; argIndex++)
+ {
+ delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition);
+ if (delimIndex == -1)
+ {
+ if (handledPosition == 0)
+ {
+ return strPattern;
+ }
+ else
+ { // 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果
+ sbuf.append(strPattern, handledPosition, strPatternLength);
+ return sbuf.toString();
+ }
+ }
+ else
+ {
+ 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(Convert.utf8Str(argArray[argIndex]));
+ handledPosition = delimIndex + 2;
+ }
+ else
+ {
+ // 占位符被转义
+ argIndex--;
+ sbuf.append(strPattern, handledPosition, delimIndex - 1);
+ sbuf.append(C_DELIM_START);
+ handledPosition = delimIndex + 1;
+ }
+ }
+ else
+ {
+ // 正常占位符
+ sbuf.append(strPattern, handledPosition, delimIndex);
+ sbuf.append(Convert.utf8Str(argArray[argIndex]));
+ handledPosition = delimIndex + 2;
+ }
+ }
+ }
+ // 加入最后一个占位符后所有的字符
+ sbuf.append(strPattern, handledPosition, strPattern.length());
+
+ return sbuf.toString();
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessStatus.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessStatus.java
index 43612e5d7..c6640bbc5 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessStatus.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessStatus.java
@@ -1,19 +1,19 @@
-package com.ruoyi.common.enums;
-
-/**
- * 操作状态
- *
- * @author ruoyi
- */
-public enum BusinessStatus
-{
- /**
- * 成功
- */
- SUCCESS,
-
- /**
- * 失败
- */
- FAIL,
-}
+package com.ruoyi.common.enums;
+
+/**
+ * 操作状态
+ *
+ * @author ruoyi
+ */
+public enum BusinessStatus
+{
+ /**
+ * 成功
+ */
+ SUCCESS,
+
+ /**
+ * 失败
+ */
+ FAIL,
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessType.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessType.java
index d22bccbd3..24d076a44 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessType.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessType.java
@@ -1,59 +1,59 @@
-package com.ruoyi.common.enums;
-
-/**
- * 业务操作类型
- *
- * @author ruoyi
- */
-public enum BusinessType
-{
- /**
- * 其它
- */
- OTHER,
-
- /**
- * 新增
- */
- INSERT,
-
- /**
- * 修改
- */
- UPDATE,
-
- /**
- * 删除
- */
- DELETE,
-
- /**
- * 授权
- */
- GRANT,
-
- /**
- * 导出
- */
- EXPORT,
-
- /**
- * 导入
- */
- IMPORT,
-
- /**
- * 强退
- */
- FORCE,
-
- /**
- * 生成代码
- */
- GENCODE,
-
- /**
- * 清空
- */
- CLEAN,
-}
+package com.ruoyi.common.enums;
+
+/**
+ * 业务操作类型
+ *
+ * @author ruoyi
+ */
+public enum BusinessType
+{
+ /**
+ * 其它
+ */
+ OTHER,
+
+ /**
+ * 新增
+ */
+ INSERT,
+
+ /**
+ * 修改
+ */
+ UPDATE,
+
+ /**
+ * 删除
+ */
+ DELETE,
+
+ /**
+ * 授权
+ */
+ GRANT,
+
+ /**
+ * 导出
+ */
+ EXPORT,
+
+ /**
+ * 导入
+ */
+ IMPORT,
+
+ /**
+ * 强退
+ */
+ FORCE,
+
+ /**
+ * 生成代码
+ */
+ GENCODE,
+
+ /**
+ * 清空
+ */
+ CLEAN,
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/DataSourceType.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/DataSourceType.java
index 4b5341d19..0d945be54 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/DataSourceType.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/DataSourceType.java
@@ -1,19 +1,19 @@
-package com.ruoyi.common.enums;
-
-/**
- * 数据源
- *
- * @author ruoyi
- */
-public enum DataSourceType
-{
- /**
- * 主库
- */
- MASTER,
-
- /**
- * 从库
- */
- SLAVE
-}
+package com.ruoyi.common.enums;
+
+/**
+ * 数据源
+ *
+ * @author ruoyi
+ */
+public enum DataSourceType
+{
+ /**
+ * 主库
+ */
+ MASTER,
+
+ /**
+ * 从库
+ */
+ SLAVE
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/OnlineStatus.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/OnlineStatus.java
index b0bdd1003..a05d5ffb8 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/OnlineStatus.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/OnlineStatus.java
@@ -1,24 +1,24 @@
-package com.ruoyi.common.enums;
-
-/**
- * 用户会话
- *
- * @author ruoyi
- */
-public enum OnlineStatus
-{
- /** 用户状态 */
- on_line("在线"), off_line("离线");
-
- private final String info;
-
- private OnlineStatus(String info)
- {
- this.info = info;
- }
-
- public String getInfo()
- {
- return info;
- }
-}
+package com.ruoyi.common.enums;
+
+/**
+ * 用户会话
+ *
+ * @author ruoyi
+ */
+public enum OnlineStatus
+{
+ /** 用户状态 */
+ on_line("在线"), off_line("离线");
+
+ private final String info;
+
+ private OnlineStatus(String info)
+ {
+ this.info = info;
+ }
+
+ public String getInfo()
+ {
+ return info;
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/OperatorType.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/OperatorType.java
index 06532af8f..bdd143c1c 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/OperatorType.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/OperatorType.java
@@ -1,24 +1,24 @@
-package com.ruoyi.common.enums;
-
-/**
- * 操作人类别
- *
- * @author ruoyi
- */
-public enum OperatorType
-{
- /**
- * 其它
- */
- OTHER,
-
- /**
- * 后台用户
- */
- MANAGE,
-
- /**
- * 手机端用户
- */
- MOBILE
-}
+package com.ruoyi.common.enums;
+
+/**
+ * 操作人类别
+ *
+ * @author ruoyi
+ */
+public enum OperatorType
+{
+ /**
+ * 其它
+ */
+ OTHER,
+
+ /**
+ * 后台用户
+ */
+ MANAGE,
+
+ /**
+ * 手机端用户
+ */
+ MOBILE
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/UserStatus.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/UserStatus.java
index a4613ff9c..d7ff44a98 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/UserStatus.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/UserStatus.java
@@ -1,30 +1,30 @@
-package com.ruoyi.common.enums;
-
-/**
- * 用户状态
- *
- * @author ruoyi
- */
-public enum UserStatus
-{
- OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除");
-
- private final String code;
- private final String info;
-
- UserStatus(String code, String info)
- {
- this.code = code;
- this.info = info;
- }
-
- public String getCode()
- {
- return code;
- }
-
- public String getInfo()
- {
- return info;
- }
-}
+package com.ruoyi.common.enums;
+
+/**
+ * 用户状态
+ *
+ * @author ruoyi
+ */
+public enum UserStatus
+{
+ OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除");
+
+ private final String code;
+ private final String info;
+
+ UserStatus(String code, String info)
+ {
+ this.code = code;
+ this.info = info;
+ }
+
+ public String getCode()
+ {
+ return code;
+ }
+
+ public String getInfo()
+ {
+ return info;
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/DemoModeException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/DemoModeException.java
index 57bffc47b..f6ad2ab49 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/DemoModeException.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/DemoModeException.java
@@ -1,15 +1,15 @@
-package com.ruoyi.common.exception;
-
-/**
- * 演示模式异常
- *
- * @author ruoyi
- */
-public class DemoModeException extends RuntimeException
-{
- private static final long serialVersionUID = 1L;
-
- public DemoModeException()
- {
- }
-}
+package com.ruoyi.common.exception;
+
+/**
+ * 演示模式异常
+ *
+ * @author ruoyi
+ */
+public class DemoModeException extends RuntimeException
+{
+ private static final long serialVersionUID = 1L;
+
+ public DemoModeException()
+ {
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/base/BaseException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/base/BaseException.java
index 3dd2c1ee7..b55d72e18 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/base/BaseException.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/base/BaseException.java
@@ -1,97 +1,97 @@
-package com.ruoyi.common.exception.base;
-
-import com.ruoyi.common.utils.MessageUtils;
-import com.ruoyi.common.utils.StringUtils;
-
-/**
- * 基础异常
- *
- * @author ruoyi
- */
-public class BaseException extends RuntimeException
-{
- private static final long serialVersionUID = 1L;
-
- /**
- * 所属模块
- */
- private String module;
-
- /**
- * 错误码
- */
- private String code;
-
- /**
- * 错误码对应的参数
- */
- private Object[] args;
-
- /**
- * 错误消息
- */
- private String defaultMessage;
-
- public BaseException(String module, String code, Object[] args, String defaultMessage)
- {
- this.module = module;
- this.code = code;
- this.args = args;
- this.defaultMessage = defaultMessage;
- }
-
- public BaseException(String module, String code, Object[] args)
- {
- this(module, code, args, null);
- }
-
- public BaseException(String module, String defaultMessage)
- {
- this(module, null, null, defaultMessage);
- }
-
- public BaseException(String code, Object[] args)
- {
- this(null, code, args, null);
- }
-
- public BaseException(String defaultMessage)
- {
- this(null, null, null, defaultMessage);
- }
-
- @Override
- public String getMessage()
- {
- String message = null;
- if (!StringUtils.isEmpty(code))
- {
- message = MessageUtils.message(code, args);
- }
- if (message == null)
- {
- message = defaultMessage;
- }
- return message;
- }
-
- public String getModule()
- {
- return module;
- }
-
- public String getCode()
- {
- return code;
- }
-
- public Object[] getArgs()
- {
- return args;
- }
-
- public String getDefaultMessage()
- {
- return defaultMessage;
- }
-}
+package com.ruoyi.common.exception.base;
+
+import com.ruoyi.common.utils.MessageUtils;
+import com.ruoyi.common.utils.StringUtils;
+
+/**
+ * 基础异常
+ *
+ * @author ruoyi
+ */
+public class BaseException extends RuntimeException
+{
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 所属模块
+ */
+ private String module;
+
+ /**
+ * 错误码
+ */
+ private String code;
+
+ /**
+ * 错误码对应的参数
+ */
+ private Object[] args;
+
+ /**
+ * 错误消息
+ */
+ private String defaultMessage;
+
+ public BaseException(String module, String code, Object[] args, String defaultMessage)
+ {
+ this.module = module;
+ this.code = code;
+ this.args = args;
+ this.defaultMessage = defaultMessage;
+ }
+
+ public BaseException(String module, String code, Object[] args)
+ {
+ this(module, code, args, null);
+ }
+
+ public BaseException(String module, String defaultMessage)
+ {
+ this(module, null, null, defaultMessage);
+ }
+
+ public BaseException(String code, Object[] args)
+ {
+ this(null, code, args, null);
+ }
+
+ public BaseException(String defaultMessage)
+ {
+ this(null, null, null, defaultMessage);
+ }
+
+ @Override
+ public String getMessage()
+ {
+ String message = null;
+ if (!StringUtils.isEmpty(code))
+ {
+ message = MessageUtils.message(code, args);
+ }
+ if (message == null)
+ {
+ message = defaultMessage;
+ }
+ return message;
+ }
+
+ public String getModule()
+ {
+ return module;
+ }
+
+ public String getCode()
+ {
+ return code;
+ }
+
+ public Object[] getArgs()
+ {
+ return args;
+ }
+
+ public String getDefaultMessage()
+ {
+ return defaultMessage;
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileNameLengthLimitExceededException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileNameLengthLimitExceededException.java
index 44941b8bc..70e0ec9b1 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileNameLengthLimitExceededException.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileNameLengthLimitExceededException.java
@@ -1,16 +1,16 @@
-package com.ruoyi.common.exception.file;
-
-/**
- * 文件名称超长限制异常类
- *
- * @author ruoyi
- */
-public class FileNameLengthLimitExceededException extends FileException
-{
- private static final long serialVersionUID = 1L;
-
- public FileNameLengthLimitExceededException(int defaultFileNameLength)
- {
- super("upload.filename.exceed.length", new Object[] { defaultFileNameLength });
- }
-}
+package com.ruoyi.common.exception.file;
+
+/**
+ * 文件名称超长限制异常类
+ *
+ * @author ruoyi
+ */
+public class FileNameLengthLimitExceededException extends FileException
+{
+ private static final long serialVersionUID = 1L;
+
+ public FileNameLengthLimitExceededException(int defaultFileNameLength)
+ {
+ super("upload.filename.exceed.length", new Object[] { defaultFileNameLength });
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java
index 81cd78b81..8f63a799c 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java
@@ -1,71 +1,71 @@
-package com.ruoyi.common.exception.file;
-
-import java.util.Arrays;
-import org.apache.commons.fileupload.FileUploadException;
-
-/**
- * 文件上传 误异常类
- *
- * @author ruoyi
- */
-public class InvalidExtensionException extends FileUploadException
-{
- private static final long serialVersionUID = 1L;
-
- private String[] allowedExtension;
- private String extension;
- private String filename;
-
- public InvalidExtensionException(String[] allowedExtension, String extension, String filename)
- {
- super("filename : [" + filename + "], extension : [" + extension + "], allowed extension : [" + Arrays.toString(allowedExtension) + "]");
- this.allowedExtension = allowedExtension;
- this.extension = extension;
- this.filename = filename;
- }
-
- public String[] getAllowedExtension()
- {
- return allowedExtension;
- }
-
- public String getExtension()
- {
- return extension;
- }
-
- public String getFilename()
- {
- return filename;
- }
-
- public static class InvalidImageExtensionException extends InvalidExtensionException
- {
- private static final long serialVersionUID = 1L;
-
- public InvalidImageExtensionException(String[] allowedExtension, String extension, String filename)
- {
- super(allowedExtension, extension, filename);
- }
- }
-
- public static class InvalidFlashExtensionException extends InvalidExtensionException
- {
- private static final long serialVersionUID = 1L;
-
- public InvalidFlashExtensionException(String[] allowedExtension, String extension, String filename)
- {
- super(allowedExtension, extension, filename);
- }
- }
-
- public static class InvalidMediaExtensionException extends InvalidExtensionException
- {
- private static final long serialVersionUID = 1L;
-
- public InvalidMediaExtensionException(String[] allowedExtension, String extension, String filename)
- {
- super(allowedExtension, extension, filename);
- }
- }
-}
+package com.ruoyi.common.exception.file;
+
+import java.util.Arrays;
+import org.apache.commons.fileupload.FileUploadException;
+
+/**
+ * 文件上传 误异常类
+ *
+ * @author ruoyi
+ */
+public class InvalidExtensionException extends FileUploadException
+{
+ private static final long serialVersionUID = 1L;
+
+ private String[] allowedExtension;
+ private String extension;
+ private String filename;
+
+ public InvalidExtensionException(String[] allowedExtension, String extension, String filename)
+ {
+ super("filename : [" + filename + "], extension : [" + extension + "], allowed extension : [" + Arrays.toString(allowedExtension) + "]");
+ this.allowedExtension = allowedExtension;
+ this.extension = extension;
+ this.filename = filename;
+ }
+
+ public String[] getAllowedExtension()
+ {
+ return allowedExtension;
+ }
+
+ public String getExtension()
+ {
+ return extension;
+ }
+
+ public String getFilename()
+ {
+ return filename;
+ }
+
+ public static class InvalidImageExtensionException extends InvalidExtensionException
+ {
+ private static final long serialVersionUID = 1L;
+
+ public InvalidImageExtensionException(String[] allowedExtension, String extension, String filename)
+ {
+ super(allowedExtension, extension, filename);
+ }
+ }
+
+ public static class InvalidFlashExtensionException extends InvalidExtensionException
+ {
+ private static final long serialVersionUID = 1L;
+
+ public InvalidFlashExtensionException(String[] allowedExtension, String extension, String filename)
+ {
+ super(allowedExtension, extension, filename);
+ }
+ }
+
+ public static class InvalidMediaExtensionException extends InvalidExtensionException
+ {
+ private static final long serialVersionUID = 1L;
+
+ public InvalidMediaExtensionException(String[] allowedExtension, String extension, String filename)
+ {
+ super(allowedExtension, extension, filename);
+ }
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/job/TaskException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/job/TaskException.java
index 14b2361d0..a567b408b 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/job/TaskException.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/job/TaskException.java
@@ -1,34 +1,34 @@
-package com.ruoyi.common.exception.job;
-
-/**
- * 计划策略异常
- *
- * @author ruoyi
- */
-public class TaskException extends Exception
-{
- private static final long serialVersionUID = 1L;
-
- private Code code;
-
- public TaskException(String msg, Code code)
- {
- this(msg, code, null);
- }
-
- public TaskException(String msg, Code code, Exception nestedEx)
- {
- super(msg, nestedEx);
- this.code = code;
- }
-
- public Code getCode()
- {
- return code;
- }
-
- public enum Code
- {
- TASK_EXISTS, NO_TASK_EXISTS, TASK_ALREADY_STARTED, UNKNOWN, CONFIG_ERROR, TASK_NODE_NOT_AVAILABLE
- }
+package com.ruoyi.common.exception.job;
+
+/**
+ * 计划策略异常
+ *
+ * @author ruoyi
+ */
+public class TaskException extends Exception
+{
+ private static final long serialVersionUID = 1L;
+
+ private Code code;
+
+ public TaskException(String msg, Code code)
+ {
+ this(msg, code, null);
+ }
+
+ public TaskException(String msg, Code code, Exception nestedEx)
+ {
+ super(msg, nestedEx);
+ this.code = code;
+ }
+
+ public Code getCode()
+ {
+ return code;
+ }
+
+ public enum Code
+ {
+ TASK_EXISTS, NO_TASK_EXISTS, TASK_ALREADY_STARTED, UNKNOWN, CONFIG_ERROR, TASK_NODE_NOT_AVAILABLE
+ }
}
\ No newline at end of file
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/CaptchaException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/CaptchaException.java
index e3334ae37..389dbc753 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/CaptchaException.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/CaptchaException.java
@@ -1,16 +1,16 @@
-package com.ruoyi.common.exception.user;
-
-/**
- * 验证码错误异常类
- *
- * @author ruoyi
- */
-public class CaptchaException extends UserException
-{
- private static final long serialVersionUID = 1L;
-
- public CaptchaException()
- {
- super("user.jcaptcha.error", null);
- }
-}
+package com.ruoyi.common.exception.user;
+
+/**
+ * 验证码错误异常类
+ *
+ * @author ruoyi
+ */
+public class CaptchaException extends UserException
+{
+ private static final long serialVersionUID = 1L;
+
+ public CaptchaException()
+ {
+ super("user.jcaptcha.error", null);
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/RoleBlockedException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/RoleBlockedException.java
index e11624426..1c4fd4a18 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/RoleBlockedException.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/RoleBlockedException.java
@@ -1,16 +1,16 @@
-package com.ruoyi.common.exception.user;
-
-/**
- * 角色锁定异常类
- *
- * @author ruoyi
- */
-public class RoleBlockedException extends UserException
-{
- private static final long serialVersionUID = 1L;
-
- public RoleBlockedException()
- {
- super("role.blocked", null);
- }
-}
+package com.ruoyi.common.exception.user;
+
+/**
+ * 角色锁定异常类
+ *
+ * @author ruoyi
+ */
+public class RoleBlockedException extends UserException
+{
+ private static final long serialVersionUID = 1L;
+
+ public RoleBlockedException()
+ {
+ super("role.blocked", null);
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserBlockedException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserBlockedException.java
index 8feb8493e..5150f52f8 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserBlockedException.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserBlockedException.java
@@ -1,16 +1,16 @@
-package com.ruoyi.common.exception.user;
-
-/**
- * 用户锁定异常类
- *
- * @author ruoyi
- */
-public class UserBlockedException extends UserException
-{
- private static final long serialVersionUID = 1L;
-
- public UserBlockedException()
- {
- super("user.blocked", null);
- }
-}
+package com.ruoyi.common.exception.user;
+
+/**
+ * 用户锁定异常类
+ *
+ * @author ruoyi
+ */
+public class UserBlockedException extends UserException
+{
+ private static final long serialVersionUID = 1L;
+
+ public UserBlockedException()
+ {
+ super("user.blocked", null);
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserDeleteException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserDeleteException.java
index cf0724228..352003080 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserDeleteException.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserDeleteException.java
@@ -1,16 +1,16 @@
-package com.ruoyi.common.exception.user;
-
-/**
- * 用户账号已被删除
- *
- * @author ruoyi
- */
-public class UserDeleteException extends UserException
-{
- private static final long serialVersionUID = 1L;
-
- public UserDeleteException()
- {
- super("user.password.delete", null);
- }
-}
+package com.ruoyi.common.exception.user;
+
+/**
+ * 用户账号已被删除
+ *
+ * @author ruoyi
+ */
+public class UserDeleteException extends UserException
+{
+ private static final long serialVersionUID = 1L;
+
+ public UserDeleteException()
+ {
+ super("user.password.delete", null);
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserException.java
index 79160d861..c292d70ed 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserException.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserException.java
@@ -1,18 +1,18 @@
-package com.ruoyi.common.exception.user;
-
-import com.ruoyi.common.exception.base.BaseException;
-
-/**
- * 用户信息异常类
- *
- * @author ruoyi
- */
-public class UserException extends BaseException
-{
- private static final long serialVersionUID = 1L;
-
- public UserException(String code, Object[] args)
- {
- super("user", code, args, null);
- }
-}
+package com.ruoyi.common.exception.user;
+
+import com.ruoyi.common.exception.base.BaseException;
+
+/**
+ * 用户信息异常类
+ *
+ * @author ruoyi
+ */
+public class UserException extends BaseException
+{
+ private static final long serialVersionUID = 1L;
+
+ public UserException(String code, Object[] args)
+ {
+ super("user", code, args, null);
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserNotExistsException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserNotExistsException.java
index ed4bea3ac..eff818121 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserNotExistsException.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserNotExistsException.java
@@ -1,16 +1,16 @@
-package com.ruoyi.common.exception.user;
-
-/**
- * 用户不存在异常类
- *
- * @author ruoyi
- */
-public class UserNotExistsException extends UserException
-{
- private static final long serialVersionUID = 1L;
-
- public UserNotExistsException()
- {
- super("user.not.exists", null);
- }
-}
+package com.ruoyi.common.exception.user;
+
+/**
+ * 用户不存在异常类
+ *
+ * @author ruoyi
+ */
+public class UserNotExistsException extends UserException
+{
+ private static final long serialVersionUID = 1L;
+
+ public UserNotExistsException()
+ {
+ super("user.not.exists", null);
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordNotMatchException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordNotMatchException.java
index 71449e293..a7f3e5ffe 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordNotMatchException.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordNotMatchException.java
@@ -1,16 +1,16 @@
-package com.ruoyi.common.exception.user;
-
-/**
- * 用户密码不正确或不符合规范异常类
- *
- * @author ruoyi
- */
-public class UserPasswordNotMatchException extends UserException
-{
- private static final long serialVersionUID = 1L;
-
- public UserPasswordNotMatchException()
- {
- super("user.password.not.match", null);
- }
-}
+package com.ruoyi.common.exception.user;
+
+/**
+ * 用户密码不正确或不符合规范异常类
+ *
+ * @author ruoyi
+ */
+public class UserPasswordNotMatchException extends UserException
+{
+ private static final long serialVersionUID = 1L;
+
+ public UserPasswordNotMatchException()
+ {
+ super("user.password.not.match", null);
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordRetryLimitCountException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordRetryLimitCountException.java
index 4222135f5..7ead89b6d 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordRetryLimitCountException.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordRetryLimitCountException.java
@@ -1,16 +1,16 @@
-package com.ruoyi.common.exception.user;
-
-/**
- * 用户错误记数异常类
- *
- * @author ruoyi
- */
-public class UserPasswordRetryLimitCountException extends UserException
-{
- private static final long serialVersionUID = 1L;
-
- public UserPasswordRetryLimitCountException(int retryLimitCount)
- {
- super("user.password.retry.limit.count", new Object[] { retryLimitCount });
- }
-}
+package com.ruoyi.common.exception.user;
+
+/**
+ * 用户错误记数异常类
+ *
+ * @author ruoyi
+ */
+public class UserPasswordRetryLimitCountException extends UserException
+{
+ private static final long serialVersionUID = 1L;
+
+ public UserPasswordRetryLimitCountException(int retryLimitCount)
+ {
+ super("user.password.retry.limit.count", new Object[] { retryLimitCount });
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordRetryLimitExceedException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordRetryLimitExceedException.java
index b48c40657..b5ccfb97e 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordRetryLimitExceedException.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordRetryLimitExceedException.java
@@ -1,16 +1,16 @@
-package com.ruoyi.common.exception.user;
-
-/**
- * 用户错误最大次数异常类
- *
- * @author ruoyi
- */
-public class UserPasswordRetryLimitExceedException extends UserException
-{
- private static final long serialVersionUID = 1L;
-
- public UserPasswordRetryLimitExceedException(int retryLimitCount)
- {
- super("user.password.retry.limit.exceed", new Object[] { retryLimitCount });
- }
-}
+package com.ruoyi.common.exception.user;
+
+/**
+ * 用户错误最大次数异常类
+ *
+ * @author ruoyi
+ */
+public class UserPasswordRetryLimitExceedException extends UserException
+{
+ private static final long serialVersionUID = 1L;
+
+ public UserPasswordRetryLimitExceedException(int retryLimitCount)
+ {
+ super("user.password.retry.limit.exceed", new Object[] { retryLimitCount });
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/json/JSON.java b/ruoyi-common/src/main/java/com/ruoyi/common/json/JSON.java
index 119147b6a..1e5b928b0 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/json/JSON.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/json/JSON.java
@@ -1,187 +1,187 @@
-package com.ruoyi.common.json;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import com.fasterxml.jackson.core.JsonGenerationException;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.ObjectWriter;
-
-/**
- * JSON解析处理
- *
- * @author ruoyi
- */
-public class JSON
-{
- public static final String DEFAULT_FAIL = "\"Parse failed\"";
- private static final ObjectMapper objectMapper = new ObjectMapper();
- private static final ObjectWriter objectWriter = objectMapper.writerWithDefaultPrettyPrinter();
-
- public static void marshal(File file, Object value) throws Exception
- {
- try
- {
- objectWriter.writeValue(file, value);
- }
- catch (JsonGenerationException e)
- {
- throw new Exception(e);
- }
- catch (JsonMappingException e)
- {
- throw new Exception(e);
- }
- catch (IOException e)
- {
- throw new Exception(e);
- }
- }
-
- public static void marshal(OutputStream os, Object value) throws Exception
- {
- try
- {
- objectWriter.writeValue(os, value);
- }
- catch (JsonGenerationException e)
- {
- throw new Exception(e);
- }
- catch (JsonMappingException e)
- {
- throw new Exception(e);
- }
- catch (IOException e)
- {
- throw new Exception(e);
- }
- }
-
- public static String marshal(Object value) throws Exception
- {
- try
- {
- return objectWriter.writeValueAsString(value);
- }
- catch (JsonGenerationException e)
- {
- throw new Exception(e);
- }
- catch (JsonMappingException e)
- {
- throw new Exception(e);
- }
- catch (IOException e)
- {
- throw new Exception(e);
- }
- }
-
- public static byte[] marshalBytes(Object value) throws Exception
- {
- try
- {
- return objectWriter.writeValueAsBytes(value);
- }
- catch (JsonGenerationException e)
- {
- throw new Exception(e);
- }
- catch (JsonMappingException e)
- {
- throw new Exception(e);
- }
- catch (IOException e)
- {
- throw new Exception(e);
- }
- }
-
- public static T unmarshal(File file, Class valueType) throws Exception
- {
- try
- {
- return objectMapper.readValue(file, valueType);
- }
- catch (JsonParseException e)
- {
- throw new Exception(e);
- }
- catch (JsonMappingException e)
- {
- throw new Exception(e);
- }
- catch (IOException e)
- {
- throw new Exception(e);
- }
- }
-
- public static T unmarshal(InputStream is, Class valueType) throws Exception
- {
- try
- {
- return objectMapper.readValue(is, valueType);
- }
- catch (JsonParseException e)
- {
- throw new Exception(e);
- }
- catch (JsonMappingException e)
- {
- throw new Exception(e);
- }
- catch (IOException e)
- {
- throw new Exception(e);
- }
- }
-
- public static T unmarshal(String str, Class valueType) throws Exception
- {
- try
- {
- return objectMapper.readValue(str, valueType);
- }
- catch (JsonParseException e)
- {
- throw new Exception(e);
- }
- catch (JsonMappingException e)
- {
- throw new Exception(e);
- }
- catch (IOException e)
- {
- throw new Exception(e);
- }
- }
-
- public static T unmarshal(byte[] bytes, Class valueType) throws Exception
- {
- try
- {
- if (bytes == null)
- {
- bytes = new byte[0];
- }
- return objectMapper.readValue(bytes, 0, bytes.length, valueType);
- }
- catch (JsonParseException e)
- {
- throw new Exception(e);
- }
- catch (JsonMappingException e)
- {
- throw new Exception(e);
- }
- catch (IOException e)
- {
- throw new Exception(e);
- }
- }
-}
+package com.ruoyi.common.json;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import com.fasterxml.jackson.core.JsonGenerationException;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectWriter;
+
+/**
+ * JSON解析处理
+ *
+ * @author ruoyi
+ */
+public class JSON
+{
+ public static final String DEFAULT_FAIL = "\"Parse failed\"";
+ private static final ObjectMapper objectMapper = new ObjectMapper();
+ private static final ObjectWriter objectWriter = objectMapper.writerWithDefaultPrettyPrinter();
+
+ public static void marshal(File file, Object value) throws Exception
+ {
+ try
+ {
+ objectWriter.writeValue(file, value);
+ }
+ catch (JsonGenerationException e)
+ {
+ throw new Exception(e);
+ }
+ catch (JsonMappingException e)
+ {
+ throw new Exception(e);
+ }
+ catch (IOException e)
+ {
+ throw new Exception(e);
+ }
+ }
+
+ public static void marshal(OutputStream os, Object value) throws Exception
+ {
+ try
+ {
+ objectWriter.writeValue(os, value);
+ }
+ catch (JsonGenerationException e)
+ {
+ throw new Exception(e);
+ }
+ catch (JsonMappingException e)
+ {
+ throw new Exception(e);
+ }
+ catch (IOException e)
+ {
+ throw new Exception(e);
+ }
+ }
+
+ public static String marshal(Object value) throws Exception
+ {
+ try
+ {
+ return objectWriter.writeValueAsString(value);
+ }
+ catch (JsonGenerationException e)
+ {
+ throw new Exception(e);
+ }
+ catch (JsonMappingException e)
+ {
+ throw new Exception(e);
+ }
+ catch (IOException e)
+ {
+ throw new Exception(e);
+ }
+ }
+
+ public static byte[] marshalBytes(Object value) throws Exception
+ {
+ try
+ {
+ return objectWriter.writeValueAsBytes(value);
+ }
+ catch (JsonGenerationException e)
+ {
+ throw new Exception(e);
+ }
+ catch (JsonMappingException e)
+ {
+ throw new Exception(e);
+ }
+ catch (IOException e)
+ {
+ throw new Exception(e);
+ }
+ }
+
+ public static T unmarshal(File file, Class valueType) throws Exception
+ {
+ try
+ {
+ return objectMapper.readValue(file, valueType);
+ }
+ catch (JsonParseException e)
+ {
+ throw new Exception(e);
+ }
+ catch (JsonMappingException e)
+ {
+ throw new Exception(e);
+ }
+ catch (IOException e)
+ {
+ throw new Exception(e);
+ }
+ }
+
+ public static T unmarshal(InputStream is, Class valueType) throws Exception
+ {
+ try
+ {
+ return objectMapper.readValue(is, valueType);
+ }
+ catch (JsonParseException e)
+ {
+ throw new Exception(e);
+ }
+ catch (JsonMappingException e)
+ {
+ throw new Exception(e);
+ }
+ catch (IOException e)
+ {
+ throw new Exception(e);
+ }
+ }
+
+ public static T unmarshal(String str, Class valueType) throws Exception
+ {
+ try
+ {
+ return objectMapper.readValue(str, valueType);
+ }
+ catch (JsonParseException e)
+ {
+ throw new Exception(e);
+ }
+ catch (JsonMappingException e)
+ {
+ throw new Exception(e);
+ }
+ catch (IOException e)
+ {
+ throw new Exception(e);
+ }
+ }
+
+ public static T unmarshal(byte[] bytes, Class valueType) throws Exception
+ {
+ try
+ {
+ if (bytes == null)
+ {
+ bytes = new byte[0];
+ }
+ return objectMapper.readValue(bytes, 0, bytes.length, valueType);
+ }
+ catch (JsonParseException e)
+ {
+ throw new Exception(e);
+ }
+ catch (JsonMappingException e)
+ {
+ throw new Exception(e);
+ }
+ catch (IOException e)
+ {
+ throw new Exception(e);
+ }
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/json/JSONObject.java b/ruoyi-common/src/main/java/com/ruoyi/common/json/JSONObject.java
index 24ef6ccb7..2f4afe710 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/json/JSONObject.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/json/JSONObject.java
@@ -1,749 +1,749 @@
-package com.ruoyi.common.json;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.ruoyi.common.utils.StringUtils;
-
-/**
- * 通用消息对象,基于Map实现的可嵌套数据结构。 支持JSON数据结构。
- *
- * @author ruoyi
- */
-public class JSONObject extends LinkedHashMap
-{
- private static final long serialVersionUID = 1L;
- private static final Pattern arrayNamePattern = Pattern.compile("(\\w+)((\\[\\d+\\])+)");
- private static final ObjectMapper objectMapper = new ObjectMapper();
-
- /**
- * 数组结构。
- */
- public static class JSONArray extends ArrayList