package Attendance import "sort" const ( AttendanceOvertime = iota // 0 加班 AttendancePersonal // 1 事假 AttendanceSick // 2 病假 AttendanceDaysOff // 3 调休 AttendanceAnnual // 4 年假 AttendanceMarriage // 婚假 AttendanceFuneral // 丧假 AttendanceMaternity // 产假 AttendanceBreastfeeding // 哺乳假 Attendancepaternity // 陪产假 AttendanceShiftPerf // 5 转绩效 ) // 请假类型 type AttendanceType struct { Id int T_name string } var AttendanceType_list = map[int]string{ AttendanceOvertime: "加班", AttendanceSick: "病假", AttendancePersonal: "事假", AttendanceDaysOff: "调休", AttendanceAnnual: "年假", AttendanceFuneral: "丧假", AttendanceMarriage: "婚假", AttendanceMaternity: "产假", AttendanceBreastfeeding: "哺乳假", Attendancepaternity: "陪产假", AttendanceShiftPerf: "加班转绩效", } // 获取全部 func Read_AttendanceType_Get(id int) string { v, ok := AttendanceType_list[id] if ok { return v } else { return "未知类型" } } // 获取全部 func Read_AttendanceType_All(T_deduct int) (r []AttendanceType) { for k, v := range AttendanceType_list { if k == AttendanceOvertime { continue } if T_deduct != 1 && k == AttendanceShiftPerf { continue } r = append(r, AttendanceType{ Id: k, T_name: v, }) } sort.Slice(r, func(i, j int) bool { return r[i].Id < r[j].Id }) return r } func Get_LeaveType_List() (r []int) { for k, _ := range AttendanceType_list { if k == AttendanceOvertime { continue } r = append(r, k) } return r }