刚才我们已经成功引入了layui框架,现在我们来实现查询操作。
首先我们先看一下项目的application.yml里面写的配置。
注意一下数据库名称
#配置数据源
spring:
datasource:
username: root #用户名
password: root #密码
driver-class-name: com.mysql.jdbc.Driver #驱动
url: jdbc:mysql://127.0.0.1:3306/bohua?useUnicode=true&characterEncoding=utf-8 #路径
druid:
max-active: 100
max-wait: 10000
initial-size: 5
min-idle: 10
#端口号
server:;
port: 8080
#解决德鲁伊配置冲突
beetlsql:
enabled: false
#指定mapper配置文件
mybatis:
mapper-locations: classpath:mapper/*.xml
#beetl的后缀
beetl:
suffix: html
#bybatis分页插件配置
pagehelper:
helper-dialect: mysql #数据库
reasonable: true
support-methods-arguments: true
params: count=countSql
然后我们在确认一下pom文件里面的包
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.bohua</groupId>
<artifactId>bohua-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>bohua-parent</name>
<description>admin-template</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding&