厨房后场人员登录
This commit is contained in:
parent
228ad9c479
commit
5270de1267
|
|
@ -194,8 +194,11 @@ public class SysUserController extends BaseController {
|
|||
if (StringUtils.isNull(sysUser)) {
|
||||
return R.fail("用户名或密码错误");
|
||||
}
|
||||
// 权限集合
|
||||
Set<String> permissions = permissionService.getDevicePermission(sysUser);
|
||||
LoginUser sysUserVo = new LoginUser();
|
||||
sysUserVo.setSysUser(sysUser);
|
||||
sysUserVo.setPermissions(permissions);
|
||||
return R.ok(sysUserVo);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,8 @@ public interface SysMenuMapper
|
|||
*/
|
||||
public List<String> selectMenuPermsByUserId(Long userId);
|
||||
|
||||
public List<String> selectDevicePermsByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询菜单
|
||||
*
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ public interface ISysMenuService
|
|||
*/
|
||||
public Set<String> selectMenuPermsByUserId(Long userId);
|
||||
|
||||
public Set<String> selectDevicePermsByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 根据角色ID查询权限
|
||||
*
|
||||
|
|
|
|||
|
|
@ -26,4 +26,6 @@ public interface ISysPermissionService
|
|||
* @return 菜单权限信息
|
||||
*/
|
||||
public Set<String> getMenuPermission(SysUser user);
|
||||
|
||||
public Set<String> getDevicePermission(SysUser user);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,6 +102,21 @@ public class SysMenuServiceImpl implements ISysMenuService
|
|||
return permsSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> selectDevicePermsByUserId(Long userId)
|
||||
{
|
||||
List<String> perms = menuMapper.selectDevicePermsByUserId(userId);
|
||||
Set<String> permsSet = new HashSet<>();
|
||||
for (String perm : perms)
|
||||
{
|
||||
if (StringUtils.isNotEmpty(perm))
|
||||
{
|
||||
permsSet.addAll(Arrays.asList(perm.trim().split(",")));
|
||||
}
|
||||
}
|
||||
return permsSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色ID查询权限
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
package com.bonus.system.service.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
|
@ -83,4 +86,12 @@ public class SysPermissionServiceImpl implements ISysPermissionService
|
|||
}
|
||||
return perms;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getDevicePermission(SysUser user)
|
||||
{
|
||||
Set<String> perms = new HashSet<String>();
|
||||
perms.addAll(menuService.selectDevicePermsByUserId(user.getUserId()));
|
||||
return perms;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,6 +143,13 @@
|
|||
left join sys_role r on r.role_id = ur.role_id
|
||||
where m.status = '0' and r.status = '0' and ur.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectDevicePermsByUserId" parameterType="Long" resultType="String">
|
||||
select distinct ksdp.device_type
|
||||
from kitchen_staff_info ksi
|
||||
left join kitchen_staff_device_privilege ksdp on ksdp.staff_id = ksi.staff_id
|
||||
where ksdp.privilege_name = 'is_enable' and ksdp.privilege_value = '1' and ksi.staff_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectMenuPermsByRoleId" parameterType="Long" resultType="String">
|
||||
select distinct m.perms
|
||||
|
|
|
|||
Loading…
Reference in New Issue