作者 tangxuhui

用户管理需要的下拉列表

... ... @@ -30,6 +30,8 @@ type CompanyUserInfo struct {
type UserOrg struct {
OrgID string `json:"orgId"`
OrgName string `json:"orgName"`
ParentId string `json:"parentId"`
IsOrg int `json:"isOrg"`
}
type UserRole struct {
... ...
... ... @@ -411,6 +411,8 @@ func (usersService *UsersService) SelectorCompanyOrg(selectorQuery *query.Compan
item = dto.UserOrg{
OrgID: strconv.Itoa(v.OrgID),
OrgName: v.OrgName,
ParentId: strconv.Itoa(v.ParentID),
IsOrg: v.IsOrg,
}
dataList = append(dataList, item)
}
... ... @@ -446,3 +448,37 @@ func (usersService *UsersService) SelectorCompanyRole(selectorQuery *query.Compa
}
return int64(result.Count), dataList, nil
}
//CompanyOrgSelector 获取公司全组织部门的下拉列表
func (usersService *UsersService) SelectorCompanyOrgAll(selectorQuery *query.CompanyOrgSelectorQuery) (int64, interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
selectorQuery.Operator.CompanyId,
selectorQuery.Operator.OrgId,
selectorQuery.Operator.UserId)
result, err := creationUserGateway.OrgSearch(allied_creation_user.ReqOrgSearch{
CompanyId: int(selectorQuery.Operator.CompanyId),
DepName: "",
IsOrg: 0,
Limit: 0,
Offset: 0,
OrgCode: "",
ParentId: 0,
})
if err != nil {
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
var (
dataList []dto.UserOrg
item dto.UserOrg
)
for _, v := range result.Orgs {
item = dto.UserOrg{
OrgID: strconv.Itoa(v.OrgID),
OrgName: v.OrgName,
ParentId: strconv.Itoa(v.ParentID),
IsOrg: v.IsOrg,
}
dataList = append(dataList, item)
}
return int64(result.Count), dataList, nil
}
... ...
... ... @@ -139,3 +139,13 @@ func (controller *UsersController) SelectorCompanyRole() {
cnt, data, err := usersService.SelectorCompanyRole(selectorQuery)
controller.returnPageListData(cnt, data, err, selectorQuery.PageNumber)
}
//CompanyOrgSelector 全组织部门选择表
func (controller *UsersController) SelectorCompanyOrgAll() {
usersService := service.NewUsersService(nil)
selectorQuery := &query.CompanyOrgSelectorQuery{}
controller.Unmarshal(selectorQuery)
selectorQuery.Operator = controller.GetOperator()
_, data, err := usersService.SelectorCompanyOrgAll(selectorQuery)
controller.Response(data, err)
}
... ...
... ... @@ -20,5 +20,5 @@ func init() {
web.Router("/v1/web/users/cooperation-user/reset-password", &web_client.UsersController{}, "Put:CooperationUserResetPassword")
web.Router("/v1/web/users/selector/org", &web_client.UsersController{}, "Post:SelectorCompanyOrg")
web.Router("/v1/web/users/selector/role", &web_client.UsersController{}, "Post:SelectorCompanyRole")
web.Router("/v1/web/users/selector/org/all", &web_client.UsersController{}, "Post:SelectorCompanyOrgAll")
}
... ...