com.ruoyi.common.enums.BusinessType Java Examples

The following examples show how to use com.ruoyi.common.enums.BusinessType. 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: ruoyiplus   Author: kongshanxuelin   File: SysDeptController.java    License: MIT License 6 votes vote down vote up
/**
 * 删除
 */
@Log(title = "部门管理", businessType = BusinessType.DELETE)
@RequiresPermissions("system:dept:remove")
@PostMapping("/remove/{deptId}")
@ResponseBody
public AjaxResult remove(@PathVariable("deptId") Long deptId)
{
    if (deptService.selectDeptCount(deptId) > 0)
    {
        return error(1, "存在下级部门,不允许删除");
    }
    if (deptService.checkDeptExistUser(deptId))
    {
        return error(1, "部门存在用户,不允许删除");
    }
    return toAjax(deptService.deleteDeptById(deptId));
}
 
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: ruoyiplus   Author: kongshanxuelin   File: SysMenuController.java    License: MIT License 6 votes vote down vote up
/**
 * 删除菜单
 */
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
@RequiresPermissions("system:menu:remove")
@PostMapping("/remove/{menuId}")
@ResponseBody
public AjaxResult remove(@PathVariable("menuId") Long menuId)
{
    if (menuService.selectCountMenuByParentId(menuId) > 0)
    {
        return error(1, "存在子菜单,不允许删除");
    }
    if (menuService.selectCountRoleMenuByMenuId(menuId) > 0)
    {
        return error(1, "菜单已分配,不允许删除");
    }
    ShiroUtils.clearCachedAuthorizationInfo();
    return toAjax(menuService.deleteMenuById(menuId));
}
 
Example #4
Source Project: supplierShop   Author: guchengwuyue   File: SysMenuController.java    License: MIT License 6 votes vote down vote up
/**
 * 删除菜单
 */
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
@RequiresPermissions("system:menu:remove")
@GetMapping("/remove/{menuId}")
@ResponseBody
public AjaxResult remove(@PathVariable("menuId") Long menuId)
{
    if (menuService.selectCountMenuByParentId(menuId) > 0)
    {
        return AjaxResult.warn("存在子菜单,不允许删除");
    }
    if (menuService.selectCountRoleMenuByMenuId(menuId) > 0)
    {
        return AjaxResult.warn("菜单已分配,不允许删除");
    }
    ShiroUtils.clearCachedAuthorizationInfo();
    return toAjax(menuService.deleteMenuById(menuId));
}
 
Example #5
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 #6
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 #7
Source Project: supplierShop   Author: guchengwuyue   File: SysUserController.java    License: MIT License 6 votes vote down vote up
@RequiresPermissions("system:user:resetPwd")
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
@PostMapping("/resetPwd")
@ResponseBody
public AjaxResult resetPwdSave(SysUser user)
{
    user.setSalt(ShiroUtils.randomSalt());
    user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
    if (userService.resetUserPwd(user) > 0)
    {
        if (ShiroUtils.getUserId() == user.getUserId())
        {
            ShiroUtils.setSysUser(userService.selectUserById(user.getUserId()));
        }
        return success();
    }
    return error();
}
 
Example #8
Source Project: ruoyiplus   Author: kongshanxuelin   File: SysJobController.java    License: MIT License 6 votes vote down vote up
@Log(title = "定时任务", businessType = BusinessType.DELETE)
@RequiresPermissions("monitor:job:remove")
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
    try
    {
        jobService.deleteJobByIds(ids);
        return success();
    }
    catch (Exception e)
    {
        e.printStackTrace();
        return error(e.getMessage());
    }
}
 
Example #9
Source Project: ruoyiplus   Author: kongshanxuelin   File: SysProfileController.java    License: MIT License 6 votes vote down vote up
/**
 * 修改用户
 */
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PostMapping("/update")
@ResponseBody
public AjaxResult update(SysUser user)
{
    SysUser currentUser = getSysUser();
    currentUser.setUserName(user.getUserName());
    currentUser.setEmail(user.getEmail());
    currentUser.setPhonenumber(user.getPhonenumber());
    currentUser.setSex(user.getSex());
    if (userService.updateUserInfo(currentUser) > 0)
    {
        setSysUser(userService.selectUserById(currentUser.getUserId()));
        return success();
    }
    return error();
}
 
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: SysJobController.java    License: MIT License 5 votes vote down vote up
@Log(title = "定时任务", businessType = BusinessType.EXPORT)
@RequiresPermissions("monitor:job:export")
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysJob job)
{
    List<SysJob> list = jobService.selectJobList(job);
    ExcelUtil<SysJob> util = new ExcelUtil<SysJob>(SysJob.class);
    return util.exportExcel(list, "定时任务");
}
 
Example #12
Source Project: RuoYi   Author: lerry903   File: SysPostController.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 修改保存岗位
 */
@RequiresPermissions("system:post:edit")
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(SysPost post) {
    post.setUpdateBy(ShiroUtils.getLoginName());
    return toAjax(postService.updatePost(post));
}
 
Example #13
Source Project: RuoYi   Author: lerry903   File: SysProfileController.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 修改用户
 */
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PostMapping("/update")
@ResponseBody
public AjaxResult update(SysUser user) {
    if (userService.updateUserInfo(user) > 0) {
        setSysUser(userService.selectUserById(user.getUserId()));
        return success();
    }
    return error();
}
 
Example #14
Source Project: ruoyiplus   Author: kongshanxuelin   File: SysDictTypeController.java    License: MIT License 5 votes vote down vote up
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:dict:export")
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysDictType dictType)
{

    List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
    ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
    return util.exportExcel(list, "字典类型");
}
 
Example #15
Source Project: ruoyiplus   Author: kongshanxuelin   File: SysRoleController.java    License: MIT License 5 votes vote down vote up
@RequiresPermissions("system:role:remove")
@Log(title = "角色管理", businessType = BusinessType.DELETE)
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
    try
    {
        return toAjax(roleService.deleteRoleByIds(ids));
    }
    catch (Exception e)
    {
        return error(e.getMessage());
    }
}
 
Example #16
Source Project: supplierShop   Author: guchengwuyue   File: SysOperlogController.java    License: MIT License 5 votes vote down vote up
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
@RequiresPermissions("monitor:operlog:remove")
@PostMapping("/clean")
@ResponseBody
public AjaxResult clean()
{
    operLogService.cleanOperLog();
    return success();
}
 
Example #17
Source Project: RuoYi   Author: lerry903   File: SysDeptController.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 新增保存部门
 */
@Log(title = "部门管理", businessType = BusinessType.INSERT)
@RequiresPermissions("system:dept:add")
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(SysDept dept) {
    dept.setCreateBy(ShiroUtils.getLoginName());
    return toAjax(deptService.insertDept(dept));
}
 
Example #18
Source Project: RuoYi   Author: lerry903   File: SysMenuController.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 修改保存菜单
 */
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
@RequiresPermissions("system:menu:edit")
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(SysMenu menu) {
    menu.setUpdateBy(ShiroUtils.getLoginName());
    ShiroUtils.clearCachedAuthorizationInfo();
    return toAjax(menuService.updateMenu(menu));
}
 
Example #19
Source Project: supplierShop   Author: guchengwuyue   File: SysLogininforController.java    License: MIT License 5 votes vote down vote up
@RequiresPermissions("monitor:logininfor:remove")
@Log(title = "登陆日志", businessType = BusinessType.CLEAN)
@PostMapping("/clean")
@ResponseBody
public AjaxResult clean()
{
    logininforService.cleanLogininfor();
    return success();
}
 
Example #20
Source Project: ruoyiplus   Author: kongshanxuelin   File: SysNoticeController.java    License: MIT License 5 votes vote down vote up
/**
 * 新增保存公告
 */
@RequiresPermissions("system:notice:add")
@Log(title = "通知公告", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(SysNotice notice)
{
    notice.setCreateBy(ShiroUtils.getLoginName());
    return toAjax(noticeService.insertNotice(notice));
}
 
Example #21
Source Project: ruoyiplus   Author: kongshanxuelin   File: SysJobController.java    License: MIT License 5 votes vote down vote up
/**
 * 任务调度立即执行一次
 */
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
@RequiresPermissions("monitor:job:changeStatus")
@PostMapping("/run")
@ResponseBody
public AjaxResult run(SysJob job)
{
    return toAjax(jobService.run(job));
}
 
Example #22
Source Project: RuoYi   Author: lerry903   File: SysDictTypeController.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 新增保存字典类型
 */
@Log(title = "字典类型", businessType = BusinessType.INSERT)
@RequiresPermissions("system:dict:add")
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(SysDictType dict) {
    dict.setCreateBy(ShiroUtils.getLoginName());
    return toAjax(dictTypeService.insertDictType(dict));
}
 
Example #23
Source Project: RuoYi   Author: lerry903   File: SysUserController.java    License: Apache License 2.0 5 votes vote down vote up
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:user:export")
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysUser user) {
    List<SysUser> list = userService.selectUserList(user);
    ExcelUtil<SysUser> util = new ExcelUtil<>(SysUser.class);
    return util.exportExcel(list, "用户信息");
}
 
Example #24
Source Project: supplierShop   Author: guchengwuyue   File: SysJobController.java    License: MIT License 5 votes vote down vote up
/**
 * 新增保存调度
 */
@Log(title = "定时任务", businessType = BusinessType.INSERT)
@RequiresPermissions("monitor:job:add")
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(@Validated SysJob job) throws SchedulerException, TaskException
{
    return toAjax(jobService.insertJob(job));
}
 
Example #25
Source Project: RuoYi   Author: lerry903   File: SysRoleController.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 新增保存角色
 */
@RequiresPermissions("system:role:add")
@Log(title = "角色管理", businessType = BusinessType.INSERT)
@PostMapping("/add")
@Transactional(rollbackFor = Exception.class)
@ResponseBody
public AjaxResult addSave(SysRole role) {
    role.setCreateBy(ShiroUtils.getLoginName());
    ShiroUtils.clearCachedAuthorizationInfo();
    return toAjax(roleService.insertRole(role));

}
 
Example #26
Source Project: supplierShop   Author: guchengwuyue   File: StoreGoodsBrandController.java    License: MIT License 5 votes vote down vote up
/**
 * 修改保存产品品牌
 */
@RequiresPermissions("shop:brand:edit")
@Log(title = "产品品牌", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(StoreGoodsBrand storeGoodsBrand)
{
    return toAjax(storeGoodsBrandService.updateStoreGoodsBrand(storeGoodsBrand));
}
 
Example #27
Source Project: supplierShop   Author: guchengwuyue   File: StoreGoodsBrandController.java    License: MIT License 5 votes vote down vote up
/**
 * 删除产品品牌
 */
@RequiresPermissions("shop:brand:remove")
@Log(title = "产品品牌", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
    return toAjax(storeGoodsBrandService.deleteStoreGoodsBrandByIds(ids));
}
 
Example #28
Source Project: supplierShop   Author: guchengwuyue   File: SysJobLogController.java    License: MIT License 5 votes vote down vote up
@Log(title = "调度日志", businessType = BusinessType.CLEAN)
@RequiresPermissions("monitor:job:remove")
@PostMapping("/clean")
@ResponseBody
public AjaxResult clean()
{
    jobLogService.cleanJobLog();
    return success();
}
 
Example #29
Source Project: RuoYi   Author: lerry903   File: SysProfileController.java    License: Apache License 2.0 5 votes vote down vote up
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
@PostMapping("/resetPwd")
@ResponseBody
public AjaxResult resetPwd(String oldPassword, String newPassword, SysUser user) {
    if(StrUtil.isNotEmpty(newPassword) && passwordService.matches(user, oldPassword)){
        user.setSalt(ShiroUtils.randomSalt());
        user.setPassword(passwordService.encryptPassword(user.getLoginName(), newPassword, user.getSalt()));
        if (userService.resetUserPwd(user) > 0) {
            setSysUser(userService.selectUserById(user.getUserId()));
            return success();
        }
        return error();
    }
    return error("修改密码失败,旧密码错误");
}
 
Example #30
Source Project: ruoyiplus   Author: kongshanxuelin   File: SysOperlogController.java    License: MIT License 5 votes vote down vote up
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
@RequiresPermissions("monitor:operlog:remove")
@PostMapping("/clean")
@ResponseBody
public AjaxResult clean()
{
    operLogService.cleanOperLog();
    return success();
}