Merge remote-tracking branch 'origin/dev' into dev
正在显示
11 个修改的文件
包含
217 行增加
和
23 行删除
| @@ -95,10 +95,12 @@ type ( | @@ -95,10 +95,12 @@ type ( | ||
| 95 | // 小程序获取文章的评论列表 | 95 | // 小程序获取文章的评论列表 |
| 96 | type ( | 96 | type ( |
| 97 | MiniListArticleCommentRequest { | 97 | MiniListArticleCommentRequest { |
| 98 | - Page int64 `json:"page"` | ||
| 99 | - Size int64 `json:"size"` | 98 | + Page int `json:"page"` |
| 99 | + Size int `json:"size"` | ||
| 100 | CompanyId int64 `json:",optional"` | 100 | CompanyId int64 `json:",optional"` |
| 101 | - SectionId int64 `json:"sectionId"` | 101 | + UserId int64 `json:",optional"` |
| 102 | + ArticleId int64 `json:"articleId"` | ||
| 103 | + SectionId int64 `json:"sectionId,optional"` | ||
| 102 | } | 104 | } |
| 103 | MiniListArticleCommentResponse { | 105 | MiniListArticleCommentResponse { |
| 104 | Total int64 `json:"total"` | 106 | Total int64 `json:"total"` |
| @@ -14,14 +14,19 @@ info( | @@ -14,14 +14,19 @@ info( | ||
| 14 | jwt: SystemAuth | 14 | jwt: SystemAuth |
| 15 | ) | 15 | ) |
| 16 | service Core { | 16 | service Core { |
| 17 | + @doc "角色详情" | ||
| 17 | @handler systemGetRole | 18 | @handler systemGetRole |
| 18 | get /system/role/:id (RoleGetRequest) returns (RoleGetResponse) | 19 | get /system/role/:id (RoleGetRequest) returns (RoleGetResponse) |
| 20 | + @doc "角色新增" | ||
| 19 | @handler systemSaveRole | 21 | @handler systemSaveRole |
| 20 | post /system/role (RoleSaveRequest) returns (RoleSaveResponse) | 22 | post /system/role (RoleSaveRequest) returns (RoleSaveResponse) |
| 23 | + @doc "角色删除" | ||
| 21 | @handler systemDeleteRole | 24 | @handler systemDeleteRole |
| 22 | delete /system/role/:id (RoleDeleteRequest) returns (RoleDeleteResponse) | 25 | delete /system/role/:id (RoleDeleteRequest) returns (RoleDeleteResponse) |
| 26 | + @doc "角色更新" | ||
| 23 | @handler systemUpdateRole | 27 | @handler systemUpdateRole |
| 24 | put /system/role/:id (RoleUpdateRequest) returns (RoleUpdateResponse) | 28 | put /system/role/:id (RoleUpdateRequest) returns (RoleUpdateResponse) |
| 29 | + @doc "角色列表搜索" | ||
| 25 | @handler systemSearchRole | 30 | @handler systemSearchRole |
| 26 | post /system/role/search (RoleSearchRequest) returns (RoleSearchResponse) | 31 | post /system/role/search (RoleSearchRequest) returns (RoleSearchResponse) |
| 27 | } | 32 | } |
| @@ -22,6 +22,7 @@ func MiniGetArticleCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | @@ -22,6 +22,7 @@ func MiniGetArticleCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 22 | l := comment.NewMiniGetArticleCommentLogic(r.Context(), svcCtx) | 22 | l := comment.NewMiniGetArticleCommentLogic(r.Context(), svcCtx) |
| 23 | token := contextdata.GetUserTokenFromCtx(r.Context()) | 23 | token := contextdata.GetUserTokenFromCtx(r.Context()) |
| 24 | req.CompanyId = token.CompanyId | 24 | req.CompanyId = token.CompanyId |
| 25 | + req.UserId = token.UserId | ||
| 25 | resp, err := l.MiniGetArticleComment(&req) | 26 | resp, err := l.MiniGetArticleComment(&req) |
| 26 | result.HttpResult(r, w, resp, err) | 27 | result.HttpResult(r, w, resp, err) |
| 27 | } | 28 | } |
| @@ -21,6 +21,7 @@ func MiniListArticleCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc | @@ -21,6 +21,7 @@ func MiniListArticleCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc | ||
| 21 | l := comment.NewMiniListArticleCommentLogic(r.Context(), svcCtx) | 21 | l := comment.NewMiniListArticleCommentLogic(r.Context(), svcCtx) |
| 22 | token := contextdata.GetUserTokenFromCtx(r.Context()) | 22 | token := contextdata.GetUserTokenFromCtx(r.Context()) |
| 23 | req.CompanyId = token.CompanyId | 23 | req.CompanyId = token.CompanyId |
| 24 | + req.UserId = token.UserId | ||
| 24 | resp, err := l.MiniListArticleComment(&req) | 25 | resp, err := l.MiniListArticleComment(&req) |
| 25 | result.HttpResult(r, w, resp, err) | 26 | result.HttpResult(r, w, resp, err) |
| 26 | } | 27 | } |
| @@ -11,6 +11,7 @@ import ( | @@ -11,6 +11,7 @@ import ( | ||
| 11 | 11 | ||
| 12 | "text/template" | 12 | "text/template" |
| 13 | 13 | ||
| 14 | + "github.com/samber/lo" | ||
| 14 | "github.com/zeromicro/go-zero/core/logx" | 15 | "github.com/zeromicro/go-zero/core/logx" |
| 15 | ) | 16 | ) |
| 16 | 17 | ||
| @@ -49,13 +50,12 @@ func (l *MiniCreateArticleCommentLogic) MiniCreateArticleComment(req *types.Mini | @@ -49,13 +50,12 @@ func (l *MiniCreateArticleCommentLogic) MiniCreateArticleComment(req *types.Mini | ||
| 49 | return nil, xerr.NewErrMsg("没有评论权限") | 50 | return nil, xerr.NewErrMsg("没有评论权限") |
| 50 | } | 51 | } |
| 51 | //查看评论权限, | 52 | //查看评论权限, |
| 52 | - //TODO 临时注释 | ||
| 53 | - // if len(articleInfo.WhoReview) > 0 { | ||
| 54 | - // ok := lo.IndexOf(articleInfo.WhoReview, req.FromUserId) | ||
| 55 | - // if ok < 0 { | ||
| 56 | - // return nil, xerr.NewErrMsg("没有评论权限") | ||
| 57 | - // } | ||
| 58 | - // } | 53 | + if len(articleInfo.WhoReview) > 0 { |
| 54 | + ok := lo.IndexOf(articleInfo.WhoReview, req.FromUserId) | ||
| 55 | + if ok < 0 { | ||
| 56 | + return nil, xerr.NewErrMsg("没有评论权限") | ||
| 57 | + } | ||
| 58 | + } | ||
| 59 | // 对段落进行评论 | 59 | // 对段落进行评论 |
| 60 | var selctionInfo *domain.ArticleSection | 60 | var selctionInfo *domain.ArticleSection |
| 61 | if req.SectionId > 0 { | 61 | if req.SectionId > 0 { |
| @@ -5,6 +5,8 @@ import ( | @@ -5,6 +5,8 @@ import ( | ||
| 5 | 5 | ||
| 6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | 6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" |
| 7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | 7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" |
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
| 9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | ||
| 8 | 10 | ||
| 9 | "github.com/zeromicro/go-zero/core/logx" | 11 | "github.com/zeromicro/go-zero/core/logx" |
| 10 | ) | 12 | ) |
| @@ -24,7 +26,166 @@ func NewMiniListArticleCommentLogic(ctx context.Context, svcCtx *svc.ServiceCont | @@ -24,7 +26,166 @@ func NewMiniListArticleCommentLogic(ctx context.Context, svcCtx *svc.ServiceCont | ||
| 24 | } | 26 | } |
| 25 | 27 | ||
| 26 | func (l *MiniListArticleCommentLogic) MiniListArticleComment(req *types.MiniListArticleCommentRequest) (resp *types.MiniListArticleCommentResponse, err error) { | 28 | func (l *MiniListArticleCommentLogic) MiniListArticleComment(req *types.MiniListArticleCommentRequest) (resp *types.MiniListArticleCommentResponse, err error) { |
| 27 | - // todo: add your logic here and delete this line | 29 | + // 先获取最顶层的评论 |
| 30 | + var conn = l.svcCtx.DefaultDBConn() | ||
| 31 | + if req.Page > 40 { | ||
| 32 | + req.Page = 40 | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + queryOption := domain.NewQueryOptions(). | ||
| 36 | + WithOffsetLimit(req.Page, req.Size). | ||
| 37 | + MustWithKV("topId", 0). | ||
| 38 | + MustWithKV("articleId", req.ArticleId). | ||
| 39 | + MustWithKV("sectionId", req.SectionId). | ||
| 40 | + MustWithKV("show", domain.CommentShowEnable). | ||
| 41 | + MustWithKV("companyId", req.CompanyId) | ||
| 42 | + | ||
| 43 | + cnt, commentList, err := l.svcCtx.ArticleCommentRepository.Find(l.ctx, conn, queryOption) | ||
| 44 | + if err != nil { | ||
| 45 | + return nil, xerr.NewErrMsgErr("获取评论信息失败", err) | ||
| 46 | + } | ||
| 47 | + if cnt == 0 { | ||
| 48 | + resp = &types.MiniListArticleCommentResponse{ | ||
| 49 | + Total: 0, | ||
| 50 | + List: make([]types.ArticleCommentAndReply, 0), | ||
| 51 | + } | ||
| 52 | + return | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + queryOption = domain.NewQueryOptions().WithFindOnly(). | ||
| 56 | + MustWithKV("articleId", req.ArticleId). | ||
| 57 | + MustWithKV("userId", req.UserId) | ||
| 58 | + // 获取我点赞的评论 | ||
| 59 | + _, userFlagList, err := l.svcCtx.UserLoveFlagRepository.Find(l.ctx, conn, queryOption) | ||
| 60 | + if err != nil { | ||
| 61 | + return nil, xerr.NewErrMsgErr("获取评论信息失败", err) | ||
| 62 | + } | ||
| 63 | + // 我点赞的 | ||
| 64 | + flagMap := map[int64]struct{}{} | ||
| 65 | + for _, val := range userFlagList { | ||
| 66 | + flagMap[val.CommentId] = struct{}{} | ||
| 67 | + } | ||
| 68 | + resp = &types.MiniListArticleCommentResponse{ | ||
| 69 | + Total: cnt, | ||
| 70 | + List: make([]types.ArticleCommentAndReply, len(commentList)), | ||
| 71 | + } | ||
| 72 | + // 获取回复的评论 | ||
| 73 | + for i, val := range commentList { | ||
| 74 | + item := types.ArticleCommentAndReply{ | ||
| 75 | + Comment: types.ArticleCommentItem{ | ||
| 76 | + Id: val.Id, | ||
| 77 | + Pid: val.Pid, | ||
| 78 | + TopId: val.TopId, | ||
| 79 | + ArtitcleId: val.ArticleId, | ||
| 80 | + SectionId: val.SectionId, | ||
| 81 | + FromUserId: val.FromUserId, | ||
| 82 | + FromUser: types.CommentAuthor{ | ||
| 83 | + Id: val.FromUser.Id, | ||
| 84 | + Name: val.FromUser.Name, | ||
| 85 | + Avatar: val.FromUser.Avatar, | ||
| 86 | + Position: val.FromUser.Position, | ||
| 87 | + Company: val.FromUser.Company, | ||
| 88 | + }, | ||
| 89 | + ToUserId: val.ToUserId, | ||
| 90 | + ToUser: types.CommentAuthor{ | ||
| 91 | + Id: val.ToUser.Id, | ||
| 92 | + Name: val.ToUser.Name, | ||
| 93 | + Avatar: val.ToUser.Avatar, | ||
| 94 | + Position: val.ToUser.Position, | ||
| 95 | + Company: val.ToUser.Company, | ||
| 96 | + }, | ||
| 97 | + SectionContent: val.SectionContent, | ||
| 98 | + CountReply: val.CountReply, | ||
| 99 | + CountUserLove: val.CountUserLove, | ||
| 100 | + CountAdminLove: val.CountAdminLove, | ||
| 101 | + AtWho: []types.CommentAtWho{}, | ||
| 102 | + CreatedAt: val.CreatedAt, | ||
| 103 | + MeLoveFlag: 0, | ||
| 104 | + }, | ||
| 105 | + Reply: []types.ArticleCommentItem{}, | ||
| 106 | + TotalReply: int64(val.CountReply), | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + if _, ok := flagMap[val.Id]; ok { | ||
| 110 | + item.Comment.MeLoveFlag = 1 | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + for _, val2 := range val.AtWho { | ||
| 114 | + item.Comment.AtWho = append(item.Comment.AtWho, types.CommentAtWho{ | ||
| 115 | + Id: val2.Id, | ||
| 116 | + Name: val2.Name, | ||
| 117 | + }) | ||
| 118 | + } | ||
| 28 | 119 | ||
| 29 | - return | 120 | + //获取回复的评论 |
| 121 | + cntReply, reply := l.listCommentReply(item.Comment.Id, flagMap) | ||
| 122 | + | ||
| 123 | + resp.List[i] = item | ||
| 124 | + resp.List[i].Reply = reply | ||
| 125 | + resp.List[i].TotalReply = cntReply | ||
| 126 | + } | ||
| 127 | + return resp, nil | ||
| 128 | +} | ||
| 129 | + | ||
| 130 | +// listCommentReply | ||
| 131 | +func (l *MiniListArticleCommentLogic) listCommentReply(commentId int64, loveFlagMap map[int64]struct{}) (cnt int64, replyList []types.ArticleCommentItem) { | ||
| 132 | + var conn = l.svcCtx.DefaultDBConn() | ||
| 133 | + queryOption := domain.NewQueryOptions(). | ||
| 134 | + WithOffsetLimit(1, 2). | ||
| 135 | + MustWithKV("topId", commentId). | ||
| 136 | + MustWithKV("show", domain.CommentShowEnable) | ||
| 137 | + | ||
| 138 | + cnt, commentList, err := l.svcCtx.ArticleCommentRepository.Find(l.ctx, conn, queryOption) | ||
| 139 | + if err != nil { | ||
| 140 | + return cnt, []types.ArticleCommentItem{} | ||
| 141 | + } | ||
| 142 | + if cnt == 0 { | ||
| 143 | + replyList = []types.ArticleCommentItem{} | ||
| 144 | + return cnt, replyList | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + for _, val := range commentList { | ||
| 148 | + item := types.ArticleCommentItem{ | ||
| 149 | + Id: val.Id, | ||
| 150 | + Pid: val.Pid, | ||
| 151 | + TopId: val.TopId, | ||
| 152 | + ArtitcleId: val.ArticleId, | ||
| 153 | + SectionId: val.SectionId, | ||
| 154 | + FromUserId: val.FromUserId, | ||
| 155 | + FromUser: types.CommentAuthor{ | ||
| 156 | + Id: val.FromUser.Id, | ||
| 157 | + Name: val.FromUser.Name, | ||
| 158 | + Avatar: val.FromUser.Avatar, | ||
| 159 | + Position: val.FromUser.Position, | ||
| 160 | + Company: val.FromUser.Company, | ||
| 161 | + }, | ||
| 162 | + ToUserId: val.ToUserId, | ||
| 163 | + ToUser: types.CommentAuthor{ | ||
| 164 | + Id: val.ToUser.Id, | ||
| 165 | + Name: val.ToUser.Name, | ||
| 166 | + Avatar: val.ToUser.Avatar, | ||
| 167 | + Position: val.ToUser.Position, | ||
| 168 | + Company: val.ToUser.Company, | ||
| 169 | + }, | ||
| 170 | + SectionContent: val.SectionContent, | ||
| 171 | + CountReply: val.CountReply, | ||
| 172 | + CountUserLove: val.CountUserLove, | ||
| 173 | + CountAdminLove: val.CountAdminLove, | ||
| 174 | + AtWho: []types.CommentAtWho{}, | ||
| 175 | + CreatedAt: val.CreatedAt, | ||
| 176 | + MeLoveFlag: 0, | ||
| 177 | + } | ||
| 178 | + | ||
| 179 | + if _, ok := loveFlagMap[val.Id]; ok { | ||
| 180 | + item.MeLoveFlag = 1 | ||
| 181 | + } | ||
| 182 | + for _, val2 := range val.AtWho { | ||
| 183 | + item.AtWho = append(item.AtWho, types.CommentAtWho{ | ||
| 184 | + Id: val2.Id, | ||
| 185 | + Name: val2.Name, | ||
| 186 | + }) | ||
| 187 | + } | ||
| 188 | + replyList = append(replyList, item) | ||
| 189 | + } | ||
| 190 | + return cnt, replyList | ||
| 30 | } | 191 | } |
| @@ -33,9 +33,10 @@ func (l *MiniUserDepartmentUsersLogic) MiniUserDepartmentUsers(req *types.MiniUs | @@ -33,9 +33,10 @@ func (l *MiniUserDepartmentUsersLogic) MiniUserDepartmentUsers(req *types.MiniUs | ||
| 33 | userToken = contextdata.GetUserTokenFromCtx(l.ctx) | 33 | userToken = contextdata.GetUserTokenFromCtx(l.ctx) |
| 34 | users []*domain.User | 34 | users []*domain.User |
| 35 | departments []*domain.Department | 35 | departments []*domain.Department |
| 36 | + groups = make([]DepartmentUser, 0) | ||
| 36 | ) | 37 | ) |
| 37 | resp = map[string]interface{}{ | 38 | resp = map[string]interface{}{ |
| 38 | - "list": make([]DepartmentUser, 0), | 39 | + "list": groups, |
| 39 | } | 40 | } |
| 40 | _, departments, err = l.svcCtx.DepartmentRepository.Find(l.ctx, conn, domain.IndexCompanyId(userToken.CompanyId)().WithFindOnly()) | 41 | _, departments, err = l.svcCtx.DepartmentRepository.Find(l.ctx, conn, domain.IndexCompanyId(userToken.CompanyId)().WithFindOnly()) |
| 41 | if err != nil { | 42 | if err != nil { |
| @@ -58,13 +59,17 @@ func (l *MiniUserDepartmentUsersLogic) MiniUserDepartmentUsers(req *types.MiniUs | @@ -58,13 +59,17 @@ func (l *MiniUserDepartmentUsersLogic) MiniUserDepartmentUsers(req *types.MiniUs | ||
| 58 | } | 59 | } |
| 59 | if lo.Contains(user.Departments, item.Id) && !groupUserSet.Contains(user.Id) { | 60 | if lo.Contains(user.Departments, item.Id) && !groupUserSet.Contains(user.Id) { |
| 60 | group.Users = append(group.Users, &domain.User{ | 61 | group.Users = append(group.Users, &domain.User{ |
| 61 | - Id: user.Id, | ||
| 62 | - Name: user.Name, | 62 | + Id: user.Id, |
| 63 | + Name: user.Name, | ||
| 64 | + PinYinName: user.PinYinName, | ||
| 63 | }) | 65 | }) |
| 64 | } | 66 | } |
| 65 | } | 67 | } |
| 68 | + groups = append(groups, group) | ||
| 66 | }) | 69 | }) |
| 67 | - | 70 | + resp = map[string]interface{}{ |
| 71 | + "list": groups, | ||
| 72 | + } | ||
| 68 | return | 73 | return |
| 69 | } | 74 | } |
| 70 | 75 |
| @@ -2,6 +2,7 @@ package user | @@ -2,6 +2,7 @@ package user | ||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "context" | 4 | "context" |
| 5 | + "github.com/samber/lo" | ||
| 5 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" | 6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" |
| 6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | 7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" |
| 7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | 8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" |
| @@ -33,6 +34,9 @@ func (l *SystemUserAccountEnableLogic) SystemUserAccountEnable(req *types.System | @@ -33,6 +34,9 @@ func (l *SystemUserAccountEnableLogic) SystemUserAccountEnable(req *types.System | ||
| 33 | users []*domain.User | 34 | users []*domain.User |
| 34 | userToken = contextdata.GetUserTokenFromCtx(l.ctx) | 35 | userToken = contextdata.GetUserTokenFromCtx(l.ctx) |
| 35 | ) | 36 | ) |
| 37 | + if !lo.Contains([]int{domain.UserEnable, domain.UserDisable}, req.Status) { | ||
| 38 | + return nil, xerr.NewErrMsg("启用状态有误") | ||
| 39 | + } | ||
| 36 | if _, users, err = l.svcCtx.UserRepository.Find(l.ctx, conn, domain.IndexCompanyId(userToken.CompanyId)().MustWithKV("ids", req.UserIds).WithFindOnly()); err != nil { | 40 | if _, users, err = l.svcCtx.UserRepository.Find(l.ctx, conn, domain.IndexCompanyId(userToken.CompanyId)().MustWithKV("ids", req.UserIds).WithFindOnly()); err != nil { |
| 37 | return nil, xerr.NewErrMsgErr("公司不存在", err) | 41 | return nil, xerr.NewErrMsgErr("公司不存在", err) |
| 38 | } | 42 | } |
| @@ -50,5 +54,6 @@ func (l *SystemUserAccountEnableLogic) SystemUserAccountEnable(req *types.System | @@ -50,5 +54,6 @@ func (l *SystemUserAccountEnableLogic) SystemUserAccountEnable(req *types.System | ||
| 50 | }, true); err != nil { | 54 | }, true); err != nil { |
| 51 | return nil, xerr.NewErrMsgErr("更新启用状态失败", err) | 55 | return nil, xerr.NewErrMsgErr("更新启用状态失败", err) |
| 52 | } | 56 | } |
| 57 | + resp = &types.SystemUserAccountEnableResponse{} | ||
| 53 | return | 58 | return |
| 54 | } | 59 | } |
| @@ -50,10 +50,12 @@ type MiniCreateArticleCommentResponse struct { | @@ -50,10 +50,12 @@ type MiniCreateArticleCommentResponse struct { | ||
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | type MiniListArticleCommentRequest struct { | 52 | type MiniListArticleCommentRequest struct { |
| 53 | - Page int64 `json:"page"` | ||
| 54 | - Size int64 `json:"size"` | 53 | + Page int `json:"page"` |
| 54 | + Size int `json:"size"` | ||
| 55 | CompanyId int64 `json:",optional"` | 55 | CompanyId int64 `json:",optional"` |
| 56 | - SectionId int64 `json:"sectionId"` | 56 | + UserId int64 `json:",optional"` |
| 57 | + ArticleId int64 `json:"articleId"` | ||
| 58 | + SectionId int64 `json:"sectionId,optional"` | ||
| 57 | } | 59 | } |
| 58 | 60 | ||
| 59 | type MiniListArticleCommentResponse struct { | 61 | type MiniListArticleCommentResponse struct { |
| @@ -125,11 +125,23 @@ func (repository *ArticleCommentRepository) Find(ctx context.Context, conn trans | @@ -125,11 +125,23 @@ func (repository *ArticleCommentRepository) Find(ctx context.Context, conn trans | ||
| 125 | queryFunc := func() (interface{}, error) { | 125 | queryFunc := func() (interface{}, error) { |
| 126 | tx = tx.Model(&ms).Order("id desc") | 126 | tx = tx.Model(&ms).Order("id desc") |
| 127 | if v, ok := queryOptions["topId"]; ok { | 127 | if v, ok := queryOptions["topId"]; ok { |
| 128 | - tx = tx.Where("top_id", v) | 128 | + tx = tx.Where("top_id=?", v) |
| 129 | } | 129 | } |
| 130 | if v, ok := queryOptions["show"]; ok { | 130 | if v, ok := queryOptions["show"]; ok { |
| 131 | - tx = tx.Where("show", v) | 131 | + tx = tx.Where("show=?", v) |
| 132 | } | 132 | } |
| 133 | + if v, ok := queryOptions["articleId"]; ok { | ||
| 134 | + tx = tx.Where("article_id=?", v) | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + if v, ok := queryOptions["sectionId"]; ok { | ||
| 138 | + tx = tx.Where("section_id=?", v) | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + if v, ok := queryOptions["companyId"]; ok { | ||
| 142 | + tx = tx.Where("company_id=?", v) | ||
| 143 | + } | ||
| 144 | + | ||
| 133 | if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { | 145 | if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { |
| 134 | return dms, tx.Error | 146 | return dms, tx.Error |
| 135 | } | 147 | } |
| @@ -211,8 +211,8 @@ func (repository *UserRepository) FindDepartmentUsers(ctx context.Context, conn | @@ -211,8 +211,8 @@ func (repository *UserRepository) FindDepartmentUsers(ctx context.Context, conn | ||
| 211 | total int64 | 211 | total int64 |
| 212 | ) | 212 | ) |
| 213 | queryFunc := func() (interface{}, error) { | 213 | queryFunc := func() (interface{}, error) { |
| 214 | - tx = tx.Model(&ms).Order("id desc") | ||
| 215 | - tx.Select("id", "name", "departments") | 214 | + tx = tx.Model(&ms).Order("pin_yin_name asc") |
| 215 | + tx.Select("id", "name", "departments", "pin_yin_name") | ||
| 216 | tx.Where("company_id = ?", companyId) | 216 | tx.Where("company_id = ?", companyId) |
| 217 | tx.Where("audit_status in (?)", domain.UserAuditStatusPassed) | 217 | tx.Where("audit_status in (?)", domain.UserAuditStatusPassed) |
| 218 | tx.Where("enable = ?", domain.UserEnable) | 218 | tx.Where("enable = ?", domain.UserEnable) |
-
请 注册 或 登录 后发表评论