@Repository
public interface ShumeipaiMapper {
@Select("select * from smp")
List<Shumeipai> getAllShump();
}
public interface ShumeipaiService {
List<Shumeipai> getAllSmp();
}
@Service
public class ShumeipaiServiceImpl implements ShumeipaiService {
@Autowired
private ShumeipaiMapper shumeipaiMapper;
@Override
public List<Shumeipai> getAllSmp() {
return shumeipaiMapper.getAllShump();
}
}
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>smp</title>
</head>
<body>
<table border="1">
<tr>
<tr>
<th>humidity</th>
<th>temperature</th>
<th>time</th>
<th>number</th>
</tr>
<tr th:each="s : ${list}">
<td><span th:text="${s.getHumidity()}"></span></td>
<td><span th:text="${s.getTemperature()}"></span></td>
<td><span th:text="${s.getTime()}"></span></td>
<td><span th:text="${s.getNumber()}"></span></td>
</tr>
</table>
</body>
</html>
2019-07-24 10:35:28.704 INFO 9568 --- [ main] com.smp.Myapplication : Starting Myapplication on DESKTOP-N40IPU5 with PID 9568 (C:\Users\dell\Desktop\88ybg\springboot\target\classes started by dell in C:\Users\dell\Desktop\88ybg\springboot)
2019-07-24 10:35:28.709 INFO 9568 --- [ main] com.smp.Myapplication : No active profile set, falling back to default profiles: default
2019-07-24 10:35:30.490 INFO 9568 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8888 (http)
2019-07-24 10:35:30.517 INFO 9568 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-07-24 10:35:30.517 INFO 9568 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.21]
2019-07-24 10:35:30.697 INFO 9568 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-07-24 10:35:30.697 INFO 9568 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1897 ms
2019-07-24 10:35:31.040 INFO 9568 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-07-24 10:35:31.285 INFO 9568 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8888 (http) with context path ''
2019-07-24 10:35:31.288 INFO 9568 --- [ main] com.smp.Myapplication : Started Myapplication in 3.089 seconds (JVM running for 4.277)
2019-07-24 10:35:34.139 INFO 9568 --- [nio-8888-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2019-07-24 10:35:34.139 INFO 9568 --- [nio-8888-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2019-07-24 10:35:34.147 INFO 9568 --- [nio-8888-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 7 ms
2019-07-24 10:35:34.297 INFO 9568 --- [nio-8888-exec-1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2019-07-24 10:35:34.863 INFO 9568 --- [nio-8888-exec-1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
刚学不久,还请大佬帮忙看一下