转git仓库
This commit is contained in:
+45
@@ -0,0 +1,45 @@
|
|||||||
|
# Maven 构建产物
|
||||||
|
target/
|
||||||
|
*/target/
|
||||||
|
**/target/
|
||||||
|
|
||||||
|
# IntelliJ IDEA 配置文件
|
||||||
|
.idea/
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
out/
|
||||||
|
|
||||||
|
# 系统临时文件
|
||||||
|
*.tmp
|
||||||
|
*.temp
|
||||||
|
*~
|
||||||
|
|
||||||
|
# Windows 系统文件
|
||||||
|
Thumbs.db
|
||||||
|
Desktop.ini
|
||||||
|
|
||||||
|
# 日志文件
|
||||||
|
logs/
|
||||||
|
*.log
|
||||||
|
**/logs/
|
||||||
|
**/*.log
|
||||||
|
|
||||||
|
# 测试报告
|
||||||
|
test-reports/
|
||||||
|
surefire-reports/
|
||||||
|
failsafe-reports/
|
||||||
|
jacoco.exec
|
||||||
|
jacoco-report/
|
||||||
|
|
||||||
|
# 打包文件
|
||||||
|
*.jar
|
||||||
|
*.war
|
||||||
|
*.ear
|
||||||
|
*.zip
|
||||||
|
*.tar.gz
|
||||||
|
*.tar.bz2
|
||||||
|
|
||||||
|
# 敏感配置文件
|
||||||
|
*.key
|
||||||
|
*.pem
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<?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.itheima</groupId>
|
||||||
|
<artifactId>http-server-demo</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
package com.inmind;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.net.ServerSocket;
|
||||||
|
import java.net.Socket;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 自定义web服务器
|
||||||
|
*/
|
||||||
|
public class Server {
|
||||||
|
public static void main(String[] args) throws IOException {
|
||||||
|
ServerSocket ss = new ServerSocket(8080); // 监听指定端口
|
||||||
|
System.out.println("server is running...");
|
||||||
|
|
||||||
|
while (true){
|
||||||
|
Socket sock = ss.accept();
|
||||||
|
System.out.println("connected from " + sock.getRemoteSocketAddress());
|
||||||
|
|
||||||
|
//开启线程处理请求
|
||||||
|
Thread t = new Handler(sock);
|
||||||
|
t.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Handler extends Thread {
|
||||||
|
Socket sock;
|
||||||
|
|
||||||
|
public Handler(Socket sock) {
|
||||||
|
this.sock = sock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
try (InputStream input = this.sock.getInputStream(); OutputStream output = this.sock.getOutputStream()) {
|
||||||
|
handle(input, output);
|
||||||
|
} catch (Exception e) {
|
||||||
|
try {
|
||||||
|
this.sock.close();
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
}
|
||||||
|
System.out.println("client disconnected.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handle(InputStream input, OutputStream output) throws IOException {
|
||||||
|
BufferedReader reader = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8));
|
||||||
|
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(output, StandardCharsets.UTF_8));
|
||||||
|
|
||||||
|
// 读取HTTP请求:
|
||||||
|
boolean requestOk = false;
|
||||||
|
String first = reader.readLine();
|
||||||
|
if (first.startsWith("GET / HTTP/1.")) {
|
||||||
|
requestOk = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
String header = reader.readLine();
|
||||||
|
if (header.isEmpty()) { // 读取到空行时, HTTP Header读取完毕
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
System.out.println(header);
|
||||||
|
}
|
||||||
|
System.out.println(requestOk ? "Response OK" : "Response Error");
|
||||||
|
|
||||||
|
if (!requestOk) {// 发送错误响应:
|
||||||
|
writer.write("HTTP/1.0 404 Not Found\r\n");
|
||||||
|
writer.write("Content-Length: 0\r\n");
|
||||||
|
writer.write("\r\n");
|
||||||
|
writer.flush();
|
||||||
|
} else { // 发送成功响应:
|
||||||
|
//读取html文件,转换为字符串
|
||||||
|
InputStream is = Server.class.getClassLoader().getResourceAsStream("html/a.html");
|
||||||
|
BufferedReader br = new BufferedReader(new InputStreamReader(is));
|
||||||
|
StringBuilder data = new StringBuilder();
|
||||||
|
String line = null;
|
||||||
|
while ((line = br.readLine()) != null){
|
||||||
|
data.append(line);
|
||||||
|
}
|
||||||
|
br.close();
|
||||||
|
int length = data.toString().getBytes(StandardCharsets.UTF_8).length;
|
||||||
|
|
||||||
|
writer.write("HTTP/1.1 200 OK\r\n");
|
||||||
|
writer.write("Connection: keep-alive\r\n");
|
||||||
|
writer.write("Content-Type: text/html\r\n");
|
||||||
|
writer.write("Content-Length: " + length + "\r\n");
|
||||||
|
writer.write("\r\n"); // 空行标识Header和Body的分隔
|
||||||
|
writer.write(data.toString());
|
||||||
|
writer.flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Title</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<table border="1" cellspacing="0" width="500">
|
||||||
|
<tr>
|
||||||
|
<th>序号</th>
|
||||||
|
<th>品牌名称</th>
|
||||||
|
<th>企业名称</th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
<tr align="center">
|
||||||
|
<td>010</td>
|
||||||
|
<td>三只松鼠</td>
|
||||||
|
<td>三只松鼠</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr align="center">
|
||||||
|
<td>009</td>
|
||||||
|
<td>优衣库</td>
|
||||||
|
<td>优衣库</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr align="center">
|
||||||
|
<td>008</td>
|
||||||
|
<td>小米</td>
|
||||||
|
<td>小米科技有限公司</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
<?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.inmind</groupId>
|
||||||
|
<artifactId>maven-project01</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<!--依赖管理坐标-->
|
||||||
|
<dependencies>
|
||||||
|
<!--logback日志框架-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-classic</artifactId>
|
||||||
|
<version>1.2.4</version>
|
||||||
|
<!--依赖范围-->
|
||||||
|
<!-- <scope>compile</scope>-->
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
<!-- 打包插件 -->
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
<version>2.4.1</version>
|
||||||
|
<configuration>
|
||||||
|
<descriptorRefs><descriptorRef>jar-with-dependencies</descriptorRef></descriptorRefs>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>make-assembly</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals><goal>single</goal></goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.inmind;
|
||||||
|
|
||||||
|
//import org.slf4j.Logger;
|
||||||
|
|
||||||
|
public class HelloWorld {
|
||||||
|
// Logger logger;
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println("Hello Maven");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.inmind;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
|
public class DemoTest {
|
||||||
|
|
||||||
|
Logger logger;
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?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.itheima</groupId>
|
||||||
|
<artifactId>maven-project02</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-classic</artifactId>
|
||||||
|
<version>1.2.3</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.12</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?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.inmind</groupId>
|
||||||
|
<artifactId>maven-projectA</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<!--依赖管理-->
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-classic</artifactId>
|
||||||
|
<version>1.2.3</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.inmind</groupId>
|
||||||
|
<artifactId>maven-projectB</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<!--排除依赖【面试题】-->
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?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.inmind</groupId>
|
||||||
|
<artifactId>maven-projectB</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<!--项目B的依赖管理-->
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.inmind</groupId>
|
||||||
|
<artifactId>maven-projectC</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.10</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?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.inmind</groupId>
|
||||||
|
<artifactId>maven-projectC</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<!--项目C的依赖管理-->
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
<version>2.11.0</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
-- auto-generated definition
|
||||||
|
create table tb_emp
|
||||||
|
(
|
||||||
|
id int unsigned auto_increment comment 'ID'
|
||||||
|
primary key,
|
||||||
|
username varchar(20) not null comment '用户名',
|
||||||
|
password varchar(32) default '123456' null comment '密码',
|
||||||
|
name varchar(10) not null comment '姓名',
|
||||||
|
gender tinyint unsigned not null comment '性别, 说明: 1 男, 2 女',
|
||||||
|
image varchar(300) null comment '图像',
|
||||||
|
job tinyint unsigned null comment '职位, 说明: 1 班主任,2 讲师, 3 学工主管, 4 教研主管',
|
||||||
|
entrydate date null comment '入职时间',
|
||||||
|
dept_id int unsigned null comment '部门ID',
|
||||||
|
create_time datetime not null comment '创建时间',
|
||||||
|
update_time datetime not null comment '修改时间',
|
||||||
|
constraint username
|
||||||
|
unique (username)
|
||||||
|
)
|
||||||
|
comment '员工表';
|
||||||
|
-- ========================================基本查询==========================================
|
||||||
|
-- DML:数据操作语言
|
||||||
|
-- DML : 插入数据 - insert
|
||||||
|
-- 1. 为 tb_emp 表的 username, name, gender 字段插入值
|
||||||
|
insert into tb_emp (username,name,gender,create_time,update_time)
|
||||||
|
values('wuji','张无忌1',1,now(),now());
|
||||||
|
|
||||||
|
-- 2. 为 tb_emp 表的 所有字段插入值
|
||||||
|
insert into tb_emp values
|
||||||
|
(null,'zs','123','张三',1
|
||||||
|
,'1.png',1,'2015-01-01',1,now(),now());
|
||||||
|
|
||||||
|
insert into tb_emp
|
||||||
|
(id, username, password, name, gender, image, job, entrydate, dept_id, create_time, update_time)
|
||||||
|
values
|
||||||
|
(null,'zs1','1234','张三1',1
|
||||||
|
,'1.png',1,'2015-01-01',1,now(),now());
|
||||||
|
|
||||||
|
-- 3. 批量为 为 tb_emp 表的 username , name , gender 字段插入数据
|
||||||
|
insert into tb_emp
|
||||||
|
(username,name,gender,create_time,update_time)
|
||||||
|
values
|
||||||
|
('wuji2','张无忌2',1,now(),now()),
|
||||||
|
('wuji3','张无忌3',1,now(),now()),
|
||||||
|
('wuji4','张无忌4',1,now(),now())
|
||||||
|
;
|
||||||
|
|
||||||
|
-- DML : 更新数据 - update
|
||||||
|
-- 1. 将 tb_emp 表的ID为1员工 姓名name字段更新为 '张四'
|
||||||
|
update tb_emp set name = '张四' where id = 1;
|
||||||
|
update tb_emp set name = '张四' ;
|
||||||
|
-- 2. 将 tb_emp 表的所有员工的入职日期更新为 '2010-01-01'
|
||||||
|
update tb_emp set entrydate='2010-01-01',update_time=now();
|
||||||
|
|
||||||
|
|
||||||
|
-- DML : 删除数据 - delete
|
||||||
|
-- 1. 删除 tb_emp 表中 ID为1的员工
|
||||||
|
delete from tb_emp where id = 1;
|
||||||
|
|
||||||
|
-- 2. 删除 tb_emp 表中的所有员工
|
||||||
|
delete from tb_emp;
|
||||||
|
|
||||||
|
-- ======================================DQL===================================
|
||||||
|
-- 基本查询
|
||||||
|
-- 1. 查询指定字段 name,entrydate 并返回
|
||||||
|
select name,entrydate from tb_emp;
|
||||||
|
|
||||||
|
-- 2. 查询返回所有字段
|
||||||
|
-- 方式一: 推荐 , 效率高 . 更直观
|
||||||
|
select id, username, password, name, gender,
|
||||||
|
image, job, entrydate, dept_id,
|
||||||
|
create_time, update_time from tb_emp;
|
||||||
|
|
||||||
|
-- 方式二:不推荐(不直观,性能低)
|
||||||
|
select * from tb_emp;
|
||||||
|
|
||||||
|
-- 3. 查询所有员工的 name,entrydate, 并起别名(姓名、入职日期) --- as 关键字可以省略
|
||||||
|
select name as '姓名',entrydate as '入职日期' from tb_emp;
|
||||||
|
|
||||||
|
select name '姓名',entrydate '入职日期' from tb_emp;
|
||||||
|
|
||||||
|
-- 4. 查询员工有哪几种职位(不要重复) -- distinct
|
||||||
|
select distinct job from tb_emp;
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
-- ===========================条件查询=======================
|
||||||
|
-- 数据准备
|
||||||
|
-- 员工管理(带约束)
|
||||||
|
create table tb_emp (
|
||||||
|
id int unsigned primary key auto_increment comment 'ID',
|
||||||
|
username varchar(20) not null unique comment '用户名',
|
||||||
|
password varchar(32) default '123456' comment '密码',
|
||||||
|
name varchar(10) not null comment '姓名',
|
||||||
|
gender tinyint unsigned not null comment '性别, 说明: 1 男, 2 女',
|
||||||
|
image varchar(300) comment '图像',
|
||||||
|
job tinyint unsigned comment '职位, 说明: 1 班主任,2 讲师, 3 学工主管, 4 教研主管',
|
||||||
|
entrydate date comment '入职时间',
|
||||||
|
create_time datetime not null comment '创建时间',
|
||||||
|
update_time datetime not null comment '修改时间'
|
||||||
|
) comment '员工表';
|
||||||
|
|
||||||
|
-- 准备测试数据
|
||||||
|
INSERT INTO tb_emp (id, username, password, name, gender, image, job, entrydate, create_time, update_time)
|
||||||
|
VALUES
|
||||||
|
(1, 'jinyong', '123456', '金庸', 1, '1.jpg', 4, '2000-01-01', '2022-10-27 16:35:33', '2022-10-27 16:35:35'),
|
||||||
|
(2, 'zhangwuji', '123456', '张无忌', 1, '2.jpg', 2, '2015-01-01', '2022-10-27 16:35:33', '2022-10-27 16:35:37'),
|
||||||
|
(3, 'yangxiao', '123456', '杨逍', 1, '3.jpg', 2, '2008-05-01', '2022-10-27 16:35:33', '2022-10-27 16:35:39'),
|
||||||
|
(4, 'weiyixiao', '123456', '韦一笑', 1, '4.jpg', 2, '2007-01-01', '2022-10-27 16:35:33', '2022-10-27 16:35:41'),
|
||||||
|
(5, 'changyuchun', '123456', '常遇春', 1, '5.jpg', 2, '2012-12-05', '2022-10-27 16:35:33', '2022-10-27 16:35:43'),
|
||||||
|
(6, 'xiaozhao', '123456', '小昭', 2, '6.jpg', 3, '2013-09-05', '2022-10-27 16:35:33', '2022-10-27 16:35:45'),
|
||||||
|
(7, 'jixiaofu', '123456', '纪晓芙', 2, '7.jpg', 1, '2005-08-01', '2022-10-27 16:35:33', '2022-10-27 16:35:47'),
|
||||||
|
(8, 'zhouzhiruo', '123456', '周芷若', 2, '8.jpg', 1, '2014-11-09', '2022-10-27 16:35:33', '2022-10-27 16:35:49'),
|
||||||
|
(9, 'dingminjun', '123456', '丁敏君', 2, '9.jpg', 1, '2011-03-11', '2022-10-27 16:35:33', '2022-10-27 16:35:51'),
|
||||||
|
(10, 'zhaomin', '123456', '赵敏', 2, '10.jpg', 1, '2013-09-05', '2022-10-27 16:35:33', '2022-10-27 16:35:53'),
|
||||||
|
(11, 'luzhangke', '123456', '鹿杖客', 1, '11.jpg', 2, '2007-02-01', '2022-10-27 16:35:33', '2022-10-27 16:35:55'),
|
||||||
|
(12, 'hebiweng', '123456', '鹤笔翁', 1, '12.jpg', 2, '2008-08-18', '2022-10-27 16:35:33', '2022-10-27 16:35:57'),
|
||||||
|
(13, 'fangdongbai', '123456', '方东白', 1, '13.jpg', 1, '2012-11-01', '2022-10-27 16:35:33', '2022-10-27 16:35:59'),
|
||||||
|
(14, 'zhangsanfeng', '123456', '张三丰', 1, '14.jpg', 2, '2002-08-01', '2022-10-27 16:35:33', '2022-10-27 16:36:01'),
|
||||||
|
(15, 'yulianzhou', '123456', '俞莲舟', 1, '15.jpg', 2, '2011-05-01', '2022-10-27 16:35:33', '2022-10-27 16:36:03'),
|
||||||
|
(16, 'songyuanqiao', '123456', '宋远桥', 1, '16.jpg', 2, '2010-01-01', '2022-10-27 16:35:33', '2022-10-27 16:36:05'),
|
||||||
|
(17, 'chenyouliang', '12345678', '陈友谅', 1, '17.jpg', null, '2015-03-21', '2022-10-27 16:35:33', '2022-10-27 16:36:07'),
|
||||||
|
(18, 'zhang1', '123456', '张一', 1, '2.jpg', 2, '2015-01-01', '2022-10-27 16:35:33', '2022-10-27 16:36:09'),
|
||||||
|
(19, 'zhang2', '123456', '张二', 1, '2.jpg', 2, '2012-01-01', '2022-10-27 16:35:33', '2022-10-27 16:36:11'),
|
||||||
|
(20, 'zhang3', '123456', '张三', 1, '2.jpg', 2, '2018-01-01', '2022-10-27 16:35:33', '2022-10-27 16:36:13'),
|
||||||
|
(21, 'zhang4', '123456', '张四', 1, '2.jpg', 2, '2015-01-01', '2022-10-27 16:35:33', '2022-10-27 16:36:15'),
|
||||||
|
(22, 'zhang5', '123456', '张五', 1, '2.jpg', 2, '2016-01-01', '2022-10-27 16:35:33', '2022-10-27 16:36:17'),
|
||||||
|
(23, 'zhang6', '123456', '张六', 1, '2.jpg', 2, '2012-01-01', '2022-10-27 16:35:33', '2022-10-27 16:36:19'),
|
||||||
|
(24, 'zhang7', '123456', '张七', 1, '2.jpg', 2, '2006-01-01', '2022-10-27 16:35:33', '2022-10-27 16:36:21'),
|
||||||
|
(25, 'zhang8', '123456', '张八', 1, '2.jpg', 2, '2002-01-01', '2022-10-27 16:35:33', '2022-10-27 16:36:23'),
|
||||||
|
(26, 'zhang9', '123456', '张九', 1, '2.jpg', 2, '2011-01-01', '2022-10-27 16:35:33', '2022-10-27 16:36:25'),
|
||||||
|
(27, 'zhang10', '123456', '张十', 1, '2.jpg', 2, '2004-01-01', '2022-10-27 16:35:33', '2022-10-27 16:36:27'),
|
||||||
|
(28, 'zhang11', '123456', '张十一', 1, '2.jpg', 2, '2007-01-01', '2022-10-27 16:35:33', '2022-10-27 16:36:29'),
|
||||||
|
(29, 'zhang12', '123456', '张十二', 1, '2.jpg', 2, '2020-01-01', '2022-10-27 16:35:33', '2022-10-27 16:36:31');
|
||||||
|
|
||||||
|
-- 1. 查询 姓名 为 杨逍 的员工
|
||||||
|
select * from tb_emp where name = '杨逍';
|
||||||
|
|
||||||
|
-- 2. 查询在 id小于等于5 的员工信息
|
||||||
|
select * from tb_emp where id <= 5;
|
||||||
|
|
||||||
|
-- 3. 查询 没有分配职位 的员工信息 -- 判断 null , 用 is null
|
||||||
|
select * from tb_emp where job is null;
|
||||||
|
|
||||||
|
-- 4. 查询 有职位 的员工信息 -- 判断 不是null , 用 is not null
|
||||||
|
select * from tb_emp where job is not null;
|
||||||
|
|
||||||
|
-- 5. 查询 密码不等于 '123456' 的员工信息
|
||||||
|
select * from tb_emp where password != '123456';
|
||||||
|
select * from tb_emp where password <> '123456';
|
||||||
|
|
||||||
|
-- 6. 查询入职日期 在 '2000-01-01' (包含) 到 '2010-01-01'(包含) 之间的员工信息
|
||||||
|
select * from tb_emp where entrydate >= '2000-01-01' and entrydate <= '2010-01-01';
|
||||||
|
select * from tb_emp where entrydate between '2000-01-01' and '2010-01-01';
|
||||||
|
|
||||||
|
-- 7. 查询 入职时间 在 '2000-01-01' (包含) 到 '2010-01-01'(包含) 之间 且 性别为女 的员工信息
|
||||||
|
select * from tb_emp where entrydate between '2000-01-01' and '2010-01-01' and gender = 2;
|
||||||
|
|
||||||
|
-- 8. 查询 职位是 2 (讲师), 3 (学工主管), 4 (教研主管) 的员工信息
|
||||||
|
select * from tb_emp where job = 2 or job = 3 or job = 4;
|
||||||
|
|
||||||
|
select * from tb_emp where job in (2,3,4);
|
||||||
|
|
||||||
|
-- 9. 查询姓名为两个字的员工信息 【_匹配一个字符 %匹配0或多个字符】
|
||||||
|
select * from tb_emp where name like '__';
|
||||||
|
|
||||||
|
-- 10. 查询姓 '张' 的员工信息
|
||||||
|
select * from tb_emp where name like '张%';
|
||||||
|
|
||||||
|
-- 11. 查询姓名中包含 '三' 的员工信息
|
||||||
|
select * from tb_emp where name like '%三%';
|
||||||
|
|
||||||
|
-- 练习 : 员工管理列表查询
|
||||||
|
-- 条件 : name , gender , entrydate
|
||||||
|
select * from tb_emp where name like '%张%'
|
||||||
|
and gender = 1
|
||||||
|
and entrydate between '2000-01-01' and '2010-01-01';
|
||||||
|
|
||||||
|
-- 分组查询---聚合函数
|
||||||
|
-- 1. 统计该企业员工数量 -- count
|
||||||
|
-- count(字段)
|
||||||
|
select count(id) from tb_emp;
|
||||||
|
select count(name) from tb_emp;
|
||||||
|
select count(job) from tb_emp; -- 注意:所有的聚合函数是排除null计算的!!!!
|
||||||
|
|
||||||
|
select count(*) from tb_emp;
|
||||||
|
|
||||||
|
select count(0) from tb_emp;-- 统计总数推荐count(0)
|
||||||
|
|
||||||
|
-- 2. 统计该企业最早入职的员工的入职日期
|
||||||
|
select min(entrydate) from tb_emp;
|
||||||
|
|
||||||
|
-- 3. 统计该企业最近入职的员工的入职日期
|
||||||
|
select max(entrydate) from tb_emp;
|
||||||
|
|
||||||
|
-- 4. 统计该企业员工的 ID 之和
|
||||||
|
select sum(id) from tb_emp;
|
||||||
|
|
||||||
|
-- 5. 统计该企业员工 ID 的平均值
|
||||||
|
select avg(id) from tb_emp;
|
||||||
|
|
||||||
|
-- 6. 不用avg如何计算平均值
|
||||||
|
select sum(id)/count(0) from tb_emp;
|
||||||
|
|
||||||
|
-- 分组查询
|
||||||
|
-- 1. 根据性别分组 , 统计男性和女性员工的数量 -- count(*)
|
||||||
|
-- 注意:分组之后能查询的字段只能是分组字段或者聚合函数才有意义
|
||||||
|
select gender, count(1) from tb_emp group by gender;
|
||||||
|
|
||||||
|
-- 2. 先查询入职时间在 '2015-01-01' (包含) 以前的员工 , 并对结果根据职位分组 , 获取员工数量大于等于2的职位 -- count
|
||||||
|
|
||||||
|
select job,count(0) from tb_emp
|
||||||
|
where entrydate <= '2015-01-01'
|
||||||
|
group by job
|
||||||
|
having count(0)>= 2;
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
/mvnw text eol=lf
|
||||||
|
*.cmd text eol=crlf
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<!--父工程是org.springframework.boot-->
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>4.1.1</version>
|
||||||
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
|
</parent>
|
||||||
|
<!--当前项目maven坐标-->
|
||||||
|
<groupId>com.inmind</groupId>
|
||||||
|
<artifactId>springboot-web-quickstart</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<!--springboot相关配置-->
|
||||||
|
<name>springboot-web-quickstart</name>
|
||||||
|
<description>springboot-web-quickstart</description>
|
||||||
|
<url/>
|
||||||
|
<licenses>
|
||||||
|
<license/>
|
||||||
|
</licenses>
|
||||||
|
<developers>
|
||||||
|
<developer/>
|
||||||
|
</developers>
|
||||||
|
<scm>
|
||||||
|
<connection/>
|
||||||
|
<developerConnection/>
|
||||||
|
<tag/>
|
||||||
|
<url/>
|
||||||
|
</scm>
|
||||||
|
<!--pom文件中配置的统一版本配置信息-->
|
||||||
|
<properties>
|
||||||
|
<java.version>17</java.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<!--依赖管理-->
|
||||||
|
<dependencies>
|
||||||
|
<!--springbootweb项目的起步依赖-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-webmvc</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!--springbootweb项目的测试起步依赖-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-webmvc-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<!--springboot-打包插件-->
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
package com.inmind;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
//springboot项目启动项,默认注解
|
||||||
|
@SpringBootApplication
|
||||||
|
public class SpringbootWebQuickstartApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
//springboot启动的固定代码
|
||||||
|
SpringApplication.run(SpringbootWebQuickstartApplication.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.inmind.controller;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
//标记当前类是一个请求处理类
|
||||||
|
@RestController
|
||||||
|
public class HelloController {
|
||||||
|
|
||||||
|
@RequestMapping(value = "/hello")
|
||||||
|
public String hello(){
|
||||||
|
System.out.println("接收了一个请求");
|
||||||
|
return "hello Springboot";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
spring.application.name=springboot-web-quickstart
|
||||||
|
#server.port=8083
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>请求方式演示-GET-POST</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<form action="" method="get">
|
||||||
|
姓 名: <input type="text" name="name"> <br>
|
||||||
|
密 码: <input type="password" name="password"><br>
|
||||||
|
<input type="submit" value="提交表单GET"><br>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<br><br><br>
|
||||||
|
|
||||||
|
<form action="" method="post">
|
||||||
|
姓 名: <input type="text" name="name"> <br>
|
||||||
|
密 码: <input type="password" name="password"><br>
|
||||||
|
<input type="submit" value="提交表单POST"><br>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
package com.inmind;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
class SpringbootWebQuickstartApplicationTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void contextLoads() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
HELP.md
|
||||||
|
target/
|
||||||
|
.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
wrapperVersion=3.3.4
|
||||||
|
distributionType=only-script
|
||||||
|
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.16/apache-maven-3.9.16-bin.zip
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>4.1.1</version>
|
||||||
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
|
</parent>
|
||||||
|
<groupId>com.inmind</groupId>
|
||||||
|
<artifactId>springboot-web-req-resp</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<name>springboot-web-req-resp</name>
|
||||||
|
<description>springboot-web-req-resp</description>
|
||||||
|
<url/>
|
||||||
|
<licenses>
|
||||||
|
<license/>
|
||||||
|
</licenses>
|
||||||
|
<developers>
|
||||||
|
<developer/>
|
||||||
|
</developers>
|
||||||
|
<scm>
|
||||||
|
<connection/>
|
||||||
|
<developerConnection/>
|
||||||
|
<tag/>
|
||||||
|
<url/>
|
||||||
|
</scm>
|
||||||
|
<properties>
|
||||||
|
<java.version>17</java.version>
|
||||||
|
</properties>
|
||||||
|
<!--依赖管理-->
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-webmvc</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-webmvc-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<!--XML解析依赖-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.dom4j</groupId>
|
||||||
|
<artifactId>dom4j</artifactId>
|
||||||
|
<version>2.1.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.inmind;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class SpringbootWebReqRespApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(SpringbootWebReqRespApplication.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.inmind.controller;
|
||||||
|
|
||||||
|
import com.inmind.pojo.Emp;
|
||||||
|
import com.inmind.pojo.Result;
|
||||||
|
import com.inmind.service.EmpService;
|
||||||
|
import com.inmind.service.impl.EmpServiceImplA;
|
||||||
|
import com.inmind.utils.XmlParserUtils;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController//底层带有@Controller,本身是交给IOC容器管理
|
||||||
|
public class EmpController {
|
||||||
|
//设置一个员工业务对象
|
||||||
|
@Autowired//运行时,IOC容器会提供该类型的bean对象,并赋值给该变量----依赖注入
|
||||||
|
@Qualifier("empServiceImplA") //优先级更高,比@Primary,优先级高
|
||||||
|
//@Resource(name = "empServiceImplB")//jdk提供的注解,不用
|
||||||
|
private EmpService empService ;
|
||||||
|
|
||||||
|
@RequestMapping("/listEmp")
|
||||||
|
public Result listEmp(){
|
||||||
|
//1.获取请求数据,交给业务层处理
|
||||||
|
List<Emp> emps = empService.listEmp();
|
||||||
|
//2.响应处理好的数据
|
||||||
|
return Result.success(emps);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
package com.inmind.controller;
|
||||||
|
|
||||||
|
import com.inmind.pojo.User;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
public class RequestController {
|
||||||
|
|
||||||
|
//原始方式接收请求数据
|
||||||
|
/*@RequestMapping( "/simpleParam")
|
||||||
|
public String simpleParam(HttpServletRequest request){
|
||||||
|
//获取请求参数
|
||||||
|
String name = request.getParameter("name");
|
||||||
|
String ageStr = request.getParameter("age");
|
||||||
|
//手动的数据类型转换
|
||||||
|
int age = Integer.parseInt(ageStr);
|
||||||
|
System.out.println("name:"+name+",age:"+age);
|
||||||
|
return "OK";
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
//springboot方式获取请求参数(简单参数)
|
||||||
|
|
||||||
|
@RequestMapping( "/simpleParam")
|
||||||
|
//@RequestParam(name = "name" ) 的作用是从请求对象中获取name属性值,将值赋给username变量
|
||||||
|
public String simpleParam(@RequestParam(name = "name",required = false ) String username, Integer age){
|
||||||
|
System.out.println("name:"+username+",age:"+age);
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
|
||||||
|
//实体参数
|
||||||
|
@RequestMapping( "/simplePojo")
|
||||||
|
public String simplePojo(User user){
|
||||||
|
System.out.println(user);
|
||||||
|
System.out.println("name:"+user.getName()+",age:"+user.getAge());
|
||||||
|
System.out.println("address:"+user.getAddress());
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
|
||||||
|
//数组参数
|
||||||
|
@RequestMapping( "/arrayParam")
|
||||||
|
public String arrayParam(String[] hobby){
|
||||||
|
System.out.println(Arrays.toString(hobby));
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
|
||||||
|
//集合参数
|
||||||
|
@RequestMapping( "/listParam")
|
||||||
|
public String listParam(@RequestParam List<String> hobby){//由于默认采用数组参数直接获取,使用list接收,会报错,需要使用@RequestParam注解
|
||||||
|
System.out.println(hobby);
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
|
||||||
|
//日期参数
|
||||||
|
@RequestMapping( "/dateParam")
|
||||||
|
public String dateParam(@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime updateTime){//由于前端的时间格式的多样性,一般前后端约定固定格式,如yyyy-MM-dd HH:mm:ss,所以这里要用一个注解
|
||||||
|
System.out.println(updateTime);
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
|
||||||
|
//json参数
|
||||||
|
@RequestMapping( "/jsonParam")
|
||||||
|
//@RequestBody: 将请求体中的json数据,映射为java对象
|
||||||
|
public String jsonParam(@RequestBody User user){
|
||||||
|
System.out.println(user);
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
|
||||||
|
//路径参数
|
||||||
|
@RequestMapping( "/path/{id}/{name}")
|
||||||
|
//@PathVariable: 将路径参数映射为方法参数
|
||||||
|
public String pathParam(@PathVariable Integer id,@PathVariable String name){
|
||||||
|
System.out.println("id:"+id);
|
||||||
|
System.out.println("name:"+name);
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.inmind.controller;
|
||||||
|
|
||||||
|
import com.inmind.pojo.Address;
|
||||||
|
import com.inmind.pojo.Result;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
public class ResponseController {
|
||||||
|
|
||||||
|
@RequestMapping("/hello")
|
||||||
|
public Result hello(){
|
||||||
|
System.out.println("hello world");
|
||||||
|
return Result.success("hello world");
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/getAddr")
|
||||||
|
public Result getAddr(){
|
||||||
|
Address address = new Address();
|
||||||
|
address.setCity("常州");
|
||||||
|
address.setProvince("江苏");
|
||||||
|
return Result.success(address);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/listAddr")
|
||||||
|
public Result listAddr(){
|
||||||
|
ArrayList<Address> list = new ArrayList<>();
|
||||||
|
list.add(new Address("江苏", "常州"));
|
||||||
|
list.add(new Address("浙江", "杭州"));
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.inmind.dao;
|
||||||
|
|
||||||
|
import com.inmind.pojo.Emp;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
//定义一个获取员工数据的规范
|
||||||
|
public interface EmpDao {
|
||||||
|
List<Emp> listEmp();
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.inmind.dao.impl;
|
||||||
|
|
||||||
|
import com.inmind.dao.EmpDao;
|
||||||
|
import com.inmind.pojo.Emp;
|
||||||
|
import com.inmind.utils.XmlParserUtils;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Repository//将当前类交给IOC容器管理,让它称为IOC容器中的bean对象---IOC控制反转
|
||||||
|
public class EmpDaoImplA implements EmpDao {
|
||||||
|
@Override
|
||||||
|
public List<Emp> listEmp() {
|
||||||
|
//1.加载并解析emp.xml数据
|
||||||
|
String file = this.getClass().getClassLoader().getResource("emp.xml").getFile();
|
||||||
|
List<Emp> emps = XmlParserUtils.parse(file, Emp.class);
|
||||||
|
return emps;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.inmind.pojo;
|
||||||
|
|
||||||
|
public class Address {
|
||||||
|
private String province;
|
||||||
|
private String city;
|
||||||
|
|
||||||
|
|
||||||
|
public Address() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Address(String province, String city) {
|
||||||
|
this.province = province;
|
||||||
|
this.city = city;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProvince() {
|
||||||
|
return province;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProvince(String province) {
|
||||||
|
this.province = province;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCity() {
|
||||||
|
return city;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCity(String city) {
|
||||||
|
this.city = city;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Address{" +
|
||||||
|
"province='" + province + '\'' +
|
||||||
|
", city='" + city + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package com.inmind.pojo;
|
||||||
|
|
||||||
|
public class Emp {
|
||||||
|
private String name;
|
||||||
|
private Integer age;
|
||||||
|
private String image;
|
||||||
|
private String gender;
|
||||||
|
private String job;
|
||||||
|
|
||||||
|
public Emp() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Emp(String name, Integer age, String image, String gender, String job) {
|
||||||
|
this.name = name;
|
||||||
|
this.age = age;
|
||||||
|
this.image = image;
|
||||||
|
this.gender = gender;
|
||||||
|
this.job = job;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getAge() {
|
||||||
|
return age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAge(Integer age) {
|
||||||
|
this.age = age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImage() {
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImage(String image) {
|
||||||
|
this.image = image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGender() {
|
||||||
|
return gender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGender(String gender) {
|
||||||
|
this.gender = gender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getJob() {
|
||||||
|
return job;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJob(String job) {
|
||||||
|
this.job = job;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Emp{" +
|
||||||
|
"name='" + name + '\'' +
|
||||||
|
", age=" + age +
|
||||||
|
", image='" + image + '\'' +
|
||||||
|
", gender='" + gender + '\'' +
|
||||||
|
", job='" + job + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package com.inmind.pojo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统一响应结果封装类
|
||||||
|
*/
|
||||||
|
public class Result {
|
||||||
|
private Integer code ;//1 成功 , 0 失败
|
||||||
|
private String msg; //提示信息
|
||||||
|
private Object data; //数据 date
|
||||||
|
|
||||||
|
public Result() {
|
||||||
|
}
|
||||||
|
public Result(Integer code, String msg, Object data) {
|
||||||
|
this.code = code;
|
||||||
|
this.msg = msg;
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
public Integer getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
public void setCode(Integer code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
public void setMsg(String msg) {
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
public Object getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
public void setData(Object data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Result success(Object data){
|
||||||
|
return new Result(1, "success", data);
|
||||||
|
}
|
||||||
|
public static Result success(){
|
||||||
|
return new Result(1, "success", null);
|
||||||
|
}
|
||||||
|
public static Result error(String msg){
|
||||||
|
return new Result(0, msg, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Result{" +
|
||||||
|
"code=" + code +
|
||||||
|
", msg='" + msg + '\'' +
|
||||||
|
", data=" + data +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package com.inmind.pojo;
|
||||||
|
|
||||||
|
public class User {
|
||||||
|
private String name;
|
||||||
|
private Integer age;
|
||||||
|
|
||||||
|
private Address address;
|
||||||
|
|
||||||
|
public User() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public User(String name, Integer age) {
|
||||||
|
this.name = name;
|
||||||
|
this.age = age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getAge() {
|
||||||
|
return age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAge(Integer age) {
|
||||||
|
this.age = age;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "User{" +
|
||||||
|
"name='" + name + '\'' +
|
||||||
|
", age=" + age +
|
||||||
|
", address=" + address +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
|
public Address getAddress() {
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddress(Address address) {
|
||||||
|
this.address = address;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.inmind.service;
|
||||||
|
|
||||||
|
import com.inmind.pojo.Emp;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
//业务层操作,对数据进行逻辑处理,返回处理后的数据
|
||||||
|
public interface EmpService {
|
||||||
|
List<Emp> listEmp();
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.inmind.service.impl;
|
||||||
|
|
||||||
|
import com.inmind.dao.EmpDao;
|
||||||
|
import com.inmind.pojo.Emp;
|
||||||
|
import com.inmind.service.EmpService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
@Primary //当DI依赖注入EmpService的变量时,优先使用当前实现类
|
||||||
|
@Service //将当前类交给IOC容器管理,让它称为IOC容器中的bean对象---IOC控制反转
|
||||||
|
public class EmpServiceImplA implements EmpService {
|
||||||
|
//设置一个dao的成员变量
|
||||||
|
@Autowired//运行时,IOC容器会提供该类型的bean对象,并赋值给该变量----依赖注入
|
||||||
|
private EmpDao empDao ;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Emp> listEmp() {
|
||||||
|
//调用dao层的功能,获取员工信息即可
|
||||||
|
List<Emp> emps = empDao.listEmp();
|
||||||
|
|
||||||
|
//逻辑处理
|
||||||
|
//2.对数据进行处理优化(处理性别,处理职位)
|
||||||
|
emps.stream().forEach(emp -> {
|
||||||
|
String gender = emp.getGender();
|
||||||
|
//处理 gender 1:男 2:女
|
||||||
|
if (gender.equals("1")) {
|
||||||
|
emp.setGender("男");
|
||||||
|
} else {
|
||||||
|
emp.setGender("女");
|
||||||
|
}
|
||||||
|
|
||||||
|
//处理job- 1:讲师 2:班主任 3:就业指导
|
||||||
|
String job = emp.getJob();
|
||||||
|
if ("1".equals(job)) {
|
||||||
|
emp.setJob("讲师");
|
||||||
|
} else if ("2".equals(job)) {
|
||||||
|
emp.setJob("班主任");
|
||||||
|
}else if ("3".equals(job)) {
|
||||||
|
emp.setJob("就业指导");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return emps;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.inmind.service.impl;
|
||||||
|
|
||||||
|
import com.inmind.dao.EmpDao;
|
||||||
|
import com.inmind.pojo.Emp;
|
||||||
|
import com.inmind.service.EmpService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service //将当前类交给IOC容器管理,让它称为IOC容器中的bean对象---IOC控制反转
|
||||||
|
public class EmpServiceImplB implements EmpService {
|
||||||
|
//设置一个dao的成员变量
|
||||||
|
@Autowired//运行时,IOC容器会提供该类型的bean对象,并赋值给该变量----依赖注入
|
||||||
|
private EmpDao empDao ;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Emp> listEmp() {
|
||||||
|
//调用dao层的功能,获取员工信息即可
|
||||||
|
List<Emp> emps = empDao.listEmp();
|
||||||
|
|
||||||
|
//逻辑处理
|
||||||
|
//2.对数据进行处理优化(处理性别,处理职位)
|
||||||
|
emps.stream().forEach(emp -> {
|
||||||
|
String gender = emp.getGender();
|
||||||
|
//处理 gender 1:男 2:女
|
||||||
|
if (gender.equals("1")) {
|
||||||
|
emp.setGender("男士");
|
||||||
|
} else {
|
||||||
|
emp.setGender("女士");
|
||||||
|
}
|
||||||
|
|
||||||
|
//处理job- 1:讲师 2:班主任 3:就业指导
|
||||||
|
String job = emp.getJob();
|
||||||
|
if ("1".equals(job)) {
|
||||||
|
emp.setJob("讲师");
|
||||||
|
} else if ("2".equals(job)) {
|
||||||
|
emp.setJob("班主任");
|
||||||
|
}else if ("3".equals(job)) {
|
||||||
|
emp.setJob("就业指导");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return emps;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package com.inmind.utils;
|
||||||
|
|
||||||
|
import org.dom4j.Document;
|
||||||
|
import org.dom4j.Element;
|
||||||
|
import org.dom4j.io.SAXReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.lang.reflect.Constructor;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class XmlParserUtils {
|
||||||
|
|
||||||
|
public static <T> List<T> parse(String file , Class<T> targetClass) {
|
||||||
|
ArrayList<T> list = new ArrayList<T>(); //封装解析出来的数据
|
||||||
|
try {
|
||||||
|
//1.获取一个解析器对象
|
||||||
|
SAXReader saxReader = new SAXReader();
|
||||||
|
//2.利用解析器把xml文件加载到内存中,并返回一个文档对象
|
||||||
|
Document document = saxReader.read(new File(file));
|
||||||
|
//3.获取到根标签
|
||||||
|
Element rootElement = document.getRootElement();
|
||||||
|
//4.通过根标签来获取 user 标签
|
||||||
|
List<Element> elements = rootElement.elements("emp");
|
||||||
|
|
||||||
|
//5.遍历集合,得到每一个 user 标签
|
||||||
|
for (Element element : elements) {
|
||||||
|
//获取 name 属性
|
||||||
|
String name = element.element("name").getText();
|
||||||
|
//获取 age 属性
|
||||||
|
String age = element.element("age").getText();
|
||||||
|
//获取 image 属性
|
||||||
|
String image = element.element("image").getText();
|
||||||
|
//获取 gender 属性
|
||||||
|
String gender = element.element("gender").getText();
|
||||||
|
//获取 job 属性
|
||||||
|
String job = element.element("job").getText();
|
||||||
|
|
||||||
|
//组装数据
|
||||||
|
Constructor<T> constructor = targetClass.getDeclaredConstructor(String.class, Integer.class, String.class, String.class, String.class);
|
||||||
|
constructor.setAccessible(true);
|
||||||
|
T object = constructor.newInstance(name, Integer.parseInt(age), image, gender, job);
|
||||||
|
|
||||||
|
list.add(object);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
spring.application.name=springboot-web-req-resp
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<emps>
|
||||||
|
<emp>
|
||||||
|
<name>金毛狮王111</name>
|
||||||
|
<age>55</age>
|
||||||
|
<image>https://inmind-test.oss-cn-shanghai.aliyuncs.com/01878908-cdaf-4df9-b2b0-e09299da5cc3.jpg</image>
|
||||||
|
<!-- 1: 男, 2: 女 -->
|
||||||
|
<gender>1</gender>
|
||||||
|
<!-- 1: 讲师, 2: 班主任 , 3: 就业指导 -->
|
||||||
|
<job>1</job>
|
||||||
|
</emp>
|
||||||
|
|
||||||
|
<emp>
|
||||||
|
<name>白眉鹰王</name>
|
||||||
|
<age>65</age>
|
||||||
|
<image>https://inmind-test.oss-cn-shanghai.aliyuncs.com/01878908-cdaf-4df9-b2b0-e09299da5cc3.jpg</image>
|
||||||
|
<gender>1</gender>
|
||||||
|
<job>1</job>
|
||||||
|
</emp>
|
||||||
|
|
||||||
|
<emp>
|
||||||
|
<name>青翼蝠王</name>
|
||||||
|
<age>45</age>
|
||||||
|
<image>https://inmind-test.oss-cn-shanghai.aliyuncs.com/01878908-cdaf-4df9-b2b0-e09299da5cc3.jpg</image>
|
||||||
|
<gender>1</gender>
|
||||||
|
<job>2</job>
|
||||||
|
</emp>
|
||||||
|
|
||||||
|
<emp>
|
||||||
|
<name>紫衫龙王</name>
|
||||||
|
<age>38</age>
|
||||||
|
<image>https://inmind-test.oss-cn-shanghai.aliyuncs.com/01878908-cdaf-4df9-b2b0-e09299da5cc3.jpg</image>
|
||||||
|
<gender>2</gender>
|
||||||
|
<job>3</job>
|
||||||
|
</emp>
|
||||||
|
</emps>
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,60 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>员工信息</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="element-ui/index.css">
|
||||||
|
<script src="./js/vue.js"></script>
|
||||||
|
<script src="./element-ui/index.js"></script>
|
||||||
|
<script src="./js/axios-0.18.0.js"></script>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1 align="center">员工信息列表展示</h1>
|
||||||
|
<div id="app">
|
||||||
|
<el-table :data="tableData" style="width: 100%" stripe border >
|
||||||
|
<el-table-column prop="name" label="姓名" align="center" min-width="20%"></el-table-column>
|
||||||
|
<el-table-column prop="age" label="年龄" align="center" min-width="20%"></el-table-column>
|
||||||
|
<el-table-column label="图像" align="center" min-width="20%">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-image :src="scope.row.image" style="width: 80px; height: 50px;"></el-image>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="gender" label="性别" align="center" min-width="20%"></el-table-column>
|
||||||
|
<el-table-column prop="job" label="职位" align="center" min-width="20%"></el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.el-table .warning-row {
|
||||||
|
background: oldlace;
|
||||||
|
}
|
||||||
|
.el-table .success-row {
|
||||||
|
background: #f0f9eb;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
new Vue({
|
||||||
|
el: "#app",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
tableData: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted(){
|
||||||
|
axios.get('/listEmp').then(res=>{
|
||||||
|
if(res.data.code){
|
||||||
|
this.tableData = res.data.data;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</html>
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
+13
@@ -0,0 +1,13 @@
|
|||||||
|
package com.inmind;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
class SpringbootWebReqRespApplicationTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void contextLoads() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user