正在显示
37 个修改的文件
包含
166 行增加
和
32 行删除
@@ -8,9 +8,11 @@ import ( | @@ -8,9 +8,11 @@ import ( | ||
8 | type CustomizeMenuDto struct { | 8 | type CustomizeMenuDto struct { |
9 | } | 9 | } |
10 | 10 | ||
11 | -func (dto *CustomizeMenuDto) LoadDto(menus []*domain.Menu, customizeMenus []*domain.CustomizeMenu) (interface{}, error) { | 11 | +func (dto *CustomizeMenuDto) LoadDto(menus []*domain.Menu, customizeMenus []*domain.CustomizeMenu, rootMenu *domain.Menu) (interface{}, error) { |
12 | var ret []interface{} | 12 | var ret []interface{} |
13 | + ret = append(ret, rootMenu) | ||
13 | menusMap := make(map[int64]*domain.Menu) | 14 | menusMap := make(map[int64]*domain.Menu) |
15 | + menusMap[rootMenu.MenuId] = rootMenu | ||
14 | for i := range menus { | 16 | for i := range menus { |
15 | menusMap[menus[i].MenuId] = menus[i] | 17 | menusMap[menus[i].MenuId] = menus[i] |
16 | } | 18 | } |
@@ -19,6 +21,7 @@ func (dto *CustomizeMenuDto) LoadDto(menus []*domain.Menu, customizeMenus []*dom | @@ -19,6 +21,7 @@ func (dto *CustomizeMenuDto) LoadDto(menus []*domain.Menu, customizeMenus []*dom | ||
19 | m := customizeMenus[i] | 21 | m := customizeMenus[i] |
20 | if menu, ok := menusMap[m.MenuId]; ok { | 22 | if menu, ok := menusMap[m.MenuId]; ok { |
21 | menu.MenuAlias = m.MenuAlias | 23 | menu.MenuAlias = m.MenuAlias |
24 | + menu.Sort = m.Sort | ||
22 | } | 25 | } |
23 | } | 26 | } |
24 | 27 |
@@ -151,9 +151,12 @@ func (companyService *CompanyService) ListCompanyCustomizeMenus(listCompanyCusto | @@ -151,9 +151,12 @@ func (companyService *CompanyService) ListCompanyCustomizeMenus(listCompanyCusto | ||
151 | menuRepository = value | 151 | menuRepository = value |
152 | } | 152 | } |
153 | queryOptions := common.SimpleStructToMap(listCompanyCustomizeMenusCommand) | 153 | queryOptions := common.SimpleStructToMap(listCompanyCustomizeMenusCommand) |
154 | + var menuCategory *domain.Menu | ||
154 | if m, e := menuRepository.FindOne(map[string]interface{}{"code": listCompanyCustomizeMenusCommand.MenuCategory}); e == nil && m != nil { | 155 | if m, e := menuRepository.FindOne(map[string]interface{}{"code": listCompanyCustomizeMenusCommand.MenuCategory}); e == nil && m != nil { |
155 | queryOptions["category"] = strconv.Itoa(int(m.MenuId)) | 156 | queryOptions["category"] = strconv.Itoa(int(m.MenuId)) |
157 | + menuCategory = m | ||
156 | } | 158 | } |
159 | + queryOptions["menuTypeIn"] = []string{"catalog", "menu"} | ||
157 | _, menus, err := menuRepository.Find(queryOptions) | 160 | _, menus, err := menuRepository.Find(queryOptions) |
158 | if err != nil { | 161 | if err != nil { |
159 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 162 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
@@ -171,7 +174,7 @@ func (companyService *CompanyService) ListCompanyCustomizeMenus(listCompanyCusto | @@ -171,7 +174,7 @@ func (companyService *CompanyService) ListCompanyCustomizeMenus(listCompanyCusto | ||
171 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 174 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
172 | } | 175 | } |
173 | customizeMenuDto := dto.CustomizeMenuDto{} | 176 | customizeMenuDto := dto.CustomizeMenuDto{} |
174 | - ret, _ := customizeMenuDto.LoadDto(menus, customizeMenus) | 177 | + ret, _ := customizeMenuDto.LoadDto(menus, customizeMenus, menuCategory) |
175 | 178 | ||
176 | if err := transactionContext.CommitTransaction(); err != nil { | 179 | if err := transactionContext.CommitTransaction(); err != nil { |
177 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 180 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
@@ -2,6 +2,7 @@ package command | @@ -2,6 +2,7 @@ package command | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain" | ||
5 | "reflect" | 6 | "reflect" |
6 | "strings" | 7 | "strings" |
7 | 8 | ||
@@ -9,6 +10,7 @@ import ( | @@ -9,6 +10,7 @@ import ( | ||
9 | ) | 10 | ) |
10 | 11 | ||
11 | type CreateOrgCommand struct { | 12 | type CreateOrgCommand struct { |
13 | + OperateInfo *domain.OperateInfo `json:"-"` | ||
12 | // 企业id | 14 | // 企业id |
13 | CompanyId int64 `cname:"企业id" json:"companyId" valid:"Required"` | 15 | CompanyId int64 `cname:"企业id" json:"companyId" valid:"Required"` |
14 | // 组织编码 | 16 | // 组织编码 |
@@ -2,6 +2,7 @@ package command | @@ -2,6 +2,7 @@ package command | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain" | ||
5 | "reflect" | 6 | "reflect" |
6 | "strings" | 7 | "strings" |
7 | 8 | ||
@@ -9,6 +10,7 @@ import ( | @@ -9,6 +10,7 @@ import ( | ||
9 | ) | 10 | ) |
10 | 11 | ||
11 | type EnableOrgCommand struct { | 12 | type EnableOrgCommand struct { |
13 | + OperateInfo *domain.OperateInfo `json:"-"` | ||
12 | // 组织ID | 14 | // 组织ID |
13 | OrgId int64 `cname:"组织ID" json:"orgId" valid:"Required"` | 15 | OrgId int64 `cname:"组织ID" json:"orgId" valid:"Required"` |
14 | // 组织状态 1:启用 2:禁用 3.删除 | 16 | // 组织状态 1:启用 2:禁用 3.删除 |
@@ -2,6 +2,7 @@ package command | @@ -2,6 +2,7 @@ package command | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain" | ||
5 | "reflect" | 6 | "reflect" |
6 | "strings" | 7 | "strings" |
7 | 8 | ||
@@ -9,6 +10,7 @@ import ( | @@ -9,6 +10,7 @@ import ( | ||
9 | ) | 10 | ) |
10 | 11 | ||
11 | type RemoveOrgCommand struct { | 12 | type RemoveOrgCommand struct { |
13 | + OperateInfo *domain.OperateInfo `json:"-"` | ||
12 | // 组织ID | 14 | // 组织ID |
13 | OrgId int64 `cname:"组织ID" json:"orgId,string" valid:"Required"` | 15 | OrgId int64 `cname:"组织ID" json:"orgId,string" valid:"Required"` |
14 | } | 16 | } |
@@ -10,10 +10,11 @@ import ( | @@ -10,10 +10,11 @@ import ( | ||
10 | ) | 10 | ) |
11 | 11 | ||
12 | type UpdateOrgCommand struct { | 12 | type UpdateOrgCommand struct { |
13 | + OperateInfo *domain.OperateInfo `json:"-"` | ||
13 | // 用户ID | 14 | // 用户ID |
14 | - UserId int64 `cname:"用户ID" json:"userId" valid:"Required"` | 15 | + UserId int64 `cname:"用户ID" json:"userId"` |
15 | // 组织ID | 16 | // 组织ID |
16 | - OrgId int64 `cname:"组织ID" json:"orgId,string"` | 17 | + OrgId int64 `cname:"组织ID" json:"orgId` |
17 | // 组织编码 | 18 | // 组织编码 |
18 | OrgCode string `cname:"组织编码" json:"orgCode"` | 19 | OrgCode string `cname:"组织编码" json:"orgCode"` |
19 | // 组织名称 | 20 | // 组织名称 |
@@ -2,6 +2,7 @@ package query | @@ -2,6 +2,7 @@ package query | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain" | ||
5 | "reflect" | 6 | "reflect" |
6 | "strings" | 7 | "strings" |
7 | 8 | ||
@@ -9,6 +10,7 @@ import ( | @@ -9,6 +10,7 @@ import ( | ||
9 | ) | 10 | ) |
10 | 11 | ||
11 | type GetOrgQuery struct { | 12 | type GetOrgQuery struct { |
13 | + OperateInfo *domain.OperateInfo `json:"-"` | ||
12 | // 组织ID | 14 | // 组织ID |
13 | OrgId int64 `cname:"组织ID" json:"orgId" valid:"Required"` | 15 | OrgId int64 `cname:"组织ID" json:"orgId" valid:"Required"` |
14 | } | 16 | } |
@@ -2,6 +2,7 @@ package query | @@ -2,6 +2,7 @@ package query | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain" | ||
5 | "reflect" | 6 | "reflect" |
6 | "strings" | 7 | "strings" |
7 | 8 | ||
@@ -9,6 +10,7 @@ import ( | @@ -9,6 +10,7 @@ import ( | ||
9 | ) | 10 | ) |
10 | 11 | ||
11 | type GetOrgSubDepartmentQuery struct { | 12 | type GetOrgSubDepartmentQuery struct { |
13 | + OperateInfo *domain.OperateInfo `json:"-"` | ||
12 | // 组织ID | 14 | // 组织ID |
13 | OrgId int64 `cname:"组织ID" json:"orgId,string" valid:"Required"` | 15 | OrgId int64 `cname:"组织ID" json:"orgId,string" valid:"Required"` |
14 | // 获取所有子节点 (1:获取当前下级子节点 2:获取当前下级所有子节点) | 16 | // 获取所有子节点 (1:获取当前下级子节点 2:获取当前下级所有子节点) |
@@ -2,6 +2,7 @@ package query | @@ -2,6 +2,7 @@ package query | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain" | ||
5 | "reflect" | 6 | "reflect" |
6 | "strings" | 7 | "strings" |
7 | 8 | ||
@@ -9,6 +10,7 @@ import ( | @@ -9,6 +10,7 @@ import ( | ||
9 | ) | 10 | ) |
10 | 11 | ||
11 | type ListOrgQuery struct { | 12 | type ListOrgQuery struct { |
13 | + OperateInfo *domain.OperateInfo `json:"-"` | ||
12 | // 查询偏离量 | 14 | // 查询偏离量 |
13 | Offset int `cname:"查询偏离量" json:"offset,omitempty"` | 15 | Offset int `cname:"查询偏离量" json:"offset,omitempty"` |
14 | // 查询限制 | 16 | // 查询限制 |
@@ -258,13 +258,16 @@ func (orgService *OrgService) UpdateOrg(updateOrgCommand *command.UpdateOrgComma | @@ -258,13 +258,16 @@ func (orgService *OrgService) UpdateOrg(updateOrgCommand *command.UpdateOrgComma | ||
258 | } | 258 | } |
259 | 259 | ||
260 | //判断当前组织内是否唯一 组织编码、组织名称 | 260 | //判断当前组织内是否唯一 组织编码、组织名称 |
261 | - if findOne, err := orgRepository.FindOne(map[string]interface{}{"companyId": org.CompanyId, "parentId": updateOrgCommand.ParentId, "orgName": updateOrgCommand.OrgName, "notEqualOrgId": org.OrgId}); err == nil || findOne != nil { | ||
262 | - return nil, fmt.Errorf("部门名称重复") | 261 | + if org.OrgName != updateOrgCommand.OrgName { |
262 | + if findOne, err := orgRepository.FindOne(map[string]interface{}{"companyId": updateOrgCommand.OperateInfo.GetCompanyId(org.CompanyId), "parentId": updateOrgCommand.ParentId, "orgName": updateOrgCommand.OrgName, "notEqualOrgId": org.OrgId}); err == nil && findOne != nil { | ||
263 | + return nil, application.ThrowError(application.BUSINESS_ERROR, "部门名称重复") | ||
264 | + } | ||
265 | + } | ||
266 | + if org.OrgCode != updateOrgCommand.OrgCode { | ||
267 | + if findOne, err := orgRepository.FindOne(map[string]interface{}{"companyId": updateOrgCommand.OperateInfo.GetCompanyId(org.CompanyId), "parentId": updateOrgCommand.ParentId, "orgCode": updateOrgCommand.OrgCode, "notEqualOrgId": org.OrgId}); err == nil && findOne != nil { | ||
268 | + return nil, application.ThrowError(application.BUSINESS_ERROR, "部门编码重复") | ||
263 | } | 269 | } |
264 | - if findOne, err := orgRepository.FindOne(map[string]interface{}{"companyId": org.CompanyId, "parentId": updateOrgCommand.ParentId, "orgCode": updateOrgCommand.OrgCode, "notEqualOrgId": org.OrgId}); err == nil || findOne != nil { | ||
265 | - return nil, fmt.Errorf("部门编码重复") | ||
266 | } | 270 | } |
267 | - | ||
268 | if err := org.Update(tool_funs.SimpleStructToMap(updateOrgCommand)); err != nil { | 271 | if err := org.Update(tool_funs.SimpleStructToMap(updateOrgCommand)); err != nil { |
269 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 272 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
270 | } | 273 | } |
@@ -272,7 +275,7 @@ func (orgService *OrgService) UpdateOrg(updateOrgCommand *command.UpdateOrgComma | @@ -272,7 +275,7 @@ func (orgService *OrgService) UpdateOrg(updateOrgCommand *command.UpdateOrgComma | ||
272 | if updateOrgCommand.ParentId != 0 { | 275 | if updateOrgCommand.ParentId != 0 { |
273 | _, parentOrg, err := factory.FastPgOrg(transactionContext, updateOrgCommand.ParentId) | 276 | _, parentOrg, err := factory.FastPgOrg(transactionContext, updateOrgCommand.ParentId) |
274 | if err != nil { | 277 | if err != nil { |
275 | - return nil, err | 278 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
276 | } | 279 | } |
277 | org.Ext.ParentDepName = parentOrg.OrgName | 280 | org.Ext.ParentDepName = parentOrg.OrgName |
278 | } | 281 | } |
@@ -10,6 +10,7 @@ import ( | @@ -10,6 +10,7 @@ import ( | ||
10 | ) | 10 | ) |
11 | 11 | ||
12 | type BatchAddCommand struct { | 12 | type BatchAddCommand struct { |
13 | + OperateInfo *domain.OperateInfo `json:"-"` | ||
13 | // 用户类型 1:企业内部用户(内部添加) 2:共创用户 1024:企业注册用户(注册添加) | 14 | // 用户类型 1:企业内部用户(内部添加) 2:共创用户 1024:企业注册用户(注册添加) |
14 | UserType int `cname:"用户类型 1:企业内部用户(内部添加) 2:共创用户 1024:企业注册用户(注册添加)" json:"userType" valid:"Required"` | 15 | UserType int `cname:"用户类型 1:企业内部用户(内部添加) 2:共创用户 1024:企业注册用户(注册添加)" json:"userType" valid:"Required"` |
15 | // 用户列表 | 16 | // 用户列表 |
@@ -10,7 +10,8 @@ import ( | @@ -10,7 +10,8 @@ import ( | ||
10 | ) | 10 | ) |
11 | 11 | ||
12 | type BatchEnableCommand struct { | 12 | type BatchEnableCommand struct { |
13 | - UserIds []int64 `cname:"" json:"userIds" valid:"Required"` | 13 | + OperateInfo *domain.OperateInfo `json:"-"` |
14 | + UserIds []int64 `cname:"用户id列表" json:"userIds" valid:"Required"` | ||
14 | // 启用状态(启用:1 禁用:2 注销:3) | 15 | // 启用状态(启用:1 禁用:2 注销:3) |
15 | EnableStatus int `cname:"启用状态(启用:1 禁用:2 注销:3)" json:"enableStatus" valid:"Required"` | 16 | EnableStatus int `cname:"启用状态(启用:1 禁用:2 注销:3)" json:"enableStatus" valid:"Required"` |
16 | } | 17 | } |
@@ -2,6 +2,7 @@ package command | @@ -2,6 +2,7 @@ package command | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain" | ||
5 | "reflect" | 6 | "reflect" |
6 | "strings" | 7 | "strings" |
7 | 8 | ||
@@ -9,6 +10,7 @@ import ( | @@ -9,6 +10,7 @@ import ( | ||
9 | ) | 10 | ) |
10 | 11 | ||
11 | type BatchResetPasswordCommand struct { | 12 | type BatchResetPasswordCommand struct { |
13 | + OperateInfo *domain.OperateInfo `json:"-"` | ||
12 | UserIds []int64 `cname:"" json:"userIds" valid:"Required"` | 14 | UserIds []int64 `cname:"" json:"userIds" valid:"Required"` |
13 | // 密码 | 15 | // 密码 |
14 | Password string `cname:"密码" json:"password" valid:"Required"` | 16 | Password string `cname:"密码" json:"password" valid:"Required"` |
@@ -2,6 +2,7 @@ package command | @@ -2,6 +2,7 @@ package command | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain" | ||
5 | "reflect" | 6 | "reflect" |
6 | "strings" | 7 | "strings" |
7 | "time" | 8 | "time" |
@@ -10,6 +11,7 @@ import ( | @@ -10,6 +11,7 @@ import ( | ||
10 | ) | 11 | ) |
11 | 12 | ||
12 | type CreateCooperatorCommand struct { | 13 | type CreateCooperatorCommand struct { |
14 | + OperateInfo *domain.OperateInfo `json:"-"` | ||
13 | // 企业ID | 15 | // 企业ID |
14 | CompanyId int64 `cname:"企业ID" json:"companyId" valid:"Required"` | 16 | CompanyId int64 `cname:"企业ID" json:"companyId" valid:"Required"` |
15 | // 共创公司 | 17 | // 共创公司 |
@@ -3,12 +3,14 @@ package command | @@ -3,12 +3,14 @@ package command | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | "github.com/beego/beego/v2/core/validation" | 5 | "github.com/beego/beego/v2/core/validation" |
6 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain" | ||
6 | "reflect" | 7 | "reflect" |
7 | "strings" | 8 | "strings" |
8 | "time" | 9 | "time" |
9 | ) | 10 | ) |
10 | 11 | ||
11 | type CreateUserCommand struct { | 12 | type CreateUserCommand struct { |
13 | + OperateInfo *domain.OperateInfo `json:"-"` | ||
12 | // 企业id | 14 | // 企业id |
13 | CompanyId int64 `cname:"企业id" json:"companyId" valid:"Required"` | 15 | CompanyId int64 `cname:"企业id" json:"companyId" valid:"Required"` |
14 | // 用户类型 1:企业内部用户(内部添加) 2:共创用户 1024:企业注册用户(注册添加) | 16 | // 用户类型 1:企业内部用户(内部添加) 2:共创用户 1024:企业注册用户(注册添加) |
@@ -2,6 +2,7 @@ package command | @@ -2,6 +2,7 @@ package command | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain" | ||
5 | "reflect" | 6 | "reflect" |
6 | "strings" | 7 | "strings" |
7 | 8 | ||
@@ -9,6 +10,7 @@ import ( | @@ -9,6 +10,7 @@ import ( | ||
9 | ) | 10 | ) |
10 | 11 | ||
11 | type DeleteFavoriteMenusCommand struct { | 12 | type DeleteFavoriteMenusCommand struct { |
13 | + OperateInfo *domain.OperateInfo `json:"-"` | ||
12 | // 编码 | 14 | // 编码 |
13 | Code int `cname:"编码" json:"code" valid:"Required"` | 15 | Code int `cname:"编码" json:"code" valid:"Required"` |
14 | // 用户Id 用户唯一标识 | 16 | // 用户Id 用户唯一标识 |
@@ -2,6 +2,7 @@ package command | @@ -2,6 +2,7 @@ package command | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain" | ||
5 | "reflect" | 6 | "reflect" |
6 | "strings" | 7 | "strings" |
7 | 8 | ||
@@ -9,6 +10,7 @@ import ( | @@ -9,6 +10,7 @@ import ( | ||
9 | ) | 10 | ) |
10 | 11 | ||
11 | type RemoveUserCommand struct { | 12 | type RemoveUserCommand struct { |
13 | + OperateInfo *domain.OperateInfo `json:"-"` | ||
12 | // 用户Id 用户唯一标识 | 14 | // 用户Id 用户唯一标识 |
13 | UserId int64 `cname:"用户Id 用户唯一标识" json:"userId,string" valid:"Required"` | 15 | UserId int64 `cname:"用户Id 用户唯一标识" json:"userId,string" valid:"Required"` |
14 | } | 16 | } |
@@ -2,6 +2,7 @@ package command | @@ -2,6 +2,7 @@ package command | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain" | ||
5 | "reflect" | 6 | "reflect" |
6 | "strings" | 7 | "strings" |
7 | "time" | 8 | "time" |
@@ -10,16 +11,17 @@ import ( | @@ -10,16 +11,17 @@ import ( | ||
10 | ) | 11 | ) |
11 | 12 | ||
12 | type UpdateCooperatorCommand struct { | 13 | type UpdateCooperatorCommand struct { |
14 | + OperateInfo *domain.OperateInfo `json:"-"` | ||
13 | // 共创公司 | 15 | // 共创公司 |
14 | CooperationCompany string `cname:"共创公司" json:"cooperationCompany" valid:"Required"` | 16 | CooperationCompany string `cname:"共创公司" json:"cooperationCompany" valid:"Required"` |
15 | // 共创到期时间 | 17 | // 共创到期时间 |
16 | CooperationDeadline time.Time `cname:"共创到期时间" json:"cooperationDeadline" valid:"Required"` | 18 | CooperationDeadline time.Time `cname:"共创到期时间" json:"cooperationDeadline" valid:"Required"` |
17 | // 邮箱 | 19 | // 邮箱 |
18 | - Email string `cname:"邮箱" json:"email" valid:"Required"` | 20 | + Email string `cname:"邮箱" json:"email"` |
19 | // 启用状态(启用:1 禁用:2 注销:3) | 21 | // 启用状态(启用:1 禁用:2 注销:3) |
20 | EnableStatus int `cname:"启用状态(启用:1 禁用:2 注销:3)" json:"enableStatus" valid:"Required"` | 22 | EnableStatus int `cname:"启用状态(启用:1 禁用:2 注销:3)" json:"enableStatus" valid:"Required"` |
21 | // 用户编号 企业内标识 | 23 | // 用户编号 企业内标识 |
22 | - UserCode string `cname:"用户编号 企业内标识" json:"userCode" valid:"Required"` | 24 | + //UserCode string `cname:"用户编号" json:"userCode" valid:"Required"` |
23 | // 用户Id 用户唯一标识 | 25 | // 用户Id 用户唯一标识 |
24 | UserId int64 `cname:"用户Id 用户唯一标识" json:"userId" valid:"Required"` | 26 | UserId int64 `cname:"用户Id 用户唯一标识" json:"userId" valid:"Required"` |
25 | // 手机号码 | 27 | // 手机号码 |
@@ -27,9 +29,9 @@ type UpdateCooperatorCommand struct { | @@ -27,9 +29,9 @@ type UpdateCooperatorCommand struct { | ||
27 | // 用户姓名 | 29 | // 用户姓名 |
28 | UserName string `cname:"用户姓名" json:"userName" valid:"Required"` | 30 | UserName string `cname:"用户姓名" json:"userName" valid:"Required"` |
29 | // 头像 | 31 | // 头像 |
30 | - Avatar string `cname:"头像" json:"avatar" valid:"Required"` | 32 | + Avatar string `cname:"头像" json:"avatar"` |
31 | // 组织ID | 33 | // 组织ID |
32 | - OrgId int64 `cname:"组织ID" json:"orgId" valid:"Required"` | 34 | + //OrgId int64 `cname:"组织ID" json:"orgId" valid:"Required"` |
33 | } | 35 | } |
34 | 36 | ||
35 | func (updateCooperatorCommand *UpdateCooperatorCommand) Valid(validation *validation.Validation) { | 37 | func (updateCooperatorCommand *UpdateCooperatorCommand) Valid(validation *validation.Validation) { |
@@ -2,6 +2,7 @@ package command | @@ -2,6 +2,7 @@ package command | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain" | ||
5 | "reflect" | 6 | "reflect" |
6 | "strings" | 7 | "strings" |
7 | 8 | ||
@@ -9,6 +10,7 @@ import ( | @@ -9,6 +10,7 @@ import ( | ||
9 | ) | 10 | ) |
10 | 11 | ||
11 | type UpdateFavoriteMenusCommand struct { | 12 | type UpdateFavoriteMenusCommand struct { |
13 | + OperateInfo *domain.OperateInfo `json:"-"` | ||
12 | // 菜单编码列表 | 14 | // 菜单编码列表 |
13 | FavoriteMenus []string `cname:"菜单编码列表" json:"favoriteMenus,omitempty"` | 15 | FavoriteMenus []string `cname:"菜单编码列表" json:"favoriteMenus,omitempty"` |
14 | // 用户Id 用户唯一标识 | 16 | // 用户Id 用户唯一标识 |
@@ -11,6 +11,7 @@ import ( | @@ -11,6 +11,7 @@ import ( | ||
11 | ) | 11 | ) |
12 | 12 | ||
13 | type UpdateUserCommand struct { | 13 | type UpdateUserCommand struct { |
14 | + OperateInfo *domain.OperateInfo `json:"-"` | ||
14 | // 用户Id 用户唯一标识 | 15 | // 用户Id 用户唯一标识 |
15 | UserId int64 `cname:"用户Id 用户唯一标识" json:"userId" valid:"Required"` | 16 | UserId int64 `cname:"用户Id 用户唯一标识" json:"userId" valid:"Required"` |
16 | // 组织机构 | 17 | // 组织机构 |
@@ -2,6 +2,7 @@ package command | @@ -2,6 +2,7 @@ package command | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain" | ||
5 | "reflect" | 6 | "reflect" |
6 | "strings" | 7 | "strings" |
7 | 8 | ||
@@ -9,6 +10,7 @@ import ( | @@ -9,6 +10,7 @@ import ( | ||
9 | ) | 10 | ) |
10 | 11 | ||
11 | type UpdateUsersBaseCommand struct { | 12 | type UpdateUsersBaseCommand struct { |
13 | + OperateInfo *domain.OperateInfo `json:"-"` | ||
12 | // 用户Id 用户唯一标识 | 14 | // 用户Id 用户唯一标识 |
13 | UserId int64 `cname:"用户Id 用户唯一标识" json:"userId,string" valid:"Required"` | 15 | UserId int64 `cname:"用户Id 用户唯一标识" json:"userId,string" valid:"Required"` |
14 | // 用户姓名 | 16 | // 用户姓名 |
@@ -62,6 +62,7 @@ func (dto *UserDto) LoadDto(user *domain.User, company *domain.Company) error { | @@ -62,6 +62,7 @@ func (dto *UserDto) LoadDto(user *domain.User, company *domain.Company) error { | ||
62 | if user.UserInfo == nil { | 62 | if user.UserInfo == nil { |
63 | dto.UserInfo = &domain.UserInfo{ | 63 | dto.UserInfo = &domain.UserInfo{ |
64 | UserName: user.Ext.UserName, | 64 | UserName: user.Ext.UserName, |
65 | + Phone: user.Ext.Phone, | ||
65 | } | 66 | } |
66 | } | 67 | } |
67 | dto.Organization = user.Organization | 68 | dto.Organization = user.Organization |
@@ -2,6 +2,7 @@ package query | @@ -2,6 +2,7 @@ package query | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain" | ||
5 | "reflect" | 6 | "reflect" |
6 | "strings" | 7 | "strings" |
7 | 8 | ||
@@ -9,6 +10,7 @@ import ( | @@ -9,6 +10,7 @@ import ( | ||
9 | ) | 10 | ) |
10 | 11 | ||
11 | type GetFavoriteMenusQuery struct { | 12 | type GetFavoriteMenusQuery struct { |
13 | + OperateInfo *domain.OperateInfo `json:"-"` | ||
12 | // 用户Id 用户唯一标识 | 14 | // 用户Id 用户唯一标识 |
13 | UserId int64 `cname:"用户Id 用户唯一标识" json:"userId,string" valid:"Required"` | 15 | UserId int64 `cname:"用户Id 用户唯一标识" json:"userId,string" valid:"Required"` |
14 | } | 16 | } |
@@ -2,6 +2,7 @@ package query | @@ -2,6 +2,7 @@ package query | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain" | ||
5 | "reflect" | 6 | "reflect" |
6 | "strings" | 7 | "strings" |
7 | 8 | ||
@@ -9,6 +10,7 @@ import ( | @@ -9,6 +10,7 @@ import ( | ||
9 | ) | 10 | ) |
10 | 11 | ||
11 | type GetUserQuery struct { | 12 | type GetUserQuery struct { |
13 | + OperateInfo *domain.OperateInfo `json:"-"` | ||
12 | // 用户Id 用户唯一标识 | 14 | // 用户Id 用户唯一标识 |
13 | UserId int64 `cname:"用户Id 用户唯一标识" json:"userId,string" valid:"Required"` | 15 | UserId int64 `cname:"用户Id 用户唯一标识" json:"userId,string" valid:"Required"` |
14 | } | 16 | } |
@@ -2,6 +2,7 @@ package query | @@ -2,6 +2,7 @@ package query | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain" | ||
5 | "reflect" | 6 | "reflect" |
6 | "strings" | 7 | "strings" |
7 | 8 | ||
@@ -9,6 +10,7 @@ import ( | @@ -9,6 +10,7 @@ import ( | ||
9 | ) | 10 | ) |
10 | 11 | ||
11 | type GetUserAccessMenusQuery struct { | 12 | type GetUserAccessMenusQuery struct { |
13 | + OperateInfo *domain.OperateInfo `json:"-"` | ||
12 | // 用户Id 用户唯一标识 | 14 | // 用户Id 用户唯一标识 |
13 | UserId int64 `cname:"用户Id 用户唯一标识" json:"userId" valid:"Required"` | 15 | UserId int64 `cname:"用户Id 用户唯一标识" json:"userId" valid:"Required"` |
14 | // 当前登录组织orgId | 16 | // 当前登录组织orgId |
@@ -2,6 +2,7 @@ package query | @@ -2,6 +2,7 @@ package query | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain" | ||
5 | "reflect" | 6 | "reflect" |
6 | "strings" | 7 | "strings" |
7 | 8 | ||
@@ -9,6 +10,7 @@ import ( | @@ -9,6 +10,7 @@ import ( | ||
9 | ) | 10 | ) |
10 | 11 | ||
11 | type GetUserProfileQuery struct { | 12 | type GetUserProfileQuery struct { |
13 | + OperateInfo *domain.OperateInfo `json:"-"` | ||
12 | // 用户Id 用户唯一标识 | 14 | // 用户Id 用户唯一标识 |
13 | UserId int64 `cname:"用户Id 用户唯一标识" json:"userId,string,omitempty"` | 15 | UserId int64 `cname:"用户Id 用户唯一标识" json:"userId,string,omitempty"` |
14 | // 手机号码 | 16 | // 手机号码 |
@@ -2,6 +2,7 @@ package query | @@ -2,6 +2,7 @@ package query | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain" | ||
5 | "reflect" | 6 | "reflect" |
6 | "strings" | 7 | "strings" |
7 | 8 | ||
@@ -9,6 +10,7 @@ import ( | @@ -9,6 +10,7 @@ import ( | ||
9 | ) | 10 | ) |
10 | 11 | ||
11 | type ListUserQuery struct { | 12 | type ListUserQuery struct { |
13 | + OperateInfo *domain.OperateInfo `json:"-"` | ||
12 | // 查询偏离量 | 14 | // 查询偏离量 |
13 | Offset int `cname:"查询偏离量" json:"offset"` | 15 | Offset int `cname:"查询偏离量" json:"offset"` |
14 | // 查询限制 | 16 | // 查询限制 |
@@ -23,7 +25,7 @@ type ListUserQuery struct { | @@ -23,7 +25,7 @@ type ListUserQuery struct { | ||
23 | UserBaseId string `cname:"用户基础ID" json:"userBaseId,omitempty"` | 25 | UserBaseId string `cname:"用户基础ID" json:"userBaseId,omitempty"` |
24 | // 用户姓名 | 26 | // 用户姓名 |
25 | UserName string `cname:"用户姓名" json:"userName,omitempty"` | 27 | UserName string `cname:"用户姓名" json:"userName,omitempty"` |
26 | - // 用户姓名 | 28 | + // 共创公司 |
27 | CooperationCompany string `cname:"共创公司" json:"cooperationCompany,omitempty"` | 29 | CooperationCompany string `cname:"共创公司" json:"cooperationCompany,omitempty"` |
28 | // 部门名称 | 30 | // 部门名称 |
29 | DepName string `cname:"部门名称" json:"depName,omitempty"` | 31 | DepName string `cname:"部门名称" json:"depName,omitempty"` |
@@ -146,11 +146,15 @@ func (userService *UserService) CreateCooperator(createCooperatorCommand *comman | @@ -146,11 +146,15 @@ func (userService *UserService) CreateCooperator(createCooperatorCommand *comman | ||
146 | UserOrg: sampleUserOrg, | 146 | UserOrg: sampleUserOrg, |
147 | UserRole: sampleUserRole, | 147 | UserRole: sampleUserRole, |
148 | FavoriteMenus: []string{}, | 148 | FavoriteMenus: []string{}, |
149 | - CooperationInfo: &domain.CooperationInfo{}, | 149 | + CooperationInfo: &domain.CooperationInfo{ |
150 | + CooperationCompany: createCooperatorCommand.CooperationCompany, | ||
151 | + CooperationDeadline: createCooperatorCommand.CooperationDeadline, | ||
152 | + }, | ||
150 | UserInfo: nweUserInfo, | 153 | UserInfo: nweUserInfo, |
151 | - //EnableStatus: createUserCommand.EnableStatus, | 154 | + EnableStatus: createCooperatorCommand.EnableStatus, |
152 | Ext: &domain.Ext{ | 155 | Ext: &domain.Ext{ |
153 | Phone: createCooperatorCommand.Phone, | 156 | Phone: createCooperatorCommand.Phone, |
157 | + UserName: createCooperatorCommand.UserName, | ||
154 | }, | 158 | }, |
155 | CreatedAt: time.Now(), | 159 | CreatedAt: time.Now(), |
156 | UpdatedAt: time.Now(), | 160 | UpdatedAt: time.Now(), |
@@ -351,7 +355,7 @@ func (userService *UserService) GetUserAccessMenus(getUserAccessMenusQuery *quer | @@ -351,7 +355,7 @@ func (userService *UserService) GetUserAccessMenus(getUserAccessMenusQuery *quer | ||
351 | }() | 355 | }() |
352 | 356 | ||
353 | // 1.用户角色包含的菜单Set | 357 | // 1.用户角色包含的菜单Set |
354 | - _, user, err := factory.FastPgUser(transactionContext, getUserAccessMenusQuery.UserId) | 358 | + _, user, err := factory.FastPgUser(transactionContext, getUserAccessMenusQuery.OperateInfo.GetUserId(getUserAccessMenusQuery.UserId)) |
355 | if err != nil { | 359 | if err != nil { |
356 | return nil, err | 360 | return nil, err |
357 | } | 361 | } |
@@ -547,7 +551,7 @@ func (userService *UserService) UpdateCooperator(updateCooperatorCommand *comman | @@ -547,7 +551,7 @@ func (userService *UserService) UpdateCooperator(updateCooperatorCommand *comman | ||
547 | if err != nil { | 551 | if err != nil { |
548 | return nil, err | 552 | return nil, err |
549 | } | 553 | } |
550 | - user.OrganizationId = updateCooperatorCommand.OrgId | 554 | + //user.OrganizationId = updateCooperatorCommand.OrgId |
551 | 555 | ||
552 | userInfo := &domain.UserInfo{ | 556 | userInfo := &domain.UserInfo{ |
553 | UserName: updateCooperatorCommand.UserName, | 557 | UserName: updateCooperatorCommand.UserName, |
@@ -155,9 +155,9 @@ func (org *Org) SetOrgStatus(orgStatus int) error { | @@ -155,9 +155,9 @@ func (org *Org) SetOrgStatus(orgStatus int) error { | ||
155 | if org.OrgStatus == orgStatus { | 155 | if org.OrgStatus == orgStatus { |
156 | return nil | 156 | return nil |
157 | } | 157 | } |
158 | - if !org.DeletedAt.IsZero() { | ||
159 | - return fmt.Errorf("组织不存在") | ||
160 | - } | 158 | + //if !org.DeletedAt.IsZero() { |
159 | + // return fmt.Errorf("组织不存在") | ||
160 | + //} | ||
161 | org.UpdatedAt = time.Now() | 161 | org.UpdatedAt = time.Now() |
162 | org.OrgStatus = orgStatus | 162 | org.OrgStatus = orgStatus |
163 | return nil | 163 | return nil |
@@ -111,17 +111,35 @@ func traverse(tree *Tree, node TreeNode) bool { | @@ -111,17 +111,35 @@ func traverse(tree *Tree, node TreeNode) bool { | ||
111 | return match | 111 | return match |
112 | } | 112 | } |
113 | 113 | ||
114 | -// Int64String 1 -> "1" "" | 114 | +// Int64String 1 -> "1" 1->1 |
115 | type Int64String int64 | 115 | type Int64String int64 |
116 | 116 | ||
117 | func (t Int64String) MarshalJSON() ([]byte, error) { | 117 | func (t Int64String) MarshalJSON() ([]byte, error) { |
118 | stamp := fmt.Sprintf(`"%d"`, t) | 118 | stamp := fmt.Sprintf(`"%d"`, t) |
119 | return []byte(stamp), nil | 119 | return []byte(stamp), nil |
120 | } | 120 | } |
121 | -func (t Int64String) UnMarshalJSON(data []byte) error { | 121 | + |
122 | +func (t *Int64String) UnMarshalJSON(data []byte) error { | ||
122 | v, err := strconv.ParseInt(string(data), 10, 64) | 123 | v, err := strconv.ParseInt(string(data), 10, 64) |
123 | - t = Int64String(v) | 124 | + *t = Int64String(v) |
124 | return err | 125 | return err |
125 | } | 126 | } |
126 | 127 | ||
128 | +// Int64String 1 -> "1" "1"->1 | ||
127 | type StringInt64 int64 | 129 | type StringInt64 int64 |
130 | + | ||
131 | +func (t StringInt64) MarshalJSON() ([]byte, error) { | ||
132 | + stamp := fmt.Sprintf(`"%d"`, t) | ||
133 | + return []byte(stamp), nil | ||
134 | +} | ||
135 | + | ||
136 | +func (t *StringInt64) UnmarshalJSON(data []byte) error { | ||
137 | + if len(data) < 2 { | ||
138 | + *t = 0 | ||
139 | + return fmt.Errorf("字符数字格式有误:" + string(data)) | ||
140 | + } | ||
141 | + data = data[1 : len(data)-1] | ||
142 | + v, err := strconv.ParseInt(string(data), 10, 64) | ||
143 | + *t = StringInt64(v) | ||
144 | + return err | ||
145 | +} |
@@ -65,3 +65,37 @@ func TestInt64String(t *testing.T) { | @@ -65,3 +65,37 @@ func TestInt64String(t *testing.T) { | ||
65 | t.Log(string(data)) | 65 | t.Log(string(data)) |
66 | } | 66 | } |
67 | } | 67 | } |
68 | + | ||
69 | +func TestStringInt64(t *testing.T) { | ||
70 | + type value struct { | ||
71 | + Value StringInt64 `json:"v"` | ||
72 | + } | ||
73 | + jsonData := `{"v":"1"}` | ||
74 | + var v = value{} | ||
75 | + if err := json.Unmarshal([]byte(jsonData), &v); err != nil { | ||
76 | + assert.Error(t, err) | ||
77 | + } | ||
78 | + assert.Equal(t, StringInt64(1), v.Value) | ||
79 | + if data, err := json.Marshal(v); err != nil { | ||
80 | + assert.Error(t, err) | ||
81 | + } else { | ||
82 | + t.Log(string(data)) | ||
83 | + } | ||
84 | +} | ||
85 | + | ||
86 | +func TestStringInt64_Array(t *testing.T) { | ||
87 | + type value struct { | ||
88 | + Value []StringInt64 `json:"v"` | ||
89 | + } | ||
90 | + jsonData := `{"v":["1","2","3"]}` | ||
91 | + var v = value{} | ||
92 | + if err := json.Unmarshal([]byte(jsonData), &v); err != nil { | ||
93 | + assert.Error(t, err) | ||
94 | + } | ||
95 | + assert.Equal(t, []StringInt64{StringInt64(1), StringInt64(2), StringInt64(3)}, v.Value) | ||
96 | + if data, err := json.Marshal(v); err != nil { | ||
97 | + assert.Error(t, err) | ||
98 | + } else { | ||
99 | + t.Log(string(data)) | ||
100 | + } | ||
101 | +} |
@@ -173,7 +173,7 @@ func (user *User) SetEnableStatus(enableStatus int) error { | @@ -173,7 +173,7 @@ func (user *User) SetEnableStatus(enableStatus int) error { | ||
173 | if user.EnableStatus == enableStatus { | 173 | if user.EnableStatus == enableStatus { |
174 | return nil //fmt.Errorf("重复设置状态") | 174 | return nil //fmt.Errorf("重复设置状态") |
175 | } | 175 | } |
176 | - if !(userStatus == UserStatusEnable || userStatus == UserStatusDisable || userStatus == UserStatusDestroy) { | 176 | + if !(enableStatus == int(UserStatusEnable) || enableStatus == int(UserStatusDisable) || enableStatus == int(UserStatusDestroy)) { |
177 | return fmt.Errorf("非法启用状态") | 177 | return fmt.Errorf("非法启用状态") |
178 | } | 178 | } |
179 | user.EnableStatus = enableStatus | 179 | user.EnableStatus = enableStatus |
@@ -78,6 +78,7 @@ func (ptr *PgCreateUserService) CreateUser(optUser *domain.User, newUser *domain | @@ -78,6 +78,7 @@ func (ptr *PgCreateUserService) CreateUser(optUser *domain.User, newUser *domain | ||
78 | 78 | ||
79 | // 4.建用户 | 79 | // 4.建用户 |
80 | newUser.UserBaseId = userBase.UserBaseId | 80 | newUser.UserBaseId = userBase.UserBaseId |
81 | + newUser.Ext.UserName = userBase.UserInfo.UserName | ||
81 | if user, err = userRepository.Save(newUser); err != nil { | 82 | if user, err = userRepository.Save(newUser); err != nil { |
82 | return nil, err | 83 | return nil, err |
83 | } | 84 | } |
@@ -163,6 +163,9 @@ func (repository *MenuRepository) Find(queryOptions map[string]interface{}) (int | @@ -163,6 +163,9 @@ func (repository *MenuRepository) Find(queryOptions map[string]interface{}) (int | ||
163 | if v, ok := queryOptions["menuName"]; ok { | 163 | if v, ok := queryOptions["menuName"]; ok { |
164 | query.Where(fmt.Sprintf("menu_name like '%%%v%%'", v)) | 164 | query.Where(fmt.Sprintf("menu_name like '%%%v%%'", v)) |
165 | } | 165 | } |
166 | + //if v, ok := queryOptions["menuTypeIn"]; ok { | ||
167 | + // query.Where("menu_type in (?)",v) | ||
168 | + //} | ||
166 | query.SetWhereByQueryOption("parent_id = ?", "parentId") | 169 | query.SetWhereByQueryOption("parent_id = ?", "parentId") |
167 | query.SetWhereByQueryOption("is_publish =?", "isPublish") | 170 | query.SetWhereByQueryOption("is_publish =?", "isPublish") |
168 | query.SetOrderDirect("parent_id", "asc") | 171 | query.SetOrderDirect("parent_id", "asc") |
@@ -42,10 +42,10 @@ func (repository *OrgRepository) Save(org *domain.Org) (*domain.Org, error) { | @@ -42,10 +42,10 @@ func (repository *OrgRepository) Save(org *domain.Org) (*domain.Org, error) { | ||
42 | "parent_id", | 42 | "parent_id", |
43 | "parent_path", | 43 | "parent_path", |
44 | } | 44 | } |
45 | - insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "org_id")) | ||
46 | - insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "org_id")) | 45 | + insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "org_id", "deleted_at")) |
46 | + insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "org_id", "deleted_at")) | ||
47 | returningFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields) | 47 | returningFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields) |
48 | - updateFields := sqlbuilder.RemoveSqlFields(sqlBuildFields, "org_id") | 48 | + updateFields := sqlbuilder.RemoveSqlFields(sqlBuildFields, "org_id", "deleted_at") |
49 | updateFieldsSnippet := sqlbuilder.SqlUpdateFieldsSnippet(updateFields) | 49 | updateFieldsSnippet := sqlbuilder.SqlUpdateFieldsSnippet(updateFields) |
50 | tx := repository.transactionContext.PgTx | 50 | tx := repository.transactionContext.PgTx |
51 | if org.Identify() == nil { | 51 | if org.Identify() == nil { |
@@ -75,7 +75,7 @@ func (repository *OrgRepository) Save(org *domain.Org) (*domain.Org, error) { | @@ -75,7 +75,7 @@ func (repository *OrgRepository) Save(org *domain.Org) (*domain.Org, error) { | ||
75 | org.CompanyId, | 75 | org.CompanyId, |
76 | org.CreatedAt, | 76 | org.CreatedAt, |
77 | org.UpdatedAt, | 77 | org.UpdatedAt, |
78 | - org.DeletedAt, | 78 | + //org.DeletedAt, |
79 | org.OrgCode, | 79 | org.OrgCode, |
80 | org.OrgName, | 80 | org.OrgName, |
81 | org.Ext, | 81 | org.Ext, |
@@ -107,7 +107,7 @@ func (repository *OrgRepository) Save(org *domain.Org) (*domain.Org, error) { | @@ -107,7 +107,7 @@ func (repository *OrgRepository) Save(org *domain.Org) (*domain.Org, error) { | ||
107 | org.CompanyId, | 107 | org.CompanyId, |
108 | org.CreatedAt, | 108 | org.CreatedAt, |
109 | org.UpdatedAt, | 109 | org.UpdatedAt, |
110 | - org.DeletedAt, | 110 | + //org.DeletedAt, |
111 | org.OrgCode, | 111 | org.OrgCode, |
112 | org.OrgName, | 112 | org.OrgName, |
113 | org.Ext, | 113 | org.Ext, |
@@ -15,6 +15,7 @@ func (controller *OrgController) CreateOrg() { | @@ -15,6 +15,7 @@ func (controller *OrgController) CreateOrg() { | ||
15 | orgService := service.NewOrgService(nil) | 15 | orgService := service.NewOrgService(nil) |
16 | createOrgCommand := &command.CreateOrgCommand{} | 16 | createOrgCommand := &command.CreateOrgCommand{} |
17 | controller.Unmarshal(createOrgCommand) | 17 | controller.Unmarshal(createOrgCommand) |
18 | + createOrgCommand.OperateInfo = ParseOperateInfo(controller.BaseController) | ||
18 | data, err := orgService.CreateOrg(createOrgCommand) | 19 | data, err := orgService.CreateOrg(createOrgCommand) |
19 | controller.Response(data, err) | 20 | controller.Response(data, err) |
20 | } | 21 | } |
@@ -25,6 +26,7 @@ func (controller *OrgController) UpdateOrg() { | @@ -25,6 +26,7 @@ func (controller *OrgController) UpdateOrg() { | ||
25 | controller.Unmarshal(updateOrgCommand) | 26 | controller.Unmarshal(updateOrgCommand) |
26 | orgId, _ := controller.GetInt64(":orgId") | 27 | orgId, _ := controller.GetInt64(":orgId") |
27 | updateOrgCommand.OrgId = orgId | 28 | updateOrgCommand.OrgId = orgId |
29 | + updateOrgCommand.OperateInfo = ParseOperateInfo(controller.BaseController) | ||
28 | data, err := orgService.UpdateOrg(updateOrgCommand) | 30 | data, err := orgService.UpdateOrg(updateOrgCommand) |
29 | controller.Response(data, err) | 31 | controller.Response(data, err) |
30 | } | 32 | } |
@@ -34,6 +36,7 @@ func (controller *OrgController) GetOrg() { | @@ -34,6 +36,7 @@ func (controller *OrgController) GetOrg() { | ||
34 | getOrgQuery := &query.GetOrgQuery{} | 36 | getOrgQuery := &query.GetOrgQuery{} |
35 | orgId, _ := controller.GetInt64(":orgId") | 37 | orgId, _ := controller.GetInt64(":orgId") |
36 | getOrgQuery.OrgId = orgId | 38 | getOrgQuery.OrgId = orgId |
39 | + getOrgQuery.OperateInfo = ParseOperateInfo(controller.BaseController) | ||
37 | data, err := orgService.GetOrg(getOrgQuery) | 40 | data, err := orgService.GetOrg(getOrgQuery) |
38 | controller.Response(data, err) | 41 | controller.Response(data, err) |
39 | } | 42 | } |
@@ -44,6 +47,7 @@ func (controller *OrgController) RemoveOrg() { | @@ -44,6 +47,7 @@ func (controller *OrgController) RemoveOrg() { | ||
44 | controller.Unmarshal(removeOrgCommand) | 47 | controller.Unmarshal(removeOrgCommand) |
45 | orgId, _ := controller.GetInt64(":orgId") | 48 | orgId, _ := controller.GetInt64(":orgId") |
46 | removeOrgCommand.OrgId = orgId | 49 | removeOrgCommand.OrgId = orgId |
50 | + removeOrgCommand.OperateInfo = ParseOperateInfo(controller.BaseController) | ||
47 | data, err := orgService.RemoveOrg(removeOrgCommand) | 51 | data, err := orgService.RemoveOrg(removeOrgCommand) |
48 | controller.Response(data, err) | 52 | controller.Response(data, err) |
49 | } | 53 | } |
@@ -51,6 +55,7 @@ func (controller *OrgController) RemoveOrg() { | @@ -51,6 +55,7 @@ func (controller *OrgController) RemoveOrg() { | ||
51 | func (controller *OrgController) ListOrg() { | 55 | func (controller *OrgController) ListOrg() { |
52 | orgService := service.NewOrgService(nil) | 56 | orgService := service.NewOrgService(nil) |
53 | listOrgQuery := &query.ListOrgQuery{} | 57 | listOrgQuery := &query.ListOrgQuery{} |
58 | + listOrgQuery.OperateInfo = ParseOperateInfo(controller.BaseController) | ||
54 | data, err := orgService.ListOrg(listOrgQuery) | 59 | data, err := orgService.ListOrg(listOrgQuery) |
55 | controller.Response(data, err) | 60 | controller.Response(data, err) |
56 | } | 61 | } |
@@ -62,6 +67,7 @@ func (controller *OrgController) GetOrgSubDepartment() { | @@ -62,6 +67,7 @@ func (controller *OrgController) GetOrgSubDepartment() { | ||
62 | getOrgSubDepartmentQuery.OrgId = orgId | 67 | getOrgSubDepartmentQuery.OrgId = orgId |
63 | childFlag, _ := controller.GetInt("childFlag") | 68 | childFlag, _ := controller.GetInt("childFlag") |
64 | getOrgSubDepartmentQuery.ChildFlag = childFlag | 69 | getOrgSubDepartmentQuery.ChildFlag = childFlag |
70 | + getOrgSubDepartmentQuery.OperateInfo = ParseOperateInfo(controller.BaseController) | ||
65 | data, err := orgService.GetOrgSubDepartment(getOrgSubDepartmentQuery) | 71 | data, err := orgService.GetOrgSubDepartment(getOrgSubDepartmentQuery) |
66 | controller.Response(data, err) | 72 | controller.Response(data, err) |
67 | } | 73 | } |
@@ -70,6 +76,7 @@ func (controller *OrgController) EnableOrg() { | @@ -70,6 +76,7 @@ func (controller *OrgController) EnableOrg() { | ||
70 | orgService := service.NewOrgService(nil) | 76 | orgService := service.NewOrgService(nil) |
71 | enableOrgCommand := &command.EnableOrgCommand{} | 77 | enableOrgCommand := &command.EnableOrgCommand{} |
72 | controller.Unmarshal(enableOrgCommand) | 78 | controller.Unmarshal(enableOrgCommand) |
79 | + enableOrgCommand.OperateInfo = ParseOperateInfo(controller.BaseController) | ||
73 | data, err := orgService.EnableOrg(enableOrgCommand) | 80 | data, err := orgService.EnableOrg(enableOrgCommand) |
74 | controller.Response(data, err) | 81 | controller.Response(data, err) |
75 | } | 82 | } |
@@ -78,6 +85,7 @@ func (controller *OrgController) SearchOrg() { | @@ -78,6 +85,7 @@ func (controller *OrgController) SearchOrg() { | ||
78 | orgService := service.NewOrgService(nil) | 85 | orgService := service.NewOrgService(nil) |
79 | listOrgQuery := &query.ListOrgQuery{} | 86 | listOrgQuery := &query.ListOrgQuery{} |
80 | Must(controller.Unmarshal(listOrgQuery)) | 87 | Must(controller.Unmarshal(listOrgQuery)) |
88 | + listOrgQuery.OperateInfo = ParseOperateInfo(controller.BaseController) | ||
81 | data, err := orgService.ListOrg(listOrgQuery) | 89 | data, err := orgService.ListOrg(listOrgQuery) |
82 | controller.Response(data, err) | 90 | controller.Response(data, err) |
83 | } | 91 | } |
@@ -15,6 +15,7 @@ func (controller *UserController) CreateUser() { | @@ -15,6 +15,7 @@ func (controller *UserController) CreateUser() { | ||
15 | userService := service.NewUserService(nil) | 15 | userService := service.NewUserService(nil) |
16 | createUserCommand := &command.CreateUserCommand{} | 16 | createUserCommand := &command.CreateUserCommand{} |
17 | Must(controller.Unmarshal(createUserCommand)) | 17 | Must(controller.Unmarshal(createUserCommand)) |
18 | + createUserCommand.OperateInfo = ParseOperateInfo(controller.BaseController) | ||
18 | data, err := userService.CreateUser(createUserCommand) | 19 | data, err := userService.CreateUser(createUserCommand) |
19 | controller.Response(data, err) | 20 | controller.Response(data, err) |
20 | } | 21 | } |
@@ -25,6 +26,7 @@ func (controller *UserController) UpdateUser() { | @@ -25,6 +26,7 @@ func (controller *UserController) UpdateUser() { | ||
25 | Must(controller.Unmarshal(updateUserCommand)) | 26 | Must(controller.Unmarshal(updateUserCommand)) |
26 | userId, _ := controller.GetInt64(":userId") | 27 | userId, _ := controller.GetInt64(":userId") |
27 | updateUserCommand.UserId = userId | 28 | updateUserCommand.UserId = userId |
29 | + updateUserCommand.OperateInfo = ParseOperateInfo(controller.BaseController) | ||
28 | data, err := userService.UpdateUser(updateUserCommand) | 30 | data, err := userService.UpdateUser(updateUserCommand) |
29 | controller.Response(data, err) | 31 | controller.Response(data, err) |
30 | } | 32 | } |
@@ -34,6 +36,7 @@ func (controller *UserController) GetUser() { | @@ -34,6 +36,7 @@ func (controller *UserController) GetUser() { | ||
34 | getUserQuery := &query.GetUserQuery{} | 36 | getUserQuery := &query.GetUserQuery{} |
35 | userId, _ := controller.GetInt64(":userId") | 37 | userId, _ := controller.GetInt64(":userId") |
36 | getUserQuery.UserId = userId | 38 | getUserQuery.UserId = userId |
39 | + getUserQuery.OperateInfo = ParseOperateInfo(controller.BaseController) | ||
37 | data, err := userService.GetUser(getUserQuery) | 40 | data, err := userService.GetUser(getUserQuery) |
38 | controller.Response(data, err) | 41 | controller.Response(data, err) |
39 | } | 42 | } |
@@ -44,6 +47,7 @@ func (controller *UserController) RemoveUser() { | @@ -44,6 +47,7 @@ func (controller *UserController) RemoveUser() { | ||
44 | controller.Unmarshal(removeUserCommand) | 47 | controller.Unmarshal(removeUserCommand) |
45 | userId, _ := controller.GetInt64(":userId") | 48 | userId, _ := controller.GetInt64(":userId") |
46 | removeUserCommand.UserId = userId | 49 | removeUserCommand.UserId = userId |
50 | + removeUserCommand.OperateInfo = ParseOperateInfo(controller.BaseController) | ||
47 | data, err := userService.RemoveUser(removeUserCommand) | 51 | data, err := userService.RemoveUser(removeUserCommand) |
48 | controller.Response(data, err) | 52 | controller.Response(data, err) |
49 | } | 53 | } |
@@ -51,6 +55,7 @@ func (controller *UserController) RemoveUser() { | @@ -51,6 +55,7 @@ func (controller *UserController) RemoveUser() { | ||
51 | func (controller *UserController) ListUser() { | 55 | func (controller *UserController) ListUser() { |
52 | userService := service.NewUserService(nil) | 56 | userService := service.NewUserService(nil) |
53 | listUserQuery := &query.ListUserQuery{} | 57 | listUserQuery := &query.ListUserQuery{} |
58 | + listUserQuery.OperateInfo = ParseOperateInfo(controller.BaseController) | ||
54 | data, err := userService.ListUser(listUserQuery) | 59 | data, err := userService.ListUser(listUserQuery) |
55 | controller.Response(data, err) | 60 | controller.Response(data, err) |
56 | } | 61 | } |
@@ -64,6 +69,7 @@ func (controller *UserController) GetUserAccessMenus() { | @@ -64,6 +69,7 @@ func (controller *UserController) GetUserAccessMenus() { | ||
64 | getUserAccessMenusQuery.MenuCategory = menuCategory | 69 | getUserAccessMenusQuery.MenuCategory = menuCategory |
65 | getUserAccessMenusQuery.OrgId, _ = controller.GetInt64("orgId", 0) | 70 | getUserAccessMenusQuery.OrgId, _ = controller.GetInt64("orgId", 0) |
66 | getUserAccessMenusQuery.ALLDisableMenu, _ = controller.GetInt("allDisableMenu", 0) | 71 | getUserAccessMenusQuery.ALLDisableMenu, _ = controller.GetInt("allDisableMenu", 0) |
72 | + getUserAccessMenusQuery.OperateInfo = ParseOperateInfo(controller.BaseController) | ||
67 | data, err := userService.GetUserAccessMenus(getUserAccessMenusQuery) | 73 | data, err := userService.GetUserAccessMenus(getUserAccessMenusQuery) |
68 | controller.Response(data, err) | 74 | controller.Response(data, err) |
69 | } | 75 | } |
@@ -73,6 +79,7 @@ func (controller *UserController) GetUserProfile() { | @@ -73,6 +79,7 @@ func (controller *UserController) GetUserProfile() { | ||
73 | getUserProfileQuery := &query.GetUserProfileQuery{} | 79 | getUserProfileQuery := &query.GetUserProfileQuery{} |
74 | userId, _ := controller.GetInt64(":userId") | 80 | userId, _ := controller.GetInt64(":userId") |
75 | getUserProfileQuery.UserId = userId | 81 | getUserProfileQuery.UserId = userId |
82 | + getUserProfileQuery.OperateInfo = ParseOperateInfo(controller.BaseController) | ||
76 | data, err := userService.GetUserProfile(getUserProfileQuery) | 83 | data, err := userService.GetUserProfile(getUserProfileQuery) |
77 | controller.Response(data, err) | 84 | controller.Response(data, err) |
78 | } | 85 | } |
@@ -81,6 +88,7 @@ func (controller *UserController) BatchAdd() { | @@ -81,6 +88,7 @@ func (controller *UserController) BatchAdd() { | ||
81 | userService := service.NewUserService(nil) | 88 | userService := service.NewUserService(nil) |
82 | batchAddCommand := &command.BatchAddCommand{} | 89 | batchAddCommand := &command.BatchAddCommand{} |
83 | Must(controller.Unmarshal(batchAddCommand)) | 90 | Must(controller.Unmarshal(batchAddCommand)) |
91 | + batchAddCommand.OperateInfo = ParseOperateInfo(controller.BaseController) | ||
84 | data, err := userService.BatchAdd(batchAddCommand) | 92 | data, err := userService.BatchAdd(batchAddCommand) |
85 | controller.Response(data, err) | 93 | controller.Response(data, err) |
86 | } | 94 | } |
@@ -89,6 +97,7 @@ func (controller *UserController) BatchEnable() { | @@ -89,6 +97,7 @@ func (controller *UserController) BatchEnable() { | ||
89 | userService := service.NewUserService(nil) | 97 | userService := service.NewUserService(nil) |
90 | batchEnableCommand := &command.BatchEnableCommand{} | 98 | batchEnableCommand := &command.BatchEnableCommand{} |
91 | controller.Unmarshal(batchEnableCommand) | 99 | controller.Unmarshal(batchEnableCommand) |
100 | + batchEnableCommand.OperateInfo = ParseOperateInfo(controller.BaseController) | ||
92 | data, err := userService.BatchEnable(batchEnableCommand) | 101 | data, err := userService.BatchEnable(batchEnableCommand) |
93 | controller.Response(data, err) | 102 | controller.Response(data, err) |
94 | } | 103 | } |
@@ -97,6 +106,7 @@ func (controller *UserController) BatchResetPassword() { | @@ -97,6 +106,7 @@ func (controller *UserController) BatchResetPassword() { | ||
97 | userService := service.NewUserService(nil) | 106 | userService := service.NewUserService(nil) |
98 | batchResetPasswordCommand := &command.BatchResetPasswordCommand{} | 107 | batchResetPasswordCommand := &command.BatchResetPasswordCommand{} |
99 | controller.Unmarshal(batchResetPasswordCommand) | 108 | controller.Unmarshal(batchResetPasswordCommand) |
109 | + batchResetPasswordCommand.OperateInfo = ParseOperateInfo(controller.BaseController) | ||
100 | data, err := userService.BatchResetPassword(batchResetPasswordCommand) | 110 | data, err := userService.BatchResetPassword(batchResetPasswordCommand) |
101 | controller.Response(data, err) | 111 | controller.Response(data, err) |
102 | } | 112 | } |
@@ -107,6 +117,7 @@ func (controller *UserController) UpdateUsersBase() { | @@ -107,6 +117,7 @@ func (controller *UserController) UpdateUsersBase() { | ||
107 | controller.Unmarshal(updateUsersBaseCommand) | 117 | controller.Unmarshal(updateUsersBaseCommand) |
108 | userId, _ := controller.GetInt64(":userId") | 118 | userId, _ := controller.GetInt64(":userId") |
109 | updateUsersBaseCommand.UserId = userId | 119 | updateUsersBaseCommand.UserId = userId |
120 | + updateUsersBaseCommand.OperateInfo = ParseOperateInfo(controller.BaseController) | ||
110 | data, err := userService.UpdateUsersBase(updateUsersBaseCommand) | 121 | data, err := userService.UpdateUsersBase(updateUsersBaseCommand) |
111 | controller.Response(data, err) | 122 | controller.Response(data, err) |
112 | } | 123 | } |
@@ -115,6 +126,7 @@ func (controller *UserController) CreateCooperator() { | @@ -115,6 +126,7 @@ func (controller *UserController) CreateCooperator() { | ||
115 | userService := service.NewUserService(nil) | 126 | userService := service.NewUserService(nil) |
116 | createCooperatorCommand := &command.CreateCooperatorCommand{} | 127 | createCooperatorCommand := &command.CreateCooperatorCommand{} |
117 | Must(controller.Unmarshal(createCooperatorCommand)) | 128 | Must(controller.Unmarshal(createCooperatorCommand)) |
129 | + createCooperatorCommand.OperateInfo = ParseOperateInfo(controller.BaseController) | ||
118 | data, err := userService.CreateCooperator(createCooperatorCommand) | 130 | data, err := userService.CreateCooperator(createCooperatorCommand) |
119 | controller.Response(data, err) | 131 | controller.Response(data, err) |
120 | } | 132 | } |
@@ -125,6 +137,7 @@ func (controller *UserController) UpdateCooperator() { | @@ -125,6 +137,7 @@ func (controller *UserController) UpdateCooperator() { | ||
125 | controller.Unmarshal(updateCooperatorCommand) | 137 | controller.Unmarshal(updateCooperatorCommand) |
126 | userId, _ := controller.GetInt64(":userId") | 138 | userId, _ := controller.GetInt64(":userId") |
127 | updateCooperatorCommand.UserId = userId | 139 | updateCooperatorCommand.UserId = userId |
140 | + updateCooperatorCommand.OperateInfo = ParseOperateInfo(controller.BaseController) | ||
128 | data, err := userService.UpdateCooperator(updateCooperatorCommand) | 141 | data, err := userService.UpdateCooperator(updateCooperatorCommand) |
129 | controller.Response(data, err) | 142 | controller.Response(data, err) |
130 | } | 143 | } |
@@ -133,6 +146,7 @@ func (controller *UserController) SearchUser() { | @@ -133,6 +146,7 @@ func (controller *UserController) SearchUser() { | ||
133 | userService := service.NewUserService(nil) | 146 | userService := service.NewUserService(nil) |
134 | listUserQuery := &query.ListUserQuery{} | 147 | listUserQuery := &query.ListUserQuery{} |
135 | Must(controller.Unmarshal(listUserQuery)) | 148 | Must(controller.Unmarshal(listUserQuery)) |
149 | + listUserQuery.OperateInfo = ParseOperateInfo(controller.BaseController) | ||
136 | data, err := userService.ListUser(listUserQuery) | 150 | data, err := userService.ListUser(listUserQuery) |
137 | controller.Response(data, err) | 151 | controller.Response(data, err) |
138 | } | 152 | } |
-
请 注册 或 登录 后发表评论