全量上传
3
.gitignore
vendored
@ -24,3 +24,6 @@
|
||||
hs_err_pid*
|
||||
replay_pid*
|
||||
|
||||
node_modules
|
||||
.idea
|
||||
target
|
||||
|
25
bigdata/hive.sql
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
CREATE DATABASE library;
|
||||
USE library;
|
||||
|
||||
-- 借书趋势
|
||||
CREATE TABLE ods_order_count AS
|
||||
SELECT
|
||||
DATE_FORMAT(time, '%Y-%m') AS month,
|
||||
COUNT(*) AS orders
|
||||
FROM orders
|
||||
GROUP BY month
|
||||
ORDER BY month;
|
||||
-- 用户画像-不同用户借书数量
|
||||
CREATE table ods_user_type as
|
||||
SELECT
|
||||
u.email AS name,
|
||||
COUNT(*) AS value
|
||||
FROM
|
||||
orders o
|
||||
JOIN
|
||||
user u ON o.user_id = u.id
|
||||
GROUP BY
|
||||
u.email
|
||||
ORDER BY
|
||||
value DESC;
|
6
bigdata/mysql.sql
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
create table ods_order_count(
|
||||
name varchar(50),
|
||||
value int(10)
|
||||
);
|
11
bigdata/sqoop.sh
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
|
||||
sqoop import-all-tables \
|
||||
--connect jdbc:mysql://localhost:3306/library-recommendation \
|
||||
--username root \
|
||||
--password 123456 \
|
||||
--hive-import \
|
||||
--hive-overwrite \
|
||||
--create-hive-table \
|
||||
--hive-database library \
|
||||
--num-mappers 1
|
581
db/block_book.sql
Normal file
BIN
files/1721114905635-柴犬.jpeg
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
files/1728524460034-book3.jpg
Normal file
After Width: | Height: | Size: 402 KiB |
BIN
files/1728526121300-book4.jpg
Normal file
After Width: | Height: | Size: 352 KiB |
BIN
files/1728526130554-book3.jpg
Normal file
After Width: | Height: | Size: 402 KiB |
BIN
files/1728526136963-boo2.jpg
Normal file
After Width: | Height: | Size: 152 KiB |
BIN
files/1728526146495-book1.jpg
Normal file
After Width: | Height: | Size: 282 KiB |
BIN
files/1728526170731-book7.jpg
Normal file
After Width: | Height: | Size: 180 KiB |
BIN
files/1728526177883-book5.jpg
Normal file
After Width: | Height: | Size: 351 KiB |
BIN
files/1728526183155-book6.jpg
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
files/1728529505517-a1.jpg
Normal file
After Width: | Height: | Size: 85 KiB |
BIN
files/1728530431479-a1.jpg
Normal file
After Width: | Height: | Size: 85 KiB |
BIN
files/1728530722844-a1.jpg
Normal file
After Width: | Height: | Size: 85 KiB |
BIN
files/1728530731353-a2.jpg
Normal file
After Width: | Height: | Size: 585 KiB |
BIN
files/1728530739327-a3.jpg
Normal file
After Width: | Height: | Size: 75 KiB |
BIN
files/1728530746021-a4.jpg
Normal file
After Width: | Height: | Size: 76 KiB |
BIN
files/1728530753715-a5.png
Normal file
After Width: | Height: | Size: 238 KiB |
BIN
files/1728530760951-a6.jpg
Normal file
After Width: | Height: | Size: 67 KiB |
BIN
files/1728530767435-a7.jpg
Normal file
After Width: | Height: | Size: 53 KiB |
BIN
files/1728530775084-a8.jpg
Normal file
After Width: | Height: | Size: 47 KiB |
BIN
files/1728531919687-y1.png
Normal file
After Width: | Height: | Size: 373 KiB |
BIN
files/1728532017266-y1.png
Normal file
After Width: | Height: | Size: 373 KiB |
BIN
files/1728532021903-y2.png
Normal file
After Width: | Height: | Size: 408 KiB |
BIN
files/1728532027128-y3.png
Normal file
After Width: | Height: | Size: 273 KiB |
BIN
files/1728532032911-y4.png
Normal file
After Width: | Height: | Size: 286 KiB |
BIN
files/1728532038023-y5.png
Normal file
After Width: | Height: | Size: 272 KiB |
BIN
files/1728532043396-y6.png
Normal file
After Width: | Height: | Size: 305 KiB |
BIN
files/1728548887103-微信截图_20231213153827.png
Normal file
After Width: | Height: | Size: 113 KiB |
BIN
files/1728548946095-微信截图_20240409161250.png
Normal file
After Width: | Height: | Size: 63 KiB |
BIN
files/1728549063819-微信截图_20231114162404.png
Normal file
After Width: | Height: | Size: 224 KiB |
BIN
files/1728549132862-微信截图_20240409161053.png
Normal file
After Width: | Height: | Size: 135 KiB |
34
files/1728614001968-项目训练营介绍.md
Normal file
@ -0,0 +1,34 @@
|
||||
## 做《项目训练营》星球的目的
|
||||
1. 目前很多小伙伴,特别是在校学生,缺少实战项目经验
|
||||
2. 有些小伙伴有点基础,想要通过项目实操提高自己的开发能力
|
||||
3. 网上找不到高质量的完整项目带敲教程,拿到源码也不懂原理,有些源码还没法运行,甚至代码不全
|
||||
4. 网上能找到的开源项目都比较大,很多小白用户一下子吃不了,甚至不会运行
|
||||
5. 星球是一个高质量的私域知识学习平台,能为大家的学习保驾护航
|
||||
6. 大部分初学者在自己学习的时候,遇到问题没法解决,星球内部所有项目都可以提供项目答疑
|
||||
## 星球提供的价值
|
||||
|
||||
1. 星球内部分项目完整源码直接开放,可免费获取。其他项目可挑选**一个**最适合你的项目,直接领取源码。
|
||||
2. **(价值)**星球内部的所有实战项目均提供脚手架、详细的笔记和完整的带敲视频,可以跟着完整学习视频敲出来,学习过程中提供答疑。
|
||||
3. **星球内部的实战项目会一直更新,星球成员可以学习所有项目,具体项目列表如下(长期更新)**:[https://www.yuque.com/xiaqing-en2ii/skflxg/cayqu7tvpxrwt9tf](https://www.yuque.com/xiaqing-en2ii/skflxg/cayqu7tvpxrwt9tf)
|
||||
4. 星球内部会提供不同的专栏,其中除了上述实战项目外,还有学习资料,比如经典学习笔记、超全面试题等
|
||||
5. 星球内部会不定期分享学习经验,开发经验,工作经验,如果你有需要,也可以提供相应文档
|
||||
6. 通过星球内部的学习,对很多初学者找实习找工作也有很大帮助。
|
||||
## 我进入星球能得到什么?
|
||||
|
||||
1. 完整的实战项目,从0到1手把手带你敲出来,完全学会,变成自己的项目
|
||||
2. 学会常用主流技术栈的使用,比如springboot、mybatis、vue、MySQL、uniapp等等
|
||||
3. 学会前后端的开发流程、数据库的设计、前后端接口调用方式,达到独立开发项目的能力
|
||||
4. 在学习的过程中,可以获得星主或者合伙人的一对一答疑,为你的学习保驾护航
|
||||
5. 从小白成长为能独挡一面的六边形战士,不管是大学竞赛、毕业设计、做公司项目还是接私活,都游刃有余
|
||||
## 星球的玩法
|
||||
|
||||
1. 星球目前定价99,历史最低价(后续不定期会派送优惠券),**价值拉满,历史最低,仅此一次!**
|
||||
2. 星球随着内部项目的增加,后面会涨价,现在加入能学习一年内所有开发的项目(至少30+个)。99相当于每天3毛钱不到,**早就是优势!**
|
||||
3. 星球不定期搞点小福利,比如送咖啡、喝奶茶打卡学习活动,共同营造一个良好的学习圈
|
||||
|
||||
**微信扫码即可加入,或者网页端点击 **[**https://t.zsxq.com/13XD9LgLl**](https://t.zsxq.com/13XD9LgLl)** 加入**
|
||||

|
||||
## 星球专属编程小助手
|
||||
如果您在购买过程中有任何疑惑,可以咨询我们的客服小助手(仅限非技术问题)
|
||||
服务时间:工作日上午9:00 - 12:00 下午14:00 - 18:00
|
||||

|
BIN
files/1728614011731-2.png
Normal file
After Width: | Height: | Size: 104 KiB |
BIN
files/1728697558653-活着.jpg
Normal file
After Width: | Height: | Size: 138 KiB |
BIN
files/1729051011438-微信截图_20231018172452.png
Normal file
After Width: | Height: | Size: 354 KiB |
BIN
files/1729051066167-微信截图_20231018172452.png
Normal file
After Width: | Height: | Size: 354 KiB |
BIN
files/1729051213993-微信截图_20231018172452.png
Normal file
After Width: | Height: | Size: 354 KiB |
BIN
files/1729051222075-微信截图_20231018172452.png
Normal file
After Width: | Height: | Size: 354 KiB |
BIN
files/1729051340662-微信截图_20231114162516.png
Normal file
After Width: | Height: | Size: 146 KiB |
BIN
files/1729051355957-微信截图_20231114162516.png
Normal file
After Width: | Height: | Size: 146 KiB |
BIN
files/1729051387136-微信截图_20231213153827.png
Normal file
After Width: | Height: | Size: 113 KiB |
BIN
files/1729051404132-微信截图_20231213153827.png
Normal file
After Width: | Height: | Size: 113 KiB |
BIN
files/1740404032345-6525592598d57.png
Normal file
After Width: | Height: | Size: 51 KiB |
82
pom.xml
Normal file
@ -0,0 +1,82 @@
|
||||
<?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>3.3.1</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>admin-api</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>springboot</name>
|
||||
<description>springboot</description>
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.24</version>
|
||||
</dependency>
|
||||
<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>3.0.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.25</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 分页插件pagehelper -->
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>1.4.6</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- JWT -->
|
||||
<dependency>
|
||||
<groupId>com.auth0</groupId>
|
||||
<artifactId>java-jwt</artifactId>
|
||||
<version>4.3.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
16
src/main/java/com/example/SpringbootApplication.java
Normal file
@ -0,0 +1,16 @@
|
||||
package com.example;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@SpringBootApplication
|
||||
@MapperScan("com.example.mapper")
|
||||
@EnableScheduling
|
||||
public class SpringbootApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SpringbootApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
7
src/main/java/com/example/common/Constants.java
Normal file
@ -0,0 +1,7 @@
|
||||
package com.example.common;
|
||||
|
||||
public interface Constants {
|
||||
|
||||
String TOKEN = "token";
|
||||
String USER_DEFAULT_PASSWORD = "123";
|
||||
}
|
86
src/main/java/com/example/common/MyScheduledTask.java
Normal file
@ -0,0 +1,86 @@
|
||||
package com.example.common;
|
||||
|
||||
import com.example.entity.Orders;
|
||||
import com.example.mapper.OrdersMapper;
|
||||
import com.example.service.OrdersService;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.HexFormat;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* 1.在主方法加@EnableScheduling
|
||||
*/
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class MyScheduledTask {
|
||||
@Autowired
|
||||
OrdersMapper ordersService;
|
||||
|
||||
// 每5秒执行一次
|
||||
@Scheduled(fixedRate = 5000)
|
||||
public void runEveryFiveSeconds() {
|
||||
System.out.println("⏰ 定时任务执行时间: " + java.time.LocalDateTime.now());
|
||||
//需要检测的hex字段
|
||||
List<Orders> list = ordersService.selectAll(null);
|
||||
for (Orders itemEntity : list) {
|
||||
if (!isValidEthereumHexId(itemEntity.getHex(),64)){
|
||||
itemEntity.setHex(sendSetRequest(itemEntity.getId().toString(),itemEntity.toString()));
|
||||
//更新数据
|
||||
ordersService.updateByHexId(itemEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
public static String sendSetRequest(String key, String value) {
|
||||
try {
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
String url = "http://localhost:8080/set?key=" + key + "&value=" + value;
|
||||
// 发送 GET 请求并解析返回 JSON 为 SetResponse 对象
|
||||
ResponseEntity<SetResponse> response = restTemplate.getForEntity(url, SetResponse.class);
|
||||
return response.getBody().data;
|
||||
}catch (Exception e){
|
||||
SetResponse setRequestService = new SetResponse();
|
||||
setRequestService.setData(generate(40));
|
||||
return setRequestService.data;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 判断是否为合法的以太坊Hex ID(例如:交易哈希、区块哈希、地址)
|
||||
* @param hexId 要校验的字符串
|
||||
* @param length 字符长度(40 = 钱包地址,64 = 交易哈希/区块哈希)
|
||||
* @return true 表示合法,否则 false
|
||||
*/
|
||||
public static boolean isValidEthereumHexId(String hexId, int length) {
|
||||
if (hexId == null || !hexId.startsWith("0x")) {
|
||||
return false;
|
||||
}
|
||||
String hexBody = hexId.substring(2);
|
||||
String pattern = "^[0-9a-fA-F]{" + length + "}$";
|
||||
return hexBody.matches(pattern);
|
||||
}
|
||||
|
||||
|
||||
// 内嵌的SetResponse类
|
||||
@Data
|
||||
public static class SetResponse {
|
||||
private String msg;
|
||||
private String data;
|
||||
}
|
||||
|
||||
private static final SecureRandom secureRandom = new SecureRandom();
|
||||
private static final HexFormat hexFormat = HexFormat.of();
|
||||
|
||||
public static String generate(int byteLength) {
|
||||
byte[] randomBytes = new byte[byteLength];
|
||||
secureRandom.nextBytes(randomBytes);
|
||||
return "0x" + hexFormat.formatHex(randomBytes);
|
||||
}
|
||||
}
|
70
src/main/java/com/example/common/Result.java
Normal file
@ -0,0 +1,70 @@
|
||||
package com.example.common;
|
||||
|
||||
public class Result {
|
||||
|
||||
private String code;
|
||||
private String msg;
|
||||
private Object data;
|
||||
|
||||
public Result() {
|
||||
|
||||
}
|
||||
|
||||
public static Result success() {
|
||||
Result result = new Result();
|
||||
result.setCode("200");
|
||||
result.setMsg("请求成功");
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Result success(Object data) {
|
||||
Result result = success();
|
||||
result.setData(data);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Result error() {
|
||||
Result result = new Result();
|
||||
result.setCode("500");
|
||||
result.setMsg("系统异常");
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Result error(String code, String msg) {
|
||||
Result result = new Result();
|
||||
result.setCode(code);
|
||||
result.setMsg(msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Result error(String msg) {
|
||||
Result result = new Result();
|
||||
result.setCode("500");
|
||||
result.setMsg(msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String 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;
|
||||
}
|
||||
}
|
25
src/main/java/com/example/common/config/CorsConfig.java
Normal file
@ -0,0 +1,25 @@
|
||||
package com.example.common.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
|
||||
/**
|
||||
* 跨域配置
|
||||
*/
|
||||
@Configuration
|
||||
public class CorsConfig {
|
||||
|
||||
@Bean
|
||||
public CorsFilter corsFilter() {
|
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||
CorsConfiguration corsConfiguration = new CorsConfiguration();
|
||||
corsConfiguration.addAllowedOrigin("*"); // 1 设置访问源地址
|
||||
corsConfiguration.addAllowedHeader("*"); // 2 设置访问源请求头
|
||||
corsConfiguration.addAllowedMethod("*"); // 3 设置访问源请求方法
|
||||
source.registerCorsConfiguration("/**", corsConfiguration); // 4 对接口配置跨域设置
|
||||
return new CorsFilter(source);
|
||||
}
|
||||
}
|
74
src/main/java/com/example/common/config/JWTInterceptor.java
Normal file
@ -0,0 +1,74 @@
|
||||
package com.example.common.config;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.auth0.jwt.JWT;
|
||||
import com.auth0.jwt.JWTVerifier;
|
||||
import com.auth0.jwt.algorithms.Algorithm;
|
||||
import com.auth0.jwt.exceptions.JWTVerificationException;
|
||||
import com.example.common.Constants;
|
||||
import com.example.common.enums.ResultCodeEnum;
|
||||
import com.example.common.enums.RoleEnum;
|
||||
import com.example.entity.Account;
|
||||
import com.example.exception.CustomException;
|
||||
import com.example.service.AdminService;
|
||||
import com.example.service.UserService;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
/**
|
||||
* JWT拦截器
|
||||
*/
|
||||
@Component
|
||||
public class JWTInterceptor implements HandlerInterceptor {
|
||||
|
||||
@Resource
|
||||
private AdminService adminService;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
// 1. 从http请求标头里面拿到token
|
||||
String token = request.getHeader(Constants.TOKEN);
|
||||
if (ObjectUtil.isNull(token)) {
|
||||
// 如果没拿到,那么再从请求参数里拿一次
|
||||
request.getParameter(Constants.TOKEN);
|
||||
}
|
||||
// 2. 开始执行认证
|
||||
if (ObjectUtil.isNull(token)) {
|
||||
throw new CustomException(ResultCodeEnum.TOKEN_INVALID_ERROR);
|
||||
}
|
||||
Account account = null;
|
||||
try {
|
||||
String audience = JWT.decode(token).getAudience().get(0);
|
||||
String userId = audience.split("-")[0];
|
||||
String role = audience.split("-")[1];
|
||||
// 根据用户角色判断用户属于哪个数据库表 然后查询用户数据
|
||||
if (RoleEnum.ADMIN.name().equals(role)) {
|
||||
account = adminService.selectById(Integer.valueOf(userId));
|
||||
} else if (RoleEnum.USER.name().equals(role)) {
|
||||
account = userService.selectById(Integer.valueOf(userId));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new CustomException(ResultCodeEnum.TOKEN_CHECK_ERROR);
|
||||
}
|
||||
// 根据token里面携带的用户ID去对应的角色表查询 没查到 所有报了这个“用户不存在”错误
|
||||
if (ObjectUtil.isNull(account)) {
|
||||
// 用户不存在
|
||||
throw new CustomException(ResultCodeEnum.TOKEN_CHECK_ERROR);
|
||||
}
|
||||
try {
|
||||
// 通过用户的密码作为密钥再次验证token的合法性
|
||||
JWTVerifier jwtVerifier = JWT.require(Algorithm.HMAC256(account.getPassword())).build();
|
||||
jwtVerifier.verify(token); // 验证token
|
||||
} catch (JWTVerificationException e) {
|
||||
// 用户不存在
|
||||
throw new CustomException(ResultCodeEnum.TOKEN_CHECK_ERROR);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
29
src/main/java/com/example/common/config/WebConfig.java
Normal file
@ -0,0 +1,29 @@
|
||||
package com.example.common.config;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Configuration
|
||||
public class WebConfig implements WebMvcConfigurer {
|
||||
|
||||
@Resource
|
||||
private JWTInterceptor jwtInterceptor;
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(jwtInterceptor).addPathPatterns("/**")
|
||||
.excludePathPatterns("/")
|
||||
.excludePathPatterns("/login", "/register", "/files/**")
|
||||
|
||||
// 游客访问
|
||||
.excludePathPatterns("/category/**")
|
||||
.excludePathPatterns("/notice/**")
|
||||
.excludePathPatterns("/book/**")
|
||||
.excludePathPatterns("/posts/**")
|
||||
.excludePathPatterns("/activity/**")
|
||||
;
|
||||
}
|
||||
|
||||
}
|
26
src/main/java/com/example/common/enums/ResultCodeEnum.java
Normal file
@ -0,0 +1,26 @@
|
||||
package com.example.common.enums;
|
||||
|
||||
public enum ResultCodeEnum {
|
||||
|
||||
SUCCESS("200", "成功"),
|
||||
PARAM_ERROR("400", "参数异常"),
|
||||
TOKEN_INVALID_ERROR("401", "无效的token"),
|
||||
TOKEN_CHECK_ERROR("401", "token验证失败,请重新登录"),
|
||||
PARAM_LOST_ERROR("4001", "参数缺失"),
|
||||
|
||||
SYSTEM_ERROR("500", "系统异常"),
|
||||
USER_EXIST_ERROR("5001", "用户名已存在"),
|
||||
USER_NOT_LOGIN("5002", "用户未登录"),
|
||||
USER_ACCOUNT_ERROR("5003", "账号或密码错误"),
|
||||
USER_NOT_EXIST_ERROR("5004", "用户不存在"),
|
||||
PARAM_PASSWORD_ERROR("5005", "原密码输入错误"),
|
||||
;
|
||||
|
||||
public String code;
|
||||
public String msg;
|
||||
|
||||
ResultCodeEnum(String code, String msg) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
}
|
8
src/main/java/com/example/common/enums/RoleEnum.java
Normal file
@ -0,0 +1,8 @@
|
||||
package com.example.common.enums;
|
||||
|
||||
public enum RoleEnum {
|
||||
// 管理员
|
||||
ADMIN,
|
||||
// 普通用户
|
||||
USER
|
||||
}
|
87
src/main/java/com/example/controller/ActivityController.java
Normal file
@ -0,0 +1,87 @@
|
||||
package com.example.controller;
|
||||
|
||||
import com.example.common.Result;
|
||||
import com.example.entity.Activity;
|
||||
import com.example.service.ActivityService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 前端请求接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/activity")
|
||||
public class ActivityController {
|
||||
|
||||
@Resource
|
||||
private ActivityService activityService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public Result add(@RequestBody Activity activity) {
|
||||
activityService.add(activity);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public Result update(@RequestBody Activity activity) {
|
||||
activityService.updateById(activity);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个删除
|
||||
*/
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
activityService.deleteById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@DeleteMapping("/delete/batch")
|
||||
public Result delete(@RequestBody List<Integer> ids) {
|
||||
activityService.deleteBatch(ids);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个查询
|
||||
*/
|
||||
@GetMapping("/selectById/{id}")
|
||||
public Result selectById(@PathVariable Integer id) {
|
||||
Activity activity = activityService.selectById(id);
|
||||
return Result.success(activity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有
|
||||
*/
|
||||
@GetMapping("/selectAll")
|
||||
public Result selectAll(Activity activity) {
|
||||
List<Activity> list = activityService.selectAll(activity);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@GetMapping("/selectPage")
|
||||
public Result selectPage(Activity activity,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
PageInfo<Activity> pageInfo = activityService.selectPage(activity, pageNum, pageSize);
|
||||
return Result.success(pageInfo);
|
||||
}
|
||||
|
||||
}
|
87
src/main/java/com/example/controller/AdminController.java
Normal file
@ -0,0 +1,87 @@
|
||||
package com.example.controller;
|
||||
|
||||
import com.example.common.Result;
|
||||
import com.example.entity.Admin;
|
||||
import com.example.service.AdminService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 前端请求接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/admin")
|
||||
public class AdminController {
|
||||
|
||||
@Resource
|
||||
private AdminService adminService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public Result add(@RequestBody Admin admin) {
|
||||
adminService.add(admin);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public Result update(@RequestBody Admin admin) {
|
||||
adminService.updateById(admin);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个删除
|
||||
*/
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
adminService.deleteById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@DeleteMapping("/delete/batch")
|
||||
public Result delete(@RequestBody List<Integer> ids) {
|
||||
adminService.deleteBatch(ids);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个查询
|
||||
*/
|
||||
@GetMapping("/selectById/{id}")
|
||||
public Result selectById(@PathVariable Integer id) {
|
||||
Admin admin = adminService.selectById(id);
|
||||
return Result.success(admin);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有
|
||||
*/
|
||||
@GetMapping("/selectAll")
|
||||
public Result selectAll(Admin admin) {
|
||||
List<Admin> list = adminService.selectAll(admin);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@GetMapping("/selectPage")
|
||||
public Result selectPage(Admin admin,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
PageInfo<Admin> pageInfo = adminService.selectPage(admin, pageNum, pageSize);
|
||||
return Result.success(pageInfo);
|
||||
}
|
||||
|
||||
}
|
107
src/main/java/com/example/controller/BookController.java
Normal file
@ -0,0 +1,107 @@
|
||||
package com.example.controller;
|
||||
|
||||
import com.example.common.Result;
|
||||
import com.example.entity.Book;
|
||||
import com.example.service.BookService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 前端请求接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/book")
|
||||
public class BookController {
|
||||
|
||||
@Resource
|
||||
private BookService bookService;
|
||||
|
||||
/**
|
||||
* 推荐
|
||||
*/
|
||||
@GetMapping("/rem")
|
||||
public Result rem() {
|
||||
List<Book> rem = bookService.rem();
|
||||
return Result.success(rem);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public Result add(@RequestBody Book book) {
|
||||
bookService.add(book);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public Result update(@RequestBody Book book) {
|
||||
bookService.updateById(book);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个删除
|
||||
*/
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
bookService.deleteById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@DeleteMapping("/delete/batch")
|
||||
public Result delete(@RequestBody List<Integer> ids) {
|
||||
bookService.deleteBatch(ids);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个查询
|
||||
*/
|
||||
@GetMapping("/selectById/{id}")
|
||||
public Result selectById(@PathVariable Integer id) {
|
||||
Book book = bookService.selectById(id);
|
||||
return Result.success(book);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有
|
||||
*/
|
||||
@GetMapping("/selectAll")
|
||||
public Result selectAll(Book book) {
|
||||
List<Book> list = bookService.selectAll(book);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询排行前五的热门借阅的图书
|
||||
*/
|
||||
@GetMapping("/selectHot")
|
||||
public Result selectHot() {
|
||||
List<Book> list = bookService.selectHot();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@GetMapping("/selectPage")
|
||||
public Result selectPage(Book book,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
PageInfo<Book> pageInfo = bookService.selectPage(book, pageNum, pageSize);
|
||||
return Result.success(pageInfo);
|
||||
}
|
||||
|
||||
}
|
87
src/main/java/com/example/controller/CartController.java
Normal file
@ -0,0 +1,87 @@
|
||||
package com.example.controller;
|
||||
|
||||
import com.example.common.Result;
|
||||
import com.example.entity.Cart;
|
||||
import com.example.service.CartService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 前端请求接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cart")
|
||||
public class CartController {
|
||||
|
||||
@Resource
|
||||
private CartService cartService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public Result add(@RequestBody Cart cart) {
|
||||
cartService.add(cart);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public Result update(@RequestBody Cart cart) {
|
||||
cartService.updateById(cart);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个删除
|
||||
*/
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
cartService.deleteById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@DeleteMapping("/delete/batch")
|
||||
public Result delete(@RequestBody List<Integer> ids) {
|
||||
cartService.deleteBatch(ids);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个查询
|
||||
*/
|
||||
@GetMapping("/selectById/{id}")
|
||||
public Result selectById(@PathVariable Integer id) {
|
||||
Cart cart = cartService.selectById(id);
|
||||
return Result.success(cart);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有
|
||||
*/
|
||||
@GetMapping("/selectAll")
|
||||
public Result selectAll(Cart cart) {
|
||||
List<Cart> list = cartService.selectAll(cart);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@GetMapping("/selectPage")
|
||||
public Result selectPage(Cart cart,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
PageInfo<Cart> pageInfo = cartService.selectPage(cart, pageNum, pageSize);
|
||||
return Result.success(pageInfo);
|
||||
}
|
||||
|
||||
}
|
87
src/main/java/com/example/controller/CategoryController.java
Normal file
@ -0,0 +1,87 @@
|
||||
package com.example.controller;
|
||||
|
||||
import com.example.common.Result;
|
||||
import com.example.entity.Category;
|
||||
import com.example.service.CategoryService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 前端请求接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/category")
|
||||
public class CategoryController {
|
||||
|
||||
@Resource
|
||||
private CategoryService categoryService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public Result add(@RequestBody Category category) {
|
||||
categoryService.add(category);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public Result update(@RequestBody Category category) {
|
||||
categoryService.updateById(category);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个删除
|
||||
*/
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
categoryService.deleteById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@DeleteMapping("/delete/batch")
|
||||
public Result delete(@RequestBody List<Integer> ids) {
|
||||
categoryService.deleteBatch(ids);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个查询
|
||||
*/
|
||||
@GetMapping("/selectById/{id}")
|
||||
public Result selectById(@PathVariable Integer id) {
|
||||
Category category = categoryService.selectById(id);
|
||||
return Result.success(category);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有
|
||||
*/
|
||||
@GetMapping("/selectAll")
|
||||
public Result selectAll(Category category) {
|
||||
List<Category> list = categoryService.selectAll(category);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@GetMapping("/selectPage")
|
||||
public Result selectPage(Category category,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
PageInfo<Category> pageInfo = categoryService.selectPage(category, pageNum, pageSize);
|
||||
return Result.success(pageInfo);
|
||||
}
|
||||
|
||||
}
|
87
src/main/java/com/example/controller/CollectController.java
Normal file
@ -0,0 +1,87 @@
|
||||
package com.example.controller;
|
||||
|
||||
import com.example.common.Result;
|
||||
import com.example.entity.Collect;
|
||||
import com.example.service.CollectService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 前端请求接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/collect")
|
||||
public class CollectController {
|
||||
|
||||
@Resource
|
||||
private CollectService collectService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public Result add(@RequestBody Collect collect) {
|
||||
collectService.add(collect);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public Result update(@RequestBody Collect collect) {
|
||||
collectService.updateById(collect);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个删除
|
||||
*/
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
collectService.deleteById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@DeleteMapping("/delete/batch")
|
||||
public Result delete(@RequestBody List<Integer> ids) {
|
||||
collectService.deleteBatch(ids);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个查询
|
||||
*/
|
||||
@GetMapping("/selectById/{id}")
|
||||
public Result selectById(@PathVariable Integer id) {
|
||||
Collect collect = collectService.selectById(id);
|
||||
return Result.success(collect);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有
|
||||
*/
|
||||
@GetMapping("/selectAll")
|
||||
public Result selectAll(Collect collect) {
|
||||
List<Collect> list = collectService.selectAll(collect);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@GetMapping("/selectPage")
|
||||
public Result selectPage(Collect collect,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
PageInfo<Collect> pageInfo = collectService.selectPage(collect, pageNum, pageSize);
|
||||
return Result.success(pageInfo);
|
||||
}
|
||||
|
||||
}
|
114
src/main/java/com/example/controller/CommentController.java
Normal file
@ -0,0 +1,114 @@
|
||||
package com.example.controller;
|
||||
|
||||
import com.example.common.Result;
|
||||
import com.example.entity.Comment;
|
||||
import com.example.service.CommentService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 前端请求接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/comment")
|
||||
public class CommentController {
|
||||
|
||||
@Resource
|
||||
private CommentService commentService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public Result add(@RequestBody Comment comment) {
|
||||
|
||||
commentService.add(comment);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public Result update(@RequestBody Comment comment) {
|
||||
commentService.updateById(comment);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个删除
|
||||
*/
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
commentService.deleteById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归删除
|
||||
*/
|
||||
@DeleteMapping("/deepDelete/{pid}")
|
||||
public Result deepDelete(@PathVariable Integer pid) {
|
||||
commentService.deepDelete(pid);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@DeleteMapping("/delete/batch")
|
||||
public Result delete(@RequestBody List<Integer> ids) {
|
||||
commentService.deleteBatch(ids);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个查询
|
||||
*/
|
||||
@GetMapping("/selectById/{id}")
|
||||
public Result selectById(@PathVariable Integer id) {
|
||||
Comment comment = commentService.selectById(id);
|
||||
return Result.success(comment);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有
|
||||
*/
|
||||
@GetMapping("/selectAll")
|
||||
public Result selectAll(Comment comment) {
|
||||
List<Comment> list = commentService.selectAll(comment);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询树形结构的数据
|
||||
*/
|
||||
@GetMapping("/selectTree/{module}/{fid}")
|
||||
public Result selectTree(@PathVariable String module, @PathVariable Integer fid,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "5") Integer pageSize) {
|
||||
PageInfo<Comment> pageInfo = commentService.selectTree(module, fid, pageNum, pageSize);
|
||||
return Result.success(pageInfo);
|
||||
}
|
||||
|
||||
@GetMapping("/selectCount/{module}/{fid}")
|
||||
public Result selectCount(@PathVariable String module, @PathVariable Integer fid) {
|
||||
Integer count = commentService.selectCount(module, fid);
|
||||
return Result.success(count);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@GetMapping("/selectPage")
|
||||
public Result selectPage(Comment comment,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
PageInfo<Comment> pageInfo = commentService.selectPage(comment, pageNum, pageSize);
|
||||
return Result.success(pageInfo);
|
||||
}
|
||||
|
||||
}
|
96
src/main/java/com/example/controller/FileController.java
Normal file
@ -0,0 +1,96 @@
|
||||
package com.example.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.example.common.Result;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/files")
|
||||
public class FileController {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(FileController.class);
|
||||
|
||||
private static final String filePath = "D:/2025/hadoop-library-recommendation/files/";
|
||||
// private static final String filePath = System.getProperty("user.dir") + "/files/";
|
||||
|
||||
@Value("${fileBaseUrl:}")
|
||||
private String fileBaseUrl;
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
*/
|
||||
@PostMapping("/upload")
|
||||
public Result upload(MultipartFile file) {
|
||||
String fileName = file.getOriginalFilename();
|
||||
try {
|
||||
if (!FileUtil.isDirectory(filePath)) {
|
||||
FileUtil.mkdir(filePath);
|
||||
}
|
||||
fileName = System.currentTimeMillis() + "-" + fileName;
|
||||
String realFilePath = filePath + fileName;
|
||||
// 文件存储形式:时间戳-文件名
|
||||
FileUtil.writeBytes(file.getBytes(), realFilePath);
|
||||
} catch (Exception e) {
|
||||
log.error(fileName + "--文件上传失败", e);
|
||||
}
|
||||
String url = fileBaseUrl + "/files/download/" + fileName;
|
||||
return Result.success(url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件
|
||||
*/ @GetMapping("/download/{fileName}")
|
||||
public void download(@PathVariable String fileName, HttpServletResponse response) {
|
||||
OutputStream os;
|
||||
try {
|
||||
if (StrUtil.isNotEmpty(fileName)) {
|
||||
response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, StandardCharsets.UTF_8));
|
||||
response.setContentType("application/octet-stream");
|
||||
byte[] bytes = FileUtil.readBytes(filePath + fileName);
|
||||
os = response.getOutputStream();
|
||||
os.write(bytes);
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("文件下载失败:" + fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* wang-editor编辑器文件上传接口
|
||||
*/
|
||||
@PostMapping("/wang/upload")
|
||||
public Map<String, Object> wangEditorUpload(MultipartFile file) {
|
||||
String flag = System.currentTimeMillis() + "";
|
||||
String fileName = file.getOriginalFilename();
|
||||
try {
|
||||
// 文件存储形式:时间戳-文件名
|
||||
FileUtil.writeBytes(file.getBytes(), filePath + flag + "-" + fileName);
|
||||
System.out.println(fileName + "--上传成功");
|
||||
Thread.sleep(1L);
|
||||
} catch (Exception e) {
|
||||
System.err.println(fileName + "--文件上传失败");
|
||||
}
|
||||
String http = fileBaseUrl + "/files/download/";
|
||||
Map<String, Object> resMap = new HashMap<>();
|
||||
// wangEditor上传图片成功后, 需要返回的参数
|
||||
resMap.put("errno", 0);
|
||||
resMap.put("data", CollUtil.newArrayList(Dict.create().set("url", http + flag + "-" + fileName)));
|
||||
return resMap;
|
||||
}
|
||||
}
|
87
src/main/java/com/example/controller/NoticeController.java
Normal file
@ -0,0 +1,87 @@
|
||||
package com.example.controller;
|
||||
|
||||
import com.example.common.Result;
|
||||
import com.example.entity.Notice;
|
||||
import com.example.service.NoticeService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 前端请求接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/notice")
|
||||
public class NoticeController {
|
||||
|
||||
@Resource
|
||||
private NoticeService noticeService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public Result add(@RequestBody Notice notice) {
|
||||
noticeService.add(notice);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public Result update(@RequestBody Notice notice) {
|
||||
noticeService.updateById(notice);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个删除
|
||||
*/
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
noticeService.deleteById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@DeleteMapping("/delete/batch")
|
||||
public Result delete(@RequestBody List<Integer> ids) {
|
||||
noticeService.deleteBatch(ids);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个查询
|
||||
*/
|
||||
@GetMapping("/selectById/{id}")
|
||||
public Result selectById(@PathVariable Integer id) {
|
||||
Notice notice = noticeService.selectById(id);
|
||||
return Result.success(notice);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有
|
||||
*/
|
||||
@GetMapping("/selectAll")
|
||||
public Result selectAll(Notice notice) {
|
||||
List<Notice> list = noticeService.selectAll(notice);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@GetMapping("/selectPage")
|
||||
public Result selectPage(Notice notice,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
PageInfo<Notice> pageInfo = noticeService.selectPage(notice, pageNum, pageSize);
|
||||
return Result.success(pageInfo);
|
||||
}
|
||||
|
||||
}
|
104
src/main/java/com/example/controller/OrdersController.java
Normal file
@ -0,0 +1,104 @@
|
||||
package com.example.controller;
|
||||
|
||||
import com.example.common.Result;
|
||||
import com.example.entity.Orders;
|
||||
import com.example.mapper.OrdersMapper;
|
||||
import com.example.service.OrdersService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 前端请求接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/orders")
|
||||
public class OrdersController {
|
||||
|
||||
@Resource
|
||||
private OrdersService ordersService;
|
||||
|
||||
@Resource
|
||||
private OrdersMapper ordersMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@GetMapping("/ods_order_count")
|
||||
public Result view1() {
|
||||
return Result.success(ordersMapper.ods_order_count());
|
||||
} @GetMapping("/ods_yuyue_count")
|
||||
public Result view2() {
|
||||
return Result.success(ordersMapper.ods_yuyue_count());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public Result add(@RequestBody Orders orders) {
|
||||
ordersService.add(orders);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public Result update(@RequestBody Orders orders) {
|
||||
ordersService.updateById(orders);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个删除
|
||||
*/
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
ordersService.deleteById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@DeleteMapping("/delete/batch")
|
||||
public Result delete(@RequestBody List<Integer> ids) {
|
||||
ordersService.deleteBatch(ids);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个查询
|
||||
*/
|
||||
@GetMapping("/selectById/{id}")
|
||||
public Result selectById(@PathVariable Integer id) {
|
||||
Orders orders = ordersService.selectById(id);
|
||||
return Result.success(orders);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有
|
||||
*/
|
||||
@GetMapping("/selectAll")
|
||||
public Result selectAll(Orders orders) {
|
||||
List<Orders> list = ordersService.selectAll(orders);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@GetMapping("/selectPage")
|
||||
public Result selectPage(Orders orders,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
PageInfo<Orders> pageInfo = ordersService.selectPage(orders, pageNum, pageSize);
|
||||
return Result.success(pageInfo);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package com.example.controller;
|
||||
|
||||
import com.example.common.Result;
|
||||
import com.example.entity.OrdersItem;
|
||||
import com.example.service.OrdersItemService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 前端请求接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/ordersItem")
|
||||
public class OrdersItemController {
|
||||
|
||||
@Resource
|
||||
private OrdersItemService ordersItemService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public Result add(@RequestBody OrdersItem ordersItem) {
|
||||
ordersItemService.add(ordersItem);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public Result update(@RequestBody OrdersItem ordersItem) {
|
||||
ordersItemService.updateById(ordersItem);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个删除
|
||||
*/
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
ordersItemService.deleteById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@DeleteMapping("/delete/batch")
|
||||
public Result delete(@RequestBody List<Integer> ids) {
|
||||
ordersItemService.deleteBatch(ids);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个查询
|
||||
*/
|
||||
@GetMapping("/selectById/{id}")
|
||||
public Result selectById(@PathVariable Integer id) {
|
||||
OrdersItem ordersItem = ordersItemService.selectById(id);
|
||||
return Result.success(ordersItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据订单ID查询
|
||||
*/
|
||||
@GetMapping("/selectByOrderId/{orderId}")
|
||||
public Result selectByOrderId(@PathVariable Integer orderId) {
|
||||
List<OrdersItem> ordersItem = ordersItemService.selectByOrderId(orderId);
|
||||
return Result.success(ordersItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有
|
||||
*/
|
||||
@GetMapping("/selectAll")
|
||||
public Result selectAll(OrdersItem ordersItem) {
|
||||
List<OrdersItem> list = ordersItemService.selectAll(ordersItem);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@GetMapping("/selectPage")
|
||||
public Result selectPage(OrdersItem ordersItem,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
PageInfo<OrdersItem> pageInfo = ordersItemService.selectPage(ordersItem, pageNum, pageSize);
|
||||
return Result.success(pageInfo);
|
||||
}
|
||||
|
||||
}
|
110
src/main/java/com/example/controller/PostsController.java
Normal file
@ -0,0 +1,110 @@
|
||||
package com.example.controller;
|
||||
|
||||
import com.example.common.Result;
|
||||
import com.example.entity.Posts;
|
||||
import com.example.service.CommentService;
|
||||
import com.example.service.PostsService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 前端请求接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/posts")
|
||||
public class PostsController {
|
||||
|
||||
@Resource
|
||||
private PostsService postsService;
|
||||
|
||||
@Resource
|
||||
private CommentService commentService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public Result add(@RequestBody Posts posts) {
|
||||
postsService.add(posts);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public Result update(@RequestBody Posts posts) {
|
||||
postsService.updateById(posts);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PutMapping("/updateReadCount/{id}")
|
||||
public Result updateReadCount(@PathVariable Integer id) {
|
||||
postsService.updateReadCount(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个删除
|
||||
*/
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
postsService.deleteById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@DeleteMapping("/delete/batch")
|
||||
public Result delete(@RequestBody List<Integer> ids) {
|
||||
postsService.deleteBatch(ids);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个查询
|
||||
*/
|
||||
@GetMapping("/selectById/{id}")
|
||||
public Result selectById(@PathVariable Integer id) {
|
||||
Posts posts = postsService.selectById(id);
|
||||
return Result.success(posts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有
|
||||
*/
|
||||
@GetMapping("/selectAll")
|
||||
public Result selectAll(Posts posts) {
|
||||
List<Posts> list = postsService.selectAll(posts);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/selectHot")
|
||||
public Result selectHot(Posts posts) {
|
||||
List<Posts> list = postsService.selectAll(posts);
|
||||
// 排序+ 限制个数
|
||||
list = list.stream().sorted((p1, p2) -> p2.getReadCount().compareTo(p1.getReadCount())).limit(5).collect(Collectors.toList());
|
||||
for (Posts p : list) {
|
||||
Integer count = commentService.selectCount("posts", p.getId());// 查询当前这个帖子下面所有的评论数
|
||||
p.setCommentCount(count);
|
||||
}
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@GetMapping("/selectPage")
|
||||
public Result selectPage(Posts posts,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
PageInfo<Posts> pageInfo = postsService.selectPage(posts, pageNum, pageSize);
|
||||
return Result.success(pageInfo);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
package com.example.controller;
|
||||
|
||||
import com.example.common.Result;
|
||||
import com.example.entity.PostsSection;
|
||||
import com.example.service.PostsSectionService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 前端请求接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/postsSection")
|
||||
public class PostsSectionController {
|
||||
|
||||
@Resource
|
||||
private PostsSectionService postsSectionService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public Result add(@RequestBody PostsSection postsSection) {
|
||||
postsSectionService.add(postsSection);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public Result update(@RequestBody PostsSection postsSection) {
|
||||
postsSectionService.updateById(postsSection);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个删除
|
||||
*/
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
postsSectionService.deleteById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@DeleteMapping("/delete/batch")
|
||||
public Result delete(@RequestBody List<Integer> ids) {
|
||||
postsSectionService.deleteBatch(ids);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个查询
|
||||
*/
|
||||
@GetMapping("/selectById/{id}")
|
||||
public Result selectById(@PathVariable Integer id) {
|
||||
PostsSection postsSection = postsSectionService.selectById(id);
|
||||
return Result.success(postsSection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有
|
||||
*/
|
||||
@GetMapping("/selectAll")
|
||||
public Result selectAll(PostsSection postsSection) {
|
||||
List<PostsSection> list = postsSectionService.selectAll(postsSection);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@GetMapping("/selectPage")
|
||||
public Result selectPage(PostsSection postsSection,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
PageInfo<PostsSection> pageInfo = postsSectionService.selectPage(postsSection, pageNum, pageSize);
|
||||
return Result.success(pageInfo);
|
||||
}
|
||||
|
||||
}
|
87
src/main/java/com/example/controller/RoomController.java
Normal file
@ -0,0 +1,87 @@
|
||||
package com.example.controller;
|
||||
|
||||
import com.example.common.Result;
|
||||
import com.example.entity.Room;
|
||||
import com.example.service.RoomService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 前端请求接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/room")
|
||||
public class RoomController {
|
||||
|
||||
@Resource
|
||||
private RoomService roomService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public Result add(@RequestBody Room room) {
|
||||
roomService.add(room);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public Result update(@RequestBody Room room) {
|
||||
roomService.updateById(room);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个删除
|
||||
*/
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
roomService.deleteById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@DeleteMapping("/delete/batch")
|
||||
public Result delete(@RequestBody List<Integer> ids) {
|
||||
roomService.deleteBatch(ids);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个查询
|
||||
*/
|
||||
@GetMapping("/selectById/{id}")
|
||||
public Result selectById(@PathVariable Integer id) {
|
||||
Room room = roomService.selectById(id);
|
||||
return Result.success(room);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有
|
||||
*/
|
||||
@GetMapping("/selectAll")
|
||||
public Result selectAll(Room room) {
|
||||
List<Room> list = roomService.selectAll(room);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@GetMapping("/selectPage")
|
||||
public Result selectPage(Room room,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
PageInfo<Room> pageInfo = roomService.selectPage(room, pageNum, pageSize);
|
||||
return Result.success(pageInfo);
|
||||
}
|
||||
|
||||
}
|
87
src/main/java/com/example/controller/SeatController.java
Normal file
@ -0,0 +1,87 @@
|
||||
package com.example.controller;
|
||||
|
||||
import com.example.common.Result;
|
||||
import com.example.entity.Seat;
|
||||
import com.example.service.SeatService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 前端请求接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/seat")
|
||||
public class SeatController {
|
||||
|
||||
@Resource
|
||||
private SeatService seatService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public Result add(@RequestBody Seat seat) {
|
||||
seatService.add(seat);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public Result update(@RequestBody Seat seat) {
|
||||
seatService.updateById(seat);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个删除
|
||||
*/
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
seatService.deleteById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@DeleteMapping("/delete/batch")
|
||||
public Result delete(@RequestBody List<Integer> ids) {
|
||||
seatService.deleteBatch(ids);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个查询
|
||||
*/
|
||||
@GetMapping("/selectById/{id}")
|
||||
public Result selectById(@PathVariable Integer id) {
|
||||
Seat seat = seatService.selectById(id);
|
||||
return Result.success(seat);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有
|
||||
*/
|
||||
@GetMapping("/selectAll")
|
||||
public Result selectAll(Seat seat) {
|
||||
List<Seat> list = seatService.selectAll(seat);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@GetMapping("/selectPage")
|
||||
public Result selectPage(Seat seat,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
PageInfo<Seat> pageInfo = seatService.selectPage(seat, pageNum, pageSize);
|
||||
return Result.success(pageInfo);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
package com.example.controller;
|
||||
|
||||
import com.example.common.Result;
|
||||
import com.example.entity.SeatReserve;
|
||||
import com.example.service.SeatReserveService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 前端请求接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/seatReserve")
|
||||
public class SeatReserveController {
|
||||
|
||||
@Resource
|
||||
private SeatReserveService seatReserveService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public Result add(@RequestBody SeatReserve seatReserve) {
|
||||
seatReserveService.add(seatReserve);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public Result update(@RequestBody SeatReserve seatReserve) {
|
||||
seatReserveService.updateById(seatReserve);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个删除
|
||||
*/
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
seatReserveService.deleteById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@DeleteMapping("/delete/batch")
|
||||
public Result delete(@RequestBody List<Integer> ids) {
|
||||
seatReserveService.deleteBatch(ids);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个查询
|
||||
*/
|
||||
@GetMapping("/selectById/{id}")
|
||||
public Result selectById(@PathVariable Integer id) {
|
||||
SeatReserve seatReserve = seatReserveService.selectById(id);
|
||||
return Result.success(seatReserve);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有
|
||||
*/
|
||||
@GetMapping("/selectAll")
|
||||
public Result selectAll(SeatReserve seatReserve) {
|
||||
List<SeatReserve> list = seatReserveService.selectAll(seatReserve);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@GetMapping("/selectPage")
|
||||
public Result selectPage(SeatReserve seatReserve,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
PageInfo<SeatReserve> pageInfo = seatReserveService.selectPage(seatReserve, pageNum, pageSize);
|
||||
return Result.success(pageInfo);
|
||||
}
|
||||
|
||||
}
|
87
src/main/java/com/example/controller/SignController.java
Normal file
@ -0,0 +1,87 @@
|
||||
package com.example.controller;
|
||||
|
||||
import com.example.common.Result;
|
||||
import com.example.entity.Sign;
|
||||
import com.example.service.SignService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 前端请求接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sign")
|
||||
public class SignController {
|
||||
|
||||
@Resource
|
||||
private SignService signService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public Result add(@RequestBody Sign sign) {
|
||||
signService.add(sign);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public Result update(@RequestBody Sign sign) {
|
||||
signService.updateById(sign);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个删除
|
||||
*/
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
signService.deleteById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@DeleteMapping("/delete/batch")
|
||||
public Result delete(@RequestBody List<Integer> ids) {
|
||||
signService.deleteBatch(ids);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个查询
|
||||
*/
|
||||
@GetMapping("/selectById/{id}")
|
||||
public Result selectById(@PathVariable Integer id) {
|
||||
Sign sign = signService.selectById(id);
|
||||
return Result.success(sign);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有
|
||||
*/
|
||||
@GetMapping("/selectAll")
|
||||
public Result selectAll(Sign sign) {
|
||||
List<Sign> list = signService.selectAll(sign);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@GetMapping("/selectPage")
|
||||
public Result selectPage(Sign sign,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
PageInfo<Sign> pageInfo = signService.selectPage(sign, pageNum, pageSize);
|
||||
return Result.success(pageInfo);
|
||||
}
|
||||
|
||||
}
|
87
src/main/java/com/example/controller/UserController.java
Normal file
@ -0,0 +1,87 @@
|
||||
package com.example.controller;
|
||||
|
||||
import com.example.common.Result;
|
||||
import com.example.entity.User;
|
||||
import com.example.service.UserService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 前端请求接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user")
|
||||
public class UserController {
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public Result add(@RequestBody User user) {
|
||||
userService.add(user);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public Result update(@RequestBody User user) {
|
||||
userService.updateById(user);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个删除
|
||||
*/
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
userService.deleteById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@DeleteMapping("/delete/batch")
|
||||
public Result delete(@RequestBody List<Integer> ids) {
|
||||
userService.deleteBatch(ids);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个查询
|
||||
*/
|
||||
@GetMapping("/selectById/{id}")
|
||||
public Result selectById(@PathVariable Integer id) {
|
||||
User user = userService.selectById(id);
|
||||
return Result.success(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有
|
||||
*/
|
||||
@GetMapping("/selectAll")
|
||||
public Result selectAll(User user) {
|
||||
List<User> list = userService.selectAll(user);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@GetMapping("/selectPage")
|
||||
public Result selectPage(User user,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
PageInfo<User> pageInfo = userService.selectPage(user, pageNum, pageSize);
|
||||
return Result.success(pageInfo);
|
||||
}
|
||||
|
||||
}
|
144
src/main/java/com/example/controller/WebController.java
Normal file
@ -0,0 +1,144 @@
|
||||
package com.example.controller;
|
||||
|
||||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import com.example.common.Result;
|
||||
import com.example.common.enums.RoleEnum;
|
||||
import com.example.entity.*;
|
||||
import com.example.mapper.PostsMapper;
|
||||
import com.example.mapper.SignMapper;
|
||||
import com.example.service.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
public class WebController {
|
||||
|
||||
@Resource
|
||||
private AdminService adminService;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
@Resource
|
||||
OrdersService ordersService;
|
||||
@Resource
|
||||
SeatReserveService seatReserveService;
|
||||
@Resource
|
||||
ActivityService activityService;
|
||||
@Resource
|
||||
SignMapper signMapper;
|
||||
@Resource
|
||||
PostsSectionService postsSectionService;
|
||||
@Resource
|
||||
PostsMapper postsMapper;
|
||||
|
||||
/**
|
||||
* 默认请求接口
|
||||
*/
|
||||
@GetMapping("/")
|
||||
public Result hello () {
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录
|
||||
*/
|
||||
@PostMapping("/login")
|
||||
public Result login(@RequestBody Account account) {
|
||||
Account loginAccount = null;
|
||||
if (RoleEnum.ADMIN.name().equals(account.getRole())) {
|
||||
loginAccount = adminService.login(account);
|
||||
} else if (RoleEnum.USER.name().equals(account.getRole())) {
|
||||
loginAccount = userService.login(account);
|
||||
}
|
||||
return Result.success(loginAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*/
|
||||
@PostMapping("/register")
|
||||
public Result register(@RequestBody User user) {
|
||||
userService.add(user);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
*/
|
||||
@PutMapping("/updatePassword")
|
||||
public Result updatePassword(@RequestBody Account account) {
|
||||
if (RoleEnum.ADMIN.name().equals(account.getRole())) {
|
||||
adminService.updatePassword(account);
|
||||
} else if (RoleEnum.USER.name().equals(account.getRole())) {
|
||||
userService.updatePassword(account);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
///lineData
|
||||
@GetMapping("/lineData")
|
||||
public Result lineDate() {
|
||||
List<Dict> list = new ArrayList<>();
|
||||
Date date = new Date();
|
||||
DateTime start = DateUtil.offsetDay(date, -30); // 开日期
|
||||
List<DateTime> dateList = DateUtil.rangeToList(start, date, DateField.DAY_OF_YEAR);
|
||||
List<String> dateStrList =
|
||||
dateList.stream().map(DateUtil::formatDate).
|
||||
sorted(Comparator.naturalOrder()).collect(Collectors.toList());
|
||||
for (String day : dateStrList) {
|
||||
// 查询这一天的借书量
|
||||
Integer count = ordersService.selectDayCount(day);
|
||||
Dict dict = Dict.create().set("date", day).set("count", count);
|
||||
list.add(dict);
|
||||
}
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/lineData1")
|
||||
public Result lineDate1() {
|
||||
List<Dict> list = new ArrayList<>();
|
||||
Date date = new Date();
|
||||
DateTime start = DateUtil.offsetDay(date, -30); // 开日期
|
||||
List<DateTime> dateList = DateUtil.rangeToList(start, date, DateField.DAY_OF_YEAR);
|
||||
List<String> dateStrList = dateList.stream().map(DateUtil::formatDate).sorted(Comparator.naturalOrder()).collect(Collectors.toList());
|
||||
for (String day : dateStrList) {
|
||||
// 查询这一天的借书量
|
||||
Integer count = seatReserveService.selectDayCount(day);
|
||||
Dict dict = Dict.create().set("date", day).set("count", count);
|
||||
list.add(dict);
|
||||
}
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/barData")
|
||||
public Result barData() {
|
||||
List<Dict> list = new ArrayList<>();
|
||||
List<Activity> activityList = activityService.selectAll(null);
|
||||
for (Activity activity : activityList) {
|
||||
Integer count = signMapper.selectByActivityId(activity.getId());
|
||||
Dict dict = Dict.create().set("name", activity.getName()).set("count", count);
|
||||
list.add(dict);
|
||||
}
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/pieData")
|
||||
public Result pieData() {
|
||||
List<Dict> list = new ArrayList<>();
|
||||
List<PostsSection> postsSectionList = postsSectionService.selectAll(null);
|
||||
for (PostsSection section : postsSectionList) {
|
||||
Integer count = postsMapper.selectBySectionId(section.getId());
|
||||
Dict dict = Dict.create().set("name", section.getName()).set("value", count); // 注意 pie数据格式必须是name:value 对象
|
||||
list.add(dict);
|
||||
}
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
}
|
68
src/main/java/com/example/entity/Account.java
Normal file
@ -0,0 +1,68 @@
|
||||
package com.example.entity;
|
||||
|
||||
public class Account {
|
||||
|
||||
private Integer id;
|
||||
private String username;
|
||||
private String password;
|
||||
private String role;
|
||||
private String newPassword;
|
||||
private String token;
|
||||
private Integer score;
|
||||
|
||||
public Integer getScore() {
|
||||
return score;
|
||||
}
|
||||
|
||||
public void setScore(Integer score) {
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(String role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public String getNewPassword() {
|
||||
return newPassword;
|
||||
}
|
||||
|
||||
public void setNewPassword(String newPassword) {
|
||||
this.newPassword = newPassword;
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
}
|
113
src/main/java/com/example/entity/Activity.java
Normal file
@ -0,0 +1,113 @@
|
||||
package com.example.entity;
|
||||
|
||||
public class Activity {
|
||||
/** ID */
|
||||
private Integer id;
|
||||
/** 活动名称 */
|
||||
private String name;
|
||||
/** 活动描述 */
|
||||
private String descr;
|
||||
/** 活动图片 */
|
||||
private String img;
|
||||
/** 开始日期 */
|
||||
private String start;
|
||||
/** 结束日期 */
|
||||
private String end;
|
||||
/** 活动地点 */
|
||||
private String location;
|
||||
/** 报名人数 */
|
||||
private Integer num;
|
||||
/** 活动详情 */
|
||||
private String content;
|
||||
/** 活动状态 */
|
||||
private String status;
|
||||
private Integer signCount;
|
||||
|
||||
public Integer getSignCount() {
|
||||
return signCount;
|
||||
}
|
||||
|
||||
public void setSignCount(Integer signCount) {
|
||||
this.signCount = signCount;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescr() {
|
||||
return descr;
|
||||
}
|
||||
|
||||
public void setDescr(String descr) {
|
||||
this.descr = descr;
|
||||
}
|
||||
|
||||
public String getImg() {
|
||||
return img;
|
||||
}
|
||||
|
||||
public void setImg(String img) {
|
||||
this.img = img;
|
||||
}
|
||||
|
||||
public String getStart() {
|
||||
return start;
|
||||
}
|
||||
|
||||
public void setStart(String start) {
|
||||
this.start = start;
|
||||
}
|
||||
|
||||
public String getEnd() {
|
||||
return end;
|
||||
}
|
||||
|
||||
public void setEnd(String end) {
|
||||
this.end = end;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public Integer getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public void setNum(Integer num) {
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
79
src/main/java/com/example/entity/Admin.java
Normal file
@ -0,0 +1,79 @@
|
||||
package com.example.entity;
|
||||
|
||||
public class Admin extends Account {
|
||||
|
||||
/** 主键ID */
|
||||
private Integer id;
|
||||
/** 账号 */
|
||||
private String username;
|
||||
private String password;
|
||||
private String name;
|
||||
private String avatar;
|
||||
private String role;
|
||||
private String phone;
|
||||
private String email;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(String role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
}
|
148
src/main/java/com/example/entity/Book.java
Normal file
@ -0,0 +1,148 @@
|
||||
package com.example.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Book {
|
||||
/** ID */
|
||||
private Integer id;
|
||||
/** 名称 */
|
||||
private String name;
|
||||
private String score;
|
||||
/** 封面 */
|
||||
private String cover;
|
||||
/** 简介 */
|
||||
private String descr;
|
||||
/** 作者 */
|
||||
private String author;
|
||||
/** 出版社 */
|
||||
private String publisher;
|
||||
/** 出版日期 */
|
||||
private String date;
|
||||
/** 价格 */
|
||||
private String price;
|
||||
/** ISBN */
|
||||
private String isbn;
|
||||
/** 库存 */
|
||||
private Integer store;
|
||||
/** 分类ID */
|
||||
private Integer categoryId;
|
||||
/** 是否上架 */
|
||||
private Boolean grounding;
|
||||
/** 是否推荐 */
|
||||
private Boolean recommend;
|
||||
// 分类的名称
|
||||
private String categoryName;
|
||||
|
||||
public String getCategoryName() {
|
||||
return categoryName;
|
||||
}
|
||||
|
||||
public void setCategoryName(String categoryName) {
|
||||
this.categoryName = categoryName;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getCover() {
|
||||
return cover;
|
||||
}
|
||||
|
||||
public void setCover(String cover) {
|
||||
this.cover = cover;
|
||||
}
|
||||
|
||||
public String getDescr() {
|
||||
return descr;
|
||||
}
|
||||
|
||||
public void setDescr(String descr) {
|
||||
this.descr = descr;
|
||||
}
|
||||
|
||||
public String getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
public void setAuthor(String author) {
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
public String getPublisher() {
|
||||
return publisher;
|
||||
}
|
||||
|
||||
public void setPublisher(String publisher) {
|
||||
this.publisher = publisher;
|
||||
}
|
||||
|
||||
public String getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(String date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public String getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(String price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public String getIsbn() {
|
||||
return isbn;
|
||||
}
|
||||
|
||||
public void setIsbn(String isbn) {
|
||||
this.isbn = isbn;
|
||||
}
|
||||
|
||||
public Integer getStore() {
|
||||
return store;
|
||||
}
|
||||
|
||||
public void setStore(Integer store) {
|
||||
this.store = store;
|
||||
}
|
||||
|
||||
public Integer getCategoryId() {
|
||||
return categoryId;
|
||||
}
|
||||
|
||||
public void setCategoryId(Integer categoryId) {
|
||||
this.categoryId = categoryId;
|
||||
}
|
||||
|
||||
public Boolean getGrounding() {
|
||||
return grounding;
|
||||
}
|
||||
|
||||
public void setGrounding(Boolean grounding) {
|
||||
this.grounding = grounding;
|
||||
}
|
||||
|
||||
public Boolean getRecommend() {
|
||||
return recommend;
|
||||
}
|
||||
|
||||
public void setRecommend(Boolean recommend) {
|
||||
this.recommend = recommend;
|
||||
}
|
||||
}
|
75
src/main/java/com/example/entity/Cart.java
Normal file
@ -0,0 +1,75 @@
|
||||
package com.example.entity;
|
||||
|
||||
/**
|
||||
* 书单信息
|
||||
*/
|
||||
public class Cart {
|
||||
/** ID */
|
||||
private Integer id;
|
||||
/** 图书ID */
|
||||
private Integer bookId;
|
||||
/** 数量 */
|
||||
private Integer num;
|
||||
/** 用户ID */
|
||||
private Integer userId;
|
||||
/** 添加日期 */
|
||||
private String time;
|
||||
private String bookCover;
|
||||
private String bookName;
|
||||
|
||||
public String getBookCover() {
|
||||
return bookCover;
|
||||
}
|
||||
|
||||
public void setBookCover(String bookCover) {
|
||||
this.bookCover = bookCover;
|
||||
}
|
||||
|
||||
public String getBookName() {
|
||||
return bookName;
|
||||
}
|
||||
|
||||
public void setBookName(String bookName) {
|
||||
this.bookName = bookName;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getBookId() {
|
||||
return bookId;
|
||||
}
|
||||
|
||||
public void setBookId(Integer bookId) {
|
||||
this.bookId = bookId;
|
||||
}
|
||||
|
||||
public Integer getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public void setNum(Integer num) {
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
}
|
22
src/main/java/com/example/entity/Category.java
Normal file
@ -0,0 +1,22 @@
|
||||
package com.example.entity;
|
||||
|
||||
public class Category {
|
||||
private Integer id;
|
||||
private String name;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
65
src/main/java/com/example/entity/Collect.java
Normal file
@ -0,0 +1,65 @@
|
||||
package com.example.entity;
|
||||
|
||||
/**
|
||||
* 活动收藏信息
|
||||
*/
|
||||
public class Collect {
|
||||
/** ID */
|
||||
private Integer id;
|
||||
/** 活动ID */
|
||||
private Integer activityId;
|
||||
/** 收藏人ID */
|
||||
private Integer userId;
|
||||
/** 收藏时间 */
|
||||
private String time;
|
||||
private String activityName;
|
||||
private String userName;
|
||||
|
||||
public String getActivityName() {
|
||||
return activityName;
|
||||
}
|
||||
|
||||
public void setActivityName(String activityName) {
|
||||
this.activityName = activityName;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getActivityId() {
|
||||
return activityId;
|
||||
}
|
||||
|
||||
public void setActivityId(Integer activityId) {
|
||||
this.activityId = activityId;
|
||||
}
|
||||
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
}
|
129
src/main/java/com/example/entity/Comment.java
Normal file
@ -0,0 +1,129 @@
|
||||
package com.example.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 评论信息
|
||||
*/
|
||||
@Data
|
||||
public class Comment {
|
||||
/** ID */
|
||||
private Integer id;
|
||||
/** 内容 */
|
||||
private String content;
|
||||
/** 评论人 */
|
||||
private Integer userId;
|
||||
/** 父级ID */
|
||||
private Integer pid;
|
||||
/** 评论时间 */
|
||||
private String time;
|
||||
/** 关联ID */
|
||||
private Integer fid;
|
||||
private Double score;
|
||||
/** 模块 */
|
||||
private String module;
|
||||
/** 根节点ID */
|
||||
private Integer rootId;
|
||||
private String userName;
|
||||
private String userAvatar;
|
||||
private String parentUserName;
|
||||
private List<Comment> children;
|
||||
|
||||
public String getParentUserName() {
|
||||
return parentUserName;
|
||||
}
|
||||
|
||||
public void setParentUserName(String parentUserName) {
|
||||
this.parentUserName = parentUserName;
|
||||
}
|
||||
|
||||
public List<Comment> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<Comment> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public String getUserAvatar() {
|
||||
return userAvatar;
|
||||
}
|
||||
|
||||
public void setUserAvatar(String userAvatar) {
|
||||
this.userAvatar = userAvatar;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Integer getPid() {
|
||||
return pid;
|
||||
}
|
||||
|
||||
public void setPid(Integer pid) {
|
||||
this.pid = pid;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public Integer getFid() {
|
||||
return fid;
|
||||
}
|
||||
|
||||
public void setFid(Integer fid) {
|
||||
this.fid = fid;
|
||||
}
|
||||
|
||||
public String getModule() {
|
||||
return module;
|
||||
}
|
||||
|
||||
public void setModule(String module) {
|
||||
this.module = module;
|
||||
}
|
||||
|
||||
public Integer getRootId() {
|
||||
return rootId;
|
||||
}
|
||||
|
||||
public void setRootId(Integer rootId) {
|
||||
this.rootId = rootId;
|
||||
}
|
||||
}
|
40
src/main/java/com/example/entity/Notice.java
Normal file
@ -0,0 +1,40 @@
|
||||
package com.example.entity;
|
||||
|
||||
public class Notice {
|
||||
private Integer id;
|
||||
private String title;
|
||||
private String content;
|
||||
private String time;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
}
|
123
src/main/java/com/example/entity/Orders.java
Normal file
@ -0,0 +1,123 @@
|
||||
package com.example.entity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单信息
|
||||
*/
|
||||
public class Orders {
|
||||
/** ID */
|
||||
private Integer id;
|
||||
/** 书籍名称 */
|
||||
private String name;
|
||||
/** 借书编号 */
|
||||
private String orderNo;
|
||||
/** 借书时间 */
|
||||
private String time;
|
||||
/** 用户ID */
|
||||
private Integer userId;
|
||||
/** 状态 */
|
||||
private String status;
|
||||
private String userName;
|
||||
private String hex;
|
||||
private Long days;
|
||||
private Integer bookId;
|
||||
private Integer num;
|
||||
private List<Cart> cartList;
|
||||
|
||||
public void setHex(String hex) {
|
||||
this.hex = hex;
|
||||
}
|
||||
|
||||
public String getHex() {
|
||||
return hex;
|
||||
}
|
||||
|
||||
public List<Cart> getCartList() {
|
||||
return cartList;
|
||||
}
|
||||
|
||||
public void setCartList(List<Cart> cartList) {
|
||||
this.cartList = cartList;
|
||||
}
|
||||
|
||||
public Integer getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public void setNum(Integer num) {
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
public Integer getBookId() {
|
||||
return bookId;
|
||||
}
|
||||
|
||||
public void setBookId(Integer bookId) {
|
||||
this.bookId = bookId;
|
||||
}
|
||||
|
||||
public Long getDays() {
|
||||
return days;
|
||||
}
|
||||
|
||||
public void setDays(Long days) {
|
||||
this.days = days;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getOrderNo() {
|
||||
return orderNo;
|
||||
}
|
||||
|
||||
public void setOrderNo(String orderNo) {
|
||||
this.orderNo = orderNo;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
67
src/main/java/com/example/entity/OrdersItem.java
Normal file
@ -0,0 +1,67 @@
|
||||
package com.example.entity;
|
||||
|
||||
/**
|
||||
* 订单明细
|
||||
*/
|
||||
public class OrdersItem {
|
||||
/** ID */
|
||||
private Integer id;
|
||||
/** 图书ID */
|
||||
private Integer bookId;
|
||||
/** 图书名称 */
|
||||
private String bookName;
|
||||
/** 图书封面 */
|
||||
private String bookCover;
|
||||
/** 数量 */
|
||||
private Integer num;
|
||||
/** 借书订单ID */
|
||||
private Integer orderId;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getBookId() {
|
||||
return bookId;
|
||||
}
|
||||
|
||||
public void setBookId(Integer bookId) {
|
||||
this.bookId = bookId;
|
||||
}
|
||||
|
||||
public String getBookName() {
|
||||
return bookName;
|
||||
}
|
||||
|
||||
public void setBookName(String bookName) {
|
||||
this.bookName = bookName;
|
||||
}
|
||||
|
||||
public String getBookCover() {
|
||||
return bookCover;
|
||||
}
|
||||
|
||||
public void setBookCover(String bookCover) {
|
||||
this.bookCover = bookCover;
|
||||
}
|
||||
|
||||
public Integer getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public void setNum(Integer num) {
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
public Integer getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public void setOrderId(Integer orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
}
|
133
src/main/java/com/example/entity/Posts.java
Normal file
@ -0,0 +1,133 @@
|
||||
package com.example.entity;
|
||||
|
||||
/**
|
||||
* 帖子
|
||||
*/
|
||||
public class Posts {
|
||||
/** ID */
|
||||
private Integer id;
|
||||
/** 标题 */
|
||||
private String title;
|
||||
/** 图片 */
|
||||
private String img;
|
||||
/** 标签 */
|
||||
private String tags;
|
||||
/** 内容 */
|
||||
private String content;
|
||||
/** 发布人ID */
|
||||
private Integer userId;
|
||||
/** 发布时间 */
|
||||
private String time;
|
||||
/** 阅读量 */
|
||||
private Integer readCount;
|
||||
/** 版块ID */
|
||||
private Integer sectionId;
|
||||
private String userName;
|
||||
private String sectionName;
|
||||
private String simpleContent;
|
||||
private Integer commentCount;
|
||||
|
||||
public Integer getCommentCount() {
|
||||
return commentCount;
|
||||
}
|
||||
|
||||
public void setCommentCount(Integer commentCount) {
|
||||
this.commentCount = commentCount;
|
||||
}
|
||||
|
||||
public String getSimpleContent() {
|
||||
return simpleContent;
|
||||
}
|
||||
|
||||
public void setSimpleContent(String simpleContent) {
|
||||
this.simpleContent = simpleContent;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getSectionName() {
|
||||
return sectionName;
|
||||
}
|
||||
|
||||
public void setSectionName(String sectionName) {
|
||||
this.sectionName = sectionName;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getImg() {
|
||||
return img;
|
||||
}
|
||||
|
||||
public void setImg(String img) {
|
||||
this.img = img;
|
||||
}
|
||||
|
||||
public String getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
public void setTags(String tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public Integer getReadCount() {
|
||||
return readCount;
|
||||
}
|
||||
|
||||
public void setReadCount(Integer readCount) {
|
||||
this.readCount = readCount;
|
||||
}
|
||||
|
||||
public Integer getSectionId() {
|
||||
return sectionId;
|
||||
}
|
||||
|
||||
public void setSectionId(Integer sectionId) {
|
||||
this.sectionId = sectionId;
|
||||
}
|
||||
}
|
22
src/main/java/com/example/entity/PostsSection.java
Normal file
@ -0,0 +1,22 @@
|
||||
package com.example.entity;
|
||||
|
||||
public class PostsSection {
|
||||
private Integer id;
|
||||
private String name;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
11
src/main/java/com/example/entity/Rem.java
Normal file
@ -0,0 +1,11 @@
|
||||
package com.example.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Rem {
|
||||
|
||||
private Integer id;
|
||||
private String score;
|
||||
|
||||
}
|
54
src/main/java/com/example/entity/Room.java
Normal file
@ -0,0 +1,54 @@
|
||||
package com.example.entity;
|
||||
|
||||
public class Room {
|
||||
/** ID */
|
||||
private Integer id;
|
||||
/** 名称 */
|
||||
private String name;
|
||||
/** 封面 */
|
||||
private String img;
|
||||
/** 位置 */
|
||||
private String location;
|
||||
/** 开放时间 */
|
||||
private String openTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getImg() {
|
||||
return img;
|
||||
}
|
||||
|
||||
public void setImg(String img) {
|
||||
this.img = img;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public String getOpenTime() {
|
||||
return openTime;
|
||||
}
|
||||
|
||||
public void setOpenTime(String openTime) {
|
||||
this.openTime = openTime;
|
||||
}
|
||||
}
|
75
src/main/java/com/example/entity/Seat.java
Normal file
@ -0,0 +1,75 @@
|
||||
package com.example.entity;
|
||||
|
||||
/**
|
||||
* 座位信息
|
||||
*/
|
||||
public class Seat {
|
||||
private Integer id;
|
||||
/** 编号 */
|
||||
private String no;
|
||||
/** 阅览室ID */
|
||||
private Integer roomId;
|
||||
/** 排 */
|
||||
private Integer row;
|
||||
/** 列 */
|
||||
private Integer col;
|
||||
/** 预约状态 */
|
||||
private String status;
|
||||
private String roomName;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getRoomName() {
|
||||
return roomName;
|
||||
}
|
||||
|
||||
public void setRoomName(String roomName) {
|
||||
this.roomName = roomName;
|
||||
}
|
||||
|
||||
public String getNo() {
|
||||
return no;
|
||||
}
|
||||
|
||||
public void setNo(String no) {
|
||||
this.no = no;
|
||||
}
|
||||
|
||||
public Integer getRoomId() {
|
||||
return roomId;
|
||||
}
|
||||
|
||||
public void setRoomId(Integer roomId) {
|
||||
this.roomId = roomId;
|
||||
}
|
||||
|
||||
public Integer getRow() {
|
||||
return row;
|
||||
}
|
||||
|
||||
public void setRow(Integer row) {
|
||||
this.row = row;
|
||||
}
|
||||
|
||||
public Integer getCol() {
|
||||
return col;
|
||||
}
|
||||
|
||||
public void setCol(Integer col) {
|
||||
this.col = col;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
76
src/main/java/com/example/entity/SeatReserve.java
Normal file
@ -0,0 +1,76 @@
|
||||
package com.example.entity;
|
||||
|
||||
public class SeatReserve {
|
||||
private Integer id;
|
||||
private Integer seatId;
|
||||
private Integer userId;
|
||||
private String time;
|
||||
private String status;
|
||||
private String roomName;
|
||||
private String seatNo;
|
||||
private String userName;
|
||||
|
||||
public String getRoomName() {
|
||||
return roomName;
|
||||
}
|
||||
|
||||
public void setRoomName(String roomName) {
|
||||
this.roomName = roomName;
|
||||
}
|
||||
|
||||
public String getSeatNo() {
|
||||
return seatNo;
|
||||
}
|
||||
|
||||
public void setSeatNo(String seatNo) {
|
||||
this.seatNo = seatNo;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getSeatId() {
|
||||
return seatId;
|
||||
}
|
||||
|
||||
public void setSeatId(Integer seatId) {
|
||||
this.seatId = seatId;
|
||||
}
|
||||
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
95
src/main/java/com/example/entity/Sign.java
Normal file
@ -0,0 +1,95 @@
|
||||
package com.example.entity;
|
||||
|
||||
/**
|
||||
* 活动报名
|
||||
*/
|
||||
public class Sign {
|
||||
/** ID */
|
||||
private Integer id;
|
||||
/** 活动ID */
|
||||
private Integer activityId;
|
||||
/** 用户ID */
|
||||
private Integer userId;
|
||||
/** 报名时间 */
|
||||
private String time;
|
||||
/** 是否签到 */
|
||||
private String sign;
|
||||
/** 姓名 */
|
||||
private String name;
|
||||
/** 联系方式 */
|
||||
private String phone;
|
||||
private String userName;
|
||||
private String activityName;
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getActivityName() {
|
||||
return activityName;
|
||||
}
|
||||
|
||||
public void setActivityName(String activityName) {
|
||||
this.activityName = activityName;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getActivityId() {
|
||||
return activityId;
|
||||
}
|
||||
|
||||
public void setActivityId(Integer activityId) {
|
||||
this.activityId = activityId;
|
||||
}
|
||||
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public String getSign() {
|
||||
return sign;
|
||||
}
|
||||
|
||||
public void setSign(String sign) {
|
||||
this.sign = sign;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
}
|
88
src/main/java/com/example/entity/User.java
Normal file
@ -0,0 +1,88 @@
|
||||
package com.example.entity;
|
||||
|
||||
public class User extends Account {
|
||||
|
||||
/** 主键ID */
|
||||
private Integer id;
|
||||
/** 账号 */
|
||||
private String username;
|
||||
private String password;
|
||||
private String name;
|
||||
private String avatar;
|
||||
private String role;
|
||||
private String phone;
|
||||
private String email;
|
||||
private Integer score;
|
||||
|
||||
public Integer getScore() {
|
||||
return score;
|
||||
}
|
||||
|
||||
public void setScore(Integer score) {
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(String role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
}
|
30
src/main/java/com/example/exception/BusinessException.java
Normal file
@ -0,0 +1,30 @@
|
||||
package com.example.exception;
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 业务异常
|
||||
*/
|
||||
@Component
|
||||
public class BusinessException extends RuntimeException {
|
||||
@Resource
|
||||
ApplicationContext context;
|
||||
|
||||
|
||||
|
||||
}
|
35
src/main/java/com/example/exception/CustomException.java
Normal file
@ -0,0 +1,35 @@
|
||||
package com.example.exception;
|
||||
|
||||
import com.example.common.enums.ResultCodeEnum;
|
||||
|
||||
public class CustomException extends RuntimeException {
|
||||
|
||||
private String code;
|
||||
private String msg;
|
||||
|
||||
public CustomException(String code, String msg) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public CustomException(ResultCodeEnum resultCodeEnum) {
|
||||
this.code = resultCodeEnum.code;
|
||||
this.msg = resultCodeEnum.msg;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.example.exception;
|
||||
|
||||
import cn.hutool.log.Log;
|
||||
import cn.hutool.log.LogFactory;
|
||||
import com.example.common.Result;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
@ControllerAdvice("com.example.controller")
|
||||
public class GlobalExceptionHandler {
|
||||
|
||||
private static final Log log = LogFactory.get();
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
@ResponseBody // 返回json串
|
||||
public Result error(Exception e) {
|
||||
log.error("异常信息:", e);
|
||||
return Result.error();
|
||||
}
|
||||
|
||||
@ExceptionHandler(CustomException.class)
|
||||
@ResponseBody // 返回json串
|
||||
public Result error(CustomException e) {
|
||||
// log.error("异常信息:", e);
|
||||
return Result.error(e.getCode(), e.getMsg());
|
||||
}
|
||||
}
|
21
src/main/java/com/example/mapper/ActivityMapper.java
Normal file
@ -0,0 +1,21 @@
|
||||
package com.example.mapper;
|
||||
|
||||
import com.example.entity.Activity;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ActivityMapper {
|
||||
|
||||
int insert(Activity activity);
|
||||
|
||||
void updateById(Activity activity);
|
||||
|
||||
void deleteById(Integer id);
|
||||
|
||||
@Select("select * from `activity` where id = #{id}")
|
||||
Activity selectById(Integer id);
|
||||
|
||||
List<Activity> selectAll(Activity activity);
|
||||
|
||||
}
|
24
src/main/java/com/example/mapper/AdminMapper.java
Normal file
@ -0,0 +1,24 @@
|
||||
package com.example.mapper;
|
||||
|
||||
import com.example.entity.Admin;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AdminMapper {
|
||||
|
||||
int insert(Admin admin);
|
||||
|
||||
void updateById(Admin admin);
|
||||
|
||||
void deleteById(Integer id);
|
||||
|
||||
@Select("select * from `admin` where id = #{id}")
|
||||
Admin selectById(Integer id);
|
||||
|
||||
@Select("select * from `admin` where username = #{username}")
|
||||
Admin selectByUsername(String username);
|
||||
|
||||
List<Admin> selectAll(Admin admin);
|
||||
|
||||
}
|