Quellcode durchsuchen

sub_account_condition

Xingyu Xian vor 4 Wochen
Ursprung
Commit
b885f2bfc7
4 geänderte Dateien mit 10 neuen und 6 gelöschten Zeilen
  1. 2 2
      db/sub_account.go
  2. 5 1
      model/http_model/find_all_sub_account.go
  3. 2 2
      service/job.go
  4. 1 1
      service/sub_account.go

+ 2 - 2
db/sub_account.go

@@ -56,11 +56,11 @@ func FindSubAccountByPhone(ctx context.Context, phone string) (*gorm_model.Young
 }
 
 // FindSubAccountByEnterpriseId 根据商家ID查找包含的所有子账号信息
-func FindSubAccountByEnterpriseId(ctx context.Context, enterpriseId string) ([]*gorm_model.YounggeeSubAccount, int64, error) {
+func FindSubAccountByEnterpriseId(ctx context.Context, enterpriseId string, jobId int, accountStatus int) ([]*gorm_model.YounggeeSubAccount, int64, error) {
 	db := GetReadDB(ctx)
 	var total int64
 	var subAccount []*gorm_model.YounggeeSubAccount
-	whereCondition := gorm_model.YounggeeSubAccount{EnterpriseId: enterpriseId, SubAccountType: 1}
+	whereCondition := gorm_model.YounggeeSubAccount{EnterpriseId: enterpriseId, SubAccountType: 1, JobId: jobId, AccountStatus: accountStatus}
 	err := db.Model(gorm_model.YounggeeSubAccount{}).Where(whereCondition).Find(&subAccount).Count(&total).Error
 	if err != nil {
 		return nil, 0, err

+ 5 - 1
model/http_model/find_all_sub_account.go

@@ -1,7 +1,11 @@
 package http_model
 
 type FindAllSubAccountRequest struct {
-	EnterpriseId string `json:"enterprise_id"` // 子账号属于的企业id
+	PageSize      int64  `json:"page_size"`
+	PageNum       int64  `json:"page_num"`
+	EnterpriseId  string `json:"enterprise_id"`  // 子账号属于的企业id
+	JobId         int    `json:"job_id"`         // 岗位ID
+	AccountStatus int    `json:"account_status"` // 账号状态,1为正常,2为停用
 }
 
 type FindAllSubAccountInfo struct {

+ 2 - 2
service/job.go

@@ -70,8 +70,8 @@ func (*job) FindJobByEnterpriseId(ctx context.Context, request http_model.FindAl
 		return nil, jobErr
 	}
 	if jobInfo != nil {
-		for _, job := range jobInfo {
-			jobNameData.JobInfo = append(jobNameData.JobInfo, job)
+		for _, jobData := range jobInfo {
+			jobNameData.JobInfo = append(jobNameData.JobInfo, jobData)
 		}
 		jobNameData.Total = total
 	} else {

+ 1 - 1
service/sub_account.go

@@ -79,7 +79,7 @@ func (*subaccount) FindSubAccountByEnterpriseId(ctx context.Context, request htt
 	subAccountResp = &http_model.FindAllSubAccountData{}
 
 	// 1. 取出子账号基本信息
-	newSubAccount, total, subaccountErr := db.FindSubAccountByEnterpriseId(ctx, request.EnterpriseId)
+	newSubAccount, total, subaccountErr := db.FindSubAccountByEnterpriseId(ctx, request.EnterpriseId, request.JobId, request.AccountStatus)
 	if subaccountErr != nil {
 		return nil, subaccountErr
 	}