正在显示
3 个修改的文件
包含
19 行增加
和
0 行删除
@@ -105,3 +105,14 @@ func ExistUserDepart(departid int64, usercompanyid int64) bool { | @@ -105,3 +105,14 @@ func ExistUserDepart(departid int64, usercompanyid int64) bool { | ||
105 | Exist() | 105 | Exist() |
106 | return ok | 106 | return ok |
107 | } | 107 | } |
108 | + | ||
109 | +func GetUserDepartment(departId, usercompanyid int64) (*UserDepartment, error) { | ||
110 | + m := &UserDepartment{} | ||
111 | + o := orm.NewOrm() | ||
112 | + err := o.QueryTable(&UserDepartment{}). | ||
113 | + Filter("department_id", departId). | ||
114 | + Filter("user_company_id", usercompanyid). | ||
115 | + Filter("enable_status", USER_DEPARTMENT_ENABLE_YES). | ||
116 | + One(m) | ||
117 | + return m, err | ||
118 | +} |
@@ -2,6 +2,7 @@ package protocol | @@ -2,6 +2,7 @@ package protocol | ||
2 | 2 | ||
3 | //ProviderData 成果提供者 | 3 | //ProviderData 成果提供者 |
4 | type AchievementProvider struct { | 4 | type AchievementProvider struct { |
5 | + Id int64 `json:"id"` //前端需要的唯一id标识,使用user_department表的id | ||
5 | UserCompanyId int64 `json:"user_company_id"` //用户的id | 6 | UserCompanyId int64 `json:"user_company_id"` //用户的id |
6 | UserName string `json:"user_name"` | 7 | UserName string `json:"user_name"` |
7 | DepartmentId int64 `json:"department_id"` //部门id | 8 | DepartmentId int64 `json:"department_id"` //部门id |
@@ -316,6 +316,7 @@ func GetAchievementInfo(id int64, companyId int64) *protocol.ResponseAchievement | @@ -316,6 +316,7 @@ func GetAchievementInfo(id int64, companyId int64) *protocol.ResponseAchievement | ||
316 | chaneTypeData *models.ChanceType | 316 | chaneTypeData *models.ChanceType |
317 | auditTempData *models.AuditTemplate | 317 | auditTempData *models.AuditTemplate |
318 | ) | 318 | ) |
319 | + | ||
319 | departmentData, err = models.GetDepartmentById(rspData.DepartmentId) | 320 | departmentData, err = models.GetDepartmentById(rspData.DepartmentId) |
320 | if err == nil { | 321 | if err == nil { |
321 | rspData.DepartmentId = departmentData.Id | 322 | rspData.DepartmentId = departmentData.Id |
@@ -354,5 +355,11 @@ func getAchievementProvider(achievementId int64) []protocol.AchievementProvider | @@ -354,5 +355,11 @@ func getAchievementProvider(achievementId int64) []protocol.AchievementProvider | ||
354 | if err != nil { | 355 | if err != nil { |
355 | log.Error("SQL EXECUTE ERR:%s", err) | 356 | log.Error("SQL EXECUTE ERR:%s", err) |
356 | } | 357 | } |
358 | + for i := range sqldata { | ||
359 | + userDepartment, err := models.GetUserDepartment(sqldata[i].DepartmentId, sqldata[i].UserCompanyId) | ||
360 | + if err == nil { | ||
361 | + sqldata[i].Id = userDepartment.Id | ||
362 | + } | ||
363 | + } | ||
357 | return sqldata | 364 | return sqldata |
358 | } | 365 | } |
-
请 注册 或 登录 后发表评论