VehicleInoutStopController.java 1.63 KB
package com.bsth.controller.traffic;

import com.bsth.controller.BaseController;
import com.bsth.entity.traffic.VehicleInoutStop;
import com.bsth.service.traffic.VehicleInoutStopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 *
 * @author BSTH
 *
 */
@RestController
@RequestMapping("vehicle_stop")
public class VehicleInoutStopController extends BaseController<VehicleInoutStop,Integer> {

    @Autowired
    VehicleInoutStopService vehicleInoutStopService;

    /**
     * 给定条件查车载上报停靠站
     * @param map
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "getVehicleInoutStopByParam")
    public Page<Map<String, Object>> getVehicleInoutStopByParam(@RequestParam Map<String, Object> map,
                        @RequestParam(defaultValue = "0") int page,
                        @RequestParam(defaultValue = "10") int size) {
        map.put("page",page);
        map.put("size",size);
        long total = vehicleInoutStopService.getVehicleInoutStopCountByParam(map);
        Page<Map<String, Object>> result = new PageImpl<>(vehicleInoutStopService.getVehicleInoutStopByParam(map),
                new PageRequest(page, size, null),total);
        return result;
    }
}