2023.6.13
1. 完成用户和实验部分Controller
This commit is contained in:
parent
dc814ba7bc
commit
912f58a3eb
1
.gitignore
vendored
1
.gitignore
vendored
@ -31,3 +31,4 @@ build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
/web/node_modules/
|
||||
|
8
pom.xml
8
pom.xml
@ -5,16 +5,16 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
<version>2.7.3</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
<groupId>com.sdut</groupId>
|
||||
<artifactId>LabEx-Server</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>0.0.1</version>
|
||||
<name>LabEx-Server</name>
|
||||
<description>LabEx-Server</description>
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<java.version>8</java.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
@ -21,6 +21,7 @@ public class MVBConfig implements WebMvcConfigurer {
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(tokenInterceptor)
|
||||
.excludePathPatterns("/user/login/**");
|
||||
.excludePathPatterns("/login/**")
|
||||
.excludePathPatterns("/register/**");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
package com.sdut.labex.controller;
|
||||
|
||||
/**
|
||||
* File: BorrowInfoController
|
||||
* Created: 2023/6/12
|
||||
* Author: springforest
|
||||
* Description:
|
||||
*/
|
||||
|
||||
public class BorrowInfoController {
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package com.sdut.labex.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.sdut.labex.entity.Experiment;
|
||||
import com.sdut.labex.service.ExperimentsService;
|
||||
import com.sdut.labex.utils.ResVo;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* File: ExpermimentsController
|
||||
* Created: 2023/6/12
|
||||
* Author: springforest
|
||||
* Description:
|
||||
*/
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
public class ExperimentsController {
|
||||
@Resource
|
||||
private ExperimentsService experimentsService;
|
||||
|
||||
@PostMapping("/experiment")
|
||||
public ResVo applyExperiment(@RequestBody JSONObject jsonObject) {
|
||||
Experiment experiment = new Experiment();
|
||||
experiment.setName(jsonObject.getString("name"));
|
||||
experiment.setTime(jsonObject.getString("time"));
|
||||
experiment.setDate(jsonObject.getDate("date"));
|
||||
experiment.setClassName(jsonObject.getString("className"));
|
||||
experiment.setRoomName(jsonObject.getString("roomName"));
|
||||
//获取当前时间
|
||||
LocalDateTime currentDateTime = LocalDateTime.now();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
String formattedDateTime = currentDateTime.format(formatter);
|
||||
Date date = new Date();
|
||||
try {
|
||||
date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(formattedDateTime);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
experiment.setApplyTime(date);
|
||||
experiment.setStatus(0);
|
||||
return experimentsService.applyExperiment(experiment);
|
||||
}
|
||||
|
||||
@PutMapping("/experiment")
|
||||
public ResVo updateExperiment(@RequestBody JSONObject jsonObject) {
|
||||
Experiment experiment = jsonObject.toJavaObject(Experiment.class);
|
||||
return experimentsService.updateExperiment(experiment);
|
||||
}
|
||||
|
||||
@DeleteMapping("/experiment/{id}")
|
||||
public ResVo deleteExperiment(@PathVariable String id) {
|
||||
return experimentsService.deleteExperiment(id);
|
||||
}
|
||||
|
||||
@GetMapping("/unreviewed")
|
||||
public ResVo getUnreviewedExperiments() {
|
||||
return experimentsService.getUnreviewedExperiments();
|
||||
}
|
||||
|
||||
@PutMapping("/isAdmitted/{id}{status}")
|
||||
public ResVo isAdmit(@PathVariable Integer id, @PathVariable Integer status) {
|
||||
return experimentsService.isAdmitted(id, status);
|
||||
}
|
||||
|
||||
}
|
11
src/main/java/com/sdut/labex/controller/RoomController.java
Normal file
11
src/main/java/com/sdut/labex/controller/RoomController.java
Normal file
@ -0,0 +1,11 @@
|
||||
package com.sdut.labex.controller;
|
||||
|
||||
/**
|
||||
* File: RoomController
|
||||
* Created: 2023/6/12
|
||||
* Author: springforest
|
||||
* Description:
|
||||
*/
|
||||
|
||||
public class RoomController {
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.sdut.labex.controller;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
/**
|
||||
* File: TimeOptionController
|
||||
* Created: 2023/6/12
|
||||
* Author: springforest
|
||||
* Description:
|
||||
*/
|
||||
@Controller
|
||||
public class TimeOptionController {
|
||||
|
||||
}
|
39
src/main/java/com/sdut/labex/controller/UserController.java
Normal file
39
src/main/java/com/sdut/labex/controller/UserController.java
Normal file
@ -0,0 +1,39 @@
|
||||
package com.sdut.labex.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.sdut.labex.service.UserService;
|
||||
import com.sdut.labex.utils.ResVo;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* File: UserController
|
||||
* Created: 2023/6/12
|
||||
* Author: springforest
|
||||
* Description:
|
||||
*/
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
public class UserController {
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@PostMapping("/login")
|
||||
public ResVo login(@RequestBody JSONObject jsonObject) {
|
||||
return userService.login(jsonObject.getString("id"), jsonObject.getString("password"));
|
||||
}
|
||||
|
||||
@PostMapping("/register")
|
||||
public ResVo register(@RequestBody JSONObject jsonObject) {
|
||||
return userService.register(jsonObject.toJavaObject(com.sdut.labex.entity.User.class));
|
||||
}
|
||||
|
||||
@PutMapping("/changePassword")
|
||||
public ResVo changePassword(@RequestBody JSONObject jsonObject) {
|
||||
String id = jsonObject.getString("id");
|
||||
String oldPassword = jsonObject.getString("oldPassword");
|
||||
String newPassword = jsonObject.getString("newPassword");
|
||||
return userService.changePassword(id, oldPassword, newPassword);
|
||||
}
|
||||
}
|
58
src/main/java/com/sdut/labex/entity/BorrowInfo.java
Normal file
58
src/main/java/com/sdut/labex/entity/BorrowInfo.java
Normal file
@ -0,0 +1,58 @@
|
||||
package com.sdut.labex.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 借用记录
|
||||
*
|
||||
* @TableName borrowInfo
|
||||
*/
|
||||
@TableName(value = "borrowInfo")
|
||||
@Data
|
||||
public class BorrowInfo implements Serializable {
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 借用人
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 时间
|
||||
*/
|
||||
private String time;
|
||||
|
||||
/**
|
||||
* 日期
|
||||
*/
|
||||
private Date date;
|
||||
|
||||
/**
|
||||
* 申请时间
|
||||
*/
|
||||
private Date applyDate;
|
||||
|
||||
/**
|
||||
* 是否通过(0未审,1通过,2拒绝)
|
||||
*/
|
||||
private Integer isAdmit;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer roomId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
63
src/main/java/com/sdut/labex/entity/Experiment.java
Normal file
63
src/main/java/com/sdut/labex/entity/Experiment.java
Normal file
@ -0,0 +1,63 @@
|
||||
package com.sdut.labex.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 实验
|
||||
*
|
||||
* @TableName experiments
|
||||
*/
|
||||
@TableName(value = "experiments")
|
||||
@Data
|
||||
public class Experiment implements Serializable {
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 项目名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 上课时间
|
||||
*/
|
||||
private String time;
|
||||
|
||||
/**
|
||||
* 上课日期
|
||||
*/
|
||||
private Date date;
|
||||
|
||||
/**
|
||||
* 上课教室
|
||||
*/
|
||||
private String roomName;
|
||||
|
||||
/**
|
||||
* 审核状态(0未审,1通过,2拒绝)
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 上课班级
|
||||
*/
|
||||
private String className;
|
||||
|
||||
/**
|
||||
* 申请时间
|
||||
*/
|
||||
private Date applyTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
42
src/main/java/com/sdut/labex/entity/Room.java
Normal file
42
src/main/java/com/sdut/labex/entity/Room.java
Normal file
@ -0,0 +1,42 @@
|
||||
package com.sdut.labex.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 房间
|
||||
*
|
||||
* @TableName room
|
||||
*/
|
||||
@TableName(value = "room")
|
||||
@Data
|
||||
public class Room implements Serializable {
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 状态(1正常,2维护)
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
32
src/main/java/com/sdut/labex/entity/TimeOption.java
Normal file
32
src/main/java/com/sdut/labex/entity/TimeOption.java
Normal file
@ -0,0 +1,32 @@
|
||||
package com.sdut.labex.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 时间
|
||||
*
|
||||
* @TableName timeOption
|
||||
*/
|
||||
@TableName(value = "timeOption")
|
||||
@Data
|
||||
public class TimeOption implements Serializable {
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String name;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -1,13 +1,57 @@
|
||||
package com.sdut.labex.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* File: User
|
||||
* Created: 2023/6/11
|
||||
* Author: springforest
|
||||
* Description:
|
||||
*/
|
||||
@TableName(value = "user")
|
||||
@Data
|
||||
public class User {
|
||||
public class User implements Serializable {
|
||||
/**
|
||||
* id;
|
||||
*/
|
||||
@TableId
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 班级ID
|
||||
*/
|
||||
private String classId;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 学院
|
||||
*/
|
||||
private String department;
|
||||
|
||||
/**
|
||||
* 身份(student,teacher,admin)
|
||||
*/
|
||||
private String role;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
@ -4,14 +4,14 @@ import com.sdut.labex.entity.User;
|
||||
import com.sdut.labex.mapper.UserMapper;
|
||||
import com.sdut.labex.utils.JWTUtil;
|
||||
import com.sdut.labex.utils.UserHolder;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* File: TokenInterceptor
|
||||
@ -30,7 +30,7 @@ public class TokenInterceptor implements HandlerInterceptor {
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
|
||||
String token = request.getHeader(AUTH_HEADER);
|
||||
if (request.getMethod().equals("OPTIONS")||request.getRequestURI().equals("/error")) {
|
||||
if (request.getMethod().equals("OPTIONS") || request.getRequestURI().equals("/error")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -41,17 +41,17 @@ public class TokenInterceptor implements HandlerInterceptor {
|
||||
// 输出请求URI
|
||||
log.info("请求URI: " + request.getRequestURI());
|
||||
// 输出token
|
||||
if (token != null){
|
||||
if (token != null) {
|
||||
log.info("token: " + token);
|
||||
}
|
||||
log.info("----------------------------------------------------");
|
||||
|
||||
if (token != null && !JWTUtil.isExpired(token)) {
|
||||
//todo:访问记录
|
||||
User user = usersMapper.selectById(JWTUtil.decode(token).getClaim("id").asString());
|
||||
if (user == null) {
|
||||
return false;
|
||||
}
|
||||
//保存到本线程
|
||||
UserHolder.saveUser(user);
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
return true;
|
||||
|
20
src/main/java/com/sdut/labex/mapper/BorrowInfoMapper.java
Normal file
20
src/main/java/com/sdut/labex/mapper/BorrowInfoMapper.java
Normal file
@ -0,0 +1,20 @@
|
||||
package com.sdut.labex.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.sdut.labex.entity.BorrowInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author springforest
|
||||
* @description 针对表【borrowInfo(借用记录)】的数据库操作Mapper
|
||||
* @createDate 2023-06-12 08:07:15
|
||||
* @Entity com.sdut.labex.entity.Borrowinfo
|
||||
*/
|
||||
@Mapper
|
||||
public interface BorrowInfoMapper extends BaseMapper<BorrowInfo> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
20
src/main/java/com/sdut/labex/mapper/ExperimentsMapper.java
Normal file
20
src/main/java/com/sdut/labex/mapper/ExperimentsMapper.java
Normal file
@ -0,0 +1,20 @@
|
||||
package com.sdut.labex.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.sdut.labex.entity.Experiment;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author springforest
|
||||
* @description 针对表【experiments(实验)】的数据库操作Mapper
|
||||
* @createDate 2023-06-12 08:07:15
|
||||
* @Entity com.sdut.labex.entity.Experiments
|
||||
*/
|
||||
@Mapper
|
||||
public interface ExperimentsMapper extends BaseMapper<Experiment> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
20
src/main/java/com/sdut/labex/mapper/RoomMapper.java
Normal file
20
src/main/java/com/sdut/labex/mapper/RoomMapper.java
Normal file
@ -0,0 +1,20 @@
|
||||
package com.sdut.labex.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.sdut.labex.entity.Room;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author springforest
|
||||
* @description 针对表【room(房间)】的数据库操作Mapper
|
||||
* @createDate 2023-06-12 08:07:15
|
||||
* @Entity com.sdut.labex.entity.Room
|
||||
*/
|
||||
@Mapper
|
||||
public interface RoomMapper extends BaseMapper<Room> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
20
src/main/java/com/sdut/labex/mapper/TimeOptionMapper.java
Normal file
20
src/main/java/com/sdut/labex/mapper/TimeOptionMapper.java
Normal file
@ -0,0 +1,20 @@
|
||||
package com.sdut.labex.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.sdut.labex.entity.TimeOption;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author springforest
|
||||
* @description 针对表【timeOption(时间)】的数据库操作Mapper
|
||||
* @createDate 2023-06-12 08:07:15
|
||||
* @Entity com.sdut.labex.entity.Timeoption
|
||||
*/
|
||||
@Mapper
|
||||
public interface TimeOptionMapper extends BaseMapper<TimeOption> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
13
src/main/java/com/sdut/labex/service/BorrowInfoService.java
Normal file
13
src/main/java/com/sdut/labex/service/BorrowInfoService.java
Normal file
@ -0,0 +1,13 @@
|
||||
package com.sdut.labex.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sdut.labex.entity.BorrowInfo;
|
||||
|
||||
/**
|
||||
* @author springforest
|
||||
* @description 针对表【borrowInfo(借用记录)】的数据库操作Service
|
||||
* @createDate 2023-06-12 08:07:15
|
||||
*/
|
||||
public interface BorrowInfoService extends IService<BorrowInfo> {
|
||||
|
||||
}
|
26
src/main/java/com/sdut/labex/service/ExperimentsService.java
Normal file
26
src/main/java/com/sdut/labex/service/ExperimentsService.java
Normal file
@ -0,0 +1,26 @@
|
||||
package com.sdut.labex.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sdut.labex.entity.Experiment;
|
||||
import com.sdut.labex.utils.ResVo;
|
||||
|
||||
/**
|
||||
* @author springforest
|
||||
* @description 针对表【experiments(实验)】的数据库操作Service
|
||||
* @createDate 2023-06-12 08:07:15
|
||||
*/
|
||||
public interface ExperimentsService extends IService<Experiment> {
|
||||
public ResVo applyExperiment(Experiment experiment);
|
||||
|
||||
public ResVo deleteExperiment(String id);
|
||||
|
||||
public ResVo updateExperiment(Experiment experiment);
|
||||
|
||||
public ResVo getExperiment(String id);
|
||||
|
||||
public ResVo getExperiments();
|
||||
|
||||
public ResVo getUnreviewedExperiments();
|
||||
|
||||
public ResVo isAdmitted(int id, int status);
|
||||
}
|
13
src/main/java/com/sdut/labex/service/RoomService.java
Normal file
13
src/main/java/com/sdut/labex/service/RoomService.java
Normal file
@ -0,0 +1,13 @@
|
||||
package com.sdut.labex.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sdut.labex.entity.Room;
|
||||
|
||||
/**
|
||||
* @author springforest
|
||||
* @description 针对表【room(房间)】的数据库操作Service
|
||||
* @createDate 2023-06-12 08:07:15
|
||||
*/
|
||||
public interface RoomService extends IService<Room> {
|
||||
|
||||
}
|
13
src/main/java/com/sdut/labex/service/TimeOptionService.java
Normal file
13
src/main/java/com/sdut/labex/service/TimeOptionService.java
Normal file
@ -0,0 +1,13 @@
|
||||
package com.sdut.labex.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sdut.labex.entity.TimeOption;
|
||||
|
||||
/**
|
||||
* @author springforest
|
||||
* @description 针对表【timeOption(时间)】的数据库操作Service
|
||||
* @createDate 2023-06-12 08:07:15
|
||||
*/
|
||||
public interface TimeOptionService extends IService<TimeOption> {
|
||||
|
||||
}
|
@ -1,5 +1,9 @@
|
||||
package com.sdut.labex.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sdut.labex.entity.User;
|
||||
import com.sdut.labex.utils.ResVo;
|
||||
|
||||
/**
|
||||
* File: UserService
|
||||
* Created: 2023/6/11
|
||||
@ -7,5 +11,10 @@ package com.sdut.labex.service;
|
||||
* Description:
|
||||
*/
|
||||
|
||||
public interface UserService {
|
||||
public interface UserService extends IService<User> {
|
||||
public ResVo login(String id, String password);
|
||||
|
||||
public ResVo register(User user);
|
||||
|
||||
public ResVo changePassword(String id, String oldPassword, String newPassword);
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
package com.sdut.labex.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sdut.labex.entity.BorrowInfo;
|
||||
import com.sdut.labex.mapper.BorrowInfoMapper;
|
||||
import com.sdut.labex.service.BorrowInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author springforest
|
||||
* @description 针对表【borrowInfo(借用记录)】的数据库操作Service实现
|
||||
* @createDate 2023-06-12 08:07:15
|
||||
*/
|
||||
@Service
|
||||
public class BorrowInfoServiceImpl extends ServiceImpl<BorrowInfoMapper, BorrowInfo>
|
||||
implements BorrowInfoService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,97 @@
|
||||
package com.sdut.labex.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sdut.labex.entity.Experiment;
|
||||
import com.sdut.labex.mapper.ExperimentsMapper;
|
||||
import com.sdut.labex.service.ExperimentsService;
|
||||
import com.sdut.labex.utils.ResVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author springforest
|
||||
* @description 针对表【experiments(实验)】的数据库操作Service实现
|
||||
* @createDate 2023-06-12 08:07:15
|
||||
*/
|
||||
@Service
|
||||
public class ExperimentsServiceImpl extends ServiceImpl<ExperimentsMapper, Experiment>
|
||||
implements ExperimentsService {
|
||||
@Resource
|
||||
private ExperimentsMapper experimentsMapper;
|
||||
|
||||
@Override
|
||||
public ResVo applyExperiment(Experiment experiment) {
|
||||
try {
|
||||
experimentsMapper.insert(experiment);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResVo.error();
|
||||
}
|
||||
return ResVo.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResVo deleteExperiment(String id) {
|
||||
if (experimentsMapper.selectById(id) == null)
|
||||
return ResVo.error("该实验不存在");
|
||||
|
||||
try {
|
||||
experimentsMapper.deleteById(id);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResVo.error();
|
||||
}
|
||||
return ResVo.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResVo updateExperiment(Experiment experiment) {
|
||||
if (experimentsMapper.selectById(experiment.getId()) == null)
|
||||
return ResVo.error("该实验不存在");
|
||||
|
||||
try {
|
||||
experimentsMapper.updateById(experiment);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResVo.error();
|
||||
}
|
||||
return ResVo.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResVo getExperiment(String id) {
|
||||
QueryWrapper<Experiment> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.select("id", id);
|
||||
|
||||
Experiment experiment = experimentsMapper.selectOne(queryWrapper);
|
||||
if (experiment == null)
|
||||
return ResVo.error("该实验不存在");
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("experiment", experiment);
|
||||
return ResVo.ok(map);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResVo getExperiments() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResVo getUnreviewedExperiments() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResVo isAdmitted(int id, int status) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,22 @@
|
||||
package com.sdut.labex.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sdut.labex.entity.Room;
|
||||
import com.sdut.labex.mapper.RoomMapper;
|
||||
import com.sdut.labex.service.RoomService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author springforest
|
||||
* @description 针对表【room(房间)】的数据库操作Service实现
|
||||
* @createDate 2023-06-12 08:07:15
|
||||
*/
|
||||
@Service
|
||||
public class RoomServiceImpl extends ServiceImpl<RoomMapper, Room>
|
||||
implements RoomService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,22 @@
|
||||
package com.sdut.labex.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sdut.labex.entity.TimeOption;
|
||||
import com.sdut.labex.mapper.TimeOptionMapper;
|
||||
import com.sdut.labex.service.TimeOptionService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author springforest
|
||||
* @description 针对表【timeOption(时间)】的数据库操作Service实现
|
||||
* @createDate 2023-06-12 08:07:15
|
||||
*/
|
||||
@Service
|
||||
public class TimeOptionServiceImpl extends ServiceImpl<TimeOptionMapper, TimeOption>
|
||||
implements TimeOptionService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,79 @@
|
||||
package com.sdut.labex.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sdut.labex.entity.User;
|
||||
import com.sdut.labex.mapper.UserMapper;
|
||||
import com.sdut.labex.service.UserService;
|
||||
import com.sdut.labex.utils.JWTUtil;
|
||||
import com.sdut.labex.utils.ResVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.DigestUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* File: UserServiceImpl
|
||||
* Created: 2023/6/11
|
||||
* Author: springforest
|
||||
* Description:
|
||||
*/
|
||||
@Service
|
||||
public class UserServiceImpl extends ServiceImpl<UserMapper, User>
|
||||
implements UserService {
|
||||
|
||||
@Resource
|
||||
private UserMapper userMapper;
|
||||
|
||||
@Override
|
||||
public ResVo login(String id, String password) {
|
||||
User user = userMapper.selectById(id);
|
||||
if (user == null) {
|
||||
return ResVo.error("用户不存在");
|
||||
}
|
||||
|
||||
|
||||
if (password.equals(user.getPassword()) || DigestUtils.md5DigestAsHex(password.getBytes()).equals(user.getPassword())) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("id", user.getId());
|
||||
map.put("role", user.getRole());
|
||||
map.put("username", user.getUsername());
|
||||
map.put("classId", user.getClassId());
|
||||
map.put("department", user.getDepartment());
|
||||
String token = JWTUtil.getTokenByMap(map);
|
||||
map.put("token", token);
|
||||
return ResVo.ok(map);
|
||||
} else {
|
||||
return ResVo.error("密码错误");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResVo register(User user) {
|
||||
try {
|
||||
user.setPassword(DigestUtils.md5DigestAsHex(user.getPassword().getBytes()));
|
||||
userMapper.insert(user);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResVo.error();
|
||||
}
|
||||
return ResVo.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResVo changePassword(String id, String oldPassword, String newPassword) {
|
||||
User user = userMapper.selectById(id);
|
||||
if (user == null) {
|
||||
return ResVo.error("用户不存在");
|
||||
}
|
||||
|
||||
if (oldPassword.equals(user.getPassword()) || DigestUtils.md5DigestAsHex(oldPassword.getBytes()).equals(user.getPassword())) {
|
||||
user.setPassword(DigestUtils.md5DigestAsHex(newPassword.getBytes()));
|
||||
userMapper.updateById(user);
|
||||
} else {
|
||||
return ResVo.error("密码错误");
|
||||
}
|
||||
return ResVo.ok();
|
||||
}
|
||||
}
|
131
src/main/java/com/sdut/labex/utils/ExcelUtils.java
Normal file
131
src/main/java/com/sdut/labex/utils/ExcelUtils.java
Normal file
@ -0,0 +1,131 @@
|
||||
package com.sdut.labex.utils;
|
||||
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
/**
|
||||
* File: ExcelUtils
|
||||
* Created: 2023/6/12
|
||||
* Author: springforest
|
||||
* Description:
|
||||
*/
|
||||
|
||||
|
||||
public class ExcelUtils {
|
||||
public Workbook workbook;
|
||||
public Sheet sheet;
|
||||
public boolean isEmpty;//判断文件是不是有内容
|
||||
public int totalRows;//总行数/最后一行的位置
|
||||
|
||||
public ExcelUtils(File file, String fileType) throws IOException {
|
||||
this.isEmpty = false;
|
||||
this.createWorkbook(file, fileType);
|
||||
}
|
||||
|
||||
private void createWorkbook(File excelFile, String fileType) throws IOException {
|
||||
|
||||
FileInputStream fileInputStream = null;
|
||||
|
||||
try {
|
||||
fileInputStream = new FileInputStream(excelFile);
|
||||
if (fileType.equalsIgnoreCase("xls")) {
|
||||
this.workbook = new HSSFWorkbook(fileInputStream); //生成.xls的excel
|
||||
} else if (fileType.equalsIgnoreCase("xlsx")) {
|
||||
this.workbook = new XSSFWorkbook(fileInputStream); //生成.xlsx的excel
|
||||
}
|
||||
if (this.workbook == null) {
|
||||
this.isEmpty = true;
|
||||
return;
|
||||
}
|
||||
|
||||
this.checkWorkbook(this.workbook);
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (workbook != null) {
|
||||
workbook.close(); //关闭流
|
||||
}
|
||||
if (fileInputStream != null) {
|
||||
fileInputStream.close(); //关闭流
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//读取数据
|
||||
public void checkWorkbook(Workbook workbook) {
|
||||
|
||||
int sheetNum = 0;
|
||||
this.sheet = workbook.getSheetAt(sheetNum); // 获取sheet
|
||||
|
||||
// 校验sheet是否合法
|
||||
if (sheet == null) {
|
||||
this.isEmpty = true;
|
||||
return;
|
||||
}
|
||||
|
||||
Row firstRow = sheet.getRow(sheet.getFirstRowNum()); // 获取第一行,一般是表头
|
||||
|
||||
if (null == firstRow) {
|
||||
this.isEmpty = true;
|
||||
return;
|
||||
}
|
||||
|
||||
this.totalRows = sheet.getPhysicalNumberOfRows();//获取有记录的行数,即:最后有数据的行是第n行,前面有m行是空行没数据,则返回n-m;
|
||||
}
|
||||
|
||||
//读取Cell内容并转换成String
|
||||
public static String getCellToString(Cell cell) {
|
||||
if (cell == null) {
|
||||
return null;
|
||||
}
|
||||
String content = null;
|
||||
try {
|
||||
switch (cell.getCellType()) {
|
||||
case NUMERIC: //数字或者时间
|
||||
Double doubleValue = cell.getNumericCellValue();
|
||||
// todo:格式化科学计数法,取一位整数(待定)
|
||||
DecimalFormat decimalFormat = new DecimalFormat("0");
|
||||
content = decimalFormat.format(doubleValue);
|
||||
break;
|
||||
case STRING: //字符串
|
||||
content = cell.getStringCellValue();
|
||||
break;
|
||||
case BOOLEAN: //布尔
|
||||
Boolean booleanValue = cell.getBooleanCellValue();
|
||||
content = booleanValue.toString();
|
||||
break;
|
||||
case BLANK: // 空值
|
||||
break;
|
||||
case FORMULA: // 公式
|
||||
content = cell.getCellFormula();
|
||||
break;
|
||||
case ERROR: // 故障
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
//读取指定位置的单元格
|
||||
public String getCertainCell(int rowNum, int columnNum) {
|
||||
Row row = this.sheet.getRow(rowNum);//获取行
|
||||
Cell cell = row.getCell(columnNum);//获取列
|
||||
|
||||
return getCellToString(cell);
|
||||
}
|
||||
}
|
||||
|
11
src/main/java/com/sdut/labex/utils/Params.java
Normal file
11
src/main/java/com/sdut/labex/utils/Params.java
Normal file
@ -0,0 +1,11 @@
|
||||
package com.sdut.labex.utils;
|
||||
|
||||
/**
|
||||
* File: Params
|
||||
* Created: 2023/6/12
|
||||
* Author: springforest
|
||||
* Description:
|
||||
*/
|
||||
|
||||
public class Params {
|
||||
}
|
57
src/main/java/com/sdut/labex/utils/ResVo.java
Normal file
57
src/main/java/com/sdut/labex/utils/ResVo.java
Normal file
@ -0,0 +1,57 @@
|
||||
package com.sdut.labex.utils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* File: ResultVo
|
||||
* Created: 2023/6/12
|
||||
* Author: springforest
|
||||
* Description:
|
||||
*/
|
||||
|
||||
|
||||
public class ResVo extends HashMap<String, Object> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ResVo() {
|
||||
put("code", 200);
|
||||
}
|
||||
|
||||
public static ResVo error() {
|
||||
return error(500, "未知异常,请联系管理员");
|
||||
}
|
||||
|
||||
public static ResVo error(String msg) {
|
||||
return error(500, msg);
|
||||
}
|
||||
|
||||
public static ResVo error(int code, String msg) {
|
||||
ResVo resVo = new ResVo();
|
||||
resVo.put("code", code);
|
||||
resVo.put("msg", msg);
|
||||
return resVo;
|
||||
}
|
||||
|
||||
public static ResVo ok(String msg) {
|
||||
ResVo resVo = new ResVo();
|
||||
resVo.put("msg", msg);
|
||||
return resVo;
|
||||
}
|
||||
|
||||
public static ResVo ok(Map<String, ?> map) {
|
||||
ResVo resVo = new ResVo();
|
||||
resVo.putAll(map);
|
||||
return resVo;
|
||||
}
|
||||
|
||||
public static ResVo ok() {
|
||||
return new ResVo();
|
||||
}
|
||||
|
||||
public ResVo put(String key, Object value) {
|
||||
super.put(key, value);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
70
src/main/java/com/sdut/labex/utils/SFFileUtils.java
Normal file
70
src/main/java/com/sdut/labex/utils/SFFileUtils.java
Normal file
@ -0,0 +1,70 @@
|
||||
package com.sdut.labex.utils;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* File: SFFileUtils
|
||||
* Created: 2023/6/12
|
||||
* Author: springforest
|
||||
* Description:
|
||||
*/
|
||||
|
||||
|
||||
public class SFFileUtils {
|
||||
private String FileName;
|
||||
private String endName;
|
||||
private MultipartFile multipartFile;
|
||||
private File file;
|
||||
|
||||
public SFFileUtils(MultipartFile rawFile) {
|
||||
this.FileName = rawFile.getOriginalFilename();
|
||||
this.endName = creatFileEndName(rawFile);
|
||||
this.multipartFile = rawFile;
|
||||
|
||||
//选择用缓冲区来实现这个转换即使用java 创建的临时文件 使用 MultipartFile.transferto()方法 。
|
||||
/**
|
||||
* MultipartFile 转 File
|
||||
*/
|
||||
File file = null;
|
||||
try {
|
||||
String originalFilename = multipartFile.getOriginalFilename();
|
||||
String[] filename = originalFilename.split("\\.");
|
||||
file = File.createTempFile(filename[0], filename[1] + ".");
|
||||
multipartFile.transferTo(file);
|
||||
file.deleteOnExit();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
public File getFile() {
|
||||
return file;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return this.FileName;
|
||||
}
|
||||
|
||||
public String getEndName() {
|
||||
return this.endName;
|
||||
}
|
||||
|
||||
public String getPostfix() {
|
||||
return this.endName;
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取文件后缀
|
||||
* */
|
||||
private String creatFileEndName(MultipartFile file) {
|
||||
String fileName = file.getOriginalFilename();
|
||||
String[] temp = fileName.split("\\.");
|
||||
int strL = temp.length;
|
||||
return temp[strL - 1];
|
||||
}
|
||||
}
|
||||
|
@ -1,2 +1,28 @@
|
||||
server:
|
||||
port: 8080
|
||||
|
||||
spring:
|
||||
# Redis
|
||||
redis:
|
||||
host: 8.219.96.16
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 密码
|
||||
password: 123456
|
||||
# 连接超时时间
|
||||
timeout: 5s
|
||||
lettuce:
|
||||
pool:
|
||||
max-active: 8 #最大连接数据库连接数,设 0 为没有限制
|
||||
max-idle: 8 #最大等待连接中的数量,设 0 为没有限制
|
||||
max-wait: 100ms #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
|
||||
min-idle: 0 #最小等待连接中的数量,设 0 为没有限制
|
||||
# MySQL
|
||||
datasource:
|
||||
url: jdbc:mysql://106.15.196.199:3306/labex?allowMultiQueries=true&useUnicode=true&characterEncoding=utf8
|
||||
username: root
|
||||
password: Udkklzxc123.
|
||||
|
||||
logging:
|
||||
level:
|
||||
root: info
|
||||
|
23
src/main/resources/mapper/BorrowInfoMapper.xml
Normal file
23
src/main/resources/mapper/BorrowInfoMapper.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.sdut.labex.mapper.BorrowInfoMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.sdut.labex.entity.BorrowInfo">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="time" column="time" jdbcType="VARCHAR"/>
|
||||
<result property="date" column="date" jdbcType="DATE"/>
|
||||
<result property="applyDate" column="apply_date" jdbcType="TIMESTAMP"/>
|
||||
<result property="isAdmit" column="is_admit" jdbcType="INTEGER"/>
|
||||
<result property="roomId" column="room_id" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id
|
||||
,name,time,
|
||||
date,apply_date,is_admit,
|
||||
room_id
|
||||
</sql>
|
||||
</mapper>
|
23
src/main/resources/mapper/ExperimentsMapper.xml
Normal file
23
src/main/resources/mapper/ExperimentsMapper.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.sdut.labex.mapper.ExperimentsMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.sdut.labex.entity.Experiment">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="time" column="time" jdbcType="VARCHAR"/>
|
||||
<result property="date" column="date" jdbcType="DATE"/>
|
||||
<result property="roomName" column="room_name" jdbcType="VARCHAR"/>
|
||||
<result property="status" column="status" jdbcType="INTEGER"/>
|
||||
<result property="className" column="class_name" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id
|
||||
,name,time,
|
||||
date,room_name,status,
|
||||
class_name
|
||||
</sql>
|
||||
</mapper>
|
19
src/main/resources/mapper/RoomMapper.xml
Normal file
19
src/main/resources/mapper/RoomMapper.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.sdut.labex.mapper.RoomMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.sdut.labex.entity.Room">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="description" column="description" jdbcType="VARCHAR"/>
|
||||
<result property="status" column="status" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id
|
||||
,name,description,
|
||||
status
|
||||
</sql>
|
||||
</mapper>
|
16
src/main/resources/mapper/TimeOptionMapper.xml
Normal file
16
src/main/resources/mapper/TimeOptionMapper.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.sdut.labex.mapper.TimeOptionMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.sdut.labex.entity.TimeOption">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id
|
||||
,name
|
||||
</sql>
|
||||
</mapper>
|
16
src/main/resources/mapper/UserMapper.xml
Normal file
16
src/main/resources/mapper/UserMapper.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.sdut.labex.mapper.UserMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.sdut.labex.entity.User">
|
||||
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="username" column="username" jdbcType="VARCHAR"/>
|
||||
<result property="password" column="password" jdbcType="VARCHAR"/>
|
||||
<result property="classId" column="class_id" jdbcType="VARCHAR"/>
|
||||
<result property="email" column="email" jdbcType="VARCHAR"/>
|
||||
<result property="department" column="department" jdbcType="VARCHAR"/>
|
||||
<result property="role" column="role" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user