|
@@ -44,32 +44,32 @@ var IndexTaskRecordColumns = struct {
|
|
|
}
|
|
|
|
|
|
func (m *IndexTaskRecord) Create() (err error) {
|
|
|
- err = global.DbMap[utils.DbNameAI].Create(&m).Error
|
|
|
+ err = global.DbMap[utils.DbNameIndex].Create(&m).Error
|
|
|
|
|
|
return
|
|
|
}
|
|
|
|
|
|
func (m *IndexTaskRecord) Update(updateCols []string) (err error) {
|
|
|
- err = global.DbMap[utils.DbNameAI].Select(updateCols).Updates(&m).Error
|
|
|
+ err = global.DbMap[utils.DbNameIndex].Select(updateCols).Updates(&m).Error
|
|
|
|
|
|
return
|
|
|
}
|
|
|
|
|
|
func (m *IndexTaskRecord) Del() (err error) {
|
|
|
- err = global.DbMap[utils.DbNameAI].Delete(&m).Error
|
|
|
+ err = global.DbMap[utils.DbNameIndex].Delete(&m).Error
|
|
|
|
|
|
return
|
|
|
}
|
|
|
|
|
|
func (m *IndexTaskRecord) GetByID(id int) (item *IndexTaskRecord, err error) {
|
|
|
- err = global.DbMap[utils.DbNameAI].Where(fmt.Sprintf("%s = ?", IndexTaskRecordColumns.IndexTaskRecordID), id).First(&item).Error
|
|
|
+ err = global.DbMap[utils.DbNameIndex].Where(fmt.Sprintf("%s = ?", IndexTaskRecordColumns.IndexTaskRecordID), id).First(&item).Error
|
|
|
|
|
|
return
|
|
|
}
|
|
|
|
|
|
func (m *IndexTaskRecord) GetByCondition(condition string, pars []interface{}) (item *IndexTaskRecord, err error) {
|
|
|
sqlStr := fmt.Sprintf(`SELECT * FROM %s WHERE 1=1 %s`, m.TableName(), condition)
|
|
|
- err = global.DbMap[utils.DbNameAI].Raw(sqlStr, pars...).First(&item).Error
|
|
|
+ err = global.DbMap[utils.DbNameIndex].Raw(sqlStr, pars...).First(&item).Error
|
|
|
|
|
|
return
|
|
|
}
|
|
@@ -79,7 +79,7 @@ func (m *IndexTaskRecord) GetAllListByCondition(field, condition string, pars []
|
|
|
field = "*"
|
|
|
}
|
|
|
sqlStr := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s order by index_task_record_id desc `, field, m.TableName(), condition)
|
|
|
- err = global.DbMap[utils.DbNameAI].Raw(sqlStr, pars...).Find(&items).Error
|
|
|
+ err = global.DbMap[utils.DbNameIndex].Raw(sqlStr, pars...).Find(&items).Error
|
|
|
|
|
|
return
|
|
|
}
|
|
@@ -90,7 +90,7 @@ func (m *IndexTaskRecord) GetListByCondition(field, condition string, pars []int
|
|
|
}
|
|
|
sqlStr := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s order by index_task_record_id desc LIMIT ?,?`, field, m.TableName(), condition)
|
|
|
pars = append(pars, startSize, pageSize)
|
|
|
- err = global.DbMap[utils.DbNameAI].Raw(sqlStr, pars...).Find(&items).Error
|
|
|
+ err = global.DbMap[utils.DbNameIndex].Raw(sqlStr, pars...).Find(&items).Error
|
|
|
|
|
|
return
|
|
|
}
|
|
@@ -98,7 +98,7 @@ func (m *IndexTaskRecord) GetListByCondition(field, condition string, pars []int
|
|
|
func (m *IndexTaskRecord) GetCountByCondition(condition string, pars []interface{}) (total int, err error) {
|
|
|
var intNull sql.NullInt64
|
|
|
sqlStr := fmt.Sprintf(`SELECT COUNT(1) total FROM %s WHERE 1=1 %s`, m.TableName(), condition)
|
|
|
- err = global.DbMap[utils.DbNameAI].Raw(sqlStr, pars...).Scan(&intNull).Error
|
|
|
+ err = global.DbMap[utils.DbNameIndex].Raw(sqlStr, pars...).Scan(&intNull).Error
|
|
|
if err == nil && intNull.Valid {
|
|
|
total = int(intNull.Int64)
|
|
|
}
|