| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- package com.xintong.visualinspection.controller;
- import java.util.List;
- import javax.validation.Valid;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import com.xintong.system.err.BusinessException;
- import com.xintong.visualinspection.bean.CheckItem;
- import com.xintong.visualinspection.service.CheckItemService;
- /**
- * 文件名:CheckItemController
- * 版本信息:日期:2017/3/30 Copyright 江苏省交通规划设计院 Corporation 2017 版权所有.
- */
- @RestController
- @RequestMapping("/checkItem")
- public class CheckItemController extends BaseController {
- @Autowired
- private CheckItemService checkItemService;
-
- /**
- * 添加考核项
- * @return
- * String
- * @exception
- * @since 1.0.0
- */
- @RequestMapping(value = "/add")
- public String add(@Valid @RequestBody CheckItem checkItem){
- checkItemService.insert(checkItem);
- return super.returnSuccessResult("添加成功");
- }
-
- /**
- * 修改考核项
- * @return
- * String
- * @exception
- * @since 1.0.0
- */
- @RequestMapping(value = "/update")
- public String update(@Valid @RequestBody CheckItem checkItem){
- checkItemService.update(checkItem);
- return super.returnSuccessResult("修改成功");
- }
-
- /**
- * 删除考核项
- * @return
- * String
- * @exception
- * @since 1.0.0
- */
- @RequestMapping(value = "/delete")
- public String delete(@RequestBody CheckItem checkItem){
- checkItemService.delete(checkItem.getId());
- return super.returnSuccessResult("删除成功");
- }
-
- /**
- * 根据id获取考核项数据
- * @param checkItem
- * @return
- */
- @RequestMapping(value = "/getById")
- public String getById(@RequestBody CheckItem checkItem){
- if(checkItem.getId()==null){
- throw new BusinessException(20101);
- }
- CheckItem checkItemOne = checkItemService.getById(checkItem.getId()) ;
- return super.returnSuccessResult(checkItemOne);
- }
-
- @RequestMapping(value = "/getAll")
- public String getAll(){
- List<CheckItem> checkItems = checkItemService.getAll() ;
- return super.returnSuccessResult(checkItems);
- }
-
- @RequestMapping(value = "/getForTaskById")
- public String getForTaskById(@RequestBody CheckItem checkItem){
- List<CheckItem> checkItems = checkItemService.getAll();
- return super.returnSuccessResult(checkItems);
- }
-
- /**
- * 通过父亲id获取考核项
- * @return
- * String
- * @exception
- * @since 1.0.0
- */
- @RequestMapping(value = "/getByParentId")
- public String getByParentId(@RequestBody CheckItem checkItem){
- if(checkItem.getParent_id()==null){
- throw new BusinessException(20101);
- }
- List<CheckItem> checkItemList = checkItemService.getByParentId(checkItem.getParent_id());
- return super.returnSuccessResult(checkItemList);
- }
-
- /**
- * 通过方法id获取考核项
- * @return
- * String
- * @exception
- * @since 1.0.0
- */
- @RequestMapping(value = "/getByRuleId")
- public String getByRuleId(@RequestBody CheckItem checkItem){
- if(checkItem.getRule_id()==null){
- throw new BusinessException(20101);
- }
- List<CheckItem> checkItemList = checkItemService.getByRuleId(checkItem.getRule_id());
- return super.returnSuccessResult(checkItemList);
- }
- }
|