Эх сурвалжийг харах

Merge remote-tracking branch 'origin/master'

Administrator 2 жил өмнө
parent
commit
33f11fe0bd

+ 0 - 6
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java

@@ -37,7 +37,6 @@ public class SysDeptController extends BaseController
     /**
      * 获取部门列表
      */
-    @PreAuthorize("@ss.hasPermi('system:dept:list')")
     @GetMapping("/list")
     public AjaxResult list(SysDept dept)
     {
@@ -48,7 +47,6 @@ public class SysDeptController extends BaseController
     /**
      * 查询部门列表(排除节点)
      */
-    @PreAuthorize("@ss.hasPermi('system:dept:list')")
     @GetMapping("/list/exclude/{deptId}")
     public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
     {
@@ -70,7 +68,6 @@ public class SysDeptController extends BaseController
     /**
      * 根据部门编号获取详细信息
      */
-    @PreAuthorize("@ss.hasPermi('system:dept:query')")
     @GetMapping(value = "/{deptId}")
     public AjaxResult getInfo(@PathVariable Long deptId)
     {
@@ -81,7 +78,6 @@ public class SysDeptController extends BaseController
     /**
      * 新增部门
      */
-    @PreAuthorize("@ss.hasPermi('system:dept:add')")
     @Log(title = "部门管理", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@Validated @RequestBody SysDept dept)
@@ -97,7 +93,6 @@ public class SysDeptController extends BaseController
     /**
      * 修改部门
      */
-    @PreAuthorize("@ss.hasPermi('system:dept:edit')")
     @Log(title = "部门管理", businessType = BusinessType.UPDATE)
     @PostMapping("/put")
     public AjaxResult edit(@Validated @RequestBody SysDept dept)
@@ -123,7 +118,6 @@ public class SysDeptController extends BaseController
     /**
      * 删除部门
      */
-    @PreAuthorize("@ss.hasPermi('system:dept:remove')")
     @Log(title = "部门管理", businessType = BusinessType.DELETE)
     @GetMapping("/delete/{deptId}")
     public AjaxResult remove(@PathVariable Long deptId)

+ 2 - 9
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java

@@ -56,7 +56,6 @@ public class SysRoleController extends BaseController
     @Autowired
     private ISysDeptService deptService;
 
-    @PreAuthorize("@ss.hasPermi('system:role:list')")
     @GetMapping("/list")
     public TableDataInfo list(SysRole role)
     {
@@ -66,7 +65,6 @@ public class SysRoleController extends BaseController
     }
 
     @Log(title = "角色管理", businessType = BusinessType.EXPORT)
-    @PreAuthorize("@ss.hasPermi('system:role:export')")
     @PostMapping("/export")
     public void export(HttpServletResponse response, SysRole role)
     {
@@ -89,7 +87,6 @@ public class SysRoleController extends BaseController
     /**
      * 新增角色
      */
-    @PreAuthorize("@ss.hasPermi('system:role:add')")
     @Log(title = "角色管理", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@Validated @RequestBody SysRole role)
@@ -110,7 +107,6 @@ public class SysRoleController extends BaseController
     /**
      * 修改保存角色
      */
-    @PreAuthorize("@ss.hasPermi('system:role:edit')")
     @Log(title = "角色管理", businessType = BusinessType.UPDATE)
     @PostMapping("/put")
     public AjaxResult edit(@Validated @RequestBody SysRole role)
@@ -145,7 +141,6 @@ public class SysRoleController extends BaseController
     /**
      * 修改保存数据权限
      */
-    @PreAuthorize("@ss.hasPermi('system:role:edit')")
     @Log(title = "角色管理", businessType = BusinessType.UPDATE)
     @PostMapping("/dataScope")
     public AjaxResult dataScope(@RequestBody SysRole role)
@@ -158,9 +153,8 @@ public class SysRoleController extends BaseController
     /**
      * 状态修改
      */
-    @PreAuthorize("@ss.hasPermi('system:role:edit')")
     @Log(title = "角色管理", businessType = BusinessType.UPDATE)
-    @PutMapping("/changeStatus")
+    @PostMapping("/changeStatus")
     public AjaxResult changeStatus(@RequestBody SysRole role)
     {
         roleService.checkRoleAllowed(role);
@@ -172,9 +166,8 @@ public class SysRoleController extends BaseController
     /**
      * 删除角色
      */
-    @PreAuthorize("@ss.hasPermi('system:role:remove')")
     @Log(title = "角色管理", businessType = BusinessType.DELETE)
-    @DeleteMapping("/{roleIds}")
+    @GetMapping("/delete/{roleIds}")
     public AjaxResult remove(@PathVariable Long[] roleIds)
     {
         return toAjax(roleService.deleteRoleByIds(roleIds));

+ 3 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java

@@ -386,10 +386,10 @@ public class SysUserController extends BaseController
      * 获取当前账号部门树列表
      */
     @GetMapping("/deptTreeNow")
-    public AjaxResult deptTreeNow()
+    public AjaxResult deptTreeNow(SysDept dept)
     {
-        SysUser user = SecurityUtils.getLoginUser().getUser();
-        return success(deptService.selectDeptTreeNowList(user.getDept()));
+
+        return success(deptService.selectDeptTreeNowList(dept));
     }
 
     /***

+ 7 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java

@@ -295,7 +295,13 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     @Override
     public List<TreeSelect> selectDeptTreeNowList(SysDept dept) {
-        List<SysDept> depts = deptMapper.selectDeptTreeNowList(dept);
+
+        SysUser user = SecurityUtils.getLoginUser().getUser();
+        SysDept deptu = user.getDept();
+        if(dept!=null && dept.getStatus()!=null){
+            deptu.setStatus(dept.getStatus());
+        }
+        List<SysDept> depts = deptMapper.selectDeptTreeNowList(deptu);
         return buildDeptTreeSelect(depts);
     }
 

+ 14 - 12
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java

@@ -291,18 +291,20 @@ public class SysRoleServiceImpl implements ISysRoleService
     public int insertRoleMenu(SysRole role)
     {
         int rows = 1;
-        // 新增用户与角色管理
-        List<SysRoleMenu> list = new ArrayList<SysRoleMenu>();
-        for (Long menuId : role.getMenuIds())
-        {
-            SysRoleMenu rm = new SysRoleMenu();
-            rm.setRoleId(role.getRoleId());
-            rm.setMenuId(menuId);
-            list.add(rm);
-        }
-        if (list.size() > 0)
-        {
-            rows = roleMenuMapper.batchRoleMenu(list);
+        if(role.getMenuIds()!=null){
+            // 新增用户与角色管理
+            List<SysRoleMenu> list = new ArrayList<SysRoleMenu>();
+            for (Long menuId : role.getMenuIds())
+            {
+                SysRoleMenu rm = new SysRoleMenu();
+                rm.setRoleId(role.getRoleId());
+                rm.setMenuId(menuId);
+                list.add(rm);
+            }
+            if (list.size() > 0)
+            {
+                rows = roleMenuMapper.batchRoleMenu(list);
+            }
         }
         return rows;
     }

+ 1 - 1
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -160,7 +160,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<include refid="selectDeptVo"/>
 		where d.del_flag = '0'
 		<if test="deptId != null and deptId != 0">
-			AND (dept_id = #{deptId} or ancestors like concat('%', #{deptId}, '%')
+			AND (dept_id = #{deptId} or ancestors like concat('%', #{deptId}, '%'))
 		</if>
 		<if test="parentId != null and parentId != 0">
 			AND parent_id = #{parentId}