1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- package com.robot.remote.smartrobotremote.controller;
- import com.robot.remote.smartrobotremote.domain.BizDevice;
- import com.robot.remote.smartrobotremote.mapper.BizDeviceMapper;
- import lombok.extern.slf4j.Slf4j;
- 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;
- @Slf4j
- @RestController
- public class TestController {
- @Autowired
- private JdbcTemplate jdbcTemplate;
- @Autowired
- private BizDeviceMapper bizDeviceMapper;
- @GetMapping("/hello")
- public String hello(String name) {
- return "hello " + name;
- }
- /**
- * jdbcTemplate 模拟查询数据
- *
- */
- @GetMapping("/testQuerySqlServerByJDBC")
- public List<Map<String, Object>> testQuerySqlServerByJDBC() {
- String sql = "SELECT * FROM biz_device";
- return jdbcTemplate.queryForList(sql);
- }
- /**
- * mybatis 模拟查询数据
- *
- */
- @GetMapping("/testQuerySqlServerByMybatis")
- public List<BizDevice> testQuerySqlServerByMybatis() {
- return this.bizDeviceMapper.selectBizDeviceList(null);
- }
- }
|