feat:完善项目管理
This commit is contained in:
@ -27,7 +27,7 @@ func (m *ActivityInstance) Joins(page, pageSize int, count *int64, where ...*mod
|
||||
Where("j.status = ?", model.ActivityJoinStatusForSuccess)
|
||||
|
||||
if len(where) > 0 {
|
||||
for _, v := range where {
|
||||
` for _, v := range where {
|
||||
db = db.Where(v.Condition, v.Value)
|
||||
}
|
||||
}
|
||||
@ -39,7 +39,7 @@ func (m *ActivityInstance) Joins(page, pageSize int, count *int64, where ...*mod
|
||||
if err := db.Order("j.id " + model.OrderModeToDesc).Offset((page - 1) * pageSize).Limit(pageSize).Scan(&out).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
return out, nil`
|
||||
}
|
||||
|
||||
func NewActivityInstance() *ActivityInstance {
|
||||
|
39
app/api/enterprise/model/manage_agent_company.go
Normal file
39
app/api/enterprise/model/manage_agent_company.go
Normal file
@ -0,0 +1,39 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"SciencesServer/app/common/model"
|
||||
"SciencesServer/serve/orm"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type ManageAgentCompany struct {
|
||||
*model.ManageAgentCompany
|
||||
}
|
||||
|
||||
type ManageAgentCompanyInfo struct {
|
||||
*model.ManageAgentCompany
|
||||
}
|
||||
|
||||
func (m *ManageAgentCompany) Company(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*ManageAgentCompanyInfo, error) {
|
||||
db := orm.GetDB().Table(m.TableName() + " AS c").
|
||||
Joins(fmt.Sprintf(""))
|
||||
|
||||
if len(where) > 0 {
|
||||
for _, v := range where {
|
||||
db = db.Where(v.Condition, v.Value)
|
||||
}
|
||||
}
|
||||
out := make([]*ManageAgentCompanyInfo, 0)
|
||||
|
||||
if err := db.Count(count).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := db.Order("c.id " + model.OrderModeToDesc).Offset((page - 1) * pageSize).Limit(pageSize).Scan(&out).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func NewManageAgentCompany() *ManageAgentCompany {
|
||||
return &ManageAgentCompany{model.NewManageAgentCompany()}
|
||||
}
|
@ -1,11 +1,45 @@
|
||||
package model
|
||||
|
||||
import "SciencesServer/app/common/model"
|
||||
import (
|
||||
"SciencesServer/app/common/model"
|
||||
"SciencesServer/serve/orm"
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
type ManageCompany struct {
|
||||
*model.ManageCompany
|
||||
}
|
||||
|
||||
// ManageCompanyInfo 公司信息,包含公司下需求信息
|
||||
type ManageCompanyInfo struct {
|
||||
model.Model
|
||||
Name string `json:"name"`
|
||||
SettledAt time.Time `json:"settled_at"`
|
||||
}
|
||||
|
||||
func (m *ManageCompany) Company(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*ManageCompanyInfo, error) {
|
||||
// TODO:未完成功能
|
||||
db := orm.GetDB().Table(m.TableName()+" AS c").
|
||||
Select("c.id", "c.name", "c.industry", "c.examine_at AS settled_at").
|
||||
Joins(fmt.Sprintf("LEFT JOIN (SELECT * FROM %s AS u_c)"))
|
||||
|
||||
if len(where) > 0 {
|
||||
for _, v := range where {
|
||||
db = db.Where(v.Condition, v.Value)
|
||||
}
|
||||
}
|
||||
out := make([]*ManageCompanyInfo, 0)
|
||||
|
||||
if err := db.Count(count).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := db.Order("c.id " + model.OrderModeToDesc).Offset((page - 1) * pageSize).Limit(pageSize).Scan(&out).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func NewManageCompany() *ManageCompany {
|
||||
return &ManageCompany{model.NewManageCompany()}
|
||||
}
|
||||
|
Reference in New Issue
Block a user