修改返回结果为泛型方式
This commit is contained in:
@ -6,6 +6,8 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.model.Captcha;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.util.FastByteArrayOutputStream;
|
import org.springframework.util.FastByteArrayOutputStream;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@ -43,13 +45,16 @@ public class CaptchaController
|
|||||||
* 生成验证码
|
* 生成验证码
|
||||||
*/
|
*/
|
||||||
@GetMapping("/captchaImage")
|
@GetMapping("/captchaImage")
|
||||||
public AjaxResult getCode(HttpServletResponse response) throws IOException
|
public AjaxResult<Captcha> getCode(HttpServletResponse response) throws IOException
|
||||||
{
|
{
|
||||||
AjaxResult ajax = AjaxResult.success();
|
Captcha captcha = new Captcha();
|
||||||
|
AjaxResult<Captcha> ajax = AjaxResult.success(captcha);
|
||||||
boolean captchaEnabled = configService.selectCaptchaEnabled();
|
boolean captchaEnabled = configService.selectCaptchaEnabled();
|
||||||
ajax.put("captchaEnabled", captchaEnabled);
|
|
||||||
if (!captchaEnabled)
|
if (!captchaEnabled)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
captcha.setCaptchaEnabled(captchaEnabled);
|
||||||
|
|
||||||
return ajax;
|
return ajax;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,8 +92,8 @@ public class CaptchaController
|
|||||||
return AjaxResult.error(e.getMessage());
|
return AjaxResult.error(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
ajax.put("uuid", uuid);
|
captcha.setUuid(uuid);
|
||||||
ajax.put("img", Base64.encode(os.toByteArray()));
|
captcha.setImg(Base64.encode(os.toByteArray()));
|
||||||
return ajax;
|
return ajax;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.model.Upload;
|
||||||
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;
|
||||||
@ -22,13 +24,12 @@ import com.ruoyi.framework.config.ServerConfig;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用请求处理
|
* 通用请求处理
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/common")
|
@RequestMapping("/common")
|
||||||
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
|
||||||
@ -38,17 +39,14 @@ public class CommonController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用下载请求
|
* 通用下载请求
|
||||||
*
|
*
|
||||||
* @param fileName 文件名称
|
* @param fileName 文件名称
|
||||||
* @param delete 是否删除
|
* @param delete 是否删除
|
||||||
*/
|
*/
|
||||||
@GetMapping("/download")
|
@GetMapping("/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.checkAllowDownload(fileName)) {
|
||||||
{
|
|
||||||
if (!FileUtils.checkAllowDownload(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);
|
||||||
@ -57,13 +55,10 @@ public class CommonController
|
|||||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||||
FileUtils.setAttachmentResponseHeader(response, realFileName);
|
FileUtils.setAttachmentResponseHeader(response, realFileName);
|
||||||
FileUtils.writeBytes(filePath, response.getOutputStream());
|
FileUtils.writeBytes(filePath, response.getOutputStream());
|
||||||
if (delete)
|
if (delete) {
|
||||||
{
|
|
||||||
FileUtils.deleteFile(filePath);
|
FileUtils.deleteFile(filePath);
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
log.error("下载文件失败", e);
|
log.error("下载文件失败", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -72,24 +67,20 @@ public class CommonController
|
|||||||
* 通用上传请求(单个)
|
* 通用上传请求(单个)
|
||||||
*/
|
*/
|
||||||
@PostMapping("/upload")
|
@PostMapping("/upload")
|
||||||
public AjaxResult uploadFile(MultipartFile file) throws Exception
|
public AjaxResult uploadFile(MultipartFile file) throws Exception {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
// 上传文件路径
|
// 上传文件路径
|
||||||
String filePath = RuoYiConfig.getUploadPath();
|
String filePath = RuoYiConfig.getUploadPath();
|
||||||
// 上传并返回新文件名称
|
// 上传并返回新文件名称
|
||||||
String fileName = FileUploadUtils.upload(filePath, file);
|
String fileName = FileUploadUtils.upload(filePath, file);
|
||||||
String url = serverConfig.getUrl() + fileName;
|
String url = serverConfig.getUrl() + fileName;
|
||||||
AjaxResult ajax = AjaxResult.success();
|
Upload upload = new Upload();
|
||||||
ajax.put("url", url);
|
upload.setFileName(fileName);
|
||||||
ajax.put("fileName", fileName);
|
upload.setUrl(url);
|
||||||
ajax.put("newFileName", FileUtils.getName(fileName));
|
upload.setNewFileName(FileUtils.getName(fileName));
|
||||||
ajax.put("originalFilename", file.getOriginalFilename());
|
upload.setOriginalFilename(file.getOriginalFilename());
|
||||||
return ajax;
|
return AjaxResult.success(upload);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return AjaxResult.error(e.getMessage());
|
return AjaxResult.error(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -98,35 +89,25 @@ public class CommonController
|
|||||||
* 通用上传请求(多个)
|
* 通用上传请求(多个)
|
||||||
*/
|
*/
|
||||||
@PostMapping("/uploads")
|
@PostMapping("/uploads")
|
||||||
public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception
|
public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
// 上传文件路径
|
// 上传文件路径
|
||||||
String filePath = RuoYiConfig.getUploadPath();
|
String filePath = RuoYiConfig.getUploadPath();
|
||||||
List<String> urls = new ArrayList<String>();
|
List<Upload> urls = new ArrayList<Upload>();
|
||||||
List<String> fileNames = new ArrayList<String>();
|
|
||||||
List<String> newFileNames = new ArrayList<String>();
|
for (MultipartFile file : files) {
|
||||||
List<String> originalFilenames = new ArrayList<String>();
|
|
||||||
for (MultipartFile file : files)
|
|
||||||
{
|
|
||||||
// 上传并返回新文件名称
|
// 上传并返回新文件名称
|
||||||
String fileName = FileUploadUtils.upload(filePath, file);
|
String fileName = FileUploadUtils.upload(filePath, file);
|
||||||
String url = serverConfig.getUrl() + fileName;
|
String url = serverConfig.getUrl() + fileName;
|
||||||
urls.add(url);
|
Upload upload = new Upload();
|
||||||
fileNames.add(fileName);
|
upload.setUrl(url);
|
||||||
newFileNames.add(FileUtils.getName(fileName));
|
upload.setFileName(fileName);
|
||||||
originalFilenames.add(file.getOriginalFilename());
|
upload.setNewFileName(FileUtils.getName(fileName));
|
||||||
|
upload.setOriginalFilename(file.getOriginalFilename());
|
||||||
|
urls.add(upload);
|
||||||
}
|
}
|
||||||
AjaxResult ajax = AjaxResult.success();
|
return AjaxResult.success(urls);
|
||||||
ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER));
|
} catch (Exception e) {
|
||||||
ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
|
|
||||||
ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
|
|
||||||
ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
|
|
||||||
return ajax;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return AjaxResult.error(e.getMessage());
|
return AjaxResult.error(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,12 +117,9 @@ public class CommonController
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/download/resource")
|
@GetMapping("/download/resource")
|
||||||
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
|
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
|
||||||
throws Exception
|
throws Exception {
|
||||||
{
|
try {
|
||||||
try
|
if (!FileUtils.checkAllowDownload(resource)) {
|
||||||
{
|
|
||||||
if (!FileUtils.checkAllowDownload(resource))
|
|
||||||
{
|
|
||||||
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
|
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
|
||||||
}
|
}
|
||||||
// 本地资源路径
|
// 本地资源路径
|
||||||
@ -153,9 +131,7 @@ public class CommonController
|
|||||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||||
FileUtils.setAttachmentResponseHeader(response, downloadName);
|
FileUtils.setAttachmentResponseHeader(response, downloadName);
|
||||||
FileUtils.writeBytes(downloadPath, response.getOutputStream());
|
FileUtils.writeBytes(downloadPath, response.getOutputStream());
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
log.error("下载文件失败", e);
|
log.error("下载文件失败", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,9 @@
|
|||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.ruoyi.common.constant.Constants;
|
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.domain.entity.SysMenu;
|
import com.ruoyi.common.core.domain.entity.SysMenu;
|
||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import com.ruoyi.common.core.domain.model.Info;
|
||||||
import com.ruoyi.common.core.domain.model.LoginBody;
|
import com.ruoyi.common.core.domain.model.LoginBody;
|
||||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||||
import com.ruoyi.common.core.text.Convert;
|
import com.ruoyi.common.core.text.Convert;
|
||||||
@ -21,8 +13,18 @@ import com.ruoyi.common.utils.StringUtils;
|
|||||||
import com.ruoyi.framework.web.service.SysLoginService;
|
import com.ruoyi.framework.web.service.SysLoginService;
|
||||||
import com.ruoyi.framework.web.service.SysPermissionService;
|
import com.ruoyi.framework.web.service.SysPermissionService;
|
||||||
import com.ruoyi.framework.web.service.TokenService;
|
import com.ruoyi.framework.web.service.TokenService;
|
||||||
|
import com.ruoyi.system.domain.vo.RouterVo;
|
||||||
import com.ruoyi.system.service.ISysConfigService;
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
import com.ruoyi.system.service.ISysMenuService;
|
import com.ruoyi.system.service.ISysMenuService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录验证
|
* 登录验证
|
||||||
@ -56,12 +58,12 @@ public class SysLoginController
|
|||||||
@PostMapping("/login")
|
@PostMapping("/login")
|
||||||
public AjaxResult login(@RequestBody LoginBody loginBody)
|
public AjaxResult login(@RequestBody LoginBody loginBody)
|
||||||
{
|
{
|
||||||
AjaxResult ajax = AjaxResult.success();
|
|
||||||
// 生成令牌
|
// 生成令牌
|
||||||
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
|
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
|
||||||
loginBody.getUuid());
|
loginBody.getUuid());
|
||||||
ajax.put(Constants.TOKEN, token);
|
|
||||||
return ajax;
|
return AjaxResult.success(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -70,7 +72,7 @@ public class SysLoginController
|
|||||||
* @return 用户信息
|
* @return 用户信息
|
||||||
*/
|
*/
|
||||||
@GetMapping("getInfo")
|
@GetMapping("getInfo")
|
||||||
public AjaxResult getInfo()
|
public AjaxResult<Info> getInfo()
|
||||||
{
|
{
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
SysUser user = loginUser.getUser();
|
SysUser user = loginUser.getUser();
|
||||||
@ -83,13 +85,13 @@ public class SysLoginController
|
|||||||
loginUser.setPermissions(permissions);
|
loginUser.setPermissions(permissions);
|
||||||
tokenService.refreshToken(loginUser);
|
tokenService.refreshToken(loginUser);
|
||||||
}
|
}
|
||||||
AjaxResult ajax = AjaxResult.success();
|
Info info = new Info();
|
||||||
ajax.put("user", user);
|
info.setUser(user);
|
||||||
ajax.put("roles", roles);
|
info.setRoles(roles);
|
||||||
ajax.put("permissions", permissions);
|
info.setPermissions(permissions);
|
||||||
ajax.put("isDefaultModifyPwd", initPasswordIsModify(user.getPwdUpdateDate()));
|
info.setIsDefaultModifyPwd(initPasswordIsModify(user.getPwdUpdateDate()));
|
||||||
ajax.put("isPasswordExpired", passwordIsExpiration(user.getPwdUpdateDate()));
|
info.setIsPasswordExpired(passwordIsExpiration(user.getPwdUpdateDate()));
|
||||||
return ajax;
|
return AjaxResult.success(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -98,7 +100,7 @@ public class SysLoginController
|
|||||||
* @return 路由信息
|
* @return 路由信息
|
||||||
*/
|
*/
|
||||||
@GetMapping("getRouters")
|
@GetMapping("getRouters")
|
||||||
public AjaxResult getRouters()
|
public AjaxResult<List<RouterVo>> getRouters()
|
||||||
{
|
{
|
||||||
Long userId = SecurityUtils.getUserId();
|
Long userId = SecurityUtils.getUserId();
|
||||||
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
|
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.model.MenuTreeselect;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -68,13 +70,13 @@ public class SysMenuController extends BaseController
|
|||||||
* 加载对应角色菜单列表树
|
* 加载对应角色菜单列表树
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
|
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
|
||||||
public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId)
|
public AjaxResult<MenuTreeselect> roleMenuTreeselect(@PathVariable("roleId") Long roleId)
|
||||||
{
|
{
|
||||||
List<SysMenu> menus = menuService.selectMenuList(getUserId());
|
List<SysMenu> menus = menuService.selectMenuList(getUserId());
|
||||||
AjaxResult ajax = AjaxResult.success();
|
MenuTreeselect menuTreeselect = new MenuTreeselect();
|
||||||
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
|
menuTreeselect.setCheckedKeys(menuService.selectMenuListByRoleId(roleId));
|
||||||
ajax.put("menus", menuService.buildMenuTreeSelect(menus));
|
menuTreeselect.setMenus(menuService.buildMenuTreeSelect(menus));
|
||||||
return ajax;
|
return AjaxResult.success(menuTreeselect);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,7 +19,7 @@ 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.SysPost;
|
import com.ruoyi.common.core.domain.model.SysPost;
|
||||||
import com.ruoyi.system.service.ISysPostService;
|
import com.ruoyi.system.service.ISysPostService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.model.SysUserExt;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@ -49,10 +52,11 @@ public class SysProfileController extends BaseController
|
|||||||
{
|
{
|
||||||
LoginUser loginUser = getLoginUser();
|
LoginUser loginUser = getLoginUser();
|
||||||
SysUser user = loginUser.getUser();
|
SysUser user = loginUser.getUser();
|
||||||
AjaxResult ajax = AjaxResult.success(user);
|
SysUserExt sysUserExt = new SysUserExt();
|
||||||
ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
|
BeanUtils.copyProperties(user, sysUserExt);
|
||||||
ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername()));
|
sysUserExt.setRoleGroup(userService.selectUserRoleGroup(loginUser.getUsername()));
|
||||||
return ajax;
|
sysUserExt.setPostGroup(userService.selectUserPostGroup(loginUser.getUsername()));
|
||||||
|
return AjaxResult.success(sysUserExt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -122,7 +126,7 @@ public class SysProfileController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
|
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/avatar")
|
@PostMapping("/avatar")
|
||||||
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception
|
public AjaxResult<String> avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception
|
||||||
{
|
{
|
||||||
if (!file.isEmpty())
|
if (!file.isEmpty())
|
||||||
{
|
{
|
||||||
@ -135,8 +139,8 @@ public class SysProfileController extends BaseController
|
|||||||
{
|
{
|
||||||
FileUtils.deleteFile(RuoYiConfig.getProfile() + FileUtils.stripPrefix(oldAvatar));
|
FileUtils.deleteFile(RuoYiConfig.getProfile() + FileUtils.stripPrefix(oldAvatar));
|
||||||
}
|
}
|
||||||
AjaxResult ajax = AjaxResult.success();
|
AjaxResult<String> ajax = AjaxResult.success(avatar);
|
||||||
ajax.put("imgUrl", avatar);
|
|
||||||
// 更新缓存用户头像
|
// 更新缓存用户头像
|
||||||
loginUser.getUser().setAvatar(avatar);
|
loginUser.getUser().setAvatar(avatar);
|
||||||
tokenService.setLoginUser(loginUser);
|
tokenService.setLoginUser(loginUser);
|
||||||
|
@ -2,6 +2,8 @@ package com.ruoyi.web.controller.system;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.model.DeptTree;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -241,7 +243,7 @@ public class SysRoleController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
@PutMapping("/authUser/selectAll")
|
@PutMapping("/authUser/selectAll")
|
||||||
public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
|
public AjaxResult<Integer> selectAuthUserAll(Long roleId, Long[] userIds)
|
||||||
{
|
{
|
||||||
roleService.checkRoleDataScope(roleId);
|
roleService.checkRoleDataScope(roleId);
|
||||||
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
||||||
@ -252,11 +254,12 @@ public class SysRoleController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||||
@GetMapping(value = "/deptTree/{roleId}")
|
@GetMapping(value = "/deptTree/{roleId}")
|
||||||
public AjaxResult deptTree(@PathVariable("roleId") Long roleId)
|
public AjaxResult<DeptTree> deptTree(@PathVariable("roleId") Long roleId)
|
||||||
{
|
{
|
||||||
AjaxResult ajax = AjaxResult.success();
|
|
||||||
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
|
DeptTree deptTree = new DeptTree();
|
||||||
ajax.put("depts", deptService.selectDeptTreeList(new SysDept()));
|
deptTree.setCheckedKeys(deptService.selectDeptListByRoleId(roleId));
|
||||||
return ajax;
|
deptTree.setDepts(deptService.selectDeptTreeList(new SysDept()));
|
||||||
|
return AjaxResult.success(deptTree);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,10 @@ package com.ruoyi.web.controller.system;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.model.AuthRole;
|
||||||
|
import com.ruoyi.common.core.domain.model.Info;
|
||||||
|
import com.ruoyi.common.core.domain.model.Infos;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
@ -98,22 +102,23 @@ public class SysUserController extends BaseController
|
|||||||
* 根据用户编号获取详细信息
|
* 根据用户编号获取详细信息
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('system:user:query')")
|
@PreAuthorize("@ss.hasPermi('system:user:query')")
|
||||||
@GetMapping(value = { "/", "/{userId}" })
|
@GetMapping(value = {"/{userId}" })
|
||||||
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
|
public AjaxResult<Infos> getInfo(@PathVariable(value = "userId", required = false) Long userId)
|
||||||
{
|
{
|
||||||
AjaxResult ajax = AjaxResult.success();
|
|
||||||
|
Infos info = new Infos();
|
||||||
if (StringUtils.isNotNull(userId))
|
if (StringUtils.isNotNull(userId))
|
||||||
{
|
{
|
||||||
userService.checkUserDataScope(userId);
|
userService.checkUserDataScope(userId);
|
||||||
SysUser sysUser = userService.selectUserById(userId);
|
SysUser sysUser = userService.selectUserById(userId);
|
||||||
ajax.put(AjaxResult.DATA_TAG, sysUser);
|
info.setUser(sysUser);
|
||||||
ajax.put("postIds", postService.selectPostListByUserId(userId));
|
info.setPostIds(postService.selectPostListByUserId(userId));
|
||||||
ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
|
info.setRoleIds(sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
List<SysRole> roles = roleService.selectRoleAll();
|
List<SysRole> roles = roleService.selectRoleAll();
|
||||||
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
info.setRoles(SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||||
ajax.put("posts", postService.selectPostAll());
|
info.setPosts(postService.selectPostAll());
|
||||||
return ajax;
|
return AjaxResult.success(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -222,12 +227,12 @@ public class SysUserController extends BaseController
|
|||||||
@GetMapping("/authRole/{userId}")
|
@GetMapping("/authRole/{userId}")
|
||||||
public AjaxResult authRole(@PathVariable("userId") Long userId)
|
public AjaxResult authRole(@PathVariable("userId") Long userId)
|
||||||
{
|
{
|
||||||
AjaxResult ajax = AjaxResult.success();
|
AuthRole authRole = new AuthRole();
|
||||||
SysUser user = userService.selectUserById(userId);
|
SysUser user = userService.selectUserById(userId);
|
||||||
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
||||||
ajax.put("user", user);
|
authRole.setUser(user);
|
||||||
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
authRole.setRoles(SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||||
return ajax;
|
return AjaxResult.success(authRole);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,9 +6,9 @@ spring:
|
|||||||
druid:
|
druid:
|
||||||
# 主库数据源
|
# 主库数据源
|
||||||
master:
|
master:
|
||||||
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
url: jdbc:mysql://192.168.1.210:33060/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
username: root
|
username: root
|
||||||
password: password
|
password: Xueqiang1230@
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
slave:
|
slave:
|
||||||
# 从数据源开关/默认关闭
|
# 从数据源开关/默认关闭
|
||||||
|
@ -16,7 +16,7 @@ ruoyi:
|
|||||||
# 开发环境配置
|
# 开发环境配置
|
||||||
server:
|
server:
|
||||||
# 服务器的HTTP端口,默认为8080
|
# 服务器的HTTP端口,默认为8080
|
||||||
port: 8080
|
port: 8081
|
||||||
servlet:
|
servlet:
|
||||||
# 应用的访问路径
|
# 应用的访问路径
|
||||||
context-path: /
|
context-path: /
|
||||||
@ -68,11 +68,11 @@ spring:
|
|||||||
# redis 配置
|
# redis 配置
|
||||||
redis:
|
redis:
|
||||||
# 地址
|
# 地址
|
||||||
host: localhost
|
host: 192.168.1.210
|
||||||
# 端口,默认为6379
|
# 端口,默认为6379
|
||||||
port: 6379
|
port: 6379
|
||||||
# 数据库索引
|
# 数据库索引
|
||||||
database: 0
|
database: 2
|
||||||
# 密码
|
# 密码
|
||||||
password:
|
password:
|
||||||
# 连接超时时间
|
# 连接超时时间
|
||||||
|
@ -10,18 +10,25 @@ import com.ruoyi.common.utils.StringUtils;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class AjaxResult extends HashMap<String, Object>
|
|
||||||
|
public class AjaxResult<T>
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
private int code;
|
||||||
|
private String msg;
|
||||||
|
private T data;
|
||||||
|
// private String roleGroup;
|
||||||
|
// private String postGroup;
|
||||||
|
// private String imgUrl;
|
||||||
|
|
||||||
/** 状态码 */
|
// /** 状态码 */
|
||||||
public static final String CODE_TAG = "code";
|
// public static final String CODE_TAG = "code";
|
||||||
|
//
|
||||||
/** 返回内容 */
|
// /** 返回内容 */
|
||||||
public static final String MSG_TAG = "msg";
|
// public static final String MSG_TAG = "msg";
|
||||||
|
//
|
||||||
/** 数据对象 */
|
// /** 数据对象 */
|
||||||
public static final String DATA_TAG = "data";
|
// public static final String DATA_TAG = "data";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
|
* 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
|
||||||
@ -38,8 +45,8 @@ public class AjaxResult extends HashMap<String, Object>
|
|||||||
*/
|
*/
|
||||||
public AjaxResult(int code, String msg)
|
public AjaxResult(int code, String msg)
|
||||||
{
|
{
|
||||||
super.put(CODE_TAG, code);
|
this.code = code;
|
||||||
super.put(MSG_TAG, msg);
|
this.msg = msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -49,14 +56,11 @@ public class AjaxResult extends HashMap<String, Object>
|
|||||||
* @param msg 返回内容
|
* @param msg 返回内容
|
||||||
* @param data 数据对象
|
* @param data 数据对象
|
||||||
*/
|
*/
|
||||||
public AjaxResult(int code, String msg, Object data)
|
public AjaxResult(int code, String msg, T data)
|
||||||
{
|
{
|
||||||
super.put(CODE_TAG, code);
|
this.code = code;
|
||||||
super.put(MSG_TAG, msg);
|
this.msg = msg;
|
||||||
if (StringUtils.isNotNull(data))
|
this.data = data;
|
||||||
{
|
|
||||||
super.put(DATA_TAG, data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -64,7 +68,7 @@ public class AjaxResult extends HashMap<String, Object>
|
|||||||
*
|
*
|
||||||
* @return 成功消息
|
* @return 成功消息
|
||||||
*/
|
*/
|
||||||
public static AjaxResult success()
|
public static <T> AjaxResult<T> success()
|
||||||
{
|
{
|
||||||
return AjaxResult.success("操作成功");
|
return AjaxResult.success("操作成功");
|
||||||
}
|
}
|
||||||
@ -74,7 +78,7 @@ public class AjaxResult extends HashMap<String, Object>
|
|||||||
*
|
*
|
||||||
* @return 成功消息
|
* @return 成功消息
|
||||||
*/
|
*/
|
||||||
public static AjaxResult success(Object data)
|
public static <T> AjaxResult<T> success(T data)
|
||||||
{
|
{
|
||||||
return AjaxResult.success("操作成功", data);
|
return AjaxResult.success("操作成功", data);
|
||||||
}
|
}
|
||||||
@ -85,7 +89,7 @@ public class AjaxResult extends HashMap<String, Object>
|
|||||||
* @param msg 返回内容
|
* @param msg 返回内容
|
||||||
* @return 成功消息
|
* @return 成功消息
|
||||||
*/
|
*/
|
||||||
public static AjaxResult success(String msg)
|
public static <T> AjaxResult<T> success(String msg)
|
||||||
{
|
{
|
||||||
return AjaxResult.success(msg, null);
|
return AjaxResult.success(msg, null);
|
||||||
}
|
}
|
||||||
@ -97,9 +101,9 @@ public class AjaxResult extends HashMap<String, Object>
|
|||||||
* @param data 数据对象
|
* @param data 数据对象
|
||||||
* @return 成功消息
|
* @return 成功消息
|
||||||
*/
|
*/
|
||||||
public static AjaxResult success(String msg, Object data)
|
public static <T> AjaxResult<T> success(String msg, T data)
|
||||||
{
|
{
|
||||||
return new AjaxResult(HttpStatus.SUCCESS, msg, data);
|
return new AjaxResult<T>(HttpStatus.SUCCESS, msg, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -108,7 +112,7 @@ public class AjaxResult extends HashMap<String, Object>
|
|||||||
* @param msg 返回内容
|
* @param msg 返回内容
|
||||||
* @return 警告消息
|
* @return 警告消息
|
||||||
*/
|
*/
|
||||||
public static AjaxResult warn(String msg)
|
public static <T> AjaxResult<T> warn(String msg)
|
||||||
{
|
{
|
||||||
return AjaxResult.warn(msg, null);
|
return AjaxResult.warn(msg, null);
|
||||||
}
|
}
|
||||||
@ -120,9 +124,9 @@ public class AjaxResult extends HashMap<String, Object>
|
|||||||
* @param data 数据对象
|
* @param data 数据对象
|
||||||
* @return 警告消息
|
* @return 警告消息
|
||||||
*/
|
*/
|
||||||
public static AjaxResult warn(String msg, Object data)
|
public static <T> AjaxResult<T> warn(String msg, T data)
|
||||||
{
|
{
|
||||||
return new AjaxResult(HttpStatus.WARN, msg, data);
|
return new AjaxResult<T>(HttpStatus.WARN, msg, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -130,7 +134,7 @@ public class AjaxResult extends HashMap<String, Object>
|
|||||||
*
|
*
|
||||||
* @return 错误消息
|
* @return 错误消息
|
||||||
*/
|
*/
|
||||||
public static AjaxResult error()
|
public static <T> AjaxResult<T> error()
|
||||||
{
|
{
|
||||||
return AjaxResult.error("操作失败");
|
return AjaxResult.error("操作失败");
|
||||||
}
|
}
|
||||||
@ -141,7 +145,7 @@ public class AjaxResult extends HashMap<String, Object>
|
|||||||
* @param msg 返回内容
|
* @param msg 返回内容
|
||||||
* @return 错误消息
|
* @return 错误消息
|
||||||
*/
|
*/
|
||||||
public static AjaxResult error(String msg)
|
public static <T> AjaxResult<T> error(String msg)
|
||||||
{
|
{
|
||||||
return AjaxResult.error(msg, null);
|
return AjaxResult.error(msg, null);
|
||||||
}
|
}
|
||||||
@ -153,7 +157,7 @@ public class AjaxResult extends HashMap<String, Object>
|
|||||||
* @param data 数据对象
|
* @param data 数据对象
|
||||||
* @return 错误消息
|
* @return 错误消息
|
||||||
*/
|
*/
|
||||||
public static AjaxResult error(String msg, Object data)
|
public static <T> AjaxResult<T> error(String msg, Object data)
|
||||||
{
|
{
|
||||||
return new AjaxResult(HttpStatus.ERROR, msg, data);
|
return new AjaxResult(HttpStatus.ERROR, msg, data);
|
||||||
}
|
}
|
||||||
@ -177,7 +181,7 @@ public class AjaxResult extends HashMap<String, Object>
|
|||||||
*/
|
*/
|
||||||
public boolean isSuccess()
|
public boolean isSuccess()
|
||||||
{
|
{
|
||||||
return Objects.equals(HttpStatus.SUCCESS, this.get(CODE_TAG));
|
return this.code == HttpStatus.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -187,7 +191,7 @@ public class AjaxResult extends HashMap<String, Object>
|
|||||||
*/
|
*/
|
||||||
public boolean isWarn()
|
public boolean isWarn()
|
||||||
{
|
{
|
||||||
return Objects.equals(HttpStatus.WARN, this.get(CODE_TAG));
|
return this.code == HttpStatus.WARN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -197,7 +201,31 @@ public class AjaxResult extends HashMap<String, Object>
|
|||||||
*/
|
*/
|
||||||
public boolean isError()
|
public boolean isError()
|
||||||
{
|
{
|
||||||
return Objects.equals(HttpStatus.ERROR, this.get(CODE_TAG));
|
return this.code == HttpStatus.ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(int code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMsg(String msg) {
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(T data) {
|
||||||
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -207,10 +235,10 @@ public class AjaxResult extends HashMap<String, Object>
|
|||||||
* @param value 值
|
* @param value 值
|
||||||
* @return 数据对象
|
* @return 数据对象
|
||||||
*/
|
*/
|
||||||
@Override
|
// @Override
|
||||||
public AjaxResult put(String key, Object value)
|
// public AjaxResult put(String key, Object value)
|
||||||
{
|
// {
|
||||||
super.put(key, value);
|
// super.put(key, value);
|
||||||
return this;
|
// return this;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,29 @@
|
|||||||
|
package com.ruoyi.common.core.domain.model;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class AuthRole implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private List<SysRole> roles;
|
||||||
|
private SysUser user;
|
||||||
|
|
||||||
|
public List<SysRole> getRoles() {
|
||||||
|
return roles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoles(List<SysRole> roles) {
|
||||||
|
this.roles = roles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SysUser getUser() {
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUser(SysUser user) {
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
package com.ruoyi.common.core.domain.model;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回的验证码数据
|
||||||
|
*/
|
||||||
|
public class Captcha implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private String img;
|
||||||
|
private Boolean captchaEnabled;
|
||||||
|
private String uuid;
|
||||||
|
|
||||||
|
public String getImg() {
|
||||||
|
return img;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImg(String img) {
|
||||||
|
this.img = img;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getCaptchaEnabled() {
|
||||||
|
return captchaEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCaptchaEnabled(Boolean captchaEnabled) {
|
||||||
|
this.captchaEnabled = captchaEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getUuid() {
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUuid(String uuid) {
|
||||||
|
this.uuid = uuid;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package com.ruoyi.common.core.domain.model;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.TreeSelect;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DeptTree implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private List<Long> checkedKeys;
|
||||||
|
private List<TreeSelect> depts;
|
||||||
|
|
||||||
|
public List<Long> getCheckedKeys() {
|
||||||
|
return checkedKeys;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCheckedKeys(List<Long> checkedKeys) {
|
||||||
|
this.checkedKeys = checkedKeys;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TreeSelect> getDepts() {
|
||||||
|
return depts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDepts(List<TreeSelect> depts) {
|
||||||
|
this.depts = depts;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
package com.ruoyi.common.core.domain.model;
|
||||||
|
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class Info implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private Set<String> permissions;
|
||||||
|
private Set<String> roles;
|
||||||
|
private SysUser user;
|
||||||
|
private boolean isDefaultModifyPwd;
|
||||||
|
private boolean isPasswordExpired;
|
||||||
|
private List<Long> postIds;
|
||||||
|
private String roleIds;
|
||||||
|
|
||||||
|
|
||||||
|
public Set<String> getPermissions() {
|
||||||
|
return permissions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPermissions(Set<String> permissions) {
|
||||||
|
this.permissions = permissions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<String> getRoles() {
|
||||||
|
return roles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoles(Set<String> roles) {
|
||||||
|
this.roles = roles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SysUser getUser() {
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUser(SysUser user) {
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getIsDefaultModifyPwd() {
|
||||||
|
return isDefaultModifyPwd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsDefaultModifyPwd(boolean isDefaultModifyPwd) {
|
||||||
|
this.isDefaultModifyPwd = isDefaultModifyPwd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getIsPasswordExpired() {
|
||||||
|
return isPasswordExpired;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsPasswordExpired(boolean isPasswordExpired) {
|
||||||
|
this.isPasswordExpired = isPasswordExpired;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
package com.ruoyi.common.core.domain.model;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Infos implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private SysUser user;
|
||||||
|
private List<Long> postIds;
|
||||||
|
private List<Long> roleIds;
|
||||||
|
private List<SysRole> roles;
|
||||||
|
private List<SysPost> posts;
|
||||||
|
|
||||||
|
|
||||||
|
public SysUser getUser() {
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUser(SysUser user) {
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Long> getPostIds() {
|
||||||
|
return postIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPostIds(List<Long> postIds) {
|
||||||
|
this.postIds = postIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Long> getRoleIds() {
|
||||||
|
return roleIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleIds(List<Long> roleIds) {
|
||||||
|
this.roleIds = roleIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SysRole> getRoles() {
|
||||||
|
return roles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoles(List<SysRole> roles) {
|
||||||
|
this.roles = roles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SysPost> getPosts() {
|
||||||
|
return posts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPosts(List<SysPost> posts) {
|
||||||
|
this.posts = posts;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package com.ruoyi.common.core.domain.model;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.TreeSelect;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public class MenuTreeselect implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private List<Long> checkedKeys;
|
||||||
|
private List<TreeSelect> menus;
|
||||||
|
|
||||||
|
public List<Long> getCheckedKeys() {
|
||||||
|
return checkedKeys;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCheckedKeys(List<Long> checkedKeys) {
|
||||||
|
this.checkedKeys = checkedKeys;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TreeSelect> getMenus() {
|
||||||
|
return menus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMenus(List<TreeSelect> menus) {
|
||||||
|
this.menus = menus;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.ruoyi.common.core.domain.model;
|
||||||
|
|
||||||
|
public class RoleGroup {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private String roleGroup;
|
||||||
|
private String postGroup;
|
||||||
|
|
||||||
|
public String getRoleGroup() {
|
||||||
|
return roleGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleGroup(String roleGroup) {
|
||||||
|
this.roleGroup = roleGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPostGroup() {
|
||||||
|
return postGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPostGroup(String postGroup) {
|
||||||
|
this.postGroup = postGroup;
|
||||||
|
}
|
||||||
|
}
|
@ -1,124 +1,124 @@
|
|||||||
package com.ruoyi.system.domain;
|
package com.ruoyi.common.core.domain.model;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import com.ruoyi.common.annotation.Excel.ColumnType;
|
import com.ruoyi.common.annotation.Excel.ColumnType;
|
||||||
import com.ruoyi.common.core.domain.BaseEntity;
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 岗位表 sys_post
|
* 岗位表 sys_post
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class SysPost extends BaseEntity
|
public class SysPost extends BaseEntity
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 岗位序号 */
|
/** 岗位序号 */
|
||||||
@Excel(name = "岗位序号", cellType = ColumnType.NUMERIC)
|
@Excel(name = "岗位序号", cellType = ColumnType.NUMERIC)
|
||||||
private Long postId;
|
private Long postId;
|
||||||
|
|
||||||
/** 岗位编码 */
|
/** 岗位编码 */
|
||||||
@Excel(name = "岗位编码")
|
@Excel(name = "岗位编码")
|
||||||
private String postCode;
|
private String postCode;
|
||||||
|
|
||||||
/** 岗位名称 */
|
/** 岗位名称 */
|
||||||
@Excel(name = "岗位名称")
|
@Excel(name = "岗位名称")
|
||||||
private String postName;
|
private String postName;
|
||||||
|
|
||||||
/** 岗位排序 */
|
/** 岗位排序 */
|
||||||
@Excel(name = "岗位排序")
|
@Excel(name = "岗位排序")
|
||||||
private Integer postSort;
|
private Integer postSort;
|
||||||
|
|
||||||
/** 状态(0正常 1停用) */
|
/** 状态(0正常 1停用) */
|
||||||
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
|
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/** 用户是否存在此岗位标识 默认不存在 */
|
/** 用户是否存在此岗位标识 默认不存在 */
|
||||||
private boolean flag = false;
|
private boolean flag = false;
|
||||||
|
|
||||||
public Long getPostId()
|
public Long getPostId()
|
||||||
{
|
{
|
||||||
return postId;
|
return postId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPostId(Long postId)
|
public void setPostId(Long postId)
|
||||||
{
|
{
|
||||||
this.postId = postId;
|
this.postId = postId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotBlank(message = "岗位编码不能为空")
|
@NotBlank(message = "岗位编码不能为空")
|
||||||
@Size(min = 0, max = 64, message = "岗位编码长度不能超过64个字符")
|
@Size(min = 0, max = 64, message = "岗位编码长度不能超过64个字符")
|
||||||
public String getPostCode()
|
public String getPostCode()
|
||||||
{
|
{
|
||||||
return postCode;
|
return postCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPostCode(String postCode)
|
public void setPostCode(String postCode)
|
||||||
{
|
{
|
||||||
this.postCode = postCode;
|
this.postCode = postCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotBlank(message = "岗位名称不能为空")
|
@NotBlank(message = "岗位名称不能为空")
|
||||||
@Size(min = 0, max = 50, message = "岗位名称长度不能超过50个字符")
|
@Size(min = 0, max = 50, message = "岗位名称长度不能超过50个字符")
|
||||||
public String getPostName()
|
public String getPostName()
|
||||||
{
|
{
|
||||||
return postName;
|
return postName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPostName(String postName)
|
public void setPostName(String postName)
|
||||||
{
|
{
|
||||||
this.postName = postName;
|
this.postName = postName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull(message = "显示顺序不能为空")
|
@NotNull(message = "显示顺序不能为空")
|
||||||
public Integer getPostSort()
|
public Integer getPostSort()
|
||||||
{
|
{
|
||||||
return postSort;
|
return postSort;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPostSort(Integer postSort)
|
public void setPostSort(Integer postSort)
|
||||||
{
|
{
|
||||||
this.postSort = postSort;
|
this.postSort = postSort;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 boolean isFlag()
|
public boolean isFlag()
|
||||||
{
|
{
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFlag(boolean flag)
|
public void setFlag(boolean flag)
|
||||||
{
|
{
|
||||||
this.flag = flag;
|
this.flag = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
.append("postId", getPostId())
|
.append("postId", getPostId())
|
||||||
.append("postCode", getPostCode())
|
.append("postCode", getPostCode())
|
||||||
.append("postName", getPostName())
|
.append("postName", getPostName())
|
||||||
.append("postSort", getPostSort())
|
.append("postSort", getPostSort())
|
||||||
.append("status", getStatus())
|
.append("status", getStatus())
|
||||||
.append("createBy", getCreateBy())
|
.append("createBy", getCreateBy())
|
||||||
.append("createTime", getCreateTime())
|
.append("createTime", getCreateTime())
|
||||||
.append("updateBy", getUpdateBy())
|
.append("updateBy", getUpdateBy())
|
||||||
.append("updateTime", getUpdateTime())
|
.append("updateTime", getUpdateTime())
|
||||||
.append("remark", getRemark())
|
.append("remark", getRemark())
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package com.ruoyi.common.core.domain.model;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
|
||||||
|
public class SysUserExt extends SysUser {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private String roleGroup;
|
||||||
|
private String postGroup;
|
||||||
|
|
||||||
|
public String getRoleGroup() {
|
||||||
|
return roleGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleGroup(String roleGroup) {
|
||||||
|
this.roleGroup = roleGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPostGroup() {
|
||||||
|
return postGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPostGroup(String postGroup) {
|
||||||
|
this.postGroup = postGroup;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
package com.ruoyi.common.core.domain.model;
|
||||||
|
|
||||||
|
|
||||||
|
public class Upload {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private String url;
|
||||||
|
private String fileName;
|
||||||
|
private String newFileName;
|
||||||
|
private String originalFilename;
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFileName() {
|
||||||
|
return fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFileName(String fileName) {
|
||||||
|
this.fileName = fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNewFileName() {
|
||||||
|
return newFileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewFileName(String newFileName) {
|
||||||
|
this.newFileName = newFileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOriginalFilename() {
|
||||||
|
return originalFilename;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOriginalFilename(String originalFilename) {
|
||||||
|
this.originalFilename = originalFilename;
|
||||||
|
}
|
||||||
|
}
|
@ -8,7 +8,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class TableDataInfo implements Serializable
|
public class TableDataInfo<T> implements Serializable
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ public class TableDataInfo implements Serializable
|
|||||||
private long total;
|
private long total;
|
||||||
|
|
||||||
/** 列表数据 */
|
/** 列表数据 */
|
||||||
private List<?> rows;
|
private List<T> rows;
|
||||||
|
|
||||||
/** 消息状态码 */
|
/** 消息状态码 */
|
||||||
private int code;
|
private int code;
|
||||||
@ -37,7 +37,7 @@ public class TableDataInfo implements Serializable
|
|||||||
* @param list 列表数据
|
* @param list 列表数据
|
||||||
* @param total 总记录数
|
* @param total 总记录数
|
||||||
*/
|
*/
|
||||||
public TableDataInfo(List<?> list, long total)
|
public TableDataInfo(List<T> list, long total)
|
||||||
{
|
{
|
||||||
this.rows = list;
|
this.rows = list;
|
||||||
this.total = total;
|
this.total = total;
|
||||||
@ -58,7 +58,7 @@ public class TableDataInfo implements Serializable
|
|||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRows(List<?> rows)
|
public void setRows(List<T> rows)
|
||||||
{
|
{
|
||||||
this.rows = rows;
|
this.rows = rows;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.ruoyi.system.mapper;
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.ruoyi.system.domain.SysPost;
|
import com.ruoyi.common.core.domain.model.SysPost;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 岗位信息 数据层
|
* 岗位信息 数据层
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.ruoyi.system.service;
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.ruoyi.system.domain.SysPost;
|
import com.ruoyi.common.core.domain.model.SysPost;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 岗位信息 服务层
|
* 岗位信息 服务层
|
||||||
|
@ -6,7 +6,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.exception.ServiceException;
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.system.domain.SysPost;
|
import com.ruoyi.common.core.domain.model.SysPost;
|
||||||
import com.ruoyi.system.mapper.SysPostMapper;
|
import com.ruoyi.system.mapper.SysPostMapper;
|
||||||
import com.ruoyi.system.mapper.SysUserPostMapper;
|
import com.ruoyi.system.mapper.SysUserPostMapper;
|
||||||
import com.ruoyi.system.service.ISysPostService;
|
import com.ruoyi.system.service.ISysPostService;
|
||||||
|
@ -19,7 +19,7 @@ import com.ruoyi.common.utils.SecurityUtils;
|
|||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.bean.BeanValidators;
|
import com.ruoyi.common.utils.bean.BeanValidators;
|
||||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
import com.ruoyi.system.domain.SysPost;
|
import com.ruoyi.common.core.domain.model.SysPost;
|
||||||
import com.ruoyi.system.domain.SysUserPost;
|
import com.ruoyi.system.domain.SysUserPost;
|
||||||
import com.ruoyi.system.domain.SysUserRole;
|
import com.ruoyi.system.domain.SysUserRole;
|
||||||
import com.ruoyi.system.mapper.SysPostMapper;
|
import com.ruoyi.system.mapper.SysPostMapper;
|
||||||
|
Reference in New Issue
Block a user