73 lines
4.2 KiB
Go
73 lines
4.2 KiB
Go
package models
|
||
|
||
import "time"
|
||
|
||
// 考勤与排班的匹配状态(match_status)
|
||
const (
|
||
OaAttendMatchUnknown int8 = 0 // 未判定(历史数据)
|
||
OaAttendMatchOK int8 = 1 // 已匹配到当日排班
|
||
OaAttendMatchMissing int8 = 2 // 未匹配到排班(仍允许打卡,只做提醒)
|
||
)
|
||
|
||
// 单次打卡结果(clock_in_status / clock_out_status)
|
||
// - 签到侧:1 正常 2 迟到 3 无排班打卡 4 不在班次时段
|
||
// - 签退侧:1 正常 2 早退 3 无排班打卡 4 不在班次时段
|
||
const (
|
||
OaAttendClockNone int8 = 0 // 未打卡
|
||
OaAttendClockNormal int8 = 1 // 正常
|
||
OaAttendClockLate int8 = 2 // 迟到(签退侧表示早退)
|
||
OaAttendClockNoShift int8 = 3 // 未匹配排班时的打卡
|
||
OaAttendClockOffTime int8 = 4 // 不在班次时段内
|
||
)
|
||
|
||
// 考勤数据来源(source)
|
||
const (
|
||
OaAttendSourceApp int8 = 1 // 移动端打卡
|
||
OaAttendSourceWeb int8 = 2 // 后台补录
|
||
)
|
||
|
||
// OaAttendance OA 考勤打卡 yz_backend_oa_attendance
|
||
//
|
||
// 一人一天一条:签到与签退写同一行,便于按「人 × 日期」做统计与展示。
|
||
// 打卡时会实时联动排班明细(yz_backend_oa_schedule_entry):
|
||
// - 匹配上:把班次名称与上下班时间快照到本表(排班后续被改也不影响历史判定);
|
||
// - 匹配不上:match_status=2,仍正常落库,clock_*_note 记录提醒文案。
|
||
//
|
||
// 唯一键为 (tid, uid, attend_date):uid 是登录身份,员工档案缺失时也能打卡,
|
||
// employee_id=0 表示未绑定员工(后台只能按账号/姓名检索到)。
|
||
type OaAttendance struct {
|
||
ID uint64 `orm:"column(id);pk;auto" json:"id"`
|
||
Tid int `orm:"column(tid)" json:"tid"`
|
||
Uid uint64 `orm:"column(uid);default(0)" json:"uid"`
|
||
EmployeeID uint `orm:"column(employee_id);default(0)" json:"employee_id"`
|
||
EmployeeName string `orm:"column(employee_name);size(50);default()" json:"employee_name"`
|
||
EmployeeAccount string `orm:"column(employee_account);size(50);default()" json:"employee_account"`
|
||
OrgID uint64 `orm:"column(org_id);default(0)" json:"org_id"`
|
||
OrgName string `orm:"column(org_name);size(128);default()" json:"org_name"`
|
||
Position string `orm:"column(position);size(50);default()" json:"position"`
|
||
AttendDate string `orm:"column(attend_date);type(date)" json:"attend_date"`
|
||
EntryID uint64 `orm:"column(entry_id);default(0)" json:"entry_id"`
|
||
ShiftID uint64 `orm:"column(shift_id);default(0)" json:"shift_id"`
|
||
ShiftName string `orm:"column(shift_name);size(50);default()" json:"shift_name"`
|
||
ShortName string `orm:"column(short_name);size(20);default()" json:"short_name"`
|
||
Color string `orm:"column(color);size(20);default(#409EFF)" json:"color"`
|
||
WorkStart string `orm:"column(work_start);size(8);default()" json:"work_start"`
|
||
WorkEnd string `orm:"column(work_end);size(8);default()" json:"work_end"`
|
||
MatchStatus int8 `orm:"column(match_status);default(0)" json:"match_status"`
|
||
ClockInTime *time.Time `orm:"column(clock_in_time);type(datetime);null" json:"clock_in_time"`
|
||
ClockInStatus int8 `orm:"column(clock_in_status);default(0)" json:"clock_in_status"`
|
||
ClockInNote string `orm:"column(clock_in_note);size(255);default()" json:"clock_in_note"`
|
||
ClockOutTime *time.Time `orm:"column(clock_out_time);type(datetime);null" json:"clock_out_time"`
|
||
ClockOutStatus int8 `orm:"column(clock_out_status);default(0)" json:"clock_out_status"`
|
||
ClockOutNote string `orm:"column(clock_out_note);size(255);default()" json:"clock_out_note"`
|
||
Location string `orm:"column(location);size(255);default()" json:"location"`
|
||
Remark string `orm:"column(remark);size(255);default()" json:"remark"`
|
||
Source int8 `orm:"column(source);default(1)" json:"source"`
|
||
CreateTime time.Time `orm:"column(create_time);auto_now_add;type(datetime)" json:"create_time"`
|
||
UpdateTime *time.Time `orm:"column(update_time);auto_now;type(datetime);null" json:"update_time"`
|
||
}
|
||
|
||
func (m *OaAttendance) TableName() string {
|
||
return "yz_backend_oa_attendance"
|
||
}
|