diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index e898b9d..0000000 Binary files a/.DS_Store and /dev/null differ diff --git a/README.md b/README.md new file mode 100644 index 0000000..fd40fee --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# sampleLibSystem + diff --git a/specimen_management-demo/.gitignore b/my-batis-demo/.gitignore similarity index 100% rename from specimen_management-demo/.gitignore rename to my-batis-demo/.gitignore diff --git a/specimen_management-demo/.mvn/wrapper/maven-wrapper.jar b/my-batis-demo/.mvn/wrapper/maven-wrapper.jar similarity index 100% rename from specimen_management-demo/.mvn/wrapper/maven-wrapper.jar rename to my-batis-demo/.mvn/wrapper/maven-wrapper.jar diff --git a/specimen_management-demo/.mvn/wrapper/maven-wrapper.properties b/my-batis-demo/.mvn/wrapper/maven-wrapper.properties similarity index 100% rename from specimen_management-demo/.mvn/wrapper/maven-wrapper.properties rename to my-batis-demo/.mvn/wrapper/maven-wrapper.properties diff --git a/specimen_management-demo/mvnw b/my-batis-demo/mvnw similarity index 100% rename from specimen_management-demo/mvnw rename to my-batis-demo/mvnw diff --git a/specimen_management-demo/mvnw.cmd b/my-batis-demo/mvnw.cmd similarity index 100% rename from specimen_management-demo/mvnw.cmd rename to my-batis-demo/mvnw.cmd diff --git a/specimen_management-demo/pom.xml b/my-batis-demo/pom.xml similarity index 100% rename from specimen_management-demo/pom.xml rename to my-batis-demo/pom.xml diff --git a/specimen_management-demo/src/main/java/com/test/MyBatisDemoApplication.java b/my-batis-demo/src/main/java/com/test/MyBatisDemoApplication.java similarity index 100% rename from specimen_management-demo/src/main/java/com/test/MyBatisDemoApplication.java rename to my-batis-demo/src/main/java/com/test/MyBatisDemoApplication.java diff --git a/specimen_management-demo/src/main/java/com/test/bean/Admin.java b/my-batis-demo/src/main/java/com/test/bean/Admin.java similarity index 100% rename from specimen_management-demo/src/main/java/com/test/bean/Admin.java rename to my-batis-demo/src/main/java/com/test/bean/Admin.java diff --git a/specimen_management-demo/src/main/java/com/test/bean/Order.java b/my-batis-demo/src/main/java/com/test/bean/Order.java similarity index 100% rename from specimen_management-demo/src/main/java/com/test/bean/Order.java rename to my-batis-demo/src/main/java/com/test/bean/Order.java diff --git a/specimen_management-demo/src/main/java/com/test/bean/PageBean.java b/my-batis-demo/src/main/java/com/test/bean/PageBean.java similarity index 100% rename from specimen_management-demo/src/main/java/com/test/bean/PageBean.java rename to my-batis-demo/src/main/java/com/test/bean/PageBean.java diff --git a/specimen_management-demo/src/main/java/com/test/bean/Result.java b/my-batis-demo/src/main/java/com/test/bean/Result.java similarity index 100% rename from specimen_management-demo/src/main/java/com/test/bean/Result.java rename to my-batis-demo/src/main/java/com/test/bean/Result.java diff --git a/my-batis-demo/src/main/java/com/test/bean/RoomType.java b/my-batis-demo/src/main/java/com/test/bean/RoomType.java new file mode 100644 index 0000000..5a87f53 --- /dev/null +++ b/my-batis-demo/src/main/java/com/test/bean/RoomType.java @@ -0,0 +1,23 @@ +package com.test.bean; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class RoomType { + private Long typeId; + private String roomType; + private String remark; + private double price; + private String cover; + private int bedNum; + private Integer remain; + private int windows; + private LocalDateTime createTime; + private LocalDateTime updateTime; +} diff --git a/specimen_management-demo/src/main/java/com/test/bean/User.java b/my-batis-demo/src/main/java/com/test/bean/User.java similarity index 100% rename from specimen_management-demo/src/main/java/com/test/bean/User.java rename to my-batis-demo/src/main/java/com/test/bean/User.java diff --git a/specimen_management-demo/src/main/java/com/test/config/WebConfig.java b/my-batis-demo/src/main/java/com/test/config/WebConfig.java similarity index 100% rename from specimen_management-demo/src/main/java/com/test/config/WebConfig.java rename to my-batis-demo/src/main/java/com/test/config/WebConfig.java diff --git a/specimen_management-demo/src/main/java/com/test/controller/LoginController.java b/my-batis-demo/src/main/java/com/test/controller/LoginController.java similarity index 100% rename from specimen_management-demo/src/main/java/com/test/controller/LoginController.java rename to my-batis-demo/src/main/java/com/test/controller/LoginController.java diff --git a/specimen_management-demo/src/main/java/com/test/controller/OrderController.java b/my-batis-demo/src/main/java/com/test/controller/OrderController.java similarity index 100% rename from specimen_management-demo/src/main/java/com/test/controller/OrderController.java rename to my-batis-demo/src/main/java/com/test/controller/OrderController.java diff --git a/specimen_management-demo/src/main/java/com/test/controller/RegisterController.java b/my-batis-demo/src/main/java/com/test/controller/RegisterController.java similarity index 100% rename from specimen_management-demo/src/main/java/com/test/controller/RegisterController.java rename to my-batis-demo/src/main/java/com/test/controller/RegisterController.java diff --git a/my-batis-demo/src/main/java/com/test/controller/RoomTypeController.java b/my-batis-demo/src/main/java/com/test/controller/RoomTypeController.java new file mode 100644 index 0000000..f5bdd44 --- /dev/null +++ b/my-batis-demo/src/main/java/com/test/controller/RoomTypeController.java @@ -0,0 +1,58 @@ +package com.test.controller; + +import com.test.bean.Result; +import com.test.bean.RoomType; +import com.test.service.RoomTypeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +@RestController +@RequestMapping("/roomType") +public class RoomTypeController { + + @Autowired + RoomTypeService roomTypeService; + +// @GetMapping("/") + public Result getAllRoomType(){ + return Result.success(); + } + + @GetMapping("/getRoomTypeByPage") + public Result getRoomTypeByPage(@RequestParam(defaultValue = "1") int page, + @RequestParam(defaultValue = "5") int pageSize){ + return Result.success(roomTypeService.getRoomTypeByPage(page, pageSize)); + + } + @GetMapping + public Result getRoomTypeById(@RequestParam Long id){ + RoomType roomType = roomTypeService.getRoomTypeById(id); + if (roomType != null && roomType.getTypeId() == null ){ + return Result.error("此房型不存在!"); + } + return Result.success(roomType); + } + @PostMapping + public Result addRoomType(@RequestBody RoomType roomType){ + if (roomTypeService.addRoomType(roomType)){ + return Result.success(); + } + return Result.error("添加失败!"); + } + @PutMapping + public Result updateRoomType(@RequestBody RoomType roomType){ + if (roomTypeService.updateRoomType(roomType)){ + return Result.success(roomTypeService.getRoomTypeById(roomType.getTypeId())); + } + return Result.error("修改失败!"); + + } + @DeleteMapping + public Result deleteRoomType(@RequestParam Long id){ + if (roomTypeService.deleteRoomType(id)){ + return Result.success(); + } + return Result.error("删除失败!"); + } + +} diff --git a/specimen_management-demo/src/main/java/com/test/controller/UserController.java b/my-batis-demo/src/main/java/com/test/controller/UserController.java similarity index 90% rename from specimen_management-demo/src/main/java/com/test/controller/UserController.java rename to my-batis-demo/src/main/java/com/test/controller/UserController.java index aabb920..b40d816 100644 --- a/specimen_management-demo/src/main/java/com/test/controller/UserController.java +++ b/my-batis-demo/src/main/java/com/test/controller/UserController.java @@ -22,7 +22,7 @@ public class UserController { return Result.error("添加用户失败"); } -// @GetMapping + @GetMapping public Result getUserByPhone(@RequestParam String phone) { User user = userService.getUserByPhone(phone); if (user != null && user.getUserId() == null) { @@ -30,10 +30,6 @@ public class UserController { } return Result.success(user); } - @GetMapping - public Result getUserById(@RequestParam String id){ - return Result.success(userService.getUserById(id)); - } @PutMapping public Result updateUser(@RequestBody User user) { diff --git a/specimen_management-demo/src/main/java/com/test/filter/Filter.java b/my-batis-demo/src/main/java/com/test/filter/Filter.java similarity index 100% rename from specimen_management-demo/src/main/java/com/test/filter/Filter.java rename to my-batis-demo/src/main/java/com/test/filter/Filter.java diff --git a/specimen_management-demo/src/main/java/com/test/interceptor/LoginCheckInterceptor.java b/my-batis-demo/src/main/java/com/test/interceptor/LoginCheckInterceptor.java similarity index 100% rename from specimen_management-demo/src/main/java/com/test/interceptor/LoginCheckInterceptor.java rename to my-batis-demo/src/main/java/com/test/interceptor/LoginCheckInterceptor.java diff --git a/specimen_management-demo/src/main/java/com/test/mapper/AdminMapper.java b/my-batis-demo/src/main/java/com/test/mapper/AdminMapper.java similarity index 100% rename from specimen_management-demo/src/main/java/com/test/mapper/AdminMapper.java rename to my-batis-demo/src/main/java/com/test/mapper/AdminMapper.java diff --git a/specimen_management-demo/src/main/java/com/test/mapper/OrderMapper.java b/my-batis-demo/src/main/java/com/test/mapper/OrderMapper.java similarity index 100% rename from specimen_management-demo/src/main/java/com/test/mapper/OrderMapper.java rename to my-batis-demo/src/main/java/com/test/mapper/OrderMapper.java diff --git a/my-batis-demo/src/main/java/com/test/mapper/RoomTypeMapper.java b/my-batis-demo/src/main/java/com/test/mapper/RoomTypeMapper.java new file mode 100644 index 0000000..804cba4 --- /dev/null +++ b/my-batis-demo/src/main/java/com/test/mapper/RoomTypeMapper.java @@ -0,0 +1,32 @@ +package com.test.mapper; + +import com.test.bean.RoomType; +import org.apache.ibatis.annotations.*; + +import java.util.ArrayList; + +@Mapper +public interface RoomTypeMapper { + + @Select("select count(*) from room_type") + public long getRoomTypeCount(); + +// start为起始索引 + @Select("select * from room_type limit #{start}, #{pageSize}") + public ArrayList getRoomTypeByPage(int start, int pageSize); + + @Select("select * from room_type") + public ArrayList getRoomType(); + + @Insert("insert into room_type(room_type, remark,price, cover,bed_num, remain,windows, create_time, update_time) VALUE (#{roomType}, #{remark}, #{price}, #{cover}, #{bedNum}, #{remain}, #{windows}, #{createTime}, #{updateTime})") + public boolean addRoomType(RoomType roomType); + + @Select("select * from room_type where type_id = #{id}") + RoomType getRoomTypeById(Long id); + + @Update("update room_type set room_type = #{roomType}, remark = #{remark}, price = #{price}, cover = #{cover}, bed_num = #{bedNum}, remain = #{remain}, windows = #{windows}, update_time = #{updateTime} where type_id = #{typeId}") + boolean updateRoomType(RoomType roomType); + + @Delete("delete from room_type where type_id = #{id}") + boolean deleteRoomType(Long id); +} diff --git a/specimen_management-demo/src/main/java/com/test/mapper/UserMapper.java b/my-batis-demo/src/main/java/com/test/mapper/UserMapper.java similarity index 100% rename from specimen_management-demo/src/main/java/com/test/mapper/UserMapper.java rename to my-batis-demo/src/main/java/com/test/mapper/UserMapper.java diff --git a/specimen_management-demo/src/main/java/com/test/service/AdminService.java b/my-batis-demo/src/main/java/com/test/service/AdminService.java similarity index 100% rename from specimen_management-demo/src/main/java/com/test/service/AdminService.java rename to my-batis-demo/src/main/java/com/test/service/AdminService.java diff --git a/specimen_management-demo/src/main/java/com/test/service/OrderService.java b/my-batis-demo/src/main/java/com/test/service/OrderService.java similarity index 100% rename from specimen_management-demo/src/main/java/com/test/service/OrderService.java rename to my-batis-demo/src/main/java/com/test/service/OrderService.java diff --git a/my-batis-demo/src/main/java/com/test/service/RoomTypeService.java b/my-batis-demo/src/main/java/com/test/service/RoomTypeService.java new file mode 100644 index 0000000..e1a6b58 --- /dev/null +++ b/my-batis-demo/src/main/java/com/test/service/RoomTypeService.java @@ -0,0 +1,19 @@ +package com.test.service; + +import com.test.bean.PageBean; +import com.test.bean.RoomType; + + +public interface RoomTypeService { + + + PageBean getRoomTypeByPage(int page, int pageSize); + + boolean addRoomType(RoomType roomType); + + RoomType getRoomTypeById(Long id); + + boolean updateRoomType(RoomType roomType); + + boolean deleteRoomType(Long id); +} diff --git a/specimen_management-demo/src/main/java/com/test/service/UserService.java b/my-batis-demo/src/main/java/com/test/service/UserService.java similarity index 87% rename from specimen_management-demo/src/main/java/com/test/service/UserService.java rename to my-batis-demo/src/main/java/com/test/service/UserService.java index c45c958..5312101 100644 --- a/specimen_management-demo/src/main/java/com/test/service/UserService.java +++ b/my-batis-demo/src/main/java/com/test/service/UserService.java @@ -12,5 +12,4 @@ public interface UserService { boolean deleteUser(Integer id); - User getUserById(String id); } diff --git a/specimen_management-demo/src/main/java/com/test/service/impl/AdminServiceImpl.java b/my-batis-demo/src/main/java/com/test/service/impl/AdminServiceImpl.java similarity index 100% rename from specimen_management-demo/src/main/java/com/test/service/impl/AdminServiceImpl.java rename to my-batis-demo/src/main/java/com/test/service/impl/AdminServiceImpl.java diff --git a/specimen_management-demo/src/main/java/com/test/service/impl/OrderServiceImpl.java b/my-batis-demo/src/main/java/com/test/service/impl/OrderServiceImpl.java similarity index 97% rename from specimen_management-demo/src/main/java/com/test/service/impl/OrderServiceImpl.java rename to my-batis-demo/src/main/java/com/test/service/impl/OrderServiceImpl.java index 3468b6c..8651ef2 100644 --- a/specimen_management-demo/src/main/java/com/test/service/impl/OrderServiceImpl.java +++ b/my-batis-demo/src/main/java/com/test/service/impl/OrderServiceImpl.java @@ -1,10 +1,12 @@ package com.test.service.impl; +import com.alibaba.fastjson.JSON; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import com.test.bean.Order; import com.test.bean.PageBean; import com.test.mapper.OrderMapper; +import com.test.mapper.RoomTypeMapper; import com.test.service.OrderService; import com.test.util.DateTimeUtils; import org.springframework.beans.factory.annotation.Autowired; diff --git a/my-batis-demo/src/main/java/com/test/service/impl/RoomTypeServiceImpl.java b/my-batis-demo/src/main/java/com/test/service/impl/RoomTypeServiceImpl.java new file mode 100644 index 0000000..2bbe3e6 --- /dev/null +++ b/my-batis-demo/src/main/java/com/test/service/impl/RoomTypeServiceImpl.java @@ -0,0 +1,52 @@ +package com.test.service.impl; + +import com.github.pagehelper.Page; +import com.github.pagehelper.PageHelper; +import com.test.bean.PageBean; +import com.test.bean.RoomType; +import com.test.mapper.RoomTypeMapper; +import com.test.service.RoomTypeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.util.ArrayList; + +@Service +public class RoomTypeServiceImpl implements RoomTypeService { + + @Autowired + RoomTypeMapper roomTypeMapper; + + @Override + public PageBean getRoomTypeByPage(int page, int pageSize) { + PageHelper.startPage(page, pageSize); + ArrayList roomType = roomTypeMapper.getRoomType(); + Page roomTypePage = (Page) roomType; + return new PageBean(roomTypePage.getTotal(), roomTypePage.getResult()); + } + + @Override + public boolean addRoomType(RoomType roomType) { + roomType.setCreateTime(LocalDateTime.now()); + roomType.setUpdateTime(LocalDateTime.now()); + return roomTypeMapper.addRoomType(roomType); + } + + @Override + public RoomType getRoomTypeById(Long id) { + return roomTypeMapper.getRoomTypeById(id); + } + + @Override + public boolean updateRoomType(RoomType roomType) { + roomType.setUpdateTime(LocalDateTime.now()); + return roomTypeMapper.updateRoomType(roomType); + } + + @Override + public boolean deleteRoomType(Long id) { + return roomTypeMapper.deleteRoomType(id); + } + +} diff --git a/specimen_management-demo/src/main/java/com/test/service/impl/UserServiceImpl.java b/my-batis-demo/src/main/java/com/test/service/impl/UserServiceImpl.java similarity index 90% rename from specimen_management-demo/src/main/java/com/test/service/impl/UserServiceImpl.java rename to my-batis-demo/src/main/java/com/test/service/impl/UserServiceImpl.java index e36b61c..bbe9aa9 100644 --- a/specimen_management-demo/src/main/java/com/test/service/impl/UserServiceImpl.java +++ b/my-batis-demo/src/main/java/com/test/service/impl/UserServiceImpl.java @@ -46,9 +46,4 @@ public class UserServiceImpl implements UserService { return userMapper.deleteUser(id); } - @Override - public User getUserById(String id) { - return userMapper.getUserById(Integer.valueOf(id)); - } - } diff --git a/specimen_management-demo/src/main/java/com/test/util/DateTimeUtils.java b/my-batis-demo/src/main/java/com/test/util/DateTimeUtils.java similarity index 100% rename from specimen_management-demo/src/main/java/com/test/util/DateTimeUtils.java rename to my-batis-demo/src/main/java/com/test/util/DateTimeUtils.java diff --git a/specimen_management-demo/src/main/java/com/test/util/JwtUtils.java b/my-batis-demo/src/main/java/com/test/util/JwtUtils.java similarity index 100% rename from specimen_management-demo/src/main/java/com/test/util/JwtUtils.java rename to my-batis-demo/src/main/java/com/test/util/JwtUtils.java diff --git a/specimen_management-demo/src/main/resources/application.properties b/my-batis-demo/src/main/resources/application.properties similarity index 100% rename from specimen_management-demo/src/main/resources/application.properties rename to my-batis-demo/src/main/resources/application.properties diff --git a/specimen_management-demo/src/test/java/com/test/MyBatisDemoApplicationTests.java b/my-batis-demo/src/test/java/com/test/MyBatisDemoApplicationTests.java similarity index 100% rename from specimen_management-demo/src/test/java/com/test/MyBatisDemoApplicationTests.java rename to my-batis-demo/src/test/java/com/test/MyBatisDemoApplicationTests.java diff --git a/sampleLibSystem b/sampleLibSystem deleted file mode 160000 index 5c98ecc..0000000 --- a/sampleLibSystem +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5c98ecced01b30a211ac291ab57e94d611705211 diff --git a/specimen_management-demo/.DS_Store b/specimen_management-demo/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/specimen_management-demo/.DS_Store and /dev/null differ diff --git a/test.txt b/test.txt new file mode 100644 index 0000000..3f7ca73 --- /dev/null +++ b/test.txt @@ -0,0 +1 @@ +text text text diff --git a/vue-next-admin b/vue-next-admin new file mode 160000 index 0000000..b74a1b1 --- /dev/null +++ b/vue-next-admin @@ -0,0 +1 @@ +Subproject commit b74a1b10fea87ef0a55e24ea939fe330298aa241 diff --git a/vue-next-admin-specimen b/vue-next-admin-specimen deleted file mode 160000 index 120a599..0000000 --- a/vue-next-admin-specimen +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 120a599f68718f4d7c2dc966bb526095e3c726fe diff --git a/第一阶段小组学习报告.docx b/第一阶段小组学习报告.docx new file mode 100644 index 0000000..3cd08ec Binary files /dev/null and b/第一阶段小组学习报告.docx differ diff --git a/第二阶段小组学习报告.docx b/第二阶段小组学习报告.docx deleted file mode 100644 index 5fc09c3..0000000 Binary files a/第二阶段小组学习报告.docx and /dev/null differ diff --git a/软件项目管理汇报PPT.pptx b/软件项目管理汇报PPT.pptx deleted file mode 100755 index 7cc6bf6..0000000 Binary files a/软件项目管理汇报PPT.pptx and /dev/null differ