浏览代码

Merge branch 'dev_wh' of ApplicationCenter/publicService into master

王浩 2 年之前
父节点
当前提交
5cd980d796
共有 3 个文件被更改,包括 41 次插入28 次删除
  1. 19 9
      rpc/pb/publicservice.pb.go
  2. 1 0
      rpc/publicservice.proto
  3. 21 19
      rpc/service/datasmt.go

+ 19 - 9
rpc/pb/publicservice.pb.go

@@ -364,6 +364,7 @@ type DatasmtRespDetail struct {
 	ClearStatus     string `protobuf:"bytes,4,opt,name=clear_status,json=clearStatus,proto3" json:"clear_status,omitempty"`             //清洗状态
 	FieldIllustrate *Field `protobuf:"bytes,5,opt,name=field_illustrate,json=fieldIllustrate,proto3" json:"field_illustrate,omitempty"` //包含字段说明
 	DataExample     string `protobuf:"bytes,6,opt,name=data_example,json=dataExample,proto3" json:"data_example,omitempty"`             //数据示例图片路径
+	Introduce       string `protobuf:"bytes,7,opt,name=introduce,proto3" json:"introduce,omitempty"`
 }
 
 func (x *DatasmtRespDetail) Reset() {
@@ -440,6 +441,13 @@ func (x *DatasmtRespDetail) GetDataExample() string {
 	return ""
 }
 
+func (x *DatasmtRespDetail) GetIntroduce() string {
+	if x != nil {
+		return x.Introduce
+	}
+	return ""
+}
+
 var File_publicservice_proto protoreflect.FileDescriptor
 
 var file_publicservice_proto_rawDesc = []byte{
@@ -479,7 +487,7 @@ var file_publicservice_proto_rawDesc = []byte{
 	0x0b, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x22, 0x0a, 0x10,
 	0x44, 0x61, 0x74, 0x61, 0x73, 0x6d, 0x74, 0x52, 0x65, 0x71, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c,
 	0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64,
-	0x22, 0xd5, 0x01, 0x0a, 0x11, 0x44, 0x61, 0x74, 0x61, 0x73, 0x6d, 0x74, 0x52, 0x65, 0x73, 0x70,
+	0x22, 0xf3, 0x01, 0x0a, 0x11, 0x44, 0x61, 0x74, 0x61, 0x73, 0x6d, 0x74, 0x52, 0x65, 0x73, 0x70,
 	0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01,
 	0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x61,
 	0x74, 0x61, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64,
@@ -492,14 +500,16 @@ var file_publicservice_proto_rawDesc = []byte{
 	0x69, 0x65, 0x6c, 0x64, 0x52, 0x0f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x49, 0x6c, 0x6c, 0x75, 0x73,
 	0x74, 0x72, 0x61, 0x74, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x65, 0x78,
 	0x61, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x61, 0x74,
-	0x61, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x32, 0x65, 0x0a, 0x07, 0x64, 0x61, 0x74, 0x61,
-	0x73, 0x6d, 0x74, 0x12, 0x29, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x0f, 0x2e, 0x44, 0x61,
-	0x74, 0x61, 0x73, 0x6d, 0x74, 0x52, 0x65, 0x71, 0x4c, 0x69, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x44,
-	0x61, 0x74, 0x61, 0x73, 0x6d, 0x74, 0x52, 0x65, 0x73, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2f,
-	0x0a, 0x06, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x11, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x73,
-	0x6d, 0x74, 0x52, 0x65, 0x71, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x1a, 0x12, 0x2e, 0x44, 0x61,
-	0x74, 0x61, 0x73, 0x6d, 0x74, 0x52, 0x65, 0x73, 0x70, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x42,
-	0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x61, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x72,
+	0x6f, 0x64, 0x75, 0x63, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x69, 0x6e, 0x74,
+	0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x32, 0x65, 0x0a, 0x07, 0x64, 0x61, 0x74, 0x61, 0x73, 0x6d,
+	0x74, 0x12, 0x29, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x0f, 0x2e, 0x44, 0x61, 0x74, 0x61,
+	0x73, 0x6d, 0x74, 0x52, 0x65, 0x71, 0x4c, 0x69, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x44, 0x61, 0x74,
+	0x61, 0x73, 0x6d, 0x74, 0x52, 0x65, 0x73, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2f, 0x0a, 0x06,
+	0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x11, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x73, 0x6d, 0x74,
+	0x52, 0x65, 0x71, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x1a, 0x12, 0x2e, 0x44, 0x61, 0x74, 0x61,
+	0x73, 0x6d, 0x74, 0x52, 0x65, 0x73, 0x70, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x42, 0x06, 0x5a,
+	0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (

+ 1 - 0
rpc/publicservice.proto

@@ -41,6 +41,7 @@ message DatasmtRespDetail {
   string clear_status = 4;      //清洗状态
   Field field_illustrate = 5;  //包含字段说明
   string data_example = 6;      //数据示例图片路径
+  string introduce=7;
 }
 
 

+ 21 - 19
rpc/service/datasmt.go

@@ -1,6 +1,5 @@
 package service
 
-import "C"
 import (
 	"app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/encrypt"
@@ -20,15 +19,27 @@ type DataSmt struct {
 
 // 列表数据
 func (d *DataSmt) List(searchValue, dataType string, pageNum, pageSize int64) *pb.DatasmtRespList {
+	result := pb.DatasmtRespList{}
+	//包含字段说明
+	fieldIllustrate := []*pb.Field{}
+	fieldIllustrateMap := map[string]string{}
+	for _, v := range config.C.DataSmt.FieldIllustrate {
+		fieldIllustrate = append(fieldIllustrate, &pb.Field{
+			Code:     v.Code,
+			Name:     v.Name,
+			Describe: v.Describe,
+		})
+		fieldIllustrateMap[v.Code] = v.Name
+	}
+	result.FieldIllustrate = fieldIllustrate
 	if pageSize == 0 {
-		pageSize = 8
+		pageSize = 40
 	}
-	result := pb.DatasmtRespList{}
 	//数据查询
 	data := &[]map[string]interface{}{}
-	querySql := "select  id,name,data_type,format,clear_status from  %s where %s ORDER BY serial_number  limit %d ,%d "
+	querySql := "select  id,name,data_type,format,clear_status from  %s where %s ORDER BY serial_number  limit %v ,%v "
 	queryStrArr := []string{
-		" 1=1 ",
+		" status=1 ",
 	}
 	if searchValue != "" {
 		queryStrArr = append(queryStrArr, " name  LIKE '%"+searchValue+"%' ")
@@ -36,7 +47,7 @@ func (d *DataSmt) List(searchValue, dataType string, pageNum, pageSize int64) *p
 	if dataType != "" {
 		queryStrArr = append(queryStrArr, fmt.Sprintf(" data_type  = '%s' ", dataType))
 	}
-	querySql = fmt.Sprintf(querySql, DATA_SUPERMARKET, strings.Join(queryStrArr, " and "), (pageNum)*pageSize, pageNum+1*pageSize)
+	querySql = fmt.Sprintf(querySql, DATA_SUPERMARKET, strings.Join(queryStrArr, " and "), (pageNum-1)*pageSize, pageSize)
 	data = db.Mysql_BaseService.SelectBySql(querySql)
 	if data != nil && len(*data) > 0 {
 		//数据处理
@@ -45,7 +56,7 @@ func (d *DataSmt) List(searchValue, dataType string, pageNum, pageSize int64) *p
 			dataList = append(dataList, &pb.DatasmtList{
 				Id:          encrypt.SE.Encode2Hex(common.InterfaceToStr(v["id"])),
 				Name:        common.InterfaceToStr(v["name"]),
-				DataType:    common.InterfaceToStr(v["data_type"]),
+				DataType:    fieldIllustrateMap[common.InterfaceToStr(v["data_type"])],
 				Format:      common.InterfaceToStr(v["format"]),
 				ClearStatus: common.InterfaceToStr(v["clear_status"]),
 			})
@@ -58,28 +69,18 @@ func (d *DataSmt) List(searchValue, dataType string, pageNum, pageSize int64) *p
 	count := db.Mysql_BaseService.CountBySql(countQuerySql)
 	result.PageCount = count
 	//热搜词处理
-	hotKeySql := fmt.Sprintf("select GROUP_CONCAT(keyword) as keyword from  %s   ORDER BY serial_number LIMIT 0,8", DATA_SUPERMARKET)
+	hotKeySql := fmt.Sprintf("select GROUP_CONCAT(keyword) as keyword from  %s  where  status=1   ORDER BY serial_number LIMIT 0,8", DATA_SUPERMARKET)
 	hotData := db.Mysql_BaseService.SelectBySql(hotKeySql)
 	if hotData != nil && len(*hotData) > 0 {
 		result.HotKeys = strings.Split(common.InterfaceToStr((*hotData)[0]["keyword"]), ",")
 	}
-	//包含字段说明
-	fieldIllustrate := []*pb.Field{}
-	for _, v := range config.C.DataSmt.FieldIllustrate {
-		fieldIllustrate = append(fieldIllustrate, &pb.Field{
-			Code:     v.Code,
-			Name:     v.Name,
-			Describe: v.Describe,
-		})
-	}
-	result.FieldIllustrate = fieldIllustrate
 	return &result
 }
 
 // 详情
 func (d *DataSmt) Detail(id string) *pb.DatasmtRespDetail {
 	result := &pb.DatasmtRespDetail{}
-	querySql := fmt.Sprintf("select  id,name,data_type,format,clear_status,data_example from   %s where id =%s", DATA_SUPERMARKET, id)
+	querySql := fmt.Sprintf("select  id,name,data_type,format,clear_status,data_example,introduce from   %s where id =%s", DATA_SUPERMARKET, id)
 	data := db.Mysql_BaseService.SelectBySql(querySql)
 	if data != nil && len(*data) > 0 {
 		//数据处理
@@ -91,6 +92,7 @@ func (d *DataSmt) Detail(id string) *pb.DatasmtRespDetail {
 			Format:      common.InterfaceToStr(v["format"]),
 			ClearStatus: common.InterfaceToStr(v["clear_status"]),
 			DataExample: common.InterfaceToStr(v["data_example"]),
+			Introduce:   common.InterfaceToStr(v["introduce"]),
 		}
 		for _, v := range config.C.DataSmt.FieldIllustrate {
 			if dataType == v.Code {