master
commit
9387efe2cf
|
@ -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,138 @@
|
|||
<?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>
|
||||
<groupId>com.bwie</groupId>
|
||||
<artifactId>day10exam</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>day10exam</name>
|
||||
<description>day10exam</description>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<spring-boot.version>2.6.13</spring-boot.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<!--activiti 工作流依赖-->
|
||||
<dependency>
|
||||
<groupId>org.activiti</groupId>
|
||||
<artifactId>activiti-spring-boot-starter</artifactId>
|
||||
<version>7.0.0.Beta2</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>javax.el</groupId>
|
||||
<artifactId>el-api</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>de.odysseus.juel</groupId>
|
||||
<artifactId>juel-api</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>de.odysseus.juel</groupId>
|
||||
<artifactId>juel-spi</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- 添加servlet依赖模块 -->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- 添加jstl标签库依赖模块 -->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>jstl</artifactId>
|
||||
</dependency>
|
||||
<!--添加tomcat依赖模块.-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- 使用jsp引擎,springboot内置tomcat没有此依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-jasper</artifactId>
|
||||
</dependency>
|
||||
<!-- 热部署依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<scope>runtime</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!-- mysql数据库依赖 -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.29</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- lombok小辣椒依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- 测试类依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.junit.vintage</groupId>
|
||||
<artifactId>junit-vintage-engine</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<configuration>
|
||||
<mainClass>com.bwie.day10exam.Day10examApplication</mainClass>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>repackage</id>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
Navicat Premium Data Transfer
|
||||
|
||||
Source Server : 2111
|
||||
Source Server Type : MySQL
|
||||
Source Server Version : 50557
|
||||
Source Host : localhost:3306
|
||||
Source Schema : 7.29exam
|
||||
|
||||
Target Server Type : MySQL
|
||||
Target Server Version : 50557
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 29/07/2024 09:09:49
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for t_user
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `t_user`;
|
||||
CREATE TABLE `t_user` (
|
||||
`uid` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
`pwd` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
`age` int(11) NULL DEFAULT NULL,
|
||||
`brithday` date NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`uid`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of t_user
|
||||
-- ----------------------------
|
||||
INSERT INTO `t_user` VALUES (1, '张三', '123', 19, '2005-01-01');
|
||||
INSERT INTO `t_user` VALUES (2, '李四', '234', 20, '2004-06-09');
|
||||
INSERT INTO `t_user` VALUES (3, '王五', '345', 19, '2005-11-10');
|
||||
INSERT INTO `t_user` VALUES (4, '赵六', '456', 20, '2004-05-10');
|
||||
INSERT INTO `t_user` VALUES (5, 'root', '567', 21, '2003-01-09');
|
||||
INSERT INTO `t_user` VALUES (6, 'lisa', '678', 22, '2002-06-10');
|
||||
INSERT INTO `t_user` VALUES (7, 'jack', '789', 19, '2005-09-19');
|
||||
INSERT INTO `t_user` VALUES (8, 'tom', '890', 18, '2006-09-10');
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
|
@ -0,0 +1,15 @@
|
|||
package com.bwie.day10exam;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.web.bind.annotation.Mapping;
|
||||
|
||||
|
||||
@SpringBootApplication
|
||||
public class Day10examApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Day10examApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.bwie.day10exam.controller;
|
||||
|
||||
import com.bwie.day10exam.pojo.User;
|
||||
import com.bwie.day10exam.serveice.UserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:LiDongJia
|
||||
* @Package:com.bwie.day10exam.controller
|
||||
* @Project:day10exam
|
||||
* @name:UserController
|
||||
* @Date:2024/7/29 上午8:52
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("user")
|
||||
public class UserController {
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@GetMapping("findAll")
|
||||
public List<User> findAll(){
|
||||
List<User> list = userService.findAll();
|
||||
return list;
|
||||
}
|
||||
|
||||
@PostMapping("delete")
|
||||
public int delete(@RequestParam Integer uid){
|
||||
int res = userService.delete(uid);
|
||||
return res;
|
||||
}
|
||||
|
||||
@GetMapping("sortList")
|
||||
public List<User> sortList(){
|
||||
List<User> list = userService.sortList();
|
||||
return list;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.bwie.day10exam.mapper;
|
||||
|
||||
import com.bwie.day10exam.pojo.User;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:LiDongJia
|
||||
* @Package:com.bwie.day10exam.mapper
|
||||
* @Project:day10exam
|
||||
* @name:UserMapper
|
||||
* @Date:2024/7/29 上午8:54
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserMapper {
|
||||
List<User> findAll();
|
||||
|
||||
int delete(@Param("uid") Integer uid);
|
||||
|
||||
List<User> sortList();
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.bwie.day10exam.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author:LiDongJia
|
||||
* @Package:com.bwie.day10exam.pojo
|
||||
* @Project:day10exam
|
||||
* @name:User
|
||||
* @Date:2024/7/29 上午8:50
|
||||
*/
|
||||
@Data
|
||||
public class User {
|
||||
private Integer uid;
|
||||
private String username;
|
||||
private String pwd;
|
||||
private Integer age;
|
||||
private Date brithday;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.bwie.day10exam.serveice;
|
||||
|
||||
import com.bwie.day10exam.pojo.User;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:LiDongJia
|
||||
* @Package:com.bwie.day10exam.serveice
|
||||
* @Project:day10exam
|
||||
* @name:UserService
|
||||
* @Date:2024/7/29 上午8:54
|
||||
*/
|
||||
public interface UserService {
|
||||
List<User> findAll();
|
||||
|
||||
int delete(Integer uid);
|
||||
|
||||
List<User> sortList();
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.bwie.day10exam.serveice.impl;
|
||||
|
||||
import com.bwie.day10exam.mapper.UserMapper;
|
||||
import com.bwie.day10exam.pojo.User;
|
||||
import com.bwie.day10exam.serveice.UserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:LiDongJia
|
||||
* @Package:com.bwie.day10exam.serveice.impl
|
||||
* @Project:day10exam
|
||||
* @name:UserServiceImpl
|
||||
* @Date:2024/7/29 上午8:54
|
||||
*/
|
||||
@Service
|
||||
public class UserServiceImpl implements UserService {
|
||||
|
||||
@Autowired
|
||||
private UserMapper userMapper;
|
||||
|
||||
@Override
|
||||
public List<User> findAll() {
|
||||
return userMapper.findAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Integer uid) {
|
||||
return userMapper.delete(uid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<User> sortList() {
|
||||
return userMapper.sortList();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
# 应用名称
|
||||
spring.application.name=boot-ssm02
|
||||
|
||||
# 应用服务 WEB 访问端口
|
||||
server.port=8080
|
||||
|
||||
|
||||
|
||||
#下面这些内容是为了让MyBatis映射
|
||||
#指定Mybatis的Mapper文件
|
||||
mybatis.mapper-locations=classpath:mapper/*xml
|
||||
#指定Mybatis的实体目录 entity bean dto pojo vo
|
||||
mybatis.type-aliases-package=com.bwie.day10exam.pojo
|
||||
# 驼峰配置
|
||||
mybatis.configuration.map-underscore-to-camel-case=true
|
||||
|
||||
# 日志
|
||||
logging.level.com.bwie.dao = debug
|
||||
|
||||
# 数据库驱动:
|
||||
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
||||
# 数据源名称
|
||||
spring.datasource.name=defaultDataSource
|
||||
# 数据库连接地址
|
||||
spring.datasource.url=jdbc:mysql://localhost:3306/7.29exam?useUnicode=true&characterEncoding=utf8&allowMultiQueries=true
|
||||
# 数据库用户名&密码:
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=root
|
||||
|
||||
# 视图解析器
|
||||
spring.mvc.view.prefix=/WEB-INF/view/
|
||||
spring.mvc.view.suffix=.jsp
|
||||
|
||||
# pageHelper插件
|
||||
# 分页合理化
|
||||
pagehelper.reasonable=true
|
||||
# 分页自动转换方言。。。不同的数据库 分页的语句是不同的 mysql--limit oracle--rownum
|
||||
pagehelper.auto-dialect=true
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bwie.day10exam.mapper.UserMapper">
|
||||
<delete id="delete">
|
||||
delete
|
||||
from t_user
|
||||
where uid=#{uid};
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="findAll" resultType="com.bwie.day10exam.pojo.User">
|
||||
select *
|
||||
from t_user;
|
||||
</select>
|
||||
|
||||
<select id="sortList" resultType="com.bwie.day10exam.pojo.User">
|
||||
select *
|
||||
from t_user order by age desc limit 12
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,13 @@
|
|||
package com.bwie.day10exam;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class Day10examApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 293 KiB |
Loading…
Reference in New Issue