StationRouteController.java 1.86 KB
package com.bsth.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.bsth.entity.StationRoute;
import com.bsth.service.StationRouteService;

/**
 * 
 * @ClassName: StationRouteController(站点路由控制器)
 * 
 * @Extends : BaseController
 * 
 * @Description: TODO(站点路由控制层)
 * 
 * @Author bsth@lq
 * 
 * @Date 2016年5月03日 上午9:21:17
 *
 * @Dersion 公交调度系统BS版 0.1
 * 
 */
@RestController
@RequestMapping("stationroute")
public class StationRouteController extends BaseController<StationRoute, Integer> {
	
	@Autowired
	StationRouteService service;
	
	@RequestMapping(method = RequestMethod.GET)
	public Page<StationRoute> list(@RequestParam Map<String, Object> map,
			@RequestParam(defaultValue = "0") int page,
			@RequestParam(defaultValue = "5") int size,
			@RequestParam(defaultValue = "id") String order,
			@RequestParam(defaultValue = "DESC") String direction){
		
		Direction d;
		
		if(null != direction && direction.equals("ASC"))
			d = Direction.ASC;
		else
			d = Direction.DESC;
		
		return service.list(map, new PageRequest(page, size, new Sort(d, order)));
	}
	
	@RequestMapping(value = "/findStations" , method = RequestMethod.GET)
	public  List<Map<String, Object>> findPoints(@RequestParam Map<String, Object> map) {
		return service.findPoints(map);
	}
}