当前位置: 首页 > 编程日记 > 正文

ruoyi后台管理系统分析(三)---admin包

三、admin包

--web包

-----controller包

-----------common包

CommonController.java------通用请求处理
package com.ruoyi.web.controller.common;import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.common.config.Global;
import com.ruoyi.common.utils.file.FileUtils;/*** 通用请求处理* * @author ruoyi*/
@Controller
public class CommonController
{private static final Logger log = LoggerFactory.getLogger(CommonController.class);@RequestMapping("common/download")public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request){String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);try{String filePath = Global.getDownloadPath() + fileName;response.setCharacterEncoding("utf-8");response.setContentType("multipart/form-data");response.setHeader("Content-Disposition", "attachment;fileName=" + setFileDownloadHeader(request, realFileName));FileUtils.writeBytes(filePath, response.getOutputStream());if (delete){FileUtils.deleteFile(filePath);}}catch (Exception e){log.error("下载文件失败", e);}}public String setFileDownloadHeader(HttpServletRequest request, String fileName) throws UnsupportedEncodingException{final String agent = request.getHeader("USER-AGENT");String filename = fileName;if (agent.contains("MSIE")){// IE浏览器filename = URLEncoder.encode(filename, "utf-8");filename = filename.replace("+", " ");}else if (agent.contains("Firefox")){// 火狐浏览器filename = new String(fileName.getBytes(), "ISO8859-1");}else if (agent.contains("Chrome")){// google浏览器filename = URLEncoder.encode(filename, "utf-8");}else{// 其它浏览器filename = URLEncoder.encode(filename, "utf-8");}return filename;}
}
View Code

-----------monitor包

DruidController.java-------druid监控(是阿里创建的一种连接池)
package com.ruoyi.web.controller.monitor;import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.web.core.base.BaseController;/*** druid 监控* * @author ruoyi*/
@Controller
@RequestMapping("/monitor/data")
public class DruidController extends BaseController
{private String prefix = "/monitor/druid";@RequiresPermissions("monitor:data:view")@GetMapping()public String index(){return redirect(prefix + "/index");}
}
View Code
SysJobController.java-------调度任务信息操作处理
package com.ruoyi.web.controller.monitor;import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ExcelUtil;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.quartz.domain.SysJob;
import com.ruoyi.quartz.service.ISysJobService;
import com.ruoyi.web.core.base.BaseController;/*** 调度任务信息操作处理* * @author ruoyi*/
@Controller
@RequestMapping("/monitor/job")
public class SysJobController extends BaseController
{private String prefix = "monitor/job";@Autowiredprivate ISysJobService jobService;@RequiresPermissions("monitor:job:view")@GetMapping()public String job(){return prefix + "/job";}@RequiresPermissions("monitor:job:list")@PostMapping("/list")@ResponseBodypublic TableDataInfo list(SysJob job){startPage();List<SysJob> list = jobService.selectJobList(job);return getDataTable(list);}@Log(title = "定时任务", businessType = BusinessType.EXPORT)@RequiresPermissions("monitor:job:export")@PostMapping("/export")@ResponseBodypublic AjaxResult export(SysJob job){List<SysJob> list = jobService.selectJobList(job);ExcelUtil<SysJob> util = new ExcelUtil<SysJob>(SysJob.class);return util.exportExcel(list, "job");}@Log(title = "定时任务", businessType = BusinessType.DELETE)@RequiresPermissions("monitor:job:remove")@PostMapping("/remove")@ResponseBodypublic AjaxResult remove(String ids){try{jobService.deleteJobByIds(ids);return success();}catch (Exception e){e.printStackTrace();return error(e.getMessage());}}/*** 任务调度状态修改*/@Log(title = "定时任务", businessType = BusinessType.UPDATE)@RequiresPermissions("monitor:job:changeStatus")@PostMapping("/changeStatus")@ResponseBodypublic AjaxResult changeStatus(SysJob job){job.setUpdateBy(ShiroUtils.getLoginName());return toAjax(jobService.changeStatus(job));}/*** 任务调度立即执行一次*/@Log(title = "定时任务", businessType = BusinessType.UPDATE)@RequiresPermissions("monitor:job:changeStatus")@PostMapping("/run")@ResponseBodypublic AjaxResult run(SysJob job){return toAjax(jobService.run(job));}/*** 新增调度*/@GetMapping("/add")public String add(){return prefix + "/add";}/*** 新增保存调度*/@Log(title = "定时任务", businessType = BusinessType.INSERT)@RequiresPermissions("monitor:job:add")@PostMapping("/add")@ResponseBodypublic AjaxResult addSave(SysJob job){job.setCreateBy(ShiroUtils.getLoginName());return toAjax(jobService.insertJobCron(job));}/*** 修改调度*/@GetMapping("/edit/{jobId}")public String edit(@PathVariable("jobId") Long jobId, ModelMap mmap){mmap.put("job", jobService.selectJobById(jobId));return prefix + "/edit";}/*** 修改保存调度*/@Log(title = "定时任务", businessType = BusinessType.UPDATE)@RequiresPermissions("monitor:job:edit")@PostMapping("/edit")@ResponseBodypublic AjaxResult editSave(SysJob job){job.setUpdateBy(ShiroUtils.getLoginName());return toAjax(jobService.updateJobCron(job));}
}
View Code

SysJobLogController.java-------调度日志操作处理
package com.ruoyi.web.controller.monitor;import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.quartz.domain.SysJobLog;
import com.ruoyi.quartz.service.ISysJobLogService;
import com.ruoyi.web.core.base.BaseController;/*** 调度日志操作处理* * @author ruoyi*/
@Controller
@RequestMapping("/monitor/jobLog")
public class SysJobLogController extends BaseController
{private String prefix = "monitor/job";@Autowiredprivate ISysJobLogService jobLogService;@RequiresPermissions("monitor:job:view")@GetMapping()public String jobLog(){return prefix + "/jobLog";}@RequiresPermissions("monitor:job:list")@PostMapping("/list")@ResponseBodypublic TableDataInfo list(SysJobLog jobLog){startPage();List<SysJobLog> list = jobLogService.selectJobLogList(jobLog);return getDataTable(list);}@Log(title = "调度日志", businessType = BusinessType.EXPORT)@RequiresPermissions("monitor:job:export")@PostMapping("/export")@ResponseBodypublic AjaxResult export(SysJobLog jobLog){List<SysJobLog> list = jobLogService.selectJobLogList(jobLog);ExcelUtil<SysJobLog> util = new ExcelUtil<SysJobLog>(SysJobLog.class);return util.exportExcel(list, "jobLog");}@Log(title = "调度日志", businessType = BusinessType.DELETE)@RequiresPermissions("monitor:job:remove")@PostMapping("/remove")@ResponseBodypublic AjaxResult remove(String ids){return toAjax(jobLogService.deleteJobLogByIds(ids));}@Log(title = "调度日志", businessType = BusinessType.CLEAN)@RequiresPermissions("monitor:job:remove")@PostMapping("/clean")@ResponseBodypublic AjaxResult clean(){jobLogService.cleanJobLog();return success();}
}
View Code
SysLogininforController.java---------系统访问记录
package com.ruoyi.web.controller.monitor;import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.system.domain.SysLogininfor;
import com.ruoyi.system.service.ISysLogininforService;
import com.ruoyi.web.core.base.BaseController;/*** 系统访问记录* * @author ruoyi*/
@Controller
@RequestMapping("/monitor/logininfor")
public class SysLogininforController extends BaseController
{private String prefix = "monitor/logininfor";@Autowiredprivate ISysLogininforService logininforService;@RequiresPermissions("monitor:logininfor:view")@GetMapping()public String logininfor(){return prefix + "/logininfor";}@RequiresPermissions("monitor:logininfor:list")@PostMapping("/list")@ResponseBodypublic TableDataInfo list(SysLogininfor logininfor){startPage();List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);return getDataTable(list);}@Log(title = "登陆日志", businessType = BusinessType.EXPORT)@RequiresPermissions("monitor:logininfor:export")@PostMapping("/export")@ResponseBodypublic AjaxResult export(SysLogininfor logininfor){List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);return util.exportExcel(list, "logininfor");}@RequiresPermissions("monitor:logininfor:remove")@Log(title = "登陆日志", businessType = BusinessType.DELETE)@PostMapping("/remove")@ResponseBodypublic AjaxResult remove(String ids){return toAjax(logininforService.deleteLogininforByIds(ids));}@RequiresPermissions("monitor:logininfor:remove")/***  例如: @RequiresPermissions({"file:read", "write:aFile.txt"} )*   void someMethod();* 要求subject中必须同时含有file:read和write:aFile.txt的权限才能执行方法someMethod()。否则抛出异常AuthorizationException。*/@Log(title = "登陆日志", businessType = BusinessType.CLEAN)@PostMapping("/clean")@ResponseBody/***   @responseBody注解的作用是将controller的方法返回的对象通过适当的转换器转换为指定的格式之后,写入到response对象的body区,通常用来返回JSON数据或者是XML**   数据*/public AjaxResult clean(){logininforService.cleanLogininfor();return success();}
}
View Code
SysOperlogController.java---------操作日志记录
package com.ruoyi.web.controller.monitor;import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.system.domain.SysOperLog;
import com.ruoyi.system.service.ISysOperLogService;
import com.ruoyi.web.core.base.BaseController;/*** 操作日志记录* * @author ruoyi*/
@Controller
@RequestMapping("/monitor/operlog")
public class SysOperlogController extends BaseController
{private String prefix = "monitor/operlog";@Autowiredprivate ISysOperLogService operLogService;@RequiresPermissions("monitor:operlog:view")@GetMapping()public String operlog(){return prefix + "/operlog";}@RequiresPermissions("monitor:operlog:list")@PostMapping("/list")@ResponseBodypublic TableDataInfo list(SysOperLog operLog){startPage();List<SysOperLog> list = operLogService.selectOperLogList(operLog);return getDataTable(list);}@Log(title = "操作日志", businessType = BusinessType.EXPORT)@RequiresPermissions("monitor:operlog:export")@PostMapping("/export")@ResponseBodypublic AjaxResult export(SysOperLog operLog){List<SysOperLog> list = operLogService.selectOperLogList(operLog);ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);return util.exportExcel(list, "operLog");}@RequiresPermissions("monitor:operlog:remove")@PostMapping("/remove")@ResponseBodypublic AjaxResult remove(String ids){return toAjax(operLogService.deleteOperLogByIds(ids));}@RequiresPermissions("monitor:operlog:detail")@GetMapping("/detail/{operId}")public String detail(@PathVariable("operId") Long deptId, ModelMap mmap){mmap.put("operLog", operLogService.selectOperLogById(deptId));return prefix + "/detail";}@Log(title = "操作日志", businessType = BusinessType.CLEAN)@RequiresPermissions("monitor:operlog:remove")@PostMapping("/clean")@ResponseBodypublic AjaxResult clean(){operLogService.cleanOperLog();return success();}
}
View Code
SysUserOnlineController.java--------在线用户监控
package com.ruoyi.web.controller.monitor;import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.enums.OnlineStatus;
import com.ruoyi.framework.shiro.session.OnlineSession;
import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.system.domain.SysUserOnline;
import com.ruoyi.system.service.impl.SysUserOnlineServiceImpl;
import com.ruoyi.web.core.base.BaseController;/*** 在线用户监控* * @author ruoyi*/
@Controller
@RequestMapping("/monitor/online")
public class SysUserOnlineController extends BaseController
{private String prefix = "monitor/online";@Autowiredprivate SysUserOnlineServiceImpl userOnlineService;@Autowiredprivate OnlineSessionDAO onlineSessionDAO;@RequiresPermissions("monitor:online:view")@GetMapping()public String online(){return prefix + "/online";}@RequiresPermissions("monitor:online:list")@PostMapping("/list")@ResponseBodypublic TableDataInfo list(SysUserOnline userOnline){startPage();List<SysUserOnline> list = userOnlineService.selectUserOnlineList(userOnline);return getDataTable(list);}@RequiresPermissions("monitor:online:batchForceLogout")@Log(title = "在线用户", businessType = BusinessType.FORCE)@PostMapping("/batchForceLogout")@ResponseBodypublic AjaxResult batchForceLogout(@RequestParam("ids[]") String[] ids){for (String sessionId : ids){SysUserOnline online = userOnlineService.selectOnlineById(sessionId);if (online == null){return error("用户已下线");}OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId());if (onlineSession == null){return error("用户已下线");}if (sessionId.equals(ShiroUtils.getSessionId())){return error("当前登陆用户无法强退");}onlineSession.setStatus(OnlineStatus.off_line);online.setStatus(OnlineStatus.off_line);userOnlineService.saveOnline(online);}return success();}@RequiresPermissions("monitor:online:forceLogout")@Log(title = "在线用户", businessType = BusinessType.FORCE)@PostMapping("/forceLogout")@ResponseBodypublic AjaxResult forceLogout(String sessionId){SysUserOnline online = userOnlineService.selectOnlineById(sessionId);if (sessionId.equals(ShiroUtils.getSessionId())){return error("当前登陆用户无法强退");}if (online == null){return error("用户已下线");}OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId());if (onlineSession == null){return error("用户已下线");}onlineSession.setStatus(OnlineStatus.off_line);online.setStatus(OnlineStatus.off_line);userOnlineService.saveOnline(online);return success();}
}
View Code

-----------system包

SysCaptchaController.java---------图片验证码
package com.ruoyi.web.controller.system;import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.google.code.kaptcha.Constants;
import com.google.code.kaptcha.Producer;
import com.ruoyi.web.core.base.BaseController;/*** 图片验证码(支持算术形式)* * @author ruoyi*/
@Controller
@RequestMapping("/captcha")
public class SysCaptchaController extends BaseController
{@Resource(name = "captchaProducer")private Producer captchaProducer;@Resource(name = "captchaProducerMath")private Producer captchaProducerMath;/*** 验证码生成*/@GetMapping(value = "/captchaImage")public ModelAndView getKaptchaImage(HttpServletRequest request, HttpServletResponse response){ServletOutputStream out = null;try{HttpSession session = request.getSession();response.setDateHeader("Expires", 0);response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");response.addHeader("Cache-Control", "post-check=0, pre-check=0");response.setHeader("Pragma", "no-cache");response.setContentType("image/jpeg");String type = request.getParameter("type");String capStr = null;String code = null;BufferedImage bi = null;if ("math".equals(type)){String capText = captchaProducerMath.createText();capStr = capText.substring(0, capText.lastIndexOf("@"));code = capText.substring(capText.lastIndexOf("@") + 1);bi = captchaProducerMath.createImage(capStr);}else if ("char".equals(type)){capStr = code = captchaProducer.createText();bi = captchaProducer.createImage(capStr);}session.setAttribute(Constants.KAPTCHA_SESSION_KEY, code);out = response.getOutputStream();ImageIO.write(bi, "jpg", out);out.flush();}catch (Exception e){e.printStackTrace();}finally{try{if (out != null){out.close();}}catch (IOException e){e.printStackTrace();}}return null;}
}
View Code
SysConfigController.java-------参数配置信息操作处理

package com.ruoyi.web.controller.system;import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ExcelUtil;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.web.core.base.BaseController;/*** 参数配置 信息操作处理* * @author ruoyi*/
@Controller
@RequestMapping("/system/config")
public class SysConfigController extends BaseController
{private String prefix = "system/config";@Autowiredprivate ISysConfigService configService;@RequiresPermissions("system:config:view")@GetMapping()public String config(){return prefix + "/config";}/*** 查询参数配置列表*/@RequiresPermissions("system:config:list")@PostMapping("/list")@ResponseBodypublic TableDataInfo list(SysConfig config){startPage();List<SysConfig> list = configService.selectConfigList(config);return getDataTable(list);}@Log(title = "参数管理", businessType = BusinessType.EXPORT)@RequiresPermissions("system:config:export")@PostMapping("/export")@ResponseBodypublic AjaxResult export(SysConfig config){List<SysConfig> list = configService.selectConfigList(config);ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);return util.exportExcel(list, "config");}/*** 新增参数配置*/@GetMapping("/add")public String add(){return prefix + "/add";}/*** 新增保存参数配置*/@RequiresPermissions("system:config:add")@Log(title = "参数管理", businessType = BusinessType.INSERT)@PostMapping("/add")@ResponseBodypublic AjaxResult addSave(SysConfig config){config.setCreateBy(ShiroUtils.getLoginName());return toAjax(configService.insertConfig(config));}/*** 修改参数配置*/@GetMapping("/edit/{configId}")public String edit(@PathVariable("configId") Long configId, ModelMap mmap){mmap.put("config", configService.selectConfigById(configId));return prefix + "/edit";}/*** 修改保存参数配置*/@RequiresPermissions("system:config:edit")@Log(title = "参数管理", businessType = BusinessType.UPDATE)@PostMapping("/edit")@ResponseBodypublic AjaxResult editSave(SysConfig config){config.setUpdateBy(ShiroUtils.getLoginName());return toAjax(configService.updateConfig(config));}/*** 删除参数配置*/@RequiresPermissions("system:config:remove")@Log(title = "参数管理", businessType = BusinessType.DELETE)@PostMapping("/remove")@ResponseBodypublic AjaxResult remove(String ids){return toAjax(configService.deleteConfigByIds(ids));}/*** 校验参数键名*/@PostMapping("/checkConfigKeyUnique")@ResponseBodypublic String checkConfigKeyUnique(SysConfig config){return configService.checkConfigKeyUnique(config);}
}
View Code
SysDeptController。java---------部门信息增删改
package com.ruoyi.web.controller.system;import java.util.List;
import java.util.Map;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.system.domain.SysDept;
import com.ruoyi.system.domain.SysRole;
import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.web.core.base.BaseController;/*** 部门信息* * @author ruoyi*/
@Controller
@RequestMapping("/system/dept")
public class SysDeptController extends BaseController
{private String prefix = "system/dept";@Autowiredprivate ISysDeptService deptService;@RequiresPermissions("system:dept:view")@GetMapping()public String dept(){return prefix + "/dept";}@RequiresPermissions("system:dept:list")@GetMapping("/list")@ResponseBodypublic List<SysDept> list(SysDept dept){List<SysDept> deptList = deptService.selectDeptList(dept);return deptList;}/*** 新增部门*/@GetMapping("/add/{parentId}")public String add(@PathVariable("parentId") Long parentId, ModelMap mmap){mmap.put("dept", deptService.selectDeptById(parentId));return prefix + "/add";}/*** 新增保存部门*/@Log(title = "部门管理", businessType = BusinessType.INSERT)@RequiresPermissions("system:dept:add")@PostMapping("/add")@ResponseBodypublic AjaxResult addSave(SysDept dept){dept.setCreateBy(ShiroUtils.getLoginName());return toAjax(deptService.insertDept(dept));}/*** 修改*/@GetMapping("/edit/{deptId}")public String edit(@PathVariable("deptId") Long deptId, ModelMap mmap){SysDept dept = deptService.selectDeptById(deptId);if (StringUtils.isNotNull(dept) && 100L == deptId){dept.setParentName("无");}mmap.put("dept", dept);return prefix + "/edit";}/*** 保存*/@Log(title = "部门管理", businessType = BusinessType.UPDATE)@RequiresPermissions("system:dept:edit")@PostMapping("/edit")@ResponseBodypublic AjaxResult editSave(SysDept dept){dept.setUpdateBy(ShiroUtils.getLoginName());return toAjax(deptService.updateDept(dept));}/*** 删除*/@Log(title = "部门管理", businessType = BusinessType.DELETE)@RequiresPermissions("system:dept:remove")@PostMapping("/remove/{deptId}")@ResponseBodypublic AjaxResult remove(@PathVariable("deptId") Long deptId){if (deptService.selectDeptCount(deptId) > 0){return error(1, "存在下级部门,不允许删除");}if (deptService.checkDeptExistUser(deptId)){return error(1, "部门存在用户,不允许删除");}return toAjax(deptService.deleteDeptById(deptId));}/*** 校验部门名称*/@PostMapping("/checkDeptNameUnique")@ResponseBodypublic String checkDeptNameUnique(SysDept dept){return deptService.checkDeptNameUnique(dept);}/*** 选择部门树*/@GetMapping("/selectDeptTree/{deptId}")public String selectDeptTree(@PathVariable("deptId") Long deptId, ModelMap mmap){mmap.put("dept", deptService.selectDeptById(deptId));return prefix + "/tree";}/*** 加载部门列表树*/@GetMapping("/treeData")@ResponseBodypublic List<Map<String, Object>> treeData(){List<Map<String, Object>> tree = deptService.selectDeptTree();return tree;}/*** 加载角色部门(数据权限)列表树*/@GetMapping("/roleDeptTreeData")@ResponseBodypublic List<Map<String, Object>> deptTreeData(SysRole role){List<Map<String, Object>> tree = deptService.roleDeptTreeData(role);return tree;}
}
View Code
SysDictDataController.java--------数据字典数据增删改

package com.ruoyi.web.controller.system;import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ExcelUtil;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.system.domain.SysDictData;
import com.ruoyi.system.service.ISysDictDataService;
import com.ruoyi.web.core.base.BaseController;/*** 数据字典信息* * @author ruoyi*/
@Controller
@RequestMapping("/system/dict/data")
public class SysDictDataController extends BaseController
{private String prefix = "system/dict/data";@Autowiredprivate ISysDictDataService dictDataService;@RequiresPermissions("system:dict:view")@GetMapping()public String dictData(){return prefix + "/data";}@PostMapping("/list")@RequiresPermissions("system:dict:list")@ResponseBodypublic TableDataInfo list(SysDictData dictData){startPage();List<SysDictData> list = dictDataService.selectDictDataList(dictData);return getDataTable(list);}@Log(title = "字典数据", businessType = BusinessType.EXPORT)@RequiresPermissions("system:dict:export")@PostMapping("/export")@ResponseBodypublic AjaxResult export(SysDictData dictData){List<SysDictData> list = dictDataService.selectDictDataList(dictData);ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);return util.exportExcel(list, "dictData");}/*** 新增字典类型*/@GetMapping("/add/{dictType}")public String add(@PathVariable("dictType") String dictType, ModelMap mmap){mmap.put("dictType", dictType);return prefix + "/add";}/*** 新增保存字典类型*/@Log(title = "字典数据", businessType = BusinessType.INSERT)@RequiresPermissions("system:dict:add")@PostMapping("/add")@ResponseBodypublic AjaxResult addSave(SysDictData dict){dict.setCreateBy(ShiroUtils.getLoginName());return toAjax(dictDataService.insertDictData(dict));}/*** 修改字典类型*/@GetMapping("/edit/{dictCode}")public String edit(@PathVariable("dictCode") Long dictCode, ModelMap mmap){mmap.put("dict", dictDataService.selectDictDataById(dictCode));return prefix + "/edit";}/*** 修改保存字典类型*/@Log(title = "字典数据", businessType = BusinessType.UPDATE)@RequiresPermissions("system:dict:edit")@PostMapping("/edit")@ResponseBodypublic AjaxResult editSave(SysDictData dict){dict.setUpdateBy(ShiroUtils.getLoginName());return toAjax(dictDataService.updateDictData(dict));}@Log(title = "字典数据", businessType = BusinessType.DELETE)@RequiresPermissions("system:dict:remove")@PostMapping("/remove")@ResponseBodypublic AjaxResult remove(String ids){return toAjax(dictDataService.deleteDictDataByIds(ids));}
}
View Code

SysDictTypeController.java--------数据字典类型增删改
package com.ruoyi.web.controller.system;import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ExcelUtil;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.system.domain.SysDictType;
import com.ruoyi.system.service.ISysDictTypeService;
import com.ruoyi.web.core.base.BaseController;/*** 数据字典类型信息* * @author ruoyi*/
@Controller
@RequestMapping("/system/dict")
public class SysDictTypeController extends BaseController
{private String prefix = "system/dict/type";@Autowiredprivate ISysDictTypeService dictTypeService;@RequiresPermissions("system:dict:view")@GetMapping()public String dictType(){return prefix + "/type";}@PostMapping("/list")@RequiresPermissions("system:dict:list")@ResponseBodypublic TableDataInfo list(SysDictType dictType){startPage();List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);return getDataTable(list);}@Log(title = "字典类型", businessType = BusinessType.EXPORT)@RequiresPermissions("system:dict:export")@PostMapping("/export")@ResponseBodypublic AjaxResult export(SysDictType dictType){List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);return util.exportExcel(list, "dictType");}/*** 新增字典类型*/@GetMapping("/add")public String add(){return prefix + "/add";}/*** 新增保存字典类型*/@Log(title = "字典类型", businessType = BusinessType.INSERT)@RequiresPermissions("system:dict:add")@PostMapping("/add")@ResponseBodypublic AjaxResult addSave(SysDictType dict){dict.setCreateBy(ShiroUtils.getLoginName());return toAjax(dictTypeService.insertDictType(dict));}/*** 修改字典类型*/@GetMapping("/edit/{dictId}")public String edit(@PathVariable("dictId") Long dictId, ModelMap mmap){mmap.put("dict", dictTypeService.selectDictTypeById(dictId));return prefix + "/edit";}/*** 修改保存字典类型*/@Log(title = "字典类型", businessType = BusinessType.UPDATE)@RequiresPermissions("system:dict:edit")@PostMapping("/edit")@ResponseBodypublic AjaxResult editSave(SysDictType dict){dict.setUpdateBy(ShiroUtils.getLoginName());return toAjax(dictTypeService.updateDictType(dict));}@Log(title = "字典类型", businessType = BusinessType.DELETE)@RequiresPermissions("system:dict:remove")@PostMapping("/remove")@ResponseBodypublic AjaxResult remove(String ids){try{return toAjax(dictTypeService.deleteDictTypeByIds(ids));}catch (Exception e){return error(e.getMessage());}}/*** 查询字典详细*/@RequiresPermissions("system:dict:list")@GetMapping("/detail/{dictId}")public String detail(@PathVariable("dictId") Long dictId, ModelMap mmap){mmap.put("dict", dictTypeService.selectDictTypeById(dictId));mmap.put("dictList", dictTypeService.selectDictTypeAll());return "system/dict/data/data";}/*** 校验字典类型*/@PostMapping("/checkDictTypeUnique")@ResponseBodypublic String checkDictTypeUnique(SysDictType dictType){return dictTypeService.checkDictTypeUnique(dictType);}
}
View Code
SysIndexController.java--------首页的业务处理
package com.ruoyi.web.controller.system;import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import com.ruoyi.common.config.Global;
import com.ruoyi.system.domain.SysMenu;
import com.ruoyi.system.domain.SysUser;
import com.ruoyi.system.service.ISysMenuService;
import com.ruoyi.web.core.base.BaseController;/*** 首页 业务处理* * @author ruoyi*/
@Controller
public class SysIndexController extends BaseController
{@Autowiredprivate ISysMenuService menuService;// 系统首页@GetMapping("/index")public String index(ModelMap mmap){// 取身份信息SysUser user = getUser();// 根据用户id取出菜单List<SysMenu> menus = menuService.selectMenusByUser(user);mmap.put("menus", menus);mmap.put("user", user);mmap.put("copyrightYear", Global.getCopyrightYear());return "index";}// 系统介绍@GetMapping("/system/main")public String main(ModelMap mmap){mmap.put("version", Global.getVersion());return "main";}
}
View Code
SysLoginController.java-------用户登陆验证
package com.ruoyi.web.controller.system;import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.util.ServletUtils;
import com.ruoyi.web.core.base.BaseController;/*** 登录验证* * @author ruoyi*/
@Controller
public class SysLoginController extends BaseController
{@GetMapping("/login")public String login(HttpServletRequest request, HttpServletResponse response){// 如果是Ajax请求,返回Json字符串。if (ServletUtils.isAjaxRequest(request)){return ServletUtils.renderString(response, "{\"code\":\"1\",\"msg\":\"未登录或登录超时。请重新登录\"}");}return "login";}@PostMapping("/login")@ResponseBodypublic AjaxResult ajaxLogin(String username, String password, Boolean rememberMe){UsernamePasswordToken token = new UsernamePasswordToken(username, password, rememberMe);Subject subject = SecurityUtils.getSubject();try{subject.login(token);return success();}catch (AuthenticationException e){String msg = "用户或密码错误";if (StringUtils.isNotEmpty(e.getMessage())){msg = e.getMessage();}return error(msg);}}@GetMapping("/unauth")public String unauth(){return "/error/unauth";}
}
View Code
SysMenuController.java----------菜单信息
package com.ruoyi.web.controller.system;import java.util.List;
import java.util.Map;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.system.domain.SysMenu;
import com.ruoyi.system.domain.SysRole;
import com.ruoyi.system.service.ISysMenuService;
import com.ruoyi.web.core.base.BaseController;/*** 菜单信息* * @author ruoyi*/
@Controller
@RequestMapping("/system/menu")
public class SysMenuController extends BaseController
{private String prefix = "system/menu";@Autowiredprivate ISysMenuService menuService;@RequiresPermissions("system:menu:view")@GetMapping()public String menu(){return prefix + "/menu";}@RequiresPermissions("system:menu:list")@GetMapping("/list")@ResponseBodypublic List<SysMenu> list(SysMenu menu){List<SysMenu> menuList = menuService.selectMenuList(menu);return menuList;}/*** 删除菜单*/@Log(title = "菜单管理", businessType = BusinessType.DELETE)@RequiresPermissions("system:menu:remove")@PostMapping("/remove/{menuId}")@ResponseBodypublic AjaxResult remove(@PathVariable("menuId") Long menuId){if (menuService.selectCountMenuByParentId(menuId) > 0){return error(1, "存在子菜单,不允许删除");}if (menuService.selectCountRoleMenuByMenuId(menuId) > 0){return error(1, "菜单已分配,不允许删除");}ShiroUtils.clearCachedAuthorizationInfo();return toAjax(menuService.deleteMenuById(menuId));}/*** 新增*/@GetMapping("/add/{parentId}")public String add(@PathVariable("parentId") Long parentId, ModelMap mmap){SysMenu menu = null;if (0L != parentId){menu = menuService.selectMenuById(parentId);}else{menu = new SysMenu();menu.setMenuId(0L);menu.setMenuName("主目录");}mmap.put("menu", menu);return prefix + "/add";}/*** 新增保存菜单*/@Log(title = "菜单管理", businessType = BusinessType.INSERT)@RequiresPermissions("system:menu:add")@PostMapping("/add")@ResponseBodypublic AjaxResult addSave(SysMenu menu){menu.setCreateBy(ShiroUtils.getLoginName());ShiroUtils.clearCachedAuthorizationInfo();return toAjax(menuService.insertMenu(menu));}/*** 修改菜单*/@GetMapping("/edit/{menuId}")public String edit(@PathVariable("menuId") Long menuId, ModelMap mmap){mmap.put("menu", menuService.selectMenuById(menuId));return prefix + "/edit";}/*** 修改保存菜单*/@Log(title = "菜单管理", businessType = BusinessType.UPDATE)@RequiresPermissions("system:menu:edit")@PostMapping("/edit")@ResponseBodypublic AjaxResult editSave(SysMenu menu){menu.setUpdateBy(ShiroUtils.getLoginName());ShiroUtils.clearCachedAuthorizationInfo();return toAjax(menuService.updateMenu(menu));}/*** 选择菜单图标*/@GetMapping("/icon")public String icon(){return prefix + "/icon";}/*** 校验菜单名称*/@PostMapping("/checkMenuNameUnique")@ResponseBodypublic String checkMenuNameUnique(SysMenu menu){return menuService.checkMenuNameUnique(menu);}/*** 加载角色菜单列表树*/@GetMapping("/roleMenuTreeData")@ResponseBodypublic List<Map<String, Object>> roleMenuTreeData(SysRole role){List<Map<String, Object>> tree = menuService.roleMenuTreeData(role);return tree;}/*** 加载所有菜单列表树*/@GetMapping("/menuTreeData")@ResponseBodypublic List<Map<String, Object>> menuTreeData(SysRole role){List<Map<String, Object>> tree = menuService.menuTreeData();return tree;}/*** 选择菜单树*/@GetMapping("/selectMenuTree/{menuId}")public String selectMenuTree(@PathVariable("menuId") Long menuId, ModelMap mmap){mmap.put("menu", menuService.selectMenuById(menuId));return prefix + "/tree";}
}
View Code
SysNoticeController.java---------公告信息操作处理
package com.ruoyi.web.controller.system;import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.system.domain.SysNotice;
import com.ruoyi.system.service.ISysNoticeService;
import com.ruoyi.web.core.base.BaseController;/*** 公告 信息操作处理* * @author ruoyi*/
@Controller
@RequestMapping("/system/notice")
public class SysNoticeController extends BaseController
{private String prefix = "system/notice";@Autowiredprivate ISysNoticeService noticeService;@RequiresPermissions("system:notice:view")@GetMapping()public String notice(){return prefix + "/notice";}/*** 查询公告列表*/@RequiresPermissions("system:notice:list")@PostMapping("/list")@ResponseBodypublic TableDataInfo list(SysNotice notice){startPage();List<SysNotice> list = noticeService.selectNoticeList(notice);return getDataTable(list);}/*** 新增公告*/@GetMapping("/add")public String add(){return prefix + "/add";}/*** 新增保存公告*/@RequiresPermissions("system:notice:add")@Log(title = "通知公告", businessType = BusinessType.INSERT)@PostMapping("/add")@ResponseBodypublic AjaxResult addSave(SysNotice notice){notice.setCreateBy(ShiroUtils.getLoginName());return toAjax(noticeService.insertNotice(notice));}/*** 修改公告*/@GetMapping("/edit/{noticeId}")public String edit(@PathVariable("noticeId") Long noticeId, ModelMap mmap){mmap.put("notice", noticeService.selectNoticeById(noticeId));return prefix + "/edit";}/*** 修改保存公告*/@RequiresPermissions("system:notice:edit")@Log(title = "通知公告", businessType = BusinessType.UPDATE)@PostMapping("/edit")@ResponseBodypublic AjaxResult editSave(SysNotice notice){notice.setUpdateBy(ShiroUtils.getLoginName());return toAjax(noticeService.updateNotice(notice));}/*** 删除公告*/@RequiresPermissions("system:notice:remove")@Log(title = "通知公告", businessType = BusinessType.DELETE)@PostMapping("/remove")@ResponseBodypublic AjaxResult remove(String ids){return toAjax(noticeService.deleteNoticeByIds(ids));}
}
View Code
SysPostController.java-----岗位信息操作处理

package com.ruoyi.web.controller.system;import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ExcelUtil;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.service.ISysPostService;
import com.ruoyi.web.core.base.BaseController;/*** 岗位信息操作处理* * @author ruoyi*/
@Controller
@RequestMapping("/system/post")
public class SysPostController extends BaseController
{private String prefix = "system/post";@Autowiredprivate ISysPostService postService;@RequiresPermissions("system:post:view")@GetMapping()public String operlog(){return prefix + "/post";}@RequiresPermissions("system:post:list")@PostMapping("/list")@ResponseBodypublic TableDataInfo list(SysPost post){startPage();List<SysPost> list = postService.selectPostList(post);return getDataTable(list);}@Log(title = "岗位管理", businessType = BusinessType.EXPORT)@RequiresPermissions("system:post:export")@PostMapping("/export")@ResponseBodypublic AjaxResult export(SysPost post){List<SysPost> list = postService.selectPostList(post);ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);return util.exportExcel(list, "post");}@RequiresPermissions("system:post:remove")@Log(title = "岗位管理", businessType = BusinessType.DELETE)@PostMapping("/remove")@ResponseBodypublic AjaxResult remove(String ids){try{return toAjax(postService.deletePostByIds(ids));}catch (Exception e){return error(e.getMessage());}}/*** 新增岗位*/@GetMapping("/add")public String add(){return prefix + "/add";}/*** 新增保存岗位*/@RequiresPermissions("system:post:add")@Log(title = "岗位管理", businessType = BusinessType.INSERT)@PostMapping("/add")@ResponseBodypublic AjaxResult addSave(SysPost post){post.setCreateBy(ShiroUtils.getLoginName());return toAjax(postService.insertPost(post));}/*** 修改岗位*/@GetMapping("/edit/{postId}")public String edit(@PathVariable("postId") Long postId, ModelMap mmap){mmap.put("post", postService.selectPostById(postId));return prefix + "/edit";}/*** 修改保存岗位*/@RequiresPermissions("system:post:edit")@Log(title = "岗位管理", businessType = BusinessType.UPDATE)@PostMapping("/edit")@ResponseBodypublic AjaxResult editSave(SysPost post){post.setUpdateBy(ShiroUtils.getLoginName());return toAjax(postService.updatePost(post));}/*** 校验岗位名称*/@PostMapping("/checkPostNameUnique")@ResponseBodypublic String checkPostNameUnique(SysPost post){return postService.checkPostNameUnique(post);}/*** 校验岗位编码*/@PostMapping("/checkPostCodeUnique")@ResponseBodypublic String checkPostCodeUnique(SysPost post){return postService.checkPostCodeUnique(post);}
}
View Code
SysProfileController.java------个人信息业务处理
package com.ruoyi.web.controller.system;import org.apache.shiro.crypto.hash.Md5Hash;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.config.Global;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.framework.util.FileUploadUtils;
import com.ruoyi.system.domain.SysUser;
import com.ruoyi.system.service.ISysDictDataService;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.web.core.base.BaseController;/*** 个人信息 业务处理* * @author ruoyi*/
@Controller
@RequestMapping("/system/user/profile")
public class SysProfileController extends BaseController
{private static final Logger log = LoggerFactory.getLogger(SysProfileController.class);private String prefix = "system/user/profile";@Autowiredprivate ISysUserService userService;@Autowiredprivate ISysDictDataService dictDataService;/*** 个人信息*/@GetMapping()public String profile(ModelMap mmap){SysUser user = getUser();user.setSex(dictDataService.selectDictLabel("sys_user_sex", user.getSex()));mmap.put("user", user);mmap.put("roleGroup", userService.selectUserRoleGroup(user.getUserId()));mmap.put("postGroup", userService.selectUserPostGroup(user.getUserId()));return prefix + "/profile";}@GetMapping("/checkPassword")@ResponseBodypublic boolean checkPassword(String password){SysUser user = getUser();String encrypt = new Md5Hash(user.getLoginName() + password + user.getSalt()).toHex().toString();if (user.getPassword().equals(encrypt)){return true;}return false;}@GetMapping("/resetPwd/{userId}")public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap){mmap.put("user", userService.selectUserById(userId));return prefix + "/resetPwd";}@Log(title = "重置密码", businessType = BusinessType.UPDATE)@PostMapping("/resetPwd")@ResponseBodypublic AjaxResult resetPwd(SysUser user){int rows = userService.resetUserPwd(user);if (rows > 0){setUser(userService.selectUserById(user.getUserId()));return success();}return error();}/*** 修改用户*/@GetMapping("/edit/{userId}")public String edit(@PathVariable("userId") Long userId, ModelMap mmap){mmap.put("user", userService.selectUserById(userId));return prefix + "/edit";}/*** 修改头像*/@GetMapping("/avatar/{userId}")public String avatar(@PathVariable("userId") Long userId, ModelMap mmap){mmap.put("user", userService.selectUserById(userId));return prefix + "/avatar";}/*** 修改用户*/@Log(title = "个人信息", businessType = BusinessType.UPDATE)@PostMapping("/update")@ResponseBodypublic AjaxResult update(SysUser user){if (userService.updateUserInfo(user) > 0){setUser(userService.selectUserById(user.getUserId()));return success();}return error();}/*** 保存头像*/@Log(title = "个人信息", businessType = BusinessType.UPDATE)@PostMapping("/updateAvatar")@ResponseBodypublic AjaxResult updateAvatar(SysUser user, @RequestParam("avatarfile") MultipartFile file){try{if (!file.isEmpty()){String avatar = FileUploadUtils.upload(Global.getAvatarPath(), file);user.setAvatar(avatar);if (userService.updateUserInfo(user) > 0){setUser(userService.selectUserById(user.getUserId()));return success();}}return error();}catch (Exception e){log.error("修改头像失败!", e);return error(e.getMessage());}}
}
View Code
SysRoleController.java------角色信息
package com.ruoyi.web.controller.system;import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ExcelUtil;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.system.domain.SysRole;
import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.web.core.base.BaseController;/*** 角色信息* * @author ruoyi*/
@Controller
@RequestMapping("/system/role")
public class SysRoleController extends BaseController
{private String prefix = "system/role";@Autowiredprivate ISysRoleService roleService;@RequiresPermissions("system:role:view")@GetMapping()public String role(){return prefix + "/role";}@RequiresPermissions("system:role:list")@PostMapping("/list")@ResponseBodypublic TableDataInfo list(SysRole role){startPage();List<SysRole> list = roleService.selectRoleList(role);return getDataTable(list);}@Log(title = "角色管理", businessType = BusinessType.EXPORT)@RequiresPermissions("system:role:export")@PostMapping("/export")@ResponseBodypublic AjaxResult export(SysRole role){List<SysRole> list = roleService.selectRoleList(role);ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);return util.exportExcel(list, "role");}/*** 新增角色*/@GetMapping("/add")public String add(){return prefix + "/add";}/*** 新增保存角色*/@RequiresPermissions("system:role:add")@Log(title = "角色管理", businessType = BusinessType.INSERT)@PostMapping("/add")@Transactional(rollbackFor = Exception.class)@ResponseBodypublic AjaxResult addSave(SysRole role){role.setCreateBy(ShiroUtils.getLoginName());ShiroUtils.clearCachedAuthorizationInfo();return toAjax(roleService.insertRole(role));}/*** 修改角色*/@GetMapping("/edit/{roleId}")public String edit(@PathVariable("roleId") Long roleId, ModelMap mmap){mmap.put("role", roleService.selectRoleById(roleId));return prefix + "/edit";}/*** 修改保存角色*/@RequiresPermissions("system:role:edit")@Log(title = "角色管理", businessType = BusinessType.UPDATE)@PostMapping("/edit")@Transactional(rollbackFor = Exception.class)@ResponseBodypublic AjaxResult editSave(SysRole role){role.setUpdateBy(ShiroUtils.getLoginName());ShiroUtils.clearCachedAuthorizationInfo();return toAjax(roleService.updateRole(role));}/*** 新增数据权限*/@GetMapping("/rule/{roleId}")public String rule(@PathVariable("roleId") Long roleId, ModelMap mmap){mmap.put("role", roleService.selectRoleById(roleId));return prefix + "/rule";}/*** 修改保存数据权限*/@RequiresPermissions("system:role:edit")@Log(title = "角色管理", businessType = BusinessType.UPDATE)@PostMapping("/rule")@Transactional(rollbackFor = Exception.class)@ResponseBodypublic AjaxResult ruleSave(SysRole role){role.setUpdateBy(ShiroUtils.getLoginName());return toAjax(roleService.updateRule(role));}@RequiresPermissions("system:role:remove")@Log(title = "角色管理", businessType = BusinessType.DELETE)@PostMapping("/remove")@ResponseBodypublic AjaxResult remove(String ids){try{return toAjax(roleService.deleteRoleByIds(ids));}catch (Exception e){return error(e.getMessage());}}/*** 校验角色名称*/@PostMapping("/checkRoleNameUnique")@ResponseBodypublic String checkRoleNameUnique(SysRole role){return roleService.checkRoleNameUnique(role);}/*** 校验角色权限*/@PostMapping("/checkRoleKeyUnique")@ResponseBodypublic String checkRoleKeyUnique(SysRole role){return roleService.checkRoleKeyUnique(role);}/*** 选择菜单树*/@GetMapping("/selectMenuTree")public String selectMenuTree(){return prefix + "/tree";}
}
View Code

SysUserController.java------用户信息

package com.ruoyi.web.controller.system;import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ExcelUtil;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.shiro.service.PasswordService;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.system.domain.SysUser;
import com.ruoyi.system.service.ISysPostService;
import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.web.core.base.BaseController;/*** 用户信息* * @author ruoyi*/
@Controller
@RequestMapping("/system/user")
public class SysUserController extends BaseController
{private String prefix = "system/user";@Autowiredprivate ISysUserService userService;@Autowiredprivate ISysRoleService roleService;@Autowiredprivate ISysPostService postService;@Autowiredprivate PasswordService passwordService;@RequiresPermissions("system:user:view")@GetMapping()public String user(){return prefix + "/user";}@RequiresPermissions("system:user:list")@PostMapping("/list")@ResponseBodypublic TableDataInfo list(SysUser user){startPage();List<SysUser> list = userService.selectUserList(user);return getDataTable(list);}@Log(title = "用户管理", businessType = BusinessType.EXPORT)@RequiresPermissions("system:user:export")@PostMapping("/export")@ResponseBodypublic AjaxResult export(SysUser user){List<SysUser> list = userService.selectUserList(user);ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);return util.exportExcel(list, "user");}/*** 新增用户*/@GetMapping("/add")public String add(ModelMap mmap){mmap.put("roles", roleService.selectRoleAll());mmap.put("posts", postService.selectPostAll());return prefix + "/add";}/*** 新增保存用户*/@RequiresPermissions("system:user:add")@Log(title = "用户管理", businessType = BusinessType.INSERT)@PostMapping("/add")@Transactional(rollbackFor = Exception.class)@ResponseBodypublic AjaxResult addSave(SysUser user){if (StringUtils.isNotNull(user.getUserId()) && SysUser.isAdmin(user.getUserId())){return error("不允许修改超级管理员用户");}user.setSalt(ShiroUtils.randomSalt());user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));user.setCreateBy(ShiroUtils.getLoginName());return toAjax(userService.insertUser(user));}/*** 修改用户*/@GetMapping("/edit/{userId}")public String edit(@PathVariable("userId") Long userId, ModelMap mmap){mmap.put("user", userService.selectUserById(userId));mmap.put("roles", roleService.selectRolesByUserId(userId));mmap.put("posts", postService.selectPostsByUserId(userId));return prefix + "/edit";}/*** 修改保存用户*/@RequiresPermissions("system:user:edit")@Log(title = "用户管理", businessType = BusinessType.UPDATE)@PostMapping("/edit")@Transactional(rollbackFor = Exception.class)@ResponseBodypublic AjaxResult editSave(SysUser user){if (StringUtils.isNotNull(user.getUserId()) && SysUser.isAdmin(user.getUserId())){return error("不允许修改超级管理员用户");}user.setUpdateBy(ShiroUtils.getLoginName());return toAjax(userService.updateUser(user));}@RequiresPermissions("system:user:resetPwd")@Log(title = "重置密码", businessType = BusinessType.UPDATE)@GetMapping("/resetPwd/{userId}")public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap){mmap.put("user", userService.selectUserById(userId));return prefix + "/resetPwd";}@RequiresPermissions("system:user:resetPwd")@Log(title = "重置密码", businessType = BusinessType.UPDATE)@PostMapping("/resetPwd")@ResponseBodypublic AjaxResult resetPwdSave(SysUser user){user.setSalt(ShiroUtils.randomSalt());user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));return toAjax(userService.resetUserPwd(user));}@RequiresPermissions("system:user:remove")@Log(title = "用户管理", businessType = BusinessType.DELETE)@PostMapping("/remove")@ResponseBodypublic AjaxResult remove(String ids){try{return toAjax(userService.deleteUserByIds(ids));}catch (Exception e){return error(e.getMessage());}}/*** 校验用户名*/@PostMapping("/checkLoginNameUnique")@ResponseBodypublic String checkLoginNameUnique(SysUser user){return userService.checkLoginNameUnique(user.getLoginName());}/*** 校验手机号码*/@PostMapping("/checkPhoneUnique")@ResponseBodypublic String checkPhoneUnique(SysUser user){return userService.checkPhoneUnique(user);}/*** 校验email邮箱*/@PostMapping("/checkEmailUnique")@ResponseBodypublic String checkEmailUnique(SysUser user){return userService.checkEmailUnique(user);}
}
View Code

-----------tool包

BuildController.java-----表单构建
package com.ruoyi.web.controller.tool;import com.ruoyi.system.dto.LeiPiDto;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.web.core.base.BaseController;import java.util.Map;/*** build 表单构建** @author ruoyi*/
@Controller
@RequestMapping("/tool")
public class BuildController extends BaseController {private String prefix = "tool/build";@RequiresPermissions("tool:build:view")@GetMapping("/build")public String build() {return prefix + "/build";}@GetMapping("leipi")@RequiresPermissions("tool:leipi:view")public String leipi() {return "tool/build/leipi";}@PostMapping("testGetLeiPiHtml")@ResponseBodypublic String testGetLeiPiHtml(@RequestBody LeiPiDto dto) {System.out.println("Received parametes: " + dto.getHtmlStr());return dto.getHtmlStr();}
}
View Code
GenController.java------代码生成操作
package com.ruoyi.web.controller.tool;import java.io.IOException;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.IOUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.support.Convert;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.generator.domain.TableInfo;
import com.ruoyi.generator.service.IGenService;
import com.ruoyi.web.core.base.BaseController;/*** 代码生成 操作处理* * @author ruoyi*/
@Controller
@RequestMapping("/tool/gen")
public class GenController extends BaseController
{private String prefix = "tool/gen";@Autowiredprivate IGenService genService;@RequiresPermissions("tool:gen:view")@GetMapping()public String gen(){return prefix + "/gen";}@RequiresPermissions("tool:gen:list")@PostMapping("/list")@ResponseBodypublic TableDataInfo list(TableInfo tableInfo){startPage();List<TableInfo> list = genService.selectTableList(tableInfo);return getDataTable(list);}/*** 生成代码*/@RequiresPermissions("tool:gen:code")@Log(title = "代码生成", businessType = BusinessType.GENCODE)@GetMapping("/genCode/{tableName}")public void genCode(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException{byte[] data = genService.generatorCode(tableName);response.reset();response.setHeader("Content-Disposition", "attachment; filename=\"ruoyi.zip\"");response.addHeader("Content-Length", "" + data.length);response.setContentType("application/octet-stream; charset=UTF-8");IOUtils.write(data, response.getOutputStream());}/*** 批量生成代码*/@RequiresPermissions("tool:gen:code")@Log(title = "代码生成", businessType = BusinessType.GENCODE)@GetMapping("/batchGenCode")@ResponseBodypublic void batchGenCode(HttpServletResponse response, String tables) throws IOException{String[] tableNames = Convert.toStrArray(tables);byte[] data = genService.generatorCode(tableNames);response.reset();response.setHeader("Content-Disposition", "attachment; filename=\"ruoyi.zip\"");response.addHeader("Content-Length", "" + data.length);response.setContentType("application/octet-stream; charset=UTF-8");IOUtils.write(data, response.getOutputStream());}
}
View Code
SwaggerController.java------swagger接口
package com.ruoyi.web.controller.tool;import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.web.core.base.BaseController;/*** swagger 接口* 一种可以写API文档的工具* * @author ruoyi*/
@Controller
@RequestMapping("/tool/swagger")
public class SwaggerController extends BaseController
{@RequiresPermissions("tool:swagger:view")@GetMapping()public String index(){return redirect("/swagger-ui.html");}
}
View Code
TestController.java-----swagger测试方法
package com.ruoyi.web.controller.tool;import java.util.ArrayList;
import java.util.List;import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.web.core.base.BaseController;import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;/*** swagger 测试方法* * @author ruoyi*/
@Api("用户信息管理")
@RestController
@RequestMapping("/test/*")
public class TestController extends BaseController
{private final static List<Test> testList = new ArrayList<>();{testList.add(new Test("1", "admin", "admin123"));testList.add(new Test("2", "ry", "admin123"));}@ApiOperation("获取列表")@GetMapping("list")public List<Test> testList(){return testList;}@ApiOperation("新增用户")@PostMapping("save")public AjaxResult save(Test test){return testList.add(test) ? success() : error();}@ApiOperation("更新用户")@ApiImplicitParam(name = "Test", value = "单个用户信息", dataType = "Test")@PutMapping("update")public AjaxResult update(Test test){return testList.remove(test) && testList.add(test) ? success() : error();}@ApiOperation("删除用户")@ApiImplicitParam(name = "Tests", value = "单个用户信息", dataType = "Test")@DeleteMapping("delete")public AjaxResult delete(Test test){return testList.remove(test) ? success() : error();}
}class Test
{private String userId;private String username;private String password;public Test(){}public Test(String userId, String username, String password){this.userId = userId;this.username = username;this.password = password;}@Overridepublic boolean equals(Object o){if (this == o){return true;}if (o == null || getClass() != o.getClass()){return false;}Test test = (Test) o;return userId != null ? userId.equals(test.userId) : test.userId == null;}@Overridepublic int hashCode(){int result = userId != null ? userId.hashCode() : 0;result = 31 * result + (username != null ? username.hashCode() : 0);result = 31 * result + (password != null ? password.hashCode() : 0);return result;}public String getUserId(){return userId;}public void setUserId(String userId){this.userId = userId;}public String getUsername(){return username;}public void setUsername(String username){this.username = username;}public String getPassword(){return password;}public void setPassword(String password){this.password = password;}
}
View Code

-----core包

-----------base包

BaseController.java------web层通用数据业务处理
package com.ruoyi.web.core.base;import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.framework.web.page.PageDomain;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.framework.web.page.TableSupport;
import com.ruoyi.system.domain.SysUser;/*** web层通用数据处理* * @author ruoyi*/
public class BaseController
{/*** 将前台传递过来的日期格式的字符串,自动转化为Date类型*/@InitBinderpublic void initBinder(WebDataBinder binder){SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");dateFormat.setLenient(false);binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));}/*** 设置请求分页数据*/protected void startPage(){PageDomain pageDomain = TableSupport.buildPageRequest();Integer pageNum = pageDomain.getPageNum();Integer pageSize = pageDomain.getPageSize();if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){String orderBy = pageDomain.getOrderBy();PageHelper.startPage(pageNum, pageSize, orderBy);}}/*** 响应请求分页数据*/@SuppressWarnings({ "rawtypes", "unchecked" })protected TableDataInfo getDataTable(List<?> list){TableDataInfo rspData = new TableDataInfo();rspData.setCode(0);rspData.setRows(list);rspData.setTotal(new PageInfo(list).getTotal());return rspData;}/*** 响应返回结果* * @param rows 影响行数* @return 操作结果*/protected AjaxResult toAjax(int rows){return rows > 0 ? success() : error();}/*** 返回成功*/public AjaxResult success(){return AjaxResult.success();}/*** 返回失败消息*/public AjaxResult error(){return AjaxResult.error();}/*** 返回成功消息*/public AjaxResult success(String message){return AjaxResult.success(message);}/*** 返回失败消息*/public AjaxResult error(String message){return AjaxResult.error(message);}/*** 返回错误码消息*/public AjaxResult error(int code, String message){return AjaxResult.error(code, message);}/*** 页面跳转*/public String redirect(String url){return StringUtils.format("redirect:{}", url);}public SysUser getUser(){return ShiroUtils.getUser();}public void setUser(SysUser user){ShiroUtils.setUser(user);}public Long getUserId(){return getUser().getUserId();}public String getLoginName(){return getUser().getLoginName();}
}
View Code

三,一、resources包

--ehcache包

ehcache-shiro.xml--------
一个纯Java的进程内缓存框架的配置

<?xml version="1.0" encoding="UTF-8"?>
<ehcache name="ruoyi"><!-- 磁盘缓存位置 --><diskStore path="java.io.tmpdir"/><!-- 默认缓存 --><defaultCachemaxEntriesLocalHeap="1000"eternal="false"timeToIdleSeconds="3600"timeToLiveSeconds="3600"overflowToDisk="false"></defaultCache><!-- 登录记录缓存 锁定10分钟 --><cache name="loginRecordCache"maxEntriesLocalHeap="2000"eternal="false"timeToIdleSeconds="600"timeToLiveSeconds="0"overflowToDisk="false"statistics="true"></cache></ehcache>
View Code

--i18n包

messages-properties-------

提示错误消息

#错误消息
not.null=* 必须填写
user.jcaptcha.error=验证码错误
user.not.exists=用户不存在/密码错误
user.password.not.match=用户不存在/密码错误
user.password.retry.limit.count=密码输入错误{0}次
user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定10分钟
user.password.delete=对不起,您的账号已被删除
user.blocked=用户已封禁,原因:{0}
role.blocked=角色已封禁,原因:{0}
user.logout.success=退出成功length.not.valid=长度必须在{min}到{max}个字符之间user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头
user.password.not.valid=* 5-50个字符user.email.not.valid=邮箱格式错误
user.mobile.phone.number.not.valid=手机号格式错误
user.login.success=登录成功
user.notfound=请重新登录
user.forcelogout=管理员强制退出,请重新登录
user.unknown.error=未知错误,请重新登录#批量插入用户错误信息
user.import.excel.null=Excel数据为空,请按照导入模板填写数据
user.import.excel.data.null=Excel数据为空,只有标题行,请按照导入模板填写数据
user.import.excel.filetype.error=文件不是Excel文件
user.import.excel.file.error=文件名为空,文件为空
user.import.excel.fileinput.error=获取Excel2003流错误
user.import.excel.fileinputx.error=获取Excel2007流错误
##权限
no.permission=您没有数据的权限,请联系管理员添加权限 [{0}]
no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}]
no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}]
no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}]
no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}]
no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}]
View Code

--static包

本包装了

ajax.libs包-----ajax框架

css包-----页面样式

font包----字体字号

img包----图标

js包-----事件驱动

ruoyi包------网页事件驱动和样式

--tenplates包----------系统的全部静态页面html

转载于:https://www.cnblogs.com/zhzJAVA11/p/9996988.html

相关文章:

ceph-objectstore-tool工具使用详解

文章目录简介使用OSD相关操作PG相关操作对象相关操作总结简介 ceph-objectstore-tool工具&#xff0c;能够操作到ceph最底层的数据&#xff0c;包括pg,对象层级。它能够对底层pg以及对象相关数据进行获取、修改。并能够对一些问题pg和对象进行简单修复。所以使用该工具进行操作…

slf4j导入那个依赖_学习SPRINGBOOT结合日志门面SLF4J和日志实现LOGBACK的混合使用

一、此处主要介绍在springboot工程下如何使用 logback slf4j 进行日志记录。logback主要包含三个组成部分&#xff1a;Loggers(日志记录器)、Appenders(输出目的在)、Layouts(日志输出格式) slf4j &#xff1a;如jdbc一样&#xff0c;定义了一套接口&#xff0c;是一个日志门面…

linux下发布的执行文件崩溃的问题定位 心得一则

C Release版本发布到客户处执行时&#xff0c;如果程序崩溃&#xff0c;有什么办法能够快速的确认程序的问题呢&#xff1f; 如果能gdb调试的话&#xff0c;比较简单了&#xff0c;可以使用gdb命令&#xff0c;类似如下&#xff1a;gdb ##set args ****b mainr#eipx/10i 0xb736…

7 个漂亮的 JavaScript 的时间轴组件 [转]

时间轴&#xff1a;通过互联网技术&#xff0c;依据时间顺序&#xff0c;把一方面或多方面的 时间足迹事件串联起来&#xff0c;形成相对完整的记录体系&#xff0c;再运用图文的形式呈现给用户&#xff1b;时间轴可以运用于不同领域&#xff0c;最大的作用就是把过去的事物系统…

Python 学习笔记: 反射

Python 反射应用 例子1&#xff1a; class Person:def __init__(self, name, age):self.name nameself.age agedef show(self):print(%s \s age is %s%(self.name, self.age))alex Person(alex, 18) # alex.show() if hasattr(alex, show):getattr(alex, show)() 转载于:ht…

C++多线程:互斥变量 std::mutex

文章目录描述成员函数总结描述 头文件 <mutex>使用 std::mutex <variable>简介 mutex是一种多线程变成中的同步原语&#xff0c;它能够让共享数据不被多个线程同时访问&#xff0c;它不支持递归得对互斥对象上锁特点 用方线程从它成功调用 lock 或 try_lock 开始&…

vim替换字符串带斜杠_Vim、gvim操作替换

~ 回复 以下关键词 查看更多IC设计教程 ~目前支持的关键词有&#xff1a;Innovus ICC or IC CompilerDC or Design Compiler PT or PrimeTimeUser Guide or UG LedaVCS Formality工艺节点 …

SharePoint2010沙盒解决方案基础开发——关于TreeView树形控件读取列表数据(树形导航)的webpart开发及问题...

转&#xff1a;http://blog.csdn.net/miragesky2049/article/details/7204882 SharePoint2010沙盒解决方案基础开发——关于TreeView树形控件读取列表数据&#xff08;树形导航&#xff09;的webpart开发及问题 1、实现效果如下&#xff1a; 点击各个节点进入相应的链接 2、测试…

智能医疗?轻松实现!

每个中国人都及其关注养老和住房问题&#xff0c;在中国每个人都十分有存钱的意识。就目前来看&#xff0c;现在的医疗和住房保障还没有能够满足我们现在的需求&#xff0c;因而&#xff0c;存钱显得尤为重要。我们关注医疗&#xff0c;是因为每个人都会面临年老&#xff0c;每…

TokuDB vs Innodb 基准测试对比

随着业务的发展以及mysql存储数据量的越来越大&#xff0c;很多超大表不仅仅存储变的不易&#xff0c;维护也变得越来越困难&#xff0c;特别是频繁的ddl操作让运维变得痛苦不堪。当然表拆分可以解决类似的问题&#xff0c;但是对一个稳定的系统来说&#xff0c;表拆分对业务的…

C++ 多线程:互斥对象 lock_gurad

描述 头文件:<mutex>声明方式: template< class Mutex > class lock_guard;简介 lock_guard是一种互斥包装器&#xff0c;它提供了非常便捷的raii资源管控技术用来在对象生存周期内提供互斥锁。 lock_gurad很好得解决了互斥变量mutex的锁成员在函数异常期间无法正…

太TM难看了,我自己都看不下去了

继续研究文件IO。 作用是用System.in输入一个文件路径&#xff0c;然后打印文件里的所有行。 而且虽然没仔细检查过&#xff0c;哦不就是因为没检查过&#xff0c;所以肯定不够健壮。 1 import java.io.*;2 import java.util.Scanner;3 4 public class test {5 public stat…

儿童吹泡泡水简单配方_自制泡泡水最简单配方的做法教程

泡泡吸引着各个年龄段的人&#xff0c;就像是反射彩虹的表面&#xff0c;在微风中漂浮。无论您是出于什么原因&#xff0c;都很容易在其中找到快乐。吹泡泡可以让小孩玩上几个小时&#xff0c;而大一点的孩子可以尝试制作最佳泡泡液。对于年轻的萌芽科学家来说&#xff0c;制备…

Linux系统下统计目录及其子目录文件个数

改变脚本权限&#xff1a;(这里假设你的脚本叫FileCount.sh) chmod ax FileCount.sh 脚本&#xff1a; 1 #!/bin/sh 2 echo 查看某目录下文件的个数 3 ls -l |grep "^-"|wc -l 4 5 echo 查看某目录下文件的个数&#xff0c;包括子目录里的。 6 ls -lR|grep "^-…

【Rsync项目实战一】备份全网服务器数据

目录 【Rsync项目实战】备份全网服务器数据 【企业案例】1.1 环境部署1.2 开始部署backup服务器&#xff1a;Rsync服务端过程&#xff1a;1.3 开始部署nfs01服务器&#xff1a;Rsync客户端过程&#xff1a;【Rsync项目实战】备份全网服务器数据 标签&#xff08;空格分隔&#…

C++ 多线程:条件变量 std::condition_variable

文章目录描述使用描述 头文件<condition_variable> 定义 class condition_variable; 简介 之前我们也已经介绍过了C多线程中互斥变量存在&#xff0c;已经足够支持多线程中对共享普通系统数据的合理访问。但是因为多线程中同一时刻必然会有一个线程持有锁&#xff0c;一…

小晶粒zsm分子筛合成表征实验报告_Nat. Mater.:区域选择性合成亚纳米金属-分子筛材料...

本文来自微信公众号&#xff1a;X-MOLNews亚纳米尺度的负载型催化剂是近些年多相催化领域以及相关材料科学领域的热门方向。围绕着单原子催化剂、团簇催化剂的论文如井喷一般出现在各大期刊上。关于亚纳米尺度金属催化剂的制备方法、表征方法、催化性能或是相关的理论研究都在如…

【翻译】使用新的Sencha Cmd 4命令app watch

原文&#xff1a;http://www.sencha.com/blog/using-the-new-app-watch-command-in-sencha-cmd-4/作者&#xff1a;Don Griffin Don Griffin is a member of the Ext JS core team. He was an Ext JS user for 2 years before joining Sencha and has over 20 years of softwar…

《设计模式解析(第2版)》

2019独角兽企业重金招聘Python工程师标准>>> 1. 软件开过程中的视角 视角 描述 概念 “软件要负责什么&#xff1f;” 规约 “怎么使用软件&#xff1f;” 实现 ”软件怎样履行自己的责任&#xff1f;“ 可能使用的另外一组视角&#xff1a;使用视角和创建/…

Nmap帮助文档解释

目标指定&#xff08;target specifiction&#xff09; 1、用法:Nmap[扫描类型][设置]{设备列表} 注&#xff1a;[]{} -> 中的内容必须有 <> -> 中的内容可以有可以没有 2、地址类型&#xff1a;主机名、ip地址、网段 3、-iL<文件名> 通过文件输入地址 4、-i…

C++ 多线程:future 异步访问类(线程之间安全便捷的数据共享)

文章目录future前言future描述future类成员使用总结future前言 首先查看如下代码 #include <iostream> #include <thread> #include <future> #include <mutex>using namespace std;void fun1(int n,int &x) {int res 1;for (int i n; i>1;…

bldc不同载波频率_广播百科 频率调制

∧ 请关注为星标&#xff0c;在知识的海洋每天进步1%第 463期频率调制&#xff0c;简称“调频”&#xff0c;它是一种使载波的瞬时频率随调制信号的变化规律而变化的调制方法。实现这种调制方法的电路称调频器,广泛用于调频广播、电视伴音、微波通信、锁相电路和扫频仪等方面。…

基于visual Studio2013解决面试题之0403串联字符串

&#xfeff;&#xfeff;&#xfeff;题目解决代码及点评/*有 n个长为 m1的字符串&#xff0c;如果某个字符串的最后m个字符与某个字符串的前m个字符匹配&#xff0c;则两个字符串可以联接&#xff0c;问这n个字符串最多可以连成一个多长的字符串&#xff0c;如果出现循环&…

MIT开放式课程“自然语言处理”介绍

MIT开放式课程“自然语言处理”介绍 发表于 2009年01月2号 由 52nlp从订阅的Google快讯上知道这个“麻省理工学院“开放式课程网页” | 电机工程与计算机科学 | 6.881 2004秋季课程&#xff1a;自然语言处理 | 课堂讲稿”网站&#xff0c;看介绍是MIT开放课程的中文翻译计划&am…

怎么将对象里面部分的属性放到一个空的对象里面去

var obj{name:jack,age:18,sex:male}var {name,age}objvar obj2{name,age}console.log(obj2) //{name: "jack", age: 18} 这是es6的用法 还有其他的3种方法,关于对象复制的 es6 var obj {name: jack,age: 18}var data Object.assign(obj)console.log(data) //{nam…

C++多线程:thread类创建线程的多种方式

文章目录描述函数成员简介总结描述 头文件 <thread> 声明方式&#xff1a;std::thread <obj> 简介 线程在构造关联的线程对象时立即开始执行&#xff0c;从提供给作为构造函数参数的顶层函数开始。如果顶层函数抛出异常&#xff0c;则调用 std::terminate。正如我…

C C++的编译过程详解

C/C编译过程C/C编译过程主要分为4个过程1) 编译预处理2) 编译、优化阶段3) 汇编过程4) 链接程序一、编译预处理&#xff08;1&#xff09;宏定义指令&#xff0c;如#define Name TokenString&#xff0c;#undef等。 对于前一个伪指令&#xff0c;预编译所要做的是将程序中的所有…

python queue 调试_学Python不是盲目的,是有做过功课认真去了解的

有多少伙伴是因为一句‘人生苦短&#xff0c;我用Python’萌生想法学Python的&#xff01;我跟大家更新过很多Python学习教程普及过多次的Python相关知识&#xff0c;不过大家还是还得计划一下Python学习路线&#xff01;Python入门前&#xff0c;你必须得知道这些&#xff0c;…

嘿嘿 刚刚进来 记录下

大家好&#xff0c;小弟刚刚进来&#xff0c;记录一下&#xff0c;发现这个网站真是太好了&#xff01;&#xff01;转载于:https://blog.51cto.com/wikowin/1112039

Oracle数据库查看表空间是否为自增的

表空间是有数据文件组成的&#xff0c;所以看表空间是否自增即看数据文件&#xff0c;如下查自增的表空间&#xff1a; select tablespace_name,file_name,autoextensible from dba_data_files where autoextensibleYES; autoextensible: YES/NO 即表示是否自增。 转载于:https…