zqbao il y a 7 mois
Parent
commit
05785e6195

+ 2 - 1
models/chart.go

@@ -324,7 +324,8 @@ func getEdbDataListByMysql(source, subSource, edbInfoId int, startDate, endDate
 	sql += ` ORDER BY data_time ASC  `
 	sql = fmt.Sprintf(sql, tableName)
 	o := global.DmSQL["data"]
-	err = o.Raw(sql, edbInfoId, pars).Scan(&list).Error
+	pars = append([]interface{}{edbInfoId}, pars...)
+	err = o.Raw(sql, pars...).Scan(&list).Error
 	return
 }
 

+ 2 - 2
models/data_manage/chart_info_correlation.go

@@ -85,7 +85,7 @@ func (m *ChartInfoCorrelation) GetItemById(id int) (err error) {
 func (m *ChartInfoCorrelation) GetItemByCondition(condition string, pars []interface{}) (err error) {
 	o := global.DmSQL["data"]
 	sql := fmt.Sprintf(`SELECT * FROM %s WHERE 1=1 %s `, m.TableName(), condition)
-	err = o.Raw(sql, pars).First(&m).Error
+	err = o.Raw(sql, pars...).First(&m).Error
 	return
 }
 
@@ -100,7 +100,7 @@ func (m *ChartInfoCorrelation) GetItemsByCondition(condition string, pars []inte
 		order = ` ORDER BY ` + orderRule
 	}
 	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s`, fields, m.TableName(), condition, order)
-	err = o.Raw(sql, pars).Scan(&items).Error
+	err = o.Raw(sql, pars...).Scan(&items).Error
 	return
 }
 

+ 2 - 2
models/data_manage/edb_source.go

@@ -52,7 +52,7 @@ func GetEdbSourceItemsByCondition(condition string, pars []interface{}, fieldArr
 		order = ` ORDER BY ` + orderRule
 	}
 	sql := fmt.Sprintf(`SELECT %s FROM edb_source WHERE 1=1 %s %s`, fields, condition, order)
-	err = o.Raw(sql, pars).Scan(&items).Error
+	err = o.Raw(sql, pars...).Scan(&items).Error
 	return
 }
 
@@ -93,7 +93,7 @@ type EdbSourceChild struct {
 func GetEdbSourceItemByCondition(condition string, pars []interface{}) (item *EdbSource, err error) {
 	o := global.DmSQL["data"]
 	sql := fmt.Sprintf(`SELECT * FROM edb_source WHERE 1=1 %s`, condition)
-	err = o.Raw(sql, pars).First(&item).Error
+	err = o.Raw(sql, pars...).First(&item).Error
 	return
 }
 

+ 2 - 2
models/data_manage/excel/excel_classify.go

@@ -257,7 +257,7 @@ func GetExcelClassifyByCondition(condition string, pars []interface{}) (item *Ex
 	if condition != "" {
 		sql += condition
 	}
-	err = o.Raw(sql, pars).First(&item).Error
+	err = o.Raw(sql, pars...).First(&item).Error
 	return
 }
 
@@ -280,7 +280,7 @@ func GetNextExcelClassifyByCondition(condition string, pars []interface{}) (item
 		sql += condition
 	}
 	sql += " ORDER BY sort asc , create_time ASC LIMIT 1 "
-	err = o.Raw(sql, pars).First(&item).Error
+	err = o.Raw(sql, pars...).First(&item).Error
 	return
 }
 

+ 1 - 1
models/data_manage/excel/excel_edb_mapping.go

@@ -191,7 +191,7 @@ func GetExcelEdbMappingItemByExcelInfoIdOrKeyword(excelInfoId int, keyword strin
 			%s
 		ORDER BY
 			b.excel_edb_mapping_id ASC`, cond)
-	err = o.Raw(sql, pars).Scan(&items).Error
+	err = o.Raw(sql, pars...).Scan(&items).Error
 	return
 }
 

+ 5 - 4
models/data_manage/excel/excel_info.go

@@ -229,7 +229,7 @@ func GetExcelInfoCountByCondition(condition string, pars []interface{}) (count i
 	if condition != "" {
 		sql += condition
 	}
-	err = o.Raw(sql, pars).Scan(&count).Error
+	err = o.Raw(sql, pars...).Scan(&count).Error
 	return
 }
 
@@ -242,7 +242,8 @@ func GetNoContentExcelInfoListByCondition(condition string, pars []interface{},
 	}
 
 	sql += ` AND is_delete=0 ORDER BY excel_info_id DESC LIMIT ?,? `
-	err = o.Raw(sql, pars, startSize, pageSize).Scan(&items).Error
+	pars = append(pars, startSize, pageSize)
+	err = o.Raw(sql, pars...).Scan(&items).Error
 	return
 }
 
@@ -252,7 +253,7 @@ func GetExcelInfoByCondition(condition string, pars []interface{}) (item *ExcelI
 	if condition != "" {
 		sql += condition
 	}
-	err = o.Raw(sql, pars).First(&item).Error
+	err = o.Raw(sql, pars...).First(&item).Error
 	return
 }
 
@@ -264,7 +265,7 @@ func GetNextExcelInfoByCondition(condition string, pars []interface{}) (item *Ex
 		sql += condition
 	}
 	sql += " ORDER BY sort asc , create_time desc LIMIT 1 "
-	err = o.Raw(sql, pars).First(&item).Error
+	err = o.Raw(sql, pars...).First(&item).Error
 	return
 }
 

+ 6 - 5
models/data_manage/factor_edb_series.go

@@ -117,14 +117,14 @@ func (m *FactorEdbSeries) GetItemByCondition(condition string, pars []interface{
 		order = ` ORDER BY ` + orderRule
 	}
 	sql := fmt.Sprintf(`SELECT * FROM %s WHERE 1=1 %s %s LIMIT 1`, m.TableName(), condition, order)
-	err = o.Raw(sql, pars).First(&item).Error
+	err = o.Raw(sql, pars...).First(&item).Error
 	return
 }
 
 func (m *FactorEdbSeries) GetCountByCondition(condition string, pars []interface{}) (count int, err error) {
 	o := global.DmSQL["data"]
 	sql := fmt.Sprintf(`SELECT COUNT(1) FROM %s WHERE 1=1 %s`, m.TableName(), condition)
-	err = o.Raw(sql, pars).Scan(&count).Error
+	err = o.Raw(sql, pars...).Scan(&count).Error
 	return
 }
 
@@ -139,7 +139,7 @@ func (m *FactorEdbSeries) GetItemsByCondition(condition string, pars []interface
 		order = ` ORDER BY ` + orderRule
 	}
 	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s`, fields, m.TableName(), condition, order)
-	err = o.Raw(sql, pars).Scan(&items).Error
+	err = o.Raw(sql, pars...).Scan(&items).Error
 	return
 }
 
@@ -154,7 +154,8 @@ func (m *FactorEdbSeries) GetPageItemsByCondition(condition string, pars []inter
 		order = ` ORDER BY ` + orderRule
 	}
 	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s LIMIT ?,?`, fields, m.TableName(), condition, order)
-	err = o.Raw(sql, pars, startSize, pageSize).Scan(&items).Error
+	pars = append(pars, startSize, pageSize)
+	err = o.Raw(sql, pars...).Scan(&items).Error
 	return
 }
 
@@ -363,7 +364,7 @@ func (m *FactorEdbSeries) EditSeriesAndMapping(item *FactorEdbSeries, mappings [
 	pars := make([]interface{}, 0)
 	pars = append(pars, item.FactorEdbSeriesId)
 	sql := fmt.Sprintf(`DELETE FROM %s WHERE %s`, mappingOb.TableName(), cond)
-	_, e = tx.Raw(sql, pars).Exec()
+	_, e = tx.Raw(sql, pars...).Exec()
 	if e != nil {
 		err = fmt.Errorf("remove mapping err: %v", e)
 		return

+ 5 - 4
models/data_manage/factor_edb_series_chart_mapping.go

@@ -127,14 +127,14 @@ func (m *FactorEdbSeriesChartMapping) GetItemByCondition(condition string, pars
 		order = ` ORDER BY ` + orderRule
 	}
 	sql := fmt.Sprintf(`SELECT * FROM %s WHERE 1=1 %s %s LIMIT 1`, m.TableName(), condition, order)
-	err = o.Raw(sql, pars).First(&item).Error
+	err = o.Raw(sql, pars...).First(&item).Error
 	return
 }
 
 func (m *FactorEdbSeriesChartMapping) GetCountByCondition(condition string, pars []interface{}) (count int, err error) {
 	o := global.DmSQL["data"]
 	sql := fmt.Sprintf(`SELECT COUNT(1) FROM %s WHERE 1=1 %s`, m.TableName(), condition)
-	err = o.Raw(sql, pars).Scan(&count).Error
+	err = o.Raw(sql, pars...).Scan(&count).Error
 	return
 }
 
@@ -149,7 +149,7 @@ func (m *FactorEdbSeriesChartMapping) GetItemsByCondition(condition string, pars
 		order = ` ORDER BY ` + orderRule
 	}
 	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s`, fields, m.TableName(), condition, order)
-	err = o.Raw(sql, pars).Scan(&items).Error
+	err = o.Raw(sql, pars...).Scan(&items).Error
 	return
 }
 
@@ -164,7 +164,8 @@ func (m *FactorEdbSeriesChartMapping) GetPageItemsByCondition(condition string,
 		order = ` ORDER BY ` + orderRule
 	}
 	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s LIMIT ?,?`, fields, m.TableName(), condition, order)
-	err = o.Raw(sql, pars, startSize, pageSize).Scan(&items).Error
+	pars = append(pars, startSize, pageSize)
+	err = o.Raw(sql, pars...).Scan(&items).Error
 	return
 }
 

+ 6 - 5
models/data_manage/factor_edb_series_mapping.go

@@ -96,7 +96,7 @@ func (m *FactorEdbSeriesMapping) RemoveByCondition(condition string, pars []inte
 	}
 	o := global.DmSQL["data"]
 	sql := fmt.Sprintf(`DELETE FROM %s WHERE %s`, m.TableName(), condition)
-	err = o.Exec(sql, pars).Error
+	err = o.Exec(sql, pars...).Error
 	return
 }
 
@@ -114,14 +114,14 @@ func (m *FactorEdbSeriesMapping) GetItemByCondition(condition string, pars []int
 		order = ` ORDER BY ` + orderRule
 	}
 	sql := fmt.Sprintf(`SELECT * FROM %s WHERE 1=1 %s %s LIMIT 1`, m.TableName(), condition, order)
-	err = o.Raw(sql, pars).First(&item).Error
+	err = o.Raw(sql, pars...).First(&item).Error
 	return
 }
 
 func (m *FactorEdbSeriesMapping) GetCountByCondition(condition string, pars []interface{}) (count int, err error) {
 	o := global.DmSQL["data"]
 	sql := fmt.Sprintf(`SELECT COUNT(1) FROM %s WHERE 1=1 %s`, m.TableName(), condition)
-	err = o.Raw(sql, pars).Scan(&count).Error
+	err = o.Raw(sql, pars...).Scan(&count).Error
 	return
 }
 
@@ -136,7 +136,7 @@ func (m *FactorEdbSeriesMapping) GetItemsByCondition(condition string, pars []in
 		order = ` ORDER BY ` + orderRule
 	}
 	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s`, fields, m.TableName(), condition, order)
-	err = o.Raw(sql, pars).Scan(&items).Error
+	err = o.Raw(sql, pars...).Scan(&items).Error
 	return
 }
 
@@ -151,7 +151,8 @@ func (m *FactorEdbSeriesMapping) GetPageItemsByCondition(condition string, pars
 		order = ` ORDER BY ` + orderRule
 	}
 	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s LIMIT ?,?`, fields, m.TableName(), condition, order)
-	err = o.Raw(sql, pars, startSize, pageSize).Scan(&items).Error
+	pars = append(pars, startSize, pageSize)
+	err = o.Raw(sql, pars...).Scan(&items).Error
 	return
 }
 

+ 2 - 2
models/data_manage/future_good/chart_info_future_good_profit.go

@@ -76,7 +76,7 @@ func (m *ChartInfoFutureGoodProfit) GetItemById(id int) (err error) {
 func (m *ChartInfoFutureGoodProfit) GetItemByCondition(condition string, pars []interface{}) (err error) {
 	o := global.DmSQL["data"]
 	sql := fmt.Sprintf(`SELECT * FROM %s WHERE 1=1 %s `, m.TableName(), condition)
-	err = o.Raw(sql, pars).First(&m).Error
+	err = o.Raw(sql, pars...).First(&m).Error
 	return
 }
 
@@ -91,7 +91,7 @@ func (m *ChartInfoFutureGoodProfit) GetItemsByCondition(condition string, pars [
 		order = ` ORDER BY ` + orderRule
 	}
 	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s`, fields, m.TableName(), condition, order)
-	err = o.Raw(sql, pars).Scan(&items).Error
+	err = o.Raw(sql, pars...).Scan(&items).Error
 	return
 }
 

+ 2 - 2
models/data_manage/future_good/future_good_chart_classify.go

@@ -142,7 +142,7 @@ func GetFutureGoodChartClassifyByCondition(condition string, pars []interface{})
 	if condition != "" {
 		sql += condition
 	}
-	err = o.Raw(sql, pars).First(&item).Error
+	err = o.Raw(sql, pars...).First(&item).Error
 	return
 }
 
@@ -154,7 +154,7 @@ func GetNextFutureGoodChartClassifyByCondition(condition string, pars []interfac
 		sql += condition
 	}
 	sql += " ORDER BY sort asc , create_time ASC LIMIT 1 "
-	err = o.Raw(sql, pars).First(&item).Error
+	err = o.Raw(sql, pars...).First(&item).Error
 	return
 }
 

+ 2 - 2
models/data_manage/future_good/future_good_edb_info.go

@@ -79,7 +79,7 @@ func GetFutureGoodEdbInfoList(condition string, pars []interface{}) (list []*Fut
 		sql += condition
 	}
 	sql += `ORDER BY future_good_edb_info_id DESC `
-	err = o.Raw(sql, pars).Scan(&list).Error
+	err = o.Raw(sql, pars...).Scan(&list).Error
 	return
 }
 
@@ -192,7 +192,7 @@ func GetFutureGoodEdbInfoGroupList(condition string, pars []interface{}) (list [
 		sql += condition
 	}
 	sql += ` ORDER BY future_good_edb_info_id DESC `
-	err = o.Raw(sql, pars).Scan(&list).Error
+	err = o.Raw(sql, pars...).Scan(&list).Error
 	return
 }
 

+ 7 - 4
models/data_manage/future_good/future_good_edb_info_data.go

@@ -105,7 +105,7 @@ func GetFutureGoodEdbDataListCount(condition string, pars []interface{}) (count
 	if condition != "" {
 		sql += condition
 	}
-	err = o.Raw(sql, pars).Scan(&count).Error
+	err = o.Raw(sql, pars...).Scan(&count).Error
 	return
 }
 
@@ -117,7 +117,8 @@ func GetFutureGoodEdbDataList(condition string, pars []interface{}, startSize, p
 		sql += condition
 	}
 	sql += `ORDER BY modify_time DESC LIMIT ?,?`
-	err = o.Raw(sql, pars, startSize, pageSize).Scan(&list).Error
+	pars = append(pars, startSize, pageSize)
+	err = o.Raw(sql, pars...).Scan(&list).Error
 	return
 }
 
@@ -166,7 +167,8 @@ func GetFutureGoodEdbDataListByDate(futureGoodEdbInfoId int, startDate, endDate
 
 	sql += ` ORDER BY data_time ASC `
 	o := global.DmSQL["data"]
-	err = o.Raw(sql, futureGoodEdbInfoId, pars).Scan(&list).Error
+	pars = append([]interface{}{futureGoodEdbInfoId}, pars...)
+	err = o.Raw(sql, pars...).Scan(&list).Error
 	return
 }
 
@@ -184,7 +186,8 @@ func GetFutureGoodEdbDataListByIdsAndDate(futureGoodEdbInfoIds []int, startDate,
 
 	sql += ` ORDER BY data_time ASC `
 	o := global.DmSQL["data"]
-	err = o.Raw(sql, futureGoodEdbInfoIds, pars).Scan(&list).Error
+	pars = append([]interface{}{futureGoodEdbInfoIds}, pars...)
+	err = o.Raw(sql, pars...).Scan(&list).Error
 	return
 }
 

+ 2 - 1
models/data_manage/predict_edb_rule_data.go

@@ -42,7 +42,8 @@ func GetPredictEdbRuleDataList(edbInfoId, configId int, startDate, endDate strin
 		pars = append(pars, endDate)
 	}
 	sql += ` ORDER BY data_time ASC `
-	err = o.Raw(sql, edbInfoId, configId, pars).Scan(&list).Error
+	pars = append([]interface{}{edbInfoId, configId}, pars...)
+	err = o.Raw(sql, pars...).Scan(&list).Error
 	return
 }
 

+ 8 - 6
models/excel_info.go

@@ -127,7 +127,7 @@ func GetExcelInfoCountByCondition(condition string, pars []interface{}) (count i
 	if condition != "" {
 		sql += condition
 	}
-	err = o.Raw(sql, pars).Scan(&count).Error
+	err = o.Raw(sql, pars...).Scan(&count).Error
 	return
 }
 
@@ -137,7 +137,7 @@ func GetExcelInfoByCondition(condition string, pars []interface{}) (item *ExcelI
 	if condition != "" {
 		sql += condition
 	}
-	err = o.Raw(sql, pars).First(&item).Error
+	err = o.Raw(sql, pars...).First(&item).Error
 	return
 }
 
@@ -369,7 +369,8 @@ func GetExcelListByCondition(condition string, pars []interface{}, startSize, pa
 	}
 	//sql += " ORDER BY sort ASC,chart_info_id DESC LIMIT ?,? "
 	sql += " ORDER BY create_time DESC LIMIT ?,? "
-	err = o.Raw(sql, pars, startSize, pageSize).Scan(&item).Error
+	pars = append(pars, startSize, pageSize)
+	err = o.Raw(sql, pars...).Scan(&item).Error
 	return
 }
 
@@ -383,7 +384,8 @@ FROM excel_info WHERE 1=1 AND is_delete=0 `
 	}
 	//sql += " ORDER BY sort ASC,chart_info_id DESC LIMIT ?,? "
 	sql += " ORDER BY create_time DESC LIMIT ?,? "
-	err = o.Raw(sql, pars, startSize, pageSize).Scan(&item).Error
+	pars = append(pars, startSize, pageSize)
+	err = o.Raw(sql, pars...).Scan(&item).Error
 	return
 }
 
@@ -393,7 +395,7 @@ func GetExcelListCountByCondition(condition string, pars []interface{}) (count i
 	if condition != "" {
 		sql += condition
 	}
-	err = o.Raw(sql, pars).Scan(&count).Error
+	err = o.Raw(sql, pars...).Scan(&count).Error
 	return
 }
 
@@ -420,7 +422,7 @@ func GetExcelInfoListByCondition(condition string, pars []interface{}) (items []
 		sql += condition
 	}
 	sql += ` ORDER BY sort asc, excel_info_id asc`
-	err = o.Raw(sql, pars).Scan(&items).Error
+	err = o.Raw(sql, pars...).Scan(&items).Error
 	return
 }
 

+ 7 - 6
models/factor_edb_series_calculate_data_qjjs.go

@@ -107,7 +107,7 @@ func (m *FactorEdbSeriesCalculateDataQjjs) RemoveByCondition(condition string, p
 	}
 	o := global.DmSQL["data"]
 	sql := fmt.Sprintf(`DELETE FROM %s WHERE %s`, m.TableName(), condition)
-	err = o.Exec(sql, pars).Error
+	err = o.Exec(sql, pars...).Error
 	return
 }
 
@@ -125,14 +125,14 @@ func (m *FactorEdbSeriesCalculateDataQjjs) GetItemByCondition(condition string,
 		order = ` ORDER BY ` + orderRule
 	}
 	sql := fmt.Sprintf(`SELECT * FROM %s WHERE 1=1 %s %s LIMIT 1`, m.TableName(), condition, order)
-	err = o.Raw(sql, pars).First(&item).Error
+	err = o.Raw(sql, pars...).First(&item).Error
 	return
 }
 
 func (m *FactorEdbSeriesCalculateDataQjjs) GetCountByCondition(condition string, pars []interface{}) (count int, err error) {
 	o := global.DmSQL["data"]
 	sql := fmt.Sprintf(`SELECT COUNT(1) FROM %s WHERE 1=1 %s`, m.TableName(), condition)
-	err = o.Raw(sql, pars).Scan(&count).Error
+	err = o.Raw(sql, pars...).Scan(&count).Error
 	return
 }
 
@@ -147,7 +147,7 @@ func (m *FactorEdbSeriesCalculateDataQjjs) GetItemsByCondition(condition string,
 		order = ` ORDER BY ` + orderRule
 	}
 	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s`, fields, m.TableName(), condition, order)
-	err = o.Raw(sql, pars).Scan(&items).Error
+	err = o.Raw(sql, pars...).Scan(&items).Error
 	return
 }
 
@@ -162,7 +162,8 @@ func (m *FactorEdbSeriesCalculateDataQjjs) GetPageItemsByCondition(condition str
 		order = ` ORDER BY ` + orderRule
 	}
 	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s LIMIT ?,?`, fields, m.TableName(), condition, order)
-	err = o.Raw(sql, pars, startSize, pageSize).Scan(&items).Error
+	pars = append(pars, startSize, pageSize)
+	err = o.Raw(sql, pars...).Scan(&items).Error
 	return
 }
 
@@ -317,7 +318,7 @@ func (m *FactorEdbSeriesCalculateDataQjjs) GetEdbDataList(seriesId int, edbInfoI
 	sql += ` ORDER BY data_time ASC `
 	sql = fmt.Sprintf(sql, m.TableName())
 	o := global.DmSQL["data"]
-	err = o.Raw(sql, pars).Scan(&list).Error
+	err = o.Raw(sql, pars...).Scan(&list).Error
 	return
 }