1、优化权限管理

This commit is contained in:
weidong 2024-05-22 07:24:49 +08:00
parent acdf5cea0f
commit 1aee2adc0f
10 changed files with 169 additions and 46 deletions

View File

@ -113,6 +113,7 @@ public class GnssCalcDataController extends BasicController implements CommonExc
@Override @Override
public String tenantIdField() { public String tenantIdField() {
return "d.tenantid"; if(isJoinQuery) return "d.tenantid";
else return "tenantid";
} }
} }

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.imdroid.beidou.common.HttpResult; import com.imdroid.beidou.common.HttpResult;
import com.imdroid.beidou.common.Role;
import com.imdroid.beidou.entity.Tenant; import com.imdroid.beidou.entity.Tenant;
import com.imdroid.beidou.entity.TenantMapper; import com.imdroid.beidou.entity.TenantMapper;
import com.imdroid.beidou.entity.User; import com.imdroid.beidou.entity.User;
@ -42,8 +43,9 @@ public class UserController extends BasicController {
@RequestMapping("/sys/user/add") @RequestMapping("/sys/user/add")
public String addUser(Model m, HttpSession session){ public String addUser(Model m, HttpSession session){
initModel(m, session); initModel(m, session);
QueryWrapper<Tenant> queryWrapper = new QueryWrapper<>();
List<Tenant> tenants = tenantMapper.selectList(null); if(loginRole.equals(Role.ADMIN)) queryWrapper.ne("id",Tenant.SAAS_PROVIDER_ID);
List<Tenant> tenants = tenantMapper.selectList(queryWrapper);
m.addAttribute("tenant_list", tenants); m.addAttribute("tenant_list", tenants);
return "/page/table/user_add"; return "/page/table/user_add";
@ -52,7 +54,10 @@ public class UserController extends BasicController {
@RequestMapping("/sys/user/edit") @RequestMapping("/sys/user/edit")
public String editUser(Model m, HttpSession session){ public String editUser(Model m, HttpSession session){
initModel(m, session); initModel(m, session);
List<Tenant> tenants = tenantMapper.selectList(null); QueryWrapper<Tenant> queryWrapper = new QueryWrapper<>();
if(loginRole.equals(Role.ADMIN)) queryWrapper.ne("id",Tenant.SAAS_PROVIDER_ID);
List<Tenant> tenants = tenantMapper.selectList(queryWrapper);
m.addAttribute("tenant_list", tenants); m.addAttribute("tenant_list", tenants);
return "/page/table/user_add"; return "/page/table/user_add";
} }
@ -63,6 +68,7 @@ public class UserController extends BasicController {
public JSONObject list(HttpSession session, int page, int limit, String searchParams) { public JSONObject list(HttpSession session, int page, int limit, String searchParams) {
Page<User> pageable = new Page<>(page, limit); Page<User> pageable = new Page<>(page, limit);
QueryWrapper<User> queryWrapper = new QueryWrapper<>(); QueryWrapper<User> queryWrapper = new QueryWrapper<>();
if(loginRole.equals(Role.ADMIN)) queryWrapper.ne("role",Role.SUPER_ADMIN);
IPage<User> cs = userMapper.selectPage(pageable, queryWrapper); IPage<User> cs = userMapper.selectPage(pageable, queryWrapper);

View File

@ -4,7 +4,7 @@
"href": "page/device_overview" "href": "page/device_overview"
}, },
"logoInfo": { "logoInfo": {
"title": "形变监测平台", "title": "北斗管理平台",
"image": "images/logo.png", "image": "images/logo.png",
"href": "" "href": ""
}, },
@ -53,12 +53,6 @@
"icon": "fa fa-gear", "icon": "fa fa-gear",
"target": "_self", "target": "_self",
"child": [ "child": [
{
"title": "通用参数",
"href": "page/gnss_group_cfg",
"icon": "fa fa-minus",
"target": "_self"
},
{ {
"title": "设备参数", "title": "设备参数",
"href": "page/gnss_dev_cfg", "href": "page/gnss_dev_cfg",
@ -78,24 +72,16 @@
"href": "page/fwd_records", "href": "page/fwd_records",
"icon": "fa fa-minus", "icon": "fa fa-minus",
"target": "_self" "target": "_self"
},
{
"title": "等待推送",
"href": "page/resend_records",
"icon": "fa fa-minus",
"target": "_self"
} }
] ]
} }
] ]
},
{
"title": "系统管理",
"icon": "fa fa-lemon-o",
"href": "",
"target": "_self",
"child": [
{
"title": "操作日志",
"href": "",
"icon": "fa fa-pencil-square-o",
"target": "_self"
}
]
} }
] ]
} }

View File

@ -4,7 +4,7 @@
"href": "page/device_overview" "href": "page/device_overview"
}, },
"logoInfo": { "logoInfo": {
"title": "形变监测平台", "title": "北斗管理平台",
"image": "images/logo.png", "image": "images/logo.png",
"href": "" "href": ""
}, },
@ -156,12 +156,6 @@
"href": "sys/user", "href": "sys/user",
"icon": "fa fa-user", "icon": "fa fa-user",
"target": "_self" "target": "_self"
},
{
"title": "操作日志",
"href": "",
"icon": "fa fa-pencil-square-o",
"target": "_self"
} }
] ]
} }

View File

@ -0,0 +1,133 @@
{
"homeInfo": {
"title": "首页",
"href": "page/device_overview"
},
"logoInfo": {
"title": "北斗管理平台",
"image": "images/logo.png",
"href": ""
},
"menuInfo": [
{
"title": "设备管理",
"icon": "fa fa-address-book",
"href": "",
"target": "_self",
"child": [
{
"title": "设备总览",
"href": "page/device_overview",
"icon": "fa fa-home",
"target": "_self"
},
{
"title": "运行状态",
"href": "page/gnss_status",
"icon": "fa fa-tachometer",
"target": "_self"
},
{
"title": "告警管理",
"href": "",
"icon": "fa fa-bell-o",
"target": "",
"child": [
{
"title": "告警消息",
"href": "page/warning",
"icon": "fa fa-minus",
"target": "_self"
},
{
"title": "告警参数",
"href": "page/warning_cfg",
"icon": "fa fa-minus",
"target": "_self"
}
]
},
{
"title": "解算结果",
"href": "page/gnss_data_calc",
"icon": "fa fa-calculator",
"target": "_self"
},
{
"title": "配置管理",
"href": "",
"icon": "fa fa-gear",
"target": "_self",
"child": [
{
"title": "通用参数",
"href": "page/gnss_group_cfg",
"icon": "fa fa-minus",
"target": "_self"
},
{
"title": "设备参数",
"href": "page/gnss_dev_cfg",
"icon": "fa fa-minus",
"target": "_self"
}
]
},
{
"title": "设备消息",
"href": "",
"icon": "fa fa-file-text-o",
"target": "_self",
"child": [
{
"title": "状态消息",
"href": "page/gnss_msg_status",
"icon": "fa fa-minus",
"target": "_self"
},
{
"title": "统计消息",
"href": "page/gnss_msg_trx",
"icon": "fa fa-minus",
"target": "_self"
}
]
},
{
"title": "数据推送",
"href": "",
"icon": "fa fa-send-o",
"target": "_self",
"child": [
{
"title": "推送记录",
"href": "page/fwd_records",
"icon": "fa fa-minus",
"target": "_self"
},
{
"title": "等待推送",
"href": "page/resend_records",
"icon": "fa fa-minus",
"target": "_self"
}
]
}
]
},
{
"title": "系统管理",
"icon": "fa fa-lemon-o",
"href": "",
"target": "_self",
"child": [
{
"title": "用户管理",
"href": "sys/user",
"icon": "fa fa-user",
"target": "_self"
}
]
}
]
}

View File

@ -131,8 +131,11 @@
miniAdmin = layui.miniAdmin; miniAdmin = layui.miniAdmin;
var nav_url; var nav_url;
if([[${role}]] == "SUPER_ADMIN" || [[${role}]] == "ADMIN") { if([[${role}]] == "SUPER_ADMIN" ) {
nav_url = "api/init.json"; nav_url = "api/init_super_admin.json";
}
else if([[${role}]] == "ADMIN") {
nav_url = "api/init_sys_admin.json";
} }
else { else {
nav_url = "api/init_enterprise.json" nav_url = "api/init_enterprise.json"

View File

@ -89,9 +89,9 @@
{field: 'b562e', title: '原始东', templet: "<div>{{d.b562e.toFixed(2)}}</div>"}, {field: 'b562e', title: '原始东', templet: "<div>{{d.b562e.toFixed(2)}}</div>"},
{field: 'b562n', title: '原始北', templet: "<div>{{d.b562n.toFixed(2)}}</div>"}, {field: 'b562n', title: '原始北', templet: "<div>{{d.b562n.toFixed(2)}}</div>"},
{field: 'b562d', title: '原始天', templet: "<div>{{d.b562d.toFixed(2)}}</div>"}, {field: 'b562d', title: '原始天', templet: "<div>{{d.b562d.toFixed(2)}}</div>"},
{field: 'rpose', title: '相对东', templet: "<div>{{d.rpose==null?'':d.rpose.toFixed(2)}}</div>"}, {field: 'rpose', title: '滤波东', templet: "<div>{{d.rpose==null?'':d.rpose.toFixed(2)}}</div>"},
{field: 'rposn', title: '相对北', templet: "<div>{{d.rposn==null?'':d.rposn.toFixed(2)}}</div>"}, {field: 'rposn', title: '滤波北', templet: "<div>{{d.rposn==null?'':d.rposn.toFixed(2)}}</div>"},
{field: 'rposd', title: '相对天', templet: "<div>{{d.rposd==null?'':d.rposd.toFixed(2)}}</div>"}, {field: 'rposd', title: '滤波天', templet: "<div>{{d.rposd==null?'':d.rposd.toFixed(2)}}</div>"},
//{field: 'auxe', title: '辅助东', templet: "<div>{{d.auxe==null?'':d.auxe.toFixed(2)}}</div>"}, //{field: 'auxe', title: '辅助东', templet: "<div>{{d.auxe==null?'':d.auxe.toFixed(2)}}</div>"},
//{field: 'auxn', title: '辅助北', templet: "<div>{{d.auxn==null?'':d.auxn.toFixed(2)}}</div>"}, //{field: 'auxn', title: '辅助北', templet: "<div>{{d.auxn==null?'':d.auxn.toFixed(2)}}</div>"},
//{field: 'auxd', title: '辅助天', templet: "<div>{{d.auxd==null?'':d.auxd.toFixed(2)}}</div>"}, //{field: 'auxd', title: '辅助天', templet: "<div>{{d.auxd==null?'':d.auxd.toFixed(2)}}</div>"},

View File

@ -88,7 +88,7 @@
{field: 'deviceid', title: '设备号', sort: true}, {field: 'deviceid', title: '设备号', sort: true},
{field: 'name', title: '设备名称'}, {field: 'name', title: '设备名称'},
{field: 'devicetype', title: '类型',templet: '#typeTrans'}, {field: 'devicetype', title: '类型',templet: '#typeTrans'},
{field: 'parentid', title: '父设备号', sort: true}, {field: 'parentid', title: '基站编号', sort: true},
{field: 'tenantname', title: '所属组织'}, {field: 'tenantname', title: '所属组织'},
{field: 'project_id', title: '项目号', sort: true}, {field: 'project_id', title: '项目号', sort: true},
{field: 'group_id', title: '基本参数组', sort: true}, {field: 'group_id', title: '基本参数组', sort: true},
@ -99,9 +99,8 @@
{field: 'syn', title: '参数同步',templet: '#synTrans'}, {field: 'syn', title: '参数同步',templet: '#synTrans'},
{title: '操作', toolbar: '#currentTableBar', align: "center", minWidth: 120} {title: '操作', toolbar: '#currentTableBar', align: "center", minWidth: 120}
]; ];
if([[${role}]] != "ADMIN" && [[${role}]] != "SUPER_ADMIN" && if([[${role}]] == "USER") {
!([[${role}]] == "MANAGER" && [[${tenant_id}]] == 0)) { cfg_cols[12].hide = true;
cfg_cols[9].hide = true;
} }
/** /**
* 初始化表单,要加上,不然刷新部分组件可能会不加载 * 初始化表单,要加上,不然刷新部分组件可能会不加载

View File

@ -42,7 +42,7 @@
</div> </div>
</div> </div>
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label">父设备</label> <label class="layui-form-label">基站编</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="number" name="parentid" id="parentid" placeholder="请输入关联基准站编号" value="" class="layui-input"> <input type="number" name="parentid" id="parentid" placeholder="请输入关联基准站编号" value="" class="layui-input">
</div> </div>
@ -83,7 +83,7 @@
<input type="text" name="project_id" id="project_id" placeholder="请输入项目编号" value="" class="layui-input"> <input type="text" name="project_id" id="project_id" placeholder="请输入项目编号" value="" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-inline"> <div class="layui-inline" th:if="${role=='SUPER_ADMIN'}">
<label class="layui-form-label">项目2号</label> <label class="layui-form-label">项目2号</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" name="project2_id" id="project2_id" placeholder="请输入项目编号" value="" class="layui-input"> <input type="text" name="project2_id" id="project2_id" placeholder="请输入项目编号" value="" class="layui-input">
@ -114,7 +114,7 @@
</select> </select>
</div> </div>
</div> </div>
<div class="layui-inline" th:if="${role=='SUPER_ADMIN' || role=='ADMIN'}"> <div class="layui-inline" th:if="${role=='SUPER_ADMIN'}">
<label class="layui-form-label">推送2</label> <label class="layui-form-label">推送2</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<select name="fwd_group_id2" id="fwd_group_id2" lay-search=""> <select name="fwd_group_id2" id="fwd_group_id2" lay-search="">
@ -204,6 +204,7 @@
console.log("ajax error"); console.log("ajax error");
} }
}); });
layer.close(index);
}); });
return false; return false;

View File

@ -51,8 +51,8 @@
<label class="layui-form-label">角色</label> <label class="layui-form-label">角色</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<select name="role" id="role" lay-filter="role"> <select name="role" id="role" lay-filter="role">
<option value="SUPER_ADMIN" th:if="${tenant_id}==0">超级管理员</option> <option value="SUPER_ADMIN" th:if="${role=='SUPER_ADMIN' && tenant_id==0}">超级管理员</option>
<option value="ADMIN" th:if="${tenant_id}==0">系统管理员</option> <option value="ADMIN" th:if="${role=='SUPER_ADMIN' || role=='ADMIN'}">系统管理员</option>
<option value="MANAGER">管理员</option> <option value="MANAGER">管理员</option>
<option value="USER">用户</option> <option value="USER">用户</option>
</select> </select>