feat:完善项目信息

This commit is contained in:
henry
2022-01-12 15:05:14 +08:00
parent 0d49575e06
commit 4ec0953a29
33 changed files with 817 additions and 249 deletions

View File

@ -14,6 +14,7 @@ type ServiceMessage struct {
type ServiceMessageInfo struct {
*model.ServiceMessage
model.Area
Domain string `json:"-"`
HandleContent string `json:"handle_content"`
HandleCreatedAt time.Time `json:"handle_created_at"`
}
@ -21,11 +22,12 @@ type ServiceMessageInfo struct {
func (m *ServiceMessage) Message(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*ServiceMessageInfo, error) {
db := orm.GetDB().Table(m.TableName()+" AS m").
Select("m.*", "l.content AS handle_content", "l.created_at AS handle_created_at",
"t.province", "t.city").
"t.province", "t.city", "t.domain").
Joins(fmt.Sprintf("LEFT JOIN (SELECT MAX(id) AS id, message_id, MAX(created_at) AS created_at, MAX(content) AS content "+
"FROM %s WHERE is_deleted = %d GROUP BY message_id) AS l ON m.id = l.message_id",
model.NewServiceMessageLog().TableName(), model.DeleteStatusForNot)).
Joins(fmt.Sprintf("LEFT JOIN %s AS t ON m.tenant_id = t.id", model.NewSysTenant().TableName()))
Joins(fmt.Sprintf("LEFT JOIN %s AS t ON m.tenant_id = t.id", model.NewSysTenant().TableName())).
Where("m.is_deleted = ?", model.DeleteStatusForNot)
if len(where) > 0 {
for _, v := range where {