diff --git a/api/version1/entry.go b/api/version1/entry.go index c023993..03170b3 100644 --- a/api/version1/entry.go +++ b/api/version1/entry.go @@ -13,6 +13,7 @@ import ( "appPlatform/api/version1/taskplatform/taskflow" "appPlatform/api/version1/taskplatform/taskmanagement" "appPlatform/api/version1/user" + "appPlatform/api/version1/workWechat" ) type ApiEntry struct { @@ -28,6 +29,7 @@ type ApiEntry struct { NewsClassApi newsclass.ApiMethod //新闻类 RedisManagApi redisController.ApiMethod MathsApi matsformula.ApiMethod + WechatApi workWechat.ApiMethod //微信相关项目 } var AppApiEntry = new(ApiEntry) diff --git a/api/version1/grantpowers/postpower.go b/api/version1/grantpowers/postpower.go index dfaa033..89ba4d8 100644 --- a/api/version1/grantpowers/postpower.go +++ b/api/version1/grantpowers/postpower.go @@ -52,7 +52,7 @@ func (a *ApiMethod) GetPostGrantPowers(c *gin.Context) { } var powerList []string var empowerCont modelssystempermission.Empower - err = empowerCont.GetCont(map[string]interface{}{"`ordid`": requestData.OrdId, "`post_id`": requestData.PostId, "`system`": requestData.SystemName}, "`id`", "`point_id`", "`operation`") + err = empowerCont.GetCont(map[string]interface{}{"`ordid`": requestData.OrdId, "`post_id`": requestData.PostId, "`system`": requestData.SystemName}, "`id`", "`point_id`", "`operation`", "`level`") if err != nil { publicmethod.Result(0, powerList, c) return @@ -76,7 +76,10 @@ func (a *ApiMethod) GetPostGrantPowers(c *gin.Context) { } } - publicmethod.Result(0, powerList, c) + sendData := publicmethod.MapOut[string]() + sendData["powerList"] = powerList + sendData["level"] = empowerCont.Level + publicmethod.Result(0, sendData, c) } /* @@ -183,7 +186,7 @@ func (a *ApiMethod) GetRoleGrantPowers(c *gin.Context) { } var powerList []string var empowerCont modelssystempermission.RoleEmpower - err = empowerCont.GetCont(map[string]interface{}{"`role_id`": requestData.RoleId, "`system`": requestData.SystemName}, "`id`", "`point_id`", "`operation`") + err = empowerCont.GetCont(map[string]interface{}{"`role_id`": requestData.RoleId, "`system`": requestData.SystemName}, "`id`", "`point_id`", "`operation`", "`level`") if err != nil { publicmethod.Result(0, powerList, c) return @@ -209,5 +212,8 @@ func (a *ApiMethod) GetRoleGrantPowers(c *gin.Context) { } } - publicmethod.Result(0, powerList, c) + sendData := publicmethod.MapOut[string]() + sendData["powerList"] = powerList + sendData["level"] = empowerCont.Level + publicmethod.Result(0, sendData, c) } diff --git a/api/version1/menus/menus.go b/api/version1/menus/menus.go index f91c3d3..e602f1e 100644 --- a/api/version1/menus/menus.go +++ b/api/version1/menus/menus.go @@ -30,7 +30,7 @@ import ( */ func (a *ApiMethod) GetMenusThree(c *gin.Context) { var menusList []modelAppPlatform.Menus - err := overall.CONSTANT_DB_AppPlatform.Where("`type` IN ? AND `visible` IN ? AND `outside` IN ?", []int{1, 2, 3}, []int{1, 2}, []int{1, 3}).Order("sort ASC").Find(&menusList).Error + err := overall.CONSTANT_DB_AppPlatform.Where("`type` IN ? AND `visible` = ? AND `outside` IN ?", []int{1, 2, 3}, 1, []int{1, 3}).Order("sort ASC").Find(&menusList).Error if err != nil && len(menusList) < 1 { publicmethod.Result(1, err, c, "没有路由!") return diff --git a/api/version1/user/type.go b/api/version1/user/type.go index 6cc9a4a..70a2e8b 100644 --- a/api/version1/user/type.go +++ b/api/version1/user/type.go @@ -46,3 +46,16 @@ type AgeType struct { publicmethod.PublicName Value int `json:"value"` } + +// 查看单一人员档案信息 +type LookOneMan struct { + SurveyMan string `json:"surveyman"` //调查人 + UnSurveyMan string `json:"unsurveyman"` //被调查人 +} + +// 输出权限及是否可操作 +type SendPower struct { + IsOk int `json:"isOk"` //调查人 + Level int `json:"level"` //调查人权限范围 + Purview []string `json:"purview"` //被调查人 +} diff --git a/api/version1/user/userCont.go b/api/version1/user/userCont.go index ac1d88f..5326eb4 100644 --- a/api/version1/user/userCont.go +++ b/api/version1/user/userCont.go @@ -64,8 +64,8 @@ func (a *ApiMethod) GetUserCont(c *gin.Context) { // roleList = append(roleList, "ROOT") sendData.Roles = roleList //获取权限 - menuPoint, _, _ := GetUserPower("appsystem", myContInfo.Position, roleList) - // menuPoint, opeart, orgList := GetUserPower("appsystem", myContInfo.Position, roleList) + menuPoint, _, _, _ := GetUserPower("appsystem", myContInfo.Position, roleList) + // menuPoint, opeart, orgList.level := GetUserPower("appsystem", myContInfo.Position, roleList) // fmt.Printf("menuPoint======>%v\nopeart======>%v\norgList======>%v\n", menuPoint, opeart, orgList) sendData.Perms = menuPoint switch myContInfo.Gender { @@ -176,12 +176,13 @@ func GainOrgPostLog(uid int64) (postLog []string) { #menuPoint 菜单操作列表 #opeart 点位 #orgList 行政组织 + #lever 最高管理等级 @ 方法原型 #func GetUserPower(appType string, postId int64, roleList []string) (menuPoint []string, opeart []string, orgList []string) */ -func GetUserPower(appType string, postId int64, roleList []string) (menuPoint, opeart, orgList []string) { +func GetUserPower(appType string, postId int64, roleList []string) (menuPoint, opeart, orgList []string, lever int) { if postId == 0 { return } @@ -201,8 +202,11 @@ func GetUserPower(appType string, postId int64, roleList []string) (menuPoint, o orgIdList := strings.Split(emPower.Organization, ",") orgList = publicmethod.MergeStruct[string](orgIdList, orgList) } + if lever <= emPower.Level { + lever = emPower.Level + } } - // fmt.Printf("职务权限:---->%v\n:---->%v\n", emPower, orgList) + // fmt.Printf("职务权限:---->%v\n:---->%v\n", len(roleList), roleList) //获取角色权限 if len(roleList) > 0 { var roleId []int64 @@ -224,6 +228,9 @@ func GetUserPower(appType string, postId int64, roleList []string) (menuPoint, o orgIdList := strings.Split(roleEmpower.Organization, ",") orgList = publicmethod.MergeStruct[string](orgIdList, orgList) } + if lever <= roleEmpower.Level { + lever = roleEmpower.Level + } } } } @@ -458,3 +465,88 @@ func (a *ApiMethod) StatisticalAgeRatio(c *gin.Context) { sheng["sendAgeAry"] = sendAgeAry publicmethod.Result(0, sendAgeAry, c) } + +/* +* +@ 作者: 秦东 +@ 时间: 2024-01-24 11:30:15 +@ 功能: 获取人员信息单页(手机)查看权限 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (a *ApiMethod) LookOnePeopleArchives(c *gin.Context) { + var requestData LookOneMan + err := c.ShouldBindJSON(&requestData) + if err != nil { + publicmethod.Result(100, err, c) + return + } + var sendData SendPower + sendData.IsOk = 2 + if requestData.SurveyMan == "" { + publicmethod.Result(0, sendData, c) + return + } + if requestData.UnSurveyMan == "" { + requestData.UnSurveyMan = requestData.SurveyMan + } + var surverManInfo modelshr.ManCont + err = surverManInfo.GetCont(map[string]interface{}{"`number`": requestData.SurveyMan}, "`emp_type`", "`company`", "`maindeparment`", "`admin_org`", "`position`", "`position`", "`role`") + if err != nil { + publicmethod.Result(0, sendData, c) + return + } + roleList := strings.Split(surverManInfo.Role, ",") + //获取权限 + var orgList []string + sendData.Purview, _, orgList, sendData.Level = GetUserPower("appsystem", surverManInfo.Position, roleList) + if publicmethod.IsInTrue[string]("210700510225772544", sendData.Purview) { + //获取被查看人行政组织 + var lookManInfo modelshr.PersonArchives + lookManInfo.GetCont(map[string]interface{}{"`number`": requestData.UnSurveyMan}, "`company`", "`maindeparment`", "`admin_org`") + switch sendData.Level { + case 1: + var sunOrg publicmethod.GetOrgAllParent + sunOrg.GetOrgSun(surverManInfo.AdminOrg) + sunOrg.Id = append(sunOrg.Id, surverManInfo.AdminOrg) + if publicmethod.IsInTrue[int64](lookManInfo.Company, sunOrg.Id) || publicmethod.IsInTrue[int64](lookManInfo.MainDeparment, sunOrg.Id) || publicmethod.IsInTrue[int64](lookManInfo.AdminOrg, sunOrg.Id) { + sendData.IsOk = 1 + } + case 2: + var sunOrg publicmethod.GetOrgAllParent + sunOrg.GetOrgSun(surverManInfo.MainDeparment) + sunOrg.Id = append(sunOrg.Id, surverManInfo.MainDeparment) + if publicmethod.IsInTrue[int64](lookManInfo.Company, sunOrg.Id) || publicmethod.IsInTrue[int64](lookManInfo.MainDeparment, sunOrg.Id) || publicmethod.IsInTrue[int64](lookManInfo.AdminOrg, sunOrg.Id) { + sendData.IsOk = 1 + } + case 3: + var sunOrg publicmethod.GetOrgAllParent + sunOrg.GetOrgSun(surverManInfo.Company) + sunOrg.Id = append(sunOrg.Id, surverManInfo.Company) + if publicmethod.IsInTrue[int64](lookManInfo.Company, sunOrg.Id) || publicmethod.IsInTrue[int64](lookManInfo.MainDeparment, sunOrg.Id) || publicmethod.IsInTrue[int64](lookManInfo.AdminOrg, sunOrg.Id) { + sendData.IsOk = 1 + } + case 4: + departMent := strconv.FormatInt(lookManInfo.MainDeparment, 10) + orgId := strconv.FormatInt(lookManInfo.AdminOrg, 10) + companyId := strconv.FormatInt(lookManInfo.Company, 10) + if publicmethod.IsInTrue[string](companyId, orgList) || publicmethod.IsInTrue[string](departMent, orgList) || publicmethod.IsInTrue[string](orgId, orgList) { + sendData.IsOk = 1 + } + case 5: + sendData.IsOk = 1 + default: + sendData.IsOk = 2 + } + } + publicmethod.Result(0, sendData, c) +} diff --git a/api/version1/workWechat/type.go b/api/version1/workWechat/type.go new file mode 100644 index 0000000..c0fdba4 --- /dev/null +++ b/api/version1/workWechat/type.go @@ -0,0 +1,43 @@ +package workWechat + +import ( + "appPlatform/overall/publicmethod" + + "github.com/gin-gonic/gin" +) + +type ApiMethod struct{} + +// 微信相关项目入口 +func (a *ApiMethod) Index(c *gin.Context) { + outputCont := publicmethod.MapOut[string]() + outputCont["index"] = "微信相关项目入口" + publicmethod.Result(0, outputCont, c) +} + +// 微信返回结构体 +type RevokeMsgSendCallBack struct { + Errcode int `json:"errcode"` //返回码 + Errmsg string `json:"errmsg"` //对返回码的文本描述内容 +} + +// 微信返回结构体(Token) +type WeChatCallBack struct { + RevokeMsgSendCallBack + Accesstoken string `json:"access_token"` + Expiresin int64 `json:"expires_in"` + Ticket string `json:"ticket"` +} + +// 查看单一人员档案信息 +type LookOneMan struct { + SurveyMan string `json:"surveyman"` //调查人 + UnSurveyMan string `json:"unsurveyman"` //被调查人 +} + +// 输出权限及是否可操作 +type SendPower struct { + IsOk int `json:"isOk"` //调查人 + Level int `json:"level"` //调查人权限范围 + Purview []string `json:"purview"` //被调查人 +} diff --git a/api/version1/workWechat/wechat.go b/api/version1/workWechat/wechat.go new file mode 100644 index 0000000..f4765bc --- /dev/null +++ b/api/version1/workWechat/wechat.go @@ -0,0 +1,201 @@ +package workWechat + +import ( + "appPlatform/api/version1/user" + "appPlatform/middleware/grocerystore" + "appPlatform/models/modelshr" + "appPlatform/overall" + "appPlatform/overall/publicmethod" + "encoding/json" + "errors" + "fmt" + "strconv" + "strings" + + "github.com/gin-gonic/gin" +) + +/* +* +@ 作者: 秦东 +@ 时间: 2024-01-18 14:11:11 +@ 功能: 获取token +@ 参数 + + #systemApp 系统 + #key 身份KEy + #isAgain 重新授权 1:否,2:是 + +@ 返回值 + + # + +@ 方法原型 + + #token token值 + #err 状态 +*/ +func GainWechatToken(systemApp, key string, isAgain int) (token string, err error) { + companyId := overall.CONSTANT_CONFIG.WechatCompany.CompanyId + redisFileKey := fmt.Sprintf("Wechat:Token:%v_%v_%v", companyId, key, overall.CONSTANT_CONFIG.RedisPrefixStr.Alias) + var secretStr string + switch systemApp { + case "kpi": + redisFileKey = fmt.Sprintf("%v_%v_%v", redisFileKey, systemApp, overall.CONSTANT_CONFIG.WechatKpi.Agentid) + secretStr = overall.CONSTANT_CONFIG.WechatKpi.Secret + case "school": + redisFileKey = fmt.Sprintf("%v_%v_%v", redisFileKey, systemApp, overall.CONSTANT_CONFIG.WechatSchool.Agentid) + secretStr = overall.CONSTANT_CONFIG.WechatSchool.Secret + default: + redisFileKey = fmt.Sprintf("%v_%v", redisFileKey, systemApp) + } + redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS4) //设定redis库 + if isAgain != 1 { + token, err = getWechatServer(companyId, secretStr) + if err != nil { + return + } + redisClient.SetRedisTime(7200) + redisClient.Set(redisFileKey, token) + } else { + isTrue, tokens := redisClient.Get(redisFileKey) + if isTrue && token != "" { + err = nil + token = tokens + return + } else { + token, err = getWechatServer(companyId, secretStr) + if err != nil { + return + } + redisClient.SetRedisTime(7200) + redisClient.Set(redisFileKey, token) + } + } + + return +} + +/* +* +@ 作者: 秦东 +@ 时间: 2024-01-18 14:23:24 +@ 功能: 获取微信Token(链接微信服务器) +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func getWechatServer(companyId, secretStr string) (token string, err error) { + getTokenUrl := fmt.Sprintf("https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=%v&corpsecret=%v", companyId, secretStr) + // getTokenUrl := "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=" + companyId + "&corpsecret=" + secretStr + tokenByte := publicmethod.CurlGet(getTokenUrl) + var callBackCont WeChatCallBack + err = json.Unmarshal(tokenByte, &callBackCont) + if err != nil { + return + } + if callBackCont.Errcode != 0 { + err = errors.New("未能获得到TOKEN!") + return + } + token = callBackCont.Accesstoken + return +} + +/* +* +@ 作者: 秦东 +@ 时间: 2024-01-24 11:30:15 +@ 功能: 获取人员信息单页(手机)查看权限 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (a *ApiMethod) LookOnePeopleArchives(c *gin.Context) { + var requestData LookOneMan + err := c.ShouldBindJSON(&requestData) + if err != nil { + publicmethod.Result(100, err, c) + return + } + var sendData SendPower + sendData.IsOk = 2 + if requestData.SurveyMan == "" { + publicmethod.Result(0, sendData, c) + return + } + if requestData.UnSurveyMan == "" { + requestData.UnSurveyMan = requestData.SurveyMan + } + + var surverManInfo modelshr.ManCont + err = surverManInfo.GetCont(map[string]interface{}{"`number`": requestData.SurveyMan}, "`emp_type`", "`company`", "`maindeparment`", "`admin_org`", "`position`", "`position`", "`role`") + if err != nil { + publicmethod.Result(0, sendData, c) + return + } + var roleList []string + if surverManInfo.Role != "" { + roleList = strings.Split(surverManInfo.Role, ",") + } + + //获取权限 + var orgList []string + sendData.Purview, _, orgList, sendData.Level = user.GetUserPower("appsystem", surverManInfo.Position, roleList) + if publicmethod.IsInTrue[string]("210700510225772544", sendData.Purview) { + //获取被查看人行政组织 + var lookManInfo modelshr.PersonArchives + lookManInfo.GetCont(map[string]interface{}{"`number`": requestData.UnSurveyMan}, "`company`", "`maindeparment`", "`admin_org`") + switch sendData.Level { + case 1: + var sunOrg publicmethod.GetOrgAllParent + sunOrg.GetOrgSun(surverManInfo.AdminOrg) + sunOrg.Id = append(sunOrg.Id, surverManInfo.AdminOrg) + if publicmethod.IsInTrue[int64](lookManInfo.Company, sunOrg.Id) || publicmethod.IsInTrue[int64](lookManInfo.MainDeparment, sunOrg.Id) || publicmethod.IsInTrue[int64](lookManInfo.AdminOrg, sunOrg.Id) { + sendData.IsOk = 1 + } + case 2: + var sunOrg publicmethod.GetOrgAllParent + sunOrg.GetOrgSun(surverManInfo.MainDeparment) + sunOrg.Id = append(sunOrg.Id, surverManInfo.MainDeparment) + if publicmethod.IsInTrue[int64](lookManInfo.Company, sunOrg.Id) || publicmethod.IsInTrue[int64](lookManInfo.MainDeparment, sunOrg.Id) || publicmethod.IsInTrue[int64](lookManInfo.AdminOrg, sunOrg.Id) { + sendData.IsOk = 1 + } + case 3: + var sunOrg publicmethod.GetOrgAllParent + sunOrg.GetOrgSun(surverManInfo.Company) + sunOrg.Id = append(sunOrg.Id, surverManInfo.Company) + if publicmethod.IsInTrue[int64](lookManInfo.Company, sunOrg.Id) || publicmethod.IsInTrue[int64](lookManInfo.MainDeparment, sunOrg.Id) || publicmethod.IsInTrue[int64](lookManInfo.AdminOrg, sunOrg.Id) { + sendData.IsOk = 1 + } + case 4: + departMent := strconv.FormatInt(lookManInfo.MainDeparment, 10) + orgId := strconv.FormatInt(lookManInfo.AdminOrg, 10) + companyId := strconv.FormatInt(lookManInfo.Company, 10) + if publicmethod.IsInTrue[string](companyId, orgList) || publicmethod.IsInTrue[string](departMent, orgList) || publicmethod.IsInTrue[string](orgId, orgList) { + sendData.IsOk = 1 + } + case 5: + sendData.IsOk = 1 + default: + sendData.IsOk = 2 + } + } + publicmethod.Result(0, sendData, c) +} diff --git a/apirouter/entry.go b/apirouter/entry.go index d676510..e77c5f1 100644 --- a/apirouter/entry.go +++ b/apirouter/entry.go @@ -14,6 +14,7 @@ import ( "appPlatform/apirouter/v1/redisRouter" "appPlatform/apirouter/v1/taskrouter" userrouters "appPlatform/apirouter/v1/userRouters" + workwechatrouter "appPlatform/apirouter/v1/workWechatRouter" ) // 路由结构 @@ -31,6 +32,7 @@ type RouterGroup struct { NewsClassApiRouter newsclassrouter.ApiRouter RedisClassApiRouter redisRouter.ApiRouter MathsRouter mathsrouter.ApiRouter + WorkWechatRouter workwechatrouter.ApiRouter } var RouterGroupEntry = new(RouterGroup) diff --git a/apirouter/v1/userRouters/pc.go b/apirouter/v1/userRouters/pc.go index 12319aa..c674244 100644 --- a/apirouter/v1/userRouters/pc.go +++ b/apirouter/v1/userRouters/pc.go @@ -12,9 +12,10 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) { var methodBinding = version1.AppApiEntry.UserApi { - apiRouter.GET("", methodBinding.Index) //入口 - apiRouter.POST("", methodBinding.Index) //入口 - apiRouter.GET("get_user_cont", methodBinding.GetUserCont) //获取登陆人信息 - apiRouter.POST("statisticalAgeRatio", methodBinding.StatisticalAgeRatio) //获取登陆人信息 + apiRouter.GET("", methodBinding.Index) //入口 + apiRouter.POST("", methodBinding.Index) //入口 + apiRouter.GET("get_user_cont", methodBinding.GetUserCont) //获取登陆人信息 + apiRouter.POST("statisticalAgeRatio", methodBinding.StatisticalAgeRatio) //获取登陆人信息 + apiRouter.POST("lookOnePeopleArchives", methodBinding.LookOnePeopleArchives) //获取人员信息单页(手机)查看权限 } } diff --git a/apirouter/v1/workWechatRouter/router.go b/apirouter/v1/workWechatRouter/router.go new file mode 100644 index 0000000..8a066c1 --- /dev/null +++ b/apirouter/v1/workWechatRouter/router.go @@ -0,0 +1,19 @@ +package workwechatrouter + +import ( + "appPlatform/api/version1" + + "github.com/gin-gonic/gin" +) + +// 微信路由 +func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) { + apiRouter := router.Group("wechat") + + var methodBinding = version1.AppApiEntry.WechatApi + { + apiRouter.GET("", methodBinding.Index) //入口 + apiRouter.POST("", methodBinding.Index) //入口 + apiRouter.POST("lookOnePeopleArchives", methodBinding.LookOnePeopleArchives) //获取人员信息单页(手机)查看权限 + } +} diff --git a/apirouter/v1/workWechatRouter/type.go b/apirouter/v1/workWechatRouter/type.go new file mode 100644 index 0000000..40c53c6 --- /dev/null +++ b/apirouter/v1/workWechatRouter/type.go @@ -0,0 +1,3 @@ +package workwechatrouter + +type ApiRouter struct{} diff --git a/initialization/route/initRoute.go b/initialization/route/initRoute.go index 4df4c7b..0114a91 100644 --- a/initialization/route/initRoute.go +++ b/initialization/route/initRoute.go @@ -41,6 +41,11 @@ func InitialRouter() *gin.Engine { //公共函数 publicRouterApi := apirouter.RouterGroupEntry.PublicRouters publicRouterApi.RouterGroupPc(appLoadRouterGroup) + //微信相关内容 + wechatApiRouter := apirouter.RouterGroupEntry.WorkWechatRouter + { + wechatApiRouter.RouterGroupPc(appLoadRouterGroup) + } } //验证身份接口 鉴权Url(主要应用端使用) diff --git a/models/modelshr/man_cont.go b/models/modelshr/man_cont.go index 5785a51..4e71cae 100644 --- a/models/modelshr/man_cont.go +++ b/models/modelshr/man_cont.go @@ -59,6 +59,9 @@ type ManCont struct { Probationperiod int `json:"probationperiod" gorm:"column:probationperiod;type:int(5) unsigned;default:0;comment:试用期"` Planformaldate int64 `json:"planformaldate" gorm:"column:planformaldate;type:bigint(20) unsigned;default:0;comment:预计转正日期"` PoliticalOutlook int `json:"politicaloutlook" gorm:"column:political_outlook;type:tinyint(3) unsigned;default:1;comment:政治面貌(1:群众;2:无党派;3:台盟会员;4:九三社员;5:致公党员;6:农工党员;7:民进会员;8:民建会员;9:民盟盟员;10:民革会员,11:共青团员;12:预备党员;13:中共党员)"` + CareerPlanning string `json:"career_planning" gorm:"column:career_planning;type:longtext;default:'';not null;comment:职业生涯规划"` + HelpObtained string `json:"help_obtained" gorm:"column:help_obtained;type:longtext;default:'';not null;comment:个人期望从组织获得的帮助"` + Hobby string `json:"hobby" gorm:"column:hobby;type:text;default:'';not null;comment:爱好"` } func (ManCont *ManCont) TableName() string { diff --git a/models/modelshr/personarchives.go b/models/modelshr/personarchives.go index 0e4e994..c074ead 100644 --- a/models/modelshr/personarchives.go +++ b/models/modelshr/personarchives.go @@ -7,35 +7,38 @@ import ( // 员工档案(主) type PersonArchives struct { - Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` - Number string `json:"number" gorm:"column:number;type:varchar(30) unsigned;not null;comment:员工工号"` - Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:姓名"` - Icon string `json:"icon" gorm:"column:icon;type:varchar(255) unsigned;default:'';not null;comment:头像"` - HireClass int `json:"hireclass" gorm:"column:hire_class;type:tinyint(1) unsigned;default:1;not null;comment:雇佣类型(1:雇佣入职;2:再入职;)"` - EmpType int `json:"emptype" gorm:"column:emp_type;type:tinyint(1) unsigned;default:1;not null;comment:用工关系(1:实习生;2:待分配;3:试用员工;4:正式员工;5:停薪留职;6:退休;7:辞退;8:离职)"` - Company int64 `json:"company" gorm:"column:company;type:bigint(20) unsigned;default:0;not null;comment:入职公司"` - MainDeparment int64 `json:"maindeparment" gorm:"column:maindeparment;type:bigint(20) unsigned;default:0;not null;comment:主部门"` - Deparment string `json:"deparment" gorm:"column:deparment;type:text;comment:部门"` - AdminOrg int64 `json:"adminorg" gorm:"column:admin_org;type:bigint(20) unsigned;default:0;not null;comment:所属行政组织"` - TeamId int64 `json:"teamid" gorm:"column:teamid;type:bigint(20) unsigned;default:0;not null;comment:班组"` - Position int64 `json:"position" gorm:"column:position;type:bigint(20) unsigned;default:0;not null;comment:职位"` - JobClass int64 `json:"jobclass" gorm:"column:job_class;type:bigint(20) unsigned;default:2;not null;comment:职务分类"` - JobId int64 `json:"jobid" gorm:"column:job_id;type:bigint(20) unsigned;default:0;not null;comment:职务"` - JobLeve int64 `json:"jobleve" gorm:"column:job_leve;type:bigint(20) unsigned;default:0;not null;comment:职务等级"` - Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:写入时间"` - EiteTime int64 `json:"eitetime" gorm:"column:eite_time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` - Wechat string `json:"wechat" gorm:"column:wechat;type:varchar(255) unsigned;default:'';not null;comment:微信UserId"` - WorkWechat string `json:"workwechat" gorm:"column:work_wechat;type:varchar(255) unsigned;default:'';not null;comment:企业微信UserId"` - State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)` - Key int64 `json:"key" gorm:"column:key;type:bigint(50) unsigned;default:0;not null;comment:key"` - IsAdmin int `json:"isadmin" gorm:"column:is_admin;type:tinyint(1) unsigned;default:1;not null;comment:是否为管理员(1:不是;2:分公司;3:集团管理员;4:超级管` - Password string `json:"password" gorm:"column:password;type:varchar(255) unsigned;default:'';not null;comment:密码"` - Role string `json:"role" gorm:"column:role;type:longtext;comment:角色"` - - EmpTypeName string `json:"emptypename" gorm:"column:emp_type_name;type:varchar(255) unsigned;default:'';not null;comment:用工关系中文"` - HireClassName string `json:"hireclassname" gorm:"column:hire_class_name;type:varchar(255) unsigned;default:'';not null;comment:雇佣类型中文"` - IconPhoto string `json:"iconphoto" gorm:"column:icon_photo;type:varchar(255) unsigned;default:'';not null;comment:头像"` - SunMainDeparment int64 `json:"sunmaindeparment" gorm:"column:sun_main_deparment;type:bigint(20) unsigned;default:0;not null;comment:主部门"` + Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` + Number string `json:"number" gorm:"column:number;type:varchar(30) unsigned;not null;comment:员工工号"` + Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:姓名"` + Icon string `json:"icon" gorm:"column:icon;type:varchar(255) unsigned;default:'';not null;comment:头像"` + HireClass int `json:"hireclass" gorm:"column:hire_class;type:tinyint(1) unsigned;default:1;not null;comment:雇佣类型(1:雇佣入职;2:再入职;)"` + EmpType int `json:"emptype" gorm:"column:emp_type;type:tinyint(1) unsigned;default:1;not null;comment:用工关系(1:实习生;2:待分配;3:试用员工;4:正式员工;5:停薪留职;6:退休;7:辞退;8:离职)"` + Company int64 `json:"company" gorm:"column:company;type:bigint(20) unsigned;default:0;not null;comment:入职公司"` + MainDeparment int64 `json:"maindeparment" gorm:"column:maindeparment;type:bigint(20) unsigned;default:0;not null;comment:主部门"` + Deparment string `json:"deparment" gorm:"column:deparment;type:text;comment:部门"` + AdminOrg int64 `json:"adminorg" gorm:"column:admin_org;type:bigint(20) unsigned;default:0;not null;comment:所属行政组织"` + TeamId int64 `json:"teamid" gorm:"column:teamid;type:bigint(20) unsigned;default:0;not null;comment:班组"` + Position int64 `json:"position" gorm:"column:position;type:bigint(20) unsigned;default:0;not null;comment:职位"` + JobClass int64 `json:"jobclass" gorm:"column:job_class;type:bigint(20) unsigned;default:2;not null;comment:职务分类"` + JobId int64 `json:"jobid" gorm:"column:job_id;type:bigint(20) unsigned;default:0;not null;comment:职务"` + JobLeve int64 `json:"jobleve" gorm:"column:job_leve;type:bigint(20) unsigned;default:0;not null;comment:职务等级"` + Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:写入时间"` + EiteTime int64 `json:"eitetime" gorm:"column:eite_time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` + Wechat string `json:"wechat" gorm:"column:wechat;type:varchar(255) unsigned;default:'';not null;comment:微信UserId"` + WorkWechat string `json:"workwechat" gorm:"column:work_wechat;type:varchar(255) unsigned;default:'';not null;comment:企业微信UserId"` + State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)` + Key int64 `json:"key" gorm:"column:key;type:bigint(50) unsigned;default:0;not null;comment:key"` + IsAdmin int `json:"isadmin" gorm:"column:is_admin;type:tinyint(1) unsigned;default:1;not null;comment:是否为管理员(1:不是;2:分公司;3:集团管理员;4:超级管` + Password string `json:"password" gorm:"column:password;type:varchar(255) unsigned;default:'';not null;comment:密码"` + Role string `json:"role" gorm:"column:role;type:longtext;comment:角色"` + Ruleid int64 `json:"ruleid" gorm:"column:ruleid;type:bigint(20) unsigned;default:0;not null;comment:轮询规则"` + EmpTypeName string `json:"emptypename" gorm:"column:emp_type_name;type:varchar(255) unsigned;default:'';not null;comment:用工关系中文"` + HireClassName string `json:"hireclassname" gorm:"column:hire_class_name;type:varchar(255) unsigned;default:'';not null;comment:雇佣类型中文"` + IconPhoto string `json:"iconphoto" gorm:"column:icon_photo;type:varchar(255) unsigned;default:'';not null;comment:头像"` + SunMainDeparment int64 `json:"sunmaindeparment" gorm:"column:sun_main_deparment;type:bigint(20) unsigned;default:0;not null;comment:主部门"` + PersonInCharge int `json:"personincharge" gorm:"column:person_in_charge;type:tinyint(1) unsigned;default:1;not null;comment:负责人(1:是;2:否)` + ResponsibleDepartment string `json:"responsibledepartment" gorm:"column:responsible_department;type:longtext;default:'';not null;comment:负责的行政组织"` + ResponsibleDepartmentJson string `json:"responsibledepartmentjson" gorm:"column:responsible_department_json;type:longtext;default:'';not null;comment:负责的行政组织json"` } func (PersonArchives *PersonArchives) TableName() string { diff --git a/models/modelshr/personnel_content.go b/models/modelshr/personnel_content.go index d5c0c6d..9feddb1 100644 --- a/models/modelshr/personnel_content.go +++ b/models/modelshr/personnel_content.go @@ -42,6 +42,10 @@ type PersonnelContent struct { ConstellationingCn string `json:"constellationingcn" gorm:"column:constellationing_cn;type:varchar(50) unsigned;default:'';not null;comment:星座汉字说明"` PoliticalOutlookCn string `json:"politicaloutlookcn" gorm:"column:political_outlook_cn;type:varchar(50) unsigned;default:'';not null;comment:政治面貌汉字说明"` HealthCn string `json:"healthcn" gorm:"column:health_cn;type:varchar(50) unsigned;default:'';not null;comment:健康状况中文说明"` + NameUsedBefore string `json:"nameusedbefore" gorm:"column:name_used_before;type:varchar(255) unsigned;default:'';not null;comment:曾用名"` + CareerPlanning string `json:"career_planning" gorm:"column:career_planning;type:longtext;default:'';not null;comment:职业生涯规划"` + HelpObtained string `json:"help_obtained" gorm:"column:help_obtained;type:longtext;default:'';not null;comment:个人期望从组织获得的帮助"` + Hobby string `json:"hobby" gorm:"column:hobby;type:text;default:'';not null;comment:爱好"` } func (PersonnelContent *PersonnelContent) TableName() string {