feat:完善项目管理
This commit is contained in:
@ -14,19 +14,22 @@ type ManageExpert struct {
|
||||
// ManageExpertInfo 专家信息
|
||||
type ManageExpertInfo struct {
|
||||
model.Model
|
||||
Name string `json:"name"`
|
||||
Mobile string `json:"mobile"`
|
||||
Industry string `json:"-"`
|
||||
VisitCount int `json:"visit_count"`
|
||||
SettledAt time.Time `json:"settled_at"`
|
||||
Name string `json:"name"`
|
||||
Mobile string `json:"mobile"`
|
||||
Industry string `json:"-"`
|
||||
VisitCount int `json:"visit_count"`
|
||||
CollectCount int `json:"collect_count"`
|
||||
SettledAt time.Time `json:"settled_at"`
|
||||
}
|
||||
|
||||
// Experts 专家信息
|
||||
func (m *ManageExpert) Experts(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*ManageExpertInfo, error) {
|
||||
db := orm.GetDB().Table(m.TableName()+" e").
|
||||
Select("e.id", "e.name", "e.mobile", "e.industry", "v.count AS visit_count", "e.examine_at AS settled_at").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS v ON e.id = v.expert_id AND v.is_deleted = %d",
|
||||
model.NewManageExpertVisit().TableName(), model.DeleteStatusForNot))
|
||||
Joins(fmt.Sprintf("LEFT JOIN (SELECT expert_id, COUNT(id) AS count FROM %s WHERE is_deleted = %d GROUP BY expert_id) AS v ON e.id = v.expert_id",
|
||||
model.NewManageExpertVisit().TableName(), model.DeleteStatusForNot)).
|
||||
Joins(fmt.Sprintf("LEFT JOIN (SELECT expert_id, COUNT(id) AS count FROM %s WHERE is_deleted = %d GROUP BY expert_id) AS c ON e.id = c.expert_id",
|
||||
model.NewManageExpertCollect().TableName(), model.DeleteStatusForNot))
|
||||
|
||||
if len(where) > 0 {
|
||||
for _, v := range where {
|
||||
|
Reference in New Issue
Block a user