feat:完善项目信息
This commit is contained in:
@ -17,7 +17,7 @@ type (
|
||||
*model.ActivityApply
|
||||
Username string `json:"username"`
|
||||
model.Area
|
||||
HandleUsername string `json:"handle_name"`
|
||||
Handler string `json:"handler"`
|
||||
HandleRemark string `json:"handle_remark"`
|
||||
HandleCreatedAt time.Time `json:"handle_created_at"`
|
||||
}
|
||||
@ -28,11 +28,10 @@ func (m *ActivityApply) Apply(page, pageSize int, count *int64, where ...*model.
|
||||
db := orm.GetDB().Table(m.TableName()+" AS a").
|
||||
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())).
|
||||
"t.province", "t.city", "l.name AS handler", "l.remark AS handle_remark", "l.created_at AS handle_created_at").
|
||||
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",
|
||||
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 AS u 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)).
|
||||
Where("a.is_deleted = ?", model.DeleteStatusForNot)
|
||||
|
||||
|
@ -22,7 +22,7 @@ type ActivityJoinInfo struct {
|
||||
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", "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_i ON j.uid = u_i.uid 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)
|
||||
|
44
app/api/admin/model/sys_banner.go
Normal file
44
app/api/admin/model/sys_banner.go
Normal file
@ -0,0 +1,44 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"SciencesServer/app/common/model"
|
||||
"SciencesServer/serve/orm"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type SysBanner struct {
|
||||
*model.SysBanner
|
||||
}
|
||||
|
||||
// SysBannerInfo 轮播图信息
|
||||
type SysBannerInfo struct {
|
||||
*model.SysBanner
|
||||
model.Area
|
||||
}
|
||||
|
||||
// Banner 轮播图信息
|
||||
func (m *SysBanner) Banner(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*SysBannerInfo, error) {
|
||||
db := orm.GetDB().Table(m.TableName()+" AS b").
|
||||
Select("b.*", "t.province", "t.city").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS t ON b.tenant_id = t.id", model.NewSysTenant().TableName())).
|
||||
Where("b.is_deleted = ?", model.DeleteStatusForNot)
|
||||
|
||||
if len(where) > 0 {
|
||||
for _, wo := range where {
|
||||
db = db.Where(wo.Condition, wo.Value)
|
||||
}
|
||||
}
|
||||
out := make([]*SysBannerInfo, 0)
|
||||
|
||||
if err := db.Count(count).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := db.Order("b.id " + model.OrderModeToDesc).Offset((page - 1) * pageSize).Limit(pageSize).Scan(&out).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func NewSysBanner() *SysBanner {
|
||||
return &SysBanner{model.NewSysBanner()}
|
||||
}
|
Reference in New Issue
Block a user