jinpengyong
2021-12-30 eca8731f8626a8baf4d472de31da160e5f77abc7
screen-api/src/main/java/com/moral/api/controller/WeatherController.java
@@ -1,12 +1,17 @@
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
@@ -16,13 +21,25 @@
 * @Version TODO
 **/
@Slf4j
@Api(tags = {"用户管理"})
@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(String regionCode){
        return null;
    public ResultMessage queryByRegionCode(Integer regionCode){
        Map<String, Object> value = cityWeatherService.queryWeatherByRegionCode(regionCode);
        return ResultMessage.ok(value);
    }
}