38 lines
1.5 KiB
Go
38 lines
1.5 KiB
Go
package hr
|
|
|
|
import (
|
|
"WiiGoLibrary/framework/db/v1/utils/mssql/unique"
|
|
"WiiGoLibrary/framework/db/v1/utils/tool"
|
|
"WiiGoLibrary/framework/hub/v1/dblib"
|
|
"time"
|
|
)
|
|
|
|
const OrganizationTable = "hr_u_organization"
|
|
|
|
type OrganizationModel struct {
|
|
RecordGuid unique.UUID `gorm:"column:RecordGuid;type:UNIQUEIDENTIFIER;primaryKey;not null;default:newid();" json:"RecordGuid"`
|
|
DepartmentID int64 `gorm:"column:DepartmentID;type:BIGINT;not null;" json:"DepartmentID"`
|
|
ParentGuid unique.UUID `gorm:"column:ParentGuid;type:UNIQUEIDENTIFIER;index;not null;" json:"ParentGuid"`
|
|
OrganizationName string `gorm:"column:OrganizationName;type:NVARCHAR(50);" json:"OrganizationName"`
|
|
RecordType int16 `gorm:"column:RecordType;not null;" json:"RecordType"`
|
|
RecordStatus int16 `gorm:"column:RecordStatus;not null;default:0;" json:"RecordStatus"`
|
|
CreateTime time.Time `gorm:"column:CreateTime;type:DATETIME;default:CURRENT_TIMESTAMP;<-:create;" json:"CreateTime"`
|
|
UpdateTime time.Time `gorm:"column:UpdateTime;type:DATETIME;default:CURRENT_TIMESTAMP;autoUpdateTime;" json:"UpdateTime"`
|
|
}
|
|
|
|
func init() {
|
|
dblib.DBIns.RegisterAutoMigrateModel(&OrganizationModel{})
|
|
}
|
|
func (am *OrganizationModel) TableName() string {
|
|
return OrganizationTable
|
|
}
|
|
func OrganizationInstance() *OrganizationModel {
|
|
return &OrganizationModel{
|
|
RecordGuid: unique.NewV4(),
|
|
ParentGuid: unique.NilUUID,
|
|
DepartmentID: tool.GenerateID(),
|
|
RecordType: 0,
|
|
RecordStatus: 0,
|
|
}
|
|
}
|