Răsfoiți Sursa

change gorm

Roc 2 luni în urmă
părinte
comite
460bd375ce

+ 1 - 1
models/data_manage/line_feature/line_feature.go

@@ -111,7 +111,7 @@ func EditLineFeatureChartAndMapping(req *data_manage.EditChartInfoReq, edbInfoId
 	sql += `WHERE chart_info_id = ?`
 
 	pars = append(pars, req.ChartInfoId)
-	err = to.Exec(sql, pars).Error
+	err = to.Exec(sql, pars...).Error
 	if err != nil {
 		fmt.Println("UPDATE  chart_info Err:", err.Error())
 		return err

+ 2 - 2
models/data_manage/supply_analysis/variety.go

@@ -145,7 +145,7 @@ func (item Variety) GetListBySuperAdminPage(condition string, pars []interface{}
 	// 数据总数
 	totalSql := `SELECT COUNT(1) total ` + baseSql
 	var totalNull sql.NullInt64
-	err = global.DbMap[utils.DbNameIndex].Raw(totalSql, pars).Scan(&totalNull).Error
+	err = global.DbMap[utils.DbNameIndex].Raw(totalSql, pars...).Scan(&totalNull).Error
 	if err != nil {
 		return
 	}
@@ -174,7 +174,7 @@ func (item Variety) GetListByPage(condition string, pars []interface{}, startSiz
 	// 数据总数
 	totalSql := `SELECT COUNT(1) total ` + baseSql
 	var totalNull sql.NullInt64
-	err = global.DbMap[utils.DbNameIndex].Raw(totalSql, pars).Scan(&totalNull).Error
+	err = global.DbMap[utils.DbNameIndex].Raw(totalSql, pars...).Scan(&totalNull).Error
 	if err != nil {
 		return
 	}

+ 1 - 1
models/data_manage/trade_analysis/trade_analysis_table_column.go

@@ -119,7 +119,7 @@ func (m *TradeAnalysisTableColumn) GetItemByCondition(condition string, pars []i
 func (m *TradeAnalysisTableColumn) GetCountByCondition(condition string, pars []interface{}) (count int, err error) {
 	sqlQuery := fmt.Sprintf(`SELECT COUNT(1) FROM %s WHERE 1=1 %s`, m.TableName(), condition)
 	var totalNull sql.NullInt64
-	err = global.DbMap[utils.DbNameIndex].Raw(sqlQuery, pars).Scan(&totalNull).Error
+	err = global.DbMap[utils.DbNameIndex].Raw(sqlQuery, pars...).Scan(&totalNull).Error
 	if !totalNull.Valid {
 		count = 0
 	} else {

+ 1 - 1
models/data_manage/trade_analysis/warehouse_process_classify.go

@@ -106,7 +106,7 @@ func (m *WareHouseProcessClassify) RemoveByCondition(condition string, pars []in
 		return
 	}
 	sql := fmt.Sprintf(`DELETE FROM %s WHERE %s`, m.TableName(), condition)
-	err = global.DbMap[utils.DbNameIndex].Exec(sql, pars).Error
+	err = global.DbMap[utils.DbNameIndex].Exec(sql, pars...).Error
 	return
 }
 

+ 2 - 2
models/data_source/base_from_sci99.go

@@ -101,14 +101,14 @@ func GetBaseFromSci99Classify() (list []*BaseFromSci99Classify, err error) {
 	return
 }
 
-func GetSci99Index(condition string, pars interface{}) (items []*BaseFromSci99IndexList, err error) {
+func GetSci99Index(condition string, pars []interface{}) (items []*BaseFromSci99IndexList, err error) {
 	o := global.DbMap[utils.DbNameIndex]
 	sql := ` SELECT * FROM base_from_sci99_index WHERE 1=1  `
 	if condition != "" {
 		sql += condition
 	}
 	sql += `ORDER BY base_from_sci_index_id ASC `
-	err = o.Raw(sql, pars).Find(&items).Error
+	err = o.Raw(sql, pars...).Find(&items).Error
 	return
 }
 

+ 2 - 2
models/data_source/icpi.go

@@ -72,14 +72,14 @@ type BaseFromIcpiIndexView struct {
 	Paging                 *paging.PagingItem      `description:"分页数据" gorm:"-"`
 }
 
-func (obj *BaseFromIcpiIndex) GetIcpiIndex(condition string, pars interface{}) (items []*BaseFromIcpiIndexView, err error) {
+func (obj *BaseFromIcpiIndex) GetIcpiIndex(condition string, pars []interface{}) (items []*BaseFromIcpiIndexView, err error) {
 	o := global.DbMap[utils.DbNameIndex]
 	sql := ` SELECT * FROM base_from_icpi_index WHERE 1=1  `
 	if condition != "" {
 		sql += condition
 	}
 	sql += `ORDER BY base_from_icpi_index_id ASC `
-	err = o.Raw(sql, pars).Find(&items).Error
+	err = o.Raw(sql, pars...).Find(&items).Error
 	return
 }
 

+ 1 - 1
models/en_classify_permission.go

@@ -102,7 +102,7 @@ func (m *EnClassifyPermission) GetPageItemsByCondition(startSize, pageSize int,
 
 	totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z`
 	var totalNull sql2.NullInt64
-	err = global.DbMap[utils.DbNameReport].Raw(totalSql, pars).Scan(&totalNull).Error
+	err = global.DbMap[utils.DbNameReport].Raw(totalSql, pars...).Scan(&totalNull).Error
 	if err != nil {
 		return
 	}