CheckRuleItemController.java 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package com.xintong.visualinspection.controller;
  2. import javax.validation.Valid;
  3. import org.springframework.beans.factory.annotation.Autowired;
  4. import org.springframework.web.bind.annotation.PathVariable;
  5. import org.springframework.web.bind.annotation.RequestBody;
  6. import org.springframework.web.bind.annotation.RequestMapping;
  7. import org.springframework.web.bind.annotation.RestController;
  8. import com.xintong.system.err.BusinessException;
  9. import com.xintong.visualinspection.bean.CheckItem;
  10. import com.xintong.visualinspection.service.CheckRuleItemService;
  11. /**
  12. * 文件名:CheckRuleIem
  13. * 版本信息:日期:2017/3/30 Copyright 江苏省交通规划设计院 Corporation 2017 版权所有.
  14. */
  15. @RestController
  16. @RequestMapping("/checkRuleItem")
  17. public class CheckRuleItemController extends BaseController {
  18. @Autowired
  19. private CheckRuleItemService checkRuleItemService ;
  20. /**
  21. * 增加考核项
  22. * @return
  23. * String
  24. * @exception
  25. * @since 1.0.0
  26. */
  27. @RequestMapping(value = "/add")
  28. public String add(@Valid @RequestBody CheckItem checkItem){
  29. if(checkItem.getId()==null && checkItem.getRule_id()==null){
  30. throw new BusinessException(20002);
  31. }
  32. checkRuleItemService.insert(checkItem);
  33. return super.returnSuccessResult("增加成功");
  34. }
  35. /**
  36. * 删除考核项
  37. * @return
  38. * String
  39. * @exception
  40. * @since 1.0.0
  41. */
  42. @RequestMapping(value = "/delete")
  43. public String delete(@RequestBody CheckItem checkItem){
  44. if(checkItem.getId() ==null && checkItem.getRule_id()==null){
  45. throw new BusinessException(20002);
  46. }
  47. checkRuleItemService.delete(checkItem);
  48. return super.returnSuccessResult("删除成功");
  49. }
  50. }