微服务调用demo,两个服务,echarts界面
作者:互联网
package cn.kgc.flight.service;
import cn.kgc.flight.dao.FlightDao;
import cn.kgc.flight.pojo.City;
import cn.kgc.flight.pojo.Flight;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
@RestController
@Transactional(readOnly = true)
public class FlightService {
@Resource
private FlightDao flightDao;
@RequestMapping("/showCity")
public List<City> showAllCity() {
return flightDao.queryAllCity();
}
@RequestMapping("/showFlight")
public List<Flight> showFlight(@RequestParam(value = "departureCity") Integer departureCity, @RequestParam(value = "arrivalCity") Integer arrivalCity) {
return flightDao.queryFlight(departureCity, arrivalCity);
}
@RequestMapping("/count")
public Boolean queryCountByFlightNo(@RequestParam(value = "flightNo") String flightNo) {
return flightDao.queryCountByFlightNo(flightNo) == 1;
}
@RequestMapping("/add")
@Transactional
public Boolean addFlight(@RequestBody Flight flight) {
return flightDao.insertFlight(flight) == 1;
}
}
标签:flight,RequestMapping,demo,springframework,echarts,flightDao,import,服务,annotatio 来源: https://www.cnblogs.com/daizuo/p/13974314.html