feat:优化项目信息
This commit is contained in:
@ -18,23 +18,12 @@ type TechnologyPatentInfo struct {
|
||||
ApplyAt string `json:"apply_at"`
|
||||
}
|
||||
|
||||
type (
|
||||
// TechnologyPatentBasicInfo 专利信息
|
||||
TechnologyPatentBasicInfo struct {
|
||||
model.Model
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
ApplyAt string `json:"apply_at"`
|
||||
}
|
||||
)
|
||||
|
||||
// Instance 专利信息
|
||||
func (m *TechnologyPatent) Instance(where ...*model.ModelWhere) ([]*TechnologyPatentInfo, error) {
|
||||
db := orm.GetDB().Table(m.TableName()+" AS p").
|
||||
Select("p.id", "p.title", "LEFT(p.description, 80) AS description", "p.apply_at").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS c ON p.ipc_code = c.ipc AND c.is_deleted = %d",
|
||||
model.NewTechnologyPatentClassify().TableName(), model.DeleteStatusForNot)).
|
||||
Where("p.shelf_status = ?", model.ShelfStatusForUp).
|
||||
Where("p.is_deleted = ?", model.DeleteStatusForNot)
|
||||
|
||||
if len(where) > 0 {
|
||||
@ -56,7 +45,6 @@ func (m *TechnologyPatent) Patents(page, pageSize int, count *int64, where ...*m
|
||||
Select("p.id", "p.title", "LEFT(p.description, 80) AS description", "p.apply_at").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS c ON p.ipc_code = c.ipc AND c.is_deleted = %d",
|
||||
model.NewTechnologyPatentClassify().TableName(), model.DeleteStatusForNot)).
|
||||
Where("p.shelf_status = ?", model.ShelfStatusForUp).
|
||||
Where("p.is_deleted = ?", model.DeleteStatusForNot)
|
||||
|
||||
if len(where) > 0 {
|
||||
@ -87,7 +75,6 @@ func (m *TechnologyPatent) Distribution() ([]*DataAreaDistributionInfo, error) {
|
||||
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())).
|
||||
Where("p.is_deleted = ?", model.DeleteStatusForNot).
|
||||
Where("p.shelf_status = ?", model.ShelfStatusForUp).
|
||||
Group("e.province").Group("e.city").Group("e.district").
|
||||
Order("e.province " + model.OrderModeToAsc).Order("e.city " + model.OrderModeToAsc).Order("e.district " + model.OrderModeToAsc).
|
||||
Scan(&out).Error
|
||||
|
Reference in New Issue
Block a user