基于Spring Boot的小区家政服务预约平台设计与实现
在社区服务数字化趋势下,开发基于BS架构的家政服务预约平台能有效提升居民生活便利性。该系统采用Spring Boot框架实现后端服务,Vue.js构建前端界面,MySQL存储数据,集成预约管理、服务评价、支付对接等核心功能。
系统架构设计
后端采用经典三层架构:
- 控制层(Controller):处理HTTP请求
- 服务层(Service):业务逻辑实现
- 持久层(Repository):数据库操作
前端通过Axios与后端RESTful API交互,采用JWT进行身份认证。数据库设计包含用户表、服务项目表、订单表等核心实体。
数据库表结构示例
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(50) NOT NULL,
`password` varchar(100) NOT NULL,
`phone` varchar(20) NOT NULL,
`role` enum('ADMIN','STAFF','USER') NOT NULL,
`create_time` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `service_item` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`description` text,
`price` decimal(10,2) NOT NULL,
`duration` int(11) NOT NULL COMMENT '分钟',
`status` tinyint(1) DEFAULT '1',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
核心功能实现
用户认证模块采用Spring Security集成JWT:
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private JwtAuthenticationFilter jwtAuthenticationFilter;
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable()
.authorizeRequests()
.antMatchers("/api/auth
879

被折叠的 条评论
为什么被折叠?



