新增返回警告消息提示
This commit is contained in:
parent
cd137bd9fc
commit
ebb9f15a75
|
@ -64,6 +64,6 @@ public class SysOperlogController extends BaseController
|
||||||
public AjaxResult clean()
|
public AjaxResult clean()
|
||||||
{
|
{
|
||||||
operLogService.cleanOperLog();
|
operLogService.cleanOperLog();
|
||||||
return AjaxResult.success();
|
return success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,6 @@ public class SysUserOnlineController extends BaseController
|
||||||
public AjaxResult forceLogout(@PathVariable String tokenId)
|
public AjaxResult forceLogout(@PathVariable String tokenId)
|
||||||
{
|
{
|
||||||
redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
|
redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
|
||||||
return AjaxResult.success();
|
return success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class SysConfigController extends BaseController
|
||||||
@GetMapping(value = "/{configId}")
|
@GetMapping(value = "/{configId}")
|
||||||
public AjaxResult getInfo(@PathVariable Long configId)
|
public AjaxResult getInfo(@PathVariable Long configId)
|
||||||
{
|
{
|
||||||
return AjaxResult.success(configService.selectConfigById(configId));
|
return success(configService.selectConfigById(configId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,7 +73,7 @@ public class SysConfigController extends BaseController
|
||||||
@GetMapping(value = "/configKey/{configKey}")
|
@GetMapping(value = "/configKey/{configKey}")
|
||||||
public AjaxResult getConfigKey(@PathVariable String configKey)
|
public AjaxResult getConfigKey(@PathVariable String configKey)
|
||||||
{
|
{
|
||||||
return AjaxResult.success(configService.selectConfigByKey(configKey));
|
return success(configService.selectConfigByKey(configKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -86,7 +86,7 @@ public class SysConfigController extends BaseController
|
||||||
{
|
{
|
||||||
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||||
}
|
}
|
||||||
config.setCreateBy(getUsername());
|
config.setCreateBy(getUsername());
|
||||||
return toAjax(configService.insertConfig(config));
|
return toAjax(configService.insertConfig(config));
|
||||||
|
@ -102,7 +102,7 @@ public class SysConfigController extends BaseController
|
||||||
{
|
{
|
||||||
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||||
}
|
}
|
||||||
config.setUpdateBy(getUsername());
|
config.setUpdateBy(getUsername());
|
||||||
return toAjax(configService.updateConfig(config));
|
return toAjax(configService.updateConfig(config));
|
||||||
|
@ -129,6 +129,6 @@ public class SysConfigController extends BaseController
|
||||||
public AjaxResult refreshCache()
|
public AjaxResult refreshCache()
|
||||||
{
|
{
|
||||||
configService.resetConfigCache();
|
configService.resetConfigCache();
|
||||||
return AjaxResult.success();
|
return success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class SysDeptController extends BaseController
|
||||||
public AjaxResult list(SysDept dept)
|
public AjaxResult list(SysDept dept)
|
||||||
{
|
{
|
||||||
List<SysDept> depts = deptService.selectDeptList(dept);
|
List<SysDept> depts = deptService.selectDeptList(dept);
|
||||||
return AjaxResult.success(depts);
|
return success(depts);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,7 +54,7 @@ public class SysDeptController extends BaseController
|
||||||
{
|
{
|
||||||
List<SysDept> depts = deptService.selectDeptList(new SysDept());
|
List<SysDept> depts = deptService.selectDeptList(new SysDept());
|
||||||
depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
|
depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
|
||||||
return AjaxResult.success(depts);
|
return success(depts);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,7 +65,7 @@ public class SysDeptController extends BaseController
|
||||||
public AjaxResult getInfo(@PathVariable Long deptId)
|
public AjaxResult getInfo(@PathVariable Long deptId)
|
||||||
{
|
{
|
||||||
deptService.checkDeptDataScope(deptId);
|
deptService.checkDeptDataScope(deptId);
|
||||||
return AjaxResult.success(deptService.selectDeptById(deptId));
|
return success(deptService.selectDeptById(deptId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -78,7 +78,7 @@ public class SysDeptController extends BaseController
|
||||||
{
|
{
|
||||||
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||||
}
|
}
|
||||||
dept.setCreateBy(getUsername());
|
dept.setCreateBy(getUsername());
|
||||||
return toAjax(deptService.insertDept(dept));
|
return toAjax(deptService.insertDept(dept));
|
||||||
|
@ -96,15 +96,15 @@ public class SysDeptController extends BaseController
|
||||||
deptService.checkDeptDataScope(deptId);
|
deptService.checkDeptDataScope(deptId);
|
||||||
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||||
}
|
}
|
||||||
else if (dept.getParentId().equals(deptId))
|
else if (dept.getParentId().equals(deptId))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
||||||
}
|
}
|
||||||
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
|
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
|
||||||
{
|
{
|
||||||
return AjaxResult.error("该部门包含未停用的子部门!");
|
return error("该部门包含未停用的子部门!");
|
||||||
}
|
}
|
||||||
dept.setUpdateBy(getUsername());
|
dept.setUpdateBy(getUsername());
|
||||||
return toAjax(deptService.updateDept(dept));
|
return toAjax(deptService.updateDept(dept));
|
||||||
|
@ -120,11 +120,11 @@ public class SysDeptController extends BaseController
|
||||||
{
|
{
|
||||||
if (deptService.hasChildByDeptId(deptId))
|
if (deptService.hasChildByDeptId(deptId))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("存在下级部门,不允许删除");
|
return warn("存在下级部门,不允许删除");
|
||||||
}
|
}
|
||||||
if (deptService.checkDeptExistUser(deptId))
|
if (deptService.checkDeptExistUser(deptId))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("部门存在用户,不允许删除");
|
return warn("部门存在用户,不允许删除");
|
||||||
}
|
}
|
||||||
deptService.checkDeptDataScope(deptId);
|
deptService.checkDeptDataScope(deptId);
|
||||||
return toAjax(deptService.deleteDeptById(deptId));
|
return toAjax(deptService.deleteDeptById(deptId));
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class SysDictDataController extends BaseController
|
||||||
@GetMapping(value = "/{dictCode}")
|
@GetMapping(value = "/{dictCode}")
|
||||||
public AjaxResult getInfo(@PathVariable Long dictCode)
|
public AjaxResult getInfo(@PathVariable Long dictCode)
|
||||||
{
|
{
|
||||||
return AjaxResult.success(dictDataService.selectDictDataById(dictCode));
|
return success(dictDataService.selectDictDataById(dictCode));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -80,7 +80,7 @@ public class SysDictDataController extends BaseController
|
||||||
{
|
{
|
||||||
data = new ArrayList<SysDictData>();
|
data = new ArrayList<SysDictData>();
|
||||||
}
|
}
|
||||||
return AjaxResult.success(data);
|
return success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class SysDictTypeController extends BaseController
|
||||||
@GetMapping(value = "/{dictId}")
|
@GetMapping(value = "/{dictId}")
|
||||||
public AjaxResult getInfo(@PathVariable Long dictId)
|
public AjaxResult getInfo(@PathVariable Long dictId)
|
||||||
{
|
{
|
||||||
return AjaxResult.success(dictTypeService.selectDictTypeById(dictId));
|
return success(dictTypeService.selectDictTypeById(dictId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -74,7 +74,7 @@ public class SysDictTypeController extends BaseController
|
||||||
{
|
{
|
||||||
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||||
}
|
}
|
||||||
dict.setCreateBy(getUsername());
|
dict.setCreateBy(getUsername());
|
||||||
return toAjax(dictTypeService.insertDictType(dict));
|
return toAjax(dictTypeService.insertDictType(dict));
|
||||||
|
@ -90,7 +90,7 @@ public class SysDictTypeController extends BaseController
|
||||||
{
|
{
|
||||||
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||||
}
|
}
|
||||||
dict.setUpdateBy(getUsername());
|
dict.setUpdateBy(getUsername());
|
||||||
return toAjax(dictTypeService.updateDictType(dict));
|
return toAjax(dictTypeService.updateDictType(dict));
|
||||||
|
@ -117,7 +117,7 @@ public class SysDictTypeController extends BaseController
|
||||||
public AjaxResult refreshCache()
|
public AjaxResult refreshCache()
|
||||||
{
|
{
|
||||||
dictTypeService.resetDictCache();
|
dictTypeService.resetDictCache();
|
||||||
return AjaxResult.success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -127,6 +127,6 @@ public class SysDictTypeController extends BaseController
|
||||||
public AjaxResult optionselect()
|
public AjaxResult optionselect()
|
||||||
{
|
{
|
||||||
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
|
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
|
||||||
return AjaxResult.success(dictTypes);
|
return success(dictTypes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class SysMenuController extends BaseController
|
||||||
public AjaxResult list(SysMenu menu)
|
public AjaxResult list(SysMenu menu)
|
||||||
{
|
{
|
||||||
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
||||||
return AjaxResult.success(menus);
|
return success(menus);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,7 +51,7 @@ public class SysMenuController extends BaseController
|
||||||
@GetMapping(value = "/{menuId}")
|
@GetMapping(value = "/{menuId}")
|
||||||
public AjaxResult getInfo(@PathVariable Long menuId)
|
public AjaxResult getInfo(@PathVariable Long menuId)
|
||||||
{
|
{
|
||||||
return AjaxResult.success(menuService.selectMenuById(menuId));
|
return success(menuService.selectMenuById(menuId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,7 +61,7 @@ public class SysMenuController extends BaseController
|
||||||
public AjaxResult treeselect(SysMenu menu)
|
public AjaxResult treeselect(SysMenu menu)
|
||||||
{
|
{
|
||||||
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
||||||
return AjaxResult.success(menuService.buildMenuTreeSelect(menus));
|
return success(menuService.buildMenuTreeSelect(menus));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -87,11 +87,11 @@ public class SysMenuController extends BaseController
|
||||||
{
|
{
|
||||||
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||||
}
|
}
|
||||||
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
|
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
return error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||||
}
|
}
|
||||||
menu.setCreateBy(getUsername());
|
menu.setCreateBy(getUsername());
|
||||||
return toAjax(menuService.insertMenu(menu));
|
return toAjax(menuService.insertMenu(menu));
|
||||||
|
@ -107,15 +107,15 @@ public class SysMenuController extends BaseController
|
||||||
{
|
{
|
||||||
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||||
}
|
}
|
||||||
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
|
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
return error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||||
}
|
}
|
||||||
else if (menu.getMenuId().equals(menu.getParentId()))
|
else if (menu.getMenuId().equals(menu.getParentId()))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
|
return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
|
||||||
}
|
}
|
||||||
menu.setUpdateBy(getUsername());
|
menu.setUpdateBy(getUsername());
|
||||||
return toAjax(menuService.updateMenu(menu));
|
return toAjax(menuService.updateMenu(menu));
|
||||||
|
@ -131,11 +131,11 @@ public class SysMenuController extends BaseController
|
||||||
{
|
{
|
||||||
if (menuService.hasChildByMenuId(menuId))
|
if (menuService.hasChildByMenuId(menuId))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("存在子菜单,不允许删除");
|
return warn("存在子菜单,不允许删除");
|
||||||
}
|
}
|
||||||
if (menuService.checkMenuExistRole(menuId))
|
if (menuService.checkMenuExistRole(menuId))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("菜单已分配,不允许删除");
|
return warn("菜单已分配,不允许删除");
|
||||||
}
|
}
|
||||||
return toAjax(menuService.deleteMenuById(menuId));
|
return toAjax(menuService.deleteMenuById(menuId));
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class SysNoticeController extends BaseController
|
||||||
@GetMapping(value = "/{noticeId}")
|
@GetMapping(value = "/{noticeId}")
|
||||||
public AjaxResult getInfo(@PathVariable Long noticeId)
|
public AjaxResult getInfo(@PathVariable Long noticeId)
|
||||||
{
|
{
|
||||||
return AjaxResult.success(noticeService.selectNoticeById(noticeId));
|
return success(noticeService.selectNoticeById(noticeId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class SysPostController extends BaseController
|
||||||
@GetMapping(value = "/{postId}")
|
@GetMapping(value = "/{postId}")
|
||||||
public AjaxResult getInfo(@PathVariable Long postId)
|
public AjaxResult getInfo(@PathVariable Long postId)
|
||||||
{
|
{
|
||||||
return AjaxResult.success(postService.selectPostById(postId));
|
return success(postService.selectPostById(postId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,11 +77,11 @@ public class SysPostController extends BaseController
|
||||||
{
|
{
|
||||||
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||||
}
|
}
|
||||||
else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||||
}
|
}
|
||||||
post.setCreateBy(getUsername());
|
post.setCreateBy(getUsername());
|
||||||
return toAjax(postService.insertPost(post));
|
return toAjax(postService.insertPost(post));
|
||||||
|
@ -97,11 +97,11 @@ public class SysPostController extends BaseController
|
||||||
{
|
{
|
||||||
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||||
}
|
}
|
||||||
else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||||
}
|
}
|
||||||
post.setUpdateBy(getUsername());
|
post.setUpdateBy(getUsername());
|
||||||
return toAjax(postService.updatePost(post));
|
return toAjax(postService.updatePost(post));
|
||||||
|
@ -125,6 +125,6 @@ public class SysPostController extends BaseController
|
||||||
public AjaxResult optionselect()
|
public AjaxResult optionselect()
|
||||||
{
|
{
|
||||||
List<SysPost> posts = postService.selectPostAll();
|
List<SysPost> posts = postService.selectPostAll();
|
||||||
return AjaxResult.success(posts);
|
return success(posts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,12 +66,12 @@ public class SysProfileController extends BaseController
|
||||||
if (StringUtils.isNotEmpty(user.getPhonenumber())
|
if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotEmpty(user.getEmail())
|
if (StringUtils.isNotEmpty(user.getEmail())
|
||||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||||
}
|
}
|
||||||
user.setUserId(sysUser.getUserId());
|
user.setUserId(sysUser.getUserId());
|
||||||
user.setPassword(null);
|
user.setPassword(null);
|
||||||
|
@ -85,9 +85,9 @@ public class SysProfileController extends BaseController
|
||||||
sysUser.setEmail(user.getEmail());
|
sysUser.setEmail(user.getEmail());
|
||||||
sysUser.setSex(user.getSex());
|
sysUser.setSex(user.getSex());
|
||||||
tokenService.setLoginUser(loginUser);
|
tokenService.setLoginUser(loginUser);
|
||||||
return AjaxResult.success();
|
return success();
|
||||||
}
|
}
|
||||||
return AjaxResult.error("修改个人信息异常,请联系管理员");
|
return error("修改个人信息异常,请联系管理员");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -102,20 +102,20 @@ public class SysProfileController extends BaseController
|
||||||
String password = loginUser.getPassword();
|
String password = loginUser.getPassword();
|
||||||
if (!SecurityUtils.matchesPassword(oldPassword, password))
|
if (!SecurityUtils.matchesPassword(oldPassword, password))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("修改密码失败,旧密码错误");
|
return error("修改密码失败,旧密码错误");
|
||||||
}
|
}
|
||||||
if (SecurityUtils.matchesPassword(newPassword, password))
|
if (SecurityUtils.matchesPassword(newPassword, password))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("新密码不能与旧密码相同");
|
return error("新密码不能与旧密码相同");
|
||||||
}
|
}
|
||||||
if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0)
|
if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0)
|
||||||
{
|
{
|
||||||
// 更新缓存用户密码
|
// 更新缓存用户密码
|
||||||
loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword));
|
loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword));
|
||||||
tokenService.setLoginUser(loginUser);
|
tokenService.setLoginUser(loginUser);
|
||||||
return AjaxResult.success();
|
return success();
|
||||||
}
|
}
|
||||||
return AjaxResult.error("修改密码异常,请联系管理员");
|
return error("修改密码异常,请联系管理员");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -139,6 +139,6 @@ public class SysProfileController extends BaseController
|
||||||
return ajax;
|
return ajax;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return AjaxResult.error("上传图片异常,请联系管理员");
|
return error("上传图片异常,请联系管理员");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class SysRoleController extends BaseController
|
||||||
public AjaxResult getInfo(@PathVariable Long roleId)
|
public AjaxResult getInfo(@PathVariable Long roleId)
|
||||||
{
|
{
|
||||||
roleService.checkRoleDataScope(roleId);
|
roleService.checkRoleDataScope(roleId);
|
||||||
return AjaxResult.success(roleService.selectRoleById(roleId));
|
return success(roleService.selectRoleById(roleId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -96,11 +96,11 @@ public class SysRoleController extends BaseController
|
||||||
{
|
{
|
||||||
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||||
}
|
}
|
||||||
else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
|
else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||||
}
|
}
|
||||||
role.setCreateBy(getUsername());
|
role.setCreateBy(getUsername());
|
||||||
return toAjax(roleService.insertRole(role));
|
return toAjax(roleService.insertRole(role));
|
||||||
|
@ -119,11 +119,11 @@ public class SysRoleController extends BaseController
|
||||||
roleService.checkRoleDataScope(role.getRoleId());
|
roleService.checkRoleDataScope(role.getRoleId());
|
||||||
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||||
}
|
}
|
||||||
else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
|
else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||||
}
|
}
|
||||||
role.setUpdateBy(getUsername());
|
role.setUpdateBy(getUsername());
|
||||||
|
|
||||||
|
@ -137,9 +137,9 @@ public class SysRoleController extends BaseController
|
||||||
loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
|
loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
|
||||||
tokenService.setLoginUser(loginUser);
|
tokenService.setLoginUser(loginUser);
|
||||||
}
|
}
|
||||||
return AjaxResult.success();
|
return success();
|
||||||
}
|
}
|
||||||
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
|
return error("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -187,7 +187,7 @@ public class SysRoleController extends BaseController
|
||||||
@GetMapping("/optionselect")
|
@GetMapping("/optionselect")
|
||||||
public AjaxResult optionselect()
|
public AjaxResult optionselect()
|
||||||
{
|
{
|
||||||
return AjaxResult.success(roleService.selectRoleAll());
|
return success(roleService.selectRoleAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class SysUserController extends BaseController
|
||||||
List<SysUser> userList = util.importExcel(file.getInputStream());
|
List<SysUser> userList = util.importExcel(file.getInputStream());
|
||||||
String operName = getUsername();
|
String operName = getUsername();
|
||||||
String message = userService.importUser(userList, updateSupport, operName);
|
String message = userService.importUser(userList, updateSupport, operName);
|
||||||
return AjaxResult.success(message);
|
return success(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/importTemplate")
|
@PostMapping("/importTemplate")
|
||||||
|
@ -127,17 +127,17 @@ public class SysUserController extends BaseController
|
||||||
{
|
{
|
||||||
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user)))
|
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user)))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||||
}
|
}
|
||||||
else if (StringUtils.isNotEmpty(user.getPhonenumber())
|
else if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||||
}
|
}
|
||||||
else if (StringUtils.isNotEmpty(user.getEmail())
|
else if (StringUtils.isNotEmpty(user.getEmail())
|
||||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||||
}
|
}
|
||||||
user.setCreateBy(getUsername());
|
user.setCreateBy(getUsername());
|
||||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||||
|
@ -156,17 +156,17 @@ public class SysUserController extends BaseController
|
||||||
userService.checkUserDataScope(user.getUserId());
|
userService.checkUserDataScope(user.getUserId());
|
||||||
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user)))
|
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user)))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
|
return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||||
}
|
}
|
||||||
else if (StringUtils.isNotEmpty(user.getPhonenumber())
|
else if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||||
}
|
}
|
||||||
else if (StringUtils.isNotEmpty(user.getEmail())
|
else if (StringUtils.isNotEmpty(user.getEmail())
|
||||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||||
}
|
}
|
||||||
user.setUpdateBy(getUsername());
|
user.setUpdateBy(getUsername());
|
||||||
return toAjax(userService.updateUser(user));
|
return toAjax(userService.updateUser(user));
|
||||||
|
@ -251,6 +251,6 @@ public class SysUserController extends BaseController
|
||||||
@GetMapping("/deptTree")
|
@GetMapping("/deptTree")
|
||||||
public AjaxResult deptTree(SysDept dept)
|
public AjaxResult deptTree(SysDept dept)
|
||||||
{
|
{
|
||||||
return AjaxResult.success(deptService.selectDeptTreeList(dept));
|
return success(deptService.selectDeptTreeList(dept));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,4 +86,9 @@ public class HttpStatus
|
||||||
* 接口未实现
|
* 接口未实现
|
||||||
*/
|
*/
|
||||||
public static final int NOT_IMPLEMENTED = 501;
|
public static final int NOT_IMPLEMENTED = 501;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统警告消息
|
||||||
|
*/
|
||||||
|
public static final int WARN = 601;
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,6 +114,14 @@ public class BaseController
|
||||||
return AjaxResult.success(message);
|
return AjaxResult.success(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回成功消息
|
||||||
|
*/
|
||||||
|
public AjaxResult success(Object data)
|
||||||
|
{
|
||||||
|
return AjaxResult.success(data);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回失败消息
|
* 返回失败消息
|
||||||
*/
|
*/
|
||||||
|
@ -122,6 +130,14 @@ public class BaseController
|
||||||
return AjaxResult.error(message);
|
return AjaxResult.error(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回警告消息
|
||||||
|
*/
|
||||||
|
public AjaxResult warn(String message)
|
||||||
|
{
|
||||||
|
return AjaxResult.warn(message);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 响应返回结果
|
* 响应返回结果
|
||||||
*
|
*
|
||||||
|
|
|
@ -101,6 +101,29 @@ public class AjaxResult extends HashMap<String, Object>
|
||||||
return new AjaxResult(HttpStatus.SUCCESS, msg, data);
|
return new AjaxResult(HttpStatus.SUCCESS, msg, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回警告消息
|
||||||
|
*
|
||||||
|
* @param msg 返回内容
|
||||||
|
* @return 警告消息
|
||||||
|
*/
|
||||||
|
public static AjaxResult warn(String msg)
|
||||||
|
{
|
||||||
|
return AjaxResult.warn(msg, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回警告消息
|
||||||
|
*
|
||||||
|
* @param msg 返回内容
|
||||||
|
* @param data 数据对象
|
||||||
|
* @return 警告消息
|
||||||
|
*/
|
||||||
|
public static AjaxResult warn(String msg, Object data)
|
||||||
|
{
|
||||||
|
return new AjaxResult(HttpStatus.WARN, msg, data);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回错误消息
|
* 返回错误消息
|
||||||
*
|
*
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class GenController extends BaseController
|
||||||
map.put("info", table);
|
map.put("info", table);
|
||||||
map.put("rows", list);
|
map.put("rows", list);
|
||||||
map.put("tables", tables);
|
map.put("tables", tables);
|
||||||
return AjaxResult.success(map);
|
return success(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -110,7 +110,7 @@ public class GenController extends BaseController
|
||||||
// 查询表信息
|
// 查询表信息
|
||||||
List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames);
|
List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames);
|
||||||
genTableService.importGenTable(tableList);
|
genTableService.importGenTable(tableList);
|
||||||
return AjaxResult.success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -123,7 +123,7 @@ public class GenController extends BaseController
|
||||||
{
|
{
|
||||||
genTableService.validateEdit(genTable);
|
genTableService.validateEdit(genTable);
|
||||||
genTableService.updateGenTable(genTable);
|
genTableService.updateGenTable(genTable);
|
||||||
return AjaxResult.success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -135,7 +135,7 @@ public class GenController extends BaseController
|
||||||
public AjaxResult remove(@PathVariable Long[] tableIds)
|
public AjaxResult remove(@PathVariable Long[] tableIds)
|
||||||
{
|
{
|
||||||
genTableService.deleteGenTableByIds(tableIds);
|
genTableService.deleteGenTableByIds(tableIds);
|
||||||
return AjaxResult.success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -146,7 +146,7 @@ public class GenController extends BaseController
|
||||||
public AjaxResult preview(@PathVariable("tableId") Long tableId) throws IOException
|
public AjaxResult preview(@PathVariable("tableId") Long tableId) throws IOException
|
||||||
{
|
{
|
||||||
Map<String, String> dataMap = genTableService.previewCode(tableId);
|
Map<String, String> dataMap = genTableService.previewCode(tableId);
|
||||||
return AjaxResult.success(dataMap);
|
return success(dataMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -170,7 +170,7 @@ public class GenController extends BaseController
|
||||||
public AjaxResult genCode(@PathVariable("tableName") String tableName)
|
public AjaxResult genCode(@PathVariable("tableName") String tableName)
|
||||||
{
|
{
|
||||||
genTableService.generatorCode(tableName);
|
genTableService.generatorCode(tableName);
|
||||||
return AjaxResult.success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -182,7 +182,7 @@ public class GenController extends BaseController
|
||||||
public AjaxResult synchDb(@PathVariable("tableName") String tableName)
|
public AjaxResult synchDb(@PathVariable("tableName") String tableName)
|
||||||
{
|
{
|
||||||
genTableService.synchDb(tableName);
|
genTableService.synchDb(tableName);
|
||||||
return AjaxResult.success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class ${ClassName}Controller extends BaseController
|
||||||
public AjaxResult list(${ClassName} ${className})
|
public AjaxResult list(${ClassName} ${className})
|
||||||
{
|
{
|
||||||
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
|
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
|
||||||
return AjaxResult.success(list);
|
return success(list);
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ public class ${ClassName}Controller extends BaseController
|
||||||
@GetMapping(value = "/{${pkColumn.javaField}}")
|
@GetMapping(value = "/{${pkColumn.javaField}}")
|
||||||
public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField})
|
public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField})
|
||||||
{
|
{
|
||||||
return AjaxResult.success(${className}Service.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField}));
|
return success(${className}Service.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class SysJobController extends BaseController
|
||||||
@GetMapping(value = "/{jobId}")
|
@GetMapping(value = "/{jobId}")
|
||||||
public AjaxResult getInfo(@PathVariable("jobId") Long jobId)
|
public AjaxResult getInfo(@PathVariable("jobId") Long jobId)
|
||||||
{
|
{
|
||||||
return AjaxResult.success(jobService.selectJobById(jobId));
|
return success(jobService.selectJobById(jobId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class SysJobLogController extends BaseController
|
||||||
@GetMapping(value = "/{configId}")
|
@GetMapping(value = "/{configId}")
|
||||||
public AjaxResult getInfo(@PathVariable Long jobLogId)
|
public AjaxResult getInfo(@PathVariable Long jobLogId)
|
||||||
{
|
{
|
||||||
return AjaxResult.success(jobLogService.selectJobLogById(jobLogId));
|
return success(jobLogService.selectJobLogById(jobLogId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,6 +87,6 @@ public class SysJobLogController extends BaseController
|
||||||
public AjaxResult clean()
|
public AjaxResult clean()
|
||||||
{
|
{
|
||||||
jobLogService.cleanJobLog();
|
jobLogService.cleanJobLog();
|
||||||
return AjaxResult.success();
|
return success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,12 @@ service.interceptors.response.use(res => {
|
||||||
type: 'error'
|
type: 'error'
|
||||||
})
|
})
|
||||||
return Promise.reject(new Error(msg))
|
return Promise.reject(new Error(msg))
|
||||||
|
} else if (code === 601) {
|
||||||
|
Message({
|
||||||
|
message: msg,
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
return Promise.reject('error')
|
||||||
} else if (code !== 200) {
|
} else if (code !== 200) {
|
||||||
Notification.error({
|
Notification.error({
|
||||||
title: msg
|
title: msg
|
||||||
|
|
Loading…
Reference in New Issue