mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-27 03:19:36 +08:00
组织数据读取权限完成
This commit is contained in:
@@ -39,8 +39,9 @@ func (p *DeviceApi) GetDeviceList(rc *restfulx.ReqCtx) {
|
||||
data.DeviceType = restfulx.QueryParam(rc, "deviceType")
|
||||
data.ParentId = restfulx.QueryParam(rc, "parentId")
|
||||
data.LinkStatus = restfulx.QueryParam(rc, "linkStatus")
|
||||
// 权限检查
|
||||
|
||||
data.RoleId = rc.LoginAccount.RoleId
|
||||
data.Owner = rc.LoginAccount.UserName
|
||||
list, total := p.DeviceApp.FindListPage(pageNum, pageSize, data)
|
||||
|
||||
rc.ResData = model.ResultPage{
|
||||
|
||||
@@ -26,6 +26,9 @@ func (p *DeviceAlarmApi) GetDeviceAlarmList(rc *restfulx.ReqCtx) {
|
||||
data.StartTime = restfulx.QueryParam(rc, "startTime")
|
||||
data.EndTime = restfulx.QueryParam(rc, "endTime")
|
||||
|
||||
data.RoleId = rc.LoginAccount.RoleId
|
||||
data.Owner = rc.LoginAccount.UserName
|
||||
|
||||
list, total := p.DeviceAlarmApp.FindListPage(pageNum, pageSize, data)
|
||||
|
||||
rc.ResData = model.ResultPage{
|
||||
|
||||
@@ -18,14 +18,20 @@ func (p *DeviceGroupApi) GetDeviceGroupTree(rc *restfulx.ReqCtx) {
|
||||
status := restfulx.QueryParam(rc, "status")
|
||||
id := restfulx.QueryParam(rc, "id")
|
||||
|
||||
sg := entity.DeviceGroup{Name: name, Status: status}
|
||||
sg.Id = id
|
||||
rc.ResData = p.DeviceGroupApp.SelectDeviceGroup(sg)
|
||||
vsg := entity.DeviceGroup{Name: name, Status: status}
|
||||
vsg.Id = id
|
||||
vsg.RoleId = rc.LoginAccount.RoleId
|
||||
vsg.Owner = rc.LoginAccount.UserName
|
||||
|
||||
rc.ResData = p.DeviceGroupApp.SelectDeviceGroup(vsg)
|
||||
}
|
||||
|
||||
func (p *DeviceGroupApi) GetDeviceGroupTreeLabel(rc *restfulx.ReqCtx) {
|
||||
sg := entity.DeviceGroup{}
|
||||
rc.ResData = p.DeviceGroupApp.SelectDeviceGroupLabel(sg)
|
||||
vsg := entity.DeviceGroup{}
|
||||
vsg.RoleId = rc.LoginAccount.RoleId
|
||||
vsg.Owner = rc.LoginAccount.UserName
|
||||
|
||||
rc.ResData = p.DeviceGroupApp.SelectDeviceGroupLabel(vsg)
|
||||
}
|
||||
|
||||
func (p *DeviceGroupApi) GetDeviceGroupList(rc *restfulx.ReqCtx) {
|
||||
@@ -33,18 +39,24 @@ func (p *DeviceGroupApi) GetDeviceGroupList(rc *restfulx.ReqCtx) {
|
||||
status := restfulx.QueryParam(rc, "status")
|
||||
id := restfulx.QueryParam(rc, "id")
|
||||
|
||||
sg := entity.DeviceGroup{Name: name, Status: status}
|
||||
sg.Id = id
|
||||
if sg.Name == "" {
|
||||
rc.ResData = p.DeviceGroupApp.SelectDeviceGroup(sg)
|
||||
vsg := entity.DeviceGroup{Name: name, Status: status}
|
||||
vsg.Id = id
|
||||
|
||||
vsg.RoleId = rc.LoginAccount.RoleId
|
||||
vsg.Owner = rc.LoginAccount.UserName
|
||||
if vsg.Name == "" {
|
||||
rc.ResData = p.DeviceGroupApp.SelectDeviceGroup(vsg)
|
||||
} else {
|
||||
rc.ResData = p.DeviceGroupApp.FindList(sg)
|
||||
rc.ResData = p.DeviceGroupApp.FindList(vsg)
|
||||
}
|
||||
}
|
||||
|
||||
// GetDeviceGroupAllList 查询所有
|
||||
func (p *DeviceGroupApi) GetDeviceGroupAllList(rc *restfulx.ReqCtx) {
|
||||
var vsg entity.DeviceGroup
|
||||
vsg.RoleId = rc.LoginAccount.RoleId
|
||||
vsg.Owner = rc.LoginAccount.UserName
|
||||
|
||||
rc.ResData = p.DeviceGroupApp.FindList(vsg)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user