博主介绍:?全网粉丝5W+,全栈开发工程师,从事多年软件开发,在大厂呆过。持有软件中级、六级等证书。可提供微服务项目搭建与毕业项目实战,博主也曾写过优秀论文,查重率极低,在这方面有丰富的经验?
博主作品:《Java项目案例》主要基于SpringBoot+MyBatis/MyBatis-plus+MySQL+Vue等前后端分离项目,可以在左边的分类专栏找到更多项目。《Uniapp项目案例》有几个有uniapp教程,企业实战开发。《微服务实战》专栏是本人的实战经验总结,《Spring家族及微服务系列》专注Spring、SpringMVC、SpringBoot、SpringCloud系列、Nacos等源码解读、热门面试题、架构设计等。除此之外还有不少文章等你来细细品味,更多惊喜等着你哦
🍅uniapp微信小程序🍅面试题软考题免费使用,还可以使用ChatGPT,微信支付,扫码加群
🍅文末获取联系🍅精彩专栏推荐订阅👇🏻👇🏻 不然下次找不到哟
Java项目案例《100套》
https://blog.csdn.net/qq_57756904/category_12173599.html
uniapp小程序《100套》https://blog.csdn.net/qq_57756904/category_12199600.html
有需求代码永远写不完,而方法才是破解之道,抖音有实战视频课程,某马某千等培训都是2万左右,甚至广东有本科院校单单一年就得3万4年就12万学费,而且还没有包括吃饭的钱。所以很划算了。另外博客左侧有源码阅读专栏,对于求职有很大帮助,当然对于工作也是有指导意义等。在大城市求职,你面试来回一趟多多少少都在12块左右,而且一般不会一次性就通过,还得面试几家。而如果你对源码以及微服务等有深度认识,这无疑给你的面试添砖加瓦更上一层楼。
最后再送一句:最好是学会了,而不是学废了!!!
目录
一、行业痛点与功能需求
二、系统设计
开发系统:Windows10
架构模式:MVC/前后端分离
JDK版本:Java JDK1.8
开发工具:IDEA
数据库版本: mysql5.7
数据库可视化工具: SQL yog或Navicat for MySQL
服务器:SpringBoot自带 apache tomcat
主要技术:Java、SpringBoot2.7、MyBatis-plus、SpringSecurity、JWT、MySQL、Redis、Html、Vue、Elementui等
? ? 借鉴微服务单点登录设计
三、数据库设计
四、功能截图?
1)根据楼栋查询单元
2)单元列表
1)房屋列表
添加房屋功能点设计:
2)选择楼栋
1)列表
五、实现代码
@RestController
@AllArgsConstructor
@RequestMapping("/api/room")
public class RoomController {
private IRoomService roomService;
@GetMapping
public Object loadRooms(@RequestParam Map<String, String> query) {
PageInfo<RoomVO> pageInfo = roomService.loadRooms(query);
return R.ok(pageInfo);
}
@GetMapping("/ownerRooms")
public Object loadOwnerRoomInfos(@RequestParam Map<String, String> query) {
PageInfo<RoomVO> pageInfo = roomService.loadOwnerRoomInfos(query);
return R.ok(pageInfo);
}
@GetMapping("{ownerId}")
public Object loadRoomsByOwnerId(@PathVariable String ownerId) {
List<RoomVO> roomVoList = roomService.loadRoomsByOwnerId(ownerId);
return R.ok(roomVoList);
}
@PostMapping
public Object addRoom(@RequestBody RoomDTO roomDTO) {
String s = roomService.addRoom(roomDTO);
return R.ok(s);
}
@PutMapping
public Object editRoom(@RequestBody RoomDTO roomDTO) {
String s = roomService.editRoom(roomDTO);
return R.ok(s);
}
@DeleteMapping("{roomId}")
public Object deleteRoom(@PathVariable String roomId) {
String s = roomService.deleteRoomById(roomId);
return R.ok(s);
}
}
public interface IRoomService extends IService<Room> {
PageInfo<RoomVO> loadRooms(Map<String, String> query);
PageInfo<RoomVO> loadOwnerRoomInfos(Map<String, String> query);
List<String> selectRoomIdByViewId(String floorId, String unitId);
List<RoomVO> loadRoomsByOwnerId(String ownerId);
String addRoom(RoomDTO roomDTO);
String editRoom(RoomDTO roomDTO);
String deleteRoomById(String roomId);
}
@Service
public class RoomServiceImpl extends ServiceImpl<RoomMapper, Room> implements IRoomService {
@Override
public PageInfo<RoomVO> loadRooms(Map<String, String> query) {
CriticalQuery criticalQuery = CriticalQuery.create(query);
PageParam pageParam = criticalQuery.pageParam();
IPage<RoomVO> page = new Page<>(pageParam.getPage(), pageParam.getSize());
QueryWrapper<Object> wrapper = criticalQuery.queryWrapper();
page = baseMapper.loadRooms(page, wrapper);
PageInfo<RoomVO> pageInfo = PageInfo.of(page.getCurrent(), page.getSize());
List<RoomVO> voList = page.getRecords();
pageInfo.setTotal(page.getTotal()).setList(voList);
return pageInfo;
}
@Override
public PageInfo<RoomVO> loadOwnerRoomInfos(Map<String, String> query) {
CriticalQuery criticalQuery = CriticalQuery.create(query);
PageParam pageParam = criticalQuery.pageParam();
IPage<RoomVO> page = new Page<>(pageParam.getPage(), pageParam.getSize());
QueryWrapper<Object> wrapper = criticalQuery.queryWrapper();
page = baseMapper.loadOwnerRoomInfos(page, wrapper);
PageInfo<RoomVO> pageInfo = PageInfo.of(page.getCurrent(), page.getSize());
List<RoomVO> voList = page.getRecords();
pageInfo.setTotal(page.getTotal()).setList(voList);
return pageInfo;
}
@Override
public List<String> selectRoomIdByViewId(String floorId, String unitId) {
return baseMapper.selectRoomIdByViewId(floorId, unitId);
}
@Override
public List<RoomVO> loadRoomsByOwnerId(String ownerId) {
List<String> roomIds = baseMapper.selectRoomIdByOwnerId(ownerId);
List<RoomVO> roomVoList = Lists.newArrayList();
roomIds.forEach(id -> {
RoomVO roomVo = baseMapper.loadRoomsByOwnerId(id);
roomVoList.add(roomVo);
});
return roomVoList;
}
@Override
public String addRoom(RoomDTO roomDTO) {
Room room = BeanCopyUtil.copyProperties(roomDTO, Room::new);
room.setUserId(SecurityUtils.getUserId());
room.setCreateTime(LocalDateTime.now());
save(room);
return room.getRoomId();
}
@Override
public String editRoom(RoomDTO roomDTO) {
Room room = BeanCopyUtil.copyProperties(roomDTO, Room::new);
room.setUserId(SecurityUtils.getUserId());
updateById(room);
return room.getRoomId();
}
@Override
public String deleteRoomById(String roomId) {
return String.valueOf(baseMapper.deleteById(roomId));
}
}
六、获取源码
?点赞、收藏、关注?、天下没有免费的午餐关注下方公众号获取联系方式👇🏻👇🏻