...
|
...
|
@@ -97,6 +97,42 @@ func (tableService *TableService) RowEditV2(ctx *domain.Context, cmd *command.Ro |
|
|
return struct{}{}, nil
|
|
|
}
|
|
|
|
|
|
func (tableService *TableService) RowsDelete(ctx *domain.Context, cmd *command.RowsDeleteCommand) (interface{}, error) {
|
|
|
if err := cmd.ValidateCommand(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
}
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
//if err := transactionContext.StartTransaction(); err != nil {
|
|
|
// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
//}
|
|
|
//defer func() {
|
|
|
// transactionContext.RollbackTransaction()
|
|
|
//}()
|
|
|
|
|
|
var table *domain.Table
|
|
|
_, table, err = factory.FastPgTable(transactionContext, cmd.TableId)
|
|
|
if err != nil {
|
|
|
return nil, factory.FastError(err)
|
|
|
}
|
|
|
|
|
|
var options = starrocks.QueryOptions{
|
|
|
TableName: table.SQLName,
|
|
|
Select: []*domain.Field{domain.PK()}, //table.Fields(true),
|
|
|
Where: []starrocks.Condition{},
|
|
|
}
|
|
|
options.SetCondition(cmd.Where.Conditions)
|
|
|
total, err := starrocks.WrapDeleteFuncWithDB(starrocks.DB)(options)
|
|
|
//if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
//}
|
|
|
return map[string]interface{}{
|
|
|
"rowsAffected": total,
|
|
|
}, nil
|
|
|
}
|
|
|
|
|
|
func MapArrayToFieldValues(list []map[string]string, table *domain.Table, dataTable *domain.DataTable, mustMatch bool) []*domain.FieldValues {
|
|
|
var result = make([]*domain.FieldValues, 0)
|
|
|
history := dto.ToFieldDataByPK(table, dataTable)
|
...
|
...
|
|