feat:完善信息
This commit is contained in:
@ -12,9 +12,10 @@ type ManageExpert struct {
|
||||
|
||||
type ManageExpertInfo struct {
|
||||
*model.ManageExpert
|
||||
PatentTitle string `json:"-"`
|
||||
Research string `json:"-"`
|
||||
Introduce string `json:"introduce"`
|
||||
PatentTitle string `json:"-"`
|
||||
ResearchName string `json:"research_name"`
|
||||
Research string `json:"-"`
|
||||
Introduce string `json:"introduce"`
|
||||
}
|
||||
|
||||
// Expert 专家信息
|
||||
@ -25,13 +26,14 @@ func (m *ManageExpert) Expert(limit int, where ...*model.ModelWhere) ([]*ManageE
|
||||
mUserPatent := model.NewUserPatent()
|
||||
|
||||
db := orm.GetDB().Table(m.TableName()+" AS e").
|
||||
Select("e.id", "e.name", "e.industry", "e.school", "e.major", "e.keyword",
|
||||
"p.title AS patent_title").
|
||||
Select("e.id", "e.name", "e.industry", "e.image", "e.school", "e.major", "e.keyword",
|
||||
"p.title AS patent_title", "r.name AS research_name").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS e_u ON e.id = e_u.expert_id AND e_u.invalid_status = %d AND e_u.is_deleted = %d",
|
||||
model.NewUserExpert().TableName(), model.InvalidStatusForNot, model.DeleteStatusForNot)).
|
||||
Joins(fmt.Sprintf(`LEFT JOIN (SELECT u.uid, SUBSTRING_INDEX(GROUP_CONCAT(p.title ORDER BY p.id DESC SEPARATOR '&&'), '&&', %d) AS title
|
||||
Joins(fmt.Sprintf(`LEFT JOIN (SELECT u.uid, SUBSTRING_INDEX(GROUP_CONCAT(p.kind, '$$', p.title ORDER BY p.id DESC SEPARATOR '&&'), '&&', %d) AS title
|
||||
FROM %s AS u LEFT JOIN %s AS p ON u.patent_id = p.id WHERE u.is_deleted = %d AND p.shelf_status = %d GROUP BY u.uid) AS p ON e_u.uid = p.uid`,
|
||||
limit, mUserPatent.TableName(), mSysPatent.TableName(), model.DeleteStatusForNot, model.ShelfStatusForUp)).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS r ON e.research_id = r.id", model.NewManageResearch().TableName())).
|
||||
Where("e.examine_status = ?", model.ExamineStatusForAgree).
|
||||
Where("e.is_deleted = ?", model.DeleteStatusForNot)
|
||||
|
||||
@ -57,12 +59,13 @@ func (m *ManageExpert) Detail(limit int, id uint64) (*ManageExpertInfo, error) {
|
||||
|
||||
db := orm.GetDB().Table(m.TableName()+" AS e").
|
||||
Select("e.id", "e.name", "e.industry", "e.school", "e.major", "e.keyword", "e.research", "e.introduce",
|
||||
"p.title AS patent_title").
|
||||
"p.title AS patent_title", "r.name AS research_name").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS e_u ON e.id = e_u.expert_id AND e_u.invalid_status = %d AND e_u.is_deleted = %d",
|
||||
model.NewUserExpert().TableName(), model.InvalidStatusForNot, model.DeleteStatusForNot)).
|
||||
Joins(fmt.Sprintf(`LEFT JOIN (SELECT u.uid, SUBSTRING_INDEX(GROUP_CONCAT(p.title ORDER BY p.id DESC SEPARATOR '&&'), '&&', %d) AS title
|
||||
Joins(fmt.Sprintf(`LEFT JOIN (SELECT u.uid, SUBSTRING_INDEX(GROUP_CONCAT(p.kind, '$$', p.title ORDER BY p.id DESC SEPARATOR '&&'), '&&', %d) AS title
|
||||
FROM %s AS u LEFT JOIN %s AS p ON u.patent_id = p.id WHERE u.is_deleted = %d AND p.shelf_status = %d GROUP BY u.uid) AS p ON e_u.uid = p.uid`,
|
||||
limit, mUserPatent.TableName(), mSysPatent.TableName(), model.DeleteStatusForNot, model.ShelfStatusForUp)).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS r ON e.research_id = r.id", model.NewManageResearch().TableName())).
|
||||
Where("e.id = ?", id)
|
||||
|
||||
out := new(ManageExpertInfo)
|
||||
|
@ -20,7 +20,7 @@ type TechnologyAchievementInfo struct {
|
||||
// Achievements 成果信息
|
||||
func (m *TechnologyAchievement) Achievements(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*TechnologyAchievementInfo, error) {
|
||||
db := orm.GetDB().Table(m.TableName()+" AS a").
|
||||
Select("a.id", "a.title", "a.mode", "a.image", "a.charge_info", "a.industry", "a.customer", "a.maturity",
|
||||
Select("a.id", "a.title", "a.mode", "a.image", "a.config", "a.industry", "a.customer", "a.maturity",
|
||||
"a.cooperation_mode", "a.keyword", "v.count AS visit_count", "c.count AS collect_count").
|
||||
Joins(fmt.Sprintf("LEFT JOIN (SELECT object_id, SUM(count) AS count FROM %s WHERE kind = %d AND is_deleted = %d GROUP BY object_id) AS v ON a.id = v.object_id",
|
||||
model.NewUserVisit().TableName(), model.UserCollectKindForTechnologyAchievement, model.DeleteStatusForNot)).
|
||||
|
Reference in New Issue
Block a user