Browse Source

update

add_mode
DengBiao 1 year ago
parent
commit
ef552a6659
2 changed files with 8 additions and 6 deletions
  1. +6
    -6
      app/admin/svc/enterprise_manage/svc_enterprise_manage.go
  2. +2
    -0
      app/db/db_user_identity.go

+ 6
- 6
app/admin/svc/enterprise_manage/svc_enterprise_manage.go View File

@@ -123,9 +123,10 @@ func EnterpriseUserListByCentralKitchenForSchoolV2(req md.EnterpriseUserListReq)
sess.And("user_identity.identity = ?", enum2.UserIdentityForCentralKitchenForStudent)
}
var m []*db.UserWithUserIdentity
count, err := sess.
count, _ := sess.
Join("LEFT", "user_identity", "user.id = user_identity.uid").
Limit(req.Limit, (req.Page-1)*req.Limit).GroupBy("user.id").FindAndCount(&m)
resp.Total = count

var userIdentitiesMap = map[string][]db.UserIdentityWithClass{}
userIdentityDb := db.UserIdentityDb{}
@@ -140,19 +141,18 @@ func EnterpriseUserListByCentralKitchenForSchoolV2(req md.EnterpriseUserListReq)
}
}
fmt.Println("!!!!!!!!!")
resp.Total = count
classWithUserDb := db.ClassWithUserDb{}
classWithUserDb.Set()
for _, v := range m {
temp := md.EnterpriseUserListByCentralKitchenForSchoolStruct{
Id: v.User.Id,
Nickname: v.Nickname,
Phone: v.Phone,
Avatar: v.Avatar,
IsTeacher: 0,
CreateAt: v.User.CreateAt,
}
for _, v1 := range userIdentitiesMap[utils.IntToStr(v.User.Id)] {
temp.Nickname = v1.User.Nickname
temp.Phone = v1.User.Phone
temp.Avatar = v1.User.Avatar
temp.CreateAt = v1.User.CreateAt
//TODO::判断是否为老师
if v1.Identity == enum2.UserIdentityForCentralKitchenForTeacher {
temp.UserIdentities = append(temp.UserIdentities, struct {


+ 2
- 0
app/db/db_user_identity.go View File

@@ -96,6 +96,7 @@ func (userIdentityDb *UserIdentityDb) FindUserIdentityWithClass() (*[]UserIdenti
var m []UserIdentityWithClass
if err := userIdentityDb.Db.
Join("LEFT", "enterprise", "user_identity.enterprise_id = enterprise.id").
Join("LEFT", "user", "user_identity.uid = user.id").
Join("LEFT", "class_with_user", "user_identity.id = class_with_user.user_identity_id").
Join("LEFT", "class", "class_with_user.class_id = class.id").
Join("LEFT", "grade", "class.grade_id = grade.id").
@@ -233,6 +234,7 @@ func (UserIdentityWithEnterprise) TableName() string {

type UserIdentityWithClass struct {
model.UserIdentity `xorm:"extends"`
model.User `xorm:"extends"`
model.Enterprise `xorm:"extends"`
model.ClassWithUser `xorm:"extends"`
model.Class `xorm:"extends"`


||||||
x
 
000:0
Loading…
Cancel
Save