Browse Source

人员档案

v2_dev
超级管理员 3 years ago
parent
commit
90cc34d9e4
  1. 2
      api/version1/administrativeorganization/duties.go
  2. 66
      api/version1/administrativeorganization/govcont.go
  3. 273
      api/version1/administrativeorganization/position.go
  4. 19
      api/version1/administrativeorganization/team.go
  5. 22
      api/version1/administrativeorganization/type.go
  6. 13
      api/version1/personnelapi/staffarchives.go
  7. 8
      apirouter/organization/organization_group.go
  8. 1
      models/position.go
  9. 18
      overall/overallhandle/overall_handle.go
  10. 5
      overall/overallhandle/type.go

2
api/version1/administrativeorganization/duties.go

@ -40,7 +40,7 @@ func (o *OrganizationApi) DutiesList(c *gin.Context) {
if totalErr != nil {
total = 0
}
errGorm := gormDb.Limit(requestData.PageSize).Offset(overallhandle.LimitPage(requestData.Page, requestData.PageSize)).Find(&dutiesList).Error
errGorm := gormDb.Order("`weight` ASC").Limit(requestData.PageSize).Offset(overallhandle.LimitPage(requestData.Page, requestData.PageSize)).Find(&dutiesList).Error
if errGorm != nil {
overallhandle.Result(105, errGorm, c)
} else {

66
api/version1/administrativeorganization/govcont.go

@ -42,7 +42,11 @@ func (o *OrganizationApi) GovList(c *gin.Context) {
gormDb = gormDb.Where("administrative_organization.organization_type = ?", requestData.GovClass)
}
if requestData.Superior != "" {
gormDb = gormDb.Where("administrative_organization.superior = ?", requestData.Superior)
// gormDb = gormDb.Where("administrative_organization.superior = ?", requestData.Superior)
superiorInt, _ := strconv.ParseInt(requestData.Superior, 10, 64)
var sunAry overallhandle.AllSunList[int64]
sunAry.GetAllSunOrg(superiorInt)
gormDb = gormDb.Where("administrative_organization.superior = ? OR administrative_organization.`id` IN ?", requestData.Superior, sunAry.SunList)
}
var total int64
totalErr := gormDb.Count(&total).Error
@ -300,6 +304,56 @@ func (o *OrganizationApi) GovThree(c *gin.Context) {
overallhandle.Result(0, govMapThree, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2022-11-21 08:59:34
@ 功能: 行政组织树
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (o *OrganizationApi) GovThreeIng(c *gin.Context) {
var requestData govThreeType
c.ShouldBindJSON(&requestData)
if requestData.Id == 0 && requestData.IdStr == "" {
requestData.Id = 0
}
if requestData.IdStr != "" {
idInt64, _ := strconv.ParseInt(requestData.IdStr, 10, 64)
requestData.Id = idInt64
}
fmt.Printf("requestData---------------->%v\n", requestData)
var govMap overallhandle.MenuList
// gormDb := overall.CONSTANT_DB_HR.Model(&models.AdministrativeOrganization{}).Select("administrative_organization.*,aot.name as classname,aot.level").Joins("left join administrative_organization_type as aot on aot.id = administrative_organization.organization_type").Where("administrative_organization.`state` IN ?", []int{1, 2}).Where("administrative_organization.id NOT IN ?", []int{312, 293, 305, 306, 307})
gormDb := overall.CONSTANT_DB_HR.Model(&models.AdministrativeOrganization{}).Select("administrative_organization.*,aot.name as classname,aot.level").Joins("left join administrative_organization_type as aot on aot.id = administrative_organization.organization_type").Where("administrative_organization.`state` BETWEEN ? AND ?", 1, 2)
if requestData.All == 0 {
requestData.Id = 312
gormDb = gormDb.Where("administrative_organization.id NOT IN ?", []int{312, 293, 305, 306, 307})
}
if requestData.Level != 0 {
gormDb = gormDb.Where("aot.level <= ?", requestData.Level)
}
err := gormDb.Find(&govMap).Error
if err != nil {
overallhandle.Result(107, err, c)
return
}
// fmt.Printf("id==========>%v", govMap)
// govMap.GovRecursion(requestData.Id, 0)
fmt.Printf("govAry---------------->%v\n", requestData.Id)
govMapThree := overallhandle.GovThreeList(requestData.Id, govMap)
overallhandle.Result(0, govMapThree, c)
}
// 获取当前行政组织的所有子类
func (o *OrganizationApi) GetOrgAllSun(c *gin.Context) {
var requestData overallhandle.GetId
@ -313,8 +367,14 @@ func (o *OrganizationApi) GetOrgAllSun(c *gin.Context) {
}
// fmt.Printf("\nrequestData---->%v\n", requestData)
var idAry []int64
idAry = overallhandle.GetDepartmentSun(requestData.Id, idAry)
idAry = append(idAry, requestData.Id)
// idAry = overallhandle.GetDepartmentSun(requestData.Id, idAry)
// idAry = append(idAry, requestData.Id)
var sunAry overallhandle.AllSunList[int64]
sunAry.GetAllSunOrg(requestData.Id)
sunAry.SunList = append(sunAry.SunList, requestData.Id)
idAry = sunAry.SunList
//获取行政组织信息
var orgList []models.AdministrativeOrganization
if len(idAry) < 1 {

273
api/version1/administrativeorganization/position.go

@ -29,13 +29,22 @@ func (o *OrganizationApi) PositionList(c *gin.Context) {
gormDb = gormDb.Where("p.name LIKE ?", "%"+requestData.Name+"%")
}
if requestData.Number != "" {
gormDb = gormDb.Where("p.number = ?", requestData.Number)
gormDb = gormDb.Where("p.number LIKE ?", "%"+requestData.Number+"%")
}
if requestData.Duties != "" {
gormDb = gormDb.Where("p.duties = ?", requestData.Duties)
}
if requestData.Organization != "" {
gormDb = gormDb.Where("p.administrative_organization = ?", requestData.Organization)
orgIdInt, _ := strconv.ParseInt(requestData.Organization, 10, 64)
// orgIdList := overallhandle.GetDepartmentSun(orgIdInt, []int64{})
// orgIdList = append(orgIdList, orgIdInt)
// gormDb = gormDb.Where("p.administrative_organization IN ?", orgIdList)
// fmt.Printf("所有子集--->%v\n", orgIdList)
var sunAry overallhandle.AllSunList[int64]
sunAry.GetAllSunOrg(orgIdInt)
sunAry.SunList = append(sunAry.SunList, orgIdInt)
gormDb = gormDb.Where("p.administrative_organization IN ?", sunAry.SunList)
}
if requestData.InCharge != 0 {
gormDb = gormDb.Where("p.person_in_charge = ?", requestData.InCharge)
@ -50,7 +59,8 @@ func (o *OrganizationApi) PositionList(c *gin.Context) {
total = 0
}
var positionAry []positionOutInfo
errGorm := gormDb.Order("p.department DESC,p.duties DESC,p.duties ASC").Limit(requestData.PageSize).Offset(overallhandle.LimitPage(requestData.Page, requestData.PageSize)).Find(&positionAry).Error
// errGorm := gormDb.Order("p.department DESC,p.duties DESC,p.duties ASC").Limit(requestData.PageSize).Offset(overallhandle.LimitPage(requestData.Page, requestData.PageSize)).Find(&positionAry).Error
errGorm := gormDb.Order("p.id DESC").Limit(requestData.PageSize).Offset(overallhandle.LimitPage(requestData.Page, requestData.PageSize)).Find(&positionAry).Error
for i, v := range positionAry {
var getSpur models.Position
getWhe := overallhandle.MapOut()
@ -185,6 +195,26 @@ func (o *OrganizationApi) GetPositionCont(c *gin.Context) {
getSpur.GetCont(getWhe, "number", "name")
postCont.SuperiorNumber = getSpur.Number
postCont.SuperiorName = getSpur.Name
if postCont.OrgList != "" {
json.Unmarshal([]byte(postCont.OrgList), postCont.OrgListAry)
} else {
groupId, companyId, departmentId, sunDepartId, workShopId := overallhandle.GetOrgStructure(postCont.AdministrativeOrganization)
if groupId != 0 && overallhandle.IsInTrue[int64](groupId, postCont.OrgListAry) == false {
postCont.OrgListAry = append(postCont.OrgListAry, groupId)
}
if companyId != 0 && overallhandle.IsInTrue[int64](companyId, postCont.OrgListAry) == false {
postCont.OrgListAry = append(postCont.OrgListAry, companyId)
}
if departmentId != 0 && overallhandle.IsInTrue[int64](departmentId, postCont.OrgListAry) == false {
postCont.OrgListAry = append(postCont.OrgListAry, departmentId)
}
if sunDepartId != 0 && overallhandle.IsInTrue[int64](sunDepartId, postCont.OrgListAry) == false {
postCont.OrgListAry = append(postCont.OrgListAry, sunDepartId)
}
if workShopId != 0 && overallhandle.IsInTrue[int64](workShopId, postCont.OrgListAry) == false {
postCont.OrgListAry = append(postCont.OrgListAry, workShopId)
}
}
overallhandle.Result(0, postCont, c)
}
@ -431,3 +461,240 @@ func MenuOperation(jurisd int, menuId int64) (isTrue bool, operation []models.Me
}
return
}
/*
*
@ 作者: 秦东
@ 时间: 2022-11-22 08:40:38
@ 功能: 根据行政组织获取岗位
@ 参数
#requestData 行政组织数组
@ 返回值
#
@ 方法原型
#func (o *OrganizationApi) BasisOrgGetPostList(c *gin.Context)
*/
func (o *OrganizationApi) BasisOrgGetPostList(c *gin.Context) {
var requestData OrgGivePost
err := c.ShouldBindJSON(&requestData)
if err != nil || len(requestData.Id) < 1 {
overallhandle.Result(100, requestData, c)
return
}
orgList := []int64{312, 313}
groupId, companyId, departmentId, _, _ := overallhandle.GetOrgStructure(requestData.Id[len(requestData.Id)-1])
fmt.Printf("空间看到----->%v----->%v----->%v\n", groupId, companyId, departmentId)
if overallhandle.IsInTrue[int64](groupId, orgList) == false {
orgList = append(orgList, groupId)
}
if overallhandle.IsInTrue[int64](companyId, orgList) == false {
orgList = append(orgList, companyId)
}
var postList []models.Position
err = overall.CONSTANT_DB_HR.Model(&models.Position{}).Where("`state` = 1 AND `administrative_organization` IN ?", orgList).Or("`department` = ?", departmentId).Order("person_in_charge ASC").Find(&postList).Error
if err != nil {
overallhandle.Result(107, err, c)
return
}
overallhandle.Result(0, postList, c)
}
/**
@ 作者: 秦东
@ 时间: 2022-11-22 10:04:48
@ 功能: 添加职位岗位新版
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
//
func (o *OrganizationApi) AddPositionContNew(c *gin.Context) {
var requestData addPositionInfoNew
err := c.ShouldBindJSON(&requestData)
if err != nil {
overallhandle.Result(100, err, c)
return
}
if requestData.Number == "" {
overallhandle.Result(101, requestData.Number, c, "职位编码不能为空!")
return
}
if requestData.Name == "" {
overallhandle.Result(101, requestData.Name, c, "职位名称不能为空!")
return
}
if requestData.Duties == 0 {
overallhandle.Result(101, requestData.Duties, c, "请指定该职位的职务!")
return
}
if len(requestData.Organization) < 1 {
overallhandle.Result(101, requestData.Organization, c, "请指定该职位归属的行政组织!")
return
}
orgListJson, _ := json.Marshal(requestData.Organization)
if requestData.InCharge == 0 {
requestData.InCharge = 2
}
var positionCont models.Position
//判断编号是否已经存在
isNumExit := overallhandle.MapOut()
isNumExit["number"] = requestData.Number
judgeNumErr := positionCont.GetCont(isNumExit)
if judgeNumErr == nil {
overallhandle.Result(101, isNumExit, c, "该编号已经存在!请不要重复使用!")
return
}
organizationId := requestData.Organization[len(requestData.Organization)-1]
_, companyId, departmentId, _, _ := overallhandle.GetOrgStructure(organizationId)
if departmentId == 0 {
departmentId = companyId
}
//判断岗位名称是否已经存在
isExit := overallhandle.MapOut()
isExit["department"] = departmentId
isExit["name"] = requestData.Name
isExit["administrative_organization"] = organizationId
judgeErr := positionCont.GetCont(isExit)
if judgeErr == nil {
overallhandle.Result(101, isExit, c, "该职位在本行政组织下已经存在!请不要重复添加")
return
}
positionCont.Number = requestData.Number
positionCont.Name = requestData.Name
positionCont.Duties = requestData.Duties
positionCont.AdministrativeOrganization = organizationId
positionCont.Superior = requestData.Superior
positionCont.PersonInCharge = requestData.InCharge
positionCont.Department = departmentId
positionCont.State = 1
positionCont.Time = time.Now().Unix()
positionCont.OrgList = string(orgListJson)
addDataErr := overall.CONSTANT_DB_HR.Create(&positionCont).Error
if addDataErr != nil {
overallhandle.Result(104, addDataErr, c)
} else {
overallhandle.Result(0, addDataErr, c)
}
}
/*
*
@ 作者: 秦东
@ 时间: 2022-11-23 08:44:11
@ 功能: 编辑职位岗位
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (o *OrganizationApi) EitePositionContNew(c *gin.Context) {
var requestData eitePositionInfoNes
err := c.ShouldBindJSON(&requestData)
if err != nil {
overallhandle.Result(100, err, c)
return
}
if requestData.Id == 0 && requestData.IdStr == "" {
overallhandle.Result(101, err, c, "行政类别Id不能为空!")
return
}
if len(requestData.Organization) < 1 {
overallhandle.Result(101, requestData.Organization, c, "请指定该职位归属的行政组织!")
return
}
if requestData.IdStr != "" {
idInt64, _ := strconv.ParseInt(requestData.IdStr, 10, 64)
requestData.Id = idInt64
}
whereAry := overallhandle.MapOut()
whereAry["id"] = requestData.Id
var govCont models.Position
judgeErr := govCont.GetCont(whereAry)
if judgeErr != nil {
overallhandle.Result(107, judgeErr, c)
return
}
saveData := overallhandle.MapOut()
if requestData.Number != "" && requestData.Number != govCont.Number {
isNumExit := overallhandle.MapOut()
isNumExit["number"] = requestData.Number
var govContNum models.Position
judgeNumErr := govContNum.GetCont(isNumExit, "id", "number")
if judgeNumErr == nil {
overallhandle.Result(101, isNumExit, c, "该编号已经存在!请不要重复使用!")
return
}
saveData["number"] = requestData.Number
}
organizationId := requestData.Organization[len(requestData.Organization)-1]
_, companyId, departmentId, _, _ := overallhandle.GetOrgStructure(organizationId)
if departmentId == 0 {
departmentId = companyId
}
departIsTrue := false
if departmentId != 0 && departmentId != govCont.Department {
departIsTrue = true
orgListJson, _ := json.Marshal(requestData.Organization)
saveData["department"] = departmentId
saveData["orglist"] = orgListJson
}
if requestData.Name != "" && requestData.Name != govCont.Name {
if departIsTrue == true {
//判断岗位名称是否已经存在
isExit := overallhandle.MapOut()
isExit["department"] = departmentId
isExit["name"] = requestData.Name
var govContName models.Position
judgeErr := govContName.GetCont(isExit, "id", "department", "name")
if judgeErr == nil {
overallhandle.Result(101, isExit, c, "该职位在本部门下已经存在!请不要重复添加")
return
}
}
saveData["name"] = requestData.Name
}
if requestData.Duties != 0 && requestData.Duties != govCont.Duties {
saveData["duties"] = requestData.Duties
}
if organizationId != 0 && organizationId != govCont.AdministrativeOrganization {
saveData["administrative_organization"] = organizationId
}
if requestData.Superior != 0 && requestData.Superior != govCont.Superior {
saveData["superior"] = requestData.Superior
}
if requestData.InCharge != 0 {
saveData["person_in_charge"] = requestData.InCharge
}
if len(saveData) < 1 {
overallhandle.Result(0, saveData, c)
return
}
saveData["time"] = time.Now().Unix()
eiteErr := govCont.EiteCont(whereAry, saveData)
if eiteErr != nil {
overallhandle.Result(106, eiteErr, c)
} else {
overallhandle.Result(0, saveData, c)
}
}

19
api/version1/administrativeorganization/team.go

@ -4,6 +4,7 @@ import (
"hr_server/models"
"hr_server/overall"
"hr_server/overall/overallhandle"
"strconv"
"time"
"github.com/gin-gonic/gin"
@ -111,10 +112,17 @@ func (o *OrganizationApi) EidtDelTeamCont(c *gin.Context) {
overallhandle.Result(100, requestData, c)
return
}
if requestData.IdStr == "" {
// fmt.Printf("requestData.IdStr--1->%v--->%v\n", requestData.IdStr, requestData.Id)
if requestData.IdStr == "" && requestData.Id == 0 {
overallhandle.Result(101, requestData, c)
return
}
if requestData.IdStr != "" {
idStrToInt, _ := strconv.ParseInt(requestData.IdStr, 10, 64)
requestData.Id = idStrToInt
}
// fmt.Printf("requestData.IdStr--->%v--->%v\n", requestData.IdStr, requestData.Id)
if requestData.State == 0 {
requestData.State = 1
}
@ -122,17 +130,17 @@ func (o *OrganizationApi) EidtDelTeamCont(c *gin.Context) {
requestData.IsTrue = 2
}
var getTeamCont models.TeamGroup
getErr := getTeamCont.GetCont(map[string]interface{}{"`id`": requestData.IdStr})
getErr := getTeamCont.GetCont(map[string]interface{}{"`id`": requestData.Id})
if getErr != nil {
overallhandle.Result(105, getErr, c)
return
}
whereAry := overallhandle.MapOut()
whereAry["id"] = requestData.IdStr
whereAry["id"] = requestData.Id
saveData := overallhandle.MapOut()
saveData["time"] = time.Now().Unix()
saveData["state"] = requestData.State
// fmt.Printf("requestData.IdStr-2-->%v--->%v\n", whereAry, saveData)
if requestData.State != 3 {
eiteErr := getTeamCont.EiteTeamGroupCont(whereAry, saveData)
if eiteErr != nil {
@ -159,13 +167,14 @@ func (o *OrganizationApi) EidtDelTeamCont(c *gin.Context) {
}
}
}
}
// 班组列表
func (o *OrganizationApi) TeamContList(c *gin.Context) {
var requestData JobClassPageSelect
c.ShouldBindJSON(&requestData)
gormDb := overall.CONSTANT_DB_HR.Model(&models.TeamGroup{}).Where("`state` = 1")
gormDb := overall.CONSTANT_DB_HR.Model(&models.TeamGroup{}).Where("`state` IN (1,2)")
if requestData.Name != "" {
gormDb = gormDb.Where("`name` LIKE ?", "%"+requestData.Name+"%")
}

22
api/version1/administrativeorganization/type.go

@ -169,6 +169,7 @@ type positionOutInfo struct {
SuperiorNumber string `json:"superiornumber"` //上级编号
DepartmentName string `json:"departmentname"`
IdStr string `json:"idstr"`
OrgListAry []int64 `json:"orglistary"`
}
// 行政组织树查询
@ -244,3 +245,24 @@ type OrgAndPeopleThreeZZ struct {
*OrgAndPeople
Child []*OrgAndPeopleThreeZZ `json:"child"` //子栏目
}
// 根据行政组织获取岗位
type OrgGivePost struct {
Id []int64 `json:"id"`
}
// 添加职位(岗位)新版
type addPositionInfoNew struct {
Number string `json:"number"` //职位编码
NameVal //职位名称
Duties int64 `json:"duties"` //职务
Organization []int64 `json:"organization"` //归属行政组织
Superior int64 `json:"superior"` //上级
InCharge int `json:"incharge"` //是否为本部门负责人(1:是;2:否)
}
// 编辑职位(岗位)
type eitePositionInfoNes struct {
overallhandle.GetId
addPositionInfoNew
}

13
api/version1/personnelapi/staffarchives.go

@ -42,10 +42,15 @@ func (s *StaffApi) ArchivesList(c *gin.Context) {
// gormDb = gormDb.Where("FIND_IN_SET(?,`deparment`)", requestData.Deparment)
// }
if requestData.AdminOrg != 0 {
var idAry []int64
idAry = overallhandle.GetDepartmentSun(requestData.AdminOrg, idAry)
idAry = append(idAry, requestData.AdminOrg)
gormDb = gormDb.Where("admin_org IN ?", idAry)
// var idAry []int64
// idAry = overallhandle.GetDepartmentSun(requestData.AdminOrg, idAry)
// idAry = append(idAry, requestData.AdminOrg)
// gormDb = gormDb.Where("admin_org IN ?", idAry)
var sunAry overallhandle.AllSunList[int64]
sunAry.GetAllSunOrg(requestData.AdminOrg)
sunAry.SunList = append(sunAry.SunList, requestData.AdminOrg)
gormDb = gormDb.Where("admin_org IN ?", sunAry.SunList)
}
if requestData.Position != 0 {
gormDb = gormDb.Where("position = ?", requestData.Position)

8
apirouter/organization/organization_group.go

@ -39,6 +39,7 @@ func (o *OrganizationRoute) InitRouterGroup(route *gin.RouterGroup) {
apiRouter.POST("eitegovstateordel", apiHandle.EiteGovStateOrDel) //编辑行政组织状态或删除
apiRouter.POST("govthree", apiHandle.GovThree) //行政组织树
apiRouter.POST("govthreeing", apiHandle.GovThreeIng) //行政组织树(副本)
apiRouter.POST("getorgallsun", apiHandle.GetOrgAllSun) //获取当前行政组织的所有子类
apiRouter.POST("govthreeaboutman", apiHandle.GovThreeAboutMan) //行政组织树及相关人员
@ -50,9 +51,14 @@ func (o *OrganizationRoute) InitRouterGroup(route *gin.RouterGroup) {
apiRouter.POST("getpositioncont", apiHandle.GetPositionCont) //获取职位(岗位)
apiRouter.POST("addpositioncont", apiHandle.AddPositionCont) //添加职位(岗位)
apiRouter.POST("eitepositioncont", apiHandle.EitePositionCont) //编辑职位(岗位)
apiRouter.POST("eitepositioncontnew", apiHandle.EitePositionContNew) //编辑职位(岗位)新
apiRouter.POST("eitepositionstateordel", apiHandle.EitePositionStateOrDel) //编辑职位(岗位)状态或删除
apiRouter.POST("getpositionrole", apiHandle.GetPositionRole) //岗位(职位)配权 GetPositionRole
apiRouter.POST("basis_org_postList", apiHandle.BasisOrgGetPostList) //根据行政组织获取岗位
apiRouter.POST("addpositioncontnew", apiHandle.AddPositionContNew) //添加职位(岗位)新版
//班组
apiRouter.POST("teamcontlist", apiHandle.TeamContList) //班组列表
apiRouter.POST("getteamcont", apiHandle.GetTeamCont) //获取班组
@ -98,6 +104,8 @@ func (o *OrganizationRouteOpen) InitRouterGroup(route *gin.RouterGroup) {
apiRouter.POST("govthree", apiHandle.GovThree) //行政组织树
apiRouter.POST("getorgallsun", apiHandle.GetOrgAllSun) //获取当前行政组织的所有子类
apiRouter.POST("govthreeing", apiHandle.GovThreeIng) //行政组织树(副本)
apiRouter.POST("govthreeaboutman", apiHandle.GovThreeAboutMan) //行政组织树及相关人员
apiRouter.POST("search_org_people", apiHandle.SearchOrgAndPeople) //角色组织与人员搜索列表

1
models/position.go

@ -21,6 +21,7 @@ type Position struct {
ButtonPermit string `json:"buttonpermit" gorm:"column:button_permit;type:longtext;comment:按钮许可"`
School int64 `json:"school" gorm:"column:school;type:bigint(20) unsigned;default:0;not null;comment:部门"`
KingdeeId string `json:"kingdeeid" gorm:"column:kingdeeid;type:varchar(255) unsigned;default:'';comment:金蝶对照ID"`
OrgList string `json:"orglist" gorm:"column:orglist;type:text;comment:行政组织关系"`
}
func (Position *Position) TableName() string {

18
overall/overallhandle/overall_handle.go

@ -738,3 +738,21 @@ func GetDepartmentSun(superior int64, idary []int64) (orgIdAry []int64) {
}
return
}
// 获取所有子集
func (a *AllSunList[int64]) GetAllSunOrg(superior int64) (err error) {
var orgAry []models.AdministrativeOrganization
err = overall.CONSTANT_DB_HR.Model(&models.AdministrativeOrganization{}).Select("`id`").Where("`state` = 1 AND `superior` = ?", superior).Find(&orgAry).Error
if err != nil {
return
}
for _, v := range orgAry {
// var idInt int64
idInt := int64(v.Id)
if IsInTrue[int64](idInt, a.SunList) == false {
a.SunList = append(a.SunList, idInt)
}
a.GetAllSunOrg(idInt)
}
return
}

5
overall/overallhandle/type.go

@ -62,3 +62,8 @@ type MenuPermitThree struct {
type GenericityVariable interface {
int | int8 | int16 | int32 | int64 | string
}
//所有子集
type AllSunList[T GenericityVariable] struct {
SunList []T `json:"sunlist"`
}

Loading…
Cancel
Save