AttendanceType.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. package Attendance
  2. import "sort"
  3. const (
  4. AttendanceOvertime = iota // 0 加班
  5. AttendancePersonal // 1 事假
  6. AttendanceSick // 2 病假
  7. AttendanceDaysOff // 3 调休
  8. AttendanceAnnual // 4 年假
  9. AttendanceMarriage // 婚假
  10. AttendanceFuneral // 丧假
  11. AttendanceMaternity // 产假
  12. AttendanceBreastfeeding // 哺乳假
  13. Attendancepaternity // 陪产假
  14. AttendanceShiftPerf // 5 转绩效
  15. )
  16. // 请假类型
  17. type AttendanceType struct {
  18. Id int
  19. T_name string
  20. }
  21. var AttendanceType_list = map[int]string{
  22. AttendanceOvertime: "加班",
  23. AttendanceSick: "病假",
  24. AttendancePersonal: "事假",
  25. AttendanceDaysOff: "调休",
  26. AttendanceAnnual: "年假",
  27. AttendanceFuneral: "丧假",
  28. AttendanceMarriage: "婚假",
  29. AttendanceMaternity: "产假",
  30. AttendanceBreastfeeding: "哺乳假",
  31. Attendancepaternity: "陪产假",
  32. AttendanceShiftPerf: "加班转绩效",
  33. }
  34. // 获取全部
  35. func Read_AttendanceType_Get(id int) string {
  36. v, ok := AttendanceType_list[id]
  37. if ok {
  38. return v
  39. } else {
  40. return "未知类型"
  41. }
  42. }
  43. // 获取全部
  44. func Read_AttendanceType_All(T_deduct int) (r []AttendanceType) {
  45. for k, v := range AttendanceType_list {
  46. if k == AttendanceOvertime {
  47. continue
  48. }
  49. if T_deduct != 1 && k == AttendanceShiftPerf {
  50. continue
  51. }
  52. r = append(r, AttendanceType{
  53. Id: k,
  54. T_name: v,
  55. })
  56. }
  57. sort.Slice(r, func(i, j int) bool {
  58. return r[i].Id < r[j].Id
  59. })
  60. return r
  61. }
  62. func Get_LeaveType_List() (r []int) {
  63. for k, _ := range AttendanceType_list {
  64. if k == AttendanceOvertime {
  65. continue
  66. }
  67. r = append(r, k)
  68. }
  69. return r
  70. }