|
@@ -140,7 +140,11 @@ func (c Condition) SetWhere(params QueryOptions, q *gorm.DB) { |
|
@@ -140,7 +140,11 @@ func (c Condition) SetWhere(params QueryOptions, q *gorm.DB) { |
|
140
|
q.Where(fmt.Sprintf("%v like '%%%v%%'", c.FormatIfNull(params, c.Field), c.Like))
|
140
|
q.Where(fmt.Sprintf("%v like '%%%v%%'", c.FormatIfNull(params, c.Field), c.Like))
|
|
141
|
}
|
141
|
}
|
|
142
|
if len(c.In) > 0 {
|
142
|
if len(c.In) > 0 {
|
|
143
|
- q.Where(fmt.Sprintf("%v in %v", c.CastType(c.FormatIfNull(params, c.Field), "string"), c.InArgs(c.In)))
|
143
|
+ if c.Field.SQLType == domain.Float.ToString() {
|
|
|
|
144
|
+ q.Where(fmt.Sprintf("%v in %v", c.CastType(c.Field.SQLName, domain.DECIMALV2.ToString()), c.InArgs(c.In)))
|
|
|
|
145
|
+ } else {
|
|
|
|
146
|
+ q.Where(fmt.Sprintf("%v in %v", c.CastType(c.FormatIfNull(params, c.Field), "string"), c.InArgs(c.In)))
|
|
|
|
147
|
+ }
|
|
144
|
}
|
148
|
}
|
|
145
|
if len(c.Ex) > 0 {
|
149
|
if len(c.Ex) > 0 {
|
|
146
|
in := c.InArgs(c.Ex)
|
150
|
in := c.InArgs(c.Ex)
|
|
@@ -201,6 +205,16 @@ func (c Condition) CastType(sql, t string) string { |
|
@@ -201,6 +205,16 @@ func (c Condition) CastType(sql, t string) string { |
|
201
|
return castType(sql, t)
|
205
|
return castType(sql, t)
|
|
202
|
}
|
206
|
}
|
|
203
|
|
207
|
|
|
|
|
208
|
+func (c Condition) CastTypeByField(f *domain.Field, t string) string {
|
|
|
|
209
|
+ if c.params.Table != nil && c.params.Table.TableType == domain.ObjectDBTable {
|
|
|
|
210
|
+ return f.SQLName
|
|
|
|
211
|
+ }
|
|
|
|
212
|
+ if f.SQLType == domain.Float.ToString() || f.SQLType == domain.DECIMAL279.ToString() {
|
|
|
|
213
|
+ return castTypeAlias(f.SQLName, domain.DECIMALV2.ToString())
|
|
|
|
214
|
+ }
|
|
|
|
215
|
+ return castType(f.SQLName, t)
|
|
|
|
216
|
+}
|
|
|
|
217
|
+
|
|
204
|
func formatFiled(f *domain.Field) string {
|
218
|
func formatFiled(f *domain.Field) string {
|
|
205
|
if f.SQLType == domain.Float.ToString() || f.SQLType == domain.DECIMAL279.ToString() {
|
219
|
if f.SQLType == domain.Float.ToString() || f.SQLType == domain.DECIMAL279.ToString() {
|
|
206
|
return castTypeAlias(f.SQLName, domain.DECIMALV2.ToString())
|
220
|
return castTypeAlias(f.SQLName, domain.DECIMALV2.ToString())
|