Job.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. namespace app\api\controller\v1;
  3. use app\api\controller\Base;
  4. use app\hander\HelpHander;
  5. use think\Db;
  6. class Job extends Base
  7. {
  8. // 新增
  9. public function save(){
  10. model('Job')->add();
  11. HelpHander::success([],'操作成功');
  12. }
  13. // 编辑
  14. public function update(){
  15. model('Job')->add();
  16. HelpHander::success([],'操作成功');
  17. }
  18. // 详情
  19. public function detail(){
  20. $id = input('id/d',0);
  21. $ret = model('Job')->info($id);
  22. HelpHander::success($ret);
  23. }
  24. // 列表
  25. public function list(){
  26. $page = input('page/d',1);
  27. $size = input('size/d',10);
  28. $ret = model('Job')->lists($page,$size);
  29. HelpHander::success($ret);
  30. }
  31. // 修改状态
  32. public function changeStatus(){
  33. $id = input('id/d',0);
  34. $enable = input('enable/d',0);
  35. model('Job')->changeStatus($id,$enable);
  36. HelpHander::success([],'操作成功');
  37. }
  38. // 部门下的岗位
  39. public function queryJobByDep(){
  40. $depId = input('depId/d',0);
  41. $ret = model('Job')->queryJobByDep($depId);
  42. HelpHander::success($ret);
  43. }
  44. // 组织下的岗位
  45. public function queryJobByOrg(){
  46. $ret = model('Job')->queryJobByOrg($this->orgId);
  47. HelpHander::success($ret);
  48. }
  49. //查询当前岗位下未分配的人员
  50. public function screenUserByJob(){
  51. $page = input('page/d',1);
  52. $size = input('size/d',10);
  53. $jobId = input('jobId/d',1);
  54. $param = input('param','','trim'); // 姓名/工号
  55. $ret = model('Job')->screenUserByJob($page,$size,$jobId,$param);
  56. HelpHander::success($ret);
  57. }
  58. //查询当前岗位分配的人员
  59. public function queryUserByJob(){
  60. $page = input('page/d',1);
  61. $size = input('size/d',10);
  62. $jobId = input('jobId/d',1);
  63. $param = input('param','','trim'); // 姓名/工号
  64. $ret = model('Job')->queryUserByJob($page,$size,$jobId,$param);
  65. HelpHander::success($ret);
  66. }
  67. }