| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- 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.visualinspection.bean.Team;
- import com.xintong.visualinspection.err.BusinessException;
- import com.xintong.visualinspection.service.TeamService;
- /**
- * 文件名:TestController
- * 版本信息:日期:2017/3/30 Copyright 江苏省交通规划设计院 Corporation 2017 版权所有.
- */
- @RestController
- @RequestMapping("/team")
- public class TeamController extends BaseController {
- @Autowired
- private TeamService teamService;
-
- /**
- * 添加班组
- * @return
- * String
- * @exception
- * @since 1.0.0
- */
- @RequestMapping(value = "/add")
- public String add(@Valid @RequestBody Team team){
- teamService.insert(team);
- return super.returnSuccessResult("添加成功");
- }
-
- /**
- * 修改班组
- * @return
- * String
- * @exception
- * @since 1.0.0
- */
- @RequestMapping(value = "/update")
- public String update(@Valid @RequestBody Team team){
- teamService.update(team);
- return super.returnSuccessResult("修改成功");
- }
-
- /**
- * 删除班组
- * @return
- * String
- * @exception
- * @since 1.0.0
- */
- @RequestMapping(value = "/delete")
- public String delete(@RequestBody Team team){
- teamService.delete(team.getId());
- return super.returnSuccessResult("删除成功");
- }
-
- /**
- * 通过id获取班组
- * @return
- * String
- * @exception
- * @since 1.0.0
- */
- @RequestMapping(value = "/getTeamById")
- public String getTeamById(@RequestBody Team team){
- if(team.getId()==null){
- throw new BusinessException(20002);
- }
- Team t = teamService.getById(team.getId());
- return super.returnSuccessResult(t);
- }
-
- /**
- * 通过部门id获取班组
- * @return
- * String
- * @exception
- * @since 1.0.0
- */
- @RequestMapping(value = "/getTeamByDeptId")
- public String getTeamByDeptId(@RequestBody Team team){
- if(team.getDept_id()==null){
- throw new BusinessException(20901);
- }
- List<Team> teamList = teamService.getByDeptId(team.getDept_id());
- return super.returnSuccessResult(teamList);
- }
- }
|