Fix map with cols #1575

Merged
lunny merged 2 commits from lunny/fix_map_cols into master 2020-03-06 08:55:19 +00:00
2 changed files with 2 additions and 2 deletions
Showing only changes of commit f4358c00fd - Show all commits

View File

@ -139,7 +139,7 @@ func (session *Session) find(rowsSlicePtr interface{}, condiBean ...interface{})
return err
}
if session.canCache() {
if session.statement.ColumnMap.IsEmpty() && session.canCache() {
if cacher := session.engine.GetCacher(session.statement.TableName()); cacher != nil &&
!session.statement.IsDistinct &&
!session.statement.GetUnscoped() {

View File

@ -65,7 +65,7 @@ func (session *Session) get(bean interface{}) (bool, error) {
table := session.statement.RefTable
if session.canCache() && beanValue.Elem().Kind() == reflect.Struct {
if session.statement.ColumnMap.IsEmpty() && session.canCache() && beanValue.Elem().Kind() == reflect.Struct {
if cacher := session.engine.GetCacher(session.statement.TableName()); cacher != nil &&
!session.statement.GetUnscoped() {
has, err := session.cacheGet(bean, sqlStr, args...)