mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-23 10:58:35 +08:00
【feature】添加组织数据读取权限
This commit is contained in:
@@ -39,13 +39,14 @@ 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
|
||||
list, total := p.DeviceApp.FindListPage(pageNum, pageSize, data)
|
||||
|
||||
rc.ResData = model.ResultPage{
|
||||
Total: total,
|
||||
PageNum: int64(pageNum),
|
||||
PageSize: int64(pageNum),
|
||||
PageSize: int64(pageSize),
|
||||
Data: list,
|
||||
}
|
||||
}
|
||||
@@ -135,6 +136,7 @@ func (p *DeviceApi) InsertDevice(rc *restfulx.ReqCtx) {
|
||||
biz.IsTrue(!(list != nil && len(*list) > 0), fmt.Sprintf("名称%s已存在,设置其他命名", data.Name))
|
||||
data.Id = kgo.KStr.Uniqid("d_")
|
||||
data.Owner = rc.LoginAccount.UserName
|
||||
data.OrgId = rc.LoginAccount.OrganizationId
|
||||
data.LinkStatus = global.INACTIVE
|
||||
data.LastAt = time.Now()
|
||||
p.DeviceApp.Insert(data)
|
||||
|
||||
@@ -31,7 +31,7 @@ func (p *DeviceAlarmApi) GetDeviceAlarmList(rc *restfulx.ReqCtx) {
|
||||
rc.ResData = model.ResultPage{
|
||||
Total: total,
|
||||
PageNum: int64(pageNum),
|
||||
PageSize: int64(pageNum),
|
||||
PageSize: int64(pageSize),
|
||||
Data: list,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ func (p *DeviceCmdLogApi) GetDeviceCmdLogList(rc *restfulx.ReqCtx) {
|
||||
rc.ResData = model.ResultPage{
|
||||
Total: total,
|
||||
PageNum: int64(pageNum),
|
||||
PageSize: int64(pageNum),
|
||||
PageSize: int64(pageSize),
|
||||
Data: list,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ func (p *DeviceGroupApi) InsertDeviceGroup(rc *restfulx.ReqCtx) {
|
||||
restfulx.BindJsonAndValid(rc, &data)
|
||||
data.Id = kgo.KStr.Uniqid("dg_")
|
||||
data.Owner = rc.LoginAccount.UserName
|
||||
data.OrgId = rc.LoginAccount.OrganizationId
|
||||
p.DeviceGroupApp.Insert(data)
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ func (p *ProductApi) GetProductList(rc *restfulx.ReqCtx) {
|
||||
rc.ResData = model.ResultPage{
|
||||
Total: total,
|
||||
PageNum: int64(pageNum),
|
||||
PageSize: int64(pageNum),
|
||||
PageSize: int64(pageSize),
|
||||
Data: list,
|
||||
}
|
||||
}
|
||||
@@ -68,6 +68,7 @@ func (p *ProductApi) InsertProduct(rc *restfulx.ReqCtx) {
|
||||
restfulx.BindJsonAndValid(rc, &data)
|
||||
data.Id = kgo.KStr.Uniqid("p_")
|
||||
data.Owner = rc.LoginAccount.UserName
|
||||
data.OrgId = rc.LoginAccount.OrganizationId
|
||||
p.ProductApp.Insert(data)
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ func (p *ProductCategoryApi) InsertProductCategory(rc *restfulx.ReqCtx) {
|
||||
restfulx.BindJsonAndValid(rc, &data)
|
||||
data.Id = kgo.KStr.Uniqid("pc_")
|
||||
data.Owner = rc.LoginAccount.UserName
|
||||
data.OrgId = rc.LoginAccount.OrganizationId
|
||||
p.ProductCategoryApp.Insert(data)
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ func (p *ProductOtaApi) GetProductOtaList(rc *restfulx.ReqCtx) {
|
||||
rc.ResData = model.ResultPage{
|
||||
Total: total,
|
||||
PageNum: int64(pageNum),
|
||||
PageSize: int64(pageNum),
|
||||
PageSize: int64(pageSize),
|
||||
Data: list,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ func (p *ProductTemplateApi) GetProductTemplateList(rc *restfulx.ReqCtx) {
|
||||
rc.ResData = model.ResultPage{
|
||||
Total: total,
|
||||
PageNum: int64(pageNum),
|
||||
PageSize: int64(pageNum),
|
||||
PageSize: int64(pageSize),
|
||||
Data: list,
|
||||
}
|
||||
}
|
||||
@@ -57,6 +57,7 @@ func (p *ProductTemplateApi) InsertProductTemplate(rc *restfulx.ReqCtx) {
|
||||
var data entity.ProductTemplate
|
||||
restfulx.BindJsonAndValid(rc, &data)
|
||||
data.Id = kgo.KStr.Uniqid("tm_")
|
||||
data.OrgId = rc.LoginAccount.OrganizationId
|
||||
p.ProductTemplateApp.Insert(data)
|
||||
// 向超级表中添加字段
|
||||
if data.Classify == entity.ATTRIBUTES_TSL {
|
||||
|
||||
Reference in New Issue
Block a user