这次我尝试写一个原创的项目 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. 解决svn异常报错“”cleanup failed to process the following paths …… previous operation has not finished”

    参考高票答案https://stackoverflow.com/questions/10128201/subversion-stuck-due-to-previous-operation-has-no ...

  2. Spring:面向切面编程的AOP

    一.前言 除了依赖注入(DI),Spring框架提供的另一个核心功能是对面向方面的编程(AOP)的支持. AOP通常被称为实现横切关注点的工具.横切关注点一词是指应用程序中的逻辑不能与应用程序的其余部 ...

  3. ubuntu 编译C++ error: ‘syscall’ was not declared in this scope

    明明已经加了头文件 #include <sys/syscall.h> #include <sched.h> #include <sys/resource.h> 编译 ...

  4. ASP的调试技术解答

    一. 调试 ASP.NET 应用程序时出现"未将项目配置为进行调试"的错误信息 症状 当您在 Visual Studio .NET 中调试 ASP.NET 应用程序时,可能会出现下 ...

  5. Codeforces Round #738 (Div. 2) D2题解

    D2. Mocha and Diana (Hard Version) 至于D1,由于范围是1000,我们直接枚举所有的边,看看能不能加上去就行,复杂度是\(O(n^2logn)\).至于\(n\)到了 ...

  6. hdu 1058 Humble Numbers(构造?枚举?)

    题意: 一个数的质因子如果只是2,3,5,7中的若干个.则这个数叫做humble number. 例如:1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 1 ...

  7. PWN学习之整数溢出

    目录 PWN学习之整数溢出 整数溢出 溢出和回绕 漏洞多发函数 整数溢出例子 PWN学习之整数溢出 整数溢出 如果一个整数用来计算一些敏感数值,如缓冲区大小或数值索引,就会产生潜在的危险.通常情况下, ...

  8. 服务集与AP的配合

    一.实验目的 1)掌握添加无线网络配置 2)掌握配置信道和协议使用并配置在一个天线上同时运行两个服务集,即两个无线网络 二.实验仪器设备及软件 仪器设备:一台AC,两台AP,一台AR,一台LSW 软件 ...

  9. 【编译原理】LL1文法语法分析器

    上篇文章[编译原理]语法分析--自上向下分析 分析了LL1语法,文章最后说给出栗子,现在补上去. 说明: 这个语法分析器是利用LL1分析方法实现的. 预测分析表和终结符以及非终结符都是针对一个特定文法 ...

  10. VSCode C/C++ 开发环境配置 详细教程

    本博客已暂停更新,需要请转新博客http://www.whbwiki.com/335.html VsCode是一个轻量级的编辑器,但是配置有点复杂,这里我做了C/C++开发环境配置总结,适用于wind ...