作者 tangxuhui

用户管理需要的下拉列表

@@ -28,8 +28,10 @@ type CompanyUserInfo struct { @@ -28,8 +28,10 @@ type CompanyUserInfo struct {
28 } 28 }
29 29
30 type UserOrg struct { 30 type UserOrg struct {
31 - OrgID string `json:"orgId"`  
32 - OrgName string `json:"orgName"` 31 + OrgID string `json:"orgId"`
  32 + OrgName string `json:"orgName"`
  33 + ParentId string `json:"parentId"`
  34 + IsOrg int `json:"isOrg"`
33 } 35 }
34 36
35 type UserRole struct { 37 type UserRole struct {
@@ -409,8 +409,10 @@ func (usersService *UsersService) SelectorCompanyOrg(selectorQuery *query.Compan @@ -409,8 +409,10 @@ func (usersService *UsersService) SelectorCompanyOrg(selectorQuery *query.Compan
409 ) 409 )
410 for _, v := range result.Orgs { 410 for _, v := range result.Orgs {
411 item = dto.UserOrg{ 411 item = dto.UserOrg{
412 - OrgID: strconv.Itoa(v.OrgID),  
413 - OrgName: v.OrgName, 412 + OrgID: strconv.Itoa(v.OrgID),
  413 + OrgName: v.OrgName,
  414 + ParentId: strconv.Itoa(v.ParentID),
  415 + IsOrg: v.IsOrg,
414 } 416 }
415 dataList = append(dataList, item) 417 dataList = append(dataList, item)
416 } 418 }
@@ -446,3 +448,37 @@ func (usersService *UsersService) SelectorCompanyRole(selectorQuery *query.Compa @@ -446,3 +448,37 @@ func (usersService *UsersService) SelectorCompanyRole(selectorQuery *query.Compa
446 } 448 }
447 return int64(result.Count), dataList, nil 449 return int64(result.Count), dataList, nil
448 } 450 }
  451 +
  452 +//CompanyOrgSelector 获取公司全组织部门的下拉列表
  453 +func (usersService *UsersService) SelectorCompanyOrgAll(selectorQuery *query.CompanyOrgSelectorQuery) (int64, interface{}, error) {
  454 + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
  455 + selectorQuery.Operator.CompanyId,
  456 + selectorQuery.Operator.OrgId,
  457 + selectorQuery.Operator.UserId)
  458 + result, err := creationUserGateway.OrgSearch(allied_creation_user.ReqOrgSearch{
  459 + CompanyId: int(selectorQuery.Operator.CompanyId),
  460 + DepName: "",
  461 + IsOrg: 0,
  462 + Limit: 0,
  463 + Offset: 0,
  464 + OrgCode: "",
  465 + ParentId: 0,
  466 + })
  467 + if err != nil {
  468 + return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  469 + }
  470 + var (
  471 + dataList []dto.UserOrg
  472 + item dto.UserOrg
  473 + )
  474 + for _, v := range result.Orgs {
  475 + item = dto.UserOrg{
  476 + OrgID: strconv.Itoa(v.OrgID),
  477 + OrgName: v.OrgName,
  478 + ParentId: strconv.Itoa(v.ParentID),
  479 + IsOrg: v.IsOrg,
  480 + }
  481 + dataList = append(dataList, item)
  482 + }
  483 + return int64(result.Count), dataList, nil
  484 +}
@@ -139,3 +139,13 @@ func (controller *UsersController) SelectorCompanyRole() { @@ -139,3 +139,13 @@ func (controller *UsersController) SelectorCompanyRole() {
139 cnt, data, err := usersService.SelectorCompanyRole(selectorQuery) 139 cnt, data, err := usersService.SelectorCompanyRole(selectorQuery)
140 controller.returnPageListData(cnt, data, err, selectorQuery.PageNumber) 140 controller.returnPageListData(cnt, data, err, selectorQuery.PageNumber)
141 } 141 }
  142 +
  143 +//CompanyOrgSelector 全组织部门选择表
  144 +func (controller *UsersController) SelectorCompanyOrgAll() {
  145 + usersService := service.NewUsersService(nil)
  146 + selectorQuery := &query.CompanyOrgSelectorQuery{}
  147 + controller.Unmarshal(selectorQuery)
  148 + selectorQuery.Operator = controller.GetOperator()
  149 + _, data, err := usersService.SelectorCompanyOrgAll(selectorQuery)
  150 + controller.Response(data, err)
  151 +}
@@ -20,5 +20,5 @@ func init() { @@ -20,5 +20,5 @@ func init() {
20 web.Router("/v1/web/users/cooperation-user/reset-password", &web_client.UsersController{}, "Put:CooperationUserResetPassword") 20 web.Router("/v1/web/users/cooperation-user/reset-password", &web_client.UsersController{}, "Put:CooperationUserResetPassword")
21 web.Router("/v1/web/users/selector/org", &web_client.UsersController{}, "Post:SelectorCompanyOrg") 21 web.Router("/v1/web/users/selector/org", &web_client.UsersController{}, "Post:SelectorCompanyOrg")
22 web.Router("/v1/web/users/selector/role", &web_client.UsersController{}, "Post:SelectorCompanyRole") 22 web.Router("/v1/web/users/selector/role", &web_client.UsersController{}, "Post:SelectorCompanyRole")
23 - 23 + web.Router("/v1/web/users/selector/org/all", &web_client.UsersController{}, "Post:SelectorCompanyOrgAll")
24 } 24 }