Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Developing a Club Management System with Spring Boot and Vue

Tech 4

The system serves three primary roles: Administrator, Club Leader, and Club Member. It targets campus club operations and adopts a decoupled architecture with Spring Boot on the backend and Vue on the frontend. The backend relies on MyBatis for data access, while the frontend leverages the Element UI component library. The development environment uses IntelliJ IDEA or VS Code, MySQL 5.7 as the database, and JDK 1.8.

Interface Overview

The landing page presents the main dashboard. The login form adapts to differant user roles. After authentication, the Administrator can manage system users, review club activities, organize club categories, proces club applications, view club details, and handle notification broadcasts. Students can submit applications to join clubs and maintain their personal information.

Code Snippets

Authentication endpoint example:

@PostMapping("/auth")
@ResponseBody
public R authenticate(String username, String password, HttpSession session) {
    Log.info("Authentication attempt for user: {}", username);
    Users account = usersService.findByUsername(username);
    if (account == null) {
        return R.fail("Account does not exist");
    }
    if (!password.equals(account.getPassword().trim())) {
        return R.fail("Invalid credentials");
    }
    String accessToken = IDUtils.generateUUID();
    cacheHandle.storeToken(accessToken, account.getId());
    return R.ok("Login successful", accessToken);
}

Club management controller methods:

@GetMapping("/detail")
@ResponseBody
public R fetchDetail(String id) {
    Log.info("Fetching club detail, ID: {}", id);
    Club club = clubService.findById(id);
    return R.data(club);
}

@GetMapping("/all")
@ResponseBody
public R fetchAll() {
    Log.info("Retrieving all clubs");
    return R.data(clubService.fetchAll());
}

@GetMapping("/by-manager")
@ResponseBody
public R fetchByManager(String managerId) {
    Log.info("Fetching clubs managed by: {}", managerId);
    return R.data(clubService.findByManagerId(managerId));
}

@GetMapping("/paginate")
@ResponseBody
public R fetchPage(Long current, Long size, String token, Club filter) {
    Users currentUser = usersService.findById(cacheHandle.extractUserId(token));
    if (currentUser.getRole() == 1) {
        filter.setLeadId(currentUser.getId());
    }
    Log.info("Paginating clubs, page: {}, size: {}, filters: {}", current, size, filter);
    PageResult page = clubService.queryPage(current, size, filter);
    return R.data(page);
}

@PostMapping("/create")
@ResponseBody
public R createClub(Club club) {
    club.setId(IDUtils.generateId());
    club.setEstablishedDate(DateUtils.formatNow("yyyy-MM-dd"));
    Log.info("Creating club: {}", club);
    clubService.insert(club);
    return R.ok();
}

The implementation offers a complete feature set, a clean interface, and a well-structured database schema suitable for studying a typical SPA application with role-based access control.

Tags: Spring Boot

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.