Browse Source

增加研究员列表筛选条件

kobe6258 4 months ago
parent
commit
34f82e1ad0

+ 10 - 7
domian/financial_analyst/financial_analyst_service.go

@@ -7,13 +7,16 @@ import (
 )
 )
 
 
 type FinancialAnalystDTO struct {
 type FinancialAnalystDTO struct {
-	Id           int
-	ETAId        int
-	Name         string
-	HeadImgUrl   string
-	Introduction string
-	Status       bool
-	Deleted      bool
+	Id                      int
+	ETAId                   int
+	Name                    string
+	Position                string
+	InvestmentCertificate   string
+	ProfessionalCertificate string
+	HeadImgUrl              string
+	Introduction            string
+	Status                  bool
+	Deleted                 bool
 }
 }
 
 
 func GetAnalystList(pageInfo page.PageInfo) (analystsDTO []FinancialAnalystDTO, err error) {
 func GetAnalystList(pageInfo page.PageInfo) (analystsDTO []FinancialAnalystDTO, err error) {

+ 17 - 14
models/financial_analyst/financial_analyst.go

@@ -14,20 +14,23 @@ type AnalystStatus string
 const (
 const (
 	AnalystStatusEnabled  AnalystStatus = "enabled"
 	AnalystStatusEnabled  AnalystStatus = "enabled"
 	AnalystStatusDisabled AnalystStatus = "disabled"
 	AnalystStatusDisabled AnalystStatus = "disabled"
-	columns                             = "id,eta_id,name,head_img_url,introduction"
+	columns                             = "id,eta_id,name,head_img_url,introduction,position,investment_certificate,professional_certificate"
 )
 )
 
 
 type CrmFinancialAnalyst struct {
 type CrmFinancialAnalyst struct {
-	Id           int           `gorm:"primaryKey;autoIncrement;column:id;comment:主键"`
-	ETAId        int           `gorm:"column:eta_id"`
-	HTId         int           `gorm:"column:ht_id"`
-	Name         string        `gorm:"column:name"`
-	HeadImgURL   string        `gorm:"column:head_img_url"`
-	Introduction string        `gorm:"column:introduction"`
-	Status       AnalystStatus `gorm:"column:status"`
-	Deleted      bool          `gorm:"column:deleted"`
-	CreatedTime  time.Time     `gorm:"column:created_time;type:timestamps;comment:创建时间"`
-	UpdatedTime  time.Time     `gorm:"column:updated_time;type:timestamps;comment:更新时间"`
+	Id                      int           `gorm:"primaryKey;autoIncrement;column:id;comment:主键"`
+	ETAId                   int           `gorm:"column:eta_id"`
+	HTId                    int           `gorm:"column:ht_id"`
+	Name                    string        `gorm:"column:name"`
+	HeadImgURL              string        `gorm:"column:head_img_url"`
+	Position                string        `gorm:"column:position"`
+	InvestmentCertificate   string        `gorm:"column:investment_certificate"`
+	ProfessionalCertificate string        `gorm:"column:professional_certificate"`
+	Introduction            string        `gorm:"column:introduction"`
+	Status                  AnalystStatus `gorm:"column:status"`
+	Deleted                 bool          `gorm:"column:deleted"`
+	CreatedTime             time.Time     `gorm:"column:created_time;type:timestamps;comment:创建时间"`
+	UpdatedTime             time.Time     `gorm:"column:updated_time;type:timestamps;comment:更新时间"`
 }
 }
 
 
 func BatchInsertOrUpdate(list []CrmFinancialAnalyst) (err error) {
 func BatchInsertOrUpdate(list []CrmFinancialAnalyst) (err error) {
@@ -61,12 +64,12 @@ func GetAnalystByName(name string) (analyst CrmFinancialAnalyst, err error) {
 
 
 func GetCount() (total int64, latestId int64) {
 func GetCount() (total int64, latestId int64) {
 	db := models.Main()
 	db := models.Main()
-	err := db.Model(&CrmFinancialAnalyst{}).Select("count(*) count").Order("id asc").Scan(&total).Error
+	err := db.Model(&CrmFinancialAnalyst{}).Select("count(*) count").Where("deleted = ? and  investment_certificate !=''", false).Scan(&total).Error
 	if err != nil {
 	if err != nil {
 		logger.Error("查询研究员列表失败,%v", err)
 		logger.Error("查询研究员列表失败,%v", err)
 		return 0, 0
 		return 0, 0
 	}
 	}
-	err = db.Model(&CrmFinancialAnalyst{}).Select("MAX(id) id").Scan(&latestId).Order("id asc").Error
+	err = db.Model(&CrmFinancialAnalyst{}).Select("MAX(id) id").Where("deleted = ? and  investment_certificate !=''", false).Scan(&latestId).Error
 	if err != nil {
 	if err != nil {
 		logger.Error("查询研究员列表失败,%v", err)
 		logger.Error("查询研究员列表失败,%v", err)
 		return 0, 0
 		return 0, 0
@@ -85,6 +88,6 @@ func GetAnalystList(latestId int64, offset int, limit int) (analysts []CrmFinanc
 		logger.Error("非法的limit参数:%d", limit)
 		logger.Error("非法的limit参数:%d", limit)
 	}
 	}
 	db := models.Main()
 	db := models.Main()
-	err = db.Select(columns).Where(" id<= ? ", latestId).Order("created_time desc").Offset(offset).Limit(limit).Find(&analysts).Error
+	err = db.Select(columns).Where(" id<= ? ", latestId).Where("deleted = ? and  investment_certificate !=''", false).Order("created_time desc").Offset(offset).Limit(limit).Find(&analysts).Error
 	return
 	return
 }
 }