Commit 087a30df authored by vicotor's avatar vicotor

fix bug for query data from db

parent 2b1ce93d
...@@ -31,8 +31,8 @@ func newCache() *CacheData { ...@@ -31,8 +31,8 @@ func newCache() *CacheData {
func TestCacheData_Query(t *testing.T) { func TestCacheData_Query(t *testing.T) {
cache := newCache() cache := newCache()
testPath := "" testPath := "/start/docker"
testUid := int64(1) testUid := int64(17)
task, err := cache.Query(testPath, testUid) task, err := cache.Query(testPath, testUid)
if err != nil { if err != nil {
......
...@@ -63,7 +63,7 @@ func (repo *taskTypeRepositoryImpl) GetListByFilter(filters ...interface{}) []*T ...@@ -63,7 +63,7 @@ func (repo *taskTypeRepositoryImpl) GetListByFilter(filters ...interface{}) []*T
func (repo *taskTypeRepositoryImpl) GetById(id int64) (*TaskType, error) { func (repo *taskTypeRepositoryImpl) GetById(id int64) (*TaskType, error) {
taskType := TaskType{ID: id} taskType := TaskType{ID: id}
err := repo.o.Read(&taskType) err := repo.o.Read(&taskType, "id")
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -72,7 +72,7 @@ func (repo *taskTypeRepositoryImpl) GetById(id int64) (*TaskType, error) { ...@@ -72,7 +72,7 @@ func (repo *taskTypeRepositoryImpl) GetById(id int64) (*TaskType, error) {
func (repo *taskTypeRepositoryImpl) GetByApiPath(path string) (*TaskType, error) { func (repo *taskTypeRepositoryImpl) GetByApiPath(path string) (*TaskType, error) {
taskType := TaskType{ApiPath: path} taskType := TaskType{ApiPath: path}
err := repo.o.Read(&taskType) err := repo.o.Read(&taskType, "api_path")
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
...@@ -72,7 +72,7 @@ func (repo *userRepositoryImpl) GetListByFilter(filters ...interface{}) []*User ...@@ -72,7 +72,7 @@ func (repo *userRepositoryImpl) GetListByFilter(filters ...interface{}) []*User
func (repo *userRepositoryImpl) GetById(uid int64) (*User, error) { func (repo *userRepositoryImpl) GetById(uid int64) (*User, error) {
user := User{ID: uid} user := User{ID: uid}
err := repo.o.Read(&user) err := repo.o.Read(&user, "id")
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
...@@ -67,7 +67,7 @@ func (repo *userLevelRepositoryImpl) GetListByFilter(filters ...interface{}) []* ...@@ -67,7 +67,7 @@ func (repo *userLevelRepositoryImpl) GetListByFilter(filters ...interface{}) []*
func (repo *userLevelRepositoryImpl) GetById(uid int64) (*UserLevel, error) { func (repo *userLevelRepositoryImpl) GetById(uid int64) (*UserLevel, error) {
user := UserLevel{ID: uid} user := UserLevel{ID: uid}
err := repo.o.Read(&user) err := repo.o.Read(&user, "id")
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -76,7 +76,7 @@ func (repo *userLevelRepositoryImpl) GetById(uid int64) (*UserLevel, error) { ...@@ -76,7 +76,7 @@ func (repo *userLevelRepositoryImpl) GetById(uid int64) (*UserLevel, error) {
func (repo *userLevelRepositoryImpl) GetByLevel(level int64) (*UserLevel, error) { func (repo *userLevelRepositoryImpl) GetByLevel(level int64) (*UserLevel, error) {
user := UserLevel{Level: level} user := UserLevel{Level: level}
err := repo.o.Read(&user) err := repo.o.Read(&user, "level")
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
...@@ -62,7 +62,7 @@ func (repo *userLevelTaskTypeRepositoryImpl) GetListByFilter(filters ...interfac ...@@ -62,7 +62,7 @@ func (repo *userLevelTaskTypeRepositoryImpl) GetListByFilter(filters ...interfac
func (repo *userLevelTaskTypeRepositoryImpl) GetByTaskTypeAndUserLevel(taskType int64, userLevel int64) (*UserLevelTaskType, error) { func (repo *userLevelTaskTypeRepositoryImpl) GetByTaskTypeAndUserLevel(taskType int64, userLevel int64) (*UserLevelTaskType, error) {
user := UserLevelTaskType{TaskTypeId: taskType, UserLevel: userLevel} user := UserLevelTaskType{TaskTypeId: taskType, UserLevel: userLevel}
err := repo.o.Read(&user) err := repo.o.Read(&user, "task_type_id", "user_level")
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -71,7 +71,7 @@ func (repo *userLevelTaskTypeRepositoryImpl) GetByTaskTypeAndUserLevel(taskType ...@@ -71,7 +71,7 @@ func (repo *userLevelTaskTypeRepositoryImpl) GetByTaskTypeAndUserLevel(taskType
func (repo *userLevelTaskTypeRepositoryImpl) GetById(uid int64) (*UserLevelTaskType, error) { func (repo *userLevelTaskTypeRepositoryImpl) GetById(uid int64) (*UserLevelTaskType, error) {
user := UserLevelTaskType{ID: uid} user := UserLevelTaskType{ID: uid}
err := repo.o.Read(&user) err := repo.o.Read(&user, "id")
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment