作者 tangxuhui

文件结构更新

正在显示 48 个修改的文件 包含 467 行增加146 行删除
{"D:\\workspaceGo\\src\\allied-creation-gateway\\pkg\\port\\beego":1627475088561293500}
\ No newline at end of file
{"D:\\workspaceGo\\src\\allied-creation-gateway\\pkg\\port\\beego":1627544330050447000}
\ No newline at end of file
... ...
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
)
type MenuFavoriteCommand struct {
// 企业id
CompanyId int64 `json:"companyId" valid:"Required"`
// 对应菜单的id
MenuId []int64 `json:"menuId,omitempty"`
}
func (menuFavoriteCommand *MenuFavoriteCommand) Valid(validation *validation.Validation) {
validation.SetError("CustomValid", "未实现的自定义认证")
}
func (menuFavoriteCommand *MenuFavoriteCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(menuFavoriteCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type MenuUpdateCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 企业id
CompanyId int64 `json:"companyId" valid:"Required"`
// 菜单编号
MenuId int64 `json:"menuId" valid:"Required"`
// 菜单名称
MenuName string `json:"menuName" valid:"Required"`
// 排序
Sort int `json:"sort" valid:"Required"`
}
func (menuUpdateQuery *MenuUpdateCommand) Valid(validation *validation.Validation) {
validation.SetError("CustomValid", "未实现的自定义认证")
}
func (menuUpdateQuery *MenuUpdateCommand) ValidateQuery() error {
valid := validation.Validation{}
b, err := valid.Valid(menuUpdateQuery)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package query
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type MenuListQuery struct {
//操作人
Operator domain.Operator `json:"-"`
}
func (menuListQuery *MenuListQuery) Valid(validation *validation.Validation) {
}
func (menuListQuery *MenuListQuery) ValidateQuery() error {
valid := validation.Validation{}
b, err := valid.Valid(menuListQuery)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package service
import (
"github.com/linmadan/egglib-go/core/application"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/custommenu/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/custommenu/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
)
// 用户菜单维护
type MenuService struct {
}
// 设置收藏菜单
func (menuService *MenuService) MenuFavorite(menuFavoriteCommand *command.MenuFavoriteCommand) (interface{}, error) {
return nil, nil
}
// 返回菜单列表
func (menuService *MenuService) MenuList(menuListQuery *query.MenuListQuery) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
menuListQuery.Operator.CompanyId,
menuListQuery.Operator.OrgId,
menuListQuery.Operator.UserId)
result, err := creationUserGateway.CompanyGetCustomizeMenus(allied_creation_user.ReqCompanyGetCustomizeMenus{
CompanyId: menuListQuery.Operator.CompanyId,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return result, nil
}
// 更新菜单
func (menuService *MenuService) MenuUpdate(menuUpdateCommand *command.MenuUpdateCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
menuUpdateCommand.Operator.CompanyId,
menuUpdateCommand.Operator.OrgId,
menuUpdateCommand.Operator.UserId)
_, err := creationUserGateway.CompanySetCustomizeMenus(allied_creation_user.ReqCompanySetCustomizeMenus{
CompanyId: menuUpdateCommand.CompanyId,
MenuAlias: menuUpdateCommand.MenuName,
MenuId: int(menuUpdateCommand.MenuId),
Sort: menuUpdateCommand.Sort,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return menuUpdateCommand, nil
}
func NewMenuService(options map[string]interface{}) *MenuService {
newMenuService := &MenuService{}
return newMenuService
}
... ...
... ... @@ -4,9 +4,9 @@ import (
"strconv"
"github.com/linmadan/egglib-go/core/application"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/orgs/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/orgs/dto"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/orgs/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/orgs/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/orgs/dto"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/orgs/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
)
... ...
... ... @@ -4,9 +4,9 @@ import (
"strconv"
"github.com/linmadan/egglib-go/core/application"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/roles/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/roles/dto"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/roles/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/roles/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/roles/dto"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/roles/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
)
... ...
... ... @@ -10,6 +10,47 @@ type CompanyUserItem struct {
UserName string `json:"userName"`
}
//CompanyUserInfo 用户数据详情
type CompanyUserInfo struct {
Email string `json:"email"`
Phone string `json:"phone"`
Avatar string `json:"avatar"`
EnableStatus int `json:"enableStatus"`
UsersCode string `json:"usersCode"`
UsersID string `json:"usersId"`
UsersName string `json:"usersName"`
OrgID string `json:"orgId"`
OrgName string `json:"orgName"`
DepartmentID string `json:"departmentId"`
DepartmentName string `json:"departmentName"`
UsersOrg []UserOrg `json:"usersOrg"`
UsersRole []UserRole `json:"usersRole"`
}
type UserOrg struct {
OrgID string `json:"orgId"`
OrgName string `json:"orgName"`
}
type UserRole struct {
RoleID string `json:"roleId"`
RoleName string `json:"roleName"`
OrgName string `json:"orgName"`
}
type UserMenu struct {
Category string `json:"category"`
Code string `json:"code"`
Icon string `json:"icon"`
MenuAlias string `json:"menuAlias"`
MenuID int `json:"menuId"`
MenuName string `json:"menuName"`
MenuType string `json:"menuType"`
ParentID int `json:"parentId"`
Remark string `json:"remark"`
Sort int `json:"sort"`
}
type CooperationUserInfo struct {
UserId string `json:"userId"`
//用户编号
... ...
... ... @@ -11,7 +11,7 @@ type CompanyUserGetQuery struct {
//操作人
Operator domain.Operator `json:"-"`
// 用户编号
UsersId int64 `json:"usersId" valid:"Required"`
UsersId string `json:"usersId" valid:"Required"`
}
func (companyUserGetQuery *CompanyUserGetQuery) Valid(validation *validation.Validation) {
... ...
... ... @@ -11,7 +11,7 @@ type CooperationUserGetQuery struct {
//操作人
Operator domain.Operator `json:"-"`
// 用户编号
UsersId int64 `json:"usersId" valid:"Required"`
UsersId string `json:"usersId" valid:"Required"`
}
func (cooperationUserGetQuery *CooperationUserGetQuery) Valid(validation *validation.Validation) {
... ...
... ... @@ -5,10 +5,9 @@ import (
"time"
"github.com/linmadan/egglib-go/core/application"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/users/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/users/dto"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/users/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/dto"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
)
... ... @@ -23,24 +22,49 @@ func (usersService *UsersService) CompanyUserGet(companyUserGetQuery *query.Comp
companyUserGetQuery.Operator.CompanyId,
companyUserGetQuery.Operator.OrgId,
companyUserGetQuery.Operator.UserId)
result, err := creationUserGateway.UserGet(allied_creation_user.ReqGateUser{
UserId: companyUserGetQuery.UsersId,
userid, _ := strconv.Atoi(companyUserGetQuery.UsersId)
resultUser, err := creationUserGateway.UserGet(allied_creation_user.ReqGateUser{
UserId: userid,
})
if err != nil {
return nil, err
}
user := domain.Users{
UserId: strconv.FormatInt(result.UserId, 10),
UserInfo: result.GetUserBase(),
Org: result.GetOrg(),
Department: result.GetDepartment(),
Company: nil,
UserOrg: result.GetUserOrg(),
UserRole: result.GetUserRole(),
creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{})
var (
usersOrg []dto.UserOrg
userRole []dto.UserRole
)
for _, v := range resultUser.UserOrg {
usersOrg = append(usersOrg, dto.UserOrg{
OrgID: strconv.Itoa(v.OrgID),
OrgName: v.OrgName,
})
}
for _, v := range resultUser.UserRole {
userRole = append(userRole, dto.UserRole{
RoleID: strconv.Itoa(v.RoleID),
RoleName: v.RoleName,
OrgName: v.Ext.OrgName,
})
}
user := dto.CompanyUserInfo{
Email: resultUser.UserInfo.Email,
Phone: resultUser.UserInfo.Phone,
Avatar: resultUser.UserInfo.Avatar,
EnableStatus: resultUser.EnableStatus,
UsersCode: resultUser.UserCode,
UsersID: strconv.Itoa(resultUser.UserId),
UsersName: resultUser.UserInfo.UserName,
OrgID: strconv.Itoa(resultUser.Org.OrgId),
OrgName: resultUser.Org.OrgName,
DepartmentID: strconv.Itoa(resultUser.Department.DepartmentId),
DepartmentName: resultUser.Department.DepartmentName,
UsersOrg: usersOrg,
UsersRole: userRole,
}
datas := map[string]interface{}{
"user": user,
"userMenu": "", //TODO
"user": user,
}
return datas, err
}
... ... @@ -138,7 +162,7 @@ func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.Co
Phone: v.UserInfo.Phone,
EnableStatus: v.EnableStatus,
UserCode: v.UserCode,
UserId: strconv.FormatInt(v.UserId, 10),
UserId: strconv.Itoa(v.UserId),
UserName: v.UserInfo.UserName,
}
listData = append(listData, item)
... ... @@ -246,15 +270,16 @@ func (usersService *UsersService) CooperationUserGet(cooperationUserGetQuery *qu
cooperationUserGetQuery.Operator.CompanyId,
cooperationUserGetQuery.Operator.OrgId,
cooperationUserGetQuery.Operator.UserId)
userId, _ := strconv.Atoi(cooperationUserGetQuery.UsersId)
result, err := creationUserGateway.UserGet(allied_creation_user.ReqGateUser{
UserId: cooperationUserGetQuery.UsersId,
UserId: userId,
})
if err != nil {
return nil, err
}
deadline := result.CooperationInfo.CooperationDeadline.Unix()
userInfo := dto.CooperationUserInfo{
UserId: strconv.FormatInt(result.UserId, 10),
UserId: strconv.Itoa(result.UserId),
UserCode: result.UserCode,
EnableStatus: int32(result.EnableStatus),
CooperationCompany: result.CooperationInfo.CooperationCompany,
... ... @@ -288,14 +313,14 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery *
for _, v := range result.Users {
item = dto.CooperationUserItem{
CooperationCompany: v.CooperationInfo.CooperationCompany,
UserId: strconv.FormatInt(v.UserId, 10),
UserId: strconv.Itoa(v.UserId),
CooperationDeadline: v.CooperationInfo.CooperationDeadline.Unix(),
Phone: v.UserInfo.Phone,
EnableStatus: v.EnableStatus,
UserCode: v.UserCode,
UserName: v.UserInfo.UserName,
OrgName: v.Org.OrgName,
OrgId: strconv.FormatInt(v.Org.OrgId, 10),
OrgId: strconv.Itoa(v.Org.OrgId),
}
listData = append(listData, item)
}
... ...
package domain
const (
UsersStatusEnable int = 1
UsersStatusDisable int = 2
)
// 用户基础信息
type Users struct {
// 用户id
... ...
... ... @@ -22,7 +22,10 @@ type (
//更新自定义菜单
type (
ReqCompanySetCustomizeMenus struct {
CompanyId int64
CompanyId int64 `json:"companyId"`
MenuAlias string `json:"menuAlias"`
MenuId int `json:"menuId"`
Sort int `json:"sort"`
}
DataCompanySetCustomizeMenus struct {
... ... @@ -64,5 +67,18 @@ type (
}
DataCompanyGetCustomizeMenus struct {
Menus []struct {
Code string `json:"code"`
EnableStatus float64 `json:"enableStatus"`
Icon string `json:"icon"`
MenuAlias string `json:"menuAlias"`
MenuID float64 `json:"menuId"`
MenuName string `json:"menuName"`
MenuType string `json:"menuType"`
ParentID float64 `json:"parentId"`
ParentMenuName string `json:"parentMenuName"`
Remark string `json:"remark"`
Sort float64 `json:"sort"`
} `json:"menus"`
}
)
... ...
package allied_creation_user
import (
"strconv"
"time"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
//################用户模块##################
//单体用户详情数据
type UserDetail struct {
UserId int64 `json:"userId"`
UserBaseId int64 `json:"userBaseId"`
UserId int `json:"userId"`
UserBaseId int `json:"userBaseId"`
UserType int `json:"userType"`
UserCode string `json:"userCode"`
EnableStatus int `json:"enableStatus"`
... ... @@ -28,7 +25,7 @@ type UserDetail struct {
Avatar string `json:"avatar"`
} `json:"userInfo,omitempty"`
Company *struct {
CompanyId int64 `json:"companyId"`
CompanyId int `json:"companyId"`
CompanyName string `json:"companyName"`
Scale string `json:"scale"`
IndustryCategory string `json:"industryCategory"`
... ... @@ -36,23 +33,23 @@ type UserDetail struct {
Status int64 `json:"status"`
} `json:"company,omitempty"`
Org *struct {
OrgId int64 `json:"orgId"`
OrgId int `json:"orgId"`
OrgCode string `json:"orgCode"`
OrgName string `json:"orgName"`
} `json:"org,omitempty"`
Department *struct {
DepartmentId int64 `json:"departmentId"`
DepartmentId int `json:"departmentId"`
DepartmentName string `json:"departmentName"`
} `json:"department,omitempty"`
UserRole []struct {
RoleID int64 `json:"roleId"`
RoleID int `json:"roleId"`
RoleName string `json:"roleName"`
Ext struct {
OrgName string `json:"orgName"`
} `json:"ext,omitempty"`
} `json:"userRole"`
UserOrg []struct {
OrgID int64 `json:"orgId"`
OrgID int `json:"orgId"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
DeletedAt time.Time `json:"deletedAt"`
... ... @@ -60,99 +57,6 @@ type UserDetail struct {
} `json:"userOrg"`
}
func (info *UserDetail) GetUserBase() *domain.UsersBase {
return &domain.UsersBase{
UserId: strconv.Itoa(int(info.UserId)),
UserBaseId: strconv.Itoa(int(info.UserBaseId)),
UserType: info.UserType,
EnableStatus: info.EnableStatus,
Phone: info.UserInfo.Phone,
UserCode: info.UserCode,
UserName: info.UserInfo.UserName,
Email: info.UserInfo.Email,
Avatar: info.UserInfo.Avatar,
CooperationCompany: info.CooperationInfo.CooperationCompany,
CooperationDeadline: info.CooperationInfo.CooperationDeadline,
}
}
func (info *UserDetail) GetCompanyInfo() *domain.CompanyInfo {
if info.Company == nil {
return nil
}
return &domain.CompanyInfo{
CompanyId: strconv.Itoa(int(info.Company.CompanyId)),
CompanyName: info.Company.CompanyName,
Scale: info.Company.Scale,
Logo: "",
Address: "",
IndustryCategory: info.Company.IndustryCategory,
Contacts: "",
RegisteredTime: info.Company.RegisteredTime,
RegistStatus: info.Company.Status,
}
}
func (info *UserDetail) GetDepartment() *domain.Department {
if info.Department == nil {
return nil
}
return &domain.Department{
OrgId: info.Department.DepartmentId,
OrgName: info.Org.OrgName,
OrgCode: "",
ParentId: 0,
}
}
func (info *UserDetail) GetOrg() *domain.Orgs {
if info.Org == nil {
return nil
}
return &domain.Orgs{
OrgId: strconv.Itoa(int(info.Department.DepartmentId)),
OrgName: info.Org.OrgName,
OrgCode: "",
ParentId: 0,
}
}
func (info *UserDetail) GetUserOrg() []domain.Orgs {
var (
userOrgs []domain.Orgs
userOrg domain.Orgs
)
for _, v := range info.UserOrg {
userOrg = domain.Orgs{
OrgId: strconv.FormatInt(v.OrgID, 10),
OrgName: v.OrgName,
OrgCode: "",
ParentId: 0,
}
userOrgs = append(userOrgs, userOrg)
}
return userOrgs
}
func (info *UserDetail) GetUserRole() []domain.Roles {
var (
roles []domain.Roles
role domain.Roles
)
for _, v := range info.UserRole {
role = domain.Roles{
RoleId: strconv.FormatInt(v.RoleID, 10),
RoleName: v.RoleName,
// 用户的组织
Org: &domain.Orgs{
OrgName: v.RoleName,
},
}
roles = append(roles, role)
}
return roles
}
//搜索用户列表
type (
ReqUserSearch struct {
... ... @@ -259,7 +163,7 @@ type (
//获取用户
type (
ReqGateUser struct {
UserId int64 `json:"userId"`
UserId int `json:"userId"`
}
DataGateUser struct {
... ... @@ -375,7 +279,7 @@ type (
//返回用户有权限的菜单
type (
ReqUserAccessMenus struct {
UserId int64 `json:"userId"`
UserId int `json:"userId"`
}
DataUserAccessMenus struct {
}
... ...
package web_client
import (
"github.com/linmadan/egglib-go/web/beego"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/orgs/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/orgs/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/orgs/service"
)
type OrgsController struct {
beego.BaseController
}
func (controller *OrgsController) OrgAdd() {
orgsService := service.NewOrgsService(nil)
orgAddCommand := &command.OrgAddCommand{}
controller.Unmarshal(orgAddCommand)
data, err := orgsService.OrgAdd(orgAddCommand)
controller.Response(data, err)
}
func (controller *OrgsController) OrgUpdate() {
orgsService := service.NewOrgsService(nil)
orgUpdateCommand := &command.OrgUpdateCommand{}
controller.Unmarshal(orgUpdateCommand)
orgId := controller.GetString(":orgId")
orgUpdateCommand.OrgId = orgId
data, err := orgsService.OrgUpdate(orgUpdateCommand)
controller.Response(data, err)
}
func (controller *OrgsController) OrgList() {
orgsService := service.NewOrgsService(nil)
orgListQuery := &query.OrgListQuery{}
data, err := orgsService.OrgList(orgListQuery)
controller.Response(data, err)
}
func (controller *OrgsController) OrgGet() {
orgsService := service.NewOrgsService(nil)
orgGetQuery := &query.OrgGetQuery{}
orgId := controller.GetString(":orgId")
orgGetQuery.OrgId = orgId
data, err := orgsService.OrgGet(orgGetQuery)
controller.Response(data, err)
}
... ...
package web_client
import (
"github.com/linmadan/egglib-go/web/beego"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/roles/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/roles/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/roles/service"
)
type RolesController struct {
beego.BaseController
}
func (controller *RolesController) returnPageListData(count int64, data interface{}, err error, pageNumber int) {
dataMap := map[string]interface{}{
"totalRow": count,
"pageNumber": pageNumber,
"list": data,
}
controller.Response(dataMap, err)
}
func (controller *RolesController) RoleAdd() {
rolesService := service.NewRolesService(nil)
roleAddCommand := &command.RoleAddCommand{}
controller.Unmarshal(roleAddCommand)
data, err := rolesService.RoleAdd(roleAddCommand)
controller.Response(data, err)
}
func (controller *RolesController) RoleUpdate() {
rolesService := service.NewRolesService(nil)
roleUpdateCommand := &command.RoleUpdateCommand{}
controller.Unmarshal(roleUpdateCommand)
roleId := controller.GetString(":roleId")
roleUpdateCommand.RoleId = roleId
data, err := rolesService.RoleEdit(roleUpdateCommand)
controller.Response(data, err)
}
func (controller *RolesController) RoleList() {
rolesService := service.NewRolesService(nil)
roleListQuery := &query.RoleListQuery{}
controller.Unmarshal(roleListQuery)
cnt, data, err := rolesService.RoleList(roleListQuery)
controller.returnPageListData(cnt, data, err, roleListQuery.PageNumber)
}
func (controller *RolesController) RoleGet() {
rolesService := service.NewRolesService(nil)
roleGetQuery := &query.RoleGetQuery{}
roleId := controller.GetString(":roleId")
roleGetQuery.RoleId = roleId
data, err := rolesService.RoleGet(roleGetQuery)
controller.Response(data, err)
}
func (controller *RolesController) RoleUserInfo() {
rolesService := service.NewRolesService(nil)
roleUserInfoQuery := &query.RoleUserInfoQuery{}
roleId, _ := controller.GetInt64(":roleId")
roleUserInfoQuery.RoleId = roleId
data, err := rolesService.RoleUserInfo(roleUserInfoQuery)
controller.Response(data, err)
}
func (controller *RolesController) RoleUserAdd() {
rolesService := service.NewRolesService(nil)
roleUserAddQuery := &command.RoleUserAddCommand{}
controller.Unmarshal(roleUserAddQuery)
data, err := rolesService.RoleUserAdd(roleUserAddQuery)
controller.Response(data, err)
}
func (controller *RolesController) RoleUserDelete() {
rolesService := service.NewRolesService(nil)
roleUserDeleteQuery := &command.RoleUserDeleteCommand{}
controller.Unmarshal(roleUserDeleteQuery)
data, err := rolesService.RoleUserDelete(roleUserDeleteQuery)
controller.Response(data, err)
}
func (controller *RolesController) RoleUserBeforeEdit() {
rolesService := service.NewRolesService(nil)
roleUserBeforeEditQuery := &query.RoleUserBeforeEditQuery{}
data, err := rolesService.RoleUserBeforeEdit(roleUserBeforeEditQuery)
controller.Response(data, err)
}
func (controller *RolesController) RoleMenuBeforeEdit() {
rolesService := service.NewRolesService(nil)
roleMenuBeforeEditQuery := &query.RoleMenuBeforeEditQuery{}
data, err := rolesService.RoleMenuBeforeEdit(roleMenuBeforeEditQuery)
controller.Response(data, err)
}
func (controller *RolesController) RoleMenuEdit() {
rolesService := service.NewRolesService(nil)
roleMenuEditQuery := &command.RoleMenuEditCommand{}
controller.Unmarshal(roleMenuEditQuery)
roleId := controller.GetString(":roleId")
roleMenuEditQuery.RoleId = roleId
data, err := rolesService.RoleMenuEdit(roleMenuEditQuery)
controller.Response(data, err)
}
... ...
... ... @@ -2,9 +2,9 @@ package web_client
import (
"github.com/linmadan/egglib-go/web/beego"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/users/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/users/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/users/service"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/service"
)
type UsersController struct {
... ... @@ -47,7 +47,7 @@ func (controller *UsersController) CompanyUserList() {
func (controller *UsersController) CompanyUserGet() {
usersService := service.NewUsersService(nil)
companyUserGetQuery := &query.CompanyUserGetQuery{}
userId, _ := controller.GetInt64(":userId")
userId := controller.GetString(":userId")
companyUserGetQuery.UsersId = userId
data, err := usersService.CompanyUserGet(companyUserGetQuery)
controller.Response(data, err)
... ... @@ -96,7 +96,7 @@ func (controller *UsersController) CooperationUserList() {
func (controller *UsersController) CooperationUserGet() {
usersService := service.NewUsersService(nil)
cooperationUserGetQuery := &query.CooperationUserGetQuery{}
userId, _ := controller.GetInt64(":userId")
userId := controller.GetString(":userId")
cooperationUserGetQuery.UsersId = userId
data, err := usersService.CooperationUserGet(cooperationUserGetQuery)
controller.Response(data, err)
... ...
package routers
import (
"github.com/beego/beego/v2/server/web"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/controllers/web_client"
)
func init() {
web.Router("/v1/web/orgs/", &web_client.OrgsController{}, "Post:OrgAdd")
web.Router("/v1/web/orgs/:orgId", &web_client.OrgsController{}, "Put:OrgUpdate")
web.Router("/v1/web/orgs/search", &web_client.OrgsController{}, "Post:OrgList")
web.Router("/v1/web/orgs/:orgId", &web_client.OrgsController{}, "Get:OrgGet")
}
... ...
package routers
import (
"github.com/beego/beego/v2/server/web"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/controllers/web_client"
)
func init() {
web.Router("/v1/web/roles/", &web_client.RolesController{}, "Post:RoleAdd")
web.Router("/v1/web/roles/:roleId", &web_client.RolesController{}, "Put:RoleUpdate")
web.Router("/v1/web/roles/search", &web_client.RolesController{}, "Post:RoleList")
web.Router("/v1/web/roles/:roleId", &web_client.RolesController{}, "Get:RoleGet")
web.Router("/v1/web/roles/role-user/:roleId", &web_client.RolesController{}, "Get:RoleUserInfo")
web.Router("/v1/web/roles/role-user", &web_client.RolesController{}, "Post:RoleUserAdd")
web.Router("/v1/web/roles/role-user", &web_client.RolesController{}, "Delete:RoleUserDelete")
web.Router("/v1/web/roles/role-user/before-edit", &web_client.RolesController{}, "Get:RoleUserBeforeEdit")
web.Router("/v1/web/roles/role-menu/before-edit", &web_client.RolesController{}, "Get:RoleMenuBeforeEdit")
web.Router("/v1/web/roles/role-menu/:roleId", &web_client.RolesController{}, "Put:RoleMenuEdit")
}
... ...