正在显示
3 个修改的文件
包含
28 行增加
和
14 行删除
@@ -12,7 +12,7 @@ func DomainFieldsToColumnSchemas(fields []*domain.Field) []domain.ColumnSchema { | @@ -12,7 +12,7 @@ func DomainFieldsToColumnSchemas(fields []*domain.Field) []domain.ColumnSchema { | ||
12 | if convertFiledSQLType(f.SQLType) { | 12 | if convertFiledSQLType(f.SQLType) { |
13 | res.ColumnType = domain.DECIMAL279.ToString() | 13 | res.ColumnType = domain.DECIMAL279.ToString() |
14 | } | 14 | } |
15 | - result = append(result) | 15 | + result = append(result, res) |
16 | } | 16 | } |
17 | return result | 17 | return result |
18 | } | 18 | } |
@@ -69,3 +69,15 @@ func convertFiledSQLType(sqlType string) bool { | @@ -69,3 +69,15 @@ func convertFiledSQLType(sqlType string) bool { | ||
69 | } | 69 | } |
70 | return false | 70 | return false |
71 | } | 71 | } |
72 | + | ||
73 | +func FieldsToColumnSchemas(fields []*domain.Field) []domain.ColumnSchema { | ||
74 | + result := make([]domain.ColumnSchema, 0) | ||
75 | + | ||
76 | + for _, f := range fields { | ||
77 | + result = append(result, domain.ColumnSchema{ | ||
78 | + ColumnName: f.Name, | ||
79 | + ColumnType: f.SQLType, | ||
80 | + }) | ||
81 | + } | ||
82 | + return result | ||
83 | +} |
@@ -96,18 +96,6 @@ type ResponseCheckoutTablesSave struct { | @@ -96,18 +96,6 @@ type ResponseCheckoutTablesSave struct { | ||
96 | CheckoutTableUrl string `json:"checkoutTableUrl"` | 96 | CheckoutTableUrl string `json:"checkoutTableUrl"` |
97 | } | 97 | } |
98 | 98 | ||
99 | -func FieldsToColumnSchemas(fields []*domain.Field) []domain.ColumnSchema { | ||
100 | - result := make([]domain.ColumnSchema, 0) | ||
101 | - | ||
102 | - for _, f := range fields { | ||
103 | - result = append(result, domain.ColumnSchema{ | ||
104 | - ColumnName: f.Name, | ||
105 | - ColumnType: f.SQLType, | ||
106 | - }) | ||
107 | - } | ||
108 | - return result | ||
109 | -} | ||
110 | - | ||
111 | func ToDataLoadDataTable(data DataCheckoutTables) *domain.DataLoadDataTable { | 99 | func ToDataLoadDataTable(data DataCheckoutTables) *domain.DataLoadDataTable { |
112 | response := &domain.DataLoadDataTable{ | 100 | response := &domain.DataLoadDataTable{ |
113 | PageNumber: data.PageNumber, | 101 | PageNumber: data.PageNumber, |
@@ -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()) |
-
请 注册 或 登录 后发表评论