浏览代码

Merge branch 'BI_Dashboard' into dm

zwxi 8 月之前
父节点
当前提交
0d9596852a
共有 3 个文件被更改,包括 17 次插入5 次删除
  1. 13 3
      controllers/bi_dashboard.go
  2. 2 1
      models/bi_approve/bi_approve_message.go
  3. 2 1
      models/bi_dashboard/bi_dashboard.go

+ 13 - 3
controllers/bi_dashboard.go

@@ -302,7 +302,7 @@ func (this *BIDaShboardController) DetailDashboard() {
 		return
 	}
 	dashboardId, _ := this.GetInt("DashboardId")
-
+	resp := new(bi_dashboard.DashboardDetailResp)
 	dashboardItem, err := bi_dashboard.GetDashboardById(dashboardId)
 	if err != nil {
 		err = errors.New("我的看板列表查询出错:" + err.Error())
@@ -311,6 +311,16 @@ func (this *BIDaShboardController) DetailDashboard() {
 		return
 	}
 
+	grantInfoList, err := bi_dashboard.GetDashboardGrantInfo(dashboardId)
+	if err != nil {
+		br.Msg = "信息获取失败"
+		br.ErrMsg = "共享信息获取失败,Err:" + err.Error()
+		return
+	}
+	if len(grantInfoList) > 0 {
+		resp.IsGrant = 1
+	}
+
 	detailList, err := bi_dashboard.GetBiDashboardDetailById(dashboardId)
 	if err != nil {
 		br.Msg = "详情获取失败"
@@ -318,7 +328,6 @@ func (this *BIDaShboardController) DetailDashboard() {
 		return
 	}
 
-	resp := new(bi_dashboard.DashboardDetailResp)
 	resp.BiDashboard = dashboardItem
 	resp.List = detailList
 
@@ -596,6 +605,7 @@ func (this *BIDaShboardController) PublicList() {
 		tmpItem := &bi_dashboard.RespPublicGroupListItem{
 			GroupId:   int64(c.BiDashboardClassifyId),
 			GroupName: c.BiDashboardClassifyName,
+			Children:  make([]*bi_dashboard.RespPublicGroupListItem, 0),
 		}
 		if _, ok := publicDashboardClassifyIdMap[c.BiDashboardClassifyId]; ok {
 			for _, v := range publicAdminIdList {
@@ -620,9 +630,9 @@ func (this *BIDaShboardController) PublicList() {
 				for _, vv := range respGroupNameListItemList {
 					if vv.BiDashboardClassifyId == c.BiDashboardClassifyId {
 						tmpRespGroupListItem.DashboardList = append(tmpRespGroupListItem.DashboardList, vv)
+						tmpItem.Children = append(tmpItem.Children, tmpRespGroupListItem)
 					}
 				}
-				tmpItem.Children = append(tmpItem.Children, tmpRespGroupListItem)
 
 				resp = append(resp, tmpItem)
 			}

+ 2 - 1
models/bi_approve/bi_approve_message.go

@@ -98,12 +98,13 @@ func (m *BiApproveMessage) GetPageItemsByCondition(condition string, pars []inte
 		order = ` ORDER BY ` + orderRule
 	}
 	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s LIMIT ?,?`, fields, m.TableName(), condition, order)
+	pars = append(pars, startSize, pageSize)
 	err = global.DmSQL["rddp"].Raw(sql, pars...).Find(&items).Error
 	return
 }
 
 func (m *BiApproveMessage) GetItemById(id int) (item *BiApproveMessage, err error) {
-	sql := fmt.Sprintf(`SELECT * FROM %s WHERE %s = ? LIMIT 1`, m.TableName(), m.PrimaryId())
+	sql := fmt.Sprintf(`SELECT * FROM %s WHERE %s = ? `, m.TableName(), m.PrimaryId())
 	err = global.DmSQL["rddp"].Raw(sql, id).First(&item).Error
 	return
 }

+ 2 - 1
models/bi_dashboard/bi_dashboard.go

@@ -78,7 +78,8 @@ func DelDashboard(id int) (err error) {
 // DashboardDetailResp 详情响应体
 type DashboardDetailResp struct {
 	*BiDashboard
-	List []*BiDashboardDetail
+	IsGrant int `description:"是否共享,0:不是,1:是"`
+	List    []*BiDashboardDetail
 }
 
 type AddDashboardReq struct {