Pre Merge pull request !110 from 王炸ll/feature/mwu1
|
|
@ -0,0 +1,21 @@
|
||||||
|
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("启动成功");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
package com.ruoyi;
|
package com.ruoyi;
|
||||||
|
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* web容器中进行部署
|
* web容器中进行部署
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class RuoYiServletInitializer extends SpringBootServletInitializer
|
public class RuoYiServletInitializer extends SpringBootServletInitializer
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
|
||||||
{
|
{
|
||||||
return application.sources(RuoYiApplication.class);
|
return application.sources(RuoYiApplication.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,91 +1,91 @@
|
||||||
package com.ruoyi.web.controller.common;
|
package com.ruoyi.web.controller.common;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import com.ruoyi.common.config.Global;
|
import com.ruoyi.common.config.Global;
|
||||||
import com.ruoyi.common.config.ServerConfig;
|
import com.ruoyi.common.config.ServerConfig;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||||
import com.ruoyi.common.utils.file.FileUtils;
|
import com.ruoyi.common.utils.file.FileUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用请求处理
|
* 通用请求处理
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
public class CommonController
|
public class CommonController
|
||||||
{
|
{
|
||||||
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
|
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ServerConfig serverConfig;
|
private ServerConfig serverConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用下载请求
|
* 通用下载请求
|
||||||
*
|
*
|
||||||
* @param fileName 文件名称
|
* @param fileName 文件名称
|
||||||
* @param delete 是否删除
|
* @param delete 是否删除
|
||||||
*/
|
*/
|
||||||
@GetMapping("common/download")
|
@GetMapping("common/download")
|
||||||
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
|
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!FileUtils.isValidFilename(fileName))
|
if (!FileUtils.isValidFilename(fileName))
|
||||||
{
|
{
|
||||||
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
|
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
|
||||||
}
|
}
|
||||||
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
|
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
|
||||||
String filePath = Global.getDownloadPath() + fileName;
|
String filePath = Global.getDownloadPath() + fileName;
|
||||||
|
|
||||||
response.setCharacterEncoding("utf-8");
|
response.setCharacterEncoding("utf-8");
|
||||||
response.setContentType("multipart/form-data");
|
response.setContentType("multipart/form-data");
|
||||||
response.setHeader("Content-Disposition",
|
response.setHeader("Content-Disposition",
|
||||||
"attachment;fileName=" + FileUtils.setFileDownloadHeader(request, realFileName));
|
"attachment;fileName=" + FileUtils.setFileDownloadHeader(request, realFileName));
|
||||||
FileUtils.writeBytes(filePath, response.getOutputStream());
|
FileUtils.writeBytes(filePath, response.getOutputStream());
|
||||||
if (delete)
|
if (delete)
|
||||||
{
|
{
|
||||||
FileUtils.deleteFile(filePath);
|
FileUtils.deleteFile(filePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.error("下载文件失败", e);
|
log.error("下载文件失败", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用上传请求
|
* 通用上传请求
|
||||||
*/
|
*/
|
||||||
@PostMapping("/common/upload")
|
@PostMapping("/common/upload")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult uploadFile(MultipartFile file) throws Exception
|
public AjaxResult uploadFile(MultipartFile file) throws Exception
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 上传文件路径
|
// 上传文件路径
|
||||||
String filePath = Global.getUploadPath();
|
String filePath = Global.getUploadPath();
|
||||||
// 上传并返回新文件名称
|
// 上传并返回新文件名称
|
||||||
String fileName = FileUploadUtils.upload(filePath, file);
|
String fileName = FileUploadUtils.upload(filePath, file);
|
||||||
String url = serverConfig.getUrl() + fileName;
|
String url = serverConfig.getUrl() + fileName;
|
||||||
AjaxResult ajax = AjaxResult.success();
|
AjaxResult ajax = AjaxResult.success();
|
||||||
ajax.put("fileName", fileName);
|
ajax.put("fileName", fileName);
|
||||||
ajax.put("url", url);
|
ajax.put("url", url);
|
||||||
return ajax;
|
return ajax;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
return AjaxResult.error(e.getMessage());
|
return AjaxResult.error(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,80 +1,80 @@
|
||||||
package com.ruoyi.web.controller.demo.controller;
|
package com.ruoyi.web.controller.demo.controller;
|
||||||
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模态窗口
|
* 模态窗口
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/demo/modal")
|
@RequestMapping("/demo/modal")
|
||||||
public class DemoDialogController
|
public class DemoDialogController
|
||||||
{
|
{
|
||||||
private String prefix = "demo/modal";
|
private String prefix = "demo/modal";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模态窗口
|
* 模态窗口
|
||||||
*/
|
*/
|
||||||
@GetMapping("/dialog")
|
@GetMapping("/dialog")
|
||||||
public String dialog()
|
public String dialog()
|
||||||
{
|
{
|
||||||
return prefix + "/dialog";
|
return prefix + "/dialog";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 弹层组件
|
* 弹层组件
|
||||||
*/
|
*/
|
||||||
@GetMapping("/layer")
|
@GetMapping("/layer")
|
||||||
public String layer()
|
public String layer()
|
||||||
{
|
{
|
||||||
return prefix + "/layer";
|
return prefix + "/layer";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表单
|
* 表单
|
||||||
*/
|
*/
|
||||||
@GetMapping("/form")
|
@GetMapping("/form")
|
||||||
public String form()
|
public String form()
|
||||||
{
|
{
|
||||||
return prefix + "/form";
|
return prefix + "/form";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表格
|
* 表格
|
||||||
*/
|
*/
|
||||||
@GetMapping("/table")
|
@GetMapping("/table")
|
||||||
public String table()
|
public String table()
|
||||||
{
|
{
|
||||||
return prefix + "/table";
|
return prefix + "/table";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表格check
|
* 表格check
|
||||||
*/
|
*/
|
||||||
@GetMapping("/check")
|
@GetMapping("/check")
|
||||||
public String check()
|
public String check()
|
||||||
{
|
{
|
||||||
return prefix + "/table/check";
|
return prefix + "/table/check";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表格radio
|
* 表格radio
|
||||||
*/
|
*/
|
||||||
@GetMapping("/radio")
|
@GetMapping("/radio")
|
||||||
public String radio()
|
public String radio()
|
||||||
{
|
{
|
||||||
return prefix + "/table/radio";
|
return prefix + "/table/radio";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表格回传父窗体
|
* 表格回传父窗体
|
||||||
*/
|
*/
|
||||||
@GetMapping("/parent")
|
@GetMapping("/parent")
|
||||||
public String parent()
|
public String parent()
|
||||||
{
|
{
|
||||||
return prefix + "/table/parent";
|
return prefix + "/table/parent";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,261 +1,261 @@
|
||||||
package com.ruoyi.web.controller.demo.controller;
|
package com.ruoyi.web.controller.demo.controller;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表单相关
|
* 表单相关
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/demo/form")
|
@RequestMapping("/demo/form")
|
||||||
public class DemoFormController
|
public class DemoFormController
|
||||||
{
|
{
|
||||||
private String prefix = "demo/form";
|
private String prefix = "demo/form";
|
||||||
|
|
||||||
private final static List<UserFormModel> users = new ArrayList<UserFormModel>();
|
private final static List<UserFormModel> users = new ArrayList<UserFormModel>();
|
||||||
{
|
{
|
||||||
users.add(new UserFormModel(1, "1000001", "测试1", "15888888888"));
|
users.add(new UserFormModel(1, "1000001", "测试1", "15888888888"));
|
||||||
users.add(new UserFormModel(2, "1000002", "测试2", "15666666666"));
|
users.add(new UserFormModel(2, "1000002", "测试2", "15666666666"));
|
||||||
users.add(new UserFormModel(3, "1000003", "测试3", "15666666666"));
|
users.add(new UserFormModel(3, "1000003", "测试3", "15666666666"));
|
||||||
users.add(new UserFormModel(4, "1000004", "测试4", "15666666666"));
|
users.add(new UserFormModel(4, "1000004", "测试4", "15666666666"));
|
||||||
users.add(new UserFormModel(5, "1000005", "测试5", "15666666666"));
|
users.add(new UserFormModel(5, "1000005", "测试5", "15666666666"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按钮页
|
* 按钮页
|
||||||
*/
|
*/
|
||||||
@GetMapping("/button")
|
@GetMapping("/button")
|
||||||
public String button()
|
public String button()
|
||||||
{
|
{
|
||||||
return prefix + "/button";
|
return prefix + "/button";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下拉框
|
* 下拉框
|
||||||
*/
|
*/
|
||||||
@GetMapping("/select")
|
@GetMapping("/select")
|
||||||
public String select()
|
public String select()
|
||||||
{
|
{
|
||||||
return prefix + "/select";
|
return prefix + "/select";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表单校验
|
* 表单校验
|
||||||
*/
|
*/
|
||||||
@GetMapping("/validate")
|
@GetMapping("/validate")
|
||||||
public String validate()
|
public String validate()
|
||||||
{
|
{
|
||||||
return prefix + "/validate";
|
return prefix + "/validate";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 功能扩展(包含文件上传)
|
* 功能扩展(包含文件上传)
|
||||||
*/
|
*/
|
||||||
@GetMapping("/jasny")
|
@GetMapping("/jasny")
|
||||||
public String jasny()
|
public String jasny()
|
||||||
{
|
{
|
||||||
return prefix + "/jasny";
|
return prefix + "/jasny";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拖动排序
|
* 拖动排序
|
||||||
*/
|
*/
|
||||||
@GetMapping("/sortable")
|
@GetMapping("/sortable")
|
||||||
public String sortable()
|
public String sortable()
|
||||||
{
|
{
|
||||||
return prefix + "/sortable";
|
return prefix + "/sortable";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 选项卡 & 面板
|
* 选项卡 & 面板
|
||||||
*/
|
*/
|
||||||
@GetMapping("/tabs_panels")
|
@GetMapping("/tabs_panels")
|
||||||
public String tabs_panels()
|
public String tabs_panels()
|
||||||
{
|
{
|
||||||
return prefix + "/tabs_panels";
|
return prefix + "/tabs_panels";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 栅格
|
* 栅格
|
||||||
*/
|
*/
|
||||||
@GetMapping("/grid")
|
@GetMapping("/grid")
|
||||||
public String grid()
|
public String grid()
|
||||||
{
|
{
|
||||||
return prefix + "/grid";
|
return prefix + "/grid";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表单向导
|
* 表单向导
|
||||||
*/
|
*/
|
||||||
@GetMapping("/wizard")
|
@GetMapping("/wizard")
|
||||||
public String wizard()
|
public String wizard()
|
||||||
{
|
{
|
||||||
return prefix + "/wizard";
|
return prefix + "/wizard";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件上传
|
* 文件上传
|
||||||
*/
|
*/
|
||||||
@GetMapping("/upload")
|
@GetMapping("/upload")
|
||||||
public String upload()
|
public String upload()
|
||||||
{
|
{
|
||||||
return prefix + "/upload";
|
return prefix + "/upload";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日期和时间页
|
* 日期和时间页
|
||||||
*/
|
*/
|
||||||
@GetMapping("/datetime")
|
@GetMapping("/datetime")
|
||||||
public String datetime()
|
public String datetime()
|
||||||
{
|
{
|
||||||
return prefix + "/datetime";
|
return prefix + "/datetime";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 左右互选组件
|
* 左右互选组件
|
||||||
*/
|
*/
|
||||||
@GetMapping("/duallistbox")
|
@GetMapping("/duallistbox")
|
||||||
public String duallistbox()
|
public String duallistbox()
|
||||||
{
|
{
|
||||||
return prefix + "/duallistbox";
|
return prefix + "/duallistbox";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 基本表单
|
* 基本表单
|
||||||
*/
|
*/
|
||||||
@GetMapping("/basic")
|
@GetMapping("/basic")
|
||||||
public String basic()
|
public String basic()
|
||||||
{
|
{
|
||||||
return prefix + "/basic";
|
return prefix + "/basic";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 卡片列表
|
* 卡片列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("/cards")
|
@GetMapping("/cards")
|
||||||
public String cards()
|
public String cards()
|
||||||
{
|
{
|
||||||
return prefix + "/cards";
|
return prefix + "/cards";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* summernote 富文本编辑器
|
* summernote 富文本编辑器
|
||||||
*/
|
*/
|
||||||
@GetMapping("/summernote")
|
@GetMapping("/summernote")
|
||||||
public String summernote()
|
public String summernote()
|
||||||
{
|
{
|
||||||
return prefix + "/summernote";
|
return prefix + "/summernote";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 搜索自动补全
|
* 搜索自动补全
|
||||||
*/
|
*/
|
||||||
@GetMapping("/autocomplete")
|
@GetMapping("/autocomplete")
|
||||||
public String autocomplete()
|
public String autocomplete()
|
||||||
{
|
{
|
||||||
return prefix + "/autocomplete";
|
return prefix + "/autocomplete";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户数据
|
* 获取用户数据
|
||||||
*/
|
*/
|
||||||
@GetMapping("/userModel")
|
@GetMapping("/userModel")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult userModel()
|
public AjaxResult userModel()
|
||||||
{
|
{
|
||||||
AjaxResult ajax = new AjaxResult();
|
AjaxResult ajax = new AjaxResult();
|
||||||
|
|
||||||
ajax.put("code", 200);
|
ajax.put("code", 200);
|
||||||
ajax.put("value", users);
|
ajax.put("value", users);
|
||||||
return ajax;
|
return ajax;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取数据集合
|
* 获取数据集合
|
||||||
*/
|
*/
|
||||||
@GetMapping("/collection")
|
@GetMapping("/collection")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult collection()
|
public AjaxResult collection()
|
||||||
{
|
{
|
||||||
String[] array = { "ruoyi 1", "ruoyi 2", "ruoyi 3", "ruoyi 4", "ruoyi 5" };
|
String[] array = { "ruoyi 1", "ruoyi 2", "ruoyi 3", "ruoyi 4", "ruoyi 5" };
|
||||||
AjaxResult ajax = new AjaxResult();
|
AjaxResult ajax = new AjaxResult();
|
||||||
ajax.put("value", array);
|
ajax.put("value", array);
|
||||||
return ajax;
|
return ajax;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class UserFormModel
|
class UserFormModel
|
||||||
{
|
{
|
||||||
/** 用户ID */
|
/** 用户ID */
|
||||||
private int userId;
|
private int userId;
|
||||||
|
|
||||||
/** 用户编号 */
|
/** 用户编号 */
|
||||||
private String userCode;
|
private String userCode;
|
||||||
|
|
||||||
/** 用户姓名 */
|
/** 用户姓名 */
|
||||||
private String userName;
|
private String userName;
|
||||||
|
|
||||||
/** 用户手机 */
|
/** 用户手机 */
|
||||||
private String userPhone;
|
private String userPhone;
|
||||||
|
|
||||||
public UserFormModel()
|
public UserFormModel()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserFormModel(int userId, String userCode, String userName, String userPhone)
|
public UserFormModel(int userId, String userCode, String userName, String userPhone)
|
||||||
{
|
{
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
this.userCode = userCode;
|
this.userCode = userCode;
|
||||||
this.userName = userName;
|
this.userName = userName;
|
||||||
this.userPhone = userPhone;
|
this.userPhone = userPhone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getUserId()
|
public int getUserId()
|
||||||
{
|
{
|
||||||
return userId;
|
return userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserId(int userId)
|
public void setUserId(int userId)
|
||||||
{
|
{
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserCode()
|
public String getUserCode()
|
||||||
{
|
{
|
||||||
return userCode;
|
return userCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserCode(String userCode)
|
public void setUserCode(String userCode)
|
||||||
{
|
{
|
||||||
this.userCode = userCode;
|
this.userCode = userCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserName()
|
public String getUserName()
|
||||||
{
|
{
|
||||||
return userName;
|
return userName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserName(String userName)
|
public void setUserName(String userName)
|
||||||
{
|
{
|
||||||
this.userName = userName;
|
this.userName = userName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserPhone()
|
public String getUserPhone()
|
||||||
{
|
{
|
||||||
return userPhone;
|
return userPhone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserPhone(String userPhone)
|
public void setUserPhone(String userPhone)
|
||||||
{
|
{
|
||||||
this.userPhone = userPhone;
|
this.userPhone = userPhone;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,35 +1,35 @@
|
||||||
package com.ruoyi.web.controller.demo.controller;
|
package com.ruoyi.web.controller.demo.controller;
|
||||||
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 图标相关
|
* 图标相关
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/demo/icon")
|
@RequestMapping("/demo/icon")
|
||||||
public class DemoIconController
|
public class DemoIconController
|
||||||
{
|
{
|
||||||
private String prefix = "demo/icon";
|
private String prefix = "demo/icon";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FontAwesome图标
|
* FontAwesome图标
|
||||||
*/
|
*/
|
||||||
@GetMapping("/fontawesome")
|
@GetMapping("/fontawesome")
|
||||||
public String fontAwesome()
|
public String fontAwesome()
|
||||||
{
|
{
|
||||||
return prefix + "/fontawesome";
|
return prefix + "/fontawesome";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Glyphicons图标
|
* Glyphicons图标
|
||||||
*/
|
*/
|
||||||
@GetMapping("/glyphicons")
|
@GetMapping("/glyphicons")
|
||||||
public String glyphicons()
|
public String glyphicons()
|
||||||
{
|
{
|
||||||
return prefix + "/glyphicons";
|
return prefix + "/glyphicons";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,303 +1,303 @@
|
||||||
package com.ruoyi.web.controller.demo.controller;
|
package com.ruoyi.web.controller.demo.controller;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.page.PageDomain;
|
import com.ruoyi.common.core.page.PageDomain;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.core.page.TableSupport;
|
import com.ruoyi.common.core.page.TableSupport;
|
||||||
import com.ruoyi.common.core.text.Convert;
|
import com.ruoyi.common.core.text.Convert;
|
||||||
import com.ruoyi.common.exception.BusinessException;
|
import com.ruoyi.common.exception.BusinessException;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.web.controller.demo.domain.UserOperateModel;
|
import com.ruoyi.web.controller.demo.domain.UserOperateModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作控制
|
* 操作控制
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/demo/operate")
|
@RequestMapping("/demo/operate")
|
||||||
public class DemoOperateController extends BaseController
|
public class DemoOperateController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "demo/operate";
|
private String prefix = "demo/operate";
|
||||||
|
|
||||||
private final static Map<Integer, UserOperateModel> users = new LinkedHashMap<Integer, UserOperateModel>();
|
private final static Map<Integer, UserOperateModel> users = new LinkedHashMap<Integer, UserOperateModel>();
|
||||||
{
|
{
|
||||||
users.put(1, new UserOperateModel(1, "1000001", "测试1", "0", "15888888888", "ry@qq.com", 150.0, "0"));
|
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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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"));
|
users.put(26, new UserOperateModel(26, "1000026", "测试26", "1", "15666666666", "ry@qq.com", 250.0, "1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表格
|
* 表格
|
||||||
*/
|
*/
|
||||||
@GetMapping("/table")
|
@GetMapping("/table")
|
||||||
public String table()
|
public String table()
|
||||||
{
|
{
|
||||||
return prefix + "/table";
|
return prefix + "/table";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 其他
|
* 其他
|
||||||
*/
|
*/
|
||||||
@GetMapping("/other")
|
@GetMapping("/other")
|
||||||
public String other()
|
public String other()
|
||||||
{
|
{
|
||||||
return prefix + "/other";
|
return prefix + "/other";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询数据
|
* 查询数据
|
||||||
*/
|
*/
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(UserOperateModel userModel)
|
public TableDataInfo list(UserOperateModel userModel)
|
||||||
{
|
{
|
||||||
TableDataInfo rspData = new TableDataInfo();
|
TableDataInfo rspData = new TableDataInfo();
|
||||||
List<UserOperateModel> userList = new ArrayList<UserOperateModel>(users.values());
|
List<UserOperateModel> userList = new ArrayList<UserOperateModel>(users.values());
|
||||||
// 查询条件过滤
|
// 查询条件过滤
|
||||||
if (StringUtils.isNotEmpty(userModel.getSearchValue()))
|
if (StringUtils.isNotEmpty(userModel.getSearchValue()))
|
||||||
{
|
{
|
||||||
userList.clear();
|
userList.clear();
|
||||||
for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet())
|
for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet())
|
||||||
{
|
{
|
||||||
if (entry.getValue().getUserName().equals(userModel.getSearchValue()))
|
if (entry.getValue().getUserName().equals(userModel.getSearchValue()))
|
||||||
{
|
{
|
||||||
userList.add(entry.getValue());
|
userList.add(entry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||||
if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize())
|
if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize())
|
||||||
{
|
{
|
||||||
rspData.setRows(userList);
|
rspData.setRows(userList);
|
||||||
rspData.setTotal(userList.size());
|
rspData.setTotal(userList.size());
|
||||||
return rspData;
|
return rspData;
|
||||||
}
|
}
|
||||||
Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
|
Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
|
||||||
Integer pageSize = pageDomain.getPageNum() * 10;
|
Integer pageSize = pageDomain.getPageNum() * 10;
|
||||||
if (pageSize > userList.size())
|
if (pageSize > userList.size())
|
||||||
{
|
{
|
||||||
pageSize = userList.size();
|
pageSize = userList.size();
|
||||||
}
|
}
|
||||||
rspData.setRows(userList.subList(pageNum, pageSize));
|
rspData.setRows(userList.subList(pageNum, pageSize));
|
||||||
rspData.setTotal(userList.size());
|
rspData.setTotal(userList.size());
|
||||||
return rspData;
|
return rspData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增用户
|
* 新增用户
|
||||||
*/
|
*/
|
||||||
@GetMapping("/add")
|
@GetMapping("/add")
|
||||||
public String add(ModelMap mmap)
|
public String add(ModelMap mmap)
|
||||||
{
|
{
|
||||||
return prefix + "/add";
|
return prefix + "/add";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增保存用户
|
* 新增保存用户
|
||||||
*/
|
*/
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(UserOperateModel user)
|
public AjaxResult addSave(UserOperateModel user)
|
||||||
{
|
{
|
||||||
Integer userId = users.size() + 1;
|
Integer userId = users.size() + 1;
|
||||||
user.setUserId(userId);
|
user.setUserId(userId);
|
||||||
return AjaxResult.success(users.put(userId, user));
|
return AjaxResult.success(users.put(userId, user));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改用户
|
* 修改用户
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit/{userId}")
|
@GetMapping("/edit/{userId}")
|
||||||
public String edit(@PathVariable("userId") Integer userId, ModelMap mmap)
|
public String edit(@PathVariable("userId") Integer userId, ModelMap mmap)
|
||||||
{
|
{
|
||||||
mmap.put("user", users.get(userId));
|
mmap.put("user", users.get(userId));
|
||||||
return prefix + "/edit";
|
return prefix + "/edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改保存用户
|
* 修改保存用户
|
||||||
*/
|
*/
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(UserOperateModel user)
|
public AjaxResult editSave(UserOperateModel user)
|
||||||
{
|
{
|
||||||
return AjaxResult.success(users.put(user.getUserId(), user));
|
return AjaxResult.success(users.put(user.getUserId(), user));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出
|
* 导出
|
||||||
*/
|
*/
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(UserOperateModel user)
|
public AjaxResult export(UserOperateModel user)
|
||||||
{
|
{
|
||||||
List<UserOperateModel> list = new ArrayList<UserOperateModel>(users.values());
|
List<UserOperateModel> list = new ArrayList<UserOperateModel>(users.values());
|
||||||
ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class);
|
ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class);
|
||||||
return util.exportExcel(list, "用户数据");
|
return util.exportExcel(list, "用户数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下载模板
|
* 下载模板
|
||||||
*/
|
*/
|
||||||
@GetMapping("/importTemplate")
|
@GetMapping("/importTemplate")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult importTemplate()
|
public AjaxResult importTemplate()
|
||||||
{
|
{
|
||||||
ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class);
|
ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class);
|
||||||
return util.importTemplateExcel("用户数据");
|
return util.importTemplateExcel("用户数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导入数据
|
* 导入数据
|
||||||
*/
|
*/
|
||||||
@PostMapping("/importData")
|
@PostMapping("/importData")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
||||||
{
|
{
|
||||||
ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class);
|
ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class);
|
||||||
List<UserOperateModel> userList = util.importExcel(file.getInputStream());
|
List<UserOperateModel> userList = util.importExcel(file.getInputStream());
|
||||||
String message = importUser(userList, updateSupport);
|
String message = importUser(userList, updateSupport);
|
||||||
return AjaxResult.success(message);
|
return AjaxResult.success(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除用户
|
* 删除用户
|
||||||
*/
|
*/
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(String ids)
|
public AjaxResult remove(String ids)
|
||||||
{
|
{
|
||||||
Integer[] userIds = Convert.toIntArray(ids);
|
Integer[] userIds = Convert.toIntArray(ids);
|
||||||
for (Integer userId : userIds)
|
for (Integer userId : userIds)
|
||||||
{
|
{
|
||||||
users.remove(userId);
|
users.remove(userId);
|
||||||
}
|
}
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查看详细
|
* 查看详细
|
||||||
*/
|
*/
|
||||||
@GetMapping("/detail/{userId}")
|
@GetMapping("/detail/{userId}")
|
||||||
public String detail(@PathVariable("userId") Integer userId, ModelMap mmap)
|
public String detail(@PathVariable("userId") Integer userId, ModelMap mmap)
|
||||||
{
|
{
|
||||||
mmap.put("user", users.get(userId));
|
mmap.put("user", users.get(userId));
|
||||||
return prefix + "/detail";
|
return prefix + "/detail";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/clean")
|
@PostMapping("/clean")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult clean()
|
public AjaxResult clean()
|
||||||
{
|
{
|
||||||
users.clear();
|
users.clear();
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导入用户数据
|
* 导入用户数据
|
||||||
*
|
*
|
||||||
* @param userList 用户数据列表
|
* @param userList 用户数据列表
|
||||||
* @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
|
* @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public String importUser(List<UserOperateModel> userList, Boolean isUpdateSupport)
|
public String importUser(List<UserOperateModel> userList, Boolean isUpdateSupport)
|
||||||
{
|
{
|
||||||
if (StringUtils.isNull(userList) || userList.size() == 0)
|
if (StringUtils.isNull(userList) || userList.size() == 0)
|
||||||
{
|
{
|
||||||
throw new BusinessException("导入用户数据不能为空!");
|
throw new BusinessException("导入用户数据不能为空!");
|
||||||
}
|
}
|
||||||
int successNum = 0;
|
int successNum = 0;
|
||||||
int failureNum = 0;
|
int failureNum = 0;
|
||||||
StringBuilder successMsg = new StringBuilder();
|
StringBuilder successMsg = new StringBuilder();
|
||||||
StringBuilder failureMsg = new StringBuilder();
|
StringBuilder failureMsg = new StringBuilder();
|
||||||
for (UserOperateModel user : userList)
|
for (UserOperateModel user : userList)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 验证是否存在这个用户
|
// 验证是否存在这个用户
|
||||||
boolean userFlag = false;
|
boolean userFlag = false;
|
||||||
for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet())
|
for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet())
|
||||||
{
|
{
|
||||||
if (entry.getValue().getUserName().equals(user.getUserName()))
|
if (entry.getValue().getUserName().equals(user.getUserName()))
|
||||||
{
|
{
|
||||||
userFlag = true;
|
userFlag = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!userFlag)
|
if (!userFlag)
|
||||||
{
|
{
|
||||||
Integer userId = users.size() + 1;
|
Integer userId = users.size() + 1;
|
||||||
user.setUserId(userId);
|
user.setUserId(userId);
|
||||||
users.put(userId, user);
|
users.put(userId, user);
|
||||||
successNum++;
|
successNum++;
|
||||||
successMsg.append("<br/>" + successNum + "、用户 " + user.getUserName() + " 导入成功");
|
successMsg.append("<br/>" + successNum + "、用户 " + user.getUserName() + " 导入成功");
|
||||||
}
|
}
|
||||||
else if (isUpdateSupport)
|
else if (isUpdateSupport)
|
||||||
{
|
{
|
||||||
users.put(user.getUserId(), user);
|
users.put(user.getUserId(), user);
|
||||||
successNum++;
|
successNum++;
|
||||||
successMsg.append("<br/>" + successNum + "、用户 " + user.getUserName() + " 更新成功");
|
successMsg.append("<br/>" + successNum + "、用户 " + user.getUserName() + " 更新成功");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
failureNum++;
|
failureNum++;
|
||||||
failureMsg.append("<br/>" + failureNum + "、用户 " + user.getUserName() + " 已存在");
|
failureMsg.append("<br/>" + failureNum + "、用户 " + user.getUserName() + " 已存在");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
failureNum++;
|
failureNum++;
|
||||||
String msg = "<br/>" + failureNum + "、账号 " + user.getUserName() + " 导入失败:";
|
String msg = "<br/>" + failureNum + "、账号 " + user.getUserName() + " 导入失败:";
|
||||||
failureMsg.append(msg + e.getMessage());
|
failureMsg.append(msg + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (failureNum > 0)
|
if (failureNum > 0)
|
||||||
{
|
{
|
||||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||||
throw new BusinessException(failureMsg.toString());
|
throw new BusinessException(failureMsg.toString());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||||
}
|
}
|
||||||
return successMsg.toString();
|
return successMsg.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,53 +1,53 @@
|
||||||
package com.ruoyi.web.controller.demo.controller;
|
package com.ruoyi.web.controller.demo.controller;
|
||||||
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 报表
|
* 报表
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/demo/report")
|
@RequestMapping("/demo/report")
|
||||||
public class DemoReportController
|
public class DemoReportController
|
||||||
{
|
{
|
||||||
private String prefix = "demo/report";
|
private String prefix = "demo/report";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 百度ECharts
|
* 百度ECharts
|
||||||
*/
|
*/
|
||||||
@GetMapping("/echarts")
|
@GetMapping("/echarts")
|
||||||
public String echarts()
|
public String echarts()
|
||||||
{
|
{
|
||||||
return prefix + "/echarts";
|
return prefix + "/echarts";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 图表插件
|
* 图表插件
|
||||||
*/
|
*/
|
||||||
@GetMapping("/peity")
|
@GetMapping("/peity")
|
||||||
public String peity()
|
public String peity()
|
||||||
{
|
{
|
||||||
return prefix + "/peity";
|
return prefix + "/peity";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 线状图插件
|
* 线状图插件
|
||||||
*/
|
*/
|
||||||
@GetMapping("/sparkline")
|
@GetMapping("/sparkline")
|
||||||
public String sparkline()
|
public String sparkline()
|
||||||
{
|
{
|
||||||
return prefix + "/sparkline";
|
return prefix + "/sparkline";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 图表组合
|
* 图表组合
|
||||||
*/
|
*/
|
||||||
@GetMapping("/metrics")
|
@GetMapping("/metrics")
|
||||||
public String metrics()
|
public String metrics()
|
||||||
{
|
{
|
||||||
return prefix + "/metrics";
|
return prefix + "/metrics";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,385 +1,385 @@
|
||||||
package com.ruoyi.web.controller.demo.controller;
|
package com.ruoyi.web.controller.demo.controller;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.page.PageDomain;
|
import com.ruoyi.common.core.page.PageDomain;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.core.page.TableSupport;
|
import com.ruoyi.common.core.page.TableSupport;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表格相关
|
* 表格相关
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/demo/table")
|
@RequestMapping("/demo/table")
|
||||||
public class DemoTableController extends BaseController
|
public class DemoTableController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "demo/table";
|
private String prefix = "demo/table";
|
||||||
|
|
||||||
private final static List<UserTableModel> users = new ArrayList<UserTableModel>();
|
private final static List<UserTableModel> users = new ArrayList<UserTableModel>();
|
||||||
{
|
{
|
||||||
users.add(new UserTableModel(1, "1000001", "测试1", "0", "15888888888", "ry@qq.com", 150.0, "0"));
|
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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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"));
|
users.add(new UserTableModel(26, "1000026", "测试26", "1", "15666666666", "ry@qq.com", 250.0, "1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 搜索相关
|
* 搜索相关
|
||||||
*/
|
*/
|
||||||
@GetMapping("/search")
|
@GetMapping("/search")
|
||||||
public String search()
|
public String search()
|
||||||
{
|
{
|
||||||
return prefix + "/search";
|
return prefix + "/search";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据汇总
|
* 数据汇总
|
||||||
*/
|
*/
|
||||||
@GetMapping("/footer")
|
@GetMapping("/footer")
|
||||||
public String footer()
|
public String footer()
|
||||||
{
|
{
|
||||||
return prefix + "/footer";
|
return prefix + "/footer";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 组合表头
|
* 组合表头
|
||||||
*/
|
*/
|
||||||
@GetMapping("/groupHeader")
|
@GetMapping("/groupHeader")
|
||||||
public String groupHeader()
|
public String groupHeader()
|
||||||
{
|
{
|
||||||
return prefix + "/groupHeader";
|
return prefix + "/groupHeader";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表格导出
|
* 表格导出
|
||||||
*/
|
*/
|
||||||
@GetMapping("/export")
|
@GetMapping("/export")
|
||||||
public String export()
|
public String export()
|
||||||
{
|
{
|
||||||
return prefix + "/export";
|
return prefix + "/export";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 翻页记住选择
|
* 翻页记住选择
|
||||||
*/
|
*/
|
||||||
@GetMapping("/remember")
|
@GetMapping("/remember")
|
||||||
public String remember()
|
public String remember()
|
||||||
{
|
{
|
||||||
return prefix + "/remember";
|
return prefix + "/remember";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 跳转至指定页
|
* 跳转至指定页
|
||||||
*/
|
*/
|
||||||
@GetMapping("/pageGo")
|
@GetMapping("/pageGo")
|
||||||
public String pageGo()
|
public String pageGo()
|
||||||
{
|
{
|
||||||
return prefix + "/pageGo";
|
return prefix + "/pageGo";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义查询参数
|
* 自定义查询参数
|
||||||
*/
|
*/
|
||||||
@GetMapping("/params")
|
@GetMapping("/params")
|
||||||
public String params()
|
public String params()
|
||||||
{
|
{
|
||||||
return prefix + "/params";
|
return prefix + "/params";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 多表格
|
* 多表格
|
||||||
*/
|
*/
|
||||||
@GetMapping("/multi")
|
@GetMapping("/multi")
|
||||||
public String multi()
|
public String multi()
|
||||||
{
|
{
|
||||||
return prefix + "/multi";
|
return prefix + "/multi";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 点击按钮加载表格
|
* 点击按钮加载表格
|
||||||
*/
|
*/
|
||||||
@GetMapping("/button")
|
@GetMapping("/button")
|
||||||
public String button()
|
public String button()
|
||||||
{
|
{
|
||||||
return prefix + "/button";
|
return prefix + "/button";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表格冻结列
|
* 表格冻结列
|
||||||
*/
|
*/
|
||||||
@GetMapping("/fixedColumns")
|
@GetMapping("/fixedColumns")
|
||||||
public String fixedColumns()
|
public String fixedColumns()
|
||||||
{
|
{
|
||||||
return prefix + "/fixedColumns";
|
return prefix + "/fixedColumns";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义触发事件
|
* 自定义触发事件
|
||||||
*/
|
*/
|
||||||
@GetMapping("/event")
|
@GetMapping("/event")
|
||||||
public String event()
|
public String event()
|
||||||
{
|
{
|
||||||
return prefix + "/event";
|
return prefix + "/event";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表格细节视图
|
* 表格细节视图
|
||||||
*/
|
*/
|
||||||
@GetMapping("/detail")
|
@GetMapping("/detail")
|
||||||
public String detail()
|
public String detail()
|
||||||
{
|
{
|
||||||
return prefix + "/detail";
|
return prefix + "/detail";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表格图片预览
|
* 表格图片预览
|
||||||
*/
|
*/
|
||||||
@GetMapping("/image")
|
@GetMapping("/image")
|
||||||
public String image()
|
public String image()
|
||||||
{
|
{
|
||||||
return prefix + "/image";
|
return prefix + "/image";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 动态增删改查
|
* 动态增删改查
|
||||||
*/
|
*/
|
||||||
@GetMapping("/curd")
|
@GetMapping("/curd")
|
||||||
public String curd()
|
public String curd()
|
||||||
{
|
{
|
||||||
return prefix + "/curd";
|
return prefix + "/curd";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表格拖拽操作
|
* 表格拖拽操作
|
||||||
*/
|
*/
|
||||||
@GetMapping("/reorder")
|
@GetMapping("/reorder")
|
||||||
public String reorder()
|
public String reorder()
|
||||||
{
|
{
|
||||||
return prefix + "/reorder";
|
return prefix + "/reorder";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表格其他操作
|
* 表格其他操作
|
||||||
*/
|
*/
|
||||||
@GetMapping("/other")
|
@GetMapping("/other")
|
||||||
public String other()
|
public String other()
|
||||||
{
|
{
|
||||||
return prefix + "/other";
|
return prefix + "/other";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询数据
|
* 查询数据
|
||||||
*/
|
*/
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(UserTableModel userModel)
|
public TableDataInfo list(UserTableModel userModel)
|
||||||
{
|
{
|
||||||
TableDataInfo rspData = new TableDataInfo();
|
TableDataInfo rspData = new TableDataInfo();
|
||||||
List<UserTableModel> userList = new ArrayList<UserTableModel>(Arrays.asList(new UserTableModel[users.size()]));
|
List<UserTableModel> userList = new ArrayList<UserTableModel>(Arrays.asList(new UserTableModel[users.size()]));
|
||||||
Collections.copy(userList, users);
|
Collections.copy(userList, users);
|
||||||
// 查询条件过滤
|
// 查询条件过滤
|
||||||
if (StringUtils.isNotEmpty(userModel.getUserName()))
|
if (StringUtils.isNotEmpty(userModel.getUserName()))
|
||||||
{
|
{
|
||||||
userList.clear();
|
userList.clear();
|
||||||
for (UserTableModel user : users)
|
for (UserTableModel user : users)
|
||||||
{
|
{
|
||||||
if (user.getUserName().equals(userModel.getUserName()))
|
if (user.getUserName().equals(userModel.getUserName()))
|
||||||
{
|
{
|
||||||
userList.add(user);
|
userList.add(user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||||
if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize())
|
if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize())
|
||||||
{
|
{
|
||||||
rspData.setRows(userList);
|
rspData.setRows(userList);
|
||||||
rspData.setTotal(userList.size());
|
rspData.setTotal(userList.size());
|
||||||
return rspData;
|
return rspData;
|
||||||
}
|
}
|
||||||
Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
|
Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
|
||||||
Integer pageSize = pageDomain.getPageNum() * 10;
|
Integer pageSize = pageDomain.getPageNum() * 10;
|
||||||
if (pageSize > userList.size())
|
if (pageSize > userList.size())
|
||||||
{
|
{
|
||||||
pageSize = userList.size();
|
pageSize = userList.size();
|
||||||
}
|
}
|
||||||
rspData.setRows(userList.subList(pageNum, pageSize));
|
rspData.setRows(userList.subList(pageNum, pageSize));
|
||||||
rspData.setTotal(userList.size());
|
rspData.setTotal(userList.size());
|
||||||
return rspData;
|
return rspData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class UserTableModel
|
class UserTableModel
|
||||||
{
|
{
|
||||||
/** 用户ID */
|
/** 用户ID */
|
||||||
private int userId;
|
private int userId;
|
||||||
|
|
||||||
/** 用户编号 */
|
/** 用户编号 */
|
||||||
private String userCode;
|
private String userCode;
|
||||||
|
|
||||||
/** 用户姓名 */
|
/** 用户姓名 */
|
||||||
private String userName;
|
private String userName;
|
||||||
|
|
||||||
/** 用户性别 */
|
/** 用户性别 */
|
||||||
private String userSex;
|
private String userSex;
|
||||||
|
|
||||||
/** 用户手机 */
|
/** 用户手机 */
|
||||||
private String userPhone;
|
private String userPhone;
|
||||||
|
|
||||||
/** 用户邮箱 */
|
/** 用户邮箱 */
|
||||||
private String userEmail;
|
private String userEmail;
|
||||||
|
|
||||||
/** 用户余额 */
|
/** 用户余额 */
|
||||||
private double userBalance;
|
private double userBalance;
|
||||||
|
|
||||||
/** 用户状态(0正常 1停用) */
|
/** 用户状态(0正常 1停用) */
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/** 创建时间 */
|
/** 创建时间 */
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
public UserTableModel()
|
public UserTableModel()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserTableModel(int userId, String userCode, String userName, String userSex, String userPhone,
|
public UserTableModel(int userId, String userCode, String userName, String userSex, String userPhone,
|
||||||
String userEmail, double userBalance, String status)
|
String userEmail, double userBalance, String status)
|
||||||
{
|
{
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
this.userCode = userCode;
|
this.userCode = userCode;
|
||||||
this.userName = userName;
|
this.userName = userName;
|
||||||
this.userSex = userSex;
|
this.userSex = userSex;
|
||||||
this.userPhone = userPhone;
|
this.userPhone = userPhone;
|
||||||
this.userEmail = userEmail;
|
this.userEmail = userEmail;
|
||||||
this.userBalance = userBalance;
|
this.userBalance = userBalance;
|
||||||
this.status = status;
|
this.status = status;
|
||||||
this.createTime = DateUtils.getNowDate();
|
this.createTime = DateUtils.getNowDate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getUserId()
|
public int getUserId()
|
||||||
{
|
{
|
||||||
return userId;
|
return userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserId(int userId)
|
public void setUserId(int userId)
|
||||||
{
|
{
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserCode()
|
public String getUserCode()
|
||||||
{
|
{
|
||||||
return userCode;
|
return userCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserCode(String userCode)
|
public void setUserCode(String userCode)
|
||||||
{
|
{
|
||||||
this.userCode = userCode;
|
this.userCode = userCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserName()
|
public String getUserName()
|
||||||
{
|
{
|
||||||
return userName;
|
return userName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserName(String userName)
|
public void setUserName(String userName)
|
||||||
{
|
{
|
||||||
this.userName = userName;
|
this.userName = userName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserSex()
|
public String getUserSex()
|
||||||
{
|
{
|
||||||
return userSex;
|
return userSex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserSex(String userSex)
|
public void setUserSex(String userSex)
|
||||||
{
|
{
|
||||||
this.userSex = userSex;
|
this.userSex = userSex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserPhone()
|
public String getUserPhone()
|
||||||
{
|
{
|
||||||
return userPhone;
|
return userPhone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserPhone(String userPhone)
|
public void setUserPhone(String userPhone)
|
||||||
{
|
{
|
||||||
this.userPhone = userPhone;
|
this.userPhone = userPhone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserEmail()
|
public String getUserEmail()
|
||||||
{
|
{
|
||||||
return userEmail;
|
return userEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserEmail(String userEmail)
|
public void setUserEmail(String userEmail)
|
||||||
{
|
{
|
||||||
this.userEmail = userEmail;
|
this.userEmail = userEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getUserBalance()
|
public double getUserBalance()
|
||||||
{
|
{
|
||||||
return userBalance;
|
return userBalance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserBalance(double userBalance)
|
public void setUserBalance(double userBalance)
|
||||||
{
|
{
|
||||||
this.userBalance = userBalance;
|
this.userBalance = userBalance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStatus()
|
public String getStatus()
|
||||||
{
|
{
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatus(String status)
|
public void setStatus(String status)
|
||||||
{
|
{
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getCreateTime()
|
public Date getCreateTime()
|
||||||
{
|
{
|
||||||
return createTime;
|
return createTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreateTime(Date createTime)
|
public void setCreateTime(Date createTime)
|
||||||
{
|
{
|
||||||
this.createTime = createTime;
|
this.createTime = createTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,147 +1,147 @@
|
||||||
package com.ruoyi.web.controller.demo.domain;
|
package com.ruoyi.web.controller.demo.domain;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import com.ruoyi.common.annotation.Excel.Type;
|
import com.ruoyi.common.annotation.Excel.Type;
|
||||||
import com.ruoyi.common.core.domain.BaseEntity;
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
|
||||||
public class UserOperateModel extends BaseEntity
|
public class UserOperateModel extends BaseEntity
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private int userId;
|
private int userId;
|
||||||
|
|
||||||
@Excel(name = "用户编号")
|
@Excel(name = "用户编号")
|
||||||
private String userCode;
|
private String userCode;
|
||||||
|
|
||||||
@Excel(name = "用户姓名")
|
@Excel(name = "用户姓名")
|
||||||
private String userName;
|
private String userName;
|
||||||
|
|
||||||
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
|
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
|
||||||
private String userSex;
|
private String userSex;
|
||||||
|
|
||||||
@Excel(name = "用户手机")
|
@Excel(name = "用户手机")
|
||||||
private String userPhone;
|
private String userPhone;
|
||||||
|
|
||||||
@Excel(name = "用户邮箱")
|
@Excel(name = "用户邮箱")
|
||||||
private String userEmail;
|
private String userEmail;
|
||||||
|
|
||||||
@Excel(name = "用户余额")
|
@Excel(name = "用户余额")
|
||||||
private double userBalance;
|
private double userBalance;
|
||||||
|
|
||||||
@Excel(name = "用户状态", readConverterExp = "0=正常,1=停用")
|
@Excel(name = "用户状态", readConverterExp = "0=正常,1=停用")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
|
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
public UserOperateModel()
|
public UserOperateModel()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserOperateModel(int userId, String userCode, String userName, String userSex, String userPhone,
|
public UserOperateModel(int userId, String userCode, String userName, String userSex, String userPhone,
|
||||||
String userEmail, double userBalance, String status)
|
String userEmail, double userBalance, String status)
|
||||||
{
|
{
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
this.userCode = userCode;
|
this.userCode = userCode;
|
||||||
this.userName = userName;
|
this.userName = userName;
|
||||||
this.userSex = userSex;
|
this.userSex = userSex;
|
||||||
this.userPhone = userPhone;
|
this.userPhone = userPhone;
|
||||||
this.userEmail = userEmail;
|
this.userEmail = userEmail;
|
||||||
this.userBalance = userBalance;
|
this.userBalance = userBalance;
|
||||||
this.status = status;
|
this.status = status;
|
||||||
this.createTime = DateUtils.getNowDate();
|
this.createTime = DateUtils.getNowDate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getUserId()
|
public int getUserId()
|
||||||
{
|
{
|
||||||
return userId;
|
return userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserId(int userId)
|
public void setUserId(int userId)
|
||||||
{
|
{
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserCode()
|
public String getUserCode()
|
||||||
{
|
{
|
||||||
return userCode;
|
return userCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserCode(String userCode)
|
public void setUserCode(String userCode)
|
||||||
{
|
{
|
||||||
this.userCode = userCode;
|
this.userCode = userCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserName()
|
public String getUserName()
|
||||||
{
|
{
|
||||||
return userName;
|
return userName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserName(String userName)
|
public void setUserName(String userName)
|
||||||
{
|
{
|
||||||
this.userName = userName;
|
this.userName = userName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserSex()
|
public String getUserSex()
|
||||||
{
|
{
|
||||||
return userSex;
|
return userSex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserSex(String userSex)
|
public void setUserSex(String userSex)
|
||||||
{
|
{
|
||||||
this.userSex = userSex;
|
this.userSex = userSex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserPhone()
|
public String getUserPhone()
|
||||||
{
|
{
|
||||||
return userPhone;
|
return userPhone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserPhone(String userPhone)
|
public void setUserPhone(String userPhone)
|
||||||
{
|
{
|
||||||
this.userPhone = userPhone;
|
this.userPhone = userPhone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserEmail()
|
public String getUserEmail()
|
||||||
{
|
{
|
||||||
return userEmail;
|
return userEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserEmail(String userEmail)
|
public void setUserEmail(String userEmail)
|
||||||
{
|
{
|
||||||
this.userEmail = userEmail;
|
this.userEmail = userEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getUserBalance()
|
public double getUserBalance()
|
||||||
{
|
{
|
||||||
return userBalance;
|
return userBalance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserBalance(double userBalance)
|
public void setUserBalance(double userBalance)
|
||||||
{
|
{
|
||||||
this.userBalance = userBalance;
|
this.userBalance = userBalance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStatus()
|
public String getStatus()
|
||||||
{
|
{
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatus(String status)
|
public void setStatus(String status)
|
||||||
{
|
{
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getCreateTime()
|
public Date getCreateTime()
|
||||||
{
|
{
|
||||||
return createTime;
|
return createTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreateTime(Date createTime)
|
public void setCreateTime(Date createTime)
|
||||||
{
|
{
|
||||||
this.createTime = createTime;
|
this.createTime = createTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,26 +1,26 @@
|
||||||
package com.ruoyi.web.controller.monitor;
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* druid 监控
|
* druid 监控
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/monitor/data")
|
@RequestMapping("/monitor/data")
|
||||||
public class DruidController extends BaseController
|
public class DruidController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "/druid";
|
private String prefix = "/druid";
|
||||||
|
|
||||||
@RequiresPermissions("monitor:data:view")
|
@RequiresPermissions("monitor:data:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String index()
|
public String index()
|
||||||
{
|
{
|
||||||
return redirect(prefix + "/index");
|
return redirect(prefix + "/index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,31 +1,31 @@
|
||||||
package com.ruoyi.web.controller.monitor;
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.framework.web.domain.Server;
|
import com.ruoyi.framework.web.domain.Server;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务器监控
|
* 服务器监控
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/monitor/server")
|
@RequestMapping("/monitor/server")
|
||||||
public class ServerController extends BaseController
|
public class ServerController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "monitor/server";
|
private String prefix = "monitor/server";
|
||||||
|
|
||||||
@RequiresPermissions("monitor:server:view")
|
@RequiresPermissions("monitor:server:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String server(ModelMap mmap) throws Exception
|
public String server(ModelMap mmap) throws Exception
|
||||||
{
|
{
|
||||||
Server server = new Server();
|
Server server = new Server();
|
||||||
server.copyTo();
|
server.copyTo();
|
||||||
mmap.put("server", server);
|
mmap.put("server", server);
|
||||||
return prefix + "/server";
|
return prefix + "/server";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,80 +1,80 @@
|
||||||
package com.ruoyi.web.controller.monitor;
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.system.domain.SysLogininfor;
|
import com.ruoyi.system.domain.SysLogininfor;
|
||||||
import com.ruoyi.system.service.ISysLogininforService;
|
import com.ruoyi.system.service.ISysLogininforService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统访问记录
|
* 系统访问记录
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/monitor/logininfor")
|
@RequestMapping("/monitor/logininfor")
|
||||||
public class SysLogininforController extends BaseController
|
public class SysLogininforController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "monitor/logininfor";
|
private String prefix = "monitor/logininfor";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysLogininforService logininforService;
|
private ISysLogininforService logininforService;
|
||||||
|
|
||||||
@RequiresPermissions("monitor:logininfor:view")
|
@RequiresPermissions("monitor:logininfor:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String logininfor()
|
public String logininfor()
|
||||||
{
|
{
|
||||||
return prefix + "/logininfor";
|
return prefix + "/logininfor";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("monitor:logininfor:list")
|
@RequiresPermissions("monitor:logininfor:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(SysLogininfor logininfor)
|
public TableDataInfo list(SysLogininfor logininfor)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = "登陆日志", businessType = BusinessType.EXPORT)
|
@Log(title = "登陆日志", businessType = BusinessType.EXPORT)
|
||||||
@RequiresPermissions("monitor:logininfor:export")
|
@RequiresPermissions("monitor:logininfor:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(SysLogininfor logininfor)
|
public AjaxResult export(SysLogininfor logininfor)
|
||||||
{
|
{
|
||||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||||
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
|
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
|
||||||
return util.exportExcel(list, "登陆日志");
|
return util.exportExcel(list, "登陆日志");
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("monitor:logininfor:remove")
|
@RequiresPermissions("monitor:logininfor:remove")
|
||||||
@Log(title = "登陆日志", businessType = BusinessType.DELETE)
|
@Log(title = "登陆日志", businessType = BusinessType.DELETE)
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(String ids)
|
public AjaxResult remove(String ids)
|
||||||
{
|
{
|
||||||
return toAjax(logininforService.deleteLogininforByIds(ids));
|
return toAjax(logininforService.deleteLogininforByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("monitor:logininfor:remove")
|
@RequiresPermissions("monitor:logininfor:remove")
|
||||||
@Log(title = "登陆日志", businessType = BusinessType.CLEAN)
|
@Log(title = "登陆日志", businessType = BusinessType.CLEAN)
|
||||||
@PostMapping("/clean")
|
@PostMapping("/clean")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult clean()
|
public AjaxResult clean()
|
||||||
{
|
{
|
||||||
logininforService.cleanLogininfor();
|
logininforService.cleanLogininfor();
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,89 +1,89 @@
|
||||||
package com.ruoyi.web.controller.monitor;
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.system.domain.SysOperLog;
|
import com.ruoyi.system.domain.SysOperLog;
|
||||||
import com.ruoyi.system.service.ISysOperLogService;
|
import com.ruoyi.system.service.ISysOperLogService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作日志记录
|
* 操作日志记录
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/monitor/operlog")
|
@RequestMapping("/monitor/operlog")
|
||||||
public class SysOperlogController extends BaseController
|
public class SysOperlogController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "monitor/operlog";
|
private String prefix = "monitor/operlog";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysOperLogService operLogService;
|
private ISysOperLogService operLogService;
|
||||||
|
|
||||||
@RequiresPermissions("monitor:operlog:view")
|
@RequiresPermissions("monitor:operlog:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String operlog()
|
public String operlog()
|
||||||
{
|
{
|
||||||
return prefix + "/operlog";
|
return prefix + "/operlog";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("monitor:operlog:list")
|
@RequiresPermissions("monitor:operlog:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(SysOperLog operLog)
|
public TableDataInfo list(SysOperLog operLog)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
||||||
@RequiresPermissions("monitor:operlog:export")
|
@RequiresPermissions("monitor:operlog:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(SysOperLog operLog)
|
public AjaxResult export(SysOperLog operLog)
|
||||||
{
|
{
|
||||||
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||||
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
|
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
|
||||||
return util.exportExcel(list, "操作日志");
|
return util.exportExcel(list, "操作日志");
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("monitor:operlog:remove")
|
@RequiresPermissions("monitor:operlog:remove")
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(String ids)
|
public AjaxResult remove(String ids)
|
||||||
{
|
{
|
||||||
return toAjax(operLogService.deleteOperLogByIds(ids));
|
return toAjax(operLogService.deleteOperLogByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("monitor:operlog:detail")
|
@RequiresPermissions("monitor:operlog:detail")
|
||||||
@GetMapping("/detail/{operId}")
|
@GetMapping("/detail/{operId}")
|
||||||
public String detail(@PathVariable("operId") Long operId, ModelMap mmap)
|
public String detail(@PathVariable("operId") Long operId, ModelMap mmap)
|
||||||
{
|
{
|
||||||
mmap.put("operLog", operLogService.selectOperLogById(operId));
|
mmap.put("operLog", operLogService.selectOperLogById(operId));
|
||||||
return prefix + "/detail";
|
return prefix + "/detail";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
|
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
|
||||||
@RequiresPermissions("monitor:operlog:remove")
|
@RequiresPermissions("monitor:operlog:remove")
|
||||||
@PostMapping("/clean")
|
@PostMapping("/clean")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult clean()
|
public AjaxResult clean()
|
||||||
{
|
{
|
||||||
operLogService.cleanOperLog();
|
operLogService.cleanOperLog();
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,114 +1,114 @@
|
||||||
package com.ruoyi.web.controller.monitor;
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.enums.OnlineStatus;
|
import com.ruoyi.common.enums.OnlineStatus;
|
||||||
import com.ruoyi.framework.shiro.session.OnlineSession;
|
import com.ruoyi.framework.shiro.session.OnlineSession;
|
||||||
import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
|
import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
|
||||||
import com.ruoyi.framework.util.ShiroUtils;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.system.domain.SysUserOnline;
|
import com.ruoyi.system.domain.SysUserOnline;
|
||||||
import com.ruoyi.system.service.ISysUserOnlineService;
|
import com.ruoyi.system.service.ISysUserOnlineService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 在线用户监控
|
* 在线用户监控
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/monitor/online")
|
@RequestMapping("/monitor/online")
|
||||||
public class SysUserOnlineController extends BaseController
|
public class SysUserOnlineController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "monitor/online";
|
private String prefix = "monitor/online";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysUserOnlineService userOnlineService;
|
private ISysUserOnlineService userOnlineService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private OnlineSessionDAO onlineSessionDAO;
|
private OnlineSessionDAO onlineSessionDAO;
|
||||||
|
|
||||||
@RequiresPermissions("monitor:online:view")
|
@RequiresPermissions("monitor:online:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String online()
|
public String online()
|
||||||
{
|
{
|
||||||
return prefix + "/online";
|
return prefix + "/online";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("monitor:online:list")
|
@RequiresPermissions("monitor:online:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(SysUserOnline userOnline)
|
public TableDataInfo list(SysUserOnline userOnline)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<SysUserOnline> list = userOnlineService.selectUserOnlineList(userOnline);
|
List<SysUserOnline> list = userOnlineService.selectUserOnlineList(userOnline);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("monitor:online:batchForceLogout")
|
@RequiresPermissions("monitor:online:batchForceLogout")
|
||||||
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||||
@PostMapping("/batchForceLogout")
|
@PostMapping("/batchForceLogout")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult batchForceLogout(@RequestParam("ids[]") String[] ids)
|
public AjaxResult batchForceLogout(@RequestParam("ids[]") String[] ids)
|
||||||
{
|
{
|
||||||
for (String sessionId : ids)
|
for (String sessionId : ids)
|
||||||
{
|
{
|
||||||
SysUserOnline online = userOnlineService.selectOnlineById(sessionId);
|
SysUserOnline online = userOnlineService.selectOnlineById(sessionId);
|
||||||
if (online == null)
|
if (online == null)
|
||||||
{
|
{
|
||||||
return error("用户已下线");
|
return error("用户已下线");
|
||||||
}
|
}
|
||||||
OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId());
|
OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId());
|
||||||
if (onlineSession == null)
|
if (onlineSession == null)
|
||||||
{
|
{
|
||||||
return error("用户已下线");
|
return error("用户已下线");
|
||||||
}
|
}
|
||||||
if (sessionId.equals(ShiroUtils.getSessionId()))
|
if (sessionId.equals(ShiroUtils.getSessionId()))
|
||||||
{
|
{
|
||||||
return error("当前登陆用户无法强退");
|
return error("当前登陆用户无法强退");
|
||||||
}
|
}
|
||||||
onlineSession.setStatus(OnlineStatus.off_line);
|
onlineSession.setStatus(OnlineStatus.off_line);
|
||||||
onlineSessionDAO.update(onlineSession);
|
onlineSessionDAO.update(onlineSession);
|
||||||
online.setStatus(OnlineStatus.off_line);
|
online.setStatus(OnlineStatus.off_line);
|
||||||
userOnlineService.saveOnline(online);
|
userOnlineService.saveOnline(online);
|
||||||
}
|
}
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("monitor:online:forceLogout")
|
@RequiresPermissions("monitor:online:forceLogout")
|
||||||
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||||
@PostMapping("/forceLogout")
|
@PostMapping("/forceLogout")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult forceLogout(String sessionId)
|
public AjaxResult forceLogout(String sessionId)
|
||||||
{
|
{
|
||||||
SysUserOnline online = userOnlineService.selectOnlineById(sessionId);
|
SysUserOnline online = userOnlineService.selectOnlineById(sessionId);
|
||||||
if (sessionId.equals(ShiroUtils.getSessionId()))
|
if (sessionId.equals(ShiroUtils.getSessionId()))
|
||||||
{
|
{
|
||||||
return error("当前登陆用户无法强退");
|
return error("当前登陆用户无法强退");
|
||||||
}
|
}
|
||||||
if (online == null)
|
if (online == null)
|
||||||
{
|
{
|
||||||
return error("用户已下线");
|
return error("用户已下线");
|
||||||
}
|
}
|
||||||
OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId());
|
OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId());
|
||||||
if (onlineSession == null)
|
if (onlineSession == null)
|
||||||
{
|
{
|
||||||
return error("用户已下线");
|
return error("用户已下线");
|
||||||
}
|
}
|
||||||
onlineSession.setStatus(OnlineStatus.off_line);
|
onlineSession.setStatus(OnlineStatus.off_line);
|
||||||
onlineSessionDAO.update(onlineSession);
|
onlineSessionDAO.update(onlineSession);
|
||||||
online.setStatus(OnlineStatus.off_line);
|
online.setStatus(OnlineStatus.off_line);
|
||||||
userOnlineService.saveOnline(online);
|
userOnlineService.saveOnline(online);
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,92 +1,92 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import javax.servlet.ServletOutputStream;
|
import javax.servlet.ServletOutputStream;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
import com.google.code.kaptcha.Constants;
|
import com.google.code.kaptcha.Constants;
|
||||||
import com.google.code.kaptcha.Producer;
|
import com.google.code.kaptcha.Producer;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 图片验证码(支持算术形式)
|
* 图片验证码(支持算术形式)
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/captcha")
|
@RequestMapping("/captcha")
|
||||||
public class SysCaptchaController extends BaseController
|
public class SysCaptchaController extends BaseController
|
||||||
{
|
{
|
||||||
@Resource(name = "captchaProducer")
|
@Resource(name = "captchaProducer")
|
||||||
private Producer captchaProducer;
|
private Producer captchaProducer;
|
||||||
|
|
||||||
@Resource(name = "captchaProducerMath")
|
@Resource(name = "captchaProducerMath")
|
||||||
private Producer captchaProducerMath;
|
private Producer captchaProducerMath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证码生成
|
* 验证码生成
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/captchaImage")
|
@GetMapping(value = "/captchaImage")
|
||||||
public ModelAndView getKaptchaImage(HttpServletRequest request, HttpServletResponse response)
|
public ModelAndView getKaptchaImage(HttpServletRequest request, HttpServletResponse response)
|
||||||
{
|
{
|
||||||
ServletOutputStream out = null;
|
ServletOutputStream out = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
HttpSession session = request.getSession();
|
HttpSession session = request.getSession();
|
||||||
response.setDateHeader("Expires", 0);
|
response.setDateHeader("Expires", 0);
|
||||||
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
|
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
|
||||||
response.addHeader("Cache-Control", "post-check=0, pre-check=0");
|
response.addHeader("Cache-Control", "post-check=0, pre-check=0");
|
||||||
response.setHeader("Pragma", "no-cache");
|
response.setHeader("Pragma", "no-cache");
|
||||||
response.setContentType("image/jpeg");
|
response.setContentType("image/jpeg");
|
||||||
|
|
||||||
String type = request.getParameter("type");
|
String type = request.getParameter("type");
|
||||||
String capStr = null;
|
String capStr = null;
|
||||||
String code = null;
|
String code = null;
|
||||||
BufferedImage bi = null;
|
BufferedImage bi = null;
|
||||||
if ("math".equals(type))
|
if ("math".equals(type))
|
||||||
{
|
{
|
||||||
String capText = captchaProducerMath.createText();
|
String capText = captchaProducerMath.createText();
|
||||||
capStr = capText.substring(0, capText.lastIndexOf("@"));
|
capStr = capText.substring(0, capText.lastIndexOf("@"));
|
||||||
code = capText.substring(capText.lastIndexOf("@") + 1);
|
code = capText.substring(capText.lastIndexOf("@") + 1);
|
||||||
bi = captchaProducerMath.createImage(capStr);
|
bi = captchaProducerMath.createImage(capStr);
|
||||||
}
|
}
|
||||||
else if ("char".equals(type))
|
else if ("char".equals(type))
|
||||||
{
|
{
|
||||||
capStr = code = captchaProducer.createText();
|
capStr = code = captchaProducer.createText();
|
||||||
bi = captchaProducer.createImage(capStr);
|
bi = captchaProducer.createImage(capStr);
|
||||||
}
|
}
|
||||||
session.setAttribute(Constants.KAPTCHA_SESSION_KEY, code);
|
session.setAttribute(Constants.KAPTCHA_SESSION_KEY, code);
|
||||||
out = response.getOutputStream();
|
out = response.getOutputStream();
|
||||||
ImageIO.write(bi, "jpg", out);
|
ImageIO.write(bi, "jpg", out);
|
||||||
out.flush();
|
out.flush();
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (out != null)
|
if (out != null)
|
||||||
{
|
{
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,144 +1,144 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.framework.util.ShiroUtils;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.system.domain.SysConfig;
|
import com.ruoyi.system.domain.SysConfig;
|
||||||
import com.ruoyi.system.service.ISysConfigService;
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 参数配置 信息操作处理
|
* 参数配置 信息操作处理
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/config")
|
@RequestMapping("/system/config")
|
||||||
public class SysConfigController extends BaseController
|
public class SysConfigController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "system/config";
|
private String prefix = "system/config";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysConfigService configService;
|
private ISysConfigService configService;
|
||||||
|
|
||||||
@RequiresPermissions("system:config:view")
|
@RequiresPermissions("system:config:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String config()
|
public String config()
|
||||||
{
|
{
|
||||||
return prefix + "/config";
|
return prefix + "/config";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询参数配置列表
|
* 查询参数配置列表
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:config:list")
|
@RequiresPermissions("system:config:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(SysConfig config)
|
public TableDataInfo list(SysConfig config)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<SysConfig> list = configService.selectConfigList(config);
|
List<SysConfig> list = configService.selectConfigList(config);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
||||||
@RequiresPermissions("system:config:export")
|
@RequiresPermissions("system:config:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(SysConfig config)
|
public AjaxResult export(SysConfig config)
|
||||||
{
|
{
|
||||||
List<SysConfig> list = configService.selectConfigList(config);
|
List<SysConfig> list = configService.selectConfigList(config);
|
||||||
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
|
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
|
||||||
return util.exportExcel(list, "参数数据");
|
return util.exportExcel(list, "参数数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增参数配置
|
* 新增参数配置
|
||||||
*/
|
*/
|
||||||
@GetMapping("/add")
|
@GetMapping("/add")
|
||||||
public String add()
|
public String add()
|
||||||
{
|
{
|
||||||
return prefix + "/add";
|
return prefix + "/add";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增保存参数配置
|
* 新增保存参数配置
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:config:add")
|
@RequiresPermissions("system:config:add")
|
||||||
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(@Validated SysConfig config)
|
public AjaxResult addSave(@Validated SysConfig config)
|
||||||
{
|
{
|
||||||
if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
||||||
{
|
{
|
||||||
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||||
}
|
}
|
||||||
config.setCreateBy(ShiroUtils.getLoginName());
|
config.setCreateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(configService.insertConfig(config));
|
return toAjax(configService.insertConfig(config));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改参数配置
|
* 修改参数配置
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit/{configId}")
|
@GetMapping("/edit/{configId}")
|
||||||
public String edit(@PathVariable("configId") Long configId, ModelMap mmap)
|
public String edit(@PathVariable("configId") Long configId, ModelMap mmap)
|
||||||
{
|
{
|
||||||
mmap.put("config", configService.selectConfigById(configId));
|
mmap.put("config", configService.selectConfigById(configId));
|
||||||
return prefix + "/edit";
|
return prefix + "/edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改保存参数配置
|
* 修改保存参数配置
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:config:edit")
|
@RequiresPermissions("system:config:edit")
|
||||||
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(@Validated SysConfig config)
|
public AjaxResult editSave(@Validated SysConfig config)
|
||||||
{
|
{
|
||||||
if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
||||||
{
|
{
|
||||||
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||||
}
|
}
|
||||||
config.setUpdateBy(ShiroUtils.getLoginName());
|
config.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(configService.updateConfig(config));
|
return toAjax(configService.updateConfig(config));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除参数配置
|
* 删除参数配置
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:config:remove")
|
@RequiresPermissions("system:config:remove")
|
||||||
@Log(title = "参数管理", businessType = BusinessType.DELETE)
|
@Log(title = "参数管理", businessType = BusinessType.DELETE)
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(String ids)
|
public AjaxResult remove(String ids)
|
||||||
{
|
{
|
||||||
return toAjax(configService.deleteConfigByIds(ids));
|
return toAjax(configService.deleteConfigByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验参数键名
|
* 校验参数键名
|
||||||
*/
|
*/
|
||||||
@PostMapping("/checkConfigKeyUnique")
|
@PostMapping("/checkConfigKeyUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkConfigKeyUnique(SysConfig config)
|
public String checkConfigKeyUnique(SysConfig config)
|
||||||
{
|
{
|
||||||
return configService.checkConfigKeyUnique(config);
|
return configService.checkConfigKeyUnique(config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,180 +1,180 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.domain.Ztree;
|
import com.ruoyi.common.core.domain.Ztree;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.framework.util.ShiroUtils;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.system.domain.SysDept;
|
import com.ruoyi.system.domain.SysDept;
|
||||||
import com.ruoyi.system.domain.SysRole;
|
import com.ruoyi.system.domain.SysRole;
|
||||||
import com.ruoyi.system.service.ISysDeptService;
|
import com.ruoyi.system.service.ISysDeptService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门信息
|
* 部门信息
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/dept")
|
@RequestMapping("/system/dept")
|
||||||
public class SysDeptController extends BaseController
|
public class SysDeptController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "system/dept";
|
private String prefix = "system/dept";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysDeptService deptService;
|
private ISysDeptService deptService;
|
||||||
|
|
||||||
@RequiresPermissions("system:dept:view")
|
@RequiresPermissions("system:dept:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String dept()
|
public String dept()
|
||||||
{
|
{
|
||||||
return prefix + "/dept";
|
return prefix + "/dept";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("system:dept:list")
|
@RequiresPermissions("system:dept:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<SysDept> list(SysDept dept)
|
public List<SysDept> list(SysDept dept)
|
||||||
{
|
{
|
||||||
List<SysDept> deptList = deptService.selectDeptList(dept);
|
List<SysDept> deptList = deptService.selectDeptList(dept);
|
||||||
return deptList;
|
return deptList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增部门
|
* 新增部门
|
||||||
*/
|
*/
|
||||||
@GetMapping("/add/{parentId}")
|
@GetMapping("/add/{parentId}")
|
||||||
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
|
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
|
||||||
{
|
{
|
||||||
mmap.put("dept", deptService.selectDeptById(parentId));
|
mmap.put("dept", deptService.selectDeptById(parentId));
|
||||||
return prefix + "/add";
|
return prefix + "/add";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增保存部门
|
* 新增保存部门
|
||||||
*/
|
*/
|
||||||
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
||||||
@RequiresPermissions("system:dept:add")
|
@RequiresPermissions("system:dept:add")
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(@Validated SysDept dept)
|
public AjaxResult addSave(@Validated SysDept dept)
|
||||||
{
|
{
|
||||||
if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
||||||
{
|
{
|
||||||
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||||
}
|
}
|
||||||
dept.setCreateBy(ShiroUtils.getLoginName());
|
dept.setCreateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(deptService.insertDept(dept));
|
return toAjax(deptService.insertDept(dept));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改
|
* 修改
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit/{deptId}")
|
@GetMapping("/edit/{deptId}")
|
||||||
public String edit(@PathVariable("deptId") Long deptId, ModelMap mmap)
|
public String edit(@PathVariable("deptId") Long deptId, ModelMap mmap)
|
||||||
{
|
{
|
||||||
SysDept dept = deptService.selectDeptById(deptId);
|
SysDept dept = deptService.selectDeptById(deptId);
|
||||||
if (StringUtils.isNotNull(dept) && 100L == deptId)
|
if (StringUtils.isNotNull(dept) && 100L == deptId)
|
||||||
{
|
{
|
||||||
dept.setParentName("无");
|
dept.setParentName("无");
|
||||||
}
|
}
|
||||||
mmap.put("dept", dept);
|
mmap.put("dept", dept);
|
||||||
return prefix + "/edit";
|
return prefix + "/edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存
|
* 保存
|
||||||
*/
|
*/
|
||||||
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
||||||
@RequiresPermissions("system:dept:edit")
|
@RequiresPermissions("system:dept:edit")
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(@Validated SysDept dept)
|
public AjaxResult editSave(@Validated SysDept dept)
|
||||||
{
|
{
|
||||||
if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
||||||
{
|
{
|
||||||
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||||
}
|
}
|
||||||
else if (dept.getParentId().equals(dept.getDeptId()))
|
else if (dept.getParentId().equals(dept.getDeptId()))
|
||||||
{
|
{
|
||||||
return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
||||||
}
|
}
|
||||||
dept.setUpdateBy(ShiroUtils.getLoginName());
|
dept.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(deptService.updateDept(dept));
|
return toAjax(deptService.updateDept(dept));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
*/
|
*/
|
||||||
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
||||||
@RequiresPermissions("system:dept:remove")
|
@RequiresPermissions("system:dept:remove")
|
||||||
@GetMapping("/remove/{deptId}")
|
@GetMapping("/remove/{deptId}")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(@PathVariable("deptId") Long deptId)
|
public AjaxResult remove(@PathVariable("deptId") Long deptId)
|
||||||
{
|
{
|
||||||
if (deptService.selectDeptCount(deptId) > 0)
|
if (deptService.selectDeptCount(deptId) > 0)
|
||||||
{
|
{
|
||||||
return AjaxResult.warn("存在下级部门,不允许删除");
|
return AjaxResult.warn("存在下级部门,不允许删除");
|
||||||
}
|
}
|
||||||
if (deptService.checkDeptExistUser(deptId))
|
if (deptService.checkDeptExistUser(deptId))
|
||||||
{
|
{
|
||||||
return AjaxResult.warn("部门存在用户,不允许删除");
|
return AjaxResult.warn("部门存在用户,不允许删除");
|
||||||
}
|
}
|
||||||
return toAjax(deptService.deleteDeptById(deptId));
|
return toAjax(deptService.deleteDeptById(deptId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验部门名称
|
* 校验部门名称
|
||||||
*/
|
*/
|
||||||
@PostMapping("/checkDeptNameUnique")
|
@PostMapping("/checkDeptNameUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkDeptNameUnique(SysDept dept)
|
public String checkDeptNameUnique(SysDept dept)
|
||||||
{
|
{
|
||||||
return deptService.checkDeptNameUnique(dept);
|
return deptService.checkDeptNameUnique(dept);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 选择部门树
|
* 选择部门树
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectDeptTree/{deptId}")
|
@GetMapping("/selectDeptTree/{deptId}")
|
||||||
public String selectDeptTree(@PathVariable("deptId") Long deptId, ModelMap mmap)
|
public String selectDeptTree(@PathVariable("deptId") Long deptId, ModelMap mmap)
|
||||||
{
|
{
|
||||||
mmap.put("dept", deptService.selectDeptById(deptId));
|
mmap.put("dept", deptService.selectDeptById(deptId));
|
||||||
return prefix + "/tree";
|
return prefix + "/tree";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载部门列表树
|
* 加载部门列表树
|
||||||
*/
|
*/
|
||||||
@GetMapping("/treeData")
|
@GetMapping("/treeData")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<Ztree> treeData()
|
public List<Ztree> treeData()
|
||||||
{
|
{
|
||||||
List<Ztree> ztrees = deptService.selectDeptTree(new SysDept());
|
List<Ztree> ztrees = deptService.selectDeptTree(new SysDept());
|
||||||
return ztrees;
|
return ztrees;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载角色部门(数据权限)列表树
|
* 加载角色部门(数据权限)列表树
|
||||||
*/
|
*/
|
||||||
@GetMapping("/roleDeptTreeData")
|
@GetMapping("/roleDeptTreeData")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<Ztree> deptTreeData(SysRole role)
|
public List<Ztree> deptTreeData(SysRole role)
|
||||||
{
|
{
|
||||||
List<Ztree> ztrees = deptService.roleDeptTreeData(role);
|
List<Ztree> ztrees = deptService.roleDeptTreeData(role);
|
||||||
return ztrees;
|
return ztrees;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,120 +1,120 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.framework.util.ShiroUtils;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.system.domain.SysDictData;
|
import com.ruoyi.system.domain.SysDictData;
|
||||||
import com.ruoyi.system.service.ISysDictDataService;
|
import com.ruoyi.system.service.ISysDictDataService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据字典信息
|
* 数据字典信息
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/dict/data")
|
@RequestMapping("/system/dict/data")
|
||||||
public class SysDictDataController extends BaseController
|
public class SysDictDataController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "system/dict/data";
|
private String prefix = "system/dict/data";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysDictDataService dictDataService;
|
private ISysDictDataService dictDataService;
|
||||||
|
|
||||||
@RequiresPermissions("system:dict:view")
|
@RequiresPermissions("system:dict:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String dictData()
|
public String dictData()
|
||||||
{
|
{
|
||||||
return prefix + "/data";
|
return prefix + "/data";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@RequiresPermissions("system:dict:list")
|
@RequiresPermissions("system:dict:list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(SysDictData dictData)
|
public TableDataInfo list(SysDictData dictData)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
|
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
|
||||||
@RequiresPermissions("system:dict:export")
|
@RequiresPermissions("system:dict:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(SysDictData dictData)
|
public AjaxResult export(SysDictData dictData)
|
||||||
{
|
{
|
||||||
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||||
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
|
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
|
||||||
return util.exportExcel(list, "字典数据");
|
return util.exportExcel(list, "字典数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增字典类型
|
* 新增字典类型
|
||||||
*/
|
*/
|
||||||
@GetMapping("/add/{dictType}")
|
@GetMapping("/add/{dictType}")
|
||||||
public String add(@PathVariable("dictType") String dictType, ModelMap mmap)
|
public String add(@PathVariable("dictType") String dictType, ModelMap mmap)
|
||||||
{
|
{
|
||||||
mmap.put("dictType", dictType);
|
mmap.put("dictType", dictType);
|
||||||
return prefix + "/add";
|
return prefix + "/add";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增保存字典类型
|
* 新增保存字典类型
|
||||||
*/
|
*/
|
||||||
@Log(title = "字典数据", businessType = BusinessType.INSERT)
|
@Log(title = "字典数据", businessType = BusinessType.INSERT)
|
||||||
@RequiresPermissions("system:dict:add")
|
@RequiresPermissions("system:dict:add")
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(@Validated SysDictData dict)
|
public AjaxResult addSave(@Validated SysDictData dict)
|
||||||
{
|
{
|
||||||
dict.setCreateBy(ShiroUtils.getLoginName());
|
dict.setCreateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(dictDataService.insertDictData(dict));
|
return toAjax(dictDataService.insertDictData(dict));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改字典类型
|
* 修改字典类型
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit/{dictCode}")
|
@GetMapping("/edit/{dictCode}")
|
||||||
public String edit(@PathVariable("dictCode") Long dictCode, ModelMap mmap)
|
public String edit(@PathVariable("dictCode") Long dictCode, ModelMap mmap)
|
||||||
{
|
{
|
||||||
mmap.put("dict", dictDataService.selectDictDataById(dictCode));
|
mmap.put("dict", dictDataService.selectDictDataById(dictCode));
|
||||||
return prefix + "/edit";
|
return prefix + "/edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改保存字典类型
|
* 修改保存字典类型
|
||||||
*/
|
*/
|
||||||
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
|
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
|
||||||
@RequiresPermissions("system:dict:edit")
|
@RequiresPermissions("system:dict:edit")
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(@Validated SysDictData dict)
|
public AjaxResult editSave(@Validated SysDictData dict)
|
||||||
{
|
{
|
||||||
dict.setUpdateBy(ShiroUtils.getLoginName());
|
dict.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(dictDataService.updateDictData(dict));
|
return toAjax(dictDataService.updateDictData(dict));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = "字典数据", businessType = BusinessType.DELETE)
|
@Log(title = "字典数据", businessType = BusinessType.DELETE)
|
||||||
@RequiresPermissions("system:dict:remove")
|
@RequiresPermissions("system:dict:remove")
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(String ids)
|
public AjaxResult remove(String ids)
|
||||||
{
|
{
|
||||||
return toAjax(dictDataService.deleteDictDataByIds(ids));
|
return toAjax(dictDataService.deleteDictDataByIds(ids));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,158 +1,158 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.framework.util.ShiroUtils;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.system.domain.SysDictType;
|
import com.ruoyi.system.domain.SysDictType;
|
||||||
import com.ruoyi.system.service.ISysDictTypeService;
|
import com.ruoyi.system.service.ISysDictTypeService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据字典信息
|
* 数据字典信息
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/dict")
|
@RequestMapping("/system/dict")
|
||||||
public class SysDictTypeController extends BaseController
|
public class SysDictTypeController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "system/dict/type";
|
private String prefix = "system/dict/type";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysDictTypeService dictTypeService;
|
private ISysDictTypeService dictTypeService;
|
||||||
|
|
||||||
@RequiresPermissions("system:dict:view")
|
@RequiresPermissions("system:dict:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String dictType()
|
public String dictType()
|
||||||
{
|
{
|
||||||
return prefix + "/type";
|
return prefix + "/type";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@RequiresPermissions("system:dict:list")
|
@RequiresPermissions("system:dict:list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(SysDictType dictType)
|
public TableDataInfo list(SysDictType dictType)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
||||||
@RequiresPermissions("system:dict:export")
|
@RequiresPermissions("system:dict:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(SysDictType dictType)
|
public AjaxResult export(SysDictType dictType)
|
||||||
{
|
{
|
||||||
|
|
||||||
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||||
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
|
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
|
||||||
return util.exportExcel(list, "字典类型");
|
return util.exportExcel(list, "字典类型");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增字典类型
|
* 新增字典类型
|
||||||
*/
|
*/
|
||||||
@GetMapping("/add")
|
@GetMapping("/add")
|
||||||
public String add()
|
public String add()
|
||||||
{
|
{
|
||||||
return prefix + "/add";
|
return prefix + "/add";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增保存字典类型
|
* 新增保存字典类型
|
||||||
*/
|
*/
|
||||||
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
||||||
@RequiresPermissions("system:dict:add")
|
@RequiresPermissions("system:dict:add")
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(@Validated SysDictType dict)
|
public AjaxResult addSave(@Validated SysDictType dict)
|
||||||
{
|
{
|
||||||
if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
||||||
{
|
{
|
||||||
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||||
}
|
}
|
||||||
dict.setCreateBy(ShiroUtils.getLoginName());
|
dict.setCreateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(dictTypeService.insertDictType(dict));
|
return toAjax(dictTypeService.insertDictType(dict));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改字典类型
|
* 修改字典类型
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit/{dictId}")
|
@GetMapping("/edit/{dictId}")
|
||||||
public String edit(@PathVariable("dictId") Long dictId, ModelMap mmap)
|
public String edit(@PathVariable("dictId") Long dictId, ModelMap mmap)
|
||||||
{
|
{
|
||||||
mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
|
mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
|
||||||
return prefix + "/edit";
|
return prefix + "/edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改保存字典类型
|
* 修改保存字典类型
|
||||||
*/
|
*/
|
||||||
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
||||||
@RequiresPermissions("system:dict:edit")
|
@RequiresPermissions("system:dict:edit")
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(@Validated SysDictType dict)
|
public AjaxResult editSave(@Validated SysDictType dict)
|
||||||
{
|
{
|
||||||
if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
||||||
{
|
{
|
||||||
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||||
}
|
}
|
||||||
dict.setUpdateBy(ShiroUtils.getLoginName());
|
dict.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(dictTypeService.updateDictType(dict));
|
return toAjax(dictTypeService.updateDictType(dict));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||||
@RequiresPermissions("system:dict:remove")
|
@RequiresPermissions("system:dict:remove")
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(String ids)
|
public AjaxResult remove(String ids)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return toAjax(dictTypeService.deleteDictTypeByIds(ids));
|
return toAjax(dictTypeService.deleteDictTypeByIds(ids));
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
return error(e.getMessage());
|
return error(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询字典详细
|
* 查询字典详细
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:dict:list")
|
@RequiresPermissions("system:dict:list")
|
||||||
@GetMapping("/detail/{dictId}")
|
@GetMapping("/detail/{dictId}")
|
||||||
public String detail(@PathVariable("dictId") Long dictId, ModelMap mmap)
|
public String detail(@PathVariable("dictId") Long dictId, ModelMap mmap)
|
||||||
{
|
{
|
||||||
mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
|
mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
|
||||||
mmap.put("dictList", dictTypeService.selectDictTypeAll());
|
mmap.put("dictList", dictTypeService.selectDictTypeAll());
|
||||||
return "system/dict/data/data";
|
return "system/dict/data/data";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验字典类型
|
* 校验字典类型
|
||||||
*/
|
*/
|
||||||
@PostMapping("/checkDictTypeUnique")
|
@PostMapping("/checkDictTypeUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkDictTypeUnique(SysDictType dictType)
|
public String checkDictTypeUnique(SysDictType dictType)
|
||||||
{
|
{
|
||||||
return dictTypeService.checkDictTypeUnique(dictType);
|
return dictTypeService.checkDictTypeUnique(dictType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,48 +1,48 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import com.ruoyi.common.config.Global;
|
import com.ruoyi.common.config.Global;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.framework.util.ShiroUtils;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.system.domain.SysMenu;
|
import com.ruoyi.system.domain.SysMenu;
|
||||||
import com.ruoyi.system.domain.SysUser;
|
import com.ruoyi.system.domain.SysUser;
|
||||||
import com.ruoyi.system.service.ISysMenuService;
|
import com.ruoyi.system.service.ISysMenuService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 首页 业务处理
|
* 首页 业务处理
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
public class SysIndexController extends BaseController
|
public class SysIndexController extends BaseController
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysMenuService menuService;
|
private ISysMenuService menuService;
|
||||||
|
|
||||||
// 系统首页
|
// 系统首页
|
||||||
@GetMapping("/index")
|
@GetMapping("/index")
|
||||||
public String index(ModelMap mmap)
|
public String index(ModelMap mmap)
|
||||||
{
|
{
|
||||||
// 取身份信息
|
// 取身份信息
|
||||||
SysUser user = ShiroUtils.getSysUser();
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
// 根据用户id取出菜单
|
// 根据用户id取出菜单
|
||||||
List<SysMenu> menus = menuService.selectMenusByUser(user);
|
List<SysMenu> menus = menuService.selectMenusByUser(user);
|
||||||
mmap.put("menus", menus);
|
mmap.put("menus", menus);
|
||||||
mmap.put("user", user);
|
mmap.put("user", user);
|
||||||
mmap.put("copyrightYear", Global.getCopyrightYear());
|
mmap.put("copyrightYear", Global.getCopyrightYear());
|
||||||
mmap.put("demoEnabled", Global.isDemoEnabled());
|
mmap.put("demoEnabled", Global.isDemoEnabled());
|
||||||
return "index";
|
return "index";
|
||||||
}
|
}
|
||||||
|
|
||||||
// 系统介绍
|
// 系统介绍
|
||||||
@GetMapping("/system/main")
|
@GetMapping("/system/main")
|
||||||
public String main(ModelMap mmap)
|
public String main(ModelMap mmap)
|
||||||
{
|
{
|
||||||
mmap.put("version", Global.getVersion());
|
mmap.put("version", Global.getVersion());
|
||||||
return "main";
|
return "main";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,196 +1,196 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.domain.Ztree;
|
import com.ruoyi.common.core.domain.Ztree;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.framework.util.ShiroUtils;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.system.domain.SysMenu;
|
import com.ruoyi.system.domain.SysMenu;
|
||||||
import com.ruoyi.system.domain.SysRole;
|
import com.ruoyi.system.domain.SysRole;
|
||||||
import com.ruoyi.system.service.ISysMenuService;
|
import com.ruoyi.system.service.ISysMenuService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单信息
|
* 菜单信息
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/menu")
|
@RequestMapping("/system/menu")
|
||||||
public class SysMenuController extends BaseController
|
public class SysMenuController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "system/menu";
|
private String prefix = "system/menu";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysMenuService menuService;
|
private ISysMenuService menuService;
|
||||||
|
|
||||||
@RequiresPermissions("system:menu:view")
|
@RequiresPermissions("system:menu:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String menu()
|
public String menu()
|
||||||
{
|
{
|
||||||
return prefix + "/menu";
|
return prefix + "/menu";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("system:menu:list")
|
@RequiresPermissions("system:menu:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<SysMenu> list(SysMenu menu)
|
public List<SysMenu> list(SysMenu menu)
|
||||||
{
|
{
|
||||||
Long userId = ShiroUtils.getUserId();
|
Long userId = ShiroUtils.getUserId();
|
||||||
List<SysMenu> menuList = menuService.selectMenuList(menu, userId);
|
List<SysMenu> menuList = menuService.selectMenuList(menu, userId);
|
||||||
return menuList;
|
return menuList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除菜单
|
* 删除菜单
|
||||||
*/
|
*/
|
||||||
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
|
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
|
||||||
@RequiresPermissions("system:menu:remove")
|
@RequiresPermissions("system:menu:remove")
|
||||||
@GetMapping("/remove/{menuId}")
|
@GetMapping("/remove/{menuId}")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(@PathVariable("menuId") Long menuId)
|
public AjaxResult remove(@PathVariable("menuId") Long menuId)
|
||||||
{
|
{
|
||||||
if (menuService.selectCountMenuByParentId(menuId) > 0)
|
if (menuService.selectCountMenuByParentId(menuId) > 0)
|
||||||
{
|
{
|
||||||
return AjaxResult.warn("存在子菜单,不允许删除");
|
return AjaxResult.warn("存在子菜单,不允许删除");
|
||||||
}
|
}
|
||||||
if (menuService.selectCountRoleMenuByMenuId(menuId) > 0)
|
if (menuService.selectCountRoleMenuByMenuId(menuId) > 0)
|
||||||
{
|
{
|
||||||
return AjaxResult.warn("菜单已分配,不允许删除");
|
return AjaxResult.warn("菜单已分配,不允许删除");
|
||||||
}
|
}
|
||||||
ShiroUtils.clearCachedAuthorizationInfo();
|
ShiroUtils.clearCachedAuthorizationInfo();
|
||||||
return toAjax(menuService.deleteMenuById(menuId));
|
return toAjax(menuService.deleteMenuById(menuId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增
|
* 新增
|
||||||
*/
|
*/
|
||||||
@GetMapping("/add/{parentId}")
|
@GetMapping("/add/{parentId}")
|
||||||
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
|
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
|
||||||
{
|
{
|
||||||
SysMenu menu = null;
|
SysMenu menu = null;
|
||||||
if (0L != parentId)
|
if (0L != parentId)
|
||||||
{
|
{
|
||||||
menu = menuService.selectMenuById(parentId);
|
menu = menuService.selectMenuById(parentId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
menu = new SysMenu();
|
menu = new SysMenu();
|
||||||
menu.setMenuId(0L);
|
menu.setMenuId(0L);
|
||||||
menu.setMenuName("主目录");
|
menu.setMenuName("主目录");
|
||||||
}
|
}
|
||||||
mmap.put("menu", menu);
|
mmap.put("menu", menu);
|
||||||
return prefix + "/add";
|
return prefix + "/add";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增保存菜单
|
* 新增保存菜单
|
||||||
*/
|
*/
|
||||||
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
|
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
|
||||||
@RequiresPermissions("system:menu:add")
|
@RequiresPermissions("system:menu:add")
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(@Validated SysMenu menu)
|
public AjaxResult addSave(@Validated SysMenu menu)
|
||||||
{
|
{
|
||||||
if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
||||||
{
|
{
|
||||||
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||||
}
|
}
|
||||||
menu.setCreateBy(ShiroUtils.getLoginName());
|
menu.setCreateBy(ShiroUtils.getLoginName());
|
||||||
ShiroUtils.clearCachedAuthorizationInfo();
|
ShiroUtils.clearCachedAuthorizationInfo();
|
||||||
return toAjax(menuService.insertMenu(menu));
|
return toAjax(menuService.insertMenu(menu));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改菜单
|
* 修改菜单
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit/{menuId}")
|
@GetMapping("/edit/{menuId}")
|
||||||
public String edit(@PathVariable("menuId") Long menuId, ModelMap mmap)
|
public String edit(@PathVariable("menuId") Long menuId, ModelMap mmap)
|
||||||
{
|
{
|
||||||
mmap.put("menu", menuService.selectMenuById(menuId));
|
mmap.put("menu", menuService.selectMenuById(menuId));
|
||||||
return prefix + "/edit";
|
return prefix + "/edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改保存菜单
|
* 修改保存菜单
|
||||||
*/
|
*/
|
||||||
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
|
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
|
||||||
@RequiresPermissions("system:menu:edit")
|
@RequiresPermissions("system:menu:edit")
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(@Validated SysMenu menu)
|
public AjaxResult editSave(@Validated SysMenu menu)
|
||||||
{
|
{
|
||||||
if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
||||||
{
|
{
|
||||||
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||||
}
|
}
|
||||||
menu.setUpdateBy(ShiroUtils.getLoginName());
|
menu.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
ShiroUtils.clearCachedAuthorizationInfo();
|
ShiroUtils.clearCachedAuthorizationInfo();
|
||||||
return toAjax(menuService.updateMenu(menu));
|
return toAjax(menuService.updateMenu(menu));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 选择菜单图标
|
* 选择菜单图标
|
||||||
*/
|
*/
|
||||||
@GetMapping("/icon")
|
@GetMapping("/icon")
|
||||||
public String icon()
|
public String icon()
|
||||||
{
|
{
|
||||||
return prefix + "/icon";
|
return prefix + "/icon";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验菜单名称
|
* 校验菜单名称
|
||||||
*/
|
*/
|
||||||
@PostMapping("/checkMenuNameUnique")
|
@PostMapping("/checkMenuNameUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkMenuNameUnique(SysMenu menu)
|
public String checkMenuNameUnique(SysMenu menu)
|
||||||
{
|
{
|
||||||
return menuService.checkMenuNameUnique(menu);
|
return menuService.checkMenuNameUnique(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载角色菜单列表树
|
* 加载角色菜单列表树
|
||||||
*/
|
*/
|
||||||
@GetMapping("/roleMenuTreeData")
|
@GetMapping("/roleMenuTreeData")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<Ztree> roleMenuTreeData(SysRole role)
|
public List<Ztree> roleMenuTreeData(SysRole role)
|
||||||
{
|
{
|
||||||
Long userId = ShiroUtils.getUserId();
|
Long userId = ShiroUtils.getUserId();
|
||||||
List<Ztree> ztrees = menuService.roleMenuTreeData(role, userId);
|
List<Ztree> ztrees = menuService.roleMenuTreeData(role, userId);
|
||||||
return ztrees;
|
return ztrees;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载所有菜单列表树
|
* 加载所有菜单列表树
|
||||||
*/
|
*/
|
||||||
@GetMapping("/menuTreeData")
|
@GetMapping("/menuTreeData")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<Ztree> menuTreeData()
|
public List<Ztree> menuTreeData()
|
||||||
{
|
{
|
||||||
Long userId = ShiroUtils.getUserId();
|
Long userId = ShiroUtils.getUserId();
|
||||||
List<Ztree> ztrees = menuService.menuTreeData(userId);
|
List<Ztree> ztrees = menuService.menuTreeData(userId);
|
||||||
return ztrees;
|
return ztrees;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 选择菜单树
|
* 选择菜单树
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectMenuTree/{menuId}")
|
@GetMapping("/selectMenuTree/{menuId}")
|
||||||
public String selectMenuTree(@PathVariable("menuId") Long menuId, ModelMap mmap)
|
public String selectMenuTree(@PathVariable("menuId") Long menuId, ModelMap mmap)
|
||||||
{
|
{
|
||||||
mmap.put("menu", menuService.selectMenuById(menuId));
|
mmap.put("menu", menuService.selectMenuById(menuId));
|
||||||
return prefix + "/tree";
|
return prefix + "/tree";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,112 +1,112 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.framework.util.ShiroUtils;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.system.domain.SysNotice;
|
import com.ruoyi.system.domain.SysNotice;
|
||||||
import com.ruoyi.system.service.ISysNoticeService;
|
import com.ruoyi.system.service.ISysNoticeService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公告 信息操作处理
|
* 公告 信息操作处理
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/notice")
|
@RequestMapping("/system/notice")
|
||||||
public class SysNoticeController extends BaseController
|
public class SysNoticeController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "system/notice";
|
private String prefix = "system/notice";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysNoticeService noticeService;
|
private ISysNoticeService noticeService;
|
||||||
|
|
||||||
@RequiresPermissions("system:notice:view")
|
@RequiresPermissions("system:notice:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String notice()
|
public String notice()
|
||||||
{
|
{
|
||||||
return prefix + "/notice";
|
return prefix + "/notice";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询公告列表
|
* 查询公告列表
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:notice:list")
|
@RequiresPermissions("system:notice:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(SysNotice notice)
|
public TableDataInfo list(SysNotice notice)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<SysNotice> list = noticeService.selectNoticeList(notice);
|
List<SysNotice> list = noticeService.selectNoticeList(notice);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增公告
|
* 新增公告
|
||||||
*/
|
*/
|
||||||
@GetMapping("/add")
|
@GetMapping("/add")
|
||||||
public String add()
|
public String add()
|
||||||
{
|
{
|
||||||
return prefix + "/add";
|
return prefix + "/add";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增保存公告
|
* 新增保存公告
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:notice:add")
|
@RequiresPermissions("system:notice:add")
|
||||||
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(SysNotice notice)
|
public AjaxResult addSave(SysNotice notice)
|
||||||
{
|
{
|
||||||
notice.setCreateBy(ShiroUtils.getLoginName());
|
notice.setCreateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(noticeService.insertNotice(notice));
|
return toAjax(noticeService.insertNotice(notice));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改公告
|
* 修改公告
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit/{noticeId}")
|
@GetMapping("/edit/{noticeId}")
|
||||||
public String edit(@PathVariable("noticeId") Long noticeId, ModelMap mmap)
|
public String edit(@PathVariable("noticeId") Long noticeId, ModelMap mmap)
|
||||||
{
|
{
|
||||||
mmap.put("notice", noticeService.selectNoticeById(noticeId));
|
mmap.put("notice", noticeService.selectNoticeById(noticeId));
|
||||||
return prefix + "/edit";
|
return prefix + "/edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改保存公告
|
* 修改保存公告
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:notice:edit")
|
@RequiresPermissions("system:notice:edit")
|
||||||
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(SysNotice notice)
|
public AjaxResult editSave(SysNotice notice)
|
||||||
{
|
{
|
||||||
notice.setUpdateBy(ShiroUtils.getLoginName());
|
notice.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(noticeService.updateNotice(notice));
|
return toAjax(noticeService.updateNotice(notice));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除公告
|
* 删除公告
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:notice:remove")
|
@RequiresPermissions("system:notice:remove")
|
||||||
@Log(title = "通知公告", businessType = BusinessType.DELETE)
|
@Log(title = "通知公告", businessType = BusinessType.DELETE)
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(String ids)
|
public AjaxResult remove(String ids)
|
||||||
{
|
{
|
||||||
return toAjax(noticeService.deleteNoticeByIds(ids));
|
return toAjax(noticeService.deleteNoticeByIds(ids));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,163 +1,163 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.framework.util.ShiroUtils;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.system.domain.SysPost;
|
import com.ruoyi.system.domain.SysPost;
|
||||||
import com.ruoyi.system.service.ISysPostService;
|
import com.ruoyi.system.service.ISysPostService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 岗位信息操作处理
|
* 岗位信息操作处理
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/post")
|
@RequestMapping("/system/post")
|
||||||
public class SysPostController extends BaseController
|
public class SysPostController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "system/post";
|
private String prefix = "system/post";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysPostService postService;
|
private ISysPostService postService;
|
||||||
|
|
||||||
@RequiresPermissions("system:post:view")
|
@RequiresPermissions("system:post:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String operlog()
|
public String operlog()
|
||||||
{
|
{
|
||||||
return prefix + "/post";
|
return prefix + "/post";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("system:post:list")
|
@RequiresPermissions("system:post:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(SysPost post)
|
public TableDataInfo list(SysPost post)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<SysPost> list = postService.selectPostList(post);
|
List<SysPost> list = postService.selectPostList(post);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
||||||
@RequiresPermissions("system:post:export")
|
@RequiresPermissions("system:post:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(SysPost post)
|
public AjaxResult export(SysPost post)
|
||||||
{
|
{
|
||||||
List<SysPost> list = postService.selectPostList(post);
|
List<SysPost> list = postService.selectPostList(post);
|
||||||
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
|
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
|
||||||
return util.exportExcel(list, "岗位数据");
|
return util.exportExcel(list, "岗位数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("system:post:remove")
|
@RequiresPermissions("system:post:remove")
|
||||||
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(String ids)
|
public AjaxResult remove(String ids)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return toAjax(postService.deletePostByIds(ids));
|
return toAjax(postService.deletePostByIds(ids));
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
return error(e.getMessage());
|
return error(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增岗位
|
* 新增岗位
|
||||||
*/
|
*/
|
||||||
@GetMapping("/add")
|
@GetMapping("/add")
|
||||||
public String add()
|
public String add()
|
||||||
{
|
{
|
||||||
return prefix + "/add";
|
return prefix + "/add";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增保存岗位
|
* 新增保存岗位
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:post:add")
|
@RequiresPermissions("system:post:add")
|
||||||
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(@Validated SysPost post)
|
public AjaxResult addSave(@Validated SysPost post)
|
||||||
{
|
{
|
||||||
if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
||||||
{
|
{
|
||||||
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||||
}
|
}
|
||||||
else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
||||||
{
|
{
|
||||||
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||||
}
|
}
|
||||||
post.setCreateBy(ShiroUtils.getLoginName());
|
post.setCreateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(postService.insertPost(post));
|
return toAjax(postService.insertPost(post));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改岗位
|
* 修改岗位
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit/{postId}")
|
@GetMapping("/edit/{postId}")
|
||||||
public String edit(@PathVariable("postId") Long postId, ModelMap mmap)
|
public String edit(@PathVariable("postId") Long postId, ModelMap mmap)
|
||||||
{
|
{
|
||||||
mmap.put("post", postService.selectPostById(postId));
|
mmap.put("post", postService.selectPostById(postId));
|
||||||
return prefix + "/edit";
|
return prefix + "/edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改保存岗位
|
* 修改保存岗位
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:post:edit")
|
@RequiresPermissions("system:post:edit")
|
||||||
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(@Validated SysPost post)
|
public AjaxResult editSave(@Validated SysPost post)
|
||||||
{
|
{
|
||||||
if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
||||||
{
|
{
|
||||||
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||||
}
|
}
|
||||||
else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
||||||
{
|
{
|
||||||
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||||
}
|
}
|
||||||
post.setUpdateBy(ShiroUtils.getLoginName());
|
post.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(postService.updatePost(post));
|
return toAjax(postService.updatePost(post));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验岗位名称
|
* 校验岗位名称
|
||||||
*/
|
*/
|
||||||
@PostMapping("/checkPostNameUnique")
|
@PostMapping("/checkPostNameUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkPostNameUnique(SysPost post)
|
public String checkPostNameUnique(SysPost post)
|
||||||
{
|
{
|
||||||
return postService.checkPostNameUnique(post);
|
return postService.checkPostNameUnique(post);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验岗位编码
|
* 校验岗位编码
|
||||||
*/
|
*/
|
||||||
@PostMapping("/checkPostCodeUnique")
|
@PostMapping("/checkPostCodeUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkPostCodeUnique(SysPost post)
|
public String checkPostCodeUnique(SysPost post)
|
||||||
{
|
{
|
||||||
return postService.checkPostCodeUnique(post);
|
return postService.checkPostCodeUnique(post);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,173 +1,173 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.config.Global;
|
import com.ruoyi.common.config.Global;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||||
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
||||||
import com.ruoyi.framework.util.ShiroUtils;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.system.domain.SysUser;
|
import com.ruoyi.system.domain.SysUser;
|
||||||
import com.ruoyi.system.service.ISysUserService;
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 个人信息 业务处理
|
* 个人信息 业务处理
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/user/profile")
|
@RequestMapping("/system/user/profile")
|
||||||
public class SysProfileController extends BaseController
|
public class SysProfileController extends BaseController
|
||||||
{
|
{
|
||||||
private static final Logger log = LoggerFactory.getLogger(SysProfileController.class);
|
private static final Logger log = LoggerFactory.getLogger(SysProfileController.class);
|
||||||
|
|
||||||
private String prefix = "system/user/profile";
|
private String prefix = "system/user/profile";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysUserService userService;
|
private ISysUserService userService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysPasswordService passwordService;
|
private SysPasswordService passwordService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 个人信息
|
* 个人信息
|
||||||
*/
|
*/
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String profile(ModelMap mmap)
|
public String profile(ModelMap mmap)
|
||||||
{
|
{
|
||||||
SysUser user = ShiroUtils.getSysUser();
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
mmap.put("user", user);
|
mmap.put("user", user);
|
||||||
mmap.put("roleGroup", userService.selectUserRoleGroup(user.getUserId()));
|
mmap.put("roleGroup", userService.selectUserRoleGroup(user.getUserId()));
|
||||||
mmap.put("postGroup", userService.selectUserPostGroup(user.getUserId()));
|
mmap.put("postGroup", userService.selectUserPostGroup(user.getUserId()));
|
||||||
return prefix + "/profile";
|
return prefix + "/profile";
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/checkPassword")
|
@GetMapping("/checkPassword")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public boolean checkPassword(String password)
|
public boolean checkPassword(String password)
|
||||||
{
|
{
|
||||||
SysUser user = ShiroUtils.getSysUser();
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
if (passwordService.matches(user, password))
|
if (passwordService.matches(user, password))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/resetPwd")
|
@GetMapping("/resetPwd")
|
||||||
public String resetPwd(ModelMap mmap)
|
public String resetPwd(ModelMap mmap)
|
||||||
{
|
{
|
||||||
SysUser user = ShiroUtils.getSysUser();
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
mmap.put("user", userService.selectUserById(user.getUserId()));
|
mmap.put("user", userService.selectUserById(user.getUserId()));
|
||||||
return prefix + "/resetPwd";
|
return prefix + "/resetPwd";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
|
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/resetPwd")
|
@PostMapping("/resetPwd")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult resetPwd(String oldPassword, String newPassword)
|
public AjaxResult resetPwd(String oldPassword, String newPassword)
|
||||||
{
|
{
|
||||||
SysUser user = ShiroUtils.getSysUser();
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
if (StringUtils.isNotEmpty(newPassword) && passwordService.matches(user, oldPassword))
|
if (StringUtils.isNotEmpty(newPassword) && passwordService.matches(user, oldPassword))
|
||||||
{
|
{
|
||||||
user.setSalt(ShiroUtils.randomSalt());
|
user.setSalt(ShiroUtils.randomSalt());
|
||||||
user.setPassword(passwordService.encryptPassword(user.getLoginName(), newPassword, user.getSalt()));
|
user.setPassword(passwordService.encryptPassword(user.getLoginName(), newPassword, user.getSalt()));
|
||||||
if (userService.resetUserPwd(user) > 0)
|
if (userService.resetUserPwd(user) > 0)
|
||||||
{
|
{
|
||||||
ShiroUtils.setSysUser(userService.selectUserById(user.getUserId()));
|
ShiroUtils.setSysUser(userService.selectUserById(user.getUserId()));
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
return error();
|
return error();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return error("修改密码失败,旧密码错误");
|
return error("修改密码失败,旧密码错误");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改用户
|
* 修改用户
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit")
|
@GetMapping("/edit")
|
||||||
public String edit(ModelMap mmap)
|
public String edit(ModelMap mmap)
|
||||||
{
|
{
|
||||||
SysUser user = ShiroUtils.getSysUser();
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
mmap.put("user", userService.selectUserById(user.getUserId()));
|
mmap.put("user", userService.selectUserById(user.getUserId()));
|
||||||
return prefix + "/edit";
|
return prefix + "/edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改头像
|
* 修改头像
|
||||||
*/
|
*/
|
||||||
@GetMapping("/avatar")
|
@GetMapping("/avatar")
|
||||||
public String avatar(ModelMap mmap)
|
public String avatar(ModelMap mmap)
|
||||||
{
|
{
|
||||||
SysUser user = ShiroUtils.getSysUser();
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
mmap.put("user", userService.selectUserById(user.getUserId()));
|
mmap.put("user", userService.selectUserById(user.getUserId()));
|
||||||
return prefix + "/avatar";
|
return prefix + "/avatar";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改用户
|
* 修改用户
|
||||||
*/
|
*/
|
||||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult update(SysUser user)
|
public AjaxResult update(SysUser user)
|
||||||
{
|
{
|
||||||
SysUser currentUser = ShiroUtils.getSysUser();
|
SysUser currentUser = ShiroUtils.getSysUser();
|
||||||
currentUser.setUserName(user.getUserName());
|
currentUser.setUserName(user.getUserName());
|
||||||
currentUser.setEmail(user.getEmail());
|
currentUser.setEmail(user.getEmail());
|
||||||
currentUser.setPhonenumber(user.getPhonenumber());
|
currentUser.setPhonenumber(user.getPhonenumber());
|
||||||
currentUser.setSex(user.getSex());
|
currentUser.setSex(user.getSex());
|
||||||
if (userService.updateUserInfo(currentUser) > 0)
|
if (userService.updateUserInfo(currentUser) > 0)
|
||||||
{
|
{
|
||||||
ShiroUtils.setSysUser(userService.selectUserById(currentUser.getUserId()));
|
ShiroUtils.setSysUser(userService.selectUserById(currentUser.getUserId()));
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
return error();
|
return error();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存头像
|
* 保存头像
|
||||||
*/
|
*/
|
||||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/updateAvatar")
|
@PostMapping("/updateAvatar")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult updateAvatar(@RequestParam("avatarfile") MultipartFile file)
|
public AjaxResult updateAvatar(@RequestParam("avatarfile") MultipartFile file)
|
||||||
{
|
{
|
||||||
SysUser currentUser = ShiroUtils.getSysUser();
|
SysUser currentUser = ShiroUtils.getSysUser();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!file.isEmpty())
|
if (!file.isEmpty())
|
||||||
{
|
{
|
||||||
String avatar = FileUploadUtils.upload(Global.getAvatarPath(), file);
|
String avatar = FileUploadUtils.upload(Global.getAvatarPath(), file);
|
||||||
currentUser.setAvatar(avatar);
|
currentUser.setAvatar(avatar);
|
||||||
if (userService.updateUserInfo(currentUser) > 0)
|
if (userService.updateUserInfo(currentUser) > 0)
|
||||||
{
|
{
|
||||||
ShiroUtils.setSysUser(userService.selectUserById(currentUser.getUserId()));
|
ShiroUtils.setSysUser(userService.selectUserById(currentUser.getUserId()));
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return error();
|
return error();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.error("修改头像失败!", e);
|
log.error("修改头像失败!", e);
|
||||||
return error(e.getMessage());
|
return error(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,301 +1,301 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.framework.util.ShiroUtils;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.system.domain.SysRole;
|
import com.ruoyi.system.domain.SysRole;
|
||||||
import com.ruoyi.system.domain.SysUser;
|
import com.ruoyi.system.domain.SysUser;
|
||||||
import com.ruoyi.system.domain.SysUserRole;
|
import com.ruoyi.system.domain.SysUserRole;
|
||||||
import com.ruoyi.system.service.ISysRoleService;
|
import com.ruoyi.system.service.ISysRoleService;
|
||||||
import com.ruoyi.system.service.ISysUserService;
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色信息
|
* 角色信息
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/role")
|
@RequestMapping("/system/role")
|
||||||
public class SysRoleController extends BaseController
|
public class SysRoleController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "system/role";
|
private String prefix = "system/role";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysRoleService roleService;
|
private ISysRoleService roleService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysUserService userService;
|
private ISysUserService userService;
|
||||||
|
|
||||||
@RequiresPermissions("system:role:view")
|
@RequiresPermissions("system:role:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String role()
|
public String role()
|
||||||
{
|
{
|
||||||
return prefix + "/role";
|
return prefix + "/role";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("system:role:list")
|
@RequiresPermissions("system:role:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(SysRole role)
|
public TableDataInfo list(SysRole role)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<SysRole> list = roleService.selectRoleList(role);
|
List<SysRole> list = roleService.selectRoleList(role);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
|
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
|
||||||
@RequiresPermissions("system:role:export")
|
@RequiresPermissions("system:role:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(SysRole role)
|
public AjaxResult export(SysRole role)
|
||||||
{
|
{
|
||||||
List<SysRole> list = roleService.selectRoleList(role);
|
List<SysRole> list = roleService.selectRoleList(role);
|
||||||
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
|
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
|
||||||
return util.exportExcel(list, "角色数据");
|
return util.exportExcel(list, "角色数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增角色
|
* 新增角色
|
||||||
*/
|
*/
|
||||||
@GetMapping("/add")
|
@GetMapping("/add")
|
||||||
public String add()
|
public String add()
|
||||||
{
|
{
|
||||||
return prefix + "/add";
|
return prefix + "/add";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增保存角色
|
* 新增保存角色
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:role:add")
|
@RequiresPermissions("system:role:add")
|
||||||
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(@Validated SysRole role)
|
public AjaxResult addSave(@Validated SysRole role)
|
||||||
{
|
{
|
||||||
if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
||||||
{
|
{
|
||||||
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||||
}
|
}
|
||||||
else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
|
else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
|
||||||
{
|
{
|
||||||
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||||
}
|
}
|
||||||
role.setCreateBy(ShiroUtils.getLoginName());
|
role.setCreateBy(ShiroUtils.getLoginName());
|
||||||
ShiroUtils.clearCachedAuthorizationInfo();
|
ShiroUtils.clearCachedAuthorizationInfo();
|
||||||
return toAjax(roleService.insertRole(role));
|
return toAjax(roleService.insertRole(role));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改角色
|
* 修改角色
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit/{roleId}")
|
@GetMapping("/edit/{roleId}")
|
||||||
public String edit(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
public String edit(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
||||||
{
|
{
|
||||||
mmap.put("role", roleService.selectRoleById(roleId));
|
mmap.put("role", roleService.selectRoleById(roleId));
|
||||||
return prefix + "/edit";
|
return prefix + "/edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改保存角色
|
* 修改保存角色
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:role:edit")
|
@RequiresPermissions("system:role:edit")
|
||||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(@Validated SysRole role)
|
public AjaxResult editSave(@Validated SysRole role)
|
||||||
{
|
{
|
||||||
if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
||||||
{
|
{
|
||||||
return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||||
}
|
}
|
||||||
else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
|
else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
|
||||||
{
|
{
|
||||||
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||||
}
|
}
|
||||||
role.setUpdateBy(ShiroUtils.getLoginName());
|
role.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
ShiroUtils.clearCachedAuthorizationInfo();
|
ShiroUtils.clearCachedAuthorizationInfo();
|
||||||
return toAjax(roleService.updateRole(role));
|
return toAjax(roleService.updateRole(role));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色分配数据权限
|
* 角色分配数据权限
|
||||||
*/
|
*/
|
||||||
@GetMapping("/authDataScope/{roleId}")
|
@GetMapping("/authDataScope/{roleId}")
|
||||||
public String authDataScope(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
public String authDataScope(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
||||||
{
|
{
|
||||||
mmap.put("role", roleService.selectRoleById(roleId));
|
mmap.put("role", roleService.selectRoleById(roleId));
|
||||||
return prefix + "/dataScope";
|
return prefix + "/dataScope";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存角色分配数据权限
|
* 保存角色分配数据权限
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:role:edit")
|
@RequiresPermissions("system:role:edit")
|
||||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/authDataScope")
|
@PostMapping("/authDataScope")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult authDataScopeSave(SysRole role)
|
public AjaxResult authDataScopeSave(SysRole role)
|
||||||
{
|
{
|
||||||
role.setUpdateBy(ShiroUtils.getLoginName());
|
role.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
if (roleService.authDataScope(role) > 0)
|
if (roleService.authDataScope(role) > 0)
|
||||||
{
|
{
|
||||||
ShiroUtils.setSysUser(userService.selectUserById(ShiroUtils.getSysUser().getUserId()));
|
ShiroUtils.setSysUser(userService.selectUserById(ShiroUtils.getSysUser().getUserId()));
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
return error();
|
return error();
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("system:role:remove")
|
@RequiresPermissions("system:role:remove")
|
||||||
@Log(title = "角色管理", businessType = BusinessType.DELETE)
|
@Log(title = "角色管理", businessType = BusinessType.DELETE)
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(String ids)
|
public AjaxResult remove(String ids)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return toAjax(roleService.deleteRoleByIds(ids));
|
return toAjax(roleService.deleteRoleByIds(ids));
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
return error(e.getMessage());
|
return error(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验角色名称
|
* 校验角色名称
|
||||||
*/
|
*/
|
||||||
@PostMapping("/checkRoleNameUnique")
|
@PostMapping("/checkRoleNameUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkRoleNameUnique(SysRole role)
|
public String checkRoleNameUnique(SysRole role)
|
||||||
{
|
{
|
||||||
return roleService.checkRoleNameUnique(role);
|
return roleService.checkRoleNameUnique(role);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验角色权限
|
* 校验角色权限
|
||||||
*/
|
*/
|
||||||
@PostMapping("/checkRoleKeyUnique")
|
@PostMapping("/checkRoleKeyUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkRoleKeyUnique(SysRole role)
|
public String checkRoleKeyUnique(SysRole role)
|
||||||
{
|
{
|
||||||
return roleService.checkRoleKeyUnique(role);
|
return roleService.checkRoleKeyUnique(role);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 选择菜单树
|
* 选择菜单树
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectMenuTree")
|
@GetMapping("/selectMenuTree")
|
||||||
public String selectMenuTree()
|
public String selectMenuTree()
|
||||||
{
|
{
|
||||||
return prefix + "/tree";
|
return prefix + "/tree";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色状态修改
|
* 角色状态修改
|
||||||
*/
|
*/
|
||||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||||
@RequiresPermissions("system:role:edit")
|
@RequiresPermissions("system:role:edit")
|
||||||
@PostMapping("/changeStatus")
|
@PostMapping("/changeStatus")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult changeStatus(SysRole role)
|
public AjaxResult changeStatus(SysRole role)
|
||||||
{
|
{
|
||||||
return toAjax(roleService.changeStatus(role));
|
return toAjax(roleService.changeStatus(role));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分配用户
|
* 分配用户
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:role:edit")
|
@RequiresPermissions("system:role:edit")
|
||||||
@GetMapping("/authUser/{roleId}")
|
@GetMapping("/authUser/{roleId}")
|
||||||
public String authUser(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
public String authUser(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
||||||
{
|
{
|
||||||
mmap.put("role", roleService.selectRoleById(roleId));
|
mmap.put("role", roleService.selectRoleById(roleId));
|
||||||
return prefix + "/authUser";
|
return prefix + "/authUser";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询已分配用户角色列表
|
* 查询已分配用户角色列表
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:role:list")
|
@RequiresPermissions("system:role:list")
|
||||||
@PostMapping("/authUser/allocatedList")
|
@PostMapping("/authUser/allocatedList")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo allocatedList(SysUser user)
|
public TableDataInfo allocatedList(SysUser user)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<SysUser> list = userService.selectAllocatedList(user);
|
List<SysUser> list = userService.selectAllocatedList(user);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消授权
|
* 取消授权
|
||||||
*/
|
*/
|
||||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
@PostMapping("/authUser/cancel")
|
@PostMapping("/authUser/cancel")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult cancelAuthUser(SysUserRole userRole)
|
public AjaxResult cancelAuthUser(SysUserRole userRole)
|
||||||
{
|
{
|
||||||
return toAjax(roleService.deleteAuthUser(userRole));
|
return toAjax(roleService.deleteAuthUser(userRole));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量取消授权
|
* 批量取消授权
|
||||||
*/
|
*/
|
||||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
@PostMapping("/authUser/cancelAll")
|
@PostMapping("/authUser/cancelAll")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult cancelAuthUserAll(Long roleId, String userIds)
|
public AjaxResult cancelAuthUserAll(Long roleId, String userIds)
|
||||||
{
|
{
|
||||||
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 选择用户
|
* 选择用户
|
||||||
*/
|
*/
|
||||||
@GetMapping("/authUser/selectUser/{roleId}")
|
@GetMapping("/authUser/selectUser/{roleId}")
|
||||||
public String selectUser(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
public String selectUser(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
||||||
{
|
{
|
||||||
mmap.put("role", roleService.selectRoleById(roleId));
|
mmap.put("role", roleService.selectRoleById(roleId));
|
||||||
return prefix + "/selectUser";
|
return prefix + "/selectUser";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询未分配用户角色列表
|
* 查询未分配用户角色列表
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:role:list")
|
@RequiresPermissions("system:role:list")
|
||||||
@PostMapping("/authUser/unallocatedList")
|
@PostMapping("/authUser/unallocatedList")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo unallocatedList(SysUser user)
|
public TableDataInfo unallocatedList(SysUser user)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<SysUser> list = userService.selectUnallocatedList(user);
|
List<SysUser> list = userService.selectUnallocatedList(user);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量选择用户授权
|
* 批量选择用户授权
|
||||||
*/
|
*/
|
||||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
@PostMapping("/authUser/selectAll")
|
@PostMapping("/authUser/selectAll")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult selectAuthUserAll(Long roleId, String userIds)
|
public AjaxResult selectAuthUserAll(Long roleId, String userIds)
|
||||||
{
|
{
|
||||||
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,263 +1,263 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
||||||
import com.ruoyi.framework.util.ShiroUtils;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.system.domain.SysUser;
|
import com.ruoyi.system.domain.SysUser;
|
||||||
import com.ruoyi.system.service.ISysPostService;
|
import com.ruoyi.system.service.ISysPostService;
|
||||||
import com.ruoyi.system.service.ISysRoleService;
|
import com.ruoyi.system.service.ISysRoleService;
|
||||||
import com.ruoyi.system.service.ISysUserService;
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户信息
|
* 用户信息
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/user")
|
@RequestMapping("/system/user")
|
||||||
public class SysUserController extends BaseController
|
public class SysUserController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "system/user";
|
private String prefix = "system/user";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysUserService userService;
|
private ISysUserService userService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysRoleService roleService;
|
private ISysRoleService roleService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysPostService postService;
|
private ISysPostService postService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysPasswordService passwordService;
|
private SysPasswordService passwordService;
|
||||||
|
|
||||||
@RequiresPermissions("system:user:view")
|
@RequiresPermissions("system:user:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String user()
|
public String user()
|
||||||
{
|
{
|
||||||
return prefix + "/user";
|
return prefix + "/user";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("system:user:list")
|
@RequiresPermissions("system:user:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(SysUser user)
|
public TableDataInfo list(SysUser user)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<SysUser> list = userService.selectUserList(user);
|
List<SysUser> list = userService.selectUserList(user);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
|
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
|
||||||
@RequiresPermissions("system:user:export")
|
@RequiresPermissions("system:user:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(SysUser user)
|
public AjaxResult export(SysUser user)
|
||||||
{
|
{
|
||||||
List<SysUser> list = userService.selectUserList(user);
|
List<SysUser> list = userService.selectUserList(user);
|
||||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||||
return util.exportExcel(list, "用户数据");
|
return util.exportExcel(list, "用户数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
||||||
@RequiresPermissions("system:user:import")
|
@RequiresPermissions("system:user:import")
|
||||||
@PostMapping("/importData")
|
@PostMapping("/importData")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
||||||
{
|
{
|
||||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||||
List<SysUser> userList = util.importExcel(file.getInputStream());
|
List<SysUser> userList = util.importExcel(file.getInputStream());
|
||||||
String operName = ShiroUtils.getSysUser().getLoginName();
|
String operName = ShiroUtils.getSysUser().getLoginName();
|
||||||
String message = userService.importUser(userList, updateSupport, operName);
|
String message = userService.importUser(userList, updateSupport, operName);
|
||||||
return AjaxResult.success(message);
|
return AjaxResult.success(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("system:user:view")
|
@RequiresPermissions("system:user:view")
|
||||||
@GetMapping("/importTemplate")
|
@GetMapping("/importTemplate")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult importTemplate()
|
public AjaxResult importTemplate()
|
||||||
{
|
{
|
||||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||||
return util.importTemplateExcel("用户数据");
|
return util.importTemplateExcel("用户数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增用户
|
* 新增用户
|
||||||
*/
|
*/
|
||||||
@GetMapping("/add")
|
@GetMapping("/add")
|
||||||
public String add(ModelMap mmap)
|
public String add(ModelMap mmap)
|
||||||
{
|
{
|
||||||
mmap.put("roles", roleService.selectRoleAll());
|
mmap.put("roles", roleService.selectRoleAll());
|
||||||
mmap.put("posts", postService.selectPostAll());
|
mmap.put("posts", postService.selectPostAll());
|
||||||
return prefix + "/add";
|
return prefix + "/add";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增保存用户
|
* 新增保存用户
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:user:add")
|
@RequiresPermissions("system:user:add")
|
||||||
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(@Validated SysUser user)
|
public AjaxResult addSave(@Validated SysUser user)
|
||||||
{
|
{
|
||||||
if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(user.getLoginName())))
|
if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(user.getLoginName())))
|
||||||
{
|
{
|
||||||
return error("新增用户'" + user.getLoginName() + "'失败,登录账号已存在");
|
return error("新增用户'" + user.getLoginName() + "'失败,登录账号已存在");
|
||||||
}
|
}
|
||||||
else if (UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
else if (UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
||||||
{
|
{
|
||||||
return error("新增用户'" + user.getLoginName() + "'失败,手机号码已存在");
|
return error("新增用户'" + user.getLoginName() + "'失败,手机号码已存在");
|
||||||
}
|
}
|
||||||
else if (UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
else if (UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
||||||
{
|
{
|
||||||
return error("新增用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
|
return error("新增用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
|
||||||
}
|
}
|
||||||
user.setSalt(ShiroUtils.randomSalt());
|
user.setSalt(ShiroUtils.randomSalt());
|
||||||
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
|
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
|
||||||
user.setCreateBy(ShiroUtils.getLoginName());
|
user.setCreateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(userService.insertUser(user));
|
return toAjax(userService.insertUser(user));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改用户
|
* 修改用户
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit/{userId}")
|
@GetMapping("/edit/{userId}")
|
||||||
public String edit(@PathVariable("userId") Long userId, ModelMap mmap)
|
public String edit(@PathVariable("userId") Long userId, ModelMap mmap)
|
||||||
{
|
{
|
||||||
mmap.put("user", userService.selectUserById(userId));
|
mmap.put("user", userService.selectUserById(userId));
|
||||||
mmap.put("roles", roleService.selectRolesByUserId(userId));
|
mmap.put("roles", roleService.selectRolesByUserId(userId));
|
||||||
mmap.put("posts", postService.selectPostsByUserId(userId));
|
mmap.put("posts", postService.selectPostsByUserId(userId));
|
||||||
return prefix + "/edit";
|
return prefix + "/edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改保存用户
|
* 修改保存用户
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:user:edit")
|
@RequiresPermissions("system:user:edit")
|
||||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(@Validated SysUser user)
|
public AjaxResult editSave(@Validated SysUser user)
|
||||||
{
|
{
|
||||||
if (StringUtils.isNotNull(user.getUserId()) && SysUser.isAdmin(user.getUserId()))
|
if (StringUtils.isNotNull(user.getUserId()) && SysUser.isAdmin(user.getUserId()))
|
||||||
{
|
{
|
||||||
return error("不允许修改超级管理员用户");
|
return error("不允许修改超级管理员用户");
|
||||||
}
|
}
|
||||||
else if (UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
else if (UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
||||||
{
|
{
|
||||||
return error("修改用户'" + user.getLoginName() + "'失败,手机号码已存在");
|
return error("修改用户'" + user.getLoginName() + "'失败,手机号码已存在");
|
||||||
}
|
}
|
||||||
else if (UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
else if (UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
||||||
{
|
{
|
||||||
return error("修改用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
|
return error("修改用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
|
||||||
}
|
}
|
||||||
user.setUpdateBy(ShiroUtils.getLoginName());
|
user.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(userService.updateUser(user));
|
return toAjax(userService.updateUser(user));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("system:user:resetPwd")
|
@RequiresPermissions("system:user:resetPwd")
|
||||||
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
|
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
|
||||||
@GetMapping("/resetPwd/{userId}")
|
@GetMapping("/resetPwd/{userId}")
|
||||||
public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap)
|
public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap)
|
||||||
{
|
{
|
||||||
mmap.put("user", userService.selectUserById(userId));
|
mmap.put("user", userService.selectUserById(userId));
|
||||||
return prefix + "/resetPwd";
|
return prefix + "/resetPwd";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("system:user:resetPwd")
|
@RequiresPermissions("system:user:resetPwd")
|
||||||
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
|
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/resetPwd")
|
@PostMapping("/resetPwd")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult resetPwdSave(SysUser user)
|
public AjaxResult resetPwdSave(SysUser user)
|
||||||
{
|
{
|
||||||
user.setSalt(ShiroUtils.randomSalt());
|
user.setSalt(ShiroUtils.randomSalt());
|
||||||
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
|
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
|
||||||
if (userService.resetUserPwd(user) > 0)
|
if (userService.resetUserPwd(user) > 0)
|
||||||
{
|
{
|
||||||
if (ShiroUtils.getUserId() == user.getUserId())
|
if (ShiroUtils.getUserId() == user.getUserId())
|
||||||
{
|
{
|
||||||
ShiroUtils.setSysUser(userService.selectUserById(user.getUserId()));
|
ShiroUtils.setSysUser(userService.selectUserById(user.getUserId()));
|
||||||
}
|
}
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
return error();
|
return error();
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("system:user:remove")
|
@RequiresPermissions("system:user:remove")
|
||||||
@Log(title = "用户管理", businessType = BusinessType.DELETE)
|
@Log(title = "用户管理", businessType = BusinessType.DELETE)
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(String ids)
|
public AjaxResult remove(String ids)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return toAjax(userService.deleteUserByIds(ids));
|
return toAjax(userService.deleteUserByIds(ids));
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
return error(e.getMessage());
|
return error(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验用户名
|
* 校验用户名
|
||||||
*/
|
*/
|
||||||
@PostMapping("/checkLoginNameUnique")
|
@PostMapping("/checkLoginNameUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkLoginNameUnique(SysUser user)
|
public String checkLoginNameUnique(SysUser user)
|
||||||
{
|
{
|
||||||
return userService.checkLoginNameUnique(user.getLoginName());
|
return userService.checkLoginNameUnique(user.getLoginName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验手机号码
|
* 校验手机号码
|
||||||
*/
|
*/
|
||||||
@PostMapping("/checkPhoneUnique")
|
@PostMapping("/checkPhoneUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkPhoneUnique(SysUser user)
|
public String checkPhoneUnique(SysUser user)
|
||||||
{
|
{
|
||||||
return userService.checkPhoneUnique(user);
|
return userService.checkPhoneUnique(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验email邮箱
|
* 校验email邮箱
|
||||||
*/
|
*/
|
||||||
@PostMapping("/checkEmailUnique")
|
@PostMapping("/checkEmailUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkEmailUnique(SysUser user)
|
public String checkEmailUnique(SysUser user)
|
||||||
{
|
{
|
||||||
return userService.checkEmailUnique(user);
|
return userService.checkEmailUnique(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户状态修改
|
* 用户状态修改
|
||||||
*/
|
*/
|
||||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||||
@RequiresPermissions("system:user:edit")
|
@RequiresPermissions("system:user:edit")
|
||||||
@PostMapping("/changeStatus")
|
@PostMapping("/changeStatus")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult changeStatus(SysUser user)
|
public AjaxResult changeStatus(SysUser user)
|
||||||
{
|
{
|
||||||
return toAjax(userService.changeStatus(user));
|
return toAjax(userService.changeStatus(user));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,26 +1,26 @@
|
||||||
package com.ruoyi.web.controller.tool;
|
package com.ruoyi.web.controller.tool;
|
||||||
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* build 表单构建
|
* build 表单构建
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/tool/build")
|
@RequestMapping("/tool/build")
|
||||||
public class BuildController extends BaseController
|
public class BuildController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "tool/build";
|
private String prefix = "tool/build";
|
||||||
|
|
||||||
@RequiresPermissions("tool:build:view")
|
@RequiresPermissions("tool:build:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String build()
|
public String build()
|
||||||
{
|
{
|
||||||
return prefix + "/build";
|
return prefix + "/build";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,24 +1,24 @@
|
||||||
package com.ruoyi.web.controller.tool;
|
package com.ruoyi.web.controller.tool;
|
||||||
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* swagger 接口
|
* swagger 接口
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/tool/swagger")
|
@RequestMapping("/tool/swagger")
|
||||||
public class SwaggerController extends BaseController
|
public class SwaggerController extends BaseController
|
||||||
{
|
{
|
||||||
@RequiresPermissions("tool:swagger:view")
|
@RequiresPermissions("tool:swagger:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String index()
|
public String index()
|
||||||
{
|
{
|
||||||
return redirect("/swagger-ui.html");
|
return redirect("/swagger-ui.html");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,175 +1,175 @@
|
||||||
package com.ruoyi.web.controller.tool;
|
package com.ruoyi.web.controller.tool;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* swagger 用户测试方法
|
* swagger 用户测试方法
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Api("用户信息管理")
|
@Api("用户信息管理")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/test/user")
|
@RequestMapping("/test/user")
|
||||||
public class TestController extends BaseController
|
public class TestController extends BaseController
|
||||||
{
|
{
|
||||||
private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
|
private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
|
||||||
{
|
{
|
||||||
users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
|
users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
|
||||||
users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
|
users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("获取用户列表")
|
@ApiOperation("获取用户列表")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public AjaxResult userList()
|
public AjaxResult userList()
|
||||||
{
|
{
|
||||||
List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
|
List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
|
||||||
return AjaxResult.success(userList);
|
return AjaxResult.success(userList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("获取用户详细")
|
@ApiOperation("获取用户详细")
|
||||||
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
|
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
|
||||||
@GetMapping("/{userId}")
|
@GetMapping("/{userId}")
|
||||||
public AjaxResult getUser(@PathVariable Integer userId)
|
public AjaxResult getUser(@PathVariable Integer userId)
|
||||||
{
|
{
|
||||||
if (!users.isEmpty() && users.containsKey(userId))
|
if (!users.isEmpty() && users.containsKey(userId))
|
||||||
{
|
{
|
||||||
return AjaxResult.success(users.get(userId));
|
return AjaxResult.success(users.get(userId));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return error("用户不存在");
|
return error("用户不存在");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("新增用户")
|
@ApiOperation("新增用户")
|
||||||
@ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
|
@ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
public AjaxResult save(UserEntity user)
|
public AjaxResult save(UserEntity user)
|
||||||
{
|
{
|
||||||
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
||||||
{
|
{
|
||||||
return error("用户ID不能为空");
|
return error("用户ID不能为空");
|
||||||
}
|
}
|
||||||
return AjaxResult.success(users.put(user.getUserId(), user));
|
return AjaxResult.success(users.put(user.getUserId(), user));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("更新用户")
|
@ApiOperation("更新用户")
|
||||||
@ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
|
@ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
public AjaxResult update(UserEntity user)
|
public AjaxResult update(UserEntity user)
|
||||||
{
|
{
|
||||||
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
||||||
{
|
{
|
||||||
return error("用户ID不能为空");
|
return error("用户ID不能为空");
|
||||||
}
|
}
|
||||||
if (users.isEmpty() || !users.containsKey(user.getUserId()))
|
if (users.isEmpty() || !users.containsKey(user.getUserId()))
|
||||||
{
|
{
|
||||||
return error("用户不存在");
|
return error("用户不存在");
|
||||||
}
|
}
|
||||||
users.remove(user.getUserId());
|
users.remove(user.getUserId());
|
||||||
return AjaxResult.success(users.put(user.getUserId(), user));
|
return AjaxResult.success(users.put(user.getUserId(), user));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("删除用户信息")
|
@ApiOperation("删除用户信息")
|
||||||
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
|
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
|
||||||
@DeleteMapping("/{userId}")
|
@DeleteMapping("/{userId}")
|
||||||
public AjaxResult delete(@PathVariable Integer userId)
|
public AjaxResult delete(@PathVariable Integer userId)
|
||||||
{
|
{
|
||||||
if (!users.isEmpty() && users.containsKey(userId))
|
if (!users.isEmpty() && users.containsKey(userId))
|
||||||
{
|
{
|
||||||
users.remove(userId);
|
users.remove(userId);
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return error("用户不存在");
|
return error("用户不存在");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiModel("用户实体")
|
@ApiModel("用户实体")
|
||||||
class UserEntity
|
class UserEntity
|
||||||
{
|
{
|
||||||
@ApiModelProperty("用户ID")
|
@ApiModelProperty("用户ID")
|
||||||
private Integer userId;
|
private Integer userId;
|
||||||
|
|
||||||
@ApiModelProperty("用户名称")
|
@ApiModelProperty("用户名称")
|
||||||
private String username;
|
private String username;
|
||||||
|
|
||||||
@ApiModelProperty("用户密码")
|
@ApiModelProperty("用户密码")
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
@ApiModelProperty("用户手机")
|
@ApiModelProperty("用户手机")
|
||||||
private String mobile;
|
private String mobile;
|
||||||
|
|
||||||
public UserEntity()
|
public UserEntity()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserEntity(Integer userId, String username, String password, String mobile)
|
public UserEntity(Integer userId, String username, String password, String mobile)
|
||||||
{
|
{
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
this.mobile = mobile;
|
this.mobile = mobile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getUserId()
|
public Integer getUserId()
|
||||||
{
|
{
|
||||||
return userId;
|
return userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserId(Integer userId)
|
public void setUserId(Integer userId)
|
||||||
{
|
{
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUsername()
|
public String getUsername()
|
||||||
{
|
{
|
||||||
return username;
|
return username;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUsername(String username)
|
public void setUsername(String username)
|
||||||
{
|
{
|
||||||
this.username = username;
|
this.username = username;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPassword()
|
public String getPassword()
|
||||||
{
|
{
|
||||||
return password;
|
return password;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPassword(String password)
|
public void setPassword(String password)
|
||||||
{
|
{
|
||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMobile()
|
public String getMobile()
|
||||||
{
|
{
|
||||||
return mobile;
|
return mobile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMobile(String mobile)
|
public void setMobile(String mobile)
|
||||||
{
|
{
|
||||||
this.mobile = mobile;
|
this.mobile = mobile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,62 +1,62 @@
|
||||||
package com.ruoyi.web.core.config;
|
package com.ruoyi.web.core.config;
|
||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import com.ruoyi.common.config.Global;
|
import com.ruoyi.common.config.Global;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import springfox.documentation.builders.ApiInfoBuilder;
|
import springfox.documentation.builders.ApiInfoBuilder;
|
||||||
import springfox.documentation.builders.PathSelectors;
|
import springfox.documentation.builders.PathSelectors;
|
||||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||||
import springfox.documentation.service.ApiInfo;
|
import springfox.documentation.service.ApiInfo;
|
||||||
import springfox.documentation.service.Contact;
|
import springfox.documentation.service.Contact;
|
||||||
import springfox.documentation.spi.DocumentationType;
|
import springfox.documentation.spi.DocumentationType;
|
||||||
import springfox.documentation.spring.web.plugins.Docket;
|
import springfox.documentation.spring.web.plugins.Docket;
|
||||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Swagger2的接口配置
|
* Swagger2的接口配置
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableSwagger2
|
@EnableSwagger2
|
||||||
public class SwaggerConfig
|
public class SwaggerConfig
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 创建API
|
* 创建API
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public Docket createRestApi()
|
public Docket createRestApi()
|
||||||
{
|
{
|
||||||
return new Docket(DocumentationType.SWAGGER_2)
|
return new Docket(DocumentationType.SWAGGER_2)
|
||||||
// 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息)
|
// 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息)
|
||||||
.apiInfo(apiInfo())
|
.apiInfo(apiInfo())
|
||||||
// 设置哪些接口暴露给Swagger展示
|
// 设置哪些接口暴露给Swagger展示
|
||||||
.select()
|
.select()
|
||||||
// 扫描所有有注解的api,用这种方式更灵活
|
// 扫描所有有注解的api,用这种方式更灵活
|
||||||
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
||||||
// 扫描指定包中的swagger注解
|
// 扫描指定包中的swagger注解
|
||||||
//.apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger"))
|
//.apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger"))
|
||||||
// 扫描所有 .apis(RequestHandlerSelectors.any())
|
// 扫描所有 .apis(RequestHandlerSelectors.any())
|
||||||
.paths(PathSelectors.any())
|
.paths(PathSelectors.any())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加摘要信息
|
* 添加摘要信息
|
||||||
*/
|
*/
|
||||||
private ApiInfo apiInfo()
|
private ApiInfo apiInfo()
|
||||||
{
|
{
|
||||||
// 用ApiInfoBuilder进行定制
|
// 用ApiInfoBuilder进行定制
|
||||||
return new ApiInfoBuilder()
|
return new ApiInfoBuilder()
|
||||||
// 设置标题
|
// 设置标题
|
||||||
.title("标题:若依管理系统_接口文档")
|
.title("标题:若依管理系统_接口文档")
|
||||||
// 描述
|
// 描述
|
||||||
.description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
|
.description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
|
||||||
// 作者信息
|
// 作者信息
|
||||||
.contact(new Contact(Global.getName(), null, null))
|
.contact(new Contact(Global.getName(), null, null))
|
||||||
// 版本
|
// 版本
|
||||||
.version("版本号:" + Global.getVersion())
|
.version("版本号:" + Global.getVersion())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,57 +1,57 @@
|
||||||
# 数据源配置
|
# 数据源配置
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
druid:
|
druid:
|
||||||
# 主库数据源
|
# 主库数据源
|
||||||
master:
|
master:
|
||||||
url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
url: jdbc:mysql://localhost:3306/ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
username: root
|
username: root
|
||||||
password: password
|
password: 123456
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
slave:
|
slave:
|
||||||
# 从数据源开关/默认关闭
|
# 从数据源开关/默认关闭
|
||||||
enabled: false
|
enabled: false
|
||||||
url:
|
url:
|
||||||
username:
|
username:
|
||||||
password:
|
password:
|
||||||
# 初始连接数
|
# 初始连接数
|
||||||
initialSize: 5
|
initialSize: 5
|
||||||
# 最小连接池数量
|
# 最小连接池数量
|
||||||
minIdle: 10
|
minIdle: 10
|
||||||
# 最大连接池数量
|
# 最大连接池数量
|
||||||
maxActive: 20
|
maxActive: 20
|
||||||
# 配置获取连接等待超时的时间
|
# 配置获取连接等待超时的时间
|
||||||
maxWait: 60000
|
maxWait: 60000
|
||||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||||
timeBetweenEvictionRunsMillis: 60000
|
timeBetweenEvictionRunsMillis: 60000
|
||||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||||
minEvictableIdleTimeMillis: 300000
|
minEvictableIdleTimeMillis: 300000
|
||||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||||
maxEvictableIdleTimeMillis: 900000
|
maxEvictableIdleTimeMillis: 900000
|
||||||
# 配置检测连接是否有效
|
# 配置检测连接是否有效
|
||||||
validationQuery: SELECT 1 FROM DUAL
|
validationQuery: SELECT 1 FROM DUAL
|
||||||
testWhileIdle: true
|
testWhileIdle: true
|
||||||
testOnBorrow: false
|
testOnBorrow: false
|
||||||
testOnReturn: false
|
testOnReturn: false
|
||||||
webStatFilter:
|
webStatFilter:
|
||||||
enabled: true
|
enabled: true
|
||||||
statViewServlet:
|
statViewServlet:
|
||||||
enabled: true
|
enabled: true
|
||||||
# 设置白名单,不填则允许所有访问
|
# 设置白名单,不填则允许所有访问
|
||||||
allow:
|
allow:
|
||||||
url-pattern: /druid/*
|
url-pattern: /druid/*
|
||||||
# 控制台管理用户名和密码
|
# 控制台管理用户名和密码
|
||||||
login-username:
|
login-username:
|
||||||
login-password:
|
login-password:
|
||||||
filter:
|
filter:
|
||||||
stat:
|
stat:
|
||||||
enabled: true
|
enabled: true
|
||||||
# 慢SQL记录
|
# 慢SQL记录
|
||||||
log-slow-sql: true
|
log-slow-sql: true
|
||||||
slow-sql-millis: 1000
|
slow-sql-millis: 1000
|
||||||
merge-sql: true
|
merge-sql: true
|
||||||
wall:
|
wall:
|
||||||
config:
|
config:
|
||||||
multi-statement-allow: true
|
multi-statement-allow: true
|
||||||
|
|
@ -1,130 +1,130 @@
|
||||||
# 项目相关配置
|
# 项目相关配置
|
||||||
ruoyi:
|
ruoyi:
|
||||||
# 名称
|
# 名称
|
||||||
name: RuoYi
|
name: RuoYi
|
||||||
# 版本
|
# 版本
|
||||||
version: 3.4.0
|
version: 3.4.0
|
||||||
# 版权年份
|
# 版权年份
|
||||||
copyrightYear: 2019
|
copyrightYear: 2019
|
||||||
# 实例演示开关
|
# 实例演示开关
|
||||||
demoEnabled: true
|
demoEnabled: true
|
||||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||||
profile: D:/ruoyi/uploadPath
|
profile: D:/ruoyi/uploadPath
|
||||||
# 获取ip地址开关
|
# 获取ip地址开关
|
||||||
addressEnabled: true
|
addressEnabled: true
|
||||||
|
|
||||||
# 开发环境配置
|
# 开发环境配置
|
||||||
server:
|
server:
|
||||||
# 服务器的HTTP端口,默认为80
|
# 服务器的HTTP端口,默认为80
|
||||||
port: 80
|
port: 80
|
||||||
servlet:
|
servlet:
|
||||||
# 应用的访问路径
|
# 应用的访问路径
|
||||||
context-path: /
|
context-path: /bmw
|
||||||
tomcat:
|
tomcat:
|
||||||
# tomcat的URI编码
|
# tomcat的URI编码
|
||||||
uri-encoding: UTF-8
|
uri-encoding: UTF-8
|
||||||
# tomcat最大线程数,默认为200
|
# tomcat最大线程数,默认为200
|
||||||
max-threads: 800
|
max-threads: 800
|
||||||
# Tomcat启动初始化的线程数,默认值25
|
# Tomcat启动初始化的线程数,默认值25
|
||||||
min-spare-threads: 30
|
min-spare-threads: 30
|
||||||
|
|
||||||
# 日志配置
|
# 日志配置
|
||||||
logging:
|
logging:
|
||||||
level:
|
level:
|
||||||
com.ruoyi: debug
|
com.ruoyi: debug
|
||||||
org.springframework: warn
|
org.springframework: warn
|
||||||
|
|
||||||
# 用户配置
|
# 用户配置
|
||||||
user:
|
user:
|
||||||
password:
|
password:
|
||||||
# 密码错误{maxRetryCount}次锁定10分钟
|
# 密码错误{maxRetryCount}次锁定10分钟
|
||||||
maxRetryCount: 5
|
maxRetryCount: 5
|
||||||
|
|
||||||
# Spring配置
|
# Spring配置
|
||||||
spring:
|
spring:
|
||||||
# 模板引擎
|
# 模板引擎
|
||||||
thymeleaf:
|
thymeleaf:
|
||||||
mode: HTML
|
mode: HTML
|
||||||
encoding: utf-8
|
encoding: utf-8
|
||||||
# 禁用缓存
|
# 禁用缓存
|
||||||
cache: false
|
cache: false
|
||||||
# 资源信息
|
# 资源信息
|
||||||
messages:
|
messages:
|
||||||
# 国际化资源文件路径
|
# 国际化资源文件路径
|
||||||
basename: static/i18n/messages
|
basename: static/i18n/messages
|
||||||
jackson:
|
jackson:
|
||||||
time-zone: GMT+8
|
time-zone: GMT+8
|
||||||
date-format: yyyy-MM-dd HH:mm:ss
|
date-format: yyyy-MM-dd HH:mm:ss
|
||||||
profiles:
|
profiles:
|
||||||
active: druid
|
active: druid
|
||||||
# 文件上传
|
# 文件上传
|
||||||
servlet:
|
servlet:
|
||||||
multipart:
|
multipart:
|
||||||
# 单个文件大小
|
# 单个文件大小
|
||||||
max-file-size: 10MB
|
max-file-size: 10MB
|
||||||
# 设置总上传的文件大小
|
# 设置总上传的文件大小
|
||||||
max-request-size: 20MB
|
max-request-size: 20MB
|
||||||
# 服务模块
|
# 服务模块
|
||||||
devtools:
|
devtools:
|
||||||
restart:
|
restart:
|
||||||
# 热部署开关
|
# 热部署开关
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
# MyBatis
|
# MyBatis
|
||||||
mybatis:
|
mybatis:
|
||||||
# 搜索指定包别名
|
# 搜索指定包别名
|
||||||
typeAliasesPackage: com.ruoyi
|
typeAliasesPackage: com.ruoyi
|
||||||
# 配置mapper的扫描,找到所有的mapper.xml映射文件
|
# 配置mapper的扫描,找到所有的mapper.xml映射文件
|
||||||
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
||||||
# 加载全局的配置文件
|
# 加载全局的配置文件
|
||||||
configLocation: classpath:mybatis/mybatis-config.xml
|
configLocation: classpath:mybatis/mybatis-config.xml
|
||||||
|
|
||||||
# PageHelper分页插件
|
# PageHelper分页插件
|
||||||
pagehelper:
|
pagehelper:
|
||||||
helperDialect: mysql
|
helperDialect: mysql
|
||||||
reasonable: true
|
reasonable: true
|
||||||
supportMethodsArguments: true
|
supportMethodsArguments: true
|
||||||
params: count=countSql
|
params: count=countSql
|
||||||
|
|
||||||
# Shiro
|
# Shiro
|
||||||
shiro:
|
shiro:
|
||||||
user:
|
user:
|
||||||
# 登录地址
|
# 登录地址
|
||||||
loginUrl: /login
|
loginUrl: /login
|
||||||
# 权限认证失败地址
|
# 权限认证失败地址
|
||||||
unauthorizedUrl: /unauth
|
unauthorizedUrl: /unauth
|
||||||
# 首页地址
|
# 首页地址
|
||||||
indexUrl: /index
|
indexUrl: /index
|
||||||
# 验证码开关
|
# 验证码开关
|
||||||
captchaEnabled: true
|
captchaEnabled: true
|
||||||
# 验证码类型 math 数组计算 char 字符
|
# 验证码类型 math 数组计算 char 字符
|
||||||
captchaType: math
|
captchaType: math
|
||||||
cookie:
|
cookie:
|
||||||
# 设置Cookie的域名 默认空,即当前访问的域名
|
# 设置Cookie的域名 默认空,即当前访问的域名
|
||||||
domain:
|
domain:
|
||||||
# 设置cookie的有效访问路径
|
# 设置cookie的有效访问路径
|
||||||
path: /
|
path: /
|
||||||
# 设置HttpOnly属性
|
# 设置HttpOnly属性
|
||||||
httpOnly: true
|
httpOnly: true
|
||||||
# 设置Cookie的过期时间,天为单位
|
# 设置Cookie的过期时间,天为单位
|
||||||
maxAge: 30
|
maxAge: 30
|
||||||
session:
|
session:
|
||||||
# Session超时时间(默认30分钟)
|
# Session超时时间(默认30分钟)
|
||||||
expireTime: 30
|
expireTime: 30
|
||||||
# 同步session到数据库的周期(默认1分钟)
|
# 同步session到数据库的周期(默认1分钟)
|
||||||
dbSyncPeriod: 1
|
dbSyncPeriod: 1
|
||||||
# 相隔多久检查一次session的有效性,默认就是10分钟
|
# 相隔多久检查一次session的有效性,默认就是10分钟
|
||||||
validationInterval: 10
|
validationInterval: 10
|
||||||
# 同一个用户最大会话数,比如2的意思是同一个账号允许最多同时两个人登录(默认-1不限制)
|
# 同一个用户最大会话数,比如2的意思是同一个账号允许最多同时两个人登录(默认-1不限制)
|
||||||
maxSession: -1
|
maxSession: -1
|
||||||
# 踢出之前登录的/之后登录的用户,默认踢出之前登录的用户
|
# 踢出之前登录的/之后登录的用户,默认踢出之前登录的用户
|
||||||
kickoutAfter: false
|
kickoutAfter: false
|
||||||
|
|
||||||
# 防止XSS攻击
|
# 防止XSS攻击
|
||||||
xss:
|
xss:
|
||||||
# 过滤开关
|
# 过滤开关
|
||||||
enabled: true
|
enabled: true
|
||||||
# 排除链接(多个用逗号分隔)
|
# 排除链接(多个用逗号分隔)
|
||||||
excludes: /system/notice/*
|
excludes: /system/notice/*
|
||||||
# 匹配链接
|
# 匹配链接
|
||||||
urlPatterns: /system/*,/monitor/*,/tool/*
|
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||||
|
|
@ -1,24 +1,24 @@
|
||||||
Application Version: ${ruoyi.version}
|
Application Version: ${ruoyi.version}
|
||||||
Spring Boot Version: ${spring-boot.version}
|
Spring Boot Version: ${spring-boot.version}
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// _ooOoo_ //
|
// _ooOoo_ //
|
||||||
// o8888888o //
|
// o8888888o //
|
||||||
// 88" . "88 //
|
// 88" . "88 //
|
||||||
// (| ^_^ |) //
|
// (| ^_^ |) //
|
||||||
// O\ = /O //
|
// O\ = /O //
|
||||||
// ____/`---'\____ //
|
// ____/`---'\____ //
|
||||||
// .' \\| |// `. //
|
// .' \\| |// `. //
|
||||||
// / \\||| : |||// \ //
|
// / \\||| : |||// \ //
|
||||||
// / _||||| -:- |||||- \ //
|
// / _||||| -:- |||||- \ //
|
||||||
// | | \\\ - /// | | //
|
// | | \\\ - /// | | //
|
||||||
// | \_| ''\---/'' | | //
|
// | \_| ''\---/'' | | //
|
||||||
// \ .-\__ `-` ___/-. / //
|
// \ .-\__ `-` ___/-. / //
|
||||||
// ___`. .' /--.--\ `. . ___ //
|
// ___`. .' /--.--\ `. . ___ //
|
||||||
// ."" '< `.___\_<|>_/___.' >'"". //
|
// ."" '< `.___\_<|>_/___.' >'"". //
|
||||||
// | | : `- \`.;`\ _ /`;.`/ - ` : | | //
|
// | | : `- \`.;`\ _ /`;.`/ - ` : | | //
|
||||||
// \ \ `-. \_ __\ /__ _/ .-` / / //
|
// \ \ `-. \_ __\ /__ _/ .-` / / //
|
||||||
// ========`-.____`-.___\_____/___.-`____.-'======== //
|
// ========`-.____`-.___\_____/___.-`____.-'======== //
|
||||||
// `=---=' //
|
// `=---=' //
|
||||||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
|
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
|
||||||
// 佛祖保佑 永不宕机 永无BUG //
|
// 佛祖保佑 永不宕机 永无BUG //
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -1,38 +1,38 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ehcache name="ruoyi" updateCheck="false">
|
<ehcache name="ruoyi" updateCheck="false">
|
||||||
|
|
||||||
<!-- 磁盘缓存位置 -->
|
<!-- 磁盘缓存位置 -->
|
||||||
<diskStore path="java.io.tmpdir"/>
|
<diskStore path="java.io.tmpdir"/>
|
||||||
|
|
||||||
<!-- 默认缓存 -->
|
<!-- 默认缓存 -->
|
||||||
<defaultCache
|
<defaultCache
|
||||||
maxEntriesLocalHeap="1000"
|
maxEntriesLocalHeap="1000"
|
||||||
eternal="false"
|
eternal="false"
|
||||||
timeToIdleSeconds="3600"
|
timeToIdleSeconds="3600"
|
||||||
timeToLiveSeconds="3600"
|
timeToLiveSeconds="3600"
|
||||||
overflowToDisk="false">
|
overflowToDisk="false">
|
||||||
</defaultCache>
|
</defaultCache>
|
||||||
|
|
||||||
<!-- 登录记录缓存 锁定10分钟 -->
|
<!-- 登录记录缓存 锁定10分钟 -->
|
||||||
<cache name="loginRecordCache"
|
<cache name="loginRecordCache"
|
||||||
maxEntriesLocalHeap="2000"
|
maxEntriesLocalHeap="2000"
|
||||||
eternal="false"
|
eternal="false"
|
||||||
timeToIdleSeconds="600"
|
timeToIdleSeconds="600"
|
||||||
timeToLiveSeconds="0"
|
timeToLiveSeconds="0"
|
||||||
overflowToDisk="false"
|
overflowToDisk="false"
|
||||||
statistics="true">
|
statistics="true">
|
||||||
</cache>
|
</cache>
|
||||||
|
|
||||||
<!-- 系统活跃用户缓存 -->
|
<!-- 系统活跃用户缓存 -->
|
||||||
<cache name="sys-userCache"
|
<cache name="sys-userCache"
|
||||||
maxEntriesLocalHeap="10000"
|
maxEntriesLocalHeap="10000"
|
||||||
overflowToDisk="false"
|
overflowToDisk="false"
|
||||||
eternal="false"
|
eternal="false"
|
||||||
diskPersistent="false"
|
diskPersistent="false"
|
||||||
timeToLiveSeconds="0"
|
timeToLiveSeconds="0"
|
||||||
timeToIdleSeconds="0"
|
timeToIdleSeconds="0"
|
||||||
statistics="true">
|
statistics="true">
|
||||||
</cache>
|
</cache>
|
||||||
|
|
||||||
</ehcache>
|
</ehcache>
|
||||||
|
|
||||||
|
|
@ -1,93 +1,93 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<!-- 日志存放路径 -->
|
<!-- 日志存放路径 -->
|
||||||
<property name="log.path" value="/home/ruoyi/logs" />
|
<property name="log.path" value="/home/ruoyi/logs" />
|
||||||
<!-- 日志输出格式 -->
|
<!-- 日志输出格式 -->
|
||||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||||
|
|
||||||
<!-- 控制台输出 -->
|
<!-- 控制台输出 -->
|
||||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
<encoder>
|
<encoder>
|
||||||
<pattern>${log.pattern}</pattern>
|
<pattern>${log.pattern}</pattern>
|
||||||
</encoder>
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<!-- 系统日志输出 -->
|
<!-- 系统日志输出 -->
|
||||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
<file>${log.path}/sys-info.log</file>
|
<file>${log.path}/sys-info.log</file>
|
||||||
<!-- 循环政策:基于时间创建日志文件 -->
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
<!-- 日志文件名格式 -->
|
<!-- 日志文件名格式 -->
|
||||||
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
<!-- 日志最大的历史 60天 -->
|
<!-- 日志最大的历史 60天 -->
|
||||||
<maxHistory>60</maxHistory>
|
<maxHistory>60</maxHistory>
|
||||||
</rollingPolicy>
|
</rollingPolicy>
|
||||||
<encoder>
|
<encoder>
|
||||||
<pattern>${log.pattern}</pattern>
|
<pattern>${log.pattern}</pattern>
|
||||||
</encoder>
|
</encoder>
|
||||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
<!-- 过滤的级别 -->
|
<!-- 过滤的级别 -->
|
||||||
<level>INFO</level>
|
<level>INFO</level>
|
||||||
<!-- 匹配时的操作:接收(记录) -->
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
<onMatch>ACCEPT</onMatch>
|
<onMatch>ACCEPT</onMatch>
|
||||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
<onMismatch>DENY</onMismatch>
|
<onMismatch>DENY</onMismatch>
|
||||||
</filter>
|
</filter>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
<file>${log.path}/sys-error.log</file>
|
<file>${log.path}/sys-error.log</file>
|
||||||
<!-- 循环政策:基于时间创建日志文件 -->
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
<!-- 日志文件名格式 -->
|
<!-- 日志文件名格式 -->
|
||||||
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
<!-- 日志最大的历史 60天 -->
|
<!-- 日志最大的历史 60天 -->
|
||||||
<maxHistory>60</maxHistory>
|
<maxHistory>60</maxHistory>
|
||||||
</rollingPolicy>
|
</rollingPolicy>
|
||||||
<encoder>
|
<encoder>
|
||||||
<pattern>${log.pattern}</pattern>
|
<pattern>${log.pattern}</pattern>
|
||||||
</encoder>
|
</encoder>
|
||||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
<!-- 过滤的级别 -->
|
<!-- 过滤的级别 -->
|
||||||
<level>ERROR</level>
|
<level>ERROR</level>
|
||||||
<!-- 匹配时的操作:接收(记录) -->
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
<onMatch>ACCEPT</onMatch>
|
<onMatch>ACCEPT</onMatch>
|
||||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
<onMismatch>DENY</onMismatch>
|
<onMismatch>DENY</onMismatch>
|
||||||
</filter>
|
</filter>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<!-- 用户访问日志输出 -->
|
<!-- 用户访问日志输出 -->
|
||||||
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
<file>${log.path}/sys-user.log</file>
|
<file>${log.path}/sys-user.log</file>
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
<!-- 按天回滚 daily -->
|
<!-- 按天回滚 daily -->
|
||||||
<fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
|
<fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
<!-- 日志最大的历史 60天 -->
|
<!-- 日志最大的历史 60天 -->
|
||||||
<maxHistory>60</maxHistory>
|
<maxHistory>60</maxHistory>
|
||||||
</rollingPolicy>
|
</rollingPolicy>
|
||||||
<encoder>
|
<encoder>
|
||||||
<pattern>${log.pattern}</pattern>
|
<pattern>${log.pattern}</pattern>
|
||||||
</encoder>
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<!-- 系统模块日志级别控制 -->
|
<!-- 系统模块日志级别控制 -->
|
||||||
<logger name="com.ruoyi" level="info" />
|
<logger name="com.ruoyi" level="info" />
|
||||||
<!-- Spring日志级别控制 -->
|
<!-- Spring日志级别控制 -->
|
||||||
<logger name="org.springframework" level="warn" />
|
<logger name="org.springframework" level="warn" />
|
||||||
|
|
||||||
<root level="info">
|
<root level="info">
|
||||||
<appender-ref ref="console" />
|
<appender-ref ref="console" />
|
||||||
</root>
|
</root>
|
||||||
|
|
||||||
<!--系统操作日志-->
|
<!--系统操作日志-->
|
||||||
<root level="info">
|
<root level="info">
|
||||||
<appender-ref ref="file_info" />
|
<appender-ref ref="file_info" />
|
||||||
<appender-ref ref="file_error" />
|
<appender-ref ref="file_error" />
|
||||||
</root>
|
</root>
|
||||||
|
|
||||||
<!--系统用户操作日志-->
|
<!--系统用户操作日志-->
|
||||||
<logger name="sys-user" level="info">
|
<logger name="sys-user" level="info">
|
||||||
<appender-ref ref="sys-user"/>
|
<appender-ref ref="sys-user"/>
|
||||||
</logger>
|
</logger>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 847 B After Width: | Height: | Size: 847 B |
|
|
@ -1,10 +1,10 @@
|
||||||
/*!
|
/*!
|
||||||
* Bootstrap-select v1.13.10 (https://developer.snapappointments.com/bootstrap-select)
|
* Bootstrap-select v1.13.10 (https://developer.snapappointments.com/bootstrap-select)
|
||||||
*
|
*
|
||||||
* Copyright 2012-2019 SnapAppointments, LLC
|
* Copyright 2012-2019 SnapAppointments, LLC
|
||||||
* Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE)
|
* Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
select.bs-select-hidden,
|
select.bs-select-hidden,
|
||||||
.bootstrap-select > select.bs-select-hidden,
|
.bootstrap-select > select.bs-select-hidden,
|
||||||
select.selectpicker {
|
select.selectpicker {
|
||||||
|
|
@ -1,146 +1,146 @@
|
||||||
/**
|
/**
|
||||||
* @author zhixin wen <wenzhixin2010@gmail.com>
|
* @author zhixin wen <wenzhixin2010@gmail.com>
|
||||||
* extensions: https://github.com/vitalets/x-editable
|
* extensions: https://github.com/vitalets/x-editable
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function($) {
|
(function($) {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
$.extend($.fn.bootstrapTable.defaults, {
|
$.extend($.fn.bootstrapTable.defaults, {
|
||||||
editable: true,
|
editable: true,
|
||||||
onEditableInit: function() {
|
onEditableInit: function() {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
onEditableSave: function(field, row, oldValue, $el) {
|
onEditableSave: function(field, row, oldValue, $el) {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
onEditableShown: function(field, row, $el, editable) {
|
onEditableShown: function(field, row, $el, editable) {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
onEditableHidden: function(field, row, $el, reason) {
|
onEditableHidden: function(field, row, $el, reason) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$.extend($.fn.bootstrapTable.Constructor.EVENTS, {
|
$.extend($.fn.bootstrapTable.Constructor.EVENTS, {
|
||||||
'editable-init.bs.table': 'onEditableInit',
|
'editable-init.bs.table': 'onEditableInit',
|
||||||
'editable-save.bs.table': 'onEditableSave',
|
'editable-save.bs.table': 'onEditableSave',
|
||||||
'editable-shown.bs.table': 'onEditableShown',
|
'editable-shown.bs.table': 'onEditableShown',
|
||||||
'editable-hidden.bs.table': 'onEditableHidden'
|
'editable-hidden.bs.table': 'onEditableHidden'
|
||||||
});
|
});
|
||||||
|
|
||||||
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
||||||
_initTable = BootstrapTable.prototype.initTable,
|
_initTable = BootstrapTable.prototype.initTable,
|
||||||
_initBody = BootstrapTable.prototype.initBody;
|
_initBody = BootstrapTable.prototype.initBody;
|
||||||
|
|
||||||
BootstrapTable.prototype.initTable = function() {
|
BootstrapTable.prototype.initTable = function() {
|
||||||
var that = this;
|
var that = this;
|
||||||
_initTable.apply(this, Array.prototype.slice.apply(arguments));
|
_initTable.apply(this, Array.prototype.slice.apply(arguments));
|
||||||
|
|
||||||
if (!this.options.editable) {
|
if (!this.options.editable) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$.each(this.columns, function(i, column) {
|
$.each(this.columns, function(i, column) {
|
||||||
if (!column.editable) {
|
if (!column.editable) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var editableOptions = {},
|
var editableOptions = {},
|
||||||
editableDataMarkup = [],
|
editableDataMarkup = [],
|
||||||
editableDataPrefix = 'editable-';
|
editableDataPrefix = 'editable-';
|
||||||
|
|
||||||
var processDataOptions = function(key, value) {
|
var processDataOptions = function(key, value) {
|
||||||
// Replace camel case with dashes.
|
// Replace camel case with dashes.
|
||||||
var dashKey = key.replace(/([A-Z])/g, function($1) {
|
var dashKey = key.replace(/([A-Z])/g, function($1) {
|
||||||
return "-" + $1.toLowerCase();
|
return "-" + $1.toLowerCase();
|
||||||
});
|
});
|
||||||
if (dashKey.slice(0, editableDataPrefix.length) == editableDataPrefix) {
|
if (dashKey.slice(0, editableDataPrefix.length) == editableDataPrefix) {
|
||||||
var dataKey = dashKey.replace(editableDataPrefix, 'data-');
|
var dataKey = dashKey.replace(editableDataPrefix, 'data-');
|
||||||
editableOptions[dataKey] = value;
|
editableOptions[dataKey] = value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$.each(that.options, processDataOptions);
|
$.each(that.options, processDataOptions);
|
||||||
|
|
||||||
column.formatter = column.formatter || function(value, row, index) {
|
column.formatter = column.formatter || function(value, row, index) {
|
||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
column._formatter = column._formatter ? column._formatter : column.formatter;
|
column._formatter = column._formatter ? column._formatter : column.formatter;
|
||||||
column.formatter = function(value, row, index) {
|
column.formatter = function(value, row, index) {
|
||||||
var result = column._formatter ? column._formatter(value, row, index) : value;
|
var result = column._formatter ? column._formatter(value, row, index) : value;
|
||||||
|
|
||||||
$.each(column, processDataOptions);
|
$.each(column, processDataOptions);
|
||||||
|
|
||||||
$.each(editableOptions, function(key, value) {
|
$.each(editableOptions, function(key, value) {
|
||||||
editableDataMarkup.push(' ' + key + '="' + value + '"');
|
editableDataMarkup.push(' ' + key + '="' + value + '"');
|
||||||
});
|
});
|
||||||
|
|
||||||
var _dont_edit_formatter = false;
|
var _dont_edit_formatter = false;
|
||||||
if (column.editable.hasOwnProperty('noeditFormatter')) {
|
if (column.editable.hasOwnProperty('noeditFormatter')) {
|
||||||
_dont_edit_formatter = column.editable.noeditFormatter(value, row, index);
|
_dont_edit_formatter = column.editable.noeditFormatter(value, row, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_dont_edit_formatter === false) {
|
if (_dont_edit_formatter === false) {
|
||||||
return ['<a href="javascript:void(0)"',
|
return ['<a href="javascript:void(0)"',
|
||||||
' data-name="' + column.field + '"',
|
' data-name="' + column.field + '"',
|
||||||
' data-pk="' + row[that.options.idField] + '"',
|
' data-pk="' + row[that.options.idField] + '"',
|
||||||
' data-value="' + result + '"',
|
' data-value="' + result + '"',
|
||||||
editableDataMarkup.join(''),
|
editableDataMarkup.join(''),
|
||||||
'>' + '</a>'
|
'>' + '</a>'
|
||||||
].join('');
|
].join('');
|
||||||
} else {
|
} else {
|
||||||
return _dont_edit_formatter;
|
return _dont_edit_formatter;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
BootstrapTable.prototype.initBody = function() {
|
BootstrapTable.prototype.initBody = function() {
|
||||||
var that = this;
|
var that = this;
|
||||||
_initBody.apply(this, Array.prototype.slice.apply(arguments));
|
_initBody.apply(this, Array.prototype.slice.apply(arguments));
|
||||||
|
|
||||||
if (!this.options.editable) {
|
if (!this.options.editable) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$.each(this.columns, function(i, column) {
|
$.each(this.columns, function(i, column) {
|
||||||
if (!column.editable) {
|
if (!column.editable) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
that.$body.find('a[data-name="' + column.field + '"]').editable(column.editable)
|
that.$body.find('a[data-name="' + column.field + '"]').editable(column.editable)
|
||||||
.off('save').on('save', function(e, params) {
|
.off('save').on('save', function(e, params) {
|
||||||
var data = that.getData(),
|
var data = that.getData(),
|
||||||
index = $(this).parents('tr[data-index]').data('index'),
|
index = $(this).parents('tr[data-index]').data('index'),
|
||||||
row = data[index],
|
row = data[index],
|
||||||
oldValue = row[column.field];
|
oldValue = row[column.field];
|
||||||
|
|
||||||
$(this).data('value', params.submitValue);
|
$(this).data('value', params.submitValue);
|
||||||
row[column.field] = params.submitValue;
|
row[column.field] = params.submitValue;
|
||||||
that.trigger('editable-save', column.field, row, oldValue, $(this));
|
that.trigger('editable-save', column.field, row, oldValue, $(this));
|
||||||
that.resetFooter();
|
that.resetFooter();
|
||||||
});
|
});
|
||||||
that.$body.find('a[data-name="' + column.field + '"]').editable(column.editable)
|
that.$body.find('a[data-name="' + column.field + '"]').editable(column.editable)
|
||||||
.off('shown').on('shown', function(e, editable) {
|
.off('shown').on('shown', function(e, editable) {
|
||||||
var data = that.getData(),
|
var data = that.getData(),
|
||||||
index = $(this).parents('tr[data-index]').data('index'),
|
index = $(this).parents('tr[data-index]').data('index'),
|
||||||
row = data[index];
|
row = data[index];
|
||||||
|
|
||||||
that.trigger('editable-shown', column.field, row, $(this), editable);
|
that.trigger('editable-shown', column.field, row, $(this), editable);
|
||||||
});
|
});
|
||||||
that.$body.find('a[data-name="' + column.field + '"]').editable(column.editable)
|
that.$body.find('a[data-name="' + column.field + '"]').editable(column.editable)
|
||||||
.off('hidden').on('hidden', function(e, reason) {
|
.off('hidden').on('hidden', function(e, reason) {
|
||||||
var data = that.getData(),
|
var data = that.getData(),
|
||||||
index = $(this).parents('tr[data-index]').data('index'),
|
index = $(this).parents('tr[data-index]').data('index'),
|
||||||
row = data[index];
|
row = data[index];
|
||||||
|
|
||||||
that.trigger('editable-hidden', column.field, row, $(this), reason);
|
that.trigger('editable-hidden', column.field, row, $(this), reason);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this.trigger('editable-init');
|
this.trigger('editable-init');
|
||||||
};
|
};
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* bootstrap-table - v1.11.0 - 2016-07-02
|
* bootstrap-table - v1.11.0 - 2016-07-02
|
||||||
* https://github.com/wenzhixin/bootstrap-table
|
* https://github.com/wenzhixin/bootstrap-table
|
||||||
* Copyright (c) 2016 zhixin wen
|
* Copyright (c) 2016 zhixin wen
|
||||||
* Licensed MIT License
|
* Licensed MIT License
|
||||||
*/
|
*/
|
||||||
!function(a){"use strict";a.extend(a.fn.bootstrapTable.defaults,{editable:!0,onEditableInit:function(){return!1},onEditableSave:function(){return!1},onEditableShown:function(){return!1},onEditableHidden:function(){return!1}}),a.extend(a.fn.bootstrapTable.Constructor.EVENTS,{"editable-init.bs.table":"onEditableInit","editable-save.bs.table":"onEditableSave","editable-shown.bs.table":"onEditableShown","editable-hidden.bs.table":"onEditableHidden"});var b=a.fn.bootstrapTable.Constructor,c=b.prototype.initTable,d=b.prototype.initBody;b.prototype.initTable=function(){var b=this;c.apply(this,Array.prototype.slice.apply(arguments)),this.options.editable&&a.each(this.columns,function(c,d){if(d.editable){var e={},f=[],g="editable-",h=function(a,b){var c=a.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()});if(c.slice(0,g.length)==g){var d=c.replace(g,"data-");e[d]=b}};a.each(b.options,h),d.formatter=d.formatter||function(a){return a},d._formatter=d._formatter?d._formatter:d.formatter,d.formatter=function(c,g,i){var j=d._formatter?d._formatter(c,g,i):c;a.each(d,h),a.each(e,function(a,b){f.push(" "+a+'="'+b+'"')});var k=!1;return d.editable.hasOwnProperty("noeditFormatter")&&(k=d.editable.noeditFormatter(c,g,i)),k===!1?['<a href="javascript:void(0)"',' data-name="'+d.field+'"',' data-pk="'+g[b.options.idField]+'"',' data-value="'+j+'"',f.join(""),"></a>"].join(""):k}}})},b.prototype.initBody=function(){var b=this;d.apply(this,Array.prototype.slice.apply(arguments)),this.options.editable&&(a.each(this.columns,function(c,d){d.editable&&(b.$body.find('a[data-name="'+d.field+'"]').editable(d.editable).off("save").on("save",function(c,e){var f=b.getData(),g=a(this).parents("tr[data-index]").data("index"),h=f[g],i=h[d.field];a(this).data("value",e.submitValue),h[d.field]=e.submitValue,b.trigger("editable-save",d.field,h,i,a(this)),b.resetFooter()}),b.$body.find('a[data-name="'+d.field+'"]').editable(d.editable).off("shown").on("shown",function(c,e){var f=b.getData(),g=a(this).parents("tr[data-index]").data("index"),h=f[g];b.trigger("editable-shown",d.field,h,a(this),e)}),b.$body.find('a[data-name="'+d.field+'"]').editable(d.editable).off("hidden").on("hidden",function(c,e){var f=b.getData(),g=a(this).parents("tr[data-index]").data("index"),h=f[g];b.trigger("editable-hidden",d.field,h,a(this),e)}))}),this.trigger("editable-init"))}}(jQuery);
|
!function(a){"use strict";a.extend(a.fn.bootstrapTable.defaults,{editable:!0,onEditableInit:function(){return!1},onEditableSave:function(){return!1},onEditableShown:function(){return!1},onEditableHidden:function(){return!1}}),a.extend(a.fn.bootstrapTable.Constructor.EVENTS,{"editable-init.bs.table":"onEditableInit","editable-save.bs.table":"onEditableSave","editable-shown.bs.table":"onEditableShown","editable-hidden.bs.table":"onEditableHidden"});var b=a.fn.bootstrapTable.Constructor,c=b.prototype.initTable,d=b.prototype.initBody;b.prototype.initTable=function(){var b=this;c.apply(this,Array.prototype.slice.apply(arguments)),this.options.editable&&a.each(this.columns,function(c,d){if(d.editable){var e={},f=[],g="editable-",h=function(a,b){var c=a.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()});if(c.slice(0,g.length)==g){var d=c.replace(g,"data-");e[d]=b}};a.each(b.options,h),d.formatter=d.formatter||function(a){return a},d._formatter=d._formatter?d._formatter:d.formatter,d.formatter=function(c,g,i){var j=d._formatter?d._formatter(c,g,i):c;a.each(d,h),a.each(e,function(a,b){f.push(" "+a+'="'+b+'"')});var k=!1;return d.editable.hasOwnProperty("noeditFormatter")&&(k=d.editable.noeditFormatter(c,g,i)),k===!1?['<a href="javascript:void(0)"',' data-name="'+d.field+'"',' data-pk="'+g[b.options.idField]+'"',' data-value="'+j+'"',f.join(""),"></a>"].join(""):k}}})},b.prototype.initBody=function(){var b=this;d.apply(this,Array.prototype.slice.apply(arguments)),this.options.editable&&(a.each(this.columns,function(c,d){d.editable&&(b.$body.find('a[data-name="'+d.field+'"]').editable(d.editable).off("save").on("save",function(c,e){var f=b.getData(),g=a(this).parents("tr[data-index]").data("index"),h=f[g],i=h[d.field];a(this).data("value",e.submitValue),h[d.field]=e.submitValue,b.trigger("editable-save",d.field,h,i,a(this)),b.resetFooter()}),b.$body.find('a[data-name="'+d.field+'"]').editable(d.editable).off("shown").on("shown",function(c,e){var f=b.getData(),g=a(this).parents("tr[data-index]").data("index"),h=f[g];b.trigger("editable-shown",d.field,h,a(this),e)}),b.$body.find('a[data-name="'+d.field+'"]').editable(d.editable).off("hidden").on("hidden",function(c,e){var f=b.getData(),g=a(this).parents("tr[data-index]").data("index"),h=f[g];b.trigger("editable-hidden",d.field,h,a(this),e)}))}),this.trigger("editable-init"))}}(jQuery);
|
||||||
|
|
@ -1,119 +1,119 @@
|
||||||
/**
|
/**
|
||||||
* @author zhixin wen <wenzhixin2010@gmail.com>
|
* @author zhixin wen <wenzhixin2010@gmail.com>
|
||||||
* extensions: https://github.com/kayalshri/tableExport.jquery.plugin
|
* extensions: https://github.com/kayalshri/tableExport.jquery.plugin
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function ($) {
|
(function ($) {
|
||||||
'use strict';
|
'use strict';
|
||||||
var sprintf = $.fn.bootstrapTable.utils.sprintf;
|
var sprintf = $.fn.bootstrapTable.utils.sprintf;
|
||||||
|
|
||||||
var TYPE_NAME = {
|
var TYPE_NAME = {
|
||||||
csv: 'CSV',
|
csv: 'CSV',
|
||||||
txt: 'TXT',
|
txt: 'TXT',
|
||||||
doc: 'Word',
|
doc: 'Word',
|
||||||
excel: 'Excel'
|
excel: 'Excel'
|
||||||
};
|
};
|
||||||
|
|
||||||
$.extend($.fn.bootstrapTable.defaults, {
|
$.extend($.fn.bootstrapTable.defaults, {
|
||||||
showExport: false,
|
showExport: false,
|
||||||
exportDataType: 'all', // basic, all, selected
|
exportDataType: 'all', // basic, all, selected
|
||||||
exportTypes: ['csv', 'txt', 'doc', 'excel'],
|
exportTypes: ['csv', 'txt', 'doc', 'excel'],
|
||||||
exportOptions: {
|
exportOptions: {
|
||||||
ignoreColumn: [0] //忽略列索引
|
ignoreColumn: [0] //忽略列索引
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$.extend($.fn.bootstrapTable.defaults.icons, {
|
$.extend($.fn.bootstrapTable.defaults.icons, {
|
||||||
export: 'glyphicon glyphicon-save'
|
export: 'glyphicon glyphicon-save'
|
||||||
});
|
});
|
||||||
|
|
||||||
$.extend($.fn.bootstrapTable.locales, {
|
$.extend($.fn.bootstrapTable.locales, {
|
||||||
formatExport: function () {
|
formatExport: function () {
|
||||||
return 'Export data';
|
return 'Export data';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
|
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
|
||||||
|
|
||||||
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
||||||
_initToolbar = BootstrapTable.prototype.initToolbar;
|
_initToolbar = BootstrapTable.prototype.initToolbar;
|
||||||
|
|
||||||
BootstrapTable.prototype.initToolbar = function () {
|
BootstrapTable.prototype.initToolbar = function () {
|
||||||
this.showToolbar = this.options.showExport;
|
this.showToolbar = this.options.showExport;
|
||||||
|
|
||||||
_initToolbar.apply(this, Array.prototype.slice.apply(arguments));
|
_initToolbar.apply(this, Array.prototype.slice.apply(arguments));
|
||||||
|
|
||||||
if (this.options.showExport) {
|
if (this.options.showExport) {
|
||||||
var that = this,
|
var that = this,
|
||||||
$btnGroup = this.$toolbar.find('>.btn-group'),
|
$btnGroup = this.$toolbar.find('>.btn-group'),
|
||||||
$export = $btnGroup.find('div.export');
|
$export = $btnGroup.find('div.export');
|
||||||
|
|
||||||
if (!$export.length) {
|
if (!$export.length) {
|
||||||
$export = $([
|
$export = $([
|
||||||
'<div class="export btn-group">',
|
'<div class="export btn-group">',
|
||||||
'<button class="btn' +
|
'<button class="btn' +
|
||||||
sprintf(' btn-%s', this.options.buttonsClass) +
|
sprintf(' btn-%s', this.options.buttonsClass) +
|
||||||
sprintf(' btn-%s', this.options.iconSize) +
|
sprintf(' btn-%s', this.options.iconSize) +
|
||||||
' dropdown-toggle" ' +
|
' dropdown-toggle" ' +
|
||||||
'title="' + this.options.formatExport() + '" ' +
|
'title="' + this.options.formatExport() + '" ' +
|
||||||
'data-toggle="dropdown" type="button">',
|
'data-toggle="dropdown" type="button">',
|
||||||
sprintf('<i class="%s %s"></i> ', this.options.iconsPrefix, this.options.icons.export),
|
sprintf('<i class="%s %s"></i> ', this.options.iconsPrefix, this.options.icons.export),
|
||||||
'<span class="caret"></span>',
|
'<span class="caret"></span>',
|
||||||
'</button>',
|
'</button>',
|
||||||
'<ul class="dropdown-menu" role="menu">',
|
'<ul class="dropdown-menu" role="menu">',
|
||||||
'</ul>',
|
'</ul>',
|
||||||
'</div>'].join('')).appendTo($btnGroup);
|
'</div>'].join('')).appendTo($btnGroup);
|
||||||
|
|
||||||
var $menu = $export.find('.dropdown-menu'),
|
var $menu = $export.find('.dropdown-menu'),
|
||||||
exportTypes = this.options.exportTypes;
|
exportTypes = this.options.exportTypes;
|
||||||
|
|
||||||
if (typeof this.options.exportTypes === 'string') {
|
if (typeof this.options.exportTypes === 'string') {
|
||||||
var types = this.options.exportTypes.slice(1, -1).replace(/ /g, '').split(',');
|
var types = this.options.exportTypes.slice(1, -1).replace(/ /g, '').split(',');
|
||||||
|
|
||||||
exportTypes = [];
|
exportTypes = [];
|
||||||
$.each(types, function (i, value) {
|
$.each(types, function (i, value) {
|
||||||
exportTypes.push(value.slice(1, -1));
|
exportTypes.push(value.slice(1, -1));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$.each(exportTypes, function (i, type) {
|
$.each(exportTypes, function (i, type) {
|
||||||
if (TYPE_NAME.hasOwnProperty(type)) {
|
if (TYPE_NAME.hasOwnProperty(type)) {
|
||||||
$menu.append(['<li data-type="' + type + '">',
|
$menu.append(['<li data-type="' + type + '">',
|
||||||
'<a href="javascript:void(0)">',
|
'<a href="javascript:void(0)">',
|
||||||
TYPE_NAME[type],
|
TYPE_NAME[type],
|
||||||
'</a>',
|
'</a>',
|
||||||
'</li>'].join(''));
|
'</li>'].join(''));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$menu.find('li').click(function () {
|
$menu.find('li').click(function () {
|
||||||
var type = $(this).data('type'),
|
var type = $(this).data('type'),
|
||||||
doExport = function () {
|
doExport = function () {
|
||||||
that.$el.tableExport($.extend({}, that.options.exportOptions, {
|
that.$el.tableExport($.extend({}, that.options.exportOptions, {
|
||||||
type: type,
|
type: type,
|
||||||
escape: false
|
escape: false
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
if (that.options.exportDataType === 'all' && that.options.pagination) {
|
if (that.options.exportDataType === 'all' && that.options.pagination) {
|
||||||
that.$el.one(that.options.sidePagination === 'server' ? 'post-body.bs.table' : 'page-change.bs.table', function () {
|
that.$el.one(that.options.sidePagination === 'server' ? 'post-body.bs.table' : 'page-change.bs.table', function () {
|
||||||
doExport();
|
doExport();
|
||||||
that.togglePagination();
|
that.togglePagination();
|
||||||
});
|
});
|
||||||
that.togglePagination();
|
that.togglePagination();
|
||||||
} else if (that.options.exportDataType === 'selected') {
|
} else if (that.options.exportDataType === 'selected') {
|
||||||
//修改sidePagination属性为server无法导出选中数据
|
//修改sidePagination属性为server无法导出选中数据
|
||||||
var trs = that.$body.children();
|
var trs = that.$body.children();
|
||||||
for (var i = 0; i < trs.length; i++) {
|
for (var i = 0; i < trs.length; i++) {
|
||||||
var $this = $(trs[i]);
|
var $this = $(trs[i]);
|
||||||
if(!$this.find(sprintf('[name="%s"]',that.options.selectItemName)).prop('checked')){
|
if(!$this.find(sprintf('[name="%s"]',that.options.selectItemName)).prop('checked')){
|
||||||
$this['hide']();
|
$this['hide']();
|
||||||
}}
|
}}
|
||||||
doExport();
|
doExport();
|
||||||
that.getRowsHidden(true);
|
that.getRowsHidden(true);
|
||||||
} else {
|
} else {
|
||||||
doExport();
|
doExport();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|
@ -1,92 +1,92 @@
|
||||||
/**
|
/**
|
||||||
* 基于bootstrap-table-mobile修改
|
* 基于bootstrap-table-mobile修改
|
||||||
* 修正部分iPhone手机不显示卡片视图
|
* 修正部分iPhone手机不显示卡片视图
|
||||||
* Copyright (c) 2019 ruoyi
|
* Copyright (c) 2019 ruoyi
|
||||||
*/
|
*/
|
||||||
!function ($) {
|
!function ($) {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var resetView = function (that) {
|
var resetView = function (that) {
|
||||||
if (that.options.height || that.options.showFooter) {
|
if (that.options.height || that.options.showFooter) {
|
||||||
setTimeout(that.resetView(), 1);
|
setTimeout(that.resetView(), 1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 判断是否 iphone
|
// 判断是否 iphone
|
||||||
var isIPhone = function () {
|
var isIPhone = function () {
|
||||||
var browserName = navigator.userAgent.toLowerCase();
|
var browserName = navigator.userAgent.toLowerCase();
|
||||||
return /(iPhone|iPad|iPod|iOS)/i.test(browserName);
|
return /(iPhone|iPad|iPod|iOS)/i.test(browserName);
|
||||||
};
|
};
|
||||||
|
|
||||||
var changeView = function (that, width, height) {
|
var changeView = function (that, width, height) {
|
||||||
if (that.options.minHeight) {
|
if (that.options.minHeight) {
|
||||||
if (checkValuesLessEqual(width, that.options.minWidth) && checkValuesLessEqual(height, that.options.minHeight)) {
|
if (checkValuesLessEqual(width, that.options.minWidth) && checkValuesLessEqual(height, that.options.minHeight)) {
|
||||||
conditionCardView(that);
|
conditionCardView(that);
|
||||||
} else if (checkValuesGreater(width, that.options.minWidth) && checkValuesGreater(height, that.options.minHeight)) {
|
} else if (checkValuesGreater(width, that.options.minWidth) && checkValuesGreater(height, that.options.minHeight)) {
|
||||||
conditionFullView(that);
|
conditionFullView(that);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (checkValuesLessEqual(width, that.options.minWidth) || isIPhone()) {
|
if (checkValuesLessEqual(width, that.options.minWidth) || isIPhone()) {
|
||||||
conditionCardView(that);
|
conditionCardView(that);
|
||||||
} else if (checkValuesGreater(width, that.options.minWidth)) {
|
} else if (checkValuesGreater(width, that.options.minWidth)) {
|
||||||
conditionFullView(that);
|
conditionFullView(that);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resetView(that);
|
resetView(that);
|
||||||
};
|
};
|
||||||
|
|
||||||
var checkValuesLessEqual = function (currentValue, targetValue) {
|
var checkValuesLessEqual = function (currentValue, targetValue) {
|
||||||
return currentValue <= targetValue;
|
return currentValue <= targetValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
var checkValuesGreater = function (currentValue, targetValue) {
|
var checkValuesGreater = function (currentValue, targetValue) {
|
||||||
return currentValue > targetValue;
|
return currentValue > targetValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
var conditionCardView = function (that) {
|
var conditionCardView = function (that) {
|
||||||
changeTableView(that, false);
|
changeTableView(that, false);
|
||||||
};
|
};
|
||||||
|
|
||||||
var conditionFullView = function (that) {
|
var conditionFullView = function (that) {
|
||||||
changeTableView(that, true);
|
changeTableView(that, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
var changeTableView = function (that, cardViewState) {
|
var changeTableView = function (that, cardViewState) {
|
||||||
that.options.cardView = cardViewState;
|
that.options.cardView = cardViewState;
|
||||||
that.toggleView();
|
that.toggleView();
|
||||||
};
|
};
|
||||||
|
|
||||||
$.extend($.fn.bootstrapTable.defaults, {
|
$.extend($.fn.bootstrapTable.defaults, {
|
||||||
mobileResponsive: false,
|
mobileResponsive: false,
|
||||||
minWidth: 562,
|
minWidth: 562,
|
||||||
minHeight: undefined,
|
minHeight: undefined,
|
||||||
checkOnInit: true,
|
checkOnInit: true,
|
||||||
toggled: false
|
toggled: false
|
||||||
});
|
});
|
||||||
|
|
||||||
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
||||||
_init = BootstrapTable.prototype.init;
|
_init = BootstrapTable.prototype.init;
|
||||||
|
|
||||||
BootstrapTable.prototype.init = function () {
|
BootstrapTable.prototype.init = function () {
|
||||||
_init.apply(this, Array.prototype.slice.apply(arguments));
|
_init.apply(this, Array.prototype.slice.apply(arguments));
|
||||||
|
|
||||||
if (!this.options.mobileResponsive) {
|
if (!this.options.mobileResponsive) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.options.minWidth) {
|
if (!this.options.minWidth) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var that = this;
|
var that = this;
|
||||||
$(window).resize(function () {
|
$(window).resize(function () {
|
||||||
changeView(that, $(this).width(), $(this).height())
|
changeView(that, $(this).width(), $(this).height())
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.options.checkOnInit) {
|
if (this.options.checkOnInit) {
|
||||||
changeView(this, $(window).width(), $(window).height());
|
changeView(this, $(window).width(), $(window).height());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}(jQuery);
|
}(jQuery);
|
||||||
|
|
@ -1,211 +1,211 @@
|
||||||
/**
|
/**
|
||||||
* @author: aperez <aperez@datadec.es>
|
* @author: aperez <aperez@datadec.es>
|
||||||
* @version: v2.0.0
|
* @version: v2.0.0
|
||||||
*
|
*
|
||||||
* @update Dennis Hernández <http://djhvscf.github.io/Blog>
|
* @update Dennis Hernández <http://djhvscf.github.io/Blog>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
!function($) {
|
!function($) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var firstLoad = false;
|
var firstLoad = false;
|
||||||
|
|
||||||
var sprintf = $.fn.bootstrapTable.utils.sprintf;
|
var sprintf = $.fn.bootstrapTable.utils.sprintf;
|
||||||
|
|
||||||
var showAvdSearch = function(pColumns, searchTitle, searchText, that) {
|
var showAvdSearch = function(pColumns, searchTitle, searchText, that) {
|
||||||
if (!$("#avdSearchModal" + "_" + that.options.idTable).hasClass("modal")) {
|
if (!$("#avdSearchModal" + "_" + that.options.idTable).hasClass("modal")) {
|
||||||
var vModal = sprintf("<div id=\"avdSearchModal%s\" class=\"modal fade\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"mySmallModalLabel\" aria-hidden=\"true\">", "_" + that.options.idTable);
|
var vModal = sprintf("<div id=\"avdSearchModal%s\" class=\"modal fade\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"mySmallModalLabel\" aria-hidden=\"true\">", "_" + that.options.idTable);
|
||||||
vModal += "<div class=\"modal-dialog modal-xs\">";
|
vModal += "<div class=\"modal-dialog modal-xs\">";
|
||||||
vModal += " <div class=\"modal-content\">";
|
vModal += " <div class=\"modal-content\">";
|
||||||
vModal += " <div class=\"modal-header\">";
|
vModal += " <div class=\"modal-header\">";
|
||||||
vModal += " <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\" >×</button>";
|
vModal += " <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\" >×</button>";
|
||||||
vModal += sprintf(" <h4 class=\"modal-title\">%s</h4>", searchTitle);
|
vModal += sprintf(" <h4 class=\"modal-title\">%s</h4>", searchTitle);
|
||||||
vModal += " </div>";
|
vModal += " </div>";
|
||||||
vModal += " <div class=\"modal-body modal-body-custom\">";
|
vModal += " <div class=\"modal-body modal-body-custom\">";
|
||||||
vModal += sprintf(" <div class=\"container-fluid\" id=\"avdSearchModalContent%s\" style=\"padding-right: 0px;padding-left: 0px;\" >", "_" + that.options.idTable);
|
vModal += sprintf(" <div class=\"container-fluid\" id=\"avdSearchModalContent%s\" style=\"padding-right: 0px;padding-left: 0px;\" >", "_" + that.options.idTable);
|
||||||
vModal += " </div>";
|
vModal += " </div>";
|
||||||
vModal += " </div>";
|
vModal += " </div>";
|
||||||
vModal += " </div>";
|
vModal += " </div>";
|
||||||
vModal += " </div>";
|
vModal += " </div>";
|
||||||
vModal += "</div>";
|
vModal += "</div>";
|
||||||
|
|
||||||
$("body").append($(vModal));
|
$("body").append($(vModal));
|
||||||
|
|
||||||
var vFormAvd = createFormAvd(pColumns, searchText, that),
|
var vFormAvd = createFormAvd(pColumns, searchText, that),
|
||||||
timeoutId = 0;;
|
timeoutId = 0;;
|
||||||
|
|
||||||
$('#avdSearchModalContent' + "_" + that.options.idTable).append(vFormAvd.join(''));
|
$('#avdSearchModalContent' + "_" + that.options.idTable).append(vFormAvd.join(''));
|
||||||
|
|
||||||
$('#' + that.options.idForm).off('keyup blur', 'input').on('keyup blur', 'input', function (event) {
|
$('#' + that.options.idForm).off('keyup blur', 'input').on('keyup blur', 'input', function (event) {
|
||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
timeoutId = setTimeout(function () {
|
timeoutId = setTimeout(function () {
|
||||||
that.onColumnAdvancedSearch(event);
|
that.onColumnAdvancedSearch(event);
|
||||||
}, that.options.searchTimeOut);
|
}, that.options.searchTimeOut);
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#btnCloseAvd" + "_" + that.options.idTable).click(function() {
|
$("#btnCloseAvd" + "_" + that.options.idTable).click(function() {
|
||||||
$("#avdSearchModal" + "_" + that.options.idTable).modal('hide');
|
$("#avdSearchModal" + "_" + that.options.idTable).modal('hide');
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#avdSearchModal" + "_" + that.options.idTable).modal();
|
$("#avdSearchModal" + "_" + that.options.idTable).modal();
|
||||||
} else {
|
} else {
|
||||||
$("#avdSearchModal" + "_" + that.options.idTable).modal();
|
$("#avdSearchModal" + "_" + that.options.idTable).modal();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var createFormAvd = function(pColumns, searchText, that) {
|
var createFormAvd = function(pColumns, searchText, that) {
|
||||||
var htmlForm = [];
|
var htmlForm = [];
|
||||||
htmlForm.push(sprintf('<form class="form-horizontal" id="%s" action="%s" >', that.options.idForm, that.options.actionForm));
|
htmlForm.push(sprintf('<form class="form-horizontal" id="%s" action="%s" >', that.options.idForm, that.options.actionForm));
|
||||||
for (var i in pColumns) {
|
for (var i in pColumns) {
|
||||||
var vObjCol = pColumns[i];
|
var vObjCol = pColumns[i];
|
||||||
if (!vObjCol.checkbox && vObjCol.visible && vObjCol.searchable) {
|
if (!vObjCol.checkbox && vObjCol.visible && vObjCol.searchable) {
|
||||||
htmlForm.push('<div class="form-group">');
|
htmlForm.push('<div class="form-group">');
|
||||||
htmlForm.push(sprintf('<label class="col-sm-4 control-label">%s</label>', vObjCol.title));
|
htmlForm.push(sprintf('<label class="col-sm-4 control-label">%s</label>', vObjCol.title));
|
||||||
htmlForm.push('<div class="col-sm-6">');
|
htmlForm.push('<div class="col-sm-6">');
|
||||||
htmlForm.push(sprintf('<input type="text" class="form-control input-md" name="%s" placeholder="%s" id="%s">', vObjCol.field, vObjCol.title, vObjCol.field));
|
htmlForm.push(sprintf('<input type="text" class="form-control input-md" name="%s" placeholder="%s" id="%s">', vObjCol.field, vObjCol.title, vObjCol.field));
|
||||||
htmlForm.push('</div>');
|
htmlForm.push('</div>');
|
||||||
htmlForm.push('</div>');
|
htmlForm.push('</div>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
htmlForm.push('<div class="form-group">');
|
htmlForm.push('<div class="form-group">');
|
||||||
htmlForm.push('<div class="col-sm-offset-9 col-sm-3">');
|
htmlForm.push('<div class="col-sm-offset-9 col-sm-3">');
|
||||||
htmlForm.push(sprintf('<button type="button" id="btnCloseAvd%s" class="btn btn-default" >%s</button>', "_" + that.options.idTable, searchText));
|
htmlForm.push(sprintf('<button type="button" id="btnCloseAvd%s" class="btn btn-default" >%s</button>', "_" + that.options.idTable, searchText));
|
||||||
htmlForm.push('</div>');
|
htmlForm.push('</div>');
|
||||||
htmlForm.push('</div>');
|
htmlForm.push('</div>');
|
||||||
htmlForm.push('</form>');
|
htmlForm.push('</form>');
|
||||||
|
|
||||||
return htmlForm;
|
return htmlForm;
|
||||||
};
|
};
|
||||||
|
|
||||||
$.extend($.fn.bootstrapTable.defaults, {
|
$.extend($.fn.bootstrapTable.defaults, {
|
||||||
advancedSearch: false,
|
advancedSearch: false,
|
||||||
idForm: 'advancedSearch',
|
idForm: 'advancedSearch',
|
||||||
actionForm: '',
|
actionForm: '',
|
||||||
idTable: undefined,
|
idTable: undefined,
|
||||||
onColumnAdvancedSearch: function (field, text) {
|
onColumnAdvancedSearch: function (field, text) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$.extend($.fn.bootstrapTable.defaults.icons, {
|
$.extend($.fn.bootstrapTable.defaults.icons, {
|
||||||
advancedSearchIcon: 'glyphicon-chevron-down'
|
advancedSearchIcon: 'glyphicon-chevron-down'
|
||||||
});
|
});
|
||||||
|
|
||||||
$.extend($.fn.bootstrapTable.Constructor.EVENTS, {
|
$.extend($.fn.bootstrapTable.Constructor.EVENTS, {
|
||||||
'column-advanced-search.bs.table': 'onColumnAdvancedSearch'
|
'column-advanced-search.bs.table': 'onColumnAdvancedSearch'
|
||||||
});
|
});
|
||||||
|
|
||||||
$.extend($.fn.bootstrapTable.locales, {
|
$.extend($.fn.bootstrapTable.locales, {
|
||||||
formatAdvancedSearch: function() {
|
formatAdvancedSearch: function() {
|
||||||
return 'Advanced search';
|
return 'Advanced search';
|
||||||
},
|
},
|
||||||
formatAdvancedCloseButton: function() {
|
formatAdvancedCloseButton: function() {
|
||||||
return "Close";
|
return "Close";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
|
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
|
||||||
|
|
||||||
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
||||||
_initToolbar = BootstrapTable.prototype.initToolbar,
|
_initToolbar = BootstrapTable.prototype.initToolbar,
|
||||||
_load = BootstrapTable.prototype.load,
|
_load = BootstrapTable.prototype.load,
|
||||||
_initSearch = BootstrapTable.prototype.initSearch;
|
_initSearch = BootstrapTable.prototype.initSearch;
|
||||||
|
|
||||||
BootstrapTable.prototype.initToolbar = function() {
|
BootstrapTable.prototype.initToolbar = function() {
|
||||||
_initToolbar.apply(this, Array.prototype.slice.apply(arguments));
|
_initToolbar.apply(this, Array.prototype.slice.apply(arguments));
|
||||||
|
|
||||||
if (!this.options.search) {
|
if (!this.options.search) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.options.advancedSearch) {
|
if (!this.options.advancedSearch) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.options.idTable) {
|
if (!this.options.idTable) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var that = this,
|
var that = this,
|
||||||
html = [];
|
html = [];
|
||||||
|
|
||||||
html.push(sprintf('<div class="columns columns-%s btn-group pull-%s" role="group">', this.options.buttonsAlign, this.options.buttonsAlign));
|
html.push(sprintf('<div class="columns columns-%s btn-group pull-%s" role="group">', this.options.buttonsAlign, this.options.buttonsAlign));
|
||||||
html.push(sprintf('<button class="btn btn-default%s' + '" type="button" name="advancedSearch" title="%s">', that.options.iconSize === undefined ? '' : ' btn-' + that.options.iconSize, that.options.formatAdvancedSearch()));
|
html.push(sprintf('<button class="btn btn-default%s' + '" type="button" name="advancedSearch" title="%s">', that.options.iconSize === undefined ? '' : ' btn-' + that.options.iconSize, that.options.formatAdvancedSearch()));
|
||||||
html.push(sprintf('<i class="%s %s"></i>', that.options.iconsPrefix, that.options.icons.advancedSearchIcon))
|
html.push(sprintf('<i class="%s %s"></i>', that.options.iconsPrefix, that.options.icons.advancedSearchIcon))
|
||||||
html.push('</button></div>');
|
html.push('</button></div>');
|
||||||
|
|
||||||
that.$toolbar.prepend(html.join(''));
|
that.$toolbar.prepend(html.join(''));
|
||||||
|
|
||||||
that.$toolbar.find('button[name="advancedSearch"]')
|
that.$toolbar.find('button[name="advancedSearch"]')
|
||||||
.off('click').on('click', function() {
|
.off('click').on('click', function() {
|
||||||
showAvdSearch(that.columns, that.options.formatAdvancedSearch(), that.options.formatAdvancedCloseButton(), that);
|
showAvdSearch(that.columns, that.options.formatAdvancedSearch(), that.options.formatAdvancedCloseButton(), that);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
BootstrapTable.prototype.load = function(data) {
|
BootstrapTable.prototype.load = function(data) {
|
||||||
_load.apply(this, Array.prototype.slice.apply(arguments));
|
_load.apply(this, Array.prototype.slice.apply(arguments));
|
||||||
|
|
||||||
if (!this.options.advancedSearch) {
|
if (!this.options.advancedSearch) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof this.options.idTable === 'undefined') {
|
if (typeof this.options.idTable === 'undefined') {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if (!firstLoad) {
|
if (!firstLoad) {
|
||||||
var height = parseInt($(".bootstrap-table").height());
|
var height = parseInt($(".bootstrap-table").height());
|
||||||
height += 10;
|
height += 10;
|
||||||
$("#" + this.options.idTable).bootstrapTable("resetView", {height: height});
|
$("#" + this.options.idTable).bootstrapTable("resetView", {height: height});
|
||||||
firstLoad = true;
|
firstLoad = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
BootstrapTable.prototype.initSearch = function () {
|
BootstrapTable.prototype.initSearch = function () {
|
||||||
_initSearch.apply(this, Array.prototype.slice.apply(arguments));
|
_initSearch.apply(this, Array.prototype.slice.apply(arguments));
|
||||||
|
|
||||||
if (!this.options.advancedSearch) {
|
if (!this.options.advancedSearch) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var that = this;
|
var that = this;
|
||||||
var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;
|
var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;
|
||||||
|
|
||||||
this.data = fp ? $.grep(this.data, function (item, i) {
|
this.data = fp ? $.grep(this.data, function (item, i) {
|
||||||
for (var key in fp) {
|
for (var key in fp) {
|
||||||
var fval = fp[key].toLowerCase();
|
var fval = fp[key].toLowerCase();
|
||||||
var value = item[key];
|
var value = item[key];
|
||||||
value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header,
|
value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header,
|
||||||
that.header.formatters[$.inArray(key, that.header.fields)],
|
that.header.formatters[$.inArray(key, that.header.fields)],
|
||||||
[value, item, i], value);
|
[value, item, i], value);
|
||||||
|
|
||||||
if (!($.inArray(key, that.header.fields) !== -1 &&
|
if (!($.inArray(key, that.header.fields) !== -1 &&
|
||||||
(typeof value === 'string' || typeof value === 'number') &&
|
(typeof value === 'string' || typeof value === 'number') &&
|
||||||
(value + '').toLowerCase().indexOf(fval) !== -1)) {
|
(value + '').toLowerCase().indexOf(fval) !== -1)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}) : this.data;
|
}) : this.data;
|
||||||
};
|
};
|
||||||
|
|
||||||
BootstrapTable.prototype.onColumnAdvancedSearch = function (event) {
|
BootstrapTable.prototype.onColumnAdvancedSearch = function (event) {
|
||||||
var text = $.trim($(event.currentTarget).val());
|
var text = $.trim($(event.currentTarget).val());
|
||||||
var $field = $(event.currentTarget)[0].id;
|
var $field = $(event.currentTarget)[0].id;
|
||||||
|
|
||||||
if ($.isEmptyObject(this.filterColumnsPartial)) {
|
if ($.isEmptyObject(this.filterColumnsPartial)) {
|
||||||
this.filterColumnsPartial = {};
|
this.filterColumnsPartial = {};
|
||||||
}
|
}
|
||||||
if (text) {
|
if (text) {
|
||||||
this.filterColumnsPartial[$field] = text;
|
this.filterColumnsPartial[$field] = text;
|
||||||
} else {
|
} else {
|
||||||
delete this.filterColumnsPartial[$field];
|
delete this.filterColumnsPartial[$field];
|
||||||
}
|
}
|
||||||
|
|
||||||
this.options.pageNumber = 1;
|
this.options.pageNumber = 1;
|
||||||
this.onSearch(event);
|
this.onSearch(event);
|
||||||
this.updatePagination();
|
this.updatePagination();
|
||||||
this.trigger('column-advanced-search', $field, text);
|
this.trigger('column-advanced-search', $field, text);
|
||||||
};
|
};
|
||||||
}(jQuery);
|
}(jQuery);
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* bootstrap-table - v1.11.0 - 2016-07-02
|
* bootstrap-table - v1.11.0 - 2016-07-02
|
||||||
* https://github.com/wenzhixin/bootstrap-table
|
* https://github.com/wenzhixin/bootstrap-table
|
||||||
* Copyright (c) 2016 zhixin wen
|
* Copyright (c) 2016 zhixin wen
|
||||||
* Licensed MIT License
|
* Licensed MIT License
|
||||||
*/
|
*/
|
||||||
!function(a){"use strict";var b=!1,c=a.fn.bootstrapTable.utils.sprintf,d=function(b,d,f,g){if(a("#avdSearchModal_"+g.options.idTable).hasClass("modal"))a("#avdSearchModal_"+g.options.idTable).modal();else{var h=c('<div id="avdSearchModal%s" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">',"_"+g.options.idTable);h+='<div class="modal-dialog modal-xs">',h+=' <div class="modal-content">',h+=' <div class="modal-header">',h+=' <button type="button" class="close" data-dismiss="modal" aria-hidden="true" >×</button>',h+=c(' <h4 class="modal-title">%s</h4>',d),h+=" </div>",h+=' <div class="modal-body modal-body-custom">',h+=c(' <div class="container-fluid" id="avdSearchModalContent%s" style="padding-right: 0px;padding-left: 0px;" >',"_"+g.options.idTable),h+=" </div>",h+=" </div>",h+=" </div>",h+=" </div>",h+="</div>",a("body").append(a(h));var i=e(b,f,g),j=0;a("#avdSearchModalContent_"+g.options.idTable).append(i.join("")),a("#"+g.options.idForm).off("keyup blur","input").on("keyup blur","input",function(a){clearTimeout(j),j=setTimeout(function(){g.onColumnAdvancedSearch(a)},g.options.searchTimeOut)}),a("#btnCloseAvd_"+g.options.idTable).click(function(){a("#avdSearchModal_"+g.options.idTable).modal("hide")}),a("#avdSearchModal_"+g.options.idTable).modal()}},e=function(a,b,d){var e=[];e.push(c('<form class="form-horizontal" id="%s" action="%s" >',d.options.idForm,d.options.actionForm));for(var f in a){var g=a[f];!g.checkbox&&g.visible&&g.searchable&&(e.push('<div class="form-group">'),e.push(c('<label class="col-sm-4 control-label">%s</label>',g.title)),e.push('<div class="col-sm-6">'),e.push(c('<input type="text" class="form-control input-md" name="%s" placeholder="%s" id="%s">',g.field,g.title,g.field)),e.push("</div>"),e.push("</div>"))}return e.push('<div class="form-group">'),e.push('<div class="col-sm-offset-9 col-sm-3">'),e.push(c('<button type="button" id="btnCloseAvd%s" class="btn btn-default" >%s</button>',"_"+d.options.idTable,b)),e.push("</div>"),e.push("</div>"),e.push("</form>"),e};a.extend(a.fn.bootstrapTable.defaults,{advancedSearch:!1,idForm:"advancedSearch",actionForm:"",idTable:void 0,onColumnAdvancedSearch:function(){return!1}}),a.extend(a.fn.bootstrapTable.defaults.icons,{advancedSearchIcon:"glyphicon-chevron-down"}),a.extend(a.fn.bootstrapTable.Constructor.EVENTS,{"column-advanced-search.bs.table":"onColumnAdvancedSearch"}),a.extend(a.fn.bootstrapTable.locales,{formatAdvancedSearch:function(){return"Advanced search"},formatAdvancedCloseButton:function(){return"Close"}}),a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales);var f=a.fn.bootstrapTable.Constructor,g=f.prototype.initToolbar,h=f.prototype.load,i=f.prototype.initSearch;f.prototype.initToolbar=function(){if(g.apply(this,Array.prototype.slice.apply(arguments)),this.options.search&&this.options.advancedSearch&&this.options.idTable){var a=this,b=[];b.push(c('<div class="columns columns-%s btn-group pull-%s" role="group">',this.options.buttonsAlign,this.options.buttonsAlign)),b.push(c('<button class="btn btn-default%s" type="button" name="advancedSearch" title="%s">',void 0===a.options.iconSize?"":" btn-"+a.options.iconSize,a.options.formatAdvancedSearch())),b.push(c('<i class="%s %s"></i>',a.options.iconsPrefix,a.options.icons.advancedSearchIcon)),b.push("</button></div>"),a.$toolbar.prepend(b.join("")),a.$toolbar.find('button[name="advancedSearch"]').off("click").on("click",function(){d(a.columns,a.options.formatAdvancedSearch(),a.options.formatAdvancedCloseButton(),a)})}},f.prototype.load=function(){if(h.apply(this,Array.prototype.slice.apply(arguments)),this.options.advancedSearch&&"undefined"!=typeof this.options.idTable&&!b){var c=parseInt(a(".bootstrap-table").height());c+=10,a("#"+this.options.idTable).bootstrapTable("resetView",{height:c}),b=!0}},f.prototype.initSearch=function(){if(i.apply(this,Array.prototype.slice.apply(arguments)),this.options.advancedSearch){var b=this,c=a.isEmptyObject(this.filterColumnsPartial)?null:this.filterColumnsPartial;this.data=c?a.grep(this.data,function(d,e){for(var f in c){var g=c[f].toLowerCase(),h=d[f];if(h=a.fn.bootstrapTable.utils.calculateObjectValue(b.header,b.header.formatters[a.inArray(f,b.header.fields)],[h,d,e],h),-1===a.inArray(f,b.header.fields)||"string"!=typeof h&&"number"!=typeof h||-1===(h+"").toLowerCase().indexOf(g))return!1}return!0}):this.data}},f.prototype.onColumnAdvancedSearch=function(b){var c=a.trim(a(b.currentTarget).val()),d=a(b.currentTarget)[0].id;a.isEmptyObject(this.filterColumnsPartial)&&(this.filterColumnsPartial={}),c?this.filterColumnsPartial[d]=c:delete this.filterColumnsPartial[d],this.options.pageNumber=1,this.onSearch(b),this.updatePagination(),this.trigger("column-advanced-search",d,c)}}(jQuery);
|
!function(a){"use strict";var b=!1,c=a.fn.bootstrapTable.utils.sprintf,d=function(b,d,f,g){if(a("#avdSearchModal_"+g.options.idTable).hasClass("modal"))a("#avdSearchModal_"+g.options.idTable).modal();else{var h=c('<div id="avdSearchModal%s" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">',"_"+g.options.idTable);h+='<div class="modal-dialog modal-xs">',h+=' <div class="modal-content">',h+=' <div class="modal-header">',h+=' <button type="button" class="close" data-dismiss="modal" aria-hidden="true" >×</button>',h+=c(' <h4 class="modal-title">%s</h4>',d),h+=" </div>",h+=' <div class="modal-body modal-body-custom">',h+=c(' <div class="container-fluid" id="avdSearchModalContent%s" style="padding-right: 0px;padding-left: 0px;" >',"_"+g.options.idTable),h+=" </div>",h+=" </div>",h+=" </div>",h+=" </div>",h+="</div>",a("body").append(a(h));var i=e(b,f,g),j=0;a("#avdSearchModalContent_"+g.options.idTable).append(i.join("")),a("#"+g.options.idForm).off("keyup blur","input").on("keyup blur","input",function(a){clearTimeout(j),j=setTimeout(function(){g.onColumnAdvancedSearch(a)},g.options.searchTimeOut)}),a("#btnCloseAvd_"+g.options.idTable).click(function(){a("#avdSearchModal_"+g.options.idTable).modal("hide")}),a("#avdSearchModal_"+g.options.idTable).modal()}},e=function(a,b,d){var e=[];e.push(c('<form class="form-horizontal" id="%s" action="%s" >',d.options.idForm,d.options.actionForm));for(var f in a){var g=a[f];!g.checkbox&&g.visible&&g.searchable&&(e.push('<div class="form-group">'),e.push(c('<label class="col-sm-4 control-label">%s</label>',g.title)),e.push('<div class="col-sm-6">'),e.push(c('<input type="text" class="form-control input-md" name="%s" placeholder="%s" id="%s">',g.field,g.title,g.field)),e.push("</div>"),e.push("</div>"))}return e.push('<div class="form-group">'),e.push('<div class="col-sm-offset-9 col-sm-3">'),e.push(c('<button type="button" id="btnCloseAvd%s" class="btn btn-default" >%s</button>',"_"+d.options.idTable,b)),e.push("</div>"),e.push("</div>"),e.push("</form>"),e};a.extend(a.fn.bootstrapTable.defaults,{advancedSearch:!1,idForm:"advancedSearch",actionForm:"",idTable:void 0,onColumnAdvancedSearch:function(){return!1}}),a.extend(a.fn.bootstrapTable.defaults.icons,{advancedSearchIcon:"glyphicon-chevron-down"}),a.extend(a.fn.bootstrapTable.Constructor.EVENTS,{"column-advanced-search.bs.table":"onColumnAdvancedSearch"}),a.extend(a.fn.bootstrapTable.locales,{formatAdvancedSearch:function(){return"Advanced search"},formatAdvancedCloseButton:function(){return"Close"}}),a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales);var f=a.fn.bootstrapTable.Constructor,g=f.prototype.initToolbar,h=f.prototype.load,i=f.prototype.initSearch;f.prototype.initToolbar=function(){if(g.apply(this,Array.prototype.slice.apply(arguments)),this.options.search&&this.options.advancedSearch&&this.options.idTable){var a=this,b=[];b.push(c('<div class="columns columns-%s btn-group pull-%s" role="group">',this.options.buttonsAlign,this.options.buttonsAlign)),b.push(c('<button class="btn btn-default%s" type="button" name="advancedSearch" title="%s">',void 0===a.options.iconSize?"":" btn-"+a.options.iconSize,a.options.formatAdvancedSearch())),b.push(c('<i class="%s %s"></i>',a.options.iconsPrefix,a.options.icons.advancedSearchIcon)),b.push("</button></div>"),a.$toolbar.prepend(b.join("")),a.$toolbar.find('button[name="advancedSearch"]').off("click").on("click",function(){d(a.columns,a.options.formatAdvancedSearch(),a.options.formatAdvancedCloseButton(),a)})}},f.prototype.load=function(){if(h.apply(this,Array.prototype.slice.apply(arguments)),this.options.advancedSearch&&"undefined"!=typeof this.options.idTable&&!b){var c=parseInt(a(".bootstrap-table").height());c+=10,a("#"+this.options.idTable).bootstrapTable("resetView",{height:c}),b=!0}},f.prototype.initSearch=function(){if(i.apply(this,Array.prototype.slice.apply(arguments)),this.options.advancedSearch){var b=this,c=a.isEmptyObject(this.filterColumnsPartial)?null:this.filterColumnsPartial;this.data=c?a.grep(this.data,function(d,e){for(var f in c){var g=c[f].toLowerCase(),h=d[f];if(h=a.fn.bootstrapTable.utils.calculateObjectValue(b.header,b.header.formatters[a.inArray(f,b.header.fields)],[h,d,e],h),-1===a.inArray(f,b.header.fields)||"string"!=typeof h&&"number"!=typeof h||-1===(h+"").toLowerCase().indexOf(g))return!1}return!0}):this.data}},f.prototype.onColumnAdvancedSearch=function(b){var c=a.trim(a(b.currentTarget).val()),d=a(b.currentTarget)[0].id;a.isEmptyObject(this.filterColumnsPartial)&&(this.filterColumnsPartial={}),c?this.filterColumnsPartial[d]=c:delete this.filterColumnsPartial[d],this.options.pageNumber=1,this.onSearch(b),this.updatePagination(),this.trigger("column-advanced-search",d,c)}}(jQuery);
|
||||||
|
|
@ -1,42 +1,42 @@
|
||||||
(function ($) {
|
(function ($) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
$.fn.bootstrapTable.locales['zh-CN'] = {
|
$.fn.bootstrapTable.locales['zh-CN'] = {
|
||||||
formatLoadingMessage: function () {
|
formatLoadingMessage: function () {
|
||||||
return '正在努力地加载数据中,请稍候……';
|
return '正在努力地加载数据中,请稍候……';
|
||||||
},
|
},
|
||||||
formatRecordsPerPage: function (pageNumber) {
|
formatRecordsPerPage: function (pageNumber) {
|
||||||
return pageNumber + ' 条记录每页';
|
return pageNumber + ' 条记录每页';
|
||||||
},
|
},
|
||||||
formatShowingRows: function (pageFrom, pageTo, totalRows) {
|
formatShowingRows: function (pageFrom, pageTo, totalRows) {
|
||||||
return '第 ' + pageFrom + ' 到 ' + pageTo + ' 条,共 ' + totalRows + ' 条记录。';
|
return '第 ' + pageFrom + ' 到 ' + pageTo + ' 条,共 ' + totalRows + ' 条记录。';
|
||||||
},
|
},
|
||||||
formatSearch: function () {
|
formatSearch: function () {
|
||||||
return '搜索';
|
return '搜索';
|
||||||
},
|
},
|
||||||
formatNoMatches: function () {
|
formatNoMatches: function () {
|
||||||
return '没有找到匹配的记录';
|
return '没有找到匹配的记录';
|
||||||
},
|
},
|
||||||
formatPaginationSwitch: function () {
|
formatPaginationSwitch: function () {
|
||||||
return '隐藏/显示分页';
|
return '隐藏/显示分页';
|
||||||
},
|
},
|
||||||
formatRefresh: function () {
|
formatRefresh: function () {
|
||||||
return '刷新';
|
return '刷新';
|
||||||
},
|
},
|
||||||
formatToggle: function () {
|
formatToggle: function () {
|
||||||
return '切换';
|
return '切换';
|
||||||
},
|
},
|
||||||
formatColumns: function () {
|
formatColumns: function () {
|
||||||
return '列';
|
return '列';
|
||||||
},
|
},
|
||||||
formatExport: function () {
|
formatExport: function () {
|
||||||
return '导出数据';
|
return '导出数据';
|
||||||
},
|
},
|
||||||
formatClearFilters: function () {
|
formatClearFilters: function () {
|
||||||
return '清空过滤';
|
return '清空过滤';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']);
|
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']);
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|
@ -1,127 +1,127 @@
|
||||||
@charset "utf-8";
|
@charset "utf-8";
|
||||||
.container {
|
.container {
|
||||||
margin: 10px auto 0 auto;
|
margin: 10px auto 0 auto;
|
||||||
position: relative;
|
position: relative;
|
||||||
font-family: 微软雅黑;
|
font-family: 微软雅黑;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
.container p {
|
.container p {
|
||||||
line-height: 12px;
|
line-height: 12px;
|
||||||
line-height: 0px;
|
line-height: 0px;
|
||||||
height: 0px;
|
height: 0px;
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
color: #bbb
|
color: #bbb
|
||||||
}
|
}
|
||||||
.action {
|
.action {
|
||||||
width: 400px;
|
width: 400px;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
margin: 10px 0;
|
margin: 10px 0;
|
||||||
}
|
}
|
||||||
.cropped {
|
.cropped {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 500px;
|
left: 500px;
|
||||||
top: 0;
|
top: 0;
|
||||||
width: 200px;
|
width: 200px;
|
||||||
border: 1px #ddd solid;
|
border: 1px #ddd solid;
|
||||||
height: 440px;
|
height: 440px;
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
box-shadow: 0px 0px 12px #ddd;
|
box-shadow: 0px 0px 12px #ddd;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
.imageBox {
|
.imageBox {
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 400px;
|
height: 400px;
|
||||||
width: 400px;
|
width: 400px;
|
||||||
border: 1px solid #aaa;
|
border: 1px solid #aaa;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
cursor: move;
|
cursor: move;
|
||||||
box-shadow: 4px 4px 12px #B0B0B0;
|
box-shadow: 4px 4px 12px #B0B0B0;
|
||||||
}
|
}
|
||||||
.imageBox .thumbBox {
|
.imageBox .thumbBox {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
width: 200px;
|
width: 200px;
|
||||||
height: 200px;
|
height: 200px;
|
||||||
margin-top: -100px;
|
margin-top: -100px;
|
||||||
margin-left: -100px;
|
margin-left: -100px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border: 1px solid rgb(102, 102, 102);
|
border: 1px solid rgb(102, 102, 102);
|
||||||
box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.5);
|
box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.5);
|
||||||
background: none repeat scroll 0% 0% transparent;
|
background: none repeat scroll 0% 0% transparent;
|
||||||
}
|
}
|
||||||
.imageBox .spinner {
|
.imageBox .spinner {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 400px;
|
line-height: 400px;
|
||||||
background: rgba(0,0,0,0.7);
|
background: rgba(0,0,0,0.7);
|
||||||
}
|
}
|
||||||
.Btnsty_peyton{ float: right;
|
.Btnsty_peyton{ float: right;
|
||||||
width: 46px;
|
width: 46px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
height: 37px;
|
height: 37px;
|
||||||
line-height: 37px;
|
line-height: 37px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
margin:0px 2px;
|
margin:0px 2px;
|
||||||
background-color: #f38e81;
|
background-color: #f38e81;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
box-shadow: 0px 0px 5px #B0B0B0;
|
box-shadow: 0px 0px 5px #B0B0B0;
|
||||||
border: 0px #fff solid;}
|
border: 0px #fff solid;}
|
||||||
/*选择文件上传*/
|
/*选择文件上传*/
|
||||||
.new-contentarea {
|
.new-contentarea {
|
||||||
width: 165px;
|
width: 165px;
|
||||||
overflow:hidden;
|
overflow:hidden;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
position:relative;float:left;
|
position:relative;float:left;
|
||||||
}
|
}
|
||||||
.new-contentarea label {
|
.new-contentarea label {
|
||||||
width:100%;
|
width:100%;
|
||||||
height:100%;
|
height:100%;
|
||||||
display:block;
|
display:block;
|
||||||
}
|
}
|
||||||
.new-contentarea input[type=file] {
|
.new-contentarea input[type=file] {
|
||||||
width:188px;
|
width:188px;
|
||||||
height:60px;
|
height:60px;
|
||||||
background:#333;
|
background:#333;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
position:absolute;
|
position:absolute;
|
||||||
right:50%;
|
right:50%;
|
||||||
margin-right:-94px;
|
margin-right:-94px;
|
||||||
top:0;
|
top:0;
|
||||||
right/*\**/:0px\9;
|
right/*\**/:0px\9;
|
||||||
margin-right/*\**/:0px\9;
|
margin-right/*\**/:0px\9;
|
||||||
width/*\**/:10px\9;
|
width/*\**/:10px\9;
|
||||||
opacity:0;
|
opacity:0;
|
||||||
filter:alpha(opacity=0);
|
filter:alpha(opacity=0);
|
||||||
z-index:2;
|
z-index:2;
|
||||||
}
|
}
|
||||||
a.upload-img{
|
a.upload-img{
|
||||||
width:165px;
|
width:165px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
height:37px;
|
height:37px;
|
||||||
line-height: 37px;
|
line-height: 37px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
background-color: #f38e81;
|
background-color: #f38e81;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
cursor:pointer;
|
cursor:pointer;
|
||||||
border: 0px #fff solid;
|
border: 0px #fff solid;
|
||||||
box-shadow: 0px 0px 5px #B0B0B0;
|
box-shadow: 0px 0px 5px #B0B0B0;
|
||||||
}
|
}
|
||||||
a.upload-img:hover{
|
a.upload-img:hover{
|
||||||
background-color: #ec7e70;
|
background-color: #ec7e70;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tc{text-align:center;}
|
.tc{text-align:center;}
|
||||||
|
|
@ -1,136 +1,136 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
(function (factory) {
|
(function (factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
define(['jquery'], factory);
|
define(['jquery'], factory);
|
||||||
} else {
|
} else {
|
||||||
factory(jQuery);
|
factory(jQuery);
|
||||||
}
|
}
|
||||||
}(function ($) {
|
}(function ($) {
|
||||||
var cropbox = function(options, el){
|
var cropbox = function(options, el){
|
||||||
var el = el || $(options.imageBox),
|
var el = el || $(options.imageBox),
|
||||||
obj =
|
obj =
|
||||||
{
|
{
|
||||||
state : {},
|
state : {},
|
||||||
ratio : 1,
|
ratio : 1,
|
||||||
options : options,
|
options : options,
|
||||||
imageBox : el,
|
imageBox : el,
|
||||||
thumbBox : el.find(options.thumbBox),
|
thumbBox : el.find(options.thumbBox),
|
||||||
spinner : el.find(options.spinner),
|
spinner : el.find(options.spinner),
|
||||||
image : new Image(),
|
image : new Image(),
|
||||||
getDataURL: function ()
|
getDataURL: function ()
|
||||||
{
|
{
|
||||||
var width = this.thumbBox.width(),
|
var width = this.thumbBox.width(),
|
||||||
height = this.thumbBox.height(),
|
height = this.thumbBox.height(),
|
||||||
canvas = document.createElement("canvas"),
|
canvas = document.createElement("canvas"),
|
||||||
dim = el.css('background-position').split(' '),
|
dim = el.css('background-position').split(' '),
|
||||||
size = el.css('background-size').split(' '),
|
size = el.css('background-size').split(' '),
|
||||||
dx = parseInt(dim[0]) - el.width()/2 + width/2,
|
dx = parseInt(dim[0]) - el.width()/2 + width/2,
|
||||||
dy = parseInt(dim[1]) - el.height()/2 + height/2,
|
dy = parseInt(dim[1]) - el.height()/2 + height/2,
|
||||||
dw = parseInt(size[0]),
|
dw = parseInt(size[0]),
|
||||||
dh = parseInt(size[1]),
|
dh = parseInt(size[1]),
|
||||||
sh = parseInt(this.image.height),
|
sh = parseInt(this.image.height),
|
||||||
sw = parseInt(this.image.width);
|
sw = parseInt(this.image.width);
|
||||||
|
|
||||||
canvas.width = width;
|
canvas.width = width;
|
||||||
canvas.height = height;
|
canvas.height = height;
|
||||||
var context = canvas.getContext("2d");
|
var context = canvas.getContext("2d");
|
||||||
context.drawImage(this.image, 0, 0, sw, sh, dx, dy, dw, dh);
|
context.drawImage(this.image, 0, 0, sw, sh, dx, dy, dw, dh);
|
||||||
var imageData = canvas.toDataURL('image/png');
|
var imageData = canvas.toDataURL('image/png');
|
||||||
return imageData;
|
return imageData;
|
||||||
},
|
},
|
||||||
getBlob: function()
|
getBlob: function()
|
||||||
{
|
{
|
||||||
var imageData = this.getDataURL();
|
var imageData = this.getDataURL();
|
||||||
var b64 = imageData.replace('data:image/png;base64,','');
|
var b64 = imageData.replace('data:image/png;base64,','');
|
||||||
var binary = atob(b64);
|
var binary = atob(b64);
|
||||||
var array = [];
|
var array = [];
|
||||||
for (var i = 0; i < binary.length; i++) {
|
for (var i = 0; i < binary.length; i++) {
|
||||||
array.push(binary.charCodeAt(i));
|
array.push(binary.charCodeAt(i));
|
||||||
}
|
}
|
||||||
return new Blob([new Uint8Array(array)], {type: 'image/png'});
|
return new Blob([new Uint8Array(array)], {type: 'image/png'});
|
||||||
},
|
},
|
||||||
zoomIn: function ()
|
zoomIn: function ()
|
||||||
{
|
{
|
||||||
this.ratio*=1.1;
|
this.ratio*=1.1;
|
||||||
setBackground();
|
setBackground();
|
||||||
},
|
},
|
||||||
zoomOut: function ()
|
zoomOut: function ()
|
||||||
{
|
{
|
||||||
this.ratio*=0.9;
|
this.ratio*=0.9;
|
||||||
setBackground();
|
setBackground();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setBackground = function()
|
setBackground = function()
|
||||||
{
|
{
|
||||||
var w = parseInt(obj.image.width)*obj.ratio;
|
var w = parseInt(obj.image.width)*obj.ratio;
|
||||||
var h = parseInt(obj.image.height)*obj.ratio;
|
var h = parseInt(obj.image.height)*obj.ratio;
|
||||||
|
|
||||||
var pw = (el.width() - w) / 2;
|
var pw = (el.width() - w) / 2;
|
||||||
var ph = (el.height() - h) / 2;
|
var ph = (el.height() - h) / 2;
|
||||||
|
|
||||||
el.css({
|
el.css({
|
||||||
'background-image': 'url(' + obj.image.src + ')',
|
'background-image': 'url(' + obj.image.src + ')',
|
||||||
'background-size': w +'px ' + h + 'px',
|
'background-size': w +'px ' + h + 'px',
|
||||||
'background-position': pw + 'px ' + ph + 'px',
|
'background-position': pw + 'px ' + ph + 'px',
|
||||||
'background-repeat': 'no-repeat'});
|
'background-repeat': 'no-repeat'});
|
||||||
},
|
},
|
||||||
imgMouseDown = function(e)
|
imgMouseDown = function(e)
|
||||||
{
|
{
|
||||||
e.stopImmediatePropagation();
|
e.stopImmediatePropagation();
|
||||||
|
|
||||||
obj.state.dragable = true;
|
obj.state.dragable = true;
|
||||||
obj.state.mouseX = e.clientX;
|
obj.state.mouseX = e.clientX;
|
||||||
obj.state.mouseY = e.clientY;
|
obj.state.mouseY = e.clientY;
|
||||||
},
|
},
|
||||||
imgMouseMove = function(e)
|
imgMouseMove = function(e)
|
||||||
{
|
{
|
||||||
e.stopImmediatePropagation();
|
e.stopImmediatePropagation();
|
||||||
|
|
||||||
if (obj.state.dragable)
|
if (obj.state.dragable)
|
||||||
{
|
{
|
||||||
var x = e.clientX - obj.state.mouseX;
|
var x = e.clientX - obj.state.mouseX;
|
||||||
var y = e.clientY - obj.state.mouseY;
|
var y = e.clientY - obj.state.mouseY;
|
||||||
|
|
||||||
var bg = el.css('background-position').split(' ');
|
var bg = el.css('background-position').split(' ');
|
||||||
|
|
||||||
var bgX = x + parseInt(bg[0]);
|
var bgX = x + parseInt(bg[0]);
|
||||||
var bgY = y + parseInt(bg[1]);
|
var bgY = y + parseInt(bg[1]);
|
||||||
|
|
||||||
el.css('background-position', bgX +'px ' + bgY + 'px');
|
el.css('background-position', bgX +'px ' + bgY + 'px');
|
||||||
|
|
||||||
obj.state.mouseX = e.clientX;
|
obj.state.mouseX = e.clientX;
|
||||||
obj.state.mouseY = e.clientY;
|
obj.state.mouseY = e.clientY;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
imgMouseUp = function(e)
|
imgMouseUp = function(e)
|
||||||
{
|
{
|
||||||
e.stopImmediatePropagation();
|
e.stopImmediatePropagation();
|
||||||
obj.state.dragable = false;
|
obj.state.dragable = false;
|
||||||
},
|
},
|
||||||
zoomImage = function(e)
|
zoomImage = function(e)
|
||||||
{
|
{
|
||||||
e.originalEvent.wheelDelta > 0 || e.originalEvent.detail < 0 ? obj.ratio*=1.1 : obj.ratio*=0.9;
|
e.originalEvent.wheelDelta > 0 || e.originalEvent.detail < 0 ? obj.ratio*=1.1 : obj.ratio*=0.9;
|
||||||
setBackground();
|
setBackground();
|
||||||
}
|
}
|
||||||
|
|
||||||
obj.spinner.show();
|
obj.spinner.show();
|
||||||
obj.image.onload = function() {
|
obj.image.onload = function() {
|
||||||
obj.spinner.hide();
|
obj.spinner.hide();
|
||||||
setBackground();
|
setBackground();
|
||||||
|
|
||||||
el.bind('mousedown', imgMouseDown);
|
el.bind('mousedown', imgMouseDown);
|
||||||
el.bind('mousemove', imgMouseMove);
|
el.bind('mousemove', imgMouseMove);
|
||||||
$(window).bind('mouseup', imgMouseUp);
|
$(window).bind('mouseup', imgMouseUp);
|
||||||
el.bind('mousewheel DOMMouseScroll', zoomImage);
|
el.bind('mousewheel DOMMouseScroll', zoomImage);
|
||||||
};
|
};
|
||||||
obj.image.crossOrigin = 'Anonymous';
|
obj.image.crossOrigin = 'Anonymous';
|
||||||
obj.image.src = options.imgSrc;
|
obj.image.src = options.imgSrc;
|
||||||
el.on('remove', function(){$(window).unbind('mouseup', imgMouseUp)});
|
el.on('remove', function(){$(window).unbind('mouseup', imgMouseUp)});
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
};
|
};
|
||||||
|
|
||||||
jQuery.fn.cropbox = function(options){
|
jQuery.fn.cropbox = function(options){
|
||||||
return new cropbox(options, this);
|
return new cropbox(options, this);
|
||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
|
|
@ -1,86 +1,86 @@
|
||||||
/*
|
/*
|
||||||
* Bootstrap Duallistbox - v3.0.7
|
* Bootstrap Duallistbox - v3.0.7
|
||||||
* A responsive dual listbox widget optimized for Twitter Bootstrap. It works on all modern browsers and on touch devices.
|
* A responsive dual listbox widget optimized for Twitter Bootstrap. It works on all modern browsers and on touch devices.
|
||||||
* https://www.virtuosoft.eu/code/bootstrap-duallistbox/
|
* https://www.virtuosoft.eu/code/bootstrap-duallistbox/
|
||||||
*
|
*
|
||||||
* Made by István Ujj-Mészáros
|
* Made by István Ujj-Mészáros
|
||||||
* Under Apache License v2.0 License
|
* Under Apache License v2.0 License
|
||||||
*/
|
*/
|
||||||
.bootstrap-duallistbox-container .buttons {
|
.bootstrap-duallistbox-container .buttons {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-bottom: -1px;
|
margin-bottom: -1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bootstrap-duallistbox-container label {
|
.bootstrap-duallistbox-container label {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bootstrap-duallistbox-container .info {
|
.bootstrap-duallistbox-container .info {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bootstrap-duallistbox-container .clear1,
|
.bootstrap-duallistbox-container .clear1,
|
||||||
.bootstrap-duallistbox-container .clear2 {
|
.bootstrap-duallistbox-container .clear2 {
|
||||||
display: none;
|
display: none;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bootstrap-duallistbox-container .box1.filtered .clear1,
|
.bootstrap-duallistbox-container .box1.filtered .clear1,
|
||||||
.bootstrap-duallistbox-container .box2.filtered .clear2 {
|
.bootstrap-duallistbox-container .box2.filtered .clear2 {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bootstrap-duallistbox-container .move,
|
.bootstrap-duallistbox-container .move,
|
||||||
.bootstrap-duallistbox-container .remove {
|
.bootstrap-duallistbox-container .remove {
|
||||||
width: 60%;
|
width: 60%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bootstrap-duallistbox-container .btn-group .btn {
|
.bootstrap-duallistbox-container .btn-group .btn {
|
||||||
border-bottom-left-radius: 0;
|
border-bottom-left-radius: 0;
|
||||||
border-bottom-right-radius: 0;
|
border-bottom-right-radius: 0;
|
||||||
}
|
}
|
||||||
.bootstrap-duallistbox-container select {
|
.bootstrap-duallistbox-container select {
|
||||||
border-top-left-radius: 0;
|
border-top-left-radius: 0;
|
||||||
border-top-right-radius: 0;
|
border-top-right-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bootstrap-duallistbox-container .moveall,
|
.bootstrap-duallistbox-container .moveall,
|
||||||
.bootstrap-duallistbox-container .removeall {
|
.bootstrap-duallistbox-container .removeall {
|
||||||
width: 40%;
|
width: 40%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bootstrap-duallistbox-container.bs2compatible .btn-group > .btn + .btn {
|
.bootstrap-duallistbox-container.bs2compatible .btn-group > .btn + .btn {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bootstrap-duallistbox-container select {
|
.bootstrap-duallistbox-container select {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 300px;
|
height: 300px;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bootstrap-duallistbox-container .filter {
|
.bootstrap-duallistbox-container .filter {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 31px;
|
height: 31px;
|
||||||
margin: 0 0 5px 0;
|
margin: 0 0 5px 0;
|
||||||
-webkit-box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
-moz-box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bootstrap-duallistbox-container .filter.placeholder {
|
.bootstrap-duallistbox-container .filter.placeholder {
|
||||||
color: #aaa;
|
color: #aaa;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bootstrap-duallistbox-container.moveonselect .move,
|
.bootstrap-duallistbox-container.moveonselect .move,
|
||||||
.bootstrap-duallistbox-container.moveonselect .remove {
|
.bootstrap-duallistbox-container.moveonselect .remove {
|
||||||
display:none;
|
display:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bootstrap-duallistbox-container.moveonselect .moveall,
|
.bootstrap-duallistbox-container.moveonselect .moveall,
|
||||||
.bootstrap-duallistbox-container.moveonselect .removeall {
|
.bootstrap-duallistbox-container.moveonselect .removeall {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
@ -1,182 +1,182 @@
|
||||||
/**
|
/**
|
||||||
* 基于jQuery FullScreen修改
|
* 基于jQuery FullScreen修改
|
||||||
* 新增支持IE全屏显示
|
* 新增支持IE全屏显示
|
||||||
* Copyright (c) 2019 ruoyi
|
* Copyright (c) 2019 ruoyi
|
||||||
*/
|
*/
|
||||||
(function(jQuery) {
|
(function(jQuery) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets or gets the fullscreen state.
|
* Sets or gets the fullscreen state.
|
||||||
*
|
*
|
||||||
* @param {boolean=} state
|
* @param {boolean=} state
|
||||||
* True to enable fullscreen mode, false to disable it. If not
|
* True to enable fullscreen mode, false to disable it. If not
|
||||||
* specified then the current fullscreen state is returned.
|
* specified then the current fullscreen state is returned.
|
||||||
* @return {boolean|Element|jQuery|null}
|
* @return {boolean|Element|jQuery|null}
|
||||||
* When querying the fullscreen state then the current fullscreen
|
* When querying the fullscreen state then the current fullscreen
|
||||||
* element (or true if browser doesn't support it) is returned
|
* element (or true if browser doesn't support it) is returned
|
||||||
* when browser is currently in full screen mode. False is returned
|
* when browser is currently in full screen mode. False is returned
|
||||||
* if browser is not in full screen mode. Null is returned if
|
* if browser is not in full screen mode. Null is returned if
|
||||||
* browser doesn't support fullscreen mode at all. When setting
|
* browser doesn't support fullscreen mode at all. When setting
|
||||||
* the fullscreen state then the current jQuery selection is
|
* the fullscreen state then the current jQuery selection is
|
||||||
* returned for chaining.
|
* returned for chaining.
|
||||||
* @this {jQuery}
|
* @this {jQuery}
|
||||||
*/
|
*/
|
||||||
function fullScreen(state)
|
function fullScreen(state)
|
||||||
{
|
{
|
||||||
var e, func, doc;
|
var e, func, doc;
|
||||||
|
|
||||||
// Do nothing when nothing was selected
|
// Do nothing when nothing was selected
|
||||||
if (!this.length) return this;
|
if (!this.length) return this;
|
||||||
|
|
||||||
// We only use the first selected element because it doesn't make sense
|
// We only use the first selected element because it doesn't make sense
|
||||||
// to fullscreen multiple elements.
|
// to fullscreen multiple elements.
|
||||||
e = (/** @type {Element} */ this[0]);
|
e = (/** @type {Element} */ this[0]);
|
||||||
|
|
||||||
// Find the real element and the document (Depends on whether the
|
// Find the real element and the document (Depends on whether the
|
||||||
// document itself or a HTML element was selected)
|
// document itself or a HTML element was selected)
|
||||||
if (e.ownerDocument)
|
if (e.ownerDocument)
|
||||||
{
|
{
|
||||||
doc = e.ownerDocument;
|
doc = e.ownerDocument;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
doc = e;
|
doc = e;
|
||||||
e = doc.documentElement;
|
e = doc.documentElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
// When no state was specified then return the current state.
|
// When no state was specified then return the current state.
|
||||||
if (state == null)
|
if (state == null)
|
||||||
{
|
{
|
||||||
// When fullscreen mode is not supported then return null
|
// When fullscreen mode is not supported then return null
|
||||||
if (!((/** @type {?Function} */ doc["exitFullscreen"])
|
if (!((/** @type {?Function} */ doc["exitFullscreen"])
|
||||||
|| (/** @type {?Function} */ doc["webkitExitFullscreen"])
|
|| (/** @type {?Function} */ doc["webkitExitFullscreen"])
|
||||||
|| (/** @type {?Function} */ doc["webkitCancelFullScreen"])
|
|| (/** @type {?Function} */ doc["webkitCancelFullScreen"])
|
||||||
|| (/** @type {?Function} */ doc["msExitFullscreen"])
|
|| (/** @type {?Function} */ doc["msExitFullscreen"])
|
||||||
|| (/** @type {?Function} */ doc["mozCancelFullScreen"])))
|
|| (/** @type {?Function} */ doc["mozCancelFullScreen"])))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check fullscreen state
|
// Check fullscreen state
|
||||||
state = !!doc["fullscreenElement"]
|
state = !!doc["fullscreenElement"]
|
||||||
|| !!doc["msFullscreenElement"]
|
|| !!doc["msFullscreenElement"]
|
||||||
|| !!doc["webkitIsFullScreen"]
|
|| !!doc["webkitIsFullScreen"]
|
||||||
|| !!doc["mozFullScreen"];
|
|| !!doc["mozFullScreen"];
|
||||||
if (!state) return state;
|
if (!state) return state;
|
||||||
|
|
||||||
// Return current fullscreen element or "true" if browser doesn't
|
// Return current fullscreen element or "true" if browser doesn't
|
||||||
// support this
|
// support this
|
||||||
return (/** @type {?Element} */ doc["fullscreenElement"])
|
return (/** @type {?Element} */ doc["fullscreenElement"])
|
||||||
|| (/** @type {?Element} */ doc["webkitFullscreenElement"])
|
|| (/** @type {?Element} */ doc["webkitFullscreenElement"])
|
||||||
|| (/** @type {?Element} */ doc["webkitCurrentFullScreenElement"])
|
|| (/** @type {?Element} */ doc["webkitCurrentFullScreenElement"])
|
||||||
|| (/** @type {?Element} */ doc["msFullscreenElement"])
|
|| (/** @type {?Element} */ doc["msFullscreenElement"])
|
||||||
|| (/** @type {?Element} */ doc["mozFullScreenElement"])
|
|| (/** @type {?Element} */ doc["mozFullScreenElement"])
|
||||||
|| state;
|
|| state;
|
||||||
}
|
}
|
||||||
|
|
||||||
// When state was specified then enter or exit fullscreen mode.
|
// When state was specified then enter or exit fullscreen mode.
|
||||||
if (state)
|
if (state)
|
||||||
{
|
{
|
||||||
// Enter fullscreen
|
// Enter fullscreen
|
||||||
func = (/** @type {?Function} */ e["requestFullscreen"])
|
func = (/** @type {?Function} */ e["requestFullscreen"])
|
||||||
|| (/** @type {?Function} */ e["webkitRequestFullscreen"])
|
|| (/** @type {?Function} */ e["webkitRequestFullscreen"])
|
||||||
|| (/** @type {?Function} */ e["webkitRequestFullScreen"])
|
|| (/** @type {?Function} */ e["webkitRequestFullScreen"])
|
||||||
|| (/** @type {?Function} */ e["msRequestFullscreen"])
|
|| (/** @type {?Function} */ e["msRequestFullscreen"])
|
||||||
|| (/** @type {?Function} */ e["mozRequestFullScreen"]);
|
|| (/** @type {?Function} */ e["mozRequestFullScreen"]);
|
||||||
if (func)
|
if (func)
|
||||||
{
|
{
|
||||||
func.call(e);
|
func.call(e);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Exit fullscreen
|
// Exit fullscreen
|
||||||
func = (/** @type {?Function} */ doc["exitFullscreen"])
|
func = (/** @type {?Function} */ doc["exitFullscreen"])
|
||||||
|| (/** @type {?Function} */ doc["webkitExitFullscreen"])
|
|| (/** @type {?Function} */ doc["webkitExitFullscreen"])
|
||||||
|| (/** @type {?Function} */ doc["webkitCancelFullScreen"])
|
|| (/** @type {?Function} */ doc["webkitCancelFullScreen"])
|
||||||
|| (/** @type {?Function} */ doc["msExitFullscreen"])
|
|| (/** @type {?Function} */ doc["msExitFullscreen"])
|
||||||
|| (/** @type {?Function} */ doc["mozCancelFullScreen"]);
|
|| (/** @type {?Function} */ doc["mozCancelFullScreen"]);
|
||||||
if (func) func.call(doc);
|
if (func) func.call(doc);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggles the fullscreen mode.
|
* Toggles the fullscreen mode.
|
||||||
*
|
*
|
||||||
* @return {!jQuery}
|
* @return {!jQuery}
|
||||||
* The jQuery selection for chaining.
|
* The jQuery selection for chaining.
|
||||||
* @this {jQuery}
|
* @this {jQuery}
|
||||||
*/
|
*/
|
||||||
function toggleFullScreen()
|
function toggleFullScreen()
|
||||||
{
|
{
|
||||||
return (/** @type {!jQuery} */ fullScreen.call(this,
|
return (/** @type {!jQuery} */ fullScreen.call(this,
|
||||||
!fullScreen.call(this)));
|
!fullScreen.call(this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the browser-specific fullscreenchange event and triggers
|
* Handles the browser-specific fullscreenchange event and triggers
|
||||||
* a jquery event for it.
|
* a jquery event for it.
|
||||||
*
|
*
|
||||||
* @param {?Event} event
|
* @param {?Event} event
|
||||||
* The fullscreenchange event.
|
* The fullscreenchange event.
|
||||||
*/
|
*/
|
||||||
function fullScreenChangeHandler(event)
|
function fullScreenChangeHandler(event)
|
||||||
{
|
{
|
||||||
jQuery(document).trigger(new jQuery.Event("fullscreenchange"));
|
jQuery(document).trigger(new jQuery.Event("fullscreenchange"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the browser-specific fullscreenerror event and triggers
|
* Handles the browser-specific fullscreenerror event and triggers
|
||||||
* a jquery event for it.
|
* a jquery event for it.
|
||||||
*
|
*
|
||||||
* @param {?Event} event
|
* @param {?Event} event
|
||||||
* The fullscreenerror event.
|
* The fullscreenerror event.
|
||||||
*/
|
*/
|
||||||
function fullScreenErrorHandler(event)
|
function fullScreenErrorHandler(event)
|
||||||
{
|
{
|
||||||
jQuery(document).trigger(new jQuery.Event("fullscreenerror"));
|
jQuery(document).trigger(new jQuery.Event("fullscreenerror"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Installs the fullscreenchange event handler.
|
* Installs the fullscreenchange event handler.
|
||||||
*/
|
*/
|
||||||
function installFullScreenHandlers()
|
function installFullScreenHandlers()
|
||||||
{
|
{
|
||||||
var e, change, error;
|
var e, change, error;
|
||||||
|
|
||||||
// Determine event name
|
// Determine event name
|
||||||
e = document;
|
e = document;
|
||||||
if (e["webkitCancelFullScreen"])
|
if (e["webkitCancelFullScreen"])
|
||||||
{
|
{
|
||||||
change = "webkitfullscreenchange";
|
change = "webkitfullscreenchange";
|
||||||
error = "webkitfullscreenerror";
|
error = "webkitfullscreenerror";
|
||||||
}
|
}
|
||||||
else if (e["msExitFullscreen"])
|
else if (e["msExitFullscreen"])
|
||||||
{
|
{
|
||||||
change = "MSFullscreenChange";
|
change = "MSFullscreenChange";
|
||||||
error = "MSFullscreenError";
|
error = "MSFullscreenError";
|
||||||
}
|
}
|
||||||
else if (e["mozCancelFullScreen"])
|
else if (e["mozCancelFullScreen"])
|
||||||
{
|
{
|
||||||
change = "mozfullscreenchange";
|
change = "mozfullscreenchange";
|
||||||
error = "mozfullscreenerror";
|
error = "mozfullscreenerror";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
change = "fullscreenchange";
|
change = "fullscreenchange";
|
||||||
error = "fullscreenerror";
|
error = "fullscreenerror";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Install the event handlers
|
// Install the event handlers
|
||||||
jQuery(document).bind(change, fullScreenChangeHandler);
|
jQuery(document).bind(change, fullScreenChangeHandler);
|
||||||
jQuery(document).bind(error, fullScreenErrorHandler);
|
jQuery(document).bind(error, fullScreenErrorHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
jQuery.fn["fullScreen"] = fullScreen;
|
jQuery.fn["fullScreen"] = fullScreen;
|
||||||
jQuery.fn["toggleFullScreen"] = toggleFullScreen;
|
jQuery.fn["toggleFullScreen"] = toggleFullScreen;
|
||||||
installFullScreenHandlers();
|
installFullScreenHandlers();
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|
||||||
|
|
@ -1,72 +1,72 @@
|
||||||
/* iCheck plugin Square skin, green
|
/* iCheck plugin Square skin, green
|
||||||
----------------------------------- */
|
----------------------------------- */
|
||||||
.icheckbox_square-green,
|
.icheckbox_square-green,
|
||||||
.iradio_square-green {
|
.iradio_square-green {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
*display: inline;
|
*display: inline;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
width: 22px;
|
width: 22px;
|
||||||
height: 22px;
|
height: 22px;
|
||||||
background: url(green.png) no-repeat;
|
background: url(green.png) no-repeat;
|
||||||
border: none;
|
border: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icheckbox_square-green-login{
|
.icheckbox_square-green-login{
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
*display: inline;
|
*display: inline;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
width: 22px;
|
width: 22px;
|
||||||
height: 22px;
|
height: 22px;
|
||||||
background: url(green-login.png) no-repeat;
|
background: url(green-login.png) no-repeat;
|
||||||
border: none;
|
border: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icheckbox_square-green,.icheckbox_square-green-login {
|
.icheckbox_square-green,.icheckbox_square-green-login {
|
||||||
background-position: 0 0;
|
background-position: 0 0;
|
||||||
}
|
}
|
||||||
.icheckbox_square-green.hover,.icheckbox_square-green-login.hover {
|
.icheckbox_square-green.hover,.icheckbox_square-green-login.hover {
|
||||||
background-position: -24px 0;
|
background-position: -24px 0;
|
||||||
}
|
}
|
||||||
.icheckbox_square-green.checked,.icheckbox_square-green-login.checked {
|
.icheckbox_square-green.checked,.icheckbox_square-green-login.checked {
|
||||||
background-position: -48px 0;
|
background-position: -48px 0;
|
||||||
}
|
}
|
||||||
.icheckbox_square-green.disabled,.icheckbox_square-green.disabled-login {
|
.icheckbox_square-green.disabled,.icheckbox_square-green.disabled-login {
|
||||||
background-position: -72px 0;
|
background-position: -72px 0;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
}
|
}
|
||||||
.icheckbox_square-green.checked.disabled,.icheckbox_square-green-login.checked.disabled {
|
.icheckbox_square-green.checked.disabled,.icheckbox_square-green-login.checked.disabled {
|
||||||
background-position: -96px 0;
|
background-position: -96px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.iradio_square-green {
|
.iradio_square-green {
|
||||||
background-position: -120px 0;
|
background-position: -120px 0;
|
||||||
}
|
}
|
||||||
.iradio_square-green.hover {
|
.iradio_square-green.hover {
|
||||||
background-position: -144px 0;
|
background-position: -144px 0;
|
||||||
}
|
}
|
||||||
.iradio_square-green.checked {
|
.iradio_square-green.checked {
|
||||||
background-position: -168px 0;
|
background-position: -168px 0;
|
||||||
}
|
}
|
||||||
.iradio_square-green.disabled {
|
.iradio_square-green.disabled {
|
||||||
background-position: -192px 0;
|
background-position: -192px 0;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
}
|
}
|
||||||
.iradio_square-green.checked.disabled {
|
.iradio_square-green.checked.disabled {
|
||||||
background-position: -216px 0;
|
background-position: -216px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* HiDPI support */
|
/* HiDPI support */
|
||||||
@media (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
|
@media (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
|
||||||
.icheckbox_square-green,.icheckbox_square-green-login,
|
.icheckbox_square-green,.icheckbox_square-green-login,
|
||||||
.iradio_square-green {
|
.iradio_square-green {
|
||||||
background-image: url(green%402x.png);
|
background-image: url(green%402x.png);
|
||||||
-webkit-background-size: 240px 24px;
|
-webkit-background-size: 240px 24px;
|
||||||
background-size: 240px 24px;
|
background-size: 240px 24px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
|
|
@ -1,11 +1,11 @@
|
||||||
/*! iCheck v1.0.2 by Damir Sultanov, http://git.io/arlzeA, MIT Licensed */
|
/*! iCheck v1.0.2 by Damir Sultanov, http://git.io/arlzeA, MIT Licensed */
|
||||||
(function(f){function A(a,b,d){var c=a[0],g=/er/.test(d)?_indeterminate:/bl/.test(d)?n:k,e=d==_update?{checked:c[k],disabled:c[n],indeterminate:"true"==a.attr(_indeterminate)||"false"==a.attr(_determinate)}:c[g];if(/^(ch|di|in)/.test(d)&&!e)x(a,g);else if(/^(un|en|de)/.test(d)&&e)q(a,g);else if(d==_update)for(var f in e)e[f]?x(a,f,!0):q(a,f,!0);else if(!b||"toggle"==d){if(!b)a[_callback]("ifClicked");e?c[_type]!==r&&q(a,g):x(a,g)}}function x(a,b,d){var c=a[0],g=a.parent(),e=b==k,u=b==_indeterminate,
|
(function(f){function A(a,b,d){var c=a[0],g=/er/.test(d)?_indeterminate:/bl/.test(d)?n:k,e=d==_update?{checked:c[k],disabled:c[n],indeterminate:"true"==a.attr(_indeterminate)||"false"==a.attr(_determinate)}:c[g];if(/^(ch|di|in)/.test(d)&&!e)x(a,g);else if(/^(un|en|de)/.test(d)&&e)q(a,g);else if(d==_update)for(var f in e)e[f]?x(a,f,!0):q(a,f,!0);else if(!b||"toggle"==d){if(!b)a[_callback]("ifClicked");e?c[_type]!==r&&q(a,g):x(a,g)}}function x(a,b,d){var c=a[0],g=a.parent(),e=b==k,u=b==_indeterminate,
|
||||||
v=b==n,s=u?_determinate:e?y:"enabled",F=l(a,s+t(c[_type])),B=l(a,b+t(c[_type]));if(!0!==c[b]){if(!d&&b==k&&c[_type]==r&&c.name){var w=a.closest("form"),p='input[name="'+c.name+'"]',p=w.length?w.find(p):f(p);p.each(function(){this!==c&&f(this).data(m)&&q(f(this),b)})}u?(c[b]=!0,c[k]&&q(a,k,"force")):(d||(c[b]=!0),e&&c[_indeterminate]&&q(a,_indeterminate,!1));D(a,e,b,d)}c[n]&&l(a,_cursor,!0)&&g.find("."+C).css(_cursor,"default");g[_add](B||l(a,b)||"");g.attr("role")&&!u&&g.attr("aria-"+(v?n:k),"true");
|
v=b==n,s=u?_determinate:e?y:"enabled",F=l(a,s+t(c[_type])),B=l(a,b+t(c[_type]));if(!0!==c[b]){if(!d&&b==k&&c[_type]==r&&c.name){var w=a.closest("form"),p='input[name="'+c.name+'"]',p=w.length?w.find(p):f(p);p.each(function(){this!==c&&f(this).data(m)&&q(f(this),b)})}u?(c[b]=!0,c[k]&&q(a,k,"force")):(d||(c[b]=!0),e&&c[_indeterminate]&&q(a,_indeterminate,!1));D(a,e,b,d)}c[n]&&l(a,_cursor,!0)&&g.find("."+C).css(_cursor,"default");g[_add](B||l(a,b)||"");g.attr("role")&&!u&&g.attr("aria-"+(v?n:k),"true");
|
||||||
g[_remove](F||l(a,s)||"")}function q(a,b,d){var c=a[0],g=a.parent(),e=b==k,f=b==_indeterminate,m=b==n,s=f?_determinate:e?y:"enabled",q=l(a,s+t(c[_type])),r=l(a,b+t(c[_type]));if(!1!==c[b]){if(f||!d||"force"==d)c[b]=!1;D(a,e,s,d)}!c[n]&&l(a,_cursor,!0)&&g.find("."+C).css(_cursor,"pointer");g[_remove](r||l(a,b)||"");g.attr("role")&&!f&&g.attr("aria-"+(m?n:k),"false");g[_add](q||l(a,s)||"")}function E(a,b){if(a.data(m)){a.parent().html(a.attr("style",a.data(m).s||""));if(b)a[_callback](b);a.off(".i").unwrap();
|
g[_remove](F||l(a,s)||"")}function q(a,b,d){var c=a[0],g=a.parent(),e=b==k,f=b==_indeterminate,m=b==n,s=f?_determinate:e?y:"enabled",q=l(a,s+t(c[_type])),r=l(a,b+t(c[_type]));if(!1!==c[b]){if(f||!d||"force"==d)c[b]=!1;D(a,e,s,d)}!c[n]&&l(a,_cursor,!0)&&g.find("."+C).css(_cursor,"pointer");g[_remove](r||l(a,b)||"");g.attr("role")&&!f&&g.attr("aria-"+(m?n:k),"false");g[_add](q||l(a,s)||"")}function E(a,b){if(a.data(m)){a.parent().html(a.attr("style",a.data(m).s||""));if(b)a[_callback](b);a.off(".i").unwrap();
|
||||||
f(_label+'[for="'+a[0].id+'"]').add(a.closest(_label)).off(".i")}}function l(a,b,f){if(a.data(m))return a.data(m).o[b+(f?"":"Class")]}function t(a){return a.charAt(0).toUpperCase()+a.slice(1)}function D(a,b,f,c){if(!c){if(b)a[_callback]("ifToggled");a[_callback]("ifChanged")[_callback]("if"+t(f))}}var m="iCheck",C=m+"-helper",r="radio",k="checked",y="un"+k,n="disabled";_determinate="determinate";_indeterminate="in"+_determinate;_update="update";_type="type";_click="click";_touch="touchbegin.i touchend.i";
|
f(_label+'[for="'+a[0].id+'"]').add(a.closest(_label)).off(".i")}}function l(a,b,f){if(a.data(m))return a.data(m).o[b+(f?"":"Class")]}function t(a){return a.charAt(0).toUpperCase()+a.slice(1)}function D(a,b,f,c){if(!c){if(b)a[_callback]("ifToggled");a[_callback]("ifChanged")[_callback]("if"+t(f))}}var m="iCheck",C=m+"-helper",r="radio",k="checked",y="un"+k,n="disabled";_determinate="determinate";_indeterminate="in"+_determinate;_update="update";_type="type";_click="click";_touch="touchbegin.i touchend.i";
|
||||||
_add="addClass";_remove="removeClass";_callback="trigger";_label="label";_cursor="cursor";_mobile=/ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent);f.fn[m]=function(a,b){var d='input[type="checkbox"], input[type="'+r+'"]',c=f(),g=function(a){a.each(function(){var a=f(this);c=a.is(d)?c.add(a):c.add(a.find(d))})};if(/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(a))return a=a.toLowerCase(),g(this),c.each(function(){var c=
|
_add="addClass";_remove="removeClass";_callback="trigger";_label="label";_cursor="cursor";_mobile=/ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent);f.fn[m]=function(a,b){var d='input[type="checkbox"], input[type="'+r+'"]',c=f(),g=function(a){a.each(function(){var a=f(this);c=a.is(d)?c.add(a):c.add(a.find(d))})};if(/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(a))return a=a.toLowerCase(),g(this),c.each(function(){var c=
|
||||||
f(this);"destroy"==a?E(c,"ifDestroyed"):A(c,!0,a);f.isFunction(b)&&b()});if("object"!=typeof a&&a)return this;var e=f.extend({checkedClass:k,disabledClass:n,indeterminateClass:_indeterminate,labelHover:!0},a),l=e.handle,v=e.hoverClass||"hover",s=e.focusClass||"focus",t=e.activeClass||"active",B=!!e.labelHover,w=e.labelHoverClass||"hover",p=(""+e.increaseArea).replace("%","")|0;if("checkbox"==l||l==r)d='input[type="'+l+'"]';-50>p&&(p=-50);g(this);return c.each(function(){var a=f(this);E(a);var c=this,
|
f(this);"destroy"==a?E(c,"ifDestroyed"):A(c,!0,a);f.isFunction(b)&&b()});if("object"!=typeof a&&a)return this;var e=f.extend({checkedClass:k,disabledClass:n,indeterminateClass:_indeterminate,labelHover:!0},a),l=e.handle,v=e.hoverClass||"hover",s=e.focusClass||"focus",t=e.activeClass||"active",B=!!e.labelHover,w=e.labelHoverClass||"hover",p=(""+e.increaseArea).replace("%","")|0;if("checkbox"==l||l==r)d='input[type="'+l+'"]';-50>p&&(p=-50);g(this);return c.each(function(){var a=f(this);E(a);var c=this,
|
||||||
b=c.id,g=-p+"%",d=100+2*p+"%",d={position:"absolute",top:g,left:g,display:"block",width:d,height:d,margin:0,padding:0,background:"#fff",border:0,opacity:0},g=_mobile?{position:"absolute",visibility:"hidden"}:p?d:{position:"absolute",opacity:0},l="checkbox"==c[_type]?e.checkboxClass||"icheckbox":e.radioClass||"i"+r,z=f(_label+'[for="'+b+'"]').add(a.closest(_label)),u=!!e.aria,y=m+"-"+Math.random().toString(36).substr(2,6),h='<div class="'+l+'" '+(u?'role="'+c[_type]+'" ':"");u&&z.each(function(){h+=
|
b=c.id,g=-p+"%",d=100+2*p+"%",d={position:"absolute",top:g,left:g,display:"block",width:d,height:d,margin:0,padding:0,background:"#fff",border:0,opacity:0},g=_mobile?{position:"absolute",visibility:"hidden"}:p?d:{position:"absolute",opacity:0},l="checkbox"==c[_type]?e.checkboxClass||"icheckbox":e.radioClass||"i"+r,z=f(_label+'[for="'+b+'"]').add(a.closest(_label)),u=!!e.aria,y=m+"-"+Math.random().toString(36).substr(2,6),h='<div class="'+l+'" '+(u?'role="'+c[_type]+'" ':"");u&&z.each(function(){h+=
|
||||||
'aria-labelledby="';this.id?h+=this.id:(this.id=y,h+=y);h+='"'});h=a.wrap(h+"/>")[_callback]("ifCreated").parent().append(e.insert);d=f('<ins class="'+C+'"/>').css(d).appendTo(h);a.data(m,{o:e,s:a.attr("style")}).css(g);e.inheritClass&&h[_add](c.className||"");e.inheritID&&b&&h.attr("id",m+"-"+b);"static"==h.css("position")&&h.css("position","relative");A(a,!0,_update);if(z.length)z.on(_click+".i mouseover.i mouseout.i "+_touch,function(b){var d=b[_type],e=f(this);if(!c[n]){if(d==_click){if(f(b.target).is("a"))return;
|
'aria-labelledby="';this.id?h+=this.id:(this.id=y,h+=y);h+='"'});h=a.wrap(h+"/>")[_callback]("ifCreated").parent().append(e.insert);d=f('<ins class="'+C+'"/>').css(d).appendTo(h);a.data(m,{o:e,s:a.attr("style")}).css(g);e.inheritClass&&h[_add](c.className||"");e.inheritID&&b&&h.attr("id",m+"-"+b);"static"==h.css("position")&&h.css("position","relative");A(a,!0,_update);if(z.length)z.on(_click+".i mouseover.i mouseout.i "+_touch,function(b){var d=b[_type],e=f(this);if(!c[n]){if(d==_click){if(f(b.target).is("a"))return;
|
||||||
A(a,!1,!0)}else B&&(/ut|nd/.test(d)?(h[_remove](v),e[_remove](w)):(h[_add](v),e[_add](w)));if(_mobile)b.stopPropagation();else return!1}});a.on(_click+".i focus.i blur.i keyup.i keydown.i keypress.i",function(b){var d=b[_type];b=b.keyCode;if(d==_click)return!1;if("keydown"==d&&32==b)return c[_type]==r&&c[k]||(c[k]?q(a,k):x(a,k)),!1;if("keyup"==d&&c[_type]==r)!c[k]&&x(a,k);else if(/us|ur/.test(d))h["blur"==d?_remove:_add](s)});d.on(_click+" mousedown mouseup mouseover mouseout "+_touch,function(b){var d=
|
A(a,!1,!0)}else B&&(/ut|nd/.test(d)?(h[_remove](v),e[_remove](w)):(h[_add](v),e[_add](w)));if(_mobile)b.stopPropagation();else return!1}});a.on(_click+".i focus.i blur.i keyup.i keydown.i keypress.i",function(b){var d=b[_type];b=b.keyCode;if(d==_click)return!1;if("keydown"==d&&32==b)return c[_type]==r&&c[k]||(c[k]?q(a,k):x(a,k)),!1;if("keyup"==d&&c[_type]==r)!c[k]&&x(a,k);else if(/us|ur/.test(d))h["blur"==d?_remove:_add](s)});d.on(_click+" mousedown mouseup mouseover mouseout "+_touch,function(b){var d=
|
||||||
b[_type],e=/wn|up/.test(d)?t:v;if(!c[n]){if(d==_click)A(a,!1,!0);else{if(/wn|er|in/.test(d))h[_add](e);else h[_remove](e+" "+t);if(z.length&&B&&e==v)z[/ut|nd/.test(d)?_remove:_add](w)}if(_mobile)b.stopPropagation();else return!1}})})}})(window.jQuery||window.Zepto);
|
b[_type],e=/wn|up/.test(d)?t:v;if(!c[n]){if(d==_click)A(a,!1,!0);else{if(/wn|er|in/.test(d))h[_add](e);else h[_remove](e+" "+t);if(z.length&&B&&e==v)z[/ut|nd/.test(d)?_remove:_add](w)}if(_mobile)b.stopPropagation();else return!1}})})}})(window.jQuery||window.Zepto);
|
||||||
|
Before Width: | Height: | Size: 601 B After Width: | Height: | Size: 601 B |
|
Before Width: | Height: | Size: 580 B After Width: | Height: | Size: 580 B |
|
Before Width: | Height: | Size: 570 B After Width: | Height: | Size: 570 B |
|
Before Width: | Height: | Size: 762 B After Width: | Height: | Size: 762 B |
|
Before Width: | Height: | Size: 399 B After Width: | Height: | Size: 399 B |