Compare commits

..

7 Commits

Author SHA1 Message Date
刘科文 9aff768e6a 10
3 months ago
刘科文 cfdf53d716 测似9
3 months ago
lkw2731938298 e0345a5b3e 1
3 months ago
lkw2731938298 1023517fdb 4
3 months ago
lkw2731938298 f6894d3885 测试5
3 months ago
lkw2731938298 2930c302fd Merge branch 'modify1' of https://bdgit.educoder.net/pcygfhfke/ECOM-SpringBoot-Vue
3 months ago
lkw2731938298 c0cd29ef64 测试代码量
3 months ago

8
.idea/.gitignore vendored

@ -1,8 +0,0 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

@ -1,7 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<ScalaCodeStyleSettings>
<option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
</ScalaCodeStyleSettings>
</code_scheme>
</component>

@ -1,5 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/superMarket-backend/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21.0.2" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/远程测试仓库1.iml" filepath="$PROJECT_DIR$/.idea/远程测试仓库1.iml" />
</modules>
</component>
</project>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -1,32 +1,67 @@
3245
23452
523
62
62
23
42234
2
3424
253262
5
6
24
524
6252
3
3
3
3
33
3
3
3
33
3
3
3
3
3
34
34
333
33
3
3
33
3
3
342
2
5252
5
66
7878
32
525
2
52
52
5
25
2
523414
14
1
4131
3
3247534
31
5125
41
4
14
14
14
1515
3
616
615
14
14
1
4
673464
36
3635
3
63
63
453
45
3242
352
52
523
5234
2
14321
12
412
41

@ -19,9 +19,9 @@ public class BackendApplication {
public static void main(String[] args) {
//SpringBoot 执行启动
// 执行启动
SpringApplication.run(BackendApplication.class, args);
//执行启动输出
log.info("=====================项目后端启动成功============================");
}

@ -1,53 +1,33 @@
// 包声明:定义当前类所在的包路径
package com.shanzhu.market.common.advice;
// 定义当前类所在的包路径
import com.shanzhu.market.common.constants.HttpStatus;
// 导入包含HTTP状态码常量的工具类
import com.shanzhu.market.common.exception.BusinessException;
// 导入自定义的业务异常类
import com.shanzhu.market.common.web.response.JsonResult;
// 导入用于封装JSON响应结果的工具类
import org.springframework.web.bind.annotation.ExceptionHandler;
// 导入Spring框架的异常处理注解
import org.springframework.web.bind.annotation.RestControllerAdvice;
// 导入Spring框架的全局异常处理注解
// 导入依赖的类库
import com.shanzhu.market.common.constants.HttpStatus; // HTTP状态码常量
import com.shanzhu.market.common.exception.BusinessException; // 自定义业务异常
import com.shanzhu.market.common.web.response.JsonResult; // 统一响应格式工具类
import org.springframework.web.bind.annotation.ExceptionHandler; // Spring异常处理注解
import org.springframework.web.bind.annotation.RestControllerAdvice; // Spring控制器增强注解
/**
*
*
*/
@RestControllerAdvice
// 声明该类为全局异常处理类返回JSON格式的响应
@RestControllerAdvice // 标识该类为全局REST控制器异常处理器
public class ExceptionControllerAdvice {
// 处理所有RuntimeException及其子类异常
@ExceptionHandler(RuntimeException.class)
// 声明方法处理RuntimeException类型的异常
public JsonResult<?> commonExceptionHandler(RuntimeException ex){
// 定义处理RuntimeException异常的方法返回JsonResult对象
ex.printStackTrace();
// 打印异常堆栈信息到控制台
return JsonResult.error(HttpStatus.CODE_BUSINESS_ERROR,ex.getMessage());
// 返回封装的错误响应,包含状态码和异常信息
ex.printStackTrace(); // 打印异常堆栈跟踪(生产环境建议替换为日志记录)
return JsonResult.error( // 返回标准错误响应
HttpStatus.CODE_BUSINESS_ERROR, // 使用预定义的业务错误码
ex.getMessage()); // 携带异常消息
}
// 专门处理自定义业务异常
@ExceptionHandler(BusinessException.class)
// 声明方法处理BusinessException类型的异常
public JsonResult<?> businessHanler(BusinessException ex){
// 定义处理BusinessException异常的方法返回JsonResult对象
return JsonResult.error(HttpStatus.CODE_BUSINESS_ERROR,ex.getMessage());
// 返回封装的错误响应,包含状态码和异常信息
return JsonResult.error( // 返回标准错误响应
HttpStatus.CODE_BUSINESS_ERROR, // 使用相同的业务错误码保持一致性
ex.getMessage()); // 携带业务异常消息
}
}
}

@ -0,0 +1,20 @@
package com.shanzhu.market.common.config;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class MpConfig {
/*mybatis plus分页插件生效*/
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(DbType.MYSQL);
paginationInnerInterceptor.setOverflow(true); //合理化
interceptor.addInnerInterceptor(paginationInnerInterceptor);
return interceptor;
}
}

@ -1,20 +1,31 @@
// 定义当前类所在的包路径
package com.shanzhu.market.common.config;
// 导入需要的类库
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
// 声明这是一个Spring配置类
@Configuration
// 定义MyBatis-Plus配置类
public class MpConfig {
// 配置MyBatis-Plus分页插件的Bean
/*mybatis plus分页插件生效*/
@Bean
// 创建MyBatis-Plus拦截器实例
public MybatisPlusInterceptor mybatisPlusInterceptor() {
// 实例化MyBatis-Plus拦截器
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
// 创建MySQL分页拦截器实例指定数据库类型为MySQL
PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(DbType.MYSQL);
// 设置溢出时自动调整到合理页码(合理化配置)
paginationInnerInterceptor.setOverflow(true); //合理化
// 将分页拦截器添加到拦截器链中
interceptor.addInnerInterceptor(paginationInnerInterceptor);
// 返回配置好的拦截器实例
return interceptor;
}
}

@ -1,13 +1,23 @@
package com.shanzhu.market.common.exception;
// 声明当前类所在的包路径(异常处理模块的基础包)
import com.shanzhu.market.common.constants.HttpStatus;
// 导入包含HTTP状态码常量的工具类
public class BusinessException extends SysException {
// 定义业务异常类继承自系统基础异常类SysException
public BusinessException(String message, Integer code) {
// 全参数构造方法(接收自定义错误消息和数字状态码)
super(message, code);
// 调用父类构造器初始化异常基类属性
}
public BusinessException(String msg) {
// 简化构造方法(仅接收错误消息参数)
super(msg, HttpStatus.CODE_BUSINESS_ERROR);
// 调用父类构造器,使用预定义的业务异常状态码常量
}
}

@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>超市管理系统</title>
<title>电商管理系统</title>
</head>
<body>
<noscript>

@ -6,7 +6,7 @@
</el-breadcrumb><br />
<div id="home_bg">
<h1 style="color: white;font-size: 28px;text-align: center;width: 1024px;">欢迎访问超市管理系统</h1>
<a href="/软件工程/ecom/ECOM-SpringBoot-Vue/电商管理平台数据可视化/index.html"> <h1 style="color: white;font-size: 28px;text-align: center;width: 1024px;">欢迎访问电商管理系统</h1></a>
</div>
</div>

@ -7,7 +7,7 @@
style="color: white; font-size: 32px"
class="iconfont icon-r-building"
>
<b style="font-size: 26px"> 超市管理系统</b></i
<b style="font-size: 26px"> 电商管理系统</b></i
>
</el-col>
<el-col

Loading…
Cancel
Save