Building a Campus Store Cashier Application with Spring Boot and Vue

Backend Framework: Spring Boot

Spring Boot is designed to streamline the creation of stand-alone, production-grade Spring applications. By prioritizing convention over configuration, it significantly reduces the complexity of setup. Developers can launch applications instantly using embedded servers like Tomcat without deploying external WAR files. The framework includes automatic configuration capabilities that eliminate the need for extensive XML, streamlining the development workflow. This approach allows engineers to focus on business logic rather than infrastructure configuration, providing a robust foundation for enterprise-level applications.

Frontend Framework: Vue.js

Vue.js serves as a robust open-source JavaScript framework designed for constructing user interfaces. Its component-based architecture allows for the efficient development of complex Single Page Applications (SPAs). Vue features a reactive data binding system that ensures the UI updates automatically when the underlying data changes. Utilizing a Virtual DOM optimizes rendering performance by minimizing direct DOM manipulation. Furthermore, its ecosystem provides essential tools like Vue Router for navigation and Vuex for state management, enhancing the developer experience and enabling the creation of scalable, interactive web applications.

Database System: MySQL

MySQL is a widely recognized relational database management system (RDBMS) renowned for its reliability and performance in handling structured data. It operates on a client-server model and supports standard SQL query language for data manipulation and retrieval. The system is highly flexible, offering multiple storage engines such as InnoDB for transactional integrity and MyISAM for read-heavy workloads. Its cross-platform compatibility allows it to run on various operating systems, making it a preferred choice for backend data storage in diverse software environments.

Core Implementation

The following configuration demonstrates the setup for the application context, database connectivity, and object-relational mapping using MyBatis Plus.

Application Configuration (application.yml)

server:
  port: 8081
  servlet:
    context-path: /campus-store

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/campus_store_db?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
    username: admin
    password: securePass
  servlet:
    multipart:
      max-file-size: 50MB
      max-request-size: 50MB
  resources:
    static-locations: classpath:/static/, file:uploads/

mybatis-plus:
  mapper-locations: classpath*:mapper/**/*.xml
  type-aliases-package: com.campus.store.entity
  configuration:
    map-underscore-to-camel-case: true
    cache-enabled: false
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
  global-config:
    db-config:
      id-type: auto
      logic-delete-field: deleted
      logic-delete-value: 1
      logic-not-delete-value: 0

Employee Data Mapper (EmployeeMapper.xml)



<mapper namespace="com.campus.store.mapper.EmployeeMapper">

    <resultMap id="BaseResultMap" type="com.campus.store.entity.Employee">
        <id column="id" property="id" jdbcType="INTEGER"/>
        <result column="emp_code" property="empCode" jdbcType="VARCHAR"/>
        <result column="password_hash" property="passwordHash" jdbcType="VARCHAR"/>
        <result column="full_name" property="fullName" jdbcType="VARCHAR"/>
        <result column="gender" property="gender" jdbcType="VARCHAR"/>
        <result column="job_title" property="jobTitle" jdbcType="VARCHAR"/>
        <result column="age" property="age" jdbcType="INTEGER"/>
        <result column="hire_date" property="hireDate" jdbcType="TIMESTAMP"/>
        <result column="phone" property="phone" jdbcType="VARCHAR"/>
        <result column="email" property="email" jdbcType="VARCHAR"/>
    </resultMap>

    <select id="selectEmployeePage" resultType="com.campus.store.vo.EmployeeVO">
        SELECT id, emp_code, full_name, job_title, phone
        FROM employees
        <where>
            <if test="ew != null">
                ${ew.sqlSegment}
            </if>
        </where>
    </select>

    <select id="getEmployeeDetail" resultType="com.campus.store.vo.EmployeeVO">
        SELECT * FROM employees
        <where>
            <if test="ew != null">
                ${ew.sqlSegment}
            </if>
        </where>
    </select>

</mapper>

Tags: java Spring Boot Vue.js MySQL MyBatis Plus

Posted on Tue, 11 Aug 2026 17:03:11 +0000 by keeve