【feature】添加组织数据读取权限

This commit is contained in:
XM-GO
2023-09-14 17:28:52 +08:00
parent bde42bfc9a
commit b5ee2a54b9
84 changed files with 1664 additions and 774 deletions

View File

@@ -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)

View File

@@ -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,
}
}

View File

@@ -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,
}
}

View File

@@ -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)
}

View File

@@ -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)
}

View File

@@ -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)
}

View File

@@ -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,
}
}

View File

@@ -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 {