feat:优化项目信息
This commit is contained in:
@ -86,7 +86,7 @@ func (c *PatentParams) add(tenantID, uid uint64) error {
|
||||
// 查询当前的专家信息
|
||||
mUserExpert := model.NewUserExpert()
|
||||
|
||||
if isExist, err = model2.FirstField(mUserExpert.UserExpert, []string{"id", "expert_id"}, model2.NewWhere("uid", uid),
|
||||
if isExist, err = model2.LastWhere(mUserExpert.UserExpert, []string{"id", "expert_id"}, model2.NewWhere("uid", uid),
|
||||
model2.NewWhere("invalid_status", model2.InvalidStatusForNot)); err != nil {
|
||||
return err
|
||||
} else if !isExist {
|
||||
|
@ -142,8 +142,8 @@ func (c *Activity) Join(id uint64) error {
|
||||
var count int64
|
||||
|
||||
if err = model2.Count(model.NewActivityJoin().ActivityJoin, &count, model2.NewWhere("id", c.UID),
|
||||
model2.NewWhere("identity", c.SelectIdentity),
|
||||
model2.NewWhere("activity_id", id), model2.NewWhere("status", model2.ActivityJoinStatusForSuccess)); err != nil {
|
||||
model2.NewWhere("identity", c.SelectIdentity), model2.NewWhere("activity_id", id),
|
||||
model2.NewWhere("status", model2.ActivityJoinStatusForSuccess)); err != nil {
|
||||
return err
|
||||
}
|
||||
if count > 0 {
|
||||
|
@ -176,7 +176,7 @@ func (c *Index) static() (*InstanceStaticInfo, error) {
|
||||
// 专利信息
|
||||
mTechnologyPatent := model.NewTechnologyPatent()
|
||||
|
||||
if err = model2.Count(mTechnologyPatent.TechnologyPatent, &out.PatentCount, model2.NewWhere("shelf_status", model2.ShelfStatusForUp)); err != nil {
|
||||
if err = model2.Count(mTechnologyPatent.TechnologyPatent, &out.PatentCount); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
//成果信息
|
||||
|
@ -72,8 +72,9 @@ func (m *TechnologyPatent) Distribution() ([]*DataAreaDistributionInfo, error) {
|
||||
Select("e.province", "e.city", "e.district", "GROUP_CONCAT(p_c.industry_detail SEPARATOR '&') AS industry").
|
||||
Joins(fmt.Sprintf("RIGHT JOIN %s AS p_c ON p.ipc_code = p_c.ipc AND p_c.is_deleted = %d",
|
||||
model.NewTechnologyPatentClassify().TableName(), model.DeleteStatusForNot)).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS u_e ON p.uid = u_e.uid", model.NewUserExpert().TableName())).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS e ON u_e.expert_id = e.id", model.NewManageExpert().TableName())).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS p_e ON p.id = p_e.patent_id AND p_e.is_deleted = %d",
|
||||
model.NewTechnologyPatentExpert().TableName(), model.DeleteStatusForNot)).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS e ON p_e.expert_id = e.id", model.NewManageExpert().TableName())).
|
||||
Where("p.is_deleted = ?", model.DeleteStatusForNot).
|
||||
Group("e.province").Group("e.city").Group("e.district").
|
||||
Order("e.province " + model.OrderModeToAsc).Order("e.city " + model.OrderModeToAsc).Order("e.district " + model.OrderModeToAsc).
|
||||
|
Reference in New Issue
Block a user