SpringBoot基於Fly社群模板開源部落格專案

longmanma發表於2021-09-09

1、官網地址

2、技術棧

  • 開發工具 Idea
  • 資料庫設計 PowerDesign
  • JDK版本 Java8
  • 資料庫 MySQL v5.7
  • 後端開發語言 SpringBoot2.2.6.RELEASE
  • 資料訪問層 Mybatis-Plus 3.3.1
  • 前端相關 HTML5、LayUI、jQuery、LayUI_fly社群模板等
  • 中介軟體 Redis快取、RabbitMQ訊息、Nginx等
  • 檔案服務 FastDFS分散式檔案儲存、七牛雲等
  • 富文字編輯器 WangEditor、Editor.md
  • 三方登入 QQ、微信、微博、gitee等
  • 訊息傳送 郵件傳送、傳送釘釘訊息、簡訊傳送
  • 整合三方api 帖子內容稽核(百度稽核)、百度推送等

3、表結構設計pd圖

4、框架搭建

4.1.整合MyBatis-Plus運算元據庫

  • 引入maven依賴

      <dependency>
      		 <groupId>mysql</groupId>
      		 <artifactId>mysql-connector-java</artifactId>
      </dependency>
      <dependency>
      		<groupId>com.baomidou</groupId>
      		<artifactId>mybatis-plus-boot-starter</artifactId>
      		<version>3.3.1</version>
      </dependency>
    
  •   application.yml配置資料庫連線
    
      		spring:
      			datasource:
      				driver-class-name: com.mysql.cj.jdbc.Driver
      				url: jdbc:mysql://127.0.0.1:3306/sunny-fly?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true&useAffectedRows=true
      				username: root
      				password: admin1009
      				type: com.zaxxer.hikari.HikariDataSource
      				hikari:
      					maximum-pool-size: 50 # 連線池最大連線數,預設是10
      					minimum-idle: 5 #最小空閒連線數量
      					idle-timeout: 18000 #空閒連線存活最大時間,預設600000(10分鐘)
      					pool-name: sunnyHikariCP  #連線池名稱
      					connection-test-query: SELECT 1
    
  •   mybatis-plus基本配置類:MybatisPlusConfig.java
    
      		@EnableTransactionManagement
      		@Configuration
      		@MapperScan("com.sunny.fly.mapper")
      		public class MybatisPlusConfig {
    
      				@Bean
      				public PaginationInterceptor paginationInterceptor() {
      						PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
      						paginationInterceptor.setCountSqlParser(new JsqlParserCountOptimize(true));
      						return paginationInterceptor;
      				}
      		}
    
  • 測試透過mybatis-plus運算元據庫

  1. 建立測試指令碼

     CREATE TABLE `test` (
     	`NAME` varchar(255) DEFAULT NULL,
     	`AGE` int(11) DEFAULT NULL,
     	`BIRTHDAY` datetime DEFAULT NULL
     ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
  2. 建立pojo,mapper,service,controller

     @Data
     @EqualsAndHashCode(callSuper = false)
     @Accessors(chain = true)
     @TableName("TEST")
     public class TestBean implements Serializable {
    
     		private static final long serialVersionUID = 1L;
    
     		/**
     		 * 姓名
     		 */
     		private String name;
    
     		/**
     		 * 年齡
     		 */
     		private int age;
    
     		/**
     		 * 年齡
     		 */
     		private Date birthday;
    
     }
    

mapper

@Repository
public interface TestMapper extends BaseMapper<TestBean> {
}

service

public List<TestBean> queryAll() {
				return testMapper.selectList(null);
		}

controller

@GetMapping("queryAll")
		@ResponseBody
		public ResponseResult<List<TestBean>> queryAll() {
				List<TestBean> testList = testService.queryAll();
				return ResponseUtil.makeOKRsp(testList);
		}
  1. 頁面訪問

圖片描述

4.2、整合Redis快取


  • 圖片描述

5.首頁開發

  • 圖片描述

6.詳情頁開發

  • 圖片描述

7、登入註冊以及個人中心開發文件

  • 圖片描述

原始碼下載地址

詳細開發技術文件盡在 ;更多技術文章: https://www.sunnyblog.top

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/2730/viewspace-2825545/,如需轉載,請註明出處,否則將追究法律責任。

相關文章