Roc 3 月之前
父節點
當前提交
e46efd0022

+ 2 - 9
controllers/data_manage/chart_info_share.go

@@ -313,15 +313,8 @@ func (c *ChartInfoShareController) List() {
 	// 基础图表
 	var condition string
 	var pars []interface{}
-	condition += ` AND chart_info_type = ? `
-	pars = append(pars, 0)
-
-	// 图表类型
-	chartType, _ := c.GetInt("ChartType", 0)
-	if chartType > 0 {
-		condition += ` AND chart_type = ? `
-		pars = append(pars, chartType)
-	}
+	condition += ` AND source = ? `
+	pars = append(pars, utils.CHART_TYPE_CURVE)
 
 	// 分类筛选
 	classifyId, _ := c.GetInt("ClassifyId")

+ 2 - 2
models/data_manage/chart_info.go

@@ -444,8 +444,8 @@ type ChartInfoList struct {
 	UniqueCode           string `description:"图表唯一编码"`
 	CreateTime           time.Time
 	ModifyTime           time.Time
-	EdbInfoList          []*EdbInfoList
-	ChartAlias           string `description:"图表别名"`
+	EdbInfoList          []*EdbInfoList `gorm:"-" description:"实际指标数据"`
+	ChartAlias           string         `description:"图表别名"`
 }
 
 type ChartInfoListResp struct {

+ 19 - 28
models/data_manage/chart_info_share.go

@@ -114,20 +114,17 @@ func (m ChartInfoShare) GetAllSharedChartInfoListByFromUserId(sysUserId int) (li
 	sql := `SELECT b."chart_info_id",
        MAX(a.share_type) AS share_type,
 MAX(a.create_time) as share_time,
-MAX(b."chart_code") AS "chart_code",
 MAX(b."chart_name") "chart_name",
-MAX(b."chart_info_type") "chart_info_type",
-MAX(b."chart_type") "chart_type",
 MAX(b."source") "source",
-MAX(b."source_name") "source_name",
-MAX(b."frequency") "frequency",
-MAX(b."unit") "unit",
-MAX(b."classify_id") "classify_id",
-MAX(b."create_time") "create_time",
+MAX(b."chart_type") "chart_type",
+MAX(b."chart_classify_id") "chart_classify_id",
+MAX(b."chart_public_classify_id") "chart_public_classify_id",
 MAX(b."unique_code") "unique_code",
 MAX(b."chart_image") "chart_image",
+MAX(b."sys_user_id") "sys_user_id",
+MAX(b."sys_user_real_name") "sys_user_real_name",
+MAX(b."create_time") "create_time",
 MAX(b."modify_time") "modify_time",
-MAX(b."start_date") "start_date",
 MAX(b."sort") AS "sort"
  FROM chart_info_share AS a 
      JOIN chart_info AS b ON a.chart_info_id = b.chart_info_id
@@ -150,20 +147,17 @@ func (m ChartInfoShare) GetAllSharedChartInfoListByReceivedUserId(sysUserId int)
 	sql := `SELECT b."chart_info_id",
        MAX(a.share_type) AS share_type,
 MAX(a.create_time) as share_time,
-MAX(b."chart_code") AS "chart_code",
 MAX(b."chart_name") "chart_name",
-MAX(b."chart_info_type") "chart_info_type",
-MAX(b."chart_type") "chart_type",
 MAX(b."source") "source",
-MAX(b."source_name") "source_name",
-MAX(b."frequency") "frequency",
-MAX(b."unit") "unit",
-MAX(b."classify_id") "classify_id",
-MAX(b."create_time") "create_time",
+MAX(b."chart_type") "chart_type",
+MAX(b."chart_classify_id") "chart_classify_id",
+MAX(b."chart_public_classify_id") "chart_public_classify_id",
 MAX(b."unique_code") "unique_code",
 MAX(b."chart_image") "chart_image",
+MAX(b."sys_user_id") "sys_user_id",
+MAX(b."sys_user_real_name") "sys_user_real_name",
+MAX(b."create_time") "create_time",
 MAX(b."modify_time") "modify_time",
-MAX(b."start_date") "start_date",
 MAX(b."sort") AS "sort"
  FROM chart_info_share AS a 
      JOIN chart_info AS b ON a.chart_info_id = b.chart_info_id
@@ -186,24 +180,21 @@ ORDER BY share_time DESC`
 // @return total int32
 // @return list []*ChartInfoList
 // @return err error
-func (m ChartInfoShare) GetShareChartInfoListPageList(condition string, pars []interface{}, startSize, pageSize int) (total int32, list []*ChartInfoList, err error) {
+func (m ChartInfoShare) GetShareChartInfoListPageList(condition string, pars []interface{}, startSize, pageSize int) (total int32, list []*ChartInfoView, err error) {
 	baseSql := `SELECT b."chart_info_id",
        MAX(a.share_type) AS share_type,
 MAX(a.create_time) as share_time,
-MAX(b."chart_code") AS "chart_code",
 MAX(b."chart_name") "chart_name",
-MAX(b."chart_info_type") "chart_info_type",
-MAX(b."chart_type") "chart_type",
 MAX(b."source") "source",
-MAX(b."source_name") "source_name",
-MAX(b."frequency") "frequency",
-MAX(b."unit") "unit",
-MAX(b."classify_id") "classify_id",
-MAX(b."create_time") "create_time",
+MAX(b."chart_type") "chart_type",
+MAX(b."chart_classify_id") "chart_classify_id",
+MAX(b."chart_public_classify_id") "chart_public_classify_id",
 MAX(b."unique_code") "unique_code",
 MAX(b."chart_image") "chart_image",
+MAX(b."sys_user_id") "sys_user_id",
+MAX(b."sys_user_real_name") "sys_user_real_name",
+MAX(b."create_time") "create_time",
 MAX(b."modify_time") "modify_time",
-MAX(b."start_date") "start_date",
 MAX(b."sort") AS "sort"
   FROM chart_info_share AS a 
      JOIN chart_info AS b ON a.chart_info_id = b.chart_info_id

+ 6 - 1
services/data/chart_classify.go

@@ -1403,7 +1403,12 @@ func GetChartClassifyTreeRecursive(list []*data_manage.ChartClassifyItems, paren
 	res := make([]*data_manage.ChartClassifyItems, 0)
 	for _, v := range list {
 		if v.ParentId == parentId {
-			v.Children = GetChartClassifyTreeRecursive(list, v.ChartClassifyId)
+			tmpChildrenList := GetChartClassifyTreeRecursive(list, v.ChartClassifyId)
+			if v.Children != nil {
+				v.Children = append(v.Children, tmpChildrenList...)
+			} else {
+				v.Children = GetChartClassifyTreeRecursive(list, v.ChartClassifyId)
+			}
 			res = append(res, v)
 		}
 	}

+ 1 - 2
services/data/chart_info_share.go

@@ -81,8 +81,7 @@ func GetChartClassifyItemListByShareChartInfoQueryList(items []*data_manage.Shar
 		}
 		chartClassifyItemList, ok := chartClassifyItemListMap[v.ChartClassifyId]
 		if !ok {
-			chartClassifyItemListMap[v.ChartClassifyId] = []*data_manage.ChartClassifyItems{chartClassifyItem}
-			continue
+			chartClassifyItemList = make([]*data_manage.ChartClassifyItems, 0)
 		}
 		chartClassifyItemListMap[v.ChartClassifyId] = append(chartClassifyItemList, chartClassifyItem)
 		classifyIdList = append(classifyIdList, v.ChartClassifyId)

+ 1 - 2
services/data/edb_info_share.go

@@ -79,8 +79,7 @@ func GetEdbClassifyItemListByShareEdbInfoQueryList(items []*data_manage.ShareEdb
 		}
 		edbClassifyItemList, ok := edbClassifyItemListMap[v.ClassifyId]
 		if !ok {
-			edbClassifyItemListMap[v.ClassifyId] = []*data_manage.EdbClassifyItems{edbClassifyItem}
-			continue
+			edbClassifyItemList = make([]*data_manage.EdbClassifyItems, 0)
 		}
 		edbClassifyItemListMap[v.ClassifyId] = append(edbClassifyItemList, edbClassifyItem)
 		classifyIdList = append(classifyIdList, v.ClassifyId)