feat:完善项目信息
This commit is contained in:
@ -26,11 +26,11 @@ type (
|
||||
// Apply 申请信息
|
||||
func (m *ActivityApply) Apply(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*ActivityApplyInfo, error) {
|
||||
db := orm.GetDB().Table(m.TableName()+" AS a").
|
||||
Select("a.id", "a.tenant_id", "a.image", "a.title", "a.contact", "a.contact_mobile", "a.begin_at",
|
||||
Select("a.id", "a.tenant_id", "a.identity", "a.image", "a.title", "a.contact", "a.contact_mobile", "a.begin_at",
|
||||
"a.finish_at", "a.amount", "a.max_number", "a.status", "a.created_at",
|
||||
"t.province", "t.city", "l.name AS handle_name", "l.remark AS handle_remark", "l.created_at AS handle_created_at").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS u ON a.uid = u.uuid", model.NewUserInstance().TableName())).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS t ON i.tenant_id = t.id", model.NewSysTenant().TableName())).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS t ON a.tenant_id = t.id", model.NewSysTenant().TableName())).
|
||||
Joins(fmt.Sprintf("LEFT JOIN (SELECT a.apply_id, MAX(a.id) AS id, MAX(a.created_at) AS created_at, MAX(a.remark) AS remark "+
|
||||
"MAX(u.`name`) AS name FROM %s AS a LEFT JOIN %s ON a.uid = u.uuid WHERE a.is_deleted = %d GROUP BY a.apply_id) AS l ON a.id = l.apply_id",
|
||||
model.NewActivityApplyLog().TableName(), model.NewSysUser().TableName(), model.DeleteStatusForNot)).
|
||||
|
@ -22,9 +22,9 @@ func (m *ActivityInstance) Activity(page, pageSize int, count *int64, where ...*
|
||||
Select("a.id", "a.tenant_id", "a.image", "a.title", "a.contact", "a.contact_mobile", "a.begin_at",
|
||||
"a.finish_at", "a.join_deadline", "a.amount", "a.max_number", "a.status", "a.created_at", "j.count AS join_count",
|
||||
"t.province", "t.city").
|
||||
Joins(fmt.Sprintf("LEFT JOIN (SELECT activity_id, COUNT(id) AS count FROM %s WHERE is_delete = %d AND status = %d GROUP BY activity_id) AS j ON a.id = j.activity_id",
|
||||
Joins(fmt.Sprintf("LEFT JOIN (SELECT activity_id, COUNT(id) AS count FROM %s WHERE is_deleted = %d AND status = %d GROUP BY activity_id) AS j ON a.id = j.activity_id",
|
||||
model.NewActivityJoin().TableName(), model.DeleteStatusForNot, model.ActivityJoinStatusForSuccess)).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS t ON i.tenant_id = t.id", model.NewSysTenant().TableName())).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS t ON a.tenant_id = t.id", model.NewSysTenant().TableName())).
|
||||
Where("a.is_deleted = ?", model.DeleteStatusForNot)
|
||||
|
||||
if len(where) > 0 {
|
||||
|
@ -13,13 +13,16 @@ type ActivityJoin struct {
|
||||
|
||||
type ActivityJoinInfo struct {
|
||||
model.Model
|
||||
Identity int `json:"identity"`
|
||||
Name string `json:"name"`
|
||||
Mobile string `json:"mobile"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
func (m *ActivityJoin) Join(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*ActivityJoinInfo, error) {
|
||||
db := orm.GetDB().Table(m.TableName()+" AS j").
|
||||
Select("j.id", "u.name", "j.created_at").
|
||||
Select("j.id", "j.identity", "u_i.name", "u.mobile", "j.created_at").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS u_i ON j.uid = u_i.uuid AND j.identity = u_i.identity", model.NewUserIdentity().TableName())).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS u ON j.uid = u.uuid", model.NewUserInstance().TableName())).
|
||||
Where("j.is_deleted = ?", model.DeleteStatusForNot).
|
||||
Where("j.status = ?", model.ActivityJoinStatusForSuccess)
|
||||
|
40
app/api/admin/model/sys_navigation.go
Normal file
40
app/api/admin/model/sys_navigation.go
Normal file
@ -0,0 +1,40 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"SciencesServer/app/common/model"
|
||||
"SciencesServer/serve/orm"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type SysNavigation struct {
|
||||
*model.SysNavigation
|
||||
}
|
||||
|
||||
type SysNavigationInfo struct {
|
||||
*model.SysNavigation
|
||||
model.Area
|
||||
}
|
||||
|
||||
func (m *SysNavigation) Navigation(where ...*model.ModelWhere) ([]*SysNavigationInfo, error) {
|
||||
out := make([]*SysNavigationInfo, 0)
|
||||
|
||||
db := orm.GetDB().Table(m.TableName()+" AS n").
|
||||
Select("n.*", "t.province", "t.city").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS t ON n.tenant_id = t.id", model.NewSysTenant().TableName())).
|
||||
Where("n.is_deleted = ?", model.DeleteStatusForNot).
|
||||
Order("n.sort " + model.OrderModeToAsc).Order("n.parent_id " + model.OrderModeToAsc).
|
||||
Order("n.id " + model.OrderModeToDesc)
|
||||
|
||||
if len(where) > 0 {
|
||||
for _, v := range where {
|
||||
db = db.Where(v.Condition, v.Value)
|
||||
}
|
||||
}
|
||||
err := db.Scan(&out).Error
|
||||
|
||||
return out, err
|
||||
}
|
||||
|
||||
func NewSysNavigation() *SysNavigation {
|
||||
return &SysNavigation{model.NewSysNavigation()}
|
||||
}
|
Reference in New Issue
Block a user