...
|
...
|
@@ -140,7 +140,11 @@ func (c Condition) SetWhere(params QueryOptions, q *gorm.DB) { |
|
|
q.Where(fmt.Sprintf("%v like '%%%v%%'", c.FormatIfNull(params, c.Field), c.Like))
|
|
|
}
|
|
|
if len(c.In) > 0 {
|
|
|
q.Where(fmt.Sprintf("%v in %v", c.CastType(c.FormatIfNull(params, c.Field), "string"), c.InArgs(c.In)))
|
|
|
if c.Field.SQLType == domain.Float.ToString() {
|
|
|
q.Where(fmt.Sprintf("%v in %v", c.CastType(c.Field.SQLName, domain.DECIMALV2.ToString()), c.InArgs(c.In)))
|
|
|
} else {
|
|
|
q.Where(fmt.Sprintf("%v in %v", c.CastType(c.FormatIfNull(params, c.Field), "string"), c.InArgs(c.In)))
|
|
|
}
|
|
|
}
|
|
|
if len(c.Ex) > 0 {
|
|
|
in := c.InArgs(c.Ex)
|
...
|
...
|
@@ -201,6 +205,16 @@ func (c Condition) CastType(sql, t string) string { |
|
|
return castType(sql, t)
|
|
|
}
|
|
|
|
|
|
func (c Condition) CastTypeByField(f *domain.Field, t string) string {
|
|
|
if c.params.Table != nil && c.params.Table.TableType == domain.ObjectDBTable {
|
|
|
return f.SQLName
|
|
|
}
|
|
|
if f.SQLType == domain.Float.ToString() || f.SQLType == domain.DECIMAL279.ToString() {
|
|
|
return castTypeAlias(f.SQLName, domain.DECIMALV2.ToString())
|
|
|
}
|
|
|
return castType(f.SQLName, t)
|
|
|
}
|
|
|
|
|
|
func formatFiled(f *domain.Field) string {
|
|
|
if f.SQLType == domain.Float.ToString() || f.SQLType == domain.DECIMAL279.ToString() {
|
|
|
return castTypeAlias(f.SQLName, domain.DECIMALV2.ToString())
|
...
|
...
|
|