mirror of https://gitee.com/y_project/RuoYi.git
优化代码
parent
ac1e66b4b6
commit
7040cd26c6
|
@ -12,7 +12,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
@ -84,7 +83,7 @@ public class SysConfigController extends BaseController
|
|||
@ResponseBody
|
||||
public AjaxResult addSave(@Validated SysConfig config)
|
||||
{
|
||||
if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
||||
if (configService.checkConfigKeyUnique(config))
|
||||
{
|
||||
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
|
@ -112,7 +111,7 @@ public class SysConfigController extends BaseController
|
|||
@ResponseBody
|
||||
public AjaxResult editSave(@Validated SysConfig config)
|
||||
{
|
||||
if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
||||
if (configService.checkConfigKeyUnique(config))
|
||||
{
|
||||
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
|
@ -151,7 +150,7 @@ public class SysConfigController extends BaseController
|
|||
*/
|
||||
@PostMapping("/checkConfigKeyUnique")
|
||||
@ResponseBody
|
||||
public String checkConfigKeyUnique(SysConfig config)
|
||||
public boolean checkConfigKeyUnique(SysConfig config)
|
||||
{
|
||||
return configService.checkConfigKeyUnique(config);
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ public class SysDeptController extends BaseController
|
|||
@ResponseBody
|
||||
public AjaxResult addSave(@Validated SysDept dept)
|
||||
{
|
||||
if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
||||
if (deptService.checkDeptNameUnique(dept))
|
||||
{
|
||||
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ public class SysDeptController extends BaseController
|
|||
{
|
||||
Long deptId = dept.getDeptId();
|
||||
deptService.checkDeptDataScope(deptId);
|
||||
if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
||||
if (deptService.checkDeptNameUnique(dept))
|
||||
{
|
||||
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ public class SysDeptController extends BaseController
|
|||
*/
|
||||
@PostMapping("/checkDeptNameUnique")
|
||||
@ResponseBody
|
||||
public String checkDeptNameUnique(SysDept dept)
|
||||
public boolean checkDeptNameUnique(SysDept dept)
|
||||
{
|
||||
return deptService.checkDeptNameUnique(dept);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.Ztree;
|
||||
|
@ -83,7 +82,7 @@ public class SysDictTypeController extends BaseController
|
|||
@ResponseBody
|
||||
public AjaxResult addSave(@Validated SysDictType dict)
|
||||
{
|
||||
if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
||||
if (dictTypeService.checkDictTypeUnique(dict))
|
||||
{
|
||||
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
|
@ -111,7 +110,7 @@ public class SysDictTypeController extends BaseController
|
|||
@ResponseBody
|
||||
public AjaxResult editSave(@Validated SysDictType dict)
|
||||
{
|
||||
if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
||||
if (dictTypeService.checkDictTypeUnique(dict))
|
||||
{
|
||||
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
|
@ -159,7 +158,7 @@ public class SysDictTypeController extends BaseController
|
|||
*/
|
||||
@PostMapping("/checkDictTypeUnique")
|
||||
@ResponseBody
|
||||
public String checkDictTypeUnique(SysDictType dictType)
|
||||
public boolean checkDictTypeUnique(SysDictType dictType)
|
||||
{
|
||||
return dictTypeService.checkDictTypeUnique(dictType);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.Ztree;
|
||||
|
@ -105,7 +104,7 @@ public class SysMenuController extends BaseController
|
|||
@ResponseBody
|
||||
public AjaxResult addSave(@Validated SysMenu menu)
|
||||
{
|
||||
if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
||||
if (menuService.checkMenuNameUnique(menu))
|
||||
{
|
||||
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
}
|
||||
|
@ -134,7 +133,7 @@ public class SysMenuController extends BaseController
|
|||
@ResponseBody
|
||||
public AjaxResult editSave(@Validated SysMenu menu)
|
||||
{
|
||||
if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
||||
if (menuService.checkMenuNameUnique(menu))
|
||||
{
|
||||
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
}
|
||||
|
@ -157,7 +156,7 @@ public class SysMenuController extends BaseController
|
|||
*/
|
||||
@PostMapping("/checkMenuNameUnique")
|
||||
@ResponseBody
|
||||
public String checkMenuNameUnique(SysMenu menu)
|
||||
public boolean checkMenuNameUnique(SysMenu menu)
|
||||
{
|
||||
return menuService.checkMenuNameUnique(menu);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
@ -97,11 +96,11 @@ public class SysPostController extends BaseController
|
|||
@ResponseBody
|
||||
public AjaxResult addSave(@Validated SysPost post)
|
||||
{
|
||||
if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
||||
if (postService.checkPostNameUnique(post))
|
||||
{
|
||||
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||
}
|
||||
else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
||||
else if (postService.checkPostCodeUnique(post))
|
||||
{
|
||||
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||
}
|
||||
|
@ -129,11 +128,11 @@ public class SysPostController extends BaseController
|
|||
@ResponseBody
|
||||
public AjaxResult editSave(@Validated SysPost post)
|
||||
{
|
||||
if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
||||
if (postService.checkPostNameUnique(post))
|
||||
{
|
||||
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||
}
|
||||
else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
||||
else if (postService.checkPostCodeUnique(post))
|
||||
{
|
||||
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||
}
|
||||
|
@ -146,7 +145,7 @@ public class SysPostController extends BaseController
|
|||
*/
|
||||
@PostMapping("/checkPostNameUnique")
|
||||
@ResponseBody
|
||||
public String checkPostNameUnique(SysPost post)
|
||||
public boolean checkPostNameUnique(SysPost post)
|
||||
{
|
||||
return postService.checkPostNameUnique(post);
|
||||
}
|
||||
|
@ -156,7 +155,7 @@ public class SysPostController extends BaseController
|
|||
*/
|
||||
@PostMapping("/checkPostCodeUnique")
|
||||
@ResponseBody
|
||||
public String checkPostCodeUnique(SysPost post)
|
||||
public boolean checkPostCodeUnique(SysPost post)
|
||||
{
|
||||
return postService.checkPostCodeUnique(post);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
|
@ -134,13 +133,11 @@ public class SysProfileController extends BaseController
|
|||
currentUser.setEmail(user.getEmail());
|
||||
currentUser.setPhonenumber(user.getPhonenumber());
|
||||
currentUser.setSex(user.getSex());
|
||||
if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||
&& UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(currentUser)))
|
||||
if (StringUtils.isNotEmpty(user.getPhonenumber()) && userService.checkPhoneUnique(currentUser))
|
||||
{
|
||||
return error("修改用户'" + currentUser.getLoginName() + "'失败,手机号码已存在");
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(user.getEmail())
|
||||
&& UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(currentUser)))
|
||||
else if (StringUtils.isNotEmpty(user.getEmail()) && userService.checkEmailUnique(currentUser))
|
||||
{
|
||||
return error("修改用户'" + currentUser.getLoginName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.Ztree;
|
||||
|
@ -93,11 +92,11 @@ public class SysRoleController extends BaseController
|
|||
@ResponseBody
|
||||
public AjaxResult addSave(@Validated SysRole role)
|
||||
{
|
||||
if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
||||
if (roleService.checkRoleNameUnique(role))
|
||||
{
|
||||
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
}
|
||||
else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
|
||||
else if (roleService.checkRoleKeyUnique(role))
|
||||
{
|
||||
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||
}
|
||||
|
@ -130,11 +129,11 @@ public class SysRoleController extends BaseController
|
|||
{
|
||||
roleService.checkRoleAllowed(role);
|
||||
roleService.checkRoleDataScope(role.getRoleId());
|
||||
if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
||||
if (roleService.checkRoleNameUnique(role))
|
||||
{
|
||||
return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
}
|
||||
else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
|
||||
else if (roleService.checkRoleKeyUnique(role))
|
||||
{
|
||||
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||
}
|
||||
|
@ -187,7 +186,7 @@ public class SysRoleController extends BaseController
|
|||
*/
|
||||
@PostMapping("/checkRoleNameUnique")
|
||||
@ResponseBody
|
||||
public String checkRoleNameUnique(SysRole role)
|
||||
public boolean checkRoleNameUnique(SysRole role)
|
||||
{
|
||||
return roleService.checkRoleNameUnique(role);
|
||||
}
|
||||
|
@ -197,7 +196,7 @@ public class SysRoleController extends BaseController
|
|||
*/
|
||||
@PostMapping("/checkRoleKeyUnique")
|
||||
@ResponseBody
|
||||
public String checkRoleKeyUnique(SysRole role)
|
||||
public boolean checkRoleKeyUnique(SysRole role)
|
||||
{
|
||||
return roleService.checkRoleKeyUnique(role);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.Ztree;
|
||||
|
@ -130,17 +129,15 @@ public class SysUserController extends BaseController
|
|||
@ResponseBody
|
||||
public AjaxResult addSave(@Validated SysUser user)
|
||||
{
|
||||
if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(user)))
|
||||
if (userService.checkLoginNameUnique(user))
|
||||
{
|
||||
return error("新增用户'" + user.getLoginName() + "'失败,登录账号已存在");
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||
&& UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
||||
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && userService.checkPhoneUnique(user))
|
||||
{
|
||||
return error("新增用户'" + user.getLoginName() + "'失败,手机号码已存在");
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(user.getEmail())
|
||||
&& UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
||||
else if (StringUtils.isNotEmpty(user.getEmail()) && userService.checkEmailUnique(user))
|
||||
{
|
||||
return error("新增用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
|
@ -176,17 +173,15 @@ public class SysUserController extends BaseController
|
|||
{
|
||||
userService.checkUserAllowed(user);
|
||||
userService.checkUserDataScope(user.getUserId());
|
||||
if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(user)))
|
||||
if (userService.checkLoginNameUnique(user))
|
||||
{
|
||||
return error("修改用户'" + user.getLoginName() + "'失败,登录账号已存在");
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||
&& UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
||||
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && userService.checkPhoneUnique(user))
|
||||
{
|
||||
return error("修改用户'" + user.getLoginName() + "'失败,手机号码已存在");
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(user.getEmail())
|
||||
&& UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
||||
else if (StringUtils.isNotEmpty(user.getEmail()) && userService.checkEmailUnique(user))
|
||||
{
|
||||
return error("修改用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
|
@ -271,7 +266,7 @@ public class SysUserController extends BaseController
|
|||
*/
|
||||
@PostMapping("/checkLoginNameUnique")
|
||||
@ResponseBody
|
||||
public String checkLoginNameUnique(SysUser user)
|
||||
public boolean checkLoginNameUnique(SysUser user)
|
||||
{
|
||||
return userService.checkLoginNameUnique(user);
|
||||
}
|
||||
|
@ -281,7 +276,7 @@ public class SysUserController extends BaseController
|
|||
*/
|
||||
@PostMapping("/checkPhoneUnique")
|
||||
@ResponseBody
|
||||
public String checkPhoneUnique(SysUser user)
|
||||
public boolean checkPhoneUnique(SysUser user)
|
||||
{
|
||||
return userService.checkPhoneUnique(user);
|
||||
}
|
||||
|
@ -291,7 +286,7 @@ public class SysUserController extends BaseController
|
|||
*/
|
||||
@PostMapping("/checkEmailUnique")
|
||||
@ResponseBody
|
||||
public String checkEmailUnique(SysUser user)
|
||||
public boolean checkEmailUnique(SysUser user)
|
||||
{
|
||||
return userService.checkEmailUnique(user);
|
||||
}
|
||||
|
|
|
@ -1347,13 +1347,6 @@ var table = {
|
|||
},
|
||||
// 校验封装处理
|
||||
validate: {
|
||||
// 判断返回标识是否唯一 false 为存在 true 为不存在
|
||||
unique: function (value) {
|
||||
if (value == "0") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
// 表单验证
|
||||
form: function (formId) {
|
||||
var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId;
|
||||
|
|
|
@ -57,9 +57,6 @@
|
|||
"configKey": function() {
|
||||
return $.common.trim($("#configKey").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function(data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -76,9 +76,6 @@
|
|||
"deptName" : function() {
|
||||
return $.common.trim($("#deptName").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function(data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -80,9 +80,6 @@
|
|||
"deptName": function() {
|
||||
return $.common.trim($("#deptName").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function(data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -53,9 +53,6 @@
|
|||
name : function() {
|
||||
return $.common.trim($("#dictType").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function(data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -57,9 +57,6 @@
|
|||
dictType : function() {
|
||||
return $.common.trim($("#dictType").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function(data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -113,9 +113,6 @@
|
|||
"menuName" : function() {
|
||||
return $.common.trim($("#menuName").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function(data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -122,9 +122,6 @@
|
|||
"menuName": function() {
|
||||
return $.common.trim($("#menuName").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function(data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -57,9 +57,6 @@
|
|||
"postName" : function() {
|
||||
return $.common.trim($("#postName").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function(data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -72,9 +69,6 @@
|
|||
"postCode" : function() {
|
||||
return $.common.trim($("#postCode").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function(data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -61,9 +61,6 @@
|
|||
"postName" : function() {
|
||||
return $.common.trim($("#postName").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function(data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -79,9 +76,6 @@
|
|||
"postCode" : function() {
|
||||
return $.common.trim($("#postCode").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function(data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -81,9 +81,6 @@
|
|||
"roleName" : function() {
|
||||
return $.common.trim($("#roleName").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function(data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -96,9 +93,6 @@
|
|||
"roleKey" : function() {
|
||||
return $.common.trim($("#roleKey").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function(data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -85,9 +85,6 @@
|
|||
"roleName": function() {
|
||||
return $.common.trim($("#roleName").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function(data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -103,9 +100,6 @@
|
|||
"roleKey": function() {
|
||||
return $.common.trim($("#roleKey").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function(data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -163,9 +163,6 @@
|
|||
"loginName": function() {
|
||||
return $.common.trim($("#loginName").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function(data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -183,9 +180,6 @@
|
|||
"email": function () {
|
||||
return $.common.trim($("#email").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function (data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -199,9 +193,6 @@
|
|||
"phonenumber": function () {
|
||||
return $.common.trim($("#phonenumber").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function (data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -150,9 +150,6 @@
|
|||
"email": function() {
|
||||
return $.common.trim($("#email").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function (data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -169,9 +166,6 @@
|
|||
"phonenumber": function() {
|
||||
return $.common.trim($("#phonenumber").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function (data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -197,9 +197,6 @@
|
|||
"email": function() {
|
||||
return $.common.trim($("#email").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function (data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -217,9 +214,6 @@
|
|||
"phonenumber": function() {
|
||||
return $.common.trim($("#phonenumber").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function (data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -35,6 +35,10 @@ public class UserConstants
|
|||
|
||||
/** 是否为系统默认(是) */
|
||||
public static final String YES = "Y";
|
||||
|
||||
/** 是否唯一的返回标识 */
|
||||
public final static boolean UNIQUE = true;
|
||||
public final static boolean NOT_UNIQUE = false;
|
||||
|
||||
/**
|
||||
* 用户名长度限制
|
||||
|
@ -42,50 +46,6 @@ public class UserConstants
|
|||
public static final int USERNAME_MIN_LENGTH = 2;
|
||||
public static final int USERNAME_MAX_LENGTH = 20;
|
||||
|
||||
/** 登录名称是否唯一的返回结果码 */
|
||||
public final static String USER_NAME_UNIQUE = "0";
|
||||
public final static String USER_NAME_NOT_UNIQUE = "1";
|
||||
|
||||
/** 手机号码是否唯一的返回结果 */
|
||||
public final static String USER_PHONE_UNIQUE = "0";
|
||||
public final static String USER_PHONE_NOT_UNIQUE = "1";
|
||||
|
||||
/** e-mail 是否唯一的返回结果 */
|
||||
public final static String USER_EMAIL_UNIQUE = "0";
|
||||
public final static String USER_EMAIL_NOT_UNIQUE = "1";
|
||||
|
||||
/** 部门名称是否唯一的返回结果码 */
|
||||
public final static String DEPT_NAME_UNIQUE = "0";
|
||||
public final static String DEPT_NAME_NOT_UNIQUE = "1";
|
||||
|
||||
/** 角色名称是否唯一的返回结果码 */
|
||||
public final static String ROLE_NAME_UNIQUE = "0";
|
||||
public final static String ROLE_NAME_NOT_UNIQUE = "1";
|
||||
|
||||
/** 岗位名称是否唯一的返回结果码 */
|
||||
public final static String POST_NAME_UNIQUE = "0";
|
||||
public final static String POST_NAME_NOT_UNIQUE = "1";
|
||||
|
||||
/** 角色权限是否唯一的返回结果码 */
|
||||
public final static String ROLE_KEY_UNIQUE = "0";
|
||||
public final static String ROLE_KEY_NOT_UNIQUE = "1";
|
||||
|
||||
/** 岗位编码是否唯一的返回结果码 */
|
||||
public final static String POST_CODE_UNIQUE = "0";
|
||||
public final static String POST_CODE_NOT_UNIQUE = "1";
|
||||
|
||||
/** 菜单名称是否唯一的返回结果码 */
|
||||
public final static String MENU_NAME_UNIQUE = "0";
|
||||
public final static String MENU_NAME_NOT_UNIQUE = "1";
|
||||
|
||||
/** 字典类型是否唯一的返回结果码 */
|
||||
public final static String DICT_TYPE_UNIQUE = "0";
|
||||
public final static String DICT_TYPE_NOT_UNIQUE = "1";
|
||||
|
||||
/** 参数键名是否唯一的返回结果码 */
|
||||
public final static String CONFIG_KEY_UNIQUE = "0";
|
||||
public final static String CONFIG_KEY_NOT_UNIQUE = "1";
|
||||
|
||||
/**
|
||||
* 密码长度限制
|
||||
*/
|
||||
|
|
|
@ -145,16 +145,20 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* 计算两个时间差
|
||||
* 计算时间差(单位:分钟)
|
||||
*
|
||||
* @param endTime 最后时间
|
||||
* @param startTime 开始时间
|
||||
* @return 时间差(天/小时/分钟)
|
||||
*/
|
||||
public static String getDatePoor(Date endDate, Date nowDate)
|
||||
public static String timeDistance(Date endDate, Date startTime)
|
||||
{
|
||||
long nd = 1000 * 24 * 60 * 60;
|
||||
long nh = 1000 * 60 * 60;
|
||||
long nm = 1000 * 60;
|
||||
// long ns = 1000;
|
||||
// 获得两个时间的毫秒时间差异
|
||||
long diff = endDate.getTime() - nowDate.getTime();
|
||||
long diff = endDate.getTime() - startTime.getTime();
|
||||
// 计算差多少天
|
||||
long day = diff / nd;
|
||||
// 计算差多少小时
|
||||
|
|
|
@ -1321,7 +1321,7 @@ public class ExcelUtil<T>
|
|||
*/
|
||||
public String encodingFilename(String filename)
|
||||
{
|
||||
filename = UUID.randomUUID().toString() + "_" + filename + ".xlsx";
|
||||
filename = UUID.randomUUID() + "_" + filename + ".xlsx";
|
||||
return filename;
|
||||
}
|
||||
|
||||
|
@ -1598,7 +1598,7 @@ public class ExcelUtil<T>
|
|||
HSSFPicture pic = (HSSFPicture) shape;
|
||||
int pictureIndex = pic.getPictureIndex() - 1;
|
||||
HSSFPictureData picData = pictures.get(pictureIndex);
|
||||
String picIndex = String.valueOf(anchor.getRow1()) + "_" + String.valueOf(anchor.getCol1());
|
||||
String picIndex = anchor.getRow1() + "_" + String.valueOf(anchor.getCol1());
|
||||
sheetIndexPicMap.put(picIndex, picData);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class Seq
|
|||
private static AtomicInteger uploadSeq = new AtomicInteger(1);
|
||||
|
||||
// 机器标识
|
||||
private static String machineCode = "A";
|
||||
private static final String machineCode = "A";
|
||||
|
||||
/**
|
||||
* 获取通用序列号
|
||||
|
|
|
@ -58,7 +58,7 @@ public class SysRegisterService
|
|||
{
|
||||
msg = "账户长度必须在2到20个字符之间";
|
||||
}
|
||||
else if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(user)))
|
||||
else if (userService.checkLoginNameUnique(user))
|
||||
{
|
||||
msg = "保存用户'" + loginName + "'失败,注册账号已存在";
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ public class Jvm
|
|||
*/
|
||||
public String getRunTime()
|
||||
{
|
||||
return DateUtils.getDatePoor(DateUtils.getNowDate(), DateUtils.getServerStartDate());
|
||||
return DateUtils.timeDistance(DateUtils.getNowDate(), DateUtils.getServerStartDate());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -78,5 +78,5 @@ public interface ISysConfigService
|
|||
* @param config 参数信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkConfigKeyUnique(SysConfig config);
|
||||
public boolean checkConfigKeyUnique(SysConfig config);
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ public interface ISysDeptService
|
|||
* @param dept 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkDeptNameUnique(SysDept dept);
|
||||
public boolean checkDeptNameUnique(SysDept dept);
|
||||
|
||||
/**
|
||||
* 校验部门是否有数据权限
|
||||
|
|
|
@ -95,7 +95,7 @@ public interface ISysDictTypeService
|
|||
* @param dictType 字典类型
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkDictTypeUnique(SysDictType dictType);
|
||||
public boolean checkDictTypeUnique(SysDictType dictType);
|
||||
|
||||
/**
|
||||
* 查询字典类型树
|
||||
|
|
|
@ -135,5 +135,5 @@ public interface ISysMenuService
|
|||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkMenuNameUnique(SysMenu menu);
|
||||
public boolean checkMenuNameUnique(SysMenu menu);
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ public interface ISysPostService
|
|||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkPostNameUnique(SysPost post);
|
||||
public boolean checkPostNameUnique(SysPost post);
|
||||
|
||||
/**
|
||||
* 校验岗位编码
|
||||
|
@ -87,5 +87,5 @@ public interface ISysPostService
|
|||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkPostCodeUnique(SysPost post);
|
||||
public boolean checkPostCodeUnique(SysPost post);
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ public interface ISysRoleService
|
|||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkRoleNameUnique(SysRole role);
|
||||
public boolean checkRoleNameUnique(SysRole role);
|
||||
|
||||
/**
|
||||
* 校验角色权限是否唯一
|
||||
|
@ -106,7 +106,7 @@ public interface ISysRoleService
|
|||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkRoleKeyUnique(SysRole role);
|
||||
public boolean checkRoleKeyUnique(SysRole role);
|
||||
|
||||
/**
|
||||
* 校验角色是否允许操作
|
||||
|
|
|
@ -146,7 +146,7 @@ public interface ISysUserService
|
|||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkLoginNameUnique(SysUser user);
|
||||
public boolean checkLoginNameUnique(SysUser user);
|
||||
|
||||
/**
|
||||
* 校验手机号码是否唯一
|
||||
|
@ -154,7 +154,7 @@ public interface ISysUserService
|
|||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkPhoneUnique(SysUser user);
|
||||
public boolean checkPhoneUnique(SysUser user);
|
||||
|
||||
/**
|
||||
* 校验email是否唯一
|
||||
|
@ -162,7 +162,7 @@ public interface ISysUserService
|
|||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkEmailUnique(SysUser user);
|
||||
public boolean checkEmailUnique(SysUser user);
|
||||
|
||||
/**
|
||||
* 校验用户是否允许操作
|
||||
|
|
|
@ -185,15 +185,15 @@ public class SysConfigServiceImpl implements ISysConfigService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkConfigKeyUnique(SysConfig config)
|
||||
public boolean checkConfigKeyUnique(SysConfig config)
|
||||
{
|
||||
Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId();
|
||||
SysConfig info = configMapper.checkConfigKeyUnique(config.getConfigKey());
|
||||
if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue())
|
||||
{
|
||||
return UserConstants.CONFIG_KEY_NOT_UNIQUE;
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.CONFIG_KEY_UNIQUE;
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -295,15 +295,15 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkDeptNameUnique(SysDept dept)
|
||||
public boolean checkDeptNameUnique(SysDept dept)
|
||||
{
|
||||
Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId();
|
||||
SysDept info = deptMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId());
|
||||
if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue())
|
||||
{
|
||||
return UserConstants.DEPT_NAME_NOT_UNIQUE;
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.DEPT_NAME_UNIQUE;
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -214,15 +214,15 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkDictTypeUnique(SysDictType dict)
|
||||
public boolean checkDictTypeUnique(SysDictType dict)
|
||||
{
|
||||
Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId();
|
||||
SysDictType dictType = dictTypeMapper.checkDictTypeUnique(dict.getDictType());
|
||||
if (StringUtils.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue())
|
||||
{
|
||||
return UserConstants.DICT_TYPE_NOT_UNIQUE;
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.DICT_TYPE_UNIQUE;
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -328,15 +328,15 @@ public class SysMenuServiceImpl implements ISysMenuService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkMenuNameUnique(SysMenu menu)
|
||||
public boolean checkMenuNameUnique(SysMenu menu)
|
||||
{
|
||||
Long menuId = StringUtils.isNull(menu.getMenuId()) ? -1L : menu.getMenuId();
|
||||
SysMenu info = menuMapper.checkMenuNameUnique(menu.getMenuName(), menu.getParentId());
|
||||
if (StringUtils.isNotNull(info) && info.getMenuId().longValue() != menuId.longValue())
|
||||
{
|
||||
return UserConstants.MENU_NAME_NOT_UNIQUE;
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.MENU_NAME_UNIQUE;
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -150,15 +150,15 @@ public class SysPostServiceImpl implements ISysPostService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkPostNameUnique(SysPost post)
|
||||
public boolean checkPostNameUnique(SysPost post)
|
||||
{
|
||||
Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
|
||||
SysPost info = postMapper.checkPostNameUnique(post.getPostName());
|
||||
if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue())
|
||||
{
|
||||
return UserConstants.POST_NAME_NOT_UNIQUE;
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.POST_NAME_UNIQUE;
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -168,14 +168,14 @@ public class SysPostServiceImpl implements ISysPostService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkPostCodeUnique(SysPost post)
|
||||
public boolean checkPostCodeUnique(SysPost post)
|
||||
{
|
||||
Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
|
||||
SysPost info = postMapper.checkPostCodeUnique(post.getPostCode());
|
||||
if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue())
|
||||
{
|
||||
return UserConstants.POST_CODE_NOT_UNIQUE;
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.POST_CODE_UNIQUE;
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -278,15 +278,15 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkRoleNameUnique(SysRole role)
|
||||
public boolean checkRoleNameUnique(SysRole role)
|
||||
{
|
||||
Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId();
|
||||
SysRole info = roleMapper.checkRoleNameUnique(role.getRoleName());
|
||||
if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue())
|
||||
{
|
||||
return UserConstants.ROLE_NAME_NOT_UNIQUE;
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.ROLE_NAME_UNIQUE;
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -296,15 +296,15 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkRoleKeyUnique(SysRole role)
|
||||
public boolean checkRoleKeyUnique(SysRole role)
|
||||
{
|
||||
Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId();
|
||||
SysRole info = roleMapper.checkRoleKeyUnique(role.getRoleKey());
|
||||
if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue())
|
||||
{
|
||||
return UserConstants.ROLE_KEY_NOT_UNIQUE;
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.ROLE_KEY_UNIQUE;
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -353,15 +353,15 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkLoginNameUnique(SysUser user)
|
||||
public boolean checkLoginNameUnique(SysUser user)
|
||||
{
|
||||
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
||||
SysUser info = userMapper.checkLoginNameUnique(user.getLoginName());
|
||||
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue())
|
||||
{
|
||||
return UserConstants.USER_NAME_NOT_UNIQUE;
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.USER_NAME_UNIQUE;
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -371,15 +371,15 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String checkPhoneUnique(SysUser user)
|
||||
public boolean checkPhoneUnique(SysUser user)
|
||||
{
|
||||
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
||||
SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber());
|
||||
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue())
|
||||
{
|
||||
return UserConstants.USER_PHONE_NOT_UNIQUE;
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.USER_PHONE_UNIQUE;
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -389,15 +389,15 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String checkEmailUnique(SysUser user)
|
||||
public boolean checkEmailUnique(SysUser user)
|
||||
{
|
||||
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
||||
SysUser info = userMapper.checkEmailUnique(user.getEmail());
|
||||
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue())
|
||||
{
|
||||
return UserConstants.USER_EMAIL_NOT_UNIQUE;
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.USER_EMAIL_UNIQUE;
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue