|
|
|
@ -38,20 +38,6 @@ func GetListByIds(ids []string, m Model.Selector) []map[string]interface{} {
|
|
|
|
|
return list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
功能:删除指定ID的缓存
|
|
|
|
|
作者:黄海
|
|
|
|
|
时间:2020-02-21
|
|
|
|
|
*/
|
|
|
|
|
func DeleteCacheByIds(ids []string, m Model.Selector) {
|
|
|
|
|
prefix := m.RedisPrefix
|
|
|
|
|
for i := 0; i < len(ids); i++ {
|
|
|
|
|
id := ids[i]
|
|
|
|
|
key := prefix + id
|
|
|
|
|
RedisUtil.DEL(key)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*===================以下为内部函数,用于扩展从REDIS缓存中查询===========================*/
|
|
|
|
|
func fromDb(ids []string, m Model.Selector) []map[string]interface{} {
|
|
|
|
|
tableName := m.TableName
|
|
|
|
@ -135,22 +121,6 @@ func batchReadRedis(ids []string, prefix string) ([]map[string]interface{}, []st
|
|
|
|
|
return existList, notExistsIds
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
功能:对于简单表提供分页的通用SQL组装方法,返回通用分页的SQL语句和获取查询总数的SQL语句
|
|
|
|
|
作者:黄海
|
|
|
|
|
时间:2020-02-21
|
|
|
|
|
*/
|
|
|
|
|
func count(baseSql string) (int32, error) {
|
|
|
|
|
countSql := "SELECT count(*) as count from (" + baseSql + ") as t100"
|
|
|
|
|
var count int32
|
|
|
|
|
_, err := db.SQL(countSql).Get(&count)
|
|
|
|
|
if err != nil {
|
|
|
|
|
LogUtil.Error(ErrorConst.SqlQueryError, err.Error())
|
|
|
|
|
return 0, err
|
|
|
|
|
}
|
|
|
|
|
return count, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
功能:将指定的SQL语句计算分页的SQL
|
|
|
|
|
作者:黄海
|
|
|
|
|