新增校验
parent
c7613a9ff5
commit
66a904d71e
|
@ -2,9 +2,8 @@ package com.ruoyi;
|
||||||
|
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启动程序
|
* 启动程序
|
||||||
|
@ -12,7 +11,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class })
|
@EnableTransactionManagement
|
||||||
@MapperScan("com.ruoyi.project.*.*.dao")
|
@MapperScan("com.ruoyi.project.*.*.dao")
|
||||||
public class RuoYiApplication
|
public class RuoYiApplication
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,7 +11,7 @@ import com.ruoyi.framework.web.page.PageDomain;
|
||||||
public class JobLog extends PageDomain
|
public class JobLog extends PageDomain
|
||||||
{
|
{
|
||||||
/** ID */
|
/** ID */
|
||||||
private Integer jobLogId;
|
private Long jobLogId;
|
||||||
/** 任务名称 */
|
/** 任务名称 */
|
||||||
private String jobName;
|
private String jobName;
|
||||||
/** 任务组名 */
|
/** 任务组名 */
|
||||||
|
@ -29,12 +29,12 @@ public class JobLog extends PageDomain
|
||||||
/** 创建时间 */
|
/** 创建时间 */
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
public Integer getJobLogId()
|
public Long getJobLogId()
|
||||||
{
|
{
|
||||||
return jobLogId;
|
return jobLogId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setJobLogId(Integer jobLogId)
|
public void setJobLogId(Long jobLogId)
|
||||||
{
|
{
|
||||||
this.jobLogId = jobLogId;
|
this.jobLogId = jobLogId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,6 @@ public class DeptController extends BaseController
|
||||||
{
|
{
|
||||||
return Message.error(1, "存在下级部门,不允许删除");
|
return Message.error(1, "存在下级部门,不允许删除");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (deptService.checkDeptExistUser(deptId))
|
if (deptService.checkDeptExistUser(deptId))
|
||||||
{
|
{
|
||||||
return Message.error(1, "部门存在用户,不允许删除");
|
return Message.error(1, "部门存在用户,不允许删除");
|
||||||
|
|
|
@ -25,7 +25,6 @@ public interface IDeptService
|
||||||
* @return 所有部门信息
|
* @return 所有部门信息
|
||||||
*/
|
*/
|
||||||
public List<Map<String, Object>> selectDeptTree();
|
public List<Map<String, Object>> selectDeptTree();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询部门人数
|
* 查询部门人数
|
||||||
|
|
|
@ -58,14 +58,19 @@ public class MenuController extends BaseController
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Message remove(@PathVariable("menuId") Long menuId)
|
public Message remove(@PathVariable("menuId") Long menuId)
|
||||||
{
|
{
|
||||||
|
if (menuService.selectCountMenuByParentId(menuId) > 0)
|
||||||
|
{
|
||||||
|
return Message.error(1, "存在子菜单,不允许删除");
|
||||||
|
}
|
||||||
|
if (menuService.selectCountRoleMenuByMenuId(menuId) > 0)
|
||||||
|
{
|
||||||
|
return Message.error(1, "菜单已分配,不允许删除");
|
||||||
|
}
|
||||||
if (menuService.deleteMenuById(menuId) > 0)
|
if (menuService.deleteMenuById(menuId) > 0)
|
||||||
{
|
{
|
||||||
return Message.ok();
|
return Message.ok();
|
||||||
}
|
}
|
||||||
else
|
return Message.error();
|
||||||
{
|
|
||||||
return Message.error(1, "删除失败");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -57,6 +57,14 @@ public interface IMenuDao
|
||||||
* @return 菜单信息
|
* @return 菜单信息
|
||||||
*/
|
*/
|
||||||
public Menu selectMenuById(Long menuId);
|
public Menu selectMenuById(Long menuId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询子菜单数量
|
||||||
|
*
|
||||||
|
* @param menuId 菜单ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int selectCountMenuByParentId(Long parentId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增菜单信息
|
* 新增菜单信息
|
||||||
|
|
|
@ -76,6 +76,22 @@ public interface IMenuService
|
||||||
*/
|
*/
|
||||||
public Menu selectMenuById(Long menuId);
|
public Menu selectMenuById(Long menuId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询子菜单数量
|
||||||
|
*
|
||||||
|
* @param menuId 菜单ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int selectCountMenuByParentId(Long parentId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询菜单使用数量
|
||||||
|
*
|
||||||
|
* @param menuId 菜单ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int selectCountRoleMenuByMenuId(Long menuId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存菜单信息
|
* 保存菜单信息
|
||||||
*
|
*
|
||||||
|
|
|
@ -19,6 +19,7 @@ import com.ruoyi.common.utils.TreeUtils;
|
||||||
import com.ruoyi.common.utils.security.ShiroUtils;
|
import com.ruoyi.common.utils.security.ShiroUtils;
|
||||||
import com.ruoyi.project.system.menu.dao.IMenuDao;
|
import com.ruoyi.project.system.menu.dao.IMenuDao;
|
||||||
import com.ruoyi.project.system.menu.domain.Menu;
|
import com.ruoyi.project.system.menu.domain.Menu;
|
||||||
|
import com.ruoyi.project.system.role.dao.IRoleMenuDao;
|
||||||
import com.ruoyi.project.system.role.domain.Role;
|
import com.ruoyi.project.system.role.domain.Role;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,6 +35,9 @@ public class MenuServiceImpl implements IMenuService
|
||||||
@Autowired
|
@Autowired
|
||||||
private IMenuDao menuDao;
|
private IMenuDao menuDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IRoleMenuDao roleMenuDao;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户ID查询菜单
|
* 根据用户ID查询菜单
|
||||||
*
|
*
|
||||||
|
@ -205,6 +209,30 @@ public class MenuServiceImpl implements IMenuService
|
||||||
return menuDao.selectMenuById(menuId);
|
return menuDao.selectMenuById(menuId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询子菜单数量
|
||||||
|
*
|
||||||
|
* @param menuId 菜单ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int selectCountMenuByParentId(Long parentId)
|
||||||
|
{
|
||||||
|
return menuDao.selectCountMenuByParentId(parentId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询菜单使用数量
|
||||||
|
*
|
||||||
|
* @param menuId 菜单ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int selectCountRoleMenuByMenuId(Long menuId)
|
||||||
|
{
|
||||||
|
return roleMenuDao.selectCountRoleMenuByMenuId(menuId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存菜单信息
|
* 保存菜单信息
|
||||||
*
|
*
|
||||||
|
|
|
@ -63,6 +63,10 @@ public class PostController extends BaseController
|
||||||
{
|
{
|
||||||
return Message.error("岗位不存在");
|
return Message.error("岗位不存在");
|
||||||
}
|
}
|
||||||
|
if (postService.selectCountPostById(postId) > 0)
|
||||||
|
{
|
||||||
|
return Message.error("岗位已分配,不能删除");
|
||||||
|
}
|
||||||
if (postService.deletePostById(postId) > 0)
|
if (postService.deletePostById(postId) > 0)
|
||||||
{
|
{
|
||||||
return Message.ok();
|
return Message.ok();
|
||||||
|
|
|
@ -64,4 +64,12 @@ public interface IPostService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int savePost(Post post);
|
public int savePost(Post post);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过岗位ID查询岗位使用数量
|
||||||
|
*
|
||||||
|
* @param postId 岗位ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int selectCountPostById(Long postId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
package com.ruoyi.project.system.post.service;
|
package com.ruoyi.project.system.post.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.security.ShiroUtils;
|
import com.ruoyi.common.utils.security.ShiroUtils;
|
||||||
import com.ruoyi.project.system.post.dao.IPostDao;
|
import com.ruoyi.project.system.post.dao.IPostDao;
|
||||||
import com.ruoyi.project.system.post.domain.Post;
|
import com.ruoyi.project.system.post.domain.Post;
|
||||||
|
import com.ruoyi.project.system.user.dao.IUserPostDao;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 岗位信息 服务层处理
|
* 岗位信息 服务层处理
|
||||||
|
@ -18,6 +21,9 @@ public class PostServiceImpl implements IPostService
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private IPostDao postDao;
|
private IPostDao postDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IUserPostDao userPostDao;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询岗位信息集合
|
* 查询岗位信息集合
|
||||||
|
@ -66,8 +72,6 @@ public class PostServiceImpl implements IPostService
|
||||||
}
|
}
|
||||||
return posts;
|
return posts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过岗位ID查询岗位信息
|
* 通过岗位ID查询岗位信息
|
||||||
|
@ -131,4 +135,16 @@ public class PostServiceImpl implements IPostService
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过岗位ID查询岗位使用数量
|
||||||
|
*
|
||||||
|
* @param postId 岗位ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int selectCountPostById(Long postId)
|
||||||
|
{
|
||||||
|
return userPostDao.selectCountPostById(postId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
@ -32,7 +33,7 @@ public class RoleController extends BaseController
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IRoleService roleService;
|
private IRoleService roleService;
|
||||||
|
|
||||||
@RequiresPermissions("system:role:view")
|
@RequiresPermissions("system:role:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String role()
|
public String role()
|
||||||
|
@ -49,7 +50,7 @@ public class RoleController extends BaseController
|
||||||
List<Role> list = roleService.selectRoleList(role);
|
List<Role> list = roleService.selectRoleList(role);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增角色
|
* 新增角色
|
||||||
*/
|
*/
|
||||||
|
@ -80,6 +81,7 @@ public class RoleController extends BaseController
|
||||||
@RequiresPermissions("system:role:save")
|
@RequiresPermissions("system:role:save")
|
||||||
@Log(title = "系统管理", action = "角色管理-保存角色")
|
@Log(title = "系统管理", action = "角色管理-保存角色")
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
|
@Transactional
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Message save(Role role)
|
public Message save(Role role)
|
||||||
{
|
{
|
||||||
|
@ -93,6 +95,7 @@ public class RoleController extends BaseController
|
||||||
@RequiresPermissions("system:role:remove")
|
@RequiresPermissions("system:role:remove")
|
||||||
@Log(title = "系统管理", action = "角色管理-删除角色")
|
@Log(title = "系统管理", action = "角色管理-删除角色")
|
||||||
@RequestMapping("/remove/{roleId}")
|
@RequestMapping("/remove/{roleId}")
|
||||||
|
@Transactional
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Message remove(@PathVariable("roleId") Long roleId)
|
public Message remove(@PathVariable("roleId") Long roleId)
|
||||||
{
|
{
|
||||||
|
@ -101,6 +104,10 @@ public class RoleController extends BaseController
|
||||||
{
|
{
|
||||||
return Message.error("角色不存在");
|
return Message.error("角色不存在");
|
||||||
}
|
}
|
||||||
|
if (roleService.selectCountUserRoleByRoleId(roleId) > 0)
|
||||||
|
{
|
||||||
|
return Message.error("角色已分配,不能删除");
|
||||||
|
}
|
||||||
if (roleService.deleteRoleById(roleId) > 0)
|
if (roleService.deleteRoleById(roleId) > 0)
|
||||||
{
|
{
|
||||||
return Message.ok();
|
return Message.ok();
|
||||||
|
@ -121,7 +128,7 @@ public class RoleController extends BaseController
|
||||||
}
|
}
|
||||||
return Message.error();
|
return Message.error();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验角色名称
|
* 校验角色名称
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -19,6 +19,22 @@ public interface IRoleMenuDao
|
||||||
*/
|
*/
|
||||||
public int deleteRoleMenuByRoleId(Long roleId);
|
public int deleteRoleMenuByRoleId(Long roleId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量角色角色菜单关联信息
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteRoleMenu(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询菜单使用数量
|
||||||
|
*
|
||||||
|
* @param menuId 菜单ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int selectCountRoleMenuByMenuId(Long menuId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量新增角色菜单信息
|
* 批量新增角色菜单信息
|
||||||
*
|
*
|
||||||
|
|
|
@ -82,5 +82,13 @@ public interface IRoleService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public String checkRoleNameUnique(Role role);
|
public String checkRoleNameUnique(Role role);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过角色ID查询角色使用数量
|
||||||
|
*
|
||||||
|
* @param roleId 角色ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int selectCountUserRoleByRoleId(Long roleId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,6 @@ public class RoleServiceImpl implements IRoleService
|
||||||
@Override
|
@Override
|
||||||
public int deleteRoleById(Long roleId)
|
public int deleteRoleById(Long roleId)
|
||||||
{
|
{
|
||||||
userRoleDao.deleteUserRoleByRoleId(roleId);
|
|
||||||
roleMenuDao.deleteRoleMenuByRoleId(roleId);
|
roleMenuDao.deleteRoleMenuByRoleId(roleId);
|
||||||
return roleDao.deleteRoleById(roleId);
|
return roleDao.deleteRoleById(roleId);
|
||||||
}
|
}
|
||||||
|
@ -140,6 +139,7 @@ public class RoleServiceImpl implements IRoleService
|
||||||
@Override
|
@Override
|
||||||
public int batchDeleteRole(Long[] ids)
|
public int batchDeleteRole(Long[] ids)
|
||||||
{
|
{
|
||||||
|
roleMenuDao.deleteRoleMenu(ids);
|
||||||
return roleDao.batchDeleteRole(ids);
|
return roleDao.batchDeleteRole(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ public class RoleServiceImpl implements IRoleService
|
||||||
}
|
}
|
||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验角色名称是否唯一
|
* 校验角色名称是否唯一
|
||||||
*
|
*
|
||||||
|
@ -205,11 +205,23 @@ public class RoleServiceImpl implements IRoleService
|
||||||
{
|
{
|
||||||
Long roleId = role.getRoleId();
|
Long roleId = role.getRoleId();
|
||||||
Role info = roleDao.checkRoleNameUnique(role.getRoleName());
|
Role info = roleDao.checkRoleNameUnique(role.getRoleName());
|
||||||
if (StringUtils.isNotNull(info) && StringUtils.isNotNull(info.getRoleId()) && info.getRoleId() != roleId)
|
if (StringUtils.isNotNull(info) && StringUtils.isNotNull(info.getRoleId()) && info.getRoleId() != roleId)
|
||||||
{
|
{
|
||||||
return UserConstants.NAME_NOT_UNIQUE;
|
return UserConstants.NAME_NOT_UNIQUE;
|
||||||
}
|
}
|
||||||
return UserConstants.NAME_UNIQUE;
|
return UserConstants.NAME_UNIQUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过角色ID查询角色使用数量
|
||||||
|
*
|
||||||
|
* @param roleId 角色ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int selectCountUserRoleByRoleId(Long roleId)
|
||||||
|
{
|
||||||
|
return userRoleDao.selectCountUserRoleByRoleId(roleId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
@ -119,6 +120,7 @@ public class UserController extends BaseController
|
||||||
@RequiresPermissions("system:user:remove")
|
@RequiresPermissions("system:user:remove")
|
||||||
@Log(title = "系统管理", action = "用户管理-删除用户")
|
@Log(title = "系统管理", action = "用户管理-删除用户")
|
||||||
@RequestMapping("/remove/{userId}")
|
@RequestMapping("/remove/{userId}")
|
||||||
|
@Transactional
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Message remove(@PathVariable("userId") Long userId)
|
public Message remove(@PathVariable("userId") Long userId)
|
||||||
{
|
{
|
||||||
|
@ -137,6 +139,7 @@ public class UserController extends BaseController
|
||||||
@RequiresPermissions("system:user:batchRemove")
|
@RequiresPermissions("system:user:batchRemove")
|
||||||
@Log(title = "系统管理", action = "用户管理-批量删除")
|
@Log(title = "系统管理", action = "用户管理-批量删除")
|
||||||
@PostMapping("/batchRemove")
|
@PostMapping("/batchRemove")
|
||||||
|
@Transactional
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Message batchRemove(@RequestParam("ids[]") Long[] ids)
|
public Message batchRemove(@RequestParam("ids[]") Long[] ids)
|
||||||
{
|
{
|
||||||
|
@ -154,6 +157,7 @@ public class UserController extends BaseController
|
||||||
@RequiresPermissions("system:user:save")
|
@RequiresPermissions("system:user:save")
|
||||||
@Log(title = "系统管理", action = "部门管理-保存部门")
|
@Log(title = "系统管理", action = "部门管理-保存部门")
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
|
@Transactional
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Message save(User user)
|
public Message save(User user)
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,6 +18,22 @@ public interface IUserPostDao
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteUserPostByUserId(Long userId);
|
public int deleteUserPostByUserId(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过岗位ID查询岗位使用数量
|
||||||
|
*
|
||||||
|
* @param postId 岗位ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int selectCountPostById(Long postId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除用户和岗位关联
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteUserPost(Long[] ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量新增用户岗位信息
|
* 批量新增用户岗位信息
|
||||||
|
|
|
@ -20,12 +20,20 @@ public interface IUserRoleDao
|
||||||
public int deleteUserRoleByUserId(Long userId);
|
public int deleteUserRoleByUserId(Long userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过角色ID删除用户和角色关联
|
* 批量删除用户和角色关联
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteUserRole(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过角色ID查询角色使用数量
|
||||||
*
|
*
|
||||||
* @param roleId 角色ID
|
* @param roleId 角色ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteUserRoleByRoleId(Long roleId);
|
public int selectCountUserRoleByRoleId(Long roleId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量新增用户角色信息
|
* 批量新增用户角色信息
|
||||||
|
|
|
@ -86,6 +86,8 @@ public class UserServiceImpl implements IUserService
|
||||||
{
|
{
|
||||||
// 删除用户与角色关联
|
// 删除用户与角色关联
|
||||||
userRoleDao.deleteUserRoleByUserId(userId);
|
userRoleDao.deleteUserRoleByUserId(userId);
|
||||||
|
// 删除用户与岗位表
|
||||||
|
userPostDao.deleteUserPostByUserId(userId);
|
||||||
return userDao.deleteUserById(userId);
|
return userDao.deleteUserById(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,6 +100,8 @@ public class UserServiceImpl implements IUserService
|
||||||
@Override
|
@Override
|
||||||
public int batchDeleteUser(Long[] ids)
|
public int batchDeleteUser(Long[] ids)
|
||||||
{
|
{
|
||||||
|
userRoleDao.deleteUserRole(ids);
|
||||||
|
userPostDao.deleteUserPost(ids);
|
||||||
return userDao.batchDeleteUser(ids);
|
return userDao.batchDeleteUser(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
delete from sys_job_log where job_log_id = #{jobLogId}
|
delete from sys_job_log where job_log_id = #{jobLogId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="batchDeleteJobLog" parameterType="String">
|
<delete id="batchDeleteJobLog" parameterType="Long">
|
||||||
delete from sys_job_log where job_log_id in
|
delete from sys_job_log where job_log_id in
|
||||||
<foreach collection="array" item="jobLogId" open="(" separator="," close=")">
|
<foreach collection="array" item="jobLogId" open="(" separator="," close=")">
|
||||||
#{jobLogId}
|
#{jobLogId}
|
||||||
|
|
|
@ -42,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
delete from sys_job where job_id = #{jobId}
|
delete from sys_job where job_id = #{jobId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="batchDeleteJob" parameterType="String">
|
<delete id="batchDeleteJob" parameterType="Long">
|
||||||
delete from sys_job where job_id in
|
delete from sys_job where job_id in
|
||||||
<foreach collection="array" item="jobId" open="(" separator="," close=")">
|
<foreach collection="array" item="jobId" open="(" separator="," close=")">
|
||||||
#{jobId}
|
#{jobId}
|
||||||
|
|
|
@ -29,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<delete id="batchDeleteLogininfor" parameterType="String">
|
<delete id="batchDeleteLogininfor" parameterType="Integer">
|
||||||
delete from sys_logininfor where info_id in
|
delete from sys_logininfor where info_id in
|
||||||
<foreach collection="array" item="infoId" open="(" separator="," close=")">
|
<foreach collection="array" item="infoId" open="(" separator="," close=")">
|
||||||
#{infoId}
|
#{infoId}
|
||||||
|
|
|
@ -34,7 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<delete id="batchDeleteOperLog" parameterType="String">
|
<delete id="batchDeleteOperLog" parameterType="Integer">
|
||||||
delete from sys_oper_log where oper_id in
|
delete from sys_oper_log where oper_id in
|
||||||
<foreach collection="array" item="operId" open="(" separator="," close=")">
|
<foreach collection="array" item="operId" open="(" separator="," close=")">
|
||||||
#{operId}
|
#{operId}
|
||||||
|
|
|
@ -39,7 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
delete from sys_dict_data where dict_code = #{dictCode}
|
delete from sys_dict_data where dict_code = #{dictCode}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="batchDeleteDictData" parameterType="String">
|
<delete id="batchDeleteDictData" parameterType="Long">
|
||||||
delete from sys_dict_data where dict_code in
|
delete from sys_dict_data where dict_code in
|
||||||
<foreach collection="array" item="dictCode" open="(" separator="," close=")">
|
<foreach collection="array" item="dictCode" open="(" separator="," close=")">
|
||||||
#{dictCode}
|
#{dictCode}
|
||||||
|
|
|
@ -41,7 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
delete from sys_dict_type where dict_id = #{dictId}
|
delete from sys_dict_type where dict_id = #{dictId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="batchDeleteDictType" parameterType="String">
|
<delete id="batchDeleteDictType" parameterType="Long">
|
||||||
delete from sys_dict_type where dict_id in
|
delete from sys_dict_type where dict_id in
|
||||||
<foreach collection="array" item="dictId" open="(" separator="," close=")">
|
<foreach collection="array" item="dictId" open="(" separator="," close=")">
|
||||||
#{dictId}
|
#{dictId}
|
||||||
|
|
|
@ -62,6 +62,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where t.menu_id = #{menuId}
|
where t.menu_id = #{menuId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectCountMenuByParentId" resultType="Integer">
|
||||||
|
select count(*) from sys_menu where parent_id=#{menuId}
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="checkMenuNameUnique" parameterType="String" resultMap="MenuResult">
|
<select id="checkMenuNameUnique" parameterType="String" resultMap="MenuResult">
|
||||||
select t.menu_id, t.parent_id, t.menu_name, t.order_num, t.url, t.menu_type, t.visible, t.perms, t.icon, t.remark
|
select t.menu_id, t.parent_id, t.menu_name, t.order_num, t.url, t.menu_type, t.visible, t.perms, t.icon, t.remark
|
||||||
from sys_menu t where menu_name=#{menuName}
|
from sys_menu t where menu_name=#{menuName}
|
||||||
|
|
|
@ -48,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
delete from sys_post where post_id = #{postId}
|
delete from sys_post where post_id = #{postId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="batchDeletePost" parameterType="String">
|
<delete id="batchDeletePost" parameterType="Long">
|
||||||
delete from sys_post where post_id in
|
delete from sys_post where post_id in
|
||||||
<foreach collection="array" item="postId" open="(" separator="," close=")">
|
<foreach collection="array" item="postId" open="(" separator="," close=")">
|
||||||
#{postId}
|
#{postId}
|
||||||
|
|
|
@ -53,7 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
delete from sys_role where role_id = #{roleId}
|
delete from sys_role where role_id = #{roleId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="batchDeleteRole" parameterType="String">
|
<delete id="batchDeleteRole" parameterType="Long">
|
||||||
delete from sys_role where role_id in
|
delete from sys_role where role_id in
|
||||||
<foreach collection="array" item="roleId" open="(" separator="," close=")">
|
<foreach collection="array" item="roleId" open="(" separator="," close=")">
|
||||||
#{roleId}
|
#{roleId}
|
||||||
|
|
|
@ -9,10 +9,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="menuId" column="menu_id" />
|
<result property="menuId" column="menu_id" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<delete id="deleteRoleMenuByRoleId">
|
<delete id="deleteRoleMenuByRoleId" parameterType="Long">
|
||||||
delete from sys_role_menu where role_id=#{roleId}
|
delete from sys_role_menu where role_id=#{roleId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<select id="selectCountRoleMenuByMenuId" resultType="Integer">
|
||||||
|
select count(*) from sys_role_menu where menu_id=#{menuId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<delete id="deleteRoleMenu" parameterType="Long">
|
||||||
|
delete from sys_role_menu where role_id in
|
||||||
|
<foreach collection="array" item="roleId" open="(" separator="," close=")">
|
||||||
|
#{roleId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
<insert id="batchRoleMenu">
|
<insert id="batchRoleMenu">
|
||||||
insert into sys_role_menu(role_id, menu_id) values
|
insert into sys_role_menu(role_id, menu_id) values
|
||||||
<foreach item="item" index="index" collection="list" separator=",">
|
<foreach item="item" index="index" collection="list" separator=",">
|
||||||
|
|
|
@ -69,7 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
delete from sys_user where user_id = #{userId}
|
delete from sys_user where user_id = #{userId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="batchDeleteUser" parameterType="String">
|
<delete id="batchDeleteUser" parameterType="Long">
|
||||||
delete from sys_user where user_id in
|
delete from sys_user where user_id in
|
||||||
<foreach collection="array" item="userId" open="(" separator="," close=")">
|
<foreach collection="array" item="userId" open="(" separator="," close=")">
|
||||||
#{userId}
|
#{userId}
|
||||||
|
|
|
@ -9,10 +9,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="postId" column="post_id" />
|
<result property="postId" column="post_id" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<delete id="deleteUserPostByUserId">
|
<delete id="deleteUserPostByUserId" parameterType="Long">
|
||||||
delete from sys_user_post where user_id=#{userId}
|
delete from sys_user_post where user_id=#{userId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<select id="selectCountPostById" resultType="Integer">
|
||||||
|
select count(*) from sys_user_post where post_id=#{postId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<delete id="deleteUserPost" parameterType="Long">
|
||||||
|
delete from sys_user_post where user_id in
|
||||||
|
<foreach collection="array" item="userId" open="(" separator="," close=")">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
<insert id="batchUserPost">
|
<insert id="batchUserPost">
|
||||||
insert into sys_user_post(user_id, post_id) values
|
insert into sys_user_post(user_id, post_id) values
|
||||||
<foreach item="item" index="index" collection="list" separator=",">
|
<foreach item="item" index="index" collection="list" separator=",">
|
||||||
|
|
|
@ -9,13 +9,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="roleId" column="role_id" />
|
<result property="roleId" column="role_id" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<delete id="deleteUserRoleByUserId">
|
<delete id="deleteUserRoleByUserId" parameterType="Long">
|
||||||
delete from sys_user_role where user_id=#{userId}
|
delete from sys_user_role where user_id=#{userId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteUserRoleByRoleId">
|
<select id="selectCountUserRoleByRoleId" resultType="Integer">
|
||||||
delete from sys_user_role where role_id=#{roleId}
|
select count(*) from sys_user_role where role_id=#{roleId}
|
||||||
</delete>
|
</select>
|
||||||
|
|
||||||
|
<delete id="deleteUserRole" parameterType="Long">
|
||||||
|
delete from sys_user_role where user_id in
|
||||||
|
<foreach collection="array" item="userId" open="(" separator="," close=")">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
<insert id="batchUserRole">
|
<insert id="batchUserRole">
|
||||||
insert into sys_user_role(user_id, role_id) values
|
insert into sys_user_role(user_id, role_id) values
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var prefix = ctx + "/monitor/job"
|
var prefix = ctx + "monitor/job"
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
var columns = [{
|
var columns = [{
|
||||||
|
@ -114,6 +114,6 @@ function batchRemove() {
|
||||||
|
|
||||||
//调度日志查询
|
//调度日志查询
|
||||||
function jobLog(id) {
|
function jobLog(id) {
|
||||||
var url = ctx + '/monitor/jobLog';
|
var url = ctx + 'monitor/jobLog';
|
||||||
createMenuItem(url, "调度日志");
|
createMenuItem(url, "调度日志");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var prefix = ctx + "/monitor/jobLog"
|
var prefix = ctx + "monitor/jobLog"
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
var columns = [{
|
var columns = [{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var prefix = ctx + "/monitor/logininfor"
|
var prefix = ctx + "monitor/logininfor"
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
var columns = [{
|
var columns = [{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var prefix = ctx + "/monitor/online"
|
var prefix = ctx + "monitor/online"
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
var columns = [{
|
var columns = [{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var prefix = ctx + "/monitor/operlog"
|
var prefix = ctx + "monitor/operlog"
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
var columns = [{
|
var columns = [{
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div th:include="include::footer"></div>
|
<div th:include="include::footer"></div>
|
||||||
<script src="/ruoyi/${moduleName}/${classname}/add.js" th:src="/ruoyi/${moduleName}/${classname}/add.js">
|
<script src="/ruoyi/${moduleName}/${classname}/add.js" th:src="@{/ruoyi/${moduleName}/${classname}/add.js}">
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div th:include="include::footer"></div>
|
<div th:include="include::footer"></div>
|
||||||
<script src="/ruoyi/${moduleName}/${classname}/edit.js" th:src="/ruoyi/${moduleName}/${classname}/edit.js">
|
<script src="/ruoyi/${moduleName}/${classname}/edit.js" th:src="@{/ruoyi/${moduleName}/${classname}/edit.js}">
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div th:include="include :: footer"></div>
|
<div th:include="include :: footer"></div>
|
||||||
<script src="/ruoyi/${moduleName}/${classname}/${classname}.js" th:src="/ruoyi/${moduleName}/${classname}/${classname}.js"></script>
|
<script src="/ruoyi/${moduleName}/${classname}/${classname}.js" th:src="@{/ruoyi/${moduleName}/${classname}/${classname}.js}"></script>
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
var editFlag = [[${@permissionService.hasPermi('${moduleName}:${classname}:edit')}]];
|
var editFlag = [[${@permissionService.hasPermi('${moduleName}:${classname}:edit')}]];
|
||||||
var removeFlag = [[${@permissionService.hasPermi('${moduleName}:${classname}:remove')}]];
|
var removeFlag = [[${@permissionService.hasPermi('${moduleName}:${classname}:remove')}]];
|
||||||
|
|
|
@ -55,11 +55,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where ${primaryKey.columnName} = #{${primaryKey.attrname}}
|
where ${primaryKey.columnName} = #{${primaryKey.attrname}}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="delete${className}ById">
|
<delete id="delete${className}ById" parameterType="${primaryKey.attrType}">
|
||||||
delete from ${tableName} where ${primaryKey.columnName} = #{value}
|
delete from ${tableName} where ${primaryKey.columnName} = #{value}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="batchDelete${className}">
|
<delete id="batchDelete${className}" parameterType="${primaryKey.attrType}">
|
||||||
delete from ${tableName} where ${primaryKey.columnName} in
|
delete from ${tableName} where ${primaryKey.columnName} in
|
||||||
<foreach item="${primaryKey.attrname}" collection="array" open="(" separator="," close=")">
|
<foreach item="${primaryKey.attrname}" collection="array" open="(" separator="," close=")">
|
||||||
#{${primaryKey.attrname}}
|
#{${primaryKey.attrname}}
|
||||||
|
|
Loading…
Reference in New Issue