com.ruoyi.common.constant.UserConstants Java Examples

The following examples show how to use com.ruoyi.common.constant.UserConstants. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: supplierShop   Author: guchengwuyue   File: SysDeptServiceImpl.java    License: MIT License 6 votes vote down vote up
/**
 * 对象转部门树
 *
 * @param deptList 部门列表
 * @param roleDeptList 角色已存在菜单列表
 * @return 树结构列表
 */
public List<Ztree> initZtree(List<SysDept> deptList, List<String> roleDeptList)
{

    List<Ztree> ztrees = new ArrayList<Ztree>();
    boolean isCheck = StringUtils.isNotNull(roleDeptList);
    for (SysDept dept : deptList)
    {
        if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()))
        {
            Ztree ztree = new Ztree();
            ztree.setId(dept.getDeptId());
            ztree.setpId(dept.getParentId());
            ztree.setName(dept.getDeptName());
            ztree.setTitle(dept.getDeptName());
            if (isCheck)
            {
                ztree.setChecked(roleDeptList.contains(dept.getDeptId() + dept.getDeptName()));
            }
            ztrees.add(ztree);
        }
    }
    return ztrees;
}
 
Example #2
Source Project: RuoYi   Author: lerry903   File: SysUserController.java    License: Apache License 2.0 6 votes vote down vote up
@ApiOperation("新增用户")
@ApiImplicitParam(name = "user", value = "新增用户信息", dataType = "SysUser")
@RequiresPermissions("system:user:add")
@Log(title = "用户管理", businessType = BusinessType.INSERT)
@PostMapping("/add")
@Transactional(rollbackFor = Exception.class)
@ResponseBody
public AjaxResult addSave(SysUser user) {
    if (ObjectUtil.isNotNull(user.getUserId()) && SysUser.isAdmin(user.getUserId())) {
        return error("不允许修改超级管理员用户");
    }
    if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(user.getLoginName()))){
        return error("保存用户'" + user.getLoginName() + "'失败,账号已存在");
    }
    user.setSalt(ShiroUtils.randomSalt());
    user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
    user.setCreateBy(ShiroUtils.getLoginName());
    return toAjax(userService.insertUser(user));
}
 
Example #3
Source Project: supplierShop   Author: guchengwuyue   File: SysDeptServiceImpl.java    License: MIT License 6 votes vote down vote up
/**
 * 修改保存部门信息
 * 
 * @param dept 部门信息
 * @return 结果
 */
@Override
@Transactional
public int updateDept(SysDept dept)
{
    SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId());
    SysDept oldDept = selectDeptById(dept.getDeptId());
    if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept))
    {
        String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId();
        String oldAncestors = oldDept.getAncestors();
        dept.setAncestors(newAncestors);
        updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors);
    }
    int result = deptMapper.updateDept(dept);
    if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()))
    {
        // 如果该部门是启用状态,则启用该部门的所有上级部门
        updateParentDeptStatus(dept);
    }
    return result;
}
 
Example #4
Source Project: supplierShop   Author: guchengwuyue   File: SysDictTypeServiceImpl.java    License: MIT License 6 votes vote down vote up
/**
 * 查询字典类型树
 * 
 * @param dictType 字典类型
 * @return 所有字典类型
 */
public List<Ztree> selectDictTree(SysDictType dictType)
{
    List<Ztree> ztrees = new ArrayList<Ztree>();
    List<SysDictType> dictList = dictTypeMapper.selectDictTypeList(dictType);
    for (SysDictType dict : dictList)
    {
        if (UserConstants.DICT_NORMAL.equals(dict.getStatus()))
        {
            Ztree ztree = new Ztree();
            ztree.setId(dict.getDictId());
            ztree.setName(transDictName(dict));
            ztree.setTitle(dict.getDictType());
            ztrees.add(ztree);
        }
    }
    return ztrees;
}
 
Example #5
Source Project: supplierShop   Author: guchengwuyue   File: SysRoleController.java    License: MIT License 6 votes vote down vote up
/**
 * 新增保存角色
 */
@RequiresPermissions("system:role:add")
@Log(title = "角色管理", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(@Validated SysRole role)
{
    if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
    {
        return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
    }
    else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
    {
        return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
    }
    role.setCreateBy(ShiroUtils.getLoginName());
    ShiroUtils.clearCachedAuthorizationInfo();
    return toAjax(roleService.insertRole(role));

}
 
Example #6
Source Project: supplierShop   Author: guchengwuyue   File: SysRoleController.java    License: MIT License 6 votes vote down vote up
/**
 * 修改保存角色
 */
@RequiresPermissions("system:role:edit")
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(@Validated SysRole role)
{
    if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
    {
        return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
    }
    else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
    {
        return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
    }
    role.setUpdateBy(ShiroUtils.getLoginName());
    ShiroUtils.clearCachedAuthorizationInfo();
    return toAjax(roleService.updateRole(role));
}
 
Example #7
Source Project: supplierShop   Author: guchengwuyue   File: SysDeptController.java    License: MIT License 6 votes vote down vote up
/**
 * 保存
 */
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
@RequiresPermissions("system:dept:edit")
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(@Validated SysDept dept)
{
    if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
    {
        return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
    }
    else if (dept.getParentId().equals(dept.getDeptId()))
    {
        return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
    }
    dept.setUpdateBy(ShiroUtils.getLoginName());
    return toAjax(deptService.updateDept(dept));
}
 
Example #8
Source Project: supplierShop   Author: guchengwuyue   File: SysUserController.java    License: MIT License 6 votes vote down vote up
/**
 * 新增保存用户
 */
@RequiresPermissions("system:user:add")
@Log(title = "用户管理", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(@Validated SysUser user)
{
    if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(user.getLoginName())))
    {
        return error("新增用户'" + user.getLoginName() + "'失败,登录账号已存在");
    }
    else if (UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
    {
        return error("新增用户'" + user.getLoginName() + "'失败,手机号码已存在");
    }
    else if (UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
    {
        return error("新增用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
    }
    user.setSalt(ShiroUtils.randomSalt());
    user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
    user.setCreateBy(ShiroUtils.getLoginName());
    return toAjax(userService.insertUser(user));
}
 
Example #9
Source Project: supplierShop   Author: guchengwuyue   File: SysUserController.java    License: MIT License 6 votes vote down vote up
/**
 * 修改保存用户
 */
@RequiresPermissions("system:user:edit")
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(@Validated SysUser user)
{
    if (StringUtils.isNotNull(user.getUserId()) && SysUser.isAdmin(user.getUserId()))
    {
        return error("不允许修改超级管理员用户");
    }
    else if (UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
    {
        return error("修改用户'" + user.getLoginName() + "'失败,手机号码已存在");
    }
    else if (UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
    {
        return error("修改用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
    }
    user.setUpdateBy(ShiroUtils.getLoginName());
    return toAjax(userService.updateUser(user));
}
 
Example #10
Source Project: supplierShop   Author: guchengwuyue   File: SysPostController.java    License: MIT License 6 votes vote down vote up
/**
 * 新增保存岗位
 */
@RequiresPermissions("system:post:add")
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(@Validated SysPost post)
{
    if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
    {
        return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
    }
    else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
    {
        return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
    }
    post.setCreateBy(ShiroUtils.getLoginName());
    return toAjax(postService.insertPost(post));
}
 
Example #11
Source Project: supplierShop   Author: guchengwuyue   File: SysPostController.java    License: MIT License 6 votes vote down vote up
/**
 * 修改保存岗位
 */
@RequiresPermissions("system:post:edit")
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(@Validated SysPost post)
{
    if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
    {
        return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
    }
    else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
    {
        return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
    }
    post.setUpdateBy(ShiroUtils.getLoginName());
    return toAjax(postService.updatePost(post));
}
 
Example #12
Source Project: RuoYi-Vue   Author: yangzongzhuan   File: SysMenuController.java    License: MIT License 6 votes vote down vote up
/**
 * 修改菜单
 */
@PreAuthorize("@ss.hasPermi('system:menu:edit')")
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysMenu menu)
{
    if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
    {
        return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
    }
    else if (UserConstants.YES_FRAME.equals(menu.getIsFrame())
            && !StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS))
    {
        return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
    }
    menu.setUpdateBy(SecurityUtils.getUsername());
    return toAjax(menuService.updateMenu(menu));
}
 
Example #13
Source Project: RuoYi-Vue   Author: yangzongzhuan   File: SysRoleController.java    License: MIT License 6 votes vote down vote up
/**
 * 新增角色
 */
@PreAuthorize("@ss.hasPermi('system:role:add')")
@Log(title = "角色管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysRole role)
{
    if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
    {
        return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
    }
    else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
    {
        return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
    }
    role.setCreateBy(SecurityUtils.getUsername());
    return toAjax(roleService.insertRole(role));

}
 
Example #14
Source Project: RuoYi-Vue   Author: yangzongzhuan   File: SysRoleController.java    License: MIT License 6 votes vote down vote up
/**
 * 修改保存角色
 */
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysRole role)
{
    roleService.checkRoleAllowed(role);
    if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
    {
        return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
    }
    else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
    {
        return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
    }
    role.setUpdateBy(SecurityUtils.getUsername());
    return toAjax(roleService.updateRole(role));
}
 
Example #15
Source Project: RuoYi-Vue   Author: yangzongzhuan   File: SysDeptController.java    License: MIT License 6 votes vote down vote up
/**
 * 修改部门
 */
@PreAuthorize("@ss.hasPermi('system:dept:edit')")
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDept dept)
{
    if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
    {
        return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
    }
    else if (dept.getParentId().equals(dept.getDeptId()))
    {
        return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
    }
    else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
            && deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0)
    {
        return AjaxResult.error("该部门包含未停用的子部门!");
    }
    dept.setUpdateBy(SecurityUtils.getUsername());
    return toAjax(deptService.updateDept(dept));
}
 
Example #16
Source Project: RuoYi   Author: lerry903   File: SysDeptServiceImpl.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 对象转部门树
 *
 * @param deptList     部门列表
 * @param roleDeptList 角色已存在菜单列表
 * @return 部门树
 */
private List<Ztree> initZtree(List<SysDept> deptList, List<String> roleDeptList) {
    List<Ztree> ztrees = new ArrayList<>();
    boolean isCheck = CollectionUtil.isNotEmpty(roleDeptList);
    if(CollectionUtil.isNotEmpty(deptList)){
        deptList.stream()
                .filter(dept-> UserConstants.DEPT_NORMAL.equals(dept.getStatus()))
                .forEach(dept->{
                    Ztree ztree = new Ztree();
                    ztree.setId(dept.getDeptId());
                    ztree.setPId(dept.getParentId());
                    ztree.setName(dept.getDeptName());
                    ztree.setTitle(dept.getDeptName());
                    if (isCheck){
                        ztree.setChecked(roleDeptList.contains(dept.getDeptId() + dept.getDeptName()));
                    }
                    ztrees.add(ztree);
        });
    }
    return ztrees;
}
 
Example #17
Source Project: RuoYi-Vue   Author: yangzongzhuan   File: SysPostController.java    License: MIT License 6 votes vote down vote up
/**
 * 新增岗位
 */
@PreAuthorize("@ss.hasPermi('system:post:add')")
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysPost post)
{
    if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
    {
        return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
    }
    else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
    {
        return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
    }
    post.setCreateBy(SecurityUtils.getUsername());
    return toAjax(postService.insertPost(post));
}
 
Example #18
Source Project: RuoYi-Vue   Author: yangzongzhuan   File: SysDeptServiceImpl.java    License: MIT License 6 votes vote down vote up
/**
 * 修改保存部门信息
 * 
 * @param dept 部门信息
 * @return 结果
 */
@Override
public int updateDept(SysDept dept)
{
    SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId());
    SysDept oldDept = deptMapper.selectDeptById(dept.getDeptId());
    if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept))
    {
        String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId();
        String oldAncestors = oldDept.getAncestors();
        dept.setAncestors(newAncestors);
        updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors);
    }
    int result = deptMapper.updateDept(dept);
    if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()))
    {
        // 如果该部门是启用状态,则启用该部门的所有上级部门
        updateParentDeptStatus(dept);
    }
    return result;
}
 
Example #19
Source Project: RuoYi-Vue   Author: yangzongzhuan   File: SysMenuServiceImpl.java    License: MIT License 6 votes vote down vote up
/**
 * 获取路由地址
 * 
 * @param menu 菜单信息
 * @return 路由地址
 */
public String getRouterPath(SysMenu menu)
{
    String routerPath = menu.getPath();
    // 非外链并且是一级目录(类型为目录)
    if (0 == menu.getParentId().intValue() && UserConstants.TYPE_DIR.equals(menu.getMenuType())
            && UserConstants.NO_FRAME.equals(menu.getIsFrame()))
    {
        routerPath = "/" + menu.getPath();
    }
    // 非外链并且是一级目录(类型为菜单)
    else if (isMeunFrame(menu))
    {
        routerPath = "/";
    }
    return routerPath;
}
 
Example #20
Source Project: RuoYi   Author: lerry903   File: SysDeptServiceImpl.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 修改保存部门信息
 *
 * @param dept 部门信息
 * @return 结果
 */
@Override
public int updateDept(SysDept dept) {
    SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId());
    SysDept oldDept = selectDeptById(dept.getDeptId());
    if (ObjectUtil.isNotNull(newParentDept) && ObjectUtil.isNotNull(oldDept)) {
        String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId();
        String oldAncestors = oldDept.getAncestors();
        dept.setAncestors(newAncestors);
        updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors);
    }
    int result = deptMapper.updateDept(dept);
    if(UserConstants.DEPT_NORMAL.equals(dept.getStatus())){
        //如果该部门是启用状态,这启用该部门的所有上级部门
        updateParentDeptStatus(dept);
    }
    return result;
}
 
Example #21
Source Project: ruoyiplus   Author: kongshanxuelin   File: SysDeptServiceImpl.java    License: MIT License 6 votes vote down vote up
/**
 * 新增保存部门信息
 * 
 * @param dept 部门信息
 * @return 结果
 */
@Override
public int insertDept(SysDept dept)
{
    if(dept.getParentId()==0){
        dept.setAncestors("0");
        return deptMapper.insertDept(dept);
    }else {
        SysDept info = deptMapper.selectDeptById(dept.getParentId());
        // 如果父节点不为"正常"状态,则不允许新增子节点
        if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) {
            throw new BusinessException("部门停用,不允许新增");
        }
        dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
        return deptMapper.insertDept(dept);
    }
}
 
Example #22
Source Project: ruoyiplus   Author: kongshanxuelin   File: SysDeptServiceImpl.java    License: MIT License 6 votes vote down vote up
/**
 * 修改保存部门信息
 * 
 * @param dept 部门信息
 * @return 结果
 */
@Override
public int updateDept(SysDept dept)
{
    SysDept info = deptMapper.selectDeptById(dept.getParentId());
    if (StringUtils.isNotNull(info))
    {
        String ancestors = info.getAncestors() + "," + info.getDeptId();
        dept.setAncestors(ancestors);
        updateDeptChildren(dept.getDeptId(), ancestors);
    }
    int result = deptMapper.updateDept(dept);
    if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()))
    {
        // 如果该部门是启用状态,则启用该部门的所有上级部门
        updateParentDeptStatus(dept);
    }
    return result;
}
 
Example #23
Source Project: RuoYi   Author: lerry903   File: SysUserServiceImpl.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 校验用户名称是否唯一
 *
 * @param user 用户信息
 * @return 校验结果
 */
@Override
public String checkPhoneUnique(SysUser user) {
    SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber());
    if (ObjectUtil.isNotNull(info) && !info.getUserId().equals(user.getUserId())) {
        return UserConstants.USER_PHONE_NOT_UNIQUE;
    }
    return UserConstants.USER_PHONE_UNIQUE;
}
 
Example #24
Source Project: supplierShop   Author: guchengwuyue   File: SysLoginService.java    License: MIT License 5 votes vote down vote up
private boolean maybeMobilePhoneNumber(String username)
{
    if (!username.matches(UserConstants.MOBILE_PHONE_NUMBER_PATTERN))
    {
        return false;
    }
    return true;
}
 
Example #25
Source Project: RuoYi   Author: lerry903   File: SysUserServiceImpl.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 校验用户名称是否唯一
 *
 * @param loginName 用户名
 * @return 校验结果
 */
@Override
public String checkLoginNameUnique(String loginName) {
    int count = userMapper.checkLoginNameUnique(loginName);
    if (count > 0) {
        return UserConstants.USER_NAME_NOT_UNIQUE;
    }
    return UserConstants.USER_NAME_UNIQUE;
}
 
Example #26
Source Project: supplierShop   Author: guchengwuyue   File: SysUserServiceImpl.java    License: MIT License 5 votes vote down vote up
/**
 * 校验用户名称是否唯一
 *
 * @param user 用户信息
 * @return
 */
@Override
public String 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.USER_PHONE_UNIQUE;
}
 
Example #27
Source Project: RuoYi   Author: lerry903   File: SysMenuServiceImpl.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 校验菜单名称是否唯一
 *
 * @param menu 菜单信息
 * @return 结果
 */
@Override
public String checkMenuNameUnique(SysMenu menu) {
    SysMenu info = menuMapper.checkMenuNameUnique(menu.getMenuName(), menu.getParentId());
    if (ObjectUtil.isNotNull(info) && !info.getMenuId().equals(menu.getMenuId())) {
        return UserConstants.MENU_NAME_NOT_UNIQUE;
    }
    return UserConstants.MENU_NAME_UNIQUE;
}
 
Example #28
Source Project: supplierShop   Author: guchengwuyue   File: SysDeptServiceImpl.java    License: MIT License 5 votes vote down vote up
/**
 * 校验部门名称是否唯一
 * 
 * @param dept 部门信息
 * @return 结果
 */
@Override
public String 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.DEPT_NAME_UNIQUE;
}
 
Example #29
Source Project: supplierShop   Author: guchengwuyue   File: SysConfigServiceImpl.java    License: MIT License 5 votes vote down vote up
/**
 * 校验参数键名是否唯一
 * 
 * @param config 参数配置信息
 * @return 结果
 */
@Override
public String 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.CONFIG_KEY_UNIQUE;
}
 
Example #30
Source Project: supplierShop   Author: guchengwuyue   File: SysRoleServiceImpl.java    License: MIT License 5 votes vote down vote up
/**
 * 校验角色名称是否唯一
 * 
 * @param role 角色信息
 * @return 结果
 */
@Override
public String 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.ROLE_NAME_UNIQUE;
}