package com.xintong.visualinspection.controller;

import java.util.List;

import com.xintong.visualinspection.bean.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.xintong.visualinspection.bean.UserClass;
import com.xintong.visualinspection.service.UserClassService;

/**
 * 文件名：TestController
 * 版本信息：日期：2017/3/30 Copyright 江苏省交通规划设计院 Corporation 2017 版权所有.
 */
@RestController
@RequestMapping("/userClass")
public class UserClassController extends BaseController {

	@Autowired
	UserClassService userClassService ;
	
	/**
     * 通过id获取班次
     * @return
     * String
     * @exception
     * @since  1.0.0
     */
    @RequestMapping(value = "/addList")
    public String addList(@RequestBody List<UserClass> list){
    	userClassService.insertList(list);
    	return super.returnSuccessResult("添加成功");
    }
    
    @RequestMapping(value = "/getList")
    public String getList(@RequestBody UserClass userClass){
    	List<UserClass> list = userClassService.selectList(userClass);
    	return super.returnSuccessResultTime(list);
    }
    
    /**
     * 更新收费站车道值班
     * @param list
     * @return
     */
    @RequestMapping(value = "/updateList")
    public String updateList(@RequestBody List<UserClass> list){
    	userClassService.updateList(list);
    	return super.returnSuccessResult("修改成功");
    }
    
    @RequestMapping(value = "/getUsersByTeamId/{user_class_id}",method=RequestMethod.POST,produces="application/json;charset=UTF-8")
    public String getUsersByTeamId(@PathVariable Integer user_class_id){
    	List<User> users= userClassService.getUsersByTeamId(user_class_id);
    	return returnResult(0, "获取成功", users);
    }
}
