1初始化
commit
461916eaa5
|
@ -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,144 @@
|
|||
<?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.muyu</groupId>
|
||||
<artifactId>h6-exam729</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>h6-exam729</name>
|
||||
<description>Demo project for Spring Boot</description>
|
||||
<properties>
|
||||
<java.version>17</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>
|
||||
|
||||
<!-- 邮箱依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-mail</artifactId>
|
||||
</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>
|
||||
<!-- sqring框架依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>2.1.4</version>
|
||||
</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.32</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>2.3.7.RELEASE</version>
|
||||
<configuration>
|
||||
<mainClass>com.bwie.BootStudentApplication</mainClass>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>repackage</id>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
|
||||
|
||||
</project>
|
|
@ -0,0 +1,20 @@
|
|||
package com.muyu.h6exam729;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author xie ya ru
|
||||
* @Date 2024/7/29 9:00
|
||||
* @注释
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@MapperScan("com.muyu.h6exam729.mapper")
|
||||
public class UserApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(UserApplication.class,args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.muyu.h6exam729.controller;
|
||||
|
||||
import com.muyu.h6exam729.pojo.User;
|
||||
import com.muyu.h6exam729.service.UserService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author xie ya ru
|
||||
* @Date 2024/7/29 9:16
|
||||
* @注释
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user")
|
||||
public class UserController {
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@GetMapping("/showAll")
|
||||
public List<User> showAll(){
|
||||
return userService.showAll();
|
||||
}
|
||||
|
||||
@DeleteMapping("/delById/{uid}")
|
||||
public void delById(@PathVariable("uid") Integer uid){
|
||||
userService.delById(uid);
|
||||
}
|
||||
@GetMapping("/orderBySex")
|
||||
public List<User> orderBySex(){
|
||||
return userService.orderBySex();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.muyu.h6exam729.mapper;
|
||||
|
||||
import com.muyu.h6exam729.pojo.User;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author xie ya ru
|
||||
* @Date 2024/7/29 9:03
|
||||
* @注释
|
||||
*/
|
||||
|
||||
public interface UserMapper {
|
||||
List<User> showAll();
|
||||
|
||||
void delById(@Param("uid") Integer uid);
|
||||
|
||||
List<User> orderBySex();
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.muyu.h6exam729.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author xie ya ru
|
||||
* @Date 2024/7/29 9:02
|
||||
* @注释
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class User {
|
||||
private Integer uid;
|
||||
private String userName;
|
||||
private String pwd;
|
||||
private Integer sex;
|
||||
private Date birthday;
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.muyu.h6exam729.service;
|
||||
|
||||
import com.muyu.h6exam729.pojo.User;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author xie ya ru
|
||||
* @Date 2024/7/29 9:15
|
||||
* @注释
|
||||
*/
|
||||
public interface UserService {
|
||||
List<User> showAll();
|
||||
|
||||
void delById(@Param("uid") Integer uid);
|
||||
|
||||
List<User> orderBySex();
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.muyu.h6exam729.service.impl;
|
||||
|
||||
import com.muyu.h6exam729.mapper.UserMapper;
|
||||
import com.muyu.h6exam729.pojo.User;
|
||||
import com.muyu.h6exam729.service.UserService;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author xie ya ru
|
||||
* @Date 2024/7/29 9:15
|
||||
* @注释
|
||||
*/
|
||||
@Service
|
||||
public class UserServiceImpl implements UserService {
|
||||
@Resource
|
||||
private UserMapper userMapper;
|
||||
@Override
|
||||
public List<User> showAll() {
|
||||
return userMapper.showAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delById(Integer uid) {
|
||||
userMapper.delById(uid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<User> orderBySex() {
|
||||
return userMapper.orderBySex();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,136 @@
|
|||
|
||||
|
||||
|
||||
# 应用名称
|
||||
spring.application.name=boot-ssm02
|
||||
|
||||
# 应用服务 WEB 访问端口
|
||||
server.port=8080
|
||||
|
||||
|
||||
|
||||
#下面这些内容是为了让MyBatis映射
|
||||
#指定Mybatis的Mapper文件
|
||||
mybatis.mapper-locations=classpath:mappers/*xml
|
||||
#指定Mybatis的实体目录 entity bean dto pojo vo
|
||||
mybatis.type-aliases-package=com.bwie.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:3308/h6-exam729?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
|
||||
|
||||
|
||||
|
||||
# 腾讯邮箱服务器的主机地址/域名
|
||||
spring.mail.host=smtp.qq.com
|
||||
# 服务器的端口号
|
||||
spring.mail.port=587
|
||||
# 用户名
|
||||
spring.mail.username=1842452729@qq.com
|
||||
# 授权码
|
||||
spring.mail.password=yghevkfpxzzychgf
|
||||
|
||||
# 编码
|
||||
spring.mail.defaultencoding=UTF8
|
||||
# 加密传输
|
||||
spring.mail.properties.mail.smtp.socketFactoryClass=javax.net.ssl.SSLSocketFactory
|
||||
# 在控制台打印邮件发送过程 便于观察邮件发送
|
||||
spring.mail.properties.mail.debug=true
|
||||
|
||||
|
||||
# pageHelper插件
|
||||
# 分页合理化
|
||||
pagehelper.reasonable=true
|
||||
# 分页自动转换方言。。。不同的数据库 分页的语句是不同的 mysql--limit oracle--rownum
|
||||
pagehelper.auto-dialect=true
|
||||
|
||||
# activeMq必须的配置
|
||||
spring.activemq.user=admin
|
||||
spring.activemq.password=admin
|
||||
# 是否使用内置的mq 并把消息保存在内存中
|
||||
spring.activemq.in-memory=false
|
||||
# 通信端口 :61616 服务端口:8161
|
||||
spring.activemq.broker-url=tcp://127.0.0.1:61616
|
||||
# 是否信任当前项目下所有的包 (为了使用实体类进行消息的传输)
|
||||
spring.activemq.packages.trust-all=true
|
||||
#开启mq持久化模式
|
||||
spring.jms.template.delivery-mode=persistent
|
||||
|
||||
# 缓存配置
|
||||
spring.cache.ehcache.config=classpath:ehcache.xml
|
||||
spring.cache.type=ehcache
|
||||
|
||||
#检测历史表是否存在 activiti7默认没有开启数据库历史记录 启动数据库历史记录
|
||||
spring.activiti.db-history-used=true
|
||||
#1.flase: 默认值。activiti在启动时,会对比数据库表中保存的版本,如果没有表或者版本不匹配,将抛出异常
|
||||
#2.true: activiti会对数据库中所有表进行更新操作。如果表不存在,则自动创建
|
||||
#3.create_drop: 在activiti启动时创建表,在关闭时删除表(必须手动关闭引擎,才能删除表)
|
||||
#4.drop-create: 在activiti启动时删除原来的旧表,然后在创建新表(不需要手动关闭引擎)
|
||||
spring.activiti.database-schema-update=true
|
||||
#记录历史等级 可配置的历史级别有none, activity, audit, full
|
||||
spring.activiti.history-level=full
|
||||
#校验流程文件,默认校验resources下的processes文件夹里的流程文件
|
||||
spring.activiti.check-process-definitions=true
|
||||
|
||||
|
||||
|
||||
|
||||
#### xxl-job admin address list, such as "http://address" or "http://address01,http://address02"
|
||||
#xxl.job.admin.addresses=http://127.0.0.1:8081/xxl-job-admin
|
||||
#
|
||||
#### xxl-job, access token
|
||||
#xxl.job.accessToken=dingsaitong
|
||||
#
|
||||
#### xxl-job executor appname
|
||||
#xxl.job.executor.appname=dst-job-executor-sample
|
||||
#### xxl-job executor registry-address: default use address to registry , otherwise use ip:port if address is null
|
||||
#xxl.job.executor.address=
|
||||
#### xxl-job executor server-info
|
||||
#xxl.job.executor.ip=
|
||||
#xxl.job.executor.port=9991
|
||||
#### xxl-job executor log-path
|
||||
#xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler
|
||||
#### xxl-job executor log-retention-days
|
||||
#xxl.job.executor.logretentiondays=30
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### 调度中心部署跟地址 [选填]:如调度中心集群部署存在多个地址则用逗号分隔。执行器将会使用该地址进行"执行器心跳注册"和"任务结果回调";为空则关闭自动注册;
|
||||
xxl.job.admin.addresses=http://127.0.0.1:8080/xxl-job-admin
|
||||
### 执行器通讯TOKEN [选填]:非空时启用;
|
||||
xxl.job.accessToken=default_token
|
||||
### 执行器AppName [选填]:执行器心跳注册分组依据;为空则关闭自动注册
|
||||
xxl.job.executor.appname=xxl-sample
|
||||
### 执行器注册 [选填]:优先使用该配置作为注册地址,为空时使用内嵌服务 ”IP:PORT“ 作为注册地址。从而更灵活的支持容器类型执行器动态IP和动态映射端口问题。
|
||||
xxl.job.executor.address=
|
||||
### 执行器IP [选填]:默认为空表示自动获取IP,多网卡时可手动设置指定IP,该IP不会绑定Host仅作为通讯实用;地址信息用于 "执行器注册" 和 "调度中心请求并触发任务";
|
||||
xxl.job.executor.ip=
|
||||
### 执行器端口号 [选填]:小于等于0则自动获取;默认端口为9999,单机部署多个执行器时,注意要配置不同执行器端口;
|
||||
xxl.job.executor.port=9998
|
||||
### 执行器运行日志文件存储磁盘路径 [选填] :需要对该路径拥有读写权限;为空则使用默认路径;
|
||||
xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler
|
||||
### 执行器日志文件保存天数 [选填] :过期日志自动清理, 限制值大于等于3时生效; 否则, 如-1, 关闭自动清理功能;
|
||||
xxl.job.executor.logretentiondays=30
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?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.muyu.h6exam729.mapper.UserMapper">
|
||||
<delete id="delById">
|
||||
delete from t_user where uid =#{uid}
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="showAll" resultType="com.muyu.h6exam729.pojo.User">
|
||||
select * from t_user
|
||||
</select>
|
||||
<select id="orderBySex" resultType="com.muyu.h6exam729.pojo.User">
|
||||
select * from t_user order by sex desc limit 1,11
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,7 @@
|
|||
<!DOCTYPE web-app PUBLIC
|
||||
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
|
||||
"http://java.sun.com/dtd/web-app_2_3.dtd" >
|
||||
|
||||
<web-app>
|
||||
<display-name>Archetype Created Web Application</display-name>
|
||||
</web-app>
|
|
@ -0,0 +1,5 @@
|
|||
<html>
|
||||
<body>
|
||||
<h2>Hello World!</h2>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,13 @@
|
|||
package com.muyu.h6exam729;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class H6Exam729ApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue