diff --git a/Readme.md b/Readme.md
index 11476be029a45501fa9871a01271e119ab05d187..dc2e4f3f3d57a4f910ef1297dc12d059288e96f9 100644
--- a/Readme.md
+++ b/Readme.md
@@ -1,172 +1,37 @@
-todo 晚点Typora写好再复制上来
+# databaseTool
-工具开发模板 SpringIOC容器版本
-主要是为了方便工具开发
-注意action并没有受Spring管理
+#### 介绍
+databaseTool
-可以使用切面技术
+#### 软件架构
+软件架构说明
-```xml
-
- org.springframework
- spring-aspects
- 4.3.7.RELEASE
-
-```
-### :warning:前端项目版本说明
+#### 安装教程
-- NodeJS版本:`'^18.0.0 || >=20.0.0'`
-- yarn版本:`>=1.22.19`【如果使用yarn】
-- npm版本:`>=8.0.0`【如果使用npm】
-- vite版本:`^5.0.0`,此版本必须要求NodeJS版本在18或20及以上。(来自:https://cn.vitejs.dev/guide/)
+1. xxxx
+2. xxxx
+3. xxxx
-### 前端项目启动前的配置
+#### 使用说明
-#### 前端修改工具名称
+1. xxxx
+2. xxxx
+3. xxxx
-在项目目录下的`.env`文件里修改`VITE_APP_TITLE`属性的值,例如:
+#### 参与贡献
-```properties
-VITE_APP_TITLE=XXX工具
-```
+1. Fork 本仓库
+2. 新建 Feat_xxx 分支
+3. 提交代码
+4. 新建 Pull Request
-#### 配置ESLint和Prettier实现代码规范化(可选)
-项目中的ESLint和Prettier的依赖和配置都已搭好,为了使其生效,我们需要安装VS Code插件 `ESLint` 和 `Prettier`。
+#### 特技
-安装好两个插件后,在项目根目录添加`.vscode`文件夹并且新建一个`settings.json`文件
-
-```bash
-# Create directory
-mkdir .vscode
-# Create settings.json file
-touch .vscode/settings.json
-```
-
-配置保存时使用`Prettier`对代码进行格式化, 在`settings.json`文件中增加如下内容:
-
-```json
-// settings.json
-{
- "editor.defaultFormatter": "esbenp.prettier-vscode",
- "editor.formatOnSave": true,
- "editor.codeActionsOnSave": {
- "source.organizeImports": true,
- "source.fixAll": true
- }
-}
-```
-
-这样可以通过键盘快捷键或在保存文件时自动从编辑器中运行 `Prettier`,从而充分利用它。当一行在编码时变得太长,以至于不适合你的屏幕时,只需按保存快捷键,就可以看到它神奇地被包裹成多行!或者,当你粘贴一些代码时,缩进会变得一团糟,让 `Prettier` 在不离开编辑器的情况下为你修复它。
-
-最后要记得配置使用格式化,在`.vue`或`.ts`等文件右键,然后执行如下操作:
-
-
-
-
-
-### 后端项目启动前的配置
-
-#### 修改项目名称
-
-1. 第一步:修改项目名称
-
- - 修改 ToolTemplate-Java ——–> 自定义项目名
-
-2. 第二步:修改包名
-
-3. 第三步:修改`com.wetoband.template.action`包下的类名
-
- - ToolTemplateAction ——> 自定义类名
-
- - 同时修改`src`下的`config.xml`的配置:
-
- ```diff
-
-
-
- 3.0
-
- + action包下的类的全路径
-
- {aid:"21419389378723787447"}
-
- http://127.0.0.1:8080
-
- ```
-
-4. 修改`pom.xml`的名称
-
-#### 导入项目依赖的jar包
-
-1. 导入项目路径下的`lib`
-2. 导入项目路径下的`WebRoot/WEB-INF/lib`
-
-#### 设置WebRoot为项目的web
-
-1. 进入idea的Project Structure,找到Modules下的项目并展开
-2. 点击上面的加号,在菜单中选中`web`
-3. 修改弹出的右侧设置
- 1. 修改`Deployment Descriptors`的Path为WebRoot下的web.xml
- 2. 修改`Web Resource Directories`下的`Web Resource Director`的路径为WebRoot路径
-
-#### 添加Tomcat服务器
-
-点击idea界面右上角的`Add Configuration`,进去添加一个Tomcat服务器就可以运行了。
-
-#### 修改AppConfig.java的ComponentScan注解
-
-```java
-@ComponentScan("Java项目的包路径")
-```
-
-如模板中的就是:`com.wetoband.template`
-
-### 启动项目
-
-#### 启动前端
-
-- 第一步:yarn install
-
-- 第二步:yarn run dev
-
-#### 启动后端
-
-- 第一步:在idea中配置tomcat
-
-- 第二步:启动tomcat
-
-#### 运行成功效果
-
-分别点击页面的`发送GET请求`和`发送POST请求`按钮,出现如下结果即为成功:
-
-
-
-
-
-
-
-切换About路由页面:
-
-
-
-切换Background路由:
-
-
-
-### 打包项目
-
-#### 打包前端
-
-- 第一步:执行 yarn run build 或 yarn build 命令,会在项目目录下生成一个dist目录
-
-#### 打包后端
-
-- 第一步:把前端生成的dist目录下的所有文件放到后端项目的WebRoot目录下的resource目录中
-- 第二步:执行Maven的 clean 和 package 指令,会在target目录下生成一个jar包文件。
-
-### :warning:注意事项
-
-1. 项目路径不可为中文路径;
-2. 前端路由最好使用Hash;
+1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
+2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
+3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
+4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
+5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
+6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
diff --git a/java/src/com/wtb/javatool/action/JavaToolDemoAction.java b/java/src/com/wtb/javatool/action/JavaToolDemoAction.java
index a1edc6cde6adaabf8bf2a83eeb75bf7223a609d0..001f4605181c4912694b1515c9315dcb208c4fde 100644
--- a/java/src/com/wtb/javatool/action/JavaToolDemoAction.java
+++ b/java/src/com/wtb/javatool/action/JavaToolDemoAction.java
@@ -3,8 +3,10 @@ package com.wtb.javatool.action;
import com.fy.wetoband.tool.Tool;
import com.fy.wetoband.utils.RequestUtil;
import com.wtb.javatool.common.Result;
+import com.wtb.javatool.entity.ApplyBuild;
import com.wtb.javatool.entity.Dish;
import com.wtb.javatool.entity.User;
+import com.wtb.javatool.service.IApplyService;
import com.wtb.javatool.service.IDishService;
import com.wtb.javatool.service.IStudent;
import com.wtb.javatool.vo.DishDto;
@@ -17,6 +19,9 @@ import org.springframework.context.annotation.Scope;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -34,6 +39,9 @@ public class JavaToolDemoAction extends Tool {
@Autowired
private IStudent studentService;
+ @Autowired
+ private IApplyService iApplyService;
+
@Action
@ApiOperation(value = "添加菜品", httpMethod = "POST", notes = "添加菜品信息")
@ApiImplicitParams({
@@ -137,14 +145,14 @@ public class JavaToolDemoAction extends Tool {
@Action
- @ApiOperation(value = "学生申请自建数据库", httpMethod = "POST", notes = "学生申请自建数据库")
+ @ApiOperation(value = "测试", httpMethod = "POST", notes = "测试")
@ApiImplicitParams({
@ApiImplicitParam(name = "studentId", dataType = "long", value = "学生ID", required = true),
@ApiImplicitParam(name = "courseId", dataType = "long", value = "课程ID", required = true)})
@ApiResponses({
@ApiResponse(code = 200, message = "成功发送申请", response = Result.class)
})
- public Result> applyByCourseId(HttpServletRequest request,HttpServletResponse response){
+ public Result> test(HttpServletRequest request,HttpServletResponse response){
// Long studentId = RequestUtil.getLongParameter(request, "studentId");
// Long courseId = RequestUtil.getLongParameter(request, "courseId");
@@ -156,6 +164,188 @@ public class JavaToolDemoAction extends Tool {
}
+ @Action
+ @ApiOperation(value = "学生申请自建数据库", httpMethod = "POST", notes = "学生申请自建数据库")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "userId", dataType = "long", value = "学生ID", required = true),
+ @ApiImplicitParam(name = "classId", dataType = "long", value = "课程ID", required = true)})
+ @ApiResponses({
+ @ApiResponse(code = 200, message = "成功发送申请", response = Result.class)
+ })
+ public Result applyByCourseId(HttpServletRequest request,HttpServletResponse response){
+
+ Long userId = RequestUtil.getLongParameter(request, "userId");
+ Long classId = RequestUtil.getLongParameter(request, "classId");
+ Integer dataBaseId = RequestUtil.getIntegerParameter(request, "dataBaseId");
+ String description = RequestUtil.getStringParameter(request, "description");
+
+ Long approverId = RequestUtil.getLongParameter(request, "approverId");
+
+ ApplyBuild applyBuild = new ApplyBuild();
+
+ applyBuild.setUserId(userId);
+ applyBuild.setClassId(classId);
+ applyBuild.setDataBaseId(dataBaseId);
+ applyBuild.setDescription(description);
+ applyBuild.setApproverId(approverId);
+
+ //创建Calendar对象
+ Calendar cal=Calendar.getInstance();
+
+ //用Calendar类提供的方法获取年、月、日、时、分、秒
+ int year =cal.get(Calendar.YEAR); //年
+ int month =cal.get(Calendar.MONTH)+1; //月 默认是从0开始 即1月获取到的是0
+ int day =cal.get(Calendar.DAY_OF_MONTH); //日,即一个月中的第几天
+ int hour =cal.get(Calendar.HOUR_OF_DAY); //小时
+ int minute=cal.get(Calendar.MINUTE); //分
+ int second=cal.get(Calendar.SECOND); //秒
+
+ //拼接成字符串输出
+ String date=year+"-"+month+"-"+day+" "+hour+":"+minute+":"+second;
+
+ applyBuild.setCreateTime(date);
+ applyBuild.setStatus(0);
+
+ final Integer integer = iApplyService.applyByCourseId(applyBuild);
+
+
+ if(integer <= 0){
+ return Result.error("申请失败");
+ }
+
+ return Result.success("申请成功");
+
+ }
+
+
+ @Action
+ @ApiOperation(value = "教师审批自建数据库请求", httpMethod = "POST", notes = "教师审批自建数据库请求")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "applyId", dataType = "Integer", value = "请求id", required = true)
+ })
+ @ApiResponses({
+ @ApiResponse(code = 200, message = "成功发送申请", response = Result.class)
+ })
+ public Result approveApply(HttpServletRequest request,HttpServletResponse response){
+
+ Integer applyId = RequestUtil.getIntegerParameter(request, "applyId");//获取此次申请的编号
+ Integer status = RequestUtil.getIntegerParameter(request, "status");//获取此次审批是否同意,教师同意应当将status设置为1
+
+ Long userId = RequestUtil.getLongParameter(request, "userId");
+ Long classId = RequestUtil.getLongParameter(request, "classId");
+ Integer dataBaseId = RequestUtil.getIntegerParameter(request, "dataBaseId");
+ String description = RequestUtil.getStringParameter(request, "description");
+
+ Long approverId = RequestUtil.getLongParameter(request, "approverId");
+ String createTime = RequestUtil.getStringParameter(request, "createTime");
+ Long authorizedId = RequestUtil.getLongParameter(request, "authorizedId");
+
+ ApplyBuild applyBuild = new ApplyBuild();
+
+ applyBuild.setUserId(userId);
+ applyBuild.setClassId(classId);
+ applyBuild.setDataBaseId(dataBaseId);
+ applyBuild.setDescription(description);
+ applyBuild.setApproverId(approverId);
+ applyBuild.setCreateTime(createTime);
+
+ //创建Calendar对象
+ Calendar cal=Calendar.getInstance();
+
+ //用Calendar类提供的方法获取年、月、日、时、分、秒
+ int year =cal.get(Calendar.YEAR); //年
+ int month =cal.get(Calendar.MONTH)+1; //月 默认是从0开始 即1月获取到的是0
+ int day =cal.get(Calendar.DAY_OF_MONTH); //日,即一个月中的第几天
+ int hour =cal.get(Calendar.HOUR_OF_DAY); //小时
+ int minute=cal.get(Calendar.MINUTE); //分
+ int second=cal.get(Calendar.SECOND); //秒
+
+ //拼接成字符串输出
+ String approveTime =year+"-"+month+"-"+day+" "+hour+":"+minute+":"+second;
+
+ applyBuild.setId(applyId);//设置此次申请的编号
+ applyBuild.setApproveTime(approveTime);//设置此次申请的审批时间
+ applyBuild.setStatus(status);//设置是否通过审批
+ applyBuild.setAuthorizedId(authorizedId);//设置交给哪个管理员进行下一步授权
+
+
+ final Integer update = iApplyService.approveApply(applyBuild);
+
+
+ if (update<=0){
+ return Result.error("审批失败");
+ }
+ return Result.success("审批成功");
+
+ }
+
+
+ @Action
+ @ApiOperation(value = "管理员授权自建数据库请求", httpMethod = "POST", notes = "管理员授权自建数据库请求")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "applyId", dataType = "Integer", value = "请求id", required = true)
+ })
+ @ApiResponses({
+ @ApiResponse(code = 200, message = "成功发送申请", response = Result.class)
+ })
+ public Result authorizedApply(HttpServletRequest request,HttpServletResponse response){
+
+ Integer applyId = RequestUtil.getIntegerParameter(request, "applyId");//获取此次申请的编号
+ Integer status = RequestUtil.getIntegerParameter(request, "status");//获取此次授权是否同意,
+ // 管理员同意应当将status设置为2,否则设置为1
+
+ Long userId = RequestUtil.getLongParameter(request, "userId");
+ Long classId = RequestUtil.getLongParameter(request, "classId");
+ Integer dataBaseId = RequestUtil.getIntegerParameter(request, "dataBaseId");
+ String description = RequestUtil.getStringParameter(request, "description");
+
+ Long approverId = RequestUtil.getLongParameter(request, "approverId");
+ String createTime = RequestUtil.getStringParameter(request, "createTime");
+ Long authorizedId = RequestUtil.getLongParameter(request, "authorizedId");
+ String approveTime = RequestUtil.getStringParameter(request, "approveTime");//要获取教师审核的时间
+
+ ApplyBuild applyBuild = new ApplyBuild();
+
+ applyBuild.setUserId(userId);
+ applyBuild.setClassId(classId);
+ applyBuild.setDataBaseId(dataBaseId);
+ applyBuild.setDescription(description);
+ applyBuild.setApproverId(approverId);
+ applyBuild.setCreateTime(createTime);
+ applyBuild.setApproveTime(approveTime);
+ applyBuild.setAuthorizedId(authorizedId);
+
+ //创建Calendar对象
+ Calendar cal=Calendar.getInstance();
+
+ //用Calendar类提供的方法获取年、月、日、时、分、秒
+ int year =cal.get(Calendar.YEAR); //年
+ int month =cal.get(Calendar.MONTH)+1; //月 默认是从0开始 即1月获取到的是0
+ int day =cal.get(Calendar.DAY_OF_MONTH); //日,即一个月中的第几天
+ int hour =cal.get(Calendar.HOUR_OF_DAY); //小时
+ int minute=cal.get(Calendar.MINUTE); //分
+ int second=cal.get(Calendar.SECOND); //秒
+
+ //拼接成字符串输出
+ String authorizedTime =year+"-"+month+"-"+day+" "+hour+":"+minute+":"+second;
+
+ applyBuild.setId(applyId);//设置此次申请的编号
+ applyBuild.setAuthorizedTime(authorizedTime);//设置此次申请的授权时间
+ applyBuild.setStatus(status);//设置是否通过审批
+
+
+
+ final Integer update = iApplyService.authorizedApply(applyBuild);
+
+
+ if (update<=0){
+ return Result.error("授权失败");
+ }
+ return Result.success("授权成功");
+
+ }
+
+
diff --git a/java/src/com/wtb/javatool/dao/ApplyMapper.java b/java/src/com/wtb/javatool/dao/ApplyMapper.java
new file mode 100644
index 0000000000000000000000000000000000000000..e5844c17cc5529b62f27aa68a54598033f348716
--- /dev/null
+++ b/java/src/com/wtb/javatool/dao/ApplyMapper.java
@@ -0,0 +1,16 @@
+package com.wtb.javatool.dao;
+
+
+import com.wtb.javatool.entity.ApplyBuild;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface ApplyMapper {
+
+ Integer applyByCourseId(ApplyBuild applyBuild);
+
+
+ Integer approveApply(ApplyBuild applyBuild);
+
+ Integer authorizedApply(ApplyBuild applyBuild);
+}
diff --git a/java/src/com/wtb/javatool/entity/ApplyBuild.java b/java/src/com/wtb/javatool/entity/ApplyBuild.java
new file mode 100644
index 0000000000000000000000000000000000000000..adbb6d1ffc9cc9a5d966aec44aa1926b50cb4fe0
--- /dev/null
+++ b/java/src/com/wtb/javatool/entity/ApplyBuild.java
@@ -0,0 +1,52 @@
+package com.wtb.javatool.entity;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.ToString;
+
+/**
+ * 创建申请表
+ * @author yangzhuoheng
+ *
+ */
+@Data
+@ToString
+@ApiModel(value = "apply_build",description="创建申请")
+public class ApplyBuild {
+
+ @ApiModelProperty(value = "id")
+ private Integer id;
+
+ @ApiModelProperty(value = "用户Id")
+ private Long userId;
+
+ @ApiModelProperty(value = "班级id")
+ private Long classId;
+
+ @ApiModelProperty(value = "数据库Id")
+ private Integer dataBaseId;
+
+ @ApiModelProperty(value = "描述")
+ private String description;
+
+ @ApiModelProperty(value = "授权人Id,管理员")
+ private Long authorizedId;
+
+ @ApiModelProperty(value = "审批人Id,教师")
+ private Long approverId;
+
+ @ApiModelProperty(value = "创建时间")
+ private String createTime;
+
+ @ApiModelProperty(value = "状态,0表示已向老师发送申请但未同意,1表示老师同意并且已向管理员发送申请但未授权,2表示管理员审批成功整个流程完成")
+ private Integer status;
+
+ @ApiModelProperty(value = "审批时间")
+ private String approveTime;
+
+ @ApiModelProperty(value = "授权时间")
+ private String authorizedTime;
+
+
+}
diff --git a/java/src/com/wtb/javatool/entity/ApplyView.java b/java/src/com/wtb/javatool/entity/ApplyView.java
new file mode 100644
index 0000000000000000000000000000000000000000..01b3cf0faebef6312c9a6884714c39324ba35f45
--- /dev/null
+++ b/java/src/com/wtb/javatool/entity/ApplyView.java
@@ -0,0 +1,46 @@
+package com.wtb.javatool.entity;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.ToString;
+
+/**
+ * 查看申请表
+ * @author yangzhuoheng
+ *
+ */
+@Data
+@ToString
+@ApiModel(value = "apply_view",description="查看申请")
+public class ApplyView {
+
+ @ApiModelProperty(value = "id")
+ private Integer id;
+
+ @ApiModelProperty(value = "用户Id")
+ private Long userId;
+
+ @ApiModelProperty(value = "数据库Id")
+ private Integer databaseId;
+
+ @ApiModelProperty(value = "描述")
+ private String description;
+
+ @ApiModelProperty(value = "审批人Id")
+ private Long approverId;
+
+ @ApiModelProperty(value = "创建时间")
+ private String createTime;
+
+ @ApiModelProperty(value = "状态,0表示已向老师发送申请但未同意,1表示老师同意并且已向管理员发送申请但未授权,2表示管理员审批成功整个流程完成")
+ private Integer status;
+
+
+
+
+
+
+
+
+}
diff --git a/java/src/com/wtb/javatool/entity/User.java b/java/src/com/wtb/javatool/entity/User.java
index 484b40e85ae7a7e82ee91e8726a89f6cf06bc6f5..8192bc73129718633fad830ba8043d228fd05bae 100644
--- a/java/src/com/wtb/javatool/entity/User.java
+++ b/java/src/com/wtb/javatool/entity/User.java
@@ -23,7 +23,7 @@ public class User {
@ApiModelProperty(value = "用户名")
private String userName;
- @ApiModelProperty(value = "角色id")
+ @ApiModelProperty(value = "角色id,0表示学生,1表示老师,2表示管理员")
private Integer roleId;
diff --git a/java/src/com/wtb/javatool/service/IApplyService.java b/java/src/com/wtb/javatool/service/IApplyService.java
index 7d1cc4549c4fca39da096cb9246ed3b9e4cff16a..ecb3b2ad5bfaf093686c3fbea264ed962a650a76 100644
--- a/java/src/com/wtb/javatool/service/IApplyService.java
+++ b/java/src/com/wtb/javatool/service/IApplyService.java
@@ -1,6 +1,7 @@
package com.wtb.javatool.service;
import com.wtb.javatool.common.Result;
+import com.wtb.javatool.entity.ApplyBuild;
public interface IApplyService {
@@ -10,6 +11,13 @@ public interface IApplyService {
* @param courseId 课程ID
* @return 申请结果
*/
- Result applyByCourseId(Long studentId, Long courseId);
+ Result apply(Long studentId, Long courseId);//测试用
+
+ Integer applyByCourseId(ApplyBuild applyBuild);
+
+
+ Integer approveApply(ApplyBuild applyBuild);
+
+ Integer authorizedApply(ApplyBuild applyBuild);
}
diff --git a/java/src/com/wtb/javatool/service/impl/ApplyServiceImpl.java b/java/src/com/wtb/javatool/service/impl/ApplyServiceImpl.java
index a9c9cc3f57f711ac527806ebb2cf04b2ef092df7..716284efc16a45f64691831a9356aa2fa0017ad3 100644
--- a/java/src/com/wtb/javatool/service/impl/ApplyServiceImpl.java
+++ b/java/src/com/wtb/javatool/service/impl/ApplyServiceImpl.java
@@ -1,37 +1,63 @@
package com.wtb.javatool.service.impl;
import com.wtb.javatool.common.Result;
+import com.wtb.javatool.dao.ApplyMapper;
+import com.wtb.javatool.entity.ApplyBuild;
import com.wtb.javatool.service.IApplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import javax.persistence.criteria.CriteriaBuilder;
import java.util.Objects;
-//@Service
-//public class ApplyServiceImpl implements IApplyService {
-//
-//// @Autowired
-//// private DatabaseApplicationMapper databaseApplicationMapper;
-////
-//// @Autowired
-//// private StudentCourseMapper studentCourseMapper;
-////
-//
-//
-// @Override
-// @Transactional(rollbackFor = Exception.class)
-// public Result applyByCourseId(Long studentId, Long courseId) {
-// // 参数校验
-// if (Objects.isNull(studentId)) {
-// throw new RuntimeException("学生ID不能为空且必须大于0");
-// }
-// if (Objects.isNull(courseId)) {
-// throw new RuntimeException("课程ID不能为空且必须大于0");
-// }
-//
-//
+@Service
+public class ApplyServiceImpl implements IApplyService {
+
+ @Autowired
+ private ApplyMapper applyMapper;
+
+
+ @Override
+ public Integer applyByCourseId(ApplyBuild applyBuild) {
+
+ Integer integer = applyMapper.applyByCourseId(applyBuild);
+
+ return integer;
+ }
+
+ @Override
+ public Integer approveApply(ApplyBuild applyBuild) {
+
+ Integer integer = applyMapper.approveApply(applyBuild);
+
+ return integer;
+ }
+
+ @Override
+ public Integer authorizedApply(ApplyBuild applyBuild) {
+
+ Integer integer = applyMapper.authorizedApply(applyBuild);
+
+ System.out.println(applyBuild);
+
+ return integer;
+ }
+
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Result apply(Long studentId, Long courseId) {
+ // 参数校验
+ if (Objects.isNull(studentId)) {
+ throw new RuntimeException("学生ID不能为空且必须大于0");
+ }
+ if (Objects.isNull(courseId)) {
+ throw new RuntimeException("课程ID不能为空且必须大于0");
+ }
+
+
// // 创建数据库申请记录
// DatabaseApplication application = new DatabaseApplication();
// application.setStudentId(studentId);
@@ -46,16 +72,16 @@ import java.util.Objects;
// if (rows <= 0) {
// throw new BusinessException("数据库申请提交失败");
// }
-//
-// // 这里可以添加异步任务,通知管理员审核
-//
-// return Result.success("数据库申请已提交,等待审核");
-// }
-//}
-//
-//
-//
-//
-//
-//
-//}
+
+ // 这里可以添加异步任务,通知管理员审核
+
+ return Result.success("数据库申请已提交,等待审核");
+ }
+}
+
+
+
+
+
+
+
diff --git a/java/src/mappers/ApplyMapper.xml b/java/src/mappers/ApplyMapper.xml
new file mode 100644
index 0000000000000000000000000000000000000000..68d6a65fc04627e9e3f41ca43d36c4f1fe1737aa
--- /dev/null
+++ b/java/src/mappers/ApplyMapper.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+ INSERT INTO apply_build(user_id,class_id,database_id,description,approver_id,status,create_time)
+ VALUES(#{userId},#{classId},#{dataBaseId},#{description},#{approverId},#{status},#{createTime})
+
+
+
+ UPDATE apply_build
+ SET user_id=#{userId},class_id=#{classId},database_id=#{dataBaseId},
+ description=#{description},approver_id=#{approverId},status=#{status},
+ create_time=#{createTime},approve_time=#{approveTime},authorized_id=#{authorizedId}
+ WHERE id = #{id}
+
+
+
+ UPDATE apply_build
+ SET user_id=#{userId},class_id=#{classId},database_id=#{dataBaseId},
+ description=#{description},approver_id=#{approverId},status=#{status},
+ create_time=#{createTime},approve_time=#{approveTime},authorized_id=#{authorizedId},
+ authorized_time=#{authorizedTime}
+ WHERE id = #{id}
+
+
+
diff --git a/java/src/mappers/DishMapper.xml b/java/src/mappers/DishMapper.xml
index 4dfb6ab09f31d926a3ac31130c7478a5dd20e340..2fb6d33661c3cb830251cb58be0c27b9b2998e02 100644
--- a/java/src/mappers/DishMapper.xml
+++ b/java/src/mappers/DishMapper.xml
@@ -3,6 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
INSERT INTO dish (name, price, description, create_time, update_time)
VALUES(#{name}, #{price,jdbcType=DECIMAL},#{description},#{createTime},#{updateTime})