当前位置:实例文章 » JAVA Web实例» [文章]java版鸿鹄工程项目管理系统 Spring Cloud+Spring Boot+前后端分离构建工程项目管理系统源代码

java版鸿鹄工程项目管理系统 Spring Cloud+Spring Boot+前后端分离构建工程项目管理系统源代码

发布人:shili8 发布时间:2024-11-19 15:27 阅读次数:0

**Java 版鸿鹄工程项目管理系统**

**概述**

本文将介绍如何使用 Spring Cloud 和 Spring Boot 构建一个工程项目管理系统。该系统将分为前端和后端两部分,分别使用 Vue.js 和 Spring Boot 来实现。

**技术栈**

* **Spring Boot**:用于构建后端服务* **Spring Cloud**:用于构建微服务架构* **Vue.js**:用于构建前端应用**工程项目管理系统功能**

1. **用户管理**
* 用户注册和登录 * 用户信息管理(修改、删除)
2. **项目管理**
*项目创建和编辑 *项目成员管理(添加、删除)
3. **任务管理**
*任务创建和编辑 *任务分配和跟踪**后端服务**

### pom.xml

xml<dependencies>
 <!-- Spring Boot -->
 <dependency>
 <groupId>org.springframework.boot</groupId>
 <artifactId>spring-boot-starter-web</artifactId>
 </dependency>

 <!-- Spring Cloud -->
 <dependency>
 <groupId>org.springframework.cloud</groupId>
 <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
 </dependency>

 <!-- MySQL -->
 <dependency>
 <groupId>mysql</groupId>
 <artifactId>mysql-connector-java</artifactId>
 </dependency>

 <!-- MyBatis -->
 <dependency>
 <groupId>org.mybatis.spring.boot</groupId>
 <artifactId>mybatis-spring-boot-starter</artifactId>
 </dependency>
</dependencies>


### application.properties
propertiesspring.datasource.url=jdbc:mysql://localhost:3306/projectspring.datasource.username=rootspring.datasource.password=123456spring.jpa.hibernate.ddl-auto=updateeureka.client.register-with-eureka=trueeureka.client.fetch-registry=false


### User.java
java@Entitypublic class User {
 @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
 private Long id;
 private String username;
 private String password;

 // getter and setter}


### UserService.java
java@Servicepublic class UserService {
 @Autowired private UserRepository userRepository;

 public List getAllUsers() {
 return userRepository.findAll();
 }

 public User getUserById(Long id) {
 return userRepository.findById(id).orElse(null);
 }
}


### UserController.java
java@RestController@RequestMapping("/users")
public class UserController {
 @Autowired private UserService userService;

 @GetMapping public List getAllUsers() {
 return userService.getAllUsers();
 }

 @GetMapping("/{id}")
 public User getUserById(@PathVariable Long id) {
 return userService.getUserById(id);
 }
}


### Project.java
java@Entitypublic class Project {
 @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
 private Long id;
 private String name;

 // getter and setter}


### ProjectService.java
java@Servicepublic class ProjectService {
 @Autowired private ProjectRepository projectRepository;

 public List getAllProjects() {
 return projectRepository.findAll();
 }

 public Project getProjectById(Long id) {
 return projectRepository.findById(id).orElse(null);
 }
}


### ProjectController.java
java@RestController@RequestMapping("/projects")
public class ProjectController {
 @Autowired private ProjectService projectService;

 @GetMapping public List getAllProjects() {
 return projectService.getAllProjects();
 }

 @GetMapping("/{id}")
 public Project getProjectById(@PathVariable Long id) {
 return projectService.getProjectById(id);
 }
}


### Task.java
java@Entitypublic class Task {
 @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
 private Long id;
 private String name;

 // getter and setter}


### TaskService.java
java@Servicepublic class TaskService {
 @Autowired private TaskRepository taskRepository;

 public List getAllTasks() {
 return taskRepository.findAll();
 }

 public Task getTaskById(Long id) {
 return taskRepository.findById(id).orElse(null);
 }
}


### TaskController.java
java@RestController@RequestMapping("/tasks")
public class TaskController {
 @Autowired private TaskService taskService;

 @GetMapping public List getAllTasks() {
 return taskService.getAllTasks();
 }

 @GetMapping("/{id}")
 public Task getTaskById(@PathVariable Long id) {
 return taskService.getTaskById(id);
 }
}


### ProjectMember.java
java@Entitypublic class ProjectMember {
 @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
 private Long id;
 private String username;

 // getter and setter}


### ProjectMemberService.java
java@Servicepublic class ProjectMemberService {
 @Autowired private ProjectMemberRepository projectMemberRepository;

 public List getAllProjectMembers() {
 return projectMemberRepository.findAll();
 }

 public ProjectMember getProjectMemberById(Long id) {
 return projectMemberRepository.findById(id).orElse(null);
 }
}


### ProjectMemberController.java
java@RestController@RequestMapping("/project-members")
public class ProjectMemberController {
 @Autowired private ProjectMemberService projectMemberService;

 @GetMapping public List getAllProjectMembers() {
 return projectMemberService.getAllProjectMembers();
 }

 @GetMapping("/{id}")
 public ProjectMember getProjectMemberById(@PathVariable Long id) {
 return projectMemberService.getProjectMemberById(id);
 }
}


### TaskAssignee.java
java@Entitypublic class TaskAssignee {
 @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
 private Long id;
 private String username;

 // getter and setter}


### TaskAssigneeService.java
java@Servicepublic class TaskAssigneeService {
 @Autowired private TaskAssigneeRepository taskAssigneeRepository;

 public List getAllTaskAssignees() {
 return taskAssigneeRepository.findAll();
 }

 public TaskAssignee getTaskAssigneeById(Long id) {
 return taskAssigneeRepository.findById(id).orElse(null);
 }
}


### TaskAssigneeController.java
java@RestController@RequestMapping("/task-assignees")
public class TaskAssigneeController {
 @Autowired private TaskAssigneeService taskAssigneeService;

 @GetMapping public List getAllTaskAssignees() {
 return taskAssigneeService.getAllTaskAssignees();
 }

 @GetMapping("/{id}")
 public TaskAssignee getTaskAssigneeById(@PathVariable Long id) {
 return taskAssigneeService.getTaskAssigneeById(id);
 }
}


### ProjectTask.java
java@Entitypublic class ProjectTask {
 @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
 private Long id;
 private String name;

 // getter and setter}


### ProjectTaskService.java
java@Servicepublic class ProjectTaskService {
 @Autowired private ProjectTaskRepository projectTaskRepository;

 public List getAllProjectTasks() {
 return projectTaskRepository.findAll();
 }

 public ProjectTask getProjectTaskById(Long id) {
 return projectTaskRepository.findById(id).orElse(null);
 }
}


### ProjectTaskController.java
java@RestController@RequestMapping("/project-tasks")
public class ProjectTaskController {
 @Autowired private ProjectTaskService projectTaskService;

 @GetMapping public List getAllProjectTasks() {
 return projectTaskService.getAllProjectTasks();
 }

 @GetMapping("/{id}")
 public ProjectTask getProjectTaskById(@PathVariable Long id) {
 return projectTaskService.getProjectTaskById(id);
 }
}


### TaskStatus.java
java@Entitypublic class TaskStatus {
 @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
 private Long id;
 private String name;

 // getter and setter}


### TaskStatusService.java
java@Servicepublic class TaskStatusService {
 @Autowired private TaskStatusRepository taskStatusRepository;

 public List getAllTaskStatuses() {
 return taskStatusRepository.findAll();
 }

 public TaskStatus getTaskStatusById(Long id) {
 return taskStatusRepository.findById(id).orElse(null);
 }
}


### TaskStatusController.java
java@RestController@RequestMapping("/task-statuses")
public class TaskStatusController {
 @Autowired private TaskStatusService taskStatusService;

 @GetMapping public List getAllTaskStatuses() {
 return taskStatusService.getAllTaskStatuses();
 }

 @GetMapping("/{id}")
 public TaskStatus getTaskStatusById(@PathVariable Long id) {
 return taskStatusService.getTaskStatusById(id);
 }
}


### ProjectMemberTask.java
java@Entitypublic class ProjectMemberTask {
 @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
 private Long id;
 private String name;

 // getter and setter}


### ProjectMemberTaskService.java
java@Servicepublic class ProjectMemberTaskService {
 @Autowired private ProjectMemberTaskRepository projectMemberTaskRepository;

 public List

其他信息

其他资源

Top