首页 > 其他分享 >springboot3+vue3大事件(一)项目准备工作

springboot3+vue3大事件(一)项目准备工作

时间:2024-03-04 10:44:20浏览次数:25  
标签:comment varchar String private 事件 vue3 null id springboot3

 1、执行sql脚本,准备数据库表

-- 创建数据库
create database dev;

-- 使用数据库
use dev;

-- 用户表
create table user (
                      id int unsigned primary key auto_increment comment 'ID',
                      username varchar(20) not null unique comment '用户名',
                      password varchar(32)  comment '密码',
                      nickname varchar(10)  default '' comment '昵称',
                      email varchar(128) default '' comment '邮箱',
                      user_pic varchar(128) default '' comment '头像',
                      create_time datetime not null comment '创建时间',
                      update_time datetime not null comment '修改时间'
) comment '用户表';

-- 分类表
create table category(
                         id int unsigned primary key auto_increment comment 'ID',
                         category_name varchar(32) not null comment '分类名称',
                         category_alias varchar(32) not null comment '分类别名',
                         create_user int unsigned not null comment '创建人ID',
                         create_time datetime not null comment '创建时间',
                         update_time datetime not null comment '修改时间',
                         constraint fk_category_user foreign key (create_user) references user(id) -- 外键约束
);

-- 文章表
create table article(
                        id int unsigned primary key auto_increment comment 'ID',
                        title varchar(30) not null comment '文章标题',
                        content varchar(10000) not null comment '文章内容',
                        cover_img varchar(128) not null  comment '文章封面',
                        state varchar(3) default '草稿' comment '文章状态: 只能是[已发布] 或者 [草稿]',
                        category_id int unsigned comment '文章分类ID',
                        create_user int unsigned not null comment '创建人ID',
                        create_time datetime not null comment '创建时间',
                        update_time datetime not null comment '修改时间',
                        constraint fk_article_category foreign key (category_id) references category(id),-- 外键约束
                        constraint fk_article_user foreign key (create_user) references user(id) -- 外键约束
)
数据库脚本

2、创建springboot工程,引入对应的依赖(web、mybatis、mysql驱动)

 点击创建后,首选配置好maven地址

添加 mybatis、mysql依赖

3、配置文件application.yml中引入mybatis的配置信息

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/dev
    username: root
    password: 123456
View Code

4、创建包结构,并准备实体类

controller 控制器、mapper、pojo 实体、service、impl service实现类、utils 工具类

 

package com.example.bigevent.pojo;


import java.time.LocalDateTime;

public class Article {
    private Integer id;//主键ID
    private String title;//文章标题
    private String content;//文章内容
    private String coverImg;//封面图像
    private String state;//发布状态 已发布|草稿
    private Integer categoryId;//文章分类id
    private Integer createUser;//创建人ID
    private LocalDateTime createTime;//创建时间
    private LocalDateTime updateTime;//更新时间
}
Article实体
package com.example.bigevent.pojo;

import java.time.LocalDateTime;

public class Category {
    private Integer id;//主键ID
    private String categoryName;//分类名称
    private String categoryAlias;//分类别名
    private Integer createUser;//创建人ID
    private LocalDateTime createTime;//创建时间
    private LocalDateTime updateTime;//更新时间
}
Category实体
package com.example.bigevent.pojo;



import java.time.LocalDateTime;

public class User {
    private Integer id;//主键ID
    private String username;//用户名
    private String password;//密码
    private String nickname;//昵称
    private String email;//邮箱
    private String userPic;//用户头像地址
    private LocalDateTime createTime;//创建时间
    private LocalDateTime updateTime;//更新时间
}
User实体

 

5、运行

 

标签:comment,varchar,String,private,事件,vue3,null,id,springboot3
From: https://www.cnblogs.com/JoeYD/p/18051317

相关文章

  • Windows操作系统中的时间戳(Timestamp)是指用于标记事件发生时间的一种时间表示方式。在
    Windows操作系统中的时间戳(Timestamp)是指用于标记事件发生时间的一种时间表示方式。在计算机系统中,时间戳通常用来记录文件的创建时间、修改时间、访问时间等信息,也常用于网络通信中的认证和数据同步等场景。以下是Windows时间戳的基础技术原理:系统时钟:Windows操作系统通过系统......
  • 一款基于Vue3实现的漂亮且功能强大的在线海报设计器
    大家好,我是Java陈序员。我们在工作中经常需要设计各种各样的图片,海报、产品图、文章图片、视频/公众号等。我们可以选择使用PS来设计图片,但是有时候想快速完成任务,有没有一款工具支持快速生成海报呢?答案是有的,今天给大家介绍一款在线图片(海报)设计器。关注微信公众号:【Java......
  • 给大家推荐一款基于Vue3通用型后台管理模板
    ​ 给大家推荐一款基于Vue3通用型后台管理模板这款Vue3后台管理模板介绍如下:        使用Vue3、Vite、ElementPlus、Pinia最新开发技术栈,拥有完整的Token登录鉴权、路由配置、界面简洁美观,可根据需要灵活配置主题、系统采用响应式布局,自适应各类屏幕尺寸、源代码有......
  • js页面当中没有写回车事件,但是有回车效果
    前两天遇到一个问题,研究了我很差事件。问题如下:页面只有一个文本框,没有写任何回车事件,但是点回车的时候,就会触发回车,回传页面。于是各种google,终于有了结果:如果表单里有一个type=”submit”的按钮,回车键生效。如果 表单里只有一个type=”text”的input,不管按钮是什么type,回......
  • vue3笔记3watch监视的几种变化
    <template> <divclass="about">  <p>情况一,监事ref的值</p>  <h1>求和{{sum}}</h1>  <button@click="changeSum">++++</button> </div></template><scriptlang="ts"......
  • Vue3学习(二十一)- 文档管理页面布局修改
    写在前面按照国际惯例,要先聊下生活,吐槽一番,今天是2月14日,也是下午听老妈说,我才知道!现在真的是对日期节日已经毫无概念可言,只知道星期几。现在已经觉得写博客也好,学习文章也罢,和写日记一样,已经融入到我的生活中,或者更确切的说,变成生活的一部分了。饭后和老妈闲聊了几句后,我发......
  • C#事件
    转载:https://blog.csdn.net/nameyichao/article/details/124646611?spm=1001.2100.3001.7377&utm_medium=distribute.pc_feed_blog_category.none-task-blog-classify_tag-11-124646611-null-null.nonecase&depth_1-utm_source=distribute.pc_feed_blog_category.none-......
  • 在Avalonia项目中使用MediatR和MS.DI库实现事件驱动通信
    大家好,我是沙漠尽头的狼!AvaloniaUI是一个强大的跨平台.NET客户端开发框架,让开发者能够针对Windows、Linux、macOS、Android和iOS等多个平台构建应用程序。在构建复杂的应用程序时,模块化和组件间的通信变得尤为重要。Prism框架提供了模块化的开发方式,支持插件的热拔插,而MediatR则......
  • Blazor之onclick事件更新值
    <h1>EventHandlerExample1</h1><h2>@headingValue</h2><p><button@onclick="UpdateHeading">Updateheading</button></p><p><label><inputtype="checkb......
  • Blazor常用事件
    一、Input事件:<h1>BindEventExample</h1><p><label>InputValue:<input@bind="InputValue"@bind:event="oninput"/></label></p><p><code>InputValue</cod......