import org.springframework.beans.factory.annotation.Autowired; import
org.springframework.jdbc.core.JdbcTemplate; import
org.springframework.web.bind.annotation.GetMapping; import
org.springframework.web.bind.annotation.RestController; import java.util.List;
import java.util.Map; /** * @Author: 说谎 说明:不用实体类,只用sql语句查询数据库信息 * @Date
2022/4/20 10:01 */ @RestController public class JDBCController { @Autowired
JdbcTemplate jdbcTemplate; //查询数据库的信息 //没有实体类的情况下,获取数据库中的信息,怎么获取?
@GetMapping("/test") public List<Map<String,Object>> list(){ String sql="select
* from haha"; List<Map<String, Object>> sqlList =
jdbcTemplate.queryForList(sql); return sqlList; } }

技术
今日推荐
PPT
阅读数 121
下载桌面版
GitHub
百度网盘(提取码:draw)
Gitee
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:766591547
关注微信