This commit is contained in:
xzb 2023-11-28 13:30:49 +08:00
commit b28cda6837
2 changed files with 11 additions and 3 deletions

View File

@ -22,6 +22,8 @@ type PublishedDto struct {
Category string `json:"category" form:"category"`
PublishAt JsonTime `json:"publishAt" form:"publishAt" time_format:"2006-01-02 15:04:05"`
Status int32 `json:"status" form:"status"`
Version int32 `json:"version" form:"version"`
Publisher string `json:"publisher" form:"publisher"`
}
type PublishReqDto struct {

View File

@ -15,9 +15,15 @@ var publishMapMutex sync.Mutex
// 查找发布地图分页信息
func PageQueryPublished(req *dto.PagePublishedReqDto) *dto.PageDto {
p, pv := dbquery.Published, dbquery.PublishedVersion
where := p.Select(p.ID, p.Code.As("name"), p.Type, p.Category, p.Status, pv.Note, pv.PublishAt).
LeftJoin(pv, p.DataID.EqCol(pv.ID)).Order(pv.PublishAt.Desc())
p, pv, u := dbquery.Published, dbquery.PublishedVersion, dbquery.User
where := p.
Select(
p.ID, p.Code.As("name"), p.Type, p.Category, p.Status,
pv.Note, pv.PublishAt, pv.Version, u.Name.As("publisher"),
).
LeftJoin(pv, p.DataID.EqCol(pv.ID)).
LeftJoin(u, pv.UserID.EqCol(u.ID)).
Order(pv.PublishAt.Desc())
if req.Name != "" {
where = where.Where(p.Code.Like(fmt.Sprintf("%%%s%%", req.Name)))
}