栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

hive springboot mybatis-plus

hive springboot mybatis-plus

pom文件

        
            org.apache.hive
            hive-jdbc
            2.1.1
            
                
                    org.eclipse.jetty.aggregate
                    *
                
            
        
        
            com.alibaba
            druid-spring-boot-starter
            1.1.23
        
        
            org.springframework.boot
            spring-boot-starter-jdbc
        
        
            com.baomidou
            mybatis-plus-boot-starter
            3.4.0
        

注意hive-jdbc版本一定与hive目录下的lib目录当中的jdbc版本一致

application.yml

spring:
  datasource:
    driver-class-name: org.apache.hive.jdbc.HiveDriver
    url: jdbc:hive2://自己的地址啦:10000/default
    username: root
    password:
logging:
  level:
    com.example.hive.mapper: debug

 Mapper

public interface CityWeatherMapper extends baseMapper {
    
    List getall();
}





	
		select key,cityname,humidity,pyName,state1,state2,stateDetailed,tem1,tem2,temNow,time,url,windDir,windPower,windState from weather_city_five_minutes_jinzhou_hive
	

注意一定不要写select  *  from tableName 返回的对应不上实体类要将所有字段写出

@RestController
@RequestMapping("/city")
public class CityWeatherController {
    @Resource
    CityWeatherMapper cityWeatherMapper;

    @GetMapping("getWeather")
    public List a(){
//        List cityWeathers = cityWeatherMapper.selectList(null);
        List getall = cityWeatherMapper.getall();
        return getall;
    }
}

 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/776007.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号