package com.moral.api.controller; import com.moral.api.entity.CityWeather; import com.moral.api.service.CityWeatherService; import com.moral.constant.ResultMessage; import io.swagger.annotations.Api; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.Map; /** * @ClassName WeatherController * @Description TODO * @Author 陈凯裕 * @Date 2021/10/28 8:43 * @Version TODO **/ @Slf4j @Api(tags = {"天气"}) @RestController @RequestMapping("/weather") @CrossOrigin(origins = "*", maxAge = 3600) public class WeatherController { @Autowired CityWeatherService cityWeatherService; /** * @Description: 根据地区码查询天气 * @Param: [regionCode] * @return: com.moral.constant.ResultMessage * @Author: 陈凯裕 * @Date: 2021/10/29 */ @GetMapping("queryByRegionCode") public ResultMessage queryByRegionCode(Integer regionCode){ Map value = cityWeatherService.queryWeatherByRegionCode(regionCode); return ResultMessage.ok(value); } }