作者 yangfu

fix:check table row duplicate

... ... @@ -119,6 +119,14 @@ func NewFormulaSelectCondition(c domain.ConditionExpr) FormulaSelectCondition {
ConditionLeftField: NewFormulaField(c.FieldLeft, true),
ConditionRightField: NewFormulaField(c.FieldRight),
}
if c.OperatorSymbol == "=" && strings.ToLower(c.FieldRight.ExprSql) == "null" {
res.ConditionOperator = " is "
res.ConditionRightField.ConditionExpression = " null "
}
if c.OperatorSymbol == "!=" && strings.ToLower(c.FieldRight.ExprSql) == "null" {
res.ConditionOperator = "is not"
res.ConditionRightField.ConditionExpression = "null"
}
return res
}
... ...
... ... @@ -477,36 +477,6 @@ func (ptr *QuerySetService) CreateOrUpdateQuerySetTable(ctx *domain.Context, que
if err = ptr.validDependentCircle(ctx, querySet, queryComponents); err != nil {
return nil, err
}
//var validTables = make([]*domain.Table, 0)
//if len(dependencyTables) > 0 {
// _, tables, err := tableRepository.Find(map[string]interface{}{"context": ctx, "tableIds": dependencyTables})
// if err != nil {
// return nil, err
// }
// tableMap := make(map[int]*domain.Table)
// for i := range tables {
// tableMap[tables[i].TableId] = tables[i]
// }
// for _, c := range queryComponents {
// if t, ok := tableMap[c.MasterTable.TableId]; ok {
// c.MasterTable = domain.NewQueryComponentTable(t)
// }
// }
// for _, t := range validTables {
// if t.TableType == domain.SchemaTable.ToString() || t.TableType == domain.SubProcessTable.ToString() {
// validTables = append(validTables, t)
// }
// }
//}
//
//// 循环依赖判断
//tableDependencyService, _ := NewTableDependencyService(ptr.transactionContext)
//if len(validTables) > 0 {
// tree := tableDependencyService.TableDependTree(validTables, querySet.QuerySetInfo.BindTableId)
// if tableDependencyService.Detect(ctx, tree.EdgesArray()) {
// return nil, NewCircleDependError(tableDependencyService.CircleTable(), querySet)
// }
//}
table.TableInfo.ApplyOnModule = domain.ModuleAll
table.TableInfo.DependencyTables = dependencyTables
... ...
... ... @@ -45,7 +45,6 @@ func (ptr *AddTableStructService) AddTableStruct(ctx *domain.Context, parentTabl
table.DataFields = dataFields
table.ManualFields = manualFields
table.ParentId = parentTableId
//table.SQLName = mainTable.SQLName // 主表名跟分表名相同
reserves, deletes, adds := domain.FieldsChange(table.Fields(false), fields)
if err = domain.ValidFields(fields); err != nil {
... ...