CheckAppealController.java 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. package com.xintong.visualinspection.controller;
  2. import java.util.List;
  3. import javax.validation.Valid;
  4. import org.springframework.beans.factory.annotation.Autowired;
  5. import org.springframework.web.bind.annotation.PathVariable;
  6. import org.springframework.web.bind.annotation.RequestBody;
  7. import org.springframework.web.bind.annotation.RequestMapping;
  8. import org.springframework.web.bind.annotation.RestController;
  9. import com.github.pagehelper.PageHelper;
  10. import com.github.pagehelper.PageInfo;
  11. import com.xintong.system.err.BusinessException;
  12. import com.xintong.visualinspection.bean.CheckAppeal;
  13. import com.xintong.visualinspection.bean.Team;
  14. import com.xintong.visualinspection.service.CheckAppealService;
  15. /**
  16. * 文件名:CheckItemController
  17. * 版本信息:日期:2017/3/30 Copyright 江苏省交通规划设计院 Corporation 2017 版权所有.
  18. */
  19. @RestController
  20. @RequestMapping("/checkAppeal")
  21. public class CheckAppealController extends BaseController {
  22. @Autowired
  23. private CheckAppealService checkAppealService;
  24. /**
  25. * 添加考核项
  26. * @return
  27. * String
  28. * @exception
  29. * @since 1.0.0
  30. */
  31. @RequestMapping(value = "/add")
  32. public String add(@Valid @RequestBody CheckAppeal checkAppeal){
  33. checkAppealService.insert(checkAppeal);
  34. return super.returnSuccessResult("添加成功");
  35. }
  36. /**
  37. * 修改考核项
  38. * @return
  39. * String
  40. * @exception
  41. * @since 1.0.0
  42. */
  43. @RequestMapping(value = "/update")
  44. public String update(@Valid @RequestBody CheckAppeal checkAppeal){
  45. checkAppealService.update(checkAppeal);
  46. return super.returnSuccessResult("修改成功");
  47. }
  48. /**
  49. * 删除考核项
  50. * @return
  51. * String
  52. * @exception
  53. * @since 1.0.0
  54. */
  55. @RequestMapping(value = "/delete")
  56. public String delete(@RequestBody CheckAppeal checkAppeal){
  57. checkAppealService.delete(checkAppeal.getId());
  58. return super.returnSuccessResult("删除成功");
  59. }
  60. /**
  61. * 根据id获取考核项数据
  62. * @param checkItem
  63. * @return
  64. */
  65. @RequestMapping(value = "/getById")
  66. public String getById(@RequestBody CheckAppeal checkAppeal){
  67. if(checkAppeal.getId()==null){
  68. throw new BusinessException(20101);
  69. }
  70. CheckAppeal checkItemOne = checkAppealService.getById(checkAppeal.getId()) ;
  71. return super.returnSuccessResult(checkItemOne);
  72. }
  73. @RequestMapping(value = "/getList/{page}/{size}")
  74. public String getList(@PathVariable Integer page,@PathVariable Integer size){
  75. PageHelper.startPage(page, size);
  76. List<CheckAppeal> checkAppeal = checkAppealService.getList() ;
  77. return super.returnSuccessResult(new PageInfo(checkAppeal));
  78. }
  79. }