2025-06-07 14:26:41 +08:00

81 lines
2.5 KiB
Go

package guanlixitong
import (
"shylinux.com/x/ice"
kit "shylinux.com/x/toolkits"
"strconv"
"shylinux.com/x/community/src/api"
"shylinux.com/x/community/src/gonganxitong"
"shylinux.com/x/enterprise/src/guanlixitong/model"
)
type Table struct {
gonganxitong.Table
list string `name:"list group_uid uid auto" role:"void"`
}
func (s Table) Inputs(m *ice.Message, arg ...string) {
switch arg[0] {
case model.USER_GROUP_ROLE:
s.InputsListRole(m, UserGroupRoleList, arg...)
case model.GROUP_TYPE:
s.InputsList(m, GroupTypeList, arg...)
case model.RECRUITMENT_TYPE:
s.InputsList(m, RecruitmentTypeList, arg...)
case model.COMPANY_UID:
m.Cmdy(company{}, s.Select).Cut(model.UID, model.NAME).RenameAppend(model.UID, arg[0])
m.DisplayInputKeyNameIconTitle()
case model.COMPANY_NAME:
msg := m.Cmd(api.GONGANXITONG_CITY, s.Select, model.NAME, m.Option(model.CITY_NAME))
m.Cmdy(company{}, s.Select, "auth_uid IS NOT NULL AND auth_uid != '' AND city_uid = ?", msg.Append(model.UID)).CutTo(model.NAME, model.COMPANY_NAME)
case model.DEGREE:
m.Push(arg[0], "博士")
m.Push(arg[0], "硕士")
m.Push(arg[0], "本科")
m.Push(arg[0], "大专")
m.Push(arg[0], "高中")
m.Push(arg[0], "中专")
m.Push(arg[0], "初中")
default:
s.Table.Inputs(m, arg...)
}
}
func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
m.RewriteAppend(func(value, key string, index int) string {
if _, e := strconv.ParseInt(value, 10, 64); e != nil {
return value
}
switch key {
case model.USER_GROUP_ROLE:
value = UserGroupRole(kit.Int(value)).String()
case model.GROUP_TYPE:
value = GroupType(kit.Int(value)).String()
case model.RECRUITMENT_TYPE:
value = RecruitmentType(kit.Int(value)).String()
case model.RECRUITMENT_STATUS:
value = RecruitmentStatus(kit.Int(value)).String()
case model.INTERVIEW_STATUS:
value = InterviewStatus(kit.Int(value)).String()
}
return value
})
return s.Table.RewriteAppend(m)
}
func (s Table) SelectJoinCompany(m *ice.Message) {
s.SelectJoin(m, company{}, model.NAME, model.CITY_UID)
s.SelectJoinCity(m)
}
func (s Table) CheckRole(m *ice.Message, arg ...string) {
role := UserGroupRole(s.UserPlaceRole(m))
m.WarnNotRight(!kit.IsIn(role.String(), append(arg, UserGroupCreator.String())...), role.String())
}
type Tables struct{ Table }
func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {}
func NewPortal(userPlace gonganxitong.UserPlacer, place gonganxitong.Placer) Portal {
return Portal{Portal: gonganxitong.NewPortal(userPlace, place, company{})}
}