feat:完善项目
This commit is contained in:
@ -63,8 +63,7 @@ func (m *ActivityInstance) Detail(id, uid uint64, identity int) (*ActivityInstan
|
||||
mActivityJoin := model.NewActivityJoin()
|
||||
|
||||
db := orm.GetDB().Table(m.TableName()+" AS a").
|
||||
Select("a.id", "a.title", "a.image", "a.begin_at", "a.finish_at", "a.join_deadline",
|
||||
"IFNULL(u.id, 0) AS join_id", "j.count AS join_count").
|
||||
Select("a.*", "IFNULL(u.id, 0) AS join_id", "j.count AS join_count").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s u ON a.id = u.activity_id AND u.uid = %d AND u.identity = %d AND u.status = %d AND u.is_deleted = %d",
|
||||
mActivityJoin.TableName(), uid, identity, model.ActivityJoinStatusForSuccess, model.DeleteStatusForNot)).
|
||||
Joins(fmt.Sprintf("LEFT JOIN (SELECT activity_id, COUNT(id) AS count FROM %s WHERE status = %d AND is_deleted = %d GROUP BY activity_id) AS j ON a.id = j.activity_id",
|
||||
|
@ -13,8 +13,9 @@ type ServiceSolutionCase struct {
|
||||
// ServiceSolutionCaseInfo 解决方案案例信息
|
||||
type ServiceSolutionCaseInfo struct {
|
||||
model.Model
|
||||
Mode model.ServiceSolutionCaseMode `json:"mode"`
|
||||
Title string `json:"title"`
|
||||
Mode model.ServiceSolutionCaseMode `json:"mode"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
model.Image
|
||||
DetailID uint64 `json:"detail_id"`
|
||||
DetailTitle string `json:"detail_title"`
|
||||
@ -37,7 +38,7 @@ func (m *ServiceSolutionCase) SolutionCase(limit int, where ...*model.ModelWhere
|
||||
// Order("s.sort " + model.OrderModeToDesc)
|
||||
|
||||
db := orm.GetDB().Table(model.NewServiceSolutionCaseKind().TableName()+" AS k").
|
||||
Select("k.id AS id", "k.mode", "k.image AS image",
|
||||
Select("k.id AS id", "k.mode", "k.title", "k.image AS image", "k.description",
|
||||
"d.id AS detail_id", "d.title AS detail_title", "d.image AS detail_image", "d.description AS detail_description").
|
||||
Joins(fmt.Sprintf(`LEFT JOIN (SELECT id, kind_id, title, image, description, sort FROM %s AS a WHERE
|
||||
(SELECT count( b.id ) FROM %s AS b WHERE a.kind_id = b.kind_id AND a.id < b.id AND b.is_deleted = %d) < %d
|
||||
|
@ -1,11 +1,24 @@
|
||||
package model
|
||||
|
||||
import "SciencesServer/app/common/model"
|
||||
import (
|
||||
"SciencesServer/app/common/model"
|
||||
"SciencesServer/serve/orm"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type SysBanner struct {
|
||||
*model.SysBanner
|
||||
}
|
||||
|
||||
func (m *SysBanner) Get(tenantID uint64, condition map[string]interface{}) error {
|
||||
db := orm.GetDB().Table(m.TableName())
|
||||
|
||||
for k, v := range condition {
|
||||
db = db.Or(fmt.Sprintf("`%s` = '%v' AND is_deleted = %d AND tenant_id = %d", k, v, model.DeleteStatusForNot, tenantID))
|
||||
}
|
||||
return db.Scan(m.SysBanner).Error
|
||||
}
|
||||
|
||||
func NewSysBanner() *SysBanner {
|
||||
return &SysBanner{model.NewSysBanner()}
|
||||
}
|
||||
|
Reference in New Issue
Block a user