这次我尝试写一个原创的项目 the_game

  框架选择: SpringBoot+Mybatisplus+Shiro

首先是简单的介绍(素材灵感来自英雄联盟)

5个关键的表:

  admin(管理员):

  lol(英雄):

  lol_forces(势力):

  lol_occupation(职业):

  lol_routes(分路):

其中英雄表中的 force_id 为int类型,必须通过查找 lol_forces 才能得到具体势力名

occupation_one、occupation_two 为int类型,必须通过查找 lol_occupation 才能得到具体职业名

route_one、route_two 为int类型,必须通过查找 lol_routes 才能得到具体分路名

Gender(性别):使用枚举的方式

因为使用了MybatisPlus,所以减轻了很多写Sql的负担,并且增加了 逻辑删除, 主键策略, 枚举等工具

实体类(都使用了Lombok):

LoL

package com.zy.entity.lol;

import com.baomidou.mybatisplus.annotation.*;
import com.zy.enums.GenderEnum;
import lombok.Data; import java.util.Date; @Data
@TableName(value = "lol")
/**
* 英雄联盟实体类
*/
public class Lol { //英雄编号,主键
//采用手动赋值方式
@TableId(type = IdType.INPUT)
private Integer hId; //英雄称号
@TableField(value = "designation")
private String designation; //英雄名
@TableField(value = "hero_name")
private String heroName; //性别,采用枚举的方式
@TableField(value = "gender")
//private Integer gender;
private GenderEnum gender; //势力编号,可以查询forces表得到
@TableField(value = "force_id")
private Integer forceId; //主要职业编号,可以查询forces表得到
@TableField(value = "occupation_one")
private Integer occupationOne; //次要职业编号,可以查询forces表得到
@TableField(value = "occupation_two")
private Integer occupationTwo; //推荐分路一,可以查询routes表得到
@TableField(value = "route_one")
private Integer routeOne; //推荐分路二,可以查询routes表得到
@TableField(value = "route_two")
private Integer routeTwo; //逻辑删除
@TableLogic
private Integer deleted; //创建时间
@TableField(value = "create_time",fill = FieldFill.INSERT)
private Date createTime; //更新时间
@TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE)
private Date updateTime; }
lolForces:
@Data
@TableName(value = "lol_forces")
/**
* lol的势力实体类
*/
public class LolForces { //势力编号,主键
//采用手动赋值方式
@TableId(type = IdType.INPUT)
private Integer fId; //势力名
@TableField(value = "f_name")
private String fName; }

LolOccupation:
@Data
@TableName(value = "lol_occupation")
/**
* lol的职业实体类
*/
public class LolOccupation { //职业编号,主键
//采用默认方式
@TableId
private Integer hcId; //职业名(英文)
@TableField(value = "name_us")
private String nameUs; //职业名(中文)
@TableField(value = "name_cn")
private String nameCn; }

LolRoutes:
@Data
@TableName(value = "lol_routes")
/**
* lol的分路实体类
*/
public class LolRoutes { //分路编号,主键
//采用手动赋值方式
@TableId(type = IdType.INPUT)
private Integer rId; //分路名
@TableField(value = "route")
private String route;
}

GenderEnum枚举
package com.zy.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;

public enum GenderEnum {
男(0,"男"),
女(1,"女"); GenderEnum(Integer code, String msg) {
this.code = code;
this.msg = msg;
} public Integer getCode() {
return code;
} public String getMsg() {
return msg;
} @EnumValue
private Integer code;
private String msg; }

还需要注意的是,因为前端显示数据时,像是势力、职业这种属性,不能用数字,而需要名字

因此我的增加了VO(value object)用于传输,其封装的属性都是前端页面需要的

LolVo

@Data
/**
* 传输的实体类
*/
public class LolVo { //英雄编号
private Integer hId;
//英雄称号
private String designation;
//英雄名
private String heroName;
//性别
private GenderEnum gender;
//势力名
private String force;
//职业名(主)
private String occupationOne;
//职业名(次)
private String occupationTwo;
//推荐分路名一
private String routeOne;
//推荐分路名二
private String routeTwo; }

管理lol表 是此项目的核心,其中admin(管理员)拥有CRUD的权限,而未登录的游客只可以进行查找

在呈现数据时,采用分页的方式,并且页面通过session判断是否登录,从而呈现不同的按钮, 比如增删改的按钮游客不可见

 

效果初览(游客视角):

  

关于写SpringBoot+Mybatisplus+Shiro项目的经验分享一:简单介绍的更多相关文章

  1. 关于写SpringBoot+Mybatisplus+Shiro项目的经验分享四:部署到阿里云

    框架: SpringBoot+Mybatisplus+Shiro 简单介绍:关于写SpringBoot+Mybatisplus+Shiro项目的经验分享一:简单介绍 阿里云开放必要端口,mysql与t ...

  2. 关于写SpringBoot+Mybatisplus+Shiro项目的经验分享三:问题2

    框架: SpringBoot+Mybatisplus+Shiro 简单介绍:关于写SpringBoot+Mybatisplus+Shiro项目的经验分享一:简单介绍 搜索框是该项目重要的一环,由于涉及 ...

  3. 关于写SpringBoot+Mybatisplus+Shiro项目的经验分享二:问题1

    框架: SpringBoot+Mybatisplus+Shiro 简单介绍:关于写SpringBoot+Mybatisplus+Shiro项目的经验分享一:简单介绍 添加时,如果失败,不能正确跳转 c ...

  4. spring-boot+mybatisPlus+shiro的集成demo 我用了5天

    spring-boot + mybatis-plus + shiro 的集成demo我用了五天 关于shiro框架,我还是从飞机哪里听来的,就连小贱都知道,可我母鸡啊.简单百度了下,结论很好上手,比s ...

  5. Visual Studio 2015开发Qt项目实战经验分享(附项目示例源码)

    Visual Studio 2015开发Qt项目实战经验分享(附项目示例源码)    转 https://blog.csdn.net/lhl1124281072/article/details/800 ...

  6. IDEA上创建 Maven SpringBoot+mybatisplus+thymeleaf 项目

    概述 在WEB领域,Java也是在不断的探索和改进,从开始的JSP--->Struts1--->Struts2+Spring--->Spring MVC--->SpringBo ...

  7. Hadoop源码学习笔记之NameNode启动场景流程一:源码环境搭建和项目模块及NameNode结构简单介绍

    最近在跟着一个大佬学习Hadoop底层源码及架构等知识点,觉得有必要记录下来这个学习过程.想到了这个废弃已久的blog账号,决定重新开始更新. 主要分以下几步来进行源码学习: 一.搭建源码阅读环境二. ...

  8. 自己动手写处理器之第二阶段(2)——Verilog HDL简单介绍

    将陆续上传本人写的新书<自己动手写处理器>(尚未出版),今天是第六篇.我尽量每周四篇 2.3 Verilog HDL简单介绍 本书实现的OpenMIPS处理器是使用Verilog HDL编 ...

  9. springboot+mybatis+shiro项目中使用shiro实现登录用户的权限验证。权限表、角色表、用户表。从不同的表中收集用户的权限、

    要实现的目的:根据登录用户.查询出当前用户具有的所有权限.然后登录系统后.根据查询到的权限信息进行不同的操作. 以下的代码是在搭好的框架之下进行的编码. 文章目录 核心实现部分. 第一种是将用户表和角 ...

随机推荐

  1. 2019.03.27【GDOI2019】模拟 T3

    题目大意 给出$n$, $p$, 求有多少长度为$n$的排列可以被分成三个上升子序列, 数量对$p$取模, 数据范围 $3 \leq n \leq 500$. 思路 首先让我们考虑如果有一个排列,如何 ...

  2. hdu 5092 Seam Carving (简单数塔DP,题没读懂,,不过可以分析样例)

    题意: 给一个m*n的矩阵,每格上有一个数. 找从第1行到第m行的一条路径,使得这条路径上的数之和最小. 路径必须满足相邻两行所选的两个数的纵坐标相邻(即一个格子必须是另一个格子的周围八个格子中的一个 ...

  3. spark structured-streaming 最全的使用总结

    一.spark structured-streaming  介绍 我们都知道spark streaming  在v2.4.5 之后 就进入了维护阶段,不再有新的大版本出现,而且 spark strea ...

  4. 记录一个很傻的错误(C++)

    使用的vscode写代码,导入了vector,memory,然后忘了导入string.但是代码中能够提示std::string也就让我忘了导入string.然后就莫名其妙的报错了.找了很久的错.记录下 ...

  5. 『学了就忘』Linux基础命令 — 37、Linux中挂载操作的相关命令

    目录 1.mount命令介绍 (1)mount命令说明 (2)mount命令格式 2.mount命令示例 3.mount -a命令说明 4.-o特殊选项说明 5.exec/noexec选项说明 挂载就 ...

  6. macos command 'clang' failed with exit status 1

    export CC=$(which gcc)export CXX=$(which g++)pip install fbprophet CC=clang pip install gevent

  7. GoLang设计模式15 - 策略模式

    策略模式是一种行为型设计模式.通过策略模式,可以在运行时修改一个对象的行为. 接下来仍然是通过例子来了解策略模式.比如说内存缓存,这是我们在开发中经常使用的东西,大家应该都有一定的了解,接下来就用内存 ...

  8. SpringCloud升级之路2020.0.x版-36. 验证断路器正确性

    本系列代码地址:https://github.com/JoJoTec/spring-cloud-parent 上一节我们通过单元测试验证了线程隔离的正确性,这一节我们来验证我们断路器的正确性,主要包括 ...

  9. c语言1左移32位(1<<32)是多少,左移-1位呢

    C语言中 << 是逻辑移位,不是循环移位.1 左移 32 位后为 0,左移 -1 位实际是左移 255 位(互补),当然也是0.这种问题可以写一段小程序,单步执行,看一下每一步的结果.先说 ...

  10. jpg与jpeg的区别在哪

    JPG文件的优点是体积小巧,并且兼容性好,因为大部分的程序都能读取这种文件,这是因为JPG格式不仅是一个工业标准格式,而且更是web的标准文件格式.JPG文件如此拥有如此便利的条件,难怪得到了业余玩家 ...