|
|
@ -37,11 +37,11 @@ func (l *VoteLogic) GetAllVote(ctx context.Context, req *v1.VoteReq) (res *v1.Vo |
|
|
|
query += " AND v.vote_title LIKE ?" |
|
|
|
conditions = append(conditions, "%"+req.VoteTitle+"%") |
|
|
|
} |
|
|
|
if req.CreateTime != nil { |
|
|
|
if req.CreateTime != nil && !req.CreateTime.IsZero() { |
|
|
|
query += " AND DATE(v.create_time) = ?" |
|
|
|
conditions = append(conditions, req.CreateTime) |
|
|
|
} |
|
|
|
if req.DeadlineTime != nil { |
|
|
|
if req.DeadlineTime != nil && !req.DeadlineTime.IsZero() { |
|
|
|
query += " AND DATE(v.deadline_time) = ?" |
|
|
|
conditions = append(conditions, req.DeadlineTime) |
|
|
|
} |
|
|
@ -67,7 +67,6 @@ func (l *VoteLogic) GetAllVote(ctx context.Context, req *v1.VoteReq) (res *v1.Vo |
|
|
|
query += " LIMIT ?, ? " |
|
|
|
offset := (req.Page - 1) * req.PageSize |
|
|
|
conditions = append(conditions, offset, req.PageSize) |
|
|
|
|
|
|
|
err = g.DB().Ctx(ctx). |
|
|
|
Raw(query, conditions...). |
|
|
|
Scan(&res.Rows) |
|
|
|