1
0

forbid_staff_down_mine.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //
  2. // Created by Administrator on 2019/3/5.
  3. // 禁止制定人员下井
  4. //
  5. #ifndef WORKSPACE_FORBID_STAFF_DOWN_MINE_H
  6. #define WORKSPACE_FORBID_STAFF_DOWN_MINE_H
  7. #include "write-copy.h"
  8. #include <string>
  9. #include <map>
  10. #include <list>
  11. #include "db_api/CDBResultSet.h"
  12. struct SForbidStaffInfo
  13. {
  14. int staff_id;
  15. int db_id;
  16. time_t start_time;
  17. time_t end_time;
  18. int state; //状态 0 = 无效 1 = 有效
  19. SForbidStaffInfo()
  20. {
  21. db_id = 0;
  22. staff_id = 0;
  23. start_time = 0;
  24. end_time = 0;
  25. state = 0;
  26. }
  27. };
  28. struct SForbidStaffList
  29. {
  30. int staff_id ;
  31. std::list<SForbidStaffInfo> forbidList;
  32. };
  33. struct forbid_staff_down_mine
  34. :single_base<forbid_staff_down_mine,int,std::shared_ptr<SForbidStaffList>>
  35. {
  36. public:
  37. // 根据数据库中的自增长id
  38. void init_forbid_staff(int id = -1);
  39. // 根据数据库中的自增长id
  40. void del_forbid_data(int id,int staff_id);
  41. // 根据员工ID
  42. void del_forbid_staff(int staff_id);
  43. //是否禁止状态
  44. bool IsForbid(int staff_id,time_t cur_time);
  45. //重新加载数据更新时间> m_updateTime
  46. void on_load_data();
  47. private:
  48. //更新数据
  49. void update_forbid_data(YADB::CDBResultSet & DBRes);
  50. void updatetime(const std::string & t);
  51. //数据中最新时间
  52. std::string m_updateTime = "";
  53. };
  54. #endif //WORKSPACE_FORBID_STAFF_DOWN_MINE_H