You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
3.0 KiB
53 lines
3.0 KiB
package hrsystem
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"gin_server_admin/global"
|
|
)
|
|
|
|
// 行政组织
|
|
type AdministrativeOrganization struct {
|
|
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"`
|
|
Number string `json:"number" gorm:"column:number;type:varchar(50) unsigned;default:'';not null;comment:行政编码"`
|
|
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:组织名称"`
|
|
Superior int64 `json:"superior" gorm:"column:superior;type:bigint(20) unsigned;default:0;not null;comment:上级ID"`
|
|
OrganizationType int64 `json:"organizationtype" gorm:"column:organization_type;type:bigint(20) unsigned;default:0;not null;comment:行政组织类型"`
|
|
Abbreviation string `json:"abbreviation" gorm:"column:abbreviation;type:varchar(255) unsigned;default:'';not null;comment:行政组织简称"`
|
|
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
|
|
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
|
|
WechatOrganizationId int64 `json:"wechatorganizationid" gorm:"column:wechat_organization_id;type:bigint(20) unsigned;default:0;not null;comment:微信组织架构对照码"`
|
|
SuperiorSun string `json:"superiorsun" gorm:"column:superior_sun;type:mediumtext;comment:级联ID"`
|
|
Schoole int64 `json:"schoole" gorm:"column:schoole;type:bigint(20) unsigned;default:0;not null;comment:原知行学院对照码"`
|
|
KingdeeId string `json:"kingdeeid" gorm:"column:kingdeeid;type:varchar(255) unsigned;default:'';comment:金蝶对照ID"`
|
|
IsPower int `json:"ispower" gorm:"column:ispower;type:int(1) unsigned;default:2;not null;comment:是否为实权部门"`
|
|
Sort int `json:"sort" gorm:"column:sort;type:int(6) unsigned;default:100;not null;comment:是否为实权部门"`
|
|
}
|
|
|
|
func (AdministrativeOrganization *AdministrativeOrganization) TableName() string {
|
|
return "administrative_organization"
|
|
}
|
|
|
|
// 编辑行政组织内容
|
|
func (cont *AdministrativeOrganization) EiteCont(whereMap map[string]interface{}, saveData map[string]interface{}) (err error) {
|
|
err = global.GVA_DB_HrDataBase.Model(&cont).Where(whereMap).Updates(saveData).Error
|
|
return
|
|
}
|
|
|
|
// 获取行政组织内容
|
|
func (cont *AdministrativeOrganization) GetCont(whereMap map[string]interface{}, field ...string) (err error) {
|
|
gormDb := global.GVA_DB_HrDataBase.Model(&cont)
|
|
if len(field) > 0 {
|
|
fieldStr := strings.Join(field, ",")
|
|
gormDb = gormDb.Select(fieldStr)
|
|
}
|
|
gormDb = gormDb.Where(whereMap)
|
|
err = gormDb.First(&cont).Error
|
|
return
|
|
}
|
|
|
|
// 根据条件获取总数
|
|
func (cont *AdministrativeOrganization) CountCont(whereMap map[string]interface{}) (countId int64) {
|
|
global.GVA_DB_HrDataBase.Model(&cont).Where(whereMap).Count(&countId)
|
|
return
|
|
}
|
|
|