Coder Social home page Coder Social logo

yxx-z / base-springboot Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 4.36 MB

SpringBoot2和SprinBoot3的开发模版。SpringBoot + Mybatis-Plus + Redis + Mysql,登录Sa-Token,日志追踪TLog。适用小型项目快速开发。

License: MIT License

Java 100.00%
java mysql redis springboot

base-springboot's Introduction

base-springboot

SpringBoot开发模版

功能

  • 注册、登录、用户详情、接口日志、ip属地、发送邮件、修改密码、找回密码、用户权限、角色、菜单、ip异常邮件提醒

准备

  • jdk17
  • maven3.5+
  • redis
  • mysql8

使用

  • 数据库新建utf8mb4数据库,运行db文件夹下的db.sql文件。
  • 更改application-dev.yml中mysql数据库连接配置、redis连接配置
  • resources下的ip2region.xdb文件放在jar同通目录下 例:jar包放在/usr/local/business/ 则该文件同样放在该目录

框架选型:

    SpringBoot + Mybatis-plus + Redis
    登录框架 Sa-Token 框架文档

项目结构:

    base:
        -- admin:
        -- business:
        -- common:
            -- common-core
            -- common-framework

common为公共包,包含core和framework两个子包:

    common-core主要是自定义注解、constant、枚举类、自定义异常、properties、utils等

    common-framework主要是filter、listener、日志打印、日志记录、Mybatis-plus配置、统一异常处理等

admin 为后台管理模块包,处理管理后台逻辑。 business为业务包,用来处理业务。不赘述。

自定义注解:

@ResponseResult

    用来封装返回值,可放在controller上,或者controller中的单个方法上。

@OperationLog

    用来记录接口日志,包含请求接口名称、用户id、ip、入参、异常信息等,可放在controller中的单个方法上。

@ReleaseToken

    用来跳过token校验,可放在controller中的单个方法上。

@SearchDate

    加在Date类型上,搜索条件开始时间结束时间,自动拼接开始时间00:00:00和结束时间23:59:59


常用utils:

LoginUtils

    登录相关utils,可获取用户基本信息,角色,token等

ApiAssert

    断言工具类,以断言方式抛出自定义异常

EnuUtils

    枚举工具类,判断指定code是否属于指定枚举类中的数据

ApplicationUtils

   程序工具类,可获取SpringBean,程序上下文等

TreeUtil

   通用树状工具类

MailUtils

   发送邮件工具

感谢

本项目使用 JetBrains 提供的开源许可证,基于 IntelliJ IDEA 开发,感谢!

JetBrains 徽标(主要) logo

IntelliJ IDEA logo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.