作者 yangfu

P008还原

@@ -50,7 +50,9 @@ func (ptr *QuerySetService) Create(ctx *domain.Context, qs *domain.QuerySet) (*d @@ -50,7 +50,9 @@ func (ptr *QuerySetService) Create(ctx *domain.Context, qs *domain.QuerySet) (*d
50 UpdatedAt: time.Now(), 50 UpdatedAt: time.Now(),
51 Context: ctx, 51 Context: ctx,
52 } 52 }
53 - 53 + if qs.Flag == domain.FlagGroup {
  54 + newQuerySet.Status = domain.StatusOn
  55 + }
54 querySetRepository, err := repository.NewQuerySetRepository(ptr.transactionContext) 56 querySetRepository, err := repository.NewQuerySetRepository(ptr.transactionContext)
55 // check parent 57 // check parent
56 options := map[string]interface{}{ 58 options := map[string]interface{}{
@@ -437,33 +437,33 @@ func (d *DataLayoutDataTable) Shrink() error { @@ -437,33 +437,33 @@ func (d *DataLayoutDataTable) Shrink() error {
437 } 437 }
438 iData++ 438 iData++
439 } 439 }
440 - //d.DataTable.Data = data  
441 - //for i := 0; i <= y; i++ {  
442 - // d.DataTable.Fields = append(d.DataTable.Fields, &domain.Field{  
443 - // Name: fmt.Sprintf("列%d", i),  
444 - // SQLName: fmt.Sprintf("col%d", i),  
445 - // SQLType: domain.String.ToString(),  
446 - // })  
447 - //}  
448 - // 默认计算集第一行作为标题  
449 - if len(data) >= 1 {  
450 - d.DataTable.Data = data[1:]  
451 - columnMap := collection.NewSet()  
452 - for i := 0; i < len(data[0]); i++ {  
453 - //if len(data[0][i]) == 0 {  
454 - // return fmt.Errorf("计算集标题第%d列不能为空", i+1)  
455 - //}  
456 - //if columnMap.Contains(data[0][i]) {  
457 - // return fmt.Errorf("计算集第%d列重复:%v", i+1, data[0][i])  
458 - //}  
459 - columnMap.Add(data[0][i]) 440 + d.DataTable.Data = data
  441 + for i := 0; i <= y; i++ {
460 d.DataTable.Fields = append(d.DataTable.Fields, &domain.Field{ 442 d.DataTable.Fields = append(d.DataTable.Fields, &domain.Field{
461 - Name: data[0][i], 443 + Name: fmt.Sprintf("列%d", i),
462 SQLName: fmt.Sprintf("col%d", i), 444 SQLName: fmt.Sprintf("col%d", i),
463 SQLType: domain.String.ToString(), 445 SQLType: domain.String.ToString(),
464 }) 446 })
465 } 447 }
466 - } 448 + // 默认计算集第一行作为标题
  449 + //if len(data) >= 1 {
  450 + // d.DataTable.Data = data[1:]
  451 + // columnMap := collection.NewSet()
  452 + // for i := 0; i < len(data[0]); i++ {
  453 + // if len(data[0][i]) == 0 {
  454 + // return fmt.Errorf("计算集标题第%d列不能为空", i+1)
  455 + // }
  456 + // if columnMap.Contains(data[0][i]) {
  457 + // return fmt.Errorf("计算集第%d列重复:%v", i+1, data[0][i])
  458 + // }
  459 + // columnMap.Add(data[0][i])
  460 + // d.DataTable.Fields = append(d.DataTable.Fields, &domain.Field{
  461 + // Name: data[0][i],
  462 + // SQLName: fmt.Sprintf("col%d", i),
  463 + // SQLType: domain.String.ToString(),
  464 + // })
  465 + // }
  466 + //}
467 return nil 467 return nil
468 } 468 }
469 469