基于springboot+thymeleaf+mybatis的员工管理系统 —— 登录与注册

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns=“http://maven.apache.org/POM/4.0.0” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”

xsi:schemaLocation=“http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd”>

4.0.0

com.yusael

ems

0.0.1-SNAPSHOT

ems

springboot + mybatis + thymeleaf 的 ems

<java.version>1.8</java.version>

org.springframework.boot

spring-boot-starter-parent

2.2.7.RELEASE

org.springframework.boot

spring-boot-starter-web

org.springframework.boot

spring-boot-starter-thymeleaf

org.mybatis.spring.boot

mybatis-spring-boot-starter

2.1.2

mysql

mysql-connector-java

5.1.43

runtime

com.alibaba

druid

1.1.12

org.projectlombok

lombok

true

org.springframework.boot

spring-boot-maven-plugin

数据库表设计和环境准备

==============================================================================

需求分析:

  • 既然做的员工管理系统,那肯定需要一个员工表(t_emp)来存储员工的信息,表的具体内容需要根据业务需求来决定,我们这里就做一个简易的管理系统,设的较为简单。

  • 由于我们要做登录功能,因此我们需要一个用户表(t_user)来存储用户信息。

建表SQL


员工表的SQL:

CREATE TABLE t_emp (

id varchar(40) NOT NULL,

name varchar(60) DEFAULT NULL,

salary double(7,2) DEFAULT NULL,

age int(3) DEFAULT NULL,

bir date DEFAULT NULL,

PRIMARY KEY (id)

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

用户表的SQL:

CREATE TABLE t_user (

id varchar(40) NOT NULL,

username varchar(40) DEFAULT NULL,

realname varchar(40) DEFAULT NULL,

password varchar(40) DEFAULT NULL,

sex varchar(8) DEFAULT NULL,

PRIMARY KEY (id)

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

application.properties


数据库建完表以后,还需要在 application.properties 中配置:

server.port=8989

server.servlet.context-path=/ems

##mysql配置

#指定连接池类型

spring.datasource.type=com.alibaba.druid.pool.DruidDataSource

#指定驱动

spring.datasource.driver-class-name=com.mysql.jdbc.Driver

#指定url

spring.datasource.url=jdbc:mysql://localhost:3306/ems?characterEncoding=UTF-8

#指定用户名

spring.datasource.username=root

#指定密码

spring.datasource.password=1234

##配置thymleaf(下面注释的是默认配置, 可以不设置)

#spring.thymeleaf.prefix=classpath:/templates/

#spring.thymeleaf.suffix=.html

#spring.thymeleaf.encoding=UTF-8

#spring.thymeleaf.cache=false # 想让热部署生效必须配置这个

#spring.thymeleaf.servlet.content-type=text/html

默认无法直接访问templates下的页面, 需要设置

spring.resources.static-locations=classpath:/templates/, classpath:/static/

#指定mapper配置文件位置

mybatis.mapper-locations=classpath:/com/yusael/mapper/*.xml

#指定起别名了的类

mybatis.type-aliases-package=com.yusael.entity

在启动类中加上 @MapperScan("com.yusael.dao") 来扫描该目录。

package com.yusael;

import org.mybatis.spring.annotation.MapperScan;

import org.springframework.boot.SpringApplication;

import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication

@MapperScan(“com.yusael.dao”)

public class EmsApplication {

public static void main(String[] args) {

SpringApplication.run(EmsApplication.class, args);

}

}

用户注册与登录功能

===============

  • 15
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
书城管理系统主要分为前台和后台两部分,前台主要是面向读者的,包括图书展示、购买、借阅等功能;后台主要是面向管理员的,包括图书管理、用户管理、订单管理等功能。 下面是一个基于SpringBoot + Thymeleaf + Mybatis的书城管理系统的简单实现: 1. 数据库设计 - 用户表:id, username, password, email, phone - 图书表:id, book_name, author, price, stock, sales, image - 订单表:id, user_id, book_id, status, create_time, update_time 2. 实体类设计 - 用户类:包括id、用户名、密码、邮箱、电话等属性 - 图书类:包括id、书名、作者、价格、库存、销量、图片等属性 - 订单类:包括id、用户id、图书id、状态、创建时间、更新时间等属性 3. DAO层设计 - 用户DAO:包括增删改查等操作,使用Mybatis注解或XML方式实现 - 图书DAO:包括增删改查等操作,使用Mybatis注解或XML方式实现 - 订单DAO:包括增删改查等操作,使用Mybatis注解或XML方式实现 4. 服务层设计 - 用户服务:包括用户注册登录、修改密码、查询用户信息等方法 - 图书服务:包括图书查询、购买、借阅、归还等方法 - 订单服务:包括订单生成、查询、修改状态等方法 5. 控制层设计 - 前台控制器:包括图书展示、购买、借阅等操作的处理 - 后台控制器:包括图书管理、用户管理、订单管理等操作的处理 6. 视图层设计 - 前台视图:包括图书展示、购买、借阅等页面的设计 - 后台视图:包括图书管理、用户管理、订单管理等页面的设计 以上是一个简单的基于SpringBoot + Thymeleaf + Mybatis的书城管理系统的设计实现,可以根据实际需求进行调整和扩展。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值