Merge branch 'dev' of http://gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss into dev
正在显示
3 个修改的文件
包含
7 行增加
和
5 行删除
| @@ -6,6 +6,7 @@ import ( | @@ -6,6 +6,7 @@ import ( | ||
| 6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | 6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" |
| 7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" | 7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" |
| 8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | 8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" |
| 9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | ||
| 9 | 10 | ||
| 10 | "github.com/zeromicro/go-zero/core/logx" | 11 | "github.com/zeromicro/go-zero/core/logx" |
| 11 | ) | 12 | ) |
| @@ -29,13 +30,13 @@ func (l *SystemDeleteLogic) SystemDelete(req *types.DepartmentGetRequest) (resp | @@ -29,13 +30,13 @@ func (l *SystemDeleteLogic) SystemDelete(req *types.DepartmentGetRequest) (resp | ||
| 29 | 30 | ||
| 30 | one, err := l.svcCtx.DepartmentRepository.FindOne(l.ctx, conn, req.Id) | 31 | one, err := l.svcCtx.DepartmentRepository.FindOne(l.ctx, conn, req.Id) |
| 31 | if err != nil { | 32 | if err != nil { |
| 32 | - return nil, err | 33 | + return nil, xerr.NewErrMsg("数据不存在") |
| 33 | } | 34 | } |
| 34 | 35 | ||
| 35 | // 获取公司下的所有用户 | 36 | // 获取公司下的所有用户 |
| 36 | _, users, err := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions(). | 37 | _, users, err := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions(). |
| 37 | WithFindOnly(). | 38 | WithFindOnly(). |
| 38 | - WithKV(" companyId", one.CompanyId)) | 39 | + WithKV("companyId", one.CompanyId)) |
| 39 | if err != nil { | 40 | if err != nil { |
| 40 | return nil, err | 41 | return nil, err |
| 41 | } | 42 | } |
| @@ -4,6 +4,7 @@ import ( | @@ -4,6 +4,7 @@ import ( | ||
| 4 | "context" | 4 | "context" |
| 5 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | 5 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" |
| 6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | 6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" |
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | ||
| 7 | 8 | ||
| 8 | "github.com/zeromicro/go-zero/core/logx" | 9 | "github.com/zeromicro/go-zero/core/logx" |
| 9 | ) | 10 | ) |
| @@ -26,7 +27,7 @@ func (l *SystemGetLogic) SystemGet(req *types.DepartmentGetRequest) (resp *types | @@ -26,7 +27,7 @@ func (l *SystemGetLogic) SystemGet(req *types.DepartmentGetRequest) (resp *types | ||
| 26 | var conn = l.svcCtx.DefaultDBConn() | 27 | var conn = l.svcCtx.DefaultDBConn() |
| 27 | department, err := l.svcCtx.DepartmentRepository.FindOne(l.ctx, conn, req.Id) | 28 | department, err := l.svcCtx.DepartmentRepository.FindOne(l.ctx, conn, req.Id) |
| 28 | if err != nil { | 29 | if err != nil { |
| 29 | - return nil, err | 30 | + return nil, xerr.NewErrMsg("数据不存在") |
| 30 | } | 31 | } |
| 31 | resp = &types.DepartmentGetResponse{ | 32 | resp = &types.DepartmentGetResponse{ |
| 32 | Department: types.Department{ | 33 | Department: types.Department{ |
| @@ -58,7 +58,7 @@ func (l *SystemUpdateLogic) SystemUpdate(req *types.DepartmentUpdateRequest) (re | @@ -58,7 +58,7 @@ func (l *SystemUpdateLogic) SystemUpdate(req *types.DepartmentUpdateRequest) (re | ||
| 58 | // 获取公司下的所有用户 | 58 | // 获取公司下的所有用户 |
| 59 | _, users, err := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions(). | 59 | _, users, err := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions(). |
| 60 | WithFindOnly(). | 60 | WithFindOnly(). |
| 61 | - WithKV(" companyId", one.CompanyId)) | 61 | + WithKV("companyId", one.CompanyId)) |
| 62 | if err != nil { | 62 | if err != nil { |
| 63 | return nil, err | 63 | return nil, err |
| 64 | } | 64 | } |
| @@ -83,7 +83,7 @@ func (l *SystemUpdateLogic) SystemUpdate(req *types.DepartmentUpdateRequest) (re | @@ -83,7 +83,7 @@ func (l *SystemUpdateLogic) SystemUpdate(req *types.DepartmentUpdateRequest) (re | ||
| 83 | if _, ok := newIdMap[user.Id]; ok { | 83 | if _, ok := newIdMap[user.Id]; ok { |
| 84 | var targetIndex = findIndex(user.Departments, req.Id) | 84 | var targetIndex = findIndex(user.Departments, req.Id) |
| 85 | if targetIndex == -1 { // 归属分组不存在,则新增 | 85 | if targetIndex == -1 { // 归属分组不存在,则新增 |
| 86 | - user.Departments = append(user.Departments) | 86 | + user.Departments = append(user.Departments, req.Id) |
| 87 | _, err = l.svcCtx.UserRepository.UpdateWithVersion(l.ctx, conn, user) | 87 | _, err = l.svcCtx.UserRepository.UpdateWithVersion(l.ctx, conn, user) |
| 88 | if err != nil { | 88 | if err != nil { |
| 89 | return err | 89 | return err |
-
请 注册 或 登录 后发表评论