KPI绩效考核系统
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.

57 lines
3.0 KiB

package models
import (
"key_performance_indicators/overall"
"strings"
)
//行政组织
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:是否为实权部门"`
}
func (AdministrativeOrganization *AdministrativeOrganization) TableName() string {
return "administrative_organization"
}
//编辑行政组织内容
func (cont *AdministrativeOrganization) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
//获取行政组织内容
func (cont *AdministrativeOrganization) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_HR.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 interface{}) (countId int64) {
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId)
return
}
//读取全部信息
func (cont *AdministrativeOrganization) ContMap(whereMap interface{}) (countAry []AdministrativeOrganization) {
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Find(&countAry)
return
}