|
@@ -61,7 +61,7 @@ func (m *EnglishReport) GetItemById(id int) (item *EnglishReport, err error) {
|
|
func (m *EnglishReport) GetCountByCondition(condition string, pars []interface{}) (count int, err error) {
|
|
func (m *EnglishReport) GetCountByCondition(condition string, pars []interface{}) (count int, err error) {
|
|
//o := orm.NewOrmUsingDB("rddp")
|
|
//o := orm.NewOrmUsingDB("rddp")
|
|
sql := fmt.Sprintf(`SELECT COUNT(1) FROM english_report WHERE 1=1 %s`, condition)
|
|
sql := fmt.Sprintf(`SELECT COUNT(1) FROM english_report WHERE 1=1 %s`, condition)
|
|
- err = global.DbMap[utils.MYSQL_URL_RDDP].Raw(sql, pars).Scan(&count).Error
|
|
|
|
|
|
+ err = global.DbMap[utils.MYSQL_URL_RDDP].Raw(sql, pars...).Scan(&count).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -76,7 +76,7 @@ func (m *EnglishReport) GetItemsByCondition(condition string, pars []interface{}
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT %s FROM english_report WHERE 1=1 %s %s`, fields, condition, order)
|
|
sql := fmt.Sprintf(`SELECT %s FROM english_report WHERE 1=1 %s %s`, fields, condition, order)
|
|
- err = global.DbMap[utils.MYSQL_URL_RDDP].Raw(sql, pars).Find(&items).Error
|
|
|
|
|
|
+ err = global.DbMap[utils.MYSQL_URL_RDDP].Raw(sql, pars...).Find(&items).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -91,7 +91,10 @@ func (m *EnglishReport) GetPageItemsByCondition(condition string, pars []interfa
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT %s FROM english_report WHERE 1=1 %s %s LIMIT ?,?`, fields, condition, order)
|
|
sql := fmt.Sprintf(`SELECT %s FROM english_report WHERE 1=1 %s %s LIMIT ?,?`, fields, condition, order)
|
|
- err = global.DbMap[utils.MYSQL_URL_RDDP].Raw(sql, pars, startSize, pageSize).Find(&items).Error
|
|
|
|
|
|
+
|
|
|
|
+ pars = append(pars, startSize, pageSize)
|
|
|
|
+ err = global.DbMap[utils.MYSQL_URL_RDDP].Raw(sql, pars...).Find(&items).Error
|
|
|
|
+
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -265,7 +268,7 @@ FROM
|
|
WHERE a.parent_id>0 and a.classify_name LIKE ? and a.root_id IN (` + utils.GetOrmInReplace(len(rootIds)) + `)`
|
|
WHERE a.parent_id>0 and a.classify_name LIKE ? and a.root_id IN (` + utils.GetOrmInReplace(len(rootIds)) + `)`
|
|
pars = append(pars, utils.GetLikeKeyword(keyword))
|
|
pars = append(pars, utils.GetLikeKeyword(keyword))
|
|
pars = append(pars, rootIds)
|
|
pars = append(pars, rootIds)
|
|
- err = global.DbMap[utils.MYSQL_URL_RDDP].Raw(sql, pars).Find(&items).Error
|
|
|
|
|
|
+ err = global.DbMap[utils.MYSQL_URL_RDDP].Raw(sql, pars...).Find(&items).Error
|
|
} else {
|
|
} else {
|
|
sql = `SELECT * FROM english_classify WHERE parent_id>0 and root_id IN (` + utils.GetOrmInReplace(len(rootIds)) + `) `
|
|
sql = `SELECT * FROM english_classify WHERE parent_id>0 and root_id IN (` + utils.GetOrmInReplace(len(rootIds)) + `) `
|
|
err = global.DbMap[utils.MYSQL_URL_RDDP].Raw(sql, rootIds).Find(&items).Error
|
|
err = global.DbMap[utils.MYSQL_URL_RDDP].Raw(sql, rootIds).Find(&items).Error
|