作者 yangfu
... ... @@ -262,7 +262,7 @@ type (
Page int `json:"page"`
Size int `json:"size"`
CompanyId int64 `json:",optional"` //
TopId int64 `json:"topId"` // 评论的顶层ID
TopId int64 `json:"topId,optional"` // 评论的顶层ID
FromUser string `json:"fromUser,optional"` // 用户
Show int `json:"show,optional"` // 显示状态
BeginTime int64 `json:"beginTime,optional"` // 填写评论的开始时间
... ...
... ... @@ -29,7 +29,7 @@ func (l *SystemListAticleCommentLogic) SystemListAticleComment(req *types.System
var conn = l.svcCtx.DefaultDBConn()
cnt, commentList, err := l.svcCtx.ArticleCommentRepository.CustomSearchBy(l.ctx, conn, req.CompanyId, req.Page, req.Size,
req.TopId, req.ArticleTitle, req.Content, req.FromUser, req.Show,
req.TopId, req.ArticleTitle, req.Content, req.FromUser, req.Show, [2]int64{req.BeginTime, req.EndTime},
)
if err != nil {
return nil, xerr.NewErrMsgErr("获取评论列表失败", err)
... ...
... ... @@ -151,6 +151,18 @@ func (l *SystemUserInfoLogic) initSystemData(companyId int64) error {
Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0},
Name: "中机会低风险", Category: "机会风险", Remark: "解决问题多手准备", SortBy: 10,
},
{
Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0},
Name: "小机会高风险", Category: "机会风险", Remark: "有空看看", SortBy: 11,
},
{
Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0},
Name: "小机会中风险", Category: "机会风险", Remark: "持续监控做好控制", SortBy: 12,
},
{
Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0},
Name: "小机会低风险", Category: "机会风险", Remark: "全员警戒马上解决", SortBy: 13,
},
}
err = l.svcCtx.ArticleTagRepository.CreateInBatches(l.ctx, conn, articleTags)
if err != nil {
... ...
... ... @@ -179,7 +179,7 @@ type SystemListCommentRequest struct {
Page int `json:"page"`
Size int `json:"size"`
CompanyId int64 `json:",optional"` //
TopId int64 `json:"topId"` // 评论的顶层ID
TopId int64 `json:"topId,optional"` // 评论的顶层ID
FromUser string `json:"fromUser,optional"` // 用户
Show int `json:"show,optional"` // 显示状态
BeginTime int64 `json:"beginTime,optional"` // 填写评论的开始时间
... ...
... ... @@ -330,7 +330,7 @@ func (repository *ArticleCommentRepository) Top5Comment(ctx context.Context, con
}
func (repository *ArticleCommentRepository) CustomSearchBy(ctx context.Context, conn transaction.Conn, companyId int64, page int, size int,
topId int64, articleTitle string, contentLike string, fromUserName string, show int) (int, []*domain.ArticleCommentShow, error) {
topId int64, articleTitle string, contentLike string, fromUserName string, show int, createdAtRange [2]int64) (int, []*domain.ArticleCommentShow, error) {
if size <= 0 {
size = 20
... ... @@ -364,6 +364,17 @@ func (repository *ArticleCommentRepository) CustomSearchBy(ctx context.Context,
where += ` and article_comment."top_id"= ? `
condition = append(condition, topId)
}
if createdAtRange[0] > 0 {
where += ` and article_comment.created_at >=? `
condition = append(condition, createdAtRange[0])
}
if createdAtRange[1] > 0 {
where += ` and article_comment.created_at <=? `
condition = append(condition, createdAtRange[1])
}
countSql := `select
count(*)
from article_comment
... ...
... ... @@ -77,5 +77,5 @@ type ArticleCommentRepository interface {
Top5Comment(ctx context.Context, conn transaction.Conn, companyId int64, articleId int64) ([]*ArticleComment, error)
// 特定的查询
CustomSearchBy(ctx context.Context, conn transaction.Conn, companyId int64, page int, size int,
topId int64, articleTitle string, contentLike string, fromUserName string, show int) (int, []*ArticleCommentShow, error)
topId int64, articleTitle string, contentLike string, fromUserName string, show int, createdAtRange [2]int64) (int, []*ArticleCommentShow, error)
}
... ...