Bladeren bron

0129 项目初始化

Qing 1 jaar geleden
bovenliggende
commit
af6b83ce05
31 gewijzigde bestanden met toevoegingen van 1373 en 247 verwijderingen
  1. 0 100
      git-demo/com/sf/Test.java
  2. 0 45
      git-demo/com/sf/TestStudent.java
  3. 0 37
      git-demo/com/sf/TestTang.java
  4. 0 26
      git-demo/com/sf/TestWang.java
  5. 0 39
      git-demo/com/sf/TestZhang.java
  6. 33 0
      novel-demo/.gitignore
  7. BIN
      novel-demo/.mvn/wrapper/maven-wrapper.jar
  8. 2 0
      novel-demo/.mvn/wrapper/maven-wrapper.properties
  9. 308 0
      novel-demo/mvnw
  10. 205 0
      novel-demo/mvnw.cmd
  11. 84 0
      novel-demo/pom.xml
  12. 15 0
      novel-demo/src/main/java/com/sf/NovelDemoApplication.java
  13. 18 0
      novel-demo/src/main/java/com/sf/controller/BookInfoController.java
  14. 71 0
      novel-demo/src/main/java/com/sf/controller/HomeBookController.java
  15. 23 0
      novel-demo/src/main/java/com/sf/dto/HomeBookRespDto.java
  16. 16 0
      novel-demo/src/main/java/com/sf/mapper/BookInfoMapper.java
  17. 16 0
      novel-demo/src/main/java/com/sf/mapper/HomeBookMapper.java
  18. 308 0
      novel-demo/src/main/java/com/sf/po/BookInfo.java
  19. 52 0
      novel-demo/src/main/java/com/sf/po/HomeBook.java
  20. 27 0
      novel-demo/src/main/java/com/sf/resp/RestResp.java
  21. 16 0
      novel-demo/src/main/java/com/sf/service/IBookInfoService.java
  22. 16 0
      novel-demo/src/main/java/com/sf/service/IHomeBookService.java
  23. 20 0
      novel-demo/src/main/java/com/sf/service/impl/BookInfoServiceImpl.java
  24. 20 0
      novel-demo/src/main/java/com/sf/service/impl/HomeBookServiceImpl.java
  25. 67 0
      novel-demo/src/main/java/com/sf/util/GeneUtils.java
  26. 1 0
      novel-demo/src/main/resources/application.properties
  27. 14 0
      novel-demo/src/main/resources/application.yml
  28. 5 0
      novel-demo/src/main/resources/mapper/BookInfoMapper.xml
  29. 5 0
      novel-demo/src/main/resources/mapper/HomeBookMapper.xml
  30. 13 0
      novel-demo/src/test/java/com/sf/ApplicationTests.java
  31. 18 0
      novel-demo/src/test/java/com/sf/MybatisPlusTests.java

+ 0 - 100
git-demo/com/sf/Test.java

@@ -1,100 +0,0 @@
-package com.sf;
-
-import java.util.Arrays;
-import java.util.Random;
-import java.util.Scanner;
-
-public class Test {
-
-    public static void main(String[] args) {
-        // 随机点名器
-        //      txt文档中
-        //  字符串中 “zhangsan、lisi、wangwu”
-        //  输入一个要随机的数量   1 2
-        //    随机出可能重复的同学名字
-        //    随机出不重复的同学名字
-
-
-        String str = "赵玉龙、闵圣楠、刘哲、李龚臻、张嫁祥、尹星博、李宏源、牛文睿、王佳强、胡春宇、郭柯雨、唐振亮、王鸿明、芦博智、张文瀚、张甫鑫、张宇璇、李小龙、王毅、孙智凡、孙超、殷碧泉、李斯扬、赵佳硕、杨晨、康雯博、孙辉、李天卓、牛世恒、卢星宇、黄天柯";
-        String[] splitStr = str.split("、");
-        System.out.println(splitStr.length);
-//        System.out.println(Arrays.toString(splitStr));
-
-        // 输入一个数字  来获取随机的数量
-        System.out.println("请输出一个要随机的数量:");
-        Scanner scanner = new Scanner(System.in);
-        int num = scanner.nextInt();
-
-        // 有效范围 [1,length]
-        //   小于最小值  大于最大值
-        //   重新输入  按照最小值和最大值处理
-        if (num < 1) num = 1;
-        else if (num > splitStr.length) num = splitStr.length;
-        else if (num == splitStr.length) System.out.println(Arrays.toString(splitStr));
-//        while (num < 1 || num > splitStr.length){
-//            System.out.println("输入数值不符合范围, 请重新输入:");
-//            num = scanner.nextInt();
-//        }
-
-        // 随机num个不重复的结果
-        // 存储结果的容器: 数组、list、set
-        //  set 用法最简单  随机的范围要在length中  随机的结果存在set中  循环遍历条件要判断set的大小
-        //  list  用法相对简单  也比较多样
-        //        contains()进行去重  循环遍历条件要判断list的大小
-        //        随机一个移除一个  使用的是动态数组的特性
-        //        Collections.shuffle()洗牌方法
-        //  数组   随机一个向前覆盖  而且用了 Math.random()随机   其他Random.nextInt()
-
-        // num = 5  随机的是索引 [0,30] 随机出5个不重复的
-        //  arr = {0,0,0,0,0}  数组初始化的默认值  但是随机结果也有可能是0
-        //  arr = {-1,-1,-1,-1,-1}
-        //  arr = {2,-1,-1,-1,-1}
-        //  arr = {2,3,-1,-1,-1}
-        //  arr = {2,3,7,-1,-1}   有效元素的个数 size  数组中是否存在 contains  ArrayList的本质是动态数组
-
-        int len = splitStr.length;
-        int[] arr = new int[num];
-        // 直接输出的是地址
-        System.out.println(arr);
-        System.out.println(Arrays.toString(arr));
-        // itar  iter 循环的快捷键
-        for (int i = 0; i < num; i++) {
-            arr[i] = -1;
-        }
-        System.out.println(Arrays.toString(arr));
-
-        // 记录有效元素的个数
-        int count = 0;
-        // 随机两种逻辑
-        // 去重
-        while (count < num) {
-//            Random random = new Random();
-//            int randomInt = random.nextInt(len);
-//            System.out.println(randomInt);
-
-            int mathRandom = (int)(Math.random() * len);
-            System.out.println(mathRandom);
-            // 判断是否在arr中存在
-            // 不存在 才赋值 并添加count
-            boolean isExists = false;
-            for (int i = 0; i < num; i++) {
-                if(arr[i] == mathRandom){
-                    isExists = true;
-                    break;
-                }
-            }
-            if (!isExists){
-                // 第一个元素  arr = {-1,-1,-1,-1,-1}
-                // count = 0
-                // 第二个元素  arr = {2,-1,-1,-1,-1}
-                // count = 1
-                // 类似于set
-                arr[count] = mathRandom;
-                count++;
-            }
-        }
-
-        System.out.println(Arrays.toString(arr));
-
-    }
-}

+ 0 - 45
git-demo/com/sf/TestStudent.java

@@ -1,45 +0,0 @@
-package com.sf;
-
-import java.util.Arrays;
-import java.util.Random;
-import java.util.Scanner;
-
-
-public class TestStudent {
-
-
-    public static void main(String[] args) {
-
-        String str = "赵玉龙、闵圣楠、刘哲、李龚臻、张嫁祥、尹星博、李宏源、牛文睿、王佳强、胡春宇、郭柯雨、唐振亮、王鸿明、芦博智、张文瀚、张甫鑫、张宇璇、李小龙、王毅、孙智凡、孙超、殷碧泉、李斯扬、赵佳硕、杨晨、康雯博、孙辉、李天卓、卢星宇、黄天柯";
-        String[] split = str.split("、");
-        //展示已有名字库
-        System.out.println(Arrays.toString(split));
-        int[] arr = new int[split.length];
-
-        Scanner scanner = new Scanner(System.in);
-        int n = scanner.nextInt();
-
-
-        for (int i = 0; i < arr.length; i++) {
-            arr[i] = -1;
-        }
-
-        for (int i = 0; i < n; i++) {
-
-            //进行随机一次点名
-            int num = (int) (Math.random() * split.length);
-            if (arr[i] == -1) {
-                arr[i] = num;
-            } else {
-                break;
-            }
-        }
-
-        for (int i = 0; i < n; i++) {
-            System.out.println(split[arr[i]]);
-        }
-
-
-    }
-}
-

+ 0 - 37
git-demo/com/sf/TestTang.java

@@ -1,37 +0,0 @@
-package com.sf;
-
-import java.util.Random;
-import java.util.Scanner;
-
-/*
-@Author 唐振亮
-@Create 2024/1/8  9:56
-@Name test01
-*/
-public class TestTang {
-    public static void main(String[] args) {
-        Scanner scanner = new Scanner(System.in);
-        System.out.print("请输入随机数量:");
-        int count = scanner.nextInt();
-        String str = "赵玉龙、闵圣楠、刘哲、李龚臻、张嫁祥、尹星博、李宏源、牛文睿、王佳强、胡春宇、郭柯雨、王鸿明、芦博智、张文瀚、张甫鑫、张宇璇、李小龙、王毅、孙智凡、孙超、殷碧泉、李斯扬、赵佳硕、杨晨、康雯博、孙辉、李天卓、卢星宇、黄天柯";
-
-        // 转数组
-        String[] names = str.split("、");
-
-        // 打乱姓名顺序
-        Random random = new Random();
-        for (int i = 0; i < count; i++) {
-            int j = random.nextInt(names.length);
-            String temp = names[i];
-            names[i] = names[j];
-            names[j] = temp;
-        }
-
-        // 输出不重复的名字
-        System.out.println("随机点名结果:");
-        for (int i = 0; i < count && i < names.length; i++) {
-            System.out.println(names[i]);
-        }
-    }
-
-}

+ 0 - 26
git-demo/com/sf/TestWang.java

@@ -1,26 +0,0 @@
-package com.sf;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Random;
-import java.util.Scanner;
-
-
-public class TestWang {
-
-    public static void main(String[] args) {
-        Scanner random = new Scanner(System.in);
-        int number_of_students = random.nextInt(10);
-        String[] student_names = {"小明", "小红", "小刚", "小李", "小张", "小哈", "小小", "小困", "小顾"};
-        // 如何把数组转化成list
-        Collections.shuffle(Arrays.asList(student_names));
-        // shuffle 洗牌
-        // {1,2,3,4,5}
-        // {3,5,1,4,2}
-        // 取两个
-        // {3,5}
-        for (int i = 0; i < number_of_students; i++) {
-            System.out.println(student_names[i]);
-        }
-    }
-}

+ 0 - 39
git-demo/com/sf/TestZhang.java

@@ -1,39 +0,0 @@
-package com.sf;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-import java.util.Scanner;
-
-public class TestZhang {
-
-    public static void main(String[] args) {
-        String names = "zs,ls,ww,tom,jack,hall,tim,boy";
-        String[] nameSplit = names.split(",");
-        int[] arr = new int[nameSplit.length];
-
-        for (int i = 0; i < arr.length; i++) {
-            arr[i] = -1;
-        }
-        Scanner scanner = new Scanner(System.in);
-        System.out.println("输入个数");
-        int count = scanner.nextInt();
-//        List list = new ArrayList();
-        Random random = new Random();
-        int times = 0;
-        while (times < count) {
-            int num = random.nextInt(nameSplit.length);
-            if (arr[num] == -1) {
-//                list.add(num);
-                arr[num] = num;
-                times++;
-            }
-        }
-
-//
-//        for (Object o : list) {
-//            System.out.println(o);
-//        }
-
-    }
-}

+ 33 - 0
novel-demo/.gitignore

@@ -0,0 +1,33 @@
+HELP.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/

BIN
novel-demo/.mvn/wrapper/maven-wrapper.jar


+ 2 - 0
novel-demo/.mvn/wrapper/maven-wrapper.properties

@@ -0,0 +1,2 @@
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip
+wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar

+ 308 - 0
novel-demo/mvnw

@@ -0,0 +1,308 @@
+#!/bin/sh
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Apache Maven Wrapper startup batch script, version 3.2.0
+#
+# Required ENV vars:
+# ------------------
+#   JAVA_HOME - location of a JDK home dir
+#
+# Optional ENV vars
+# -----------------
+#   MAVEN_OPTS - parameters passed to the Java VM when running Maven
+#     e.g. to debug Maven itself, use
+#       set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+#   MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+# ----------------------------------------------------------------------------
+
+if [ -z "$MAVEN_SKIP_RC" ] ; then
+
+  if [ -f /usr/local/etc/mavenrc ] ; then
+    . /usr/local/etc/mavenrc
+  fi
+
+  if [ -f /etc/mavenrc ] ; then
+    . /etc/mavenrc
+  fi
+
+  if [ -f "$HOME/.mavenrc" ] ; then
+    . "$HOME/.mavenrc"
+  fi
+
+fi
+
+# OS specific support.  $var _must_ be set to either true or false.
+cygwin=false;
+darwin=false;
+mingw=false
+case "$(uname)" in
+  CYGWIN*) cygwin=true ;;
+  MINGW*) mingw=true;;
+  Darwin*) darwin=true
+    # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
+    # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
+    if [ -z "$JAVA_HOME" ]; then
+      if [ -x "/usr/libexec/java_home" ]; then
+        JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME
+      else
+        JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
+      fi
+    fi
+    ;;
+esac
+
+if [ -z "$JAVA_HOME" ] ; then
+  if [ -r /etc/gentoo-release ] ; then
+    JAVA_HOME=$(java-config --jre-home)
+  fi
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+  [ -n "$JAVA_HOME" ] &&
+    JAVA_HOME=$(cygpath --unix "$JAVA_HOME")
+  [ -n "$CLASSPATH" ] &&
+    CLASSPATH=$(cygpath --path --unix "$CLASSPATH")
+fi
+
+# For Mingw, ensure paths are in UNIX format before anything is touched
+if $mingw ; then
+  [ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] &&
+    JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)"
+fi
+
+if [ -z "$JAVA_HOME" ]; then
+  javaExecutable="$(which javac)"
+  if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then
+    # readlink(1) is not available as standard on Solaris 10.
+    readLink=$(which readlink)
+    if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then
+      if $darwin ; then
+        javaHome="$(dirname "\"$javaExecutable\"")"
+        javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac"
+      else
+        javaExecutable="$(readlink -f "\"$javaExecutable\"")"
+      fi
+      javaHome="$(dirname "\"$javaExecutable\"")"
+      javaHome=$(expr "$javaHome" : '\(.*\)/bin')
+      JAVA_HOME="$javaHome"
+      export JAVA_HOME
+    fi
+  fi
+fi
+
+if [ -z "$JAVACMD" ] ; then
+  if [ -n "$JAVA_HOME"  ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+      # IBM's JDK on AIX uses strange locations for the executables
+      JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+      JAVACMD="$JAVA_HOME/bin/java"
+    fi
+  else
+    JAVACMD="$(\unset -f command 2>/dev/null; \command -v java)"
+  fi
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+  echo "Error: JAVA_HOME is not defined correctly." >&2
+  echo "  We cannot execute $JAVACMD" >&2
+  exit 1
+fi
+
+if [ -z "$JAVA_HOME" ] ; then
+  echo "Warning: JAVA_HOME environment variable is not set."
+fi
+
+# traverses directory structure from process work directory to filesystem root
+# first directory with .mvn subdirectory is considered project base directory
+find_maven_basedir() {
+  if [ -z "$1" ]
+  then
+    echo "Path not specified to find_maven_basedir"
+    return 1
+  fi
+
+  basedir="$1"
+  wdir="$1"
+  while [ "$wdir" != '/' ] ; do
+    if [ -d "$wdir"/.mvn ] ; then
+      basedir=$wdir
+      break
+    fi
+    # workaround for JBEAP-8937 (on Solaris 10/Sparc)
+    if [ -d "${wdir}" ]; then
+      wdir=$(cd "$wdir/.." || exit 1; pwd)
+    fi
+    # end of workaround
+  done
+  printf '%s' "$(cd "$basedir" || exit 1; pwd)"
+}
+
+# concatenates all lines of a file
+concat_lines() {
+  if [ -f "$1" ]; then
+    # Remove \r in case we run on Windows within Git Bash
+    # and check out the repository with auto CRLF management
+    # enabled. Otherwise, we may read lines that are delimited with
+    # \r\n and produce $'-Xarg\r' rather than -Xarg due to word
+    # splitting rules.
+    tr -s '\r\n' ' ' < "$1"
+  fi
+}
+
+log() {
+  if [ "$MVNW_VERBOSE" = true ]; then
+    printf '%s\n' "$1"
+  fi
+}
+
+BASE_DIR=$(find_maven_basedir "$(dirname "$0")")
+if [ -z "$BASE_DIR" ]; then
+  exit 1;
+fi
+
+MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR
+log "$MAVEN_PROJECTBASEDIR"
+
+##########################################################################################
+# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+# This allows using the maven wrapper in projects that prohibit checking in binary data.
+##########################################################################################
+wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar"
+if [ -r "$wrapperJarPath" ]; then
+    log "Found $wrapperJarPath"
+else
+    log "Couldn't find $wrapperJarPath, downloading it ..."
+
+    if [ -n "$MVNW_REPOURL" ]; then
+      wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
+    else
+      wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
+    fi
+    while IFS="=" read -r key value; do
+      # Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' )
+      safeValue=$(echo "$value" | tr -d '\r')
+      case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;;
+      esac
+    done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
+    log "Downloading from: $wrapperUrl"
+
+    if $cygwin; then
+      wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath")
+    fi
+
+    if command -v wget > /dev/null; then
+        log "Found wget ... using wget"
+        [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet"
+        if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+            wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
+        else
+            wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
+        fi
+    elif command -v curl > /dev/null; then
+        log "Found curl ... using curl"
+        [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent"
+        if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+            curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
+        else
+            curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
+        fi
+    else
+        log "Falling back to using Java to download"
+        javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java"
+        javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class"
+        # For Cygwin, switch paths to Windows format before running javac
+        if $cygwin; then
+          javaSource=$(cygpath --path --windows "$javaSource")
+          javaClass=$(cygpath --path --windows "$javaClass")
+        fi
+        if [ -e "$javaSource" ]; then
+            if [ ! -e "$javaClass" ]; then
+                log " - Compiling MavenWrapperDownloader.java ..."
+                ("$JAVA_HOME/bin/javac" "$javaSource")
+            fi
+            if [ -e "$javaClass" ]; then
+                log " - Running MavenWrapperDownloader.java ..."
+                ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath"
+            fi
+        fi
+    fi
+fi
+##########################################################################################
+# End of extension
+##########################################################################################
+
+# If specified, validate the SHA-256 sum of the Maven wrapper jar file
+wrapperSha256Sum=""
+while IFS="=" read -r key value; do
+  case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;;
+  esac
+done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
+if [ -n "$wrapperSha256Sum" ]; then
+  wrapperSha256Result=false
+  if command -v sha256sum > /dev/null; then
+    if echo "$wrapperSha256Sum  $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then
+      wrapperSha256Result=true
+    fi
+  elif command -v shasum > /dev/null; then
+    if echo "$wrapperSha256Sum  $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then
+      wrapperSha256Result=true
+    fi
+  else
+    echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available."
+    echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties."
+    exit 1
+  fi
+  if [ $wrapperSha256Result = false ]; then
+    echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2
+    echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2
+    echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2
+    exit 1
+  fi
+fi
+
+MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+  [ -n "$JAVA_HOME" ] &&
+    JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME")
+  [ -n "$CLASSPATH" ] &&
+    CLASSPATH=$(cygpath --path --windows "$CLASSPATH")
+  [ -n "$MAVEN_PROJECTBASEDIR" ] &&
+    MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR")
+fi
+
+# Provide a "standardized" way to retrieve the CLI args that will
+# work with both Windows and non-Windows executions.
+MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*"
+export MAVEN_CMD_LINE_ARGS
+
+WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+# shellcheck disable=SC2086 # safe args
+exec "$JAVACMD" \
+  $MAVEN_OPTS \
+  $MAVEN_DEBUG_OPTS \
+  -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
+  "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
+  ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

+ 205 - 0
novel-demo/mvnw.cmd

@@ -0,0 +1,205 @@
+@REM ----------------------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements.  See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership.  The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License.  You may obtain a copy of the License at
+@REM
+@REM    https://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied.  See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ----------------------------------------------------------------------------
+
+@REM ----------------------------------------------------------------------------
+@REM Apache Maven Wrapper startup batch script, version 3.2.0
+@REM
+@REM Required ENV vars:
+@REM JAVA_HOME - location of a JDK home dir
+@REM
+@REM Optional ENV vars
+@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
+@REM     e.g. to debug Maven itself, use
+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+@REM ----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM set title of command window
+title %0
+@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%
+
+@REM set %HOME% to equivalent of $HOME
+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
+
+@REM Execute a user defined script before this one
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
+if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
+if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
+:skipRcPre
+
+@setlocal
+
+set ERROR_CODE=0
+
+@REM To isolate internal variables from possible post scripts, we use another setlocal
+@setlocal
+
+@REM ==== START VALIDATION ====
+if not "%JAVA_HOME%" == "" goto OkJHome
+
+echo.
+echo Error: JAVA_HOME not found in your environment. >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+:OkJHome
+if exist "%JAVA_HOME%\bin\java.exe" goto init
+
+echo.
+echo Error: JAVA_HOME is set to an invalid directory. >&2
+echo JAVA_HOME = "%JAVA_HOME%" >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+@REM ==== END VALIDATION ====
+
+:init
+
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
+@REM Fallback to current working directory if not found.
+
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
+
+set EXEC_DIR=%CD%
+set WDIR=%EXEC_DIR%
+:findBaseDir
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
+cd ..
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
+set WDIR=%CD%
+goto findBaseDir
+
+:baseDirFound
+set MAVEN_PROJECTBASEDIR=%WDIR%
+cd "%EXEC_DIR%"
+goto endDetectBaseDir
+
+:baseDirNotFound
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
+cd "%EXEC_DIR%"
+
+:endDetectBaseDir
+
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+
+@setlocal EnableExtensions EnableDelayedExpansion
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
+
+:endReadAdditionalConfig
+
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
+
+FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
+    IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
+)
+
+@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
+if exist %WRAPPER_JAR% (
+    if "%MVNW_VERBOSE%" == "true" (
+        echo Found %WRAPPER_JAR%
+    )
+) else (
+    if not "%MVNW_REPOURL%" == "" (
+        SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
+    )
+    if "%MVNW_VERBOSE%" == "true" (
+        echo Couldn't find %WRAPPER_JAR%, downloading it ...
+        echo Downloading from: %WRAPPER_URL%
+    )
+
+    powershell -Command "&{"^
+		"$webclient = new-object System.Net.WebClient;"^
+		"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
+		"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
+		"}"^
+		"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
+		"}"
+    if "%MVNW_VERBOSE%" == "true" (
+        echo Finished downloading %WRAPPER_JAR%
+    )
+)
+@REM End of extension
+
+@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file
+SET WRAPPER_SHA_256_SUM=""
+FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
+    IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B
+)
+IF NOT %WRAPPER_SHA_256_SUM%=="" (
+    powershell -Command "&{"^
+       "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^
+       "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^
+       "  Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^
+       "  Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^
+       "  Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^
+       "  exit 1;"^
+       "}"^
+       "}"
+    if ERRORLEVEL 1 goto error
+)
+
+@REM Provide a "standardized" way to retrieve the CLI args that will
+@REM work with both Windows and non-Windows executions.
+set MAVEN_CMD_LINE_ARGS=%*
+
+%MAVEN_JAVA_EXE% ^
+  %JVM_CONFIG_MAVEN_PROPS% ^
+  %MAVEN_OPTS% ^
+  %MAVEN_DEBUG_OPTS% ^
+  -classpath %WRAPPER_JAR% ^
+  "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
+  %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
+if ERRORLEVEL 1 goto error
+goto end
+
+:error
+set ERROR_CODE=1
+
+:end
+@endlocal & set ERROR_CODE=%ERROR_CODE%
+
+if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
+if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
+if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
+:skipRcPost
+
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
+if "%MAVEN_BATCH_PAUSE%"=="on" pause
+
+if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
+
+cmd /C exit /B %ERROR_CODE%

+ 84 - 0
novel-demo/pom.xml

@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>3.2.0</version>
+        <relativePath/> <!-- lookup parent from repository -->
+    </parent>
+    <groupId>com.sf</groupId>
+    <artifactId>novel-demo</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <name>novel-demo</name>
+    <description>novel-demo</description>
+    <properties>
+        <java.version>17</java.version>
+    </properties>
+    <dependencies>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
+            <version>3.0.3</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.mysql</groupId>
+            <artifactId>mysql-connector-j</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <!-- 整合mybatis plus -->
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-boot-starter</artifactId>
+            <version>3.5.4</version>
+        </dependency>
+        <!-- 使用mybatis plus的代码生成工具 使用了模板引擎freemarker -->
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-generator</artifactId>
+            <version>3.5.4</version>
+        </dependency>
+        <dependency>
+            <groupId>org.freemarker</groupId>
+            <artifactId>freemarker</artifactId>
+            <version>2.3.32</version>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <excludes>
+                        <exclude>
+                            <groupId>org.projectlombok</groupId>
+                            <artifactId>lombok</artifactId>
+                        </exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 15 - 0
novel-demo/src/main/java/com/sf/NovelDemoApplication.java

@@ -0,0 +1,15 @@
+package com.sf;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+@MapperScan("com.sf.mapper")
+public class NovelDemoApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(NovelDemoApplication.class, args);
+    }
+
+}

+ 18 - 0
novel-demo/src/main/java/com/sf/controller/BookInfoController.java

@@ -0,0 +1,18 @@
+package com.sf.controller;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.stereotype.Controller;
+
+/**
+ * <p>
+ * 小说信息 前端控制器
+ * </p>
+ *
+ * @author Qing
+ * @since 2024-01-29
+ */
+@Controller
+@RequestMapping("/bookInfo")
+public class BookInfoController {
+
+}

+ 71 - 0
novel-demo/src/main/java/com/sf/controller/HomeBookController.java

@@ -0,0 +1,71 @@
+package com.sf.controller;
+
+import com.sf.dto.HomeBookRespDto;
+import com.sf.po.BookInfo;
+import com.sf.po.HomeBook;
+import com.sf.resp.RestResp;
+import com.sf.service.IBookInfoService;
+import com.sf.service.IHomeBookService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * <p>
+ * 小说推荐 前端控制器
+ * </p>
+ *
+ * @author Qing
+ * @since 2024-01-29
+ */
+@CrossOrigin(originPatterns = "*",allowCredentials = "true")
+@RestController
+@RequestMapping("/api/front/home")
+public class HomeBookController {
+
+    @Autowired
+    private IHomeBookService homeBookService;
+
+    @Autowired
+    private IBookInfoService bookInfoService;
+
+    // http://127.0.0.1:8888/api/front/home/books
+    @GetMapping("/books")
+    public RestResp<List<HomeBookRespDto>> books() {
+        // json结构
+        // code  message  data  ok  -> RestResp
+        //    [{type:"",bookId:"",...},{type:"",bookId:"",...}]
+        List<HomeBookRespDto> list = new ArrayList<>();
+//        HomeBookRespDto dto = HomeBookRespDto.builder()
+//                .bookId(1334318182169681920L).type(0).bookName("我给王爷寄刀片").authorName("汐娴阳光")
+//                .build();
+//        HomeBookRespDto dto1 = HomeBookRespDto.builder()
+//                .bookId(1334318182169681920L).type(0).bookName("我有家最强当铺").authorName("汐娴阳光")
+//                .build();
+//        list.add(dto);
+//        list.add(dto1);
+        List<HomeBook> homeBooks = homeBookService.list();
+        homeBooks.forEach(homeBook -> {
+            // INSERT INTO `home_book` (`id`, `type`, `sort`, `book_id`, `create_time`, `update_time`)
+            // VALUES (64, 0, 0, 1334318182169681920, '2020-12-03 11:43:23', '2020-12-03 11:43:23');
+            BookInfo bookInfo = bookInfoService.getById(homeBook.getBookId());
+            HomeBookRespDto dto = HomeBookRespDto.builder()
+                    .type(homeBook.getType().intValue())   // byte - int
+                    .bookId(homeBook.getBookId())
+                    .picUrl(bookInfo.getPicUrl())
+                    .bookName(bookInfo.getBookName())
+                    .authorName(bookInfo.getAuthorName())
+                    .bookDesc(bookInfo.getBookDesc())
+                    .build();
+            list.add(dto);
+        });
+        // 都取出来 批量查询
+        return RestResp.ok(list);
+    }
+}

+ 23 - 0
novel-demo/src/main/java/com/sf/dto/HomeBookRespDto.java

@@ -0,0 +1,23 @@
+package com.sf.dto;
+
+import lombok.Builder;
+import lombok.Data;
+
+// dto 数据传输对象
+// 在处理前端和后端进行请求和响应时的对象
+@Data
+@Builder
+public class HomeBookRespDto {
+
+    private Integer type;
+
+    private Long bookId;
+
+    private String picUrl;
+
+    private String bookName;
+
+    private String authorName;
+
+    private String bookDesc;
+}

+ 16 - 0
novel-demo/src/main/java/com/sf/mapper/BookInfoMapper.java

@@ -0,0 +1,16 @@
+package com.sf.mapper;
+
+import com.sf.po.BookInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 小说信息 Mapper 接口
+ * </p>
+ *
+ * @author Qing
+ * @since 2024-01-29
+ */
+public interface BookInfoMapper extends BaseMapper<BookInfo> {
+
+}

+ 16 - 0
novel-demo/src/main/java/com/sf/mapper/HomeBookMapper.java

@@ -0,0 +1,16 @@
+package com.sf.mapper;
+
+import com.sf.po.HomeBook;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 小说推荐 Mapper 接口
+ * </p>
+ *
+ * @author Qing
+ * @since 2024-01-29
+ */
+public interface HomeBookMapper extends BaseMapper<HomeBook> {
+
+}

+ 308 - 0
novel-demo/src/main/java/com/sf/po/BookInfo.java

@@ -0,0 +1,308 @@
+package com.sf.po;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 小说信息
+ * </p>
+ *
+ * @author Qing
+ * @since 2024-01-29
+ */
+@TableName("book_info")
+public class BookInfo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 作品方向;0-男频 1-女频
+     */
+    private Byte workDirection;
+
+    /**
+     * 类别ID
+     */
+    private Long categoryId;
+
+    /**
+     * 类别名
+     */
+    private String categoryName;
+
+    /**
+     * 小说封面地址
+     */
+    private String picUrl;
+
+    /**
+     * 小说名
+     */
+    private String bookName;
+
+    /**
+     * 作家id
+     */
+    private Long authorId;
+
+    /**
+     * 作家名
+     */
+    private String authorName;
+
+    /**
+     * 书籍描述
+     */
+    private String bookDesc;
+
+    /**
+     * 评分;总分:10 ,真实评分 = score/10
+     */
+    private Byte score;
+
+    /**
+     * 书籍状态;0-连载中 1-已完结
+     */
+    private Byte bookStatus;
+
+    /**
+     * 点击量
+     */
+    private Long visitCount;
+
+    /**
+     * 总字数
+     */
+    private Integer wordCount;
+
+    /**
+     * 评论数
+     */
+    private Integer commentCount;
+
+    /**
+     * 最新章节ID
+     */
+    private Long lastChapterId;
+
+    /**
+     * 最新章节名
+     */
+    private String lastChapterName;
+
+    /**
+     * 最新章节更新时间
+     */
+    private LocalDateTime lastChapterUpdateTime;
+
+    /**
+     * 是否收费;1-收费 0-免费
+     */
+    private Byte isVip;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updateTime;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Byte getWorkDirection() {
+        return workDirection;
+    }
+
+    public void setWorkDirection(Byte workDirection) {
+        this.workDirection = workDirection;
+    }
+
+    public Long getCategoryId() {
+        return categoryId;
+    }
+
+    public void setCategoryId(Long categoryId) {
+        this.categoryId = categoryId;
+    }
+
+    public String getCategoryName() {
+        return categoryName;
+    }
+
+    public void setCategoryName(String categoryName) {
+        this.categoryName = categoryName;
+    }
+
+    public String getPicUrl() {
+        return picUrl;
+    }
+
+    public void setPicUrl(String picUrl) {
+        this.picUrl = picUrl;
+    }
+
+    public String getBookName() {
+        return bookName;
+    }
+
+    public void setBookName(String bookName) {
+        this.bookName = bookName;
+    }
+
+    public Long getAuthorId() {
+        return authorId;
+    }
+
+    public void setAuthorId(Long authorId) {
+        this.authorId = authorId;
+    }
+
+    public String getAuthorName() {
+        return authorName;
+    }
+
+    public void setAuthorName(String authorName) {
+        this.authorName = authorName;
+    }
+
+    public String getBookDesc() {
+        return bookDesc;
+    }
+
+    public void setBookDesc(String bookDesc) {
+        this.bookDesc = bookDesc;
+    }
+
+    public Byte getScore() {
+        return score;
+    }
+
+    public void setScore(Byte score) {
+        this.score = score;
+    }
+
+    public Byte getBookStatus() {
+        return bookStatus;
+    }
+
+    public void setBookStatus(Byte bookStatus) {
+        this.bookStatus = bookStatus;
+    }
+
+    public Long getVisitCount() {
+        return visitCount;
+    }
+
+    public void setVisitCount(Long visitCount) {
+        this.visitCount = visitCount;
+    }
+
+    public Integer getWordCount() {
+        return wordCount;
+    }
+
+    public void setWordCount(Integer wordCount) {
+        this.wordCount = wordCount;
+    }
+
+    public Integer getCommentCount() {
+        return commentCount;
+    }
+
+    public void setCommentCount(Integer commentCount) {
+        this.commentCount = commentCount;
+    }
+
+    public Long getLastChapterId() {
+        return lastChapterId;
+    }
+
+    public void setLastChapterId(Long lastChapterId) {
+        this.lastChapterId = lastChapterId;
+    }
+
+    public String getLastChapterName() {
+        return lastChapterName;
+    }
+
+    public void setLastChapterName(String lastChapterName) {
+        this.lastChapterName = lastChapterName;
+    }
+
+    public LocalDateTime getLastChapterUpdateTime() {
+        return lastChapterUpdateTime;
+    }
+
+    public void setLastChapterUpdateTime(LocalDateTime lastChapterUpdateTime) {
+        this.lastChapterUpdateTime = lastChapterUpdateTime;
+    }
+
+    public Byte getIsVip() {
+        return isVip;
+    }
+
+    public void setIsVip(Byte isVip) {
+        this.isVip = isVip;
+    }
+
+    public LocalDateTime getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(LocalDateTime createTime) {
+        this.createTime = createTime;
+    }
+
+    public LocalDateTime getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(LocalDateTime updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    @Override
+    public String toString() {
+        return "BookInfo{" +
+            "id = " + id +
+            ", workDirection = " + workDirection +
+            ", categoryId = " + categoryId +
+            ", categoryName = " + categoryName +
+            ", picUrl = " + picUrl +
+            ", bookName = " + bookName +
+            ", authorId = " + authorId +
+            ", authorName = " + authorName +
+            ", bookDesc = " + bookDesc +
+            ", score = " + score +
+            ", bookStatus = " + bookStatus +
+            ", visitCount = " + visitCount +
+            ", wordCount = " + wordCount +
+            ", commentCount = " + commentCount +
+            ", lastChapterId = " + lastChapterId +
+            ", lastChapterName = " + lastChapterName +
+            ", lastChapterUpdateTime = " + lastChapterUpdateTime +
+            ", isVip = " + isVip +
+            ", createTime = " + createTime +
+            ", updateTime = " + updateTime +
+        "}";
+    }
+}

+ 52 - 0
novel-demo/src/main/java/com/sf/po/HomeBook.java

@@ -0,0 +1,52 @@
+package com.sf.po;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 小说推荐
+ * </p>
+ *
+ * @author Qing
+ * @since 2024-01-29
+ */
+@Data
+@TableName("home_book")
+public class HomeBook implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 推荐类型;0-轮播图 1-顶部栏 2-本周强推 3-热门推荐 4-精品推荐
+     */
+    private Byte type;
+
+    /**
+     * 推荐排序
+     */
+    private Byte sort;
+
+    /**
+     * 推荐小说ID
+     */
+    private Long bookId;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updateTime;
+}

+ 27 - 0
novel-demo/src/main/java/com/sf/resp/RestResp.java

@@ -0,0 +1,27 @@
+package com.sf.resp;
+
+import lombok.Data;
+import lombok.Getter;
+
+//@Getter
+@Data
+public class RestResp<T> {
+
+    // 成功对应 00000
+    private String code;
+    // 处理失败的具体信息
+    private String message;
+    // 处理成功的数据
+    private T data;
+    private boolean ok = true;
+
+    private RestResp(T data) {
+        this.code = "00000";
+        this.message = "成功";
+        this.data = data;
+    }
+
+    public static <T> RestResp<T> ok(T data) {
+        return new RestResp(data);
+    }
+}

+ 16 - 0
novel-demo/src/main/java/com/sf/service/IBookInfoService.java

@@ -0,0 +1,16 @@
+package com.sf.service;
+
+import com.sf.po.BookInfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 小说信息 服务类
+ * </p>
+ *
+ * @author Qing
+ * @since 2024-01-29
+ */
+public interface IBookInfoService extends IService<BookInfo> {
+
+}

+ 16 - 0
novel-demo/src/main/java/com/sf/service/IHomeBookService.java

@@ -0,0 +1,16 @@
+package com.sf.service;
+
+import com.sf.po.HomeBook;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 小说推荐 服务类
+ * </p>
+ *
+ * @author Qing
+ * @since 2024-01-29
+ */
+public interface IHomeBookService extends IService<HomeBook> {
+
+}

+ 20 - 0
novel-demo/src/main/java/com/sf/service/impl/BookInfoServiceImpl.java

@@ -0,0 +1,20 @@
+package com.sf.service.impl;
+
+import com.sf.po.BookInfo;
+import com.sf.mapper.BookInfoMapper;
+import com.sf.service.IBookInfoService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 小说信息 服务实现类
+ * </p>
+ *
+ * @author Qing
+ * @since 2024-01-29
+ */
+@Service
+public class BookInfoServiceImpl extends ServiceImpl<BookInfoMapper, BookInfo> implements IBookInfoService {
+
+}

+ 20 - 0
novel-demo/src/main/java/com/sf/service/impl/HomeBookServiceImpl.java

@@ -0,0 +1,20 @@
+package com.sf.service.impl;
+
+import com.sf.po.HomeBook;
+import com.sf.mapper.HomeBookMapper;
+import com.sf.service.IHomeBookService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 小说推荐 服务实现类
+ * </p>
+ *
+ * @author Qing
+ * @since 2024-01-29
+ */
+@Service
+public class HomeBookServiceImpl extends ServiceImpl<HomeBookMapper, HomeBook> implements IHomeBookService {
+
+}

+ 67 - 0
novel-demo/src/main/java/com/sf/util/GeneUtils.java

@@ -0,0 +1,67 @@
+package com.sf.util;
+
+import com.baomidou.mybatisplus.generator.FastAutoGenerator;
+import com.baomidou.mybatisplus.generator.config.OutputFile;
+import com.baomidou.mybatisplus.generator.config.rules.DbColumnType;
+import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
+
+import java.sql.Types;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class GeneUtils {
+
+    public static void main(String[] args) {
+
+        FastAutoGenerator
+                .create("jdbc:mysql://localhost:3306/novel-cloud?useUnicode=true&characterEncoding=utf-8&allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=Asia/Shanghai",
+                        "root", "root123456")
+                .globalConfig(builder -> {
+                    builder.author("Qing") // 设置作者
+//                            .fileOverride() // 覆盖已生成文件
+                            .outputDir("src/main/java/"); // 指定输出目录 java文件的整体地址
+//                            .outputDir("src\\main\\java\\"); // windows中修改为\\
+                })
+                .dataSourceConfig(builder ->
+                        builder.typeConvertHandler((globalConfig, typeRegistry, metaInfo) -> {
+                            int typeCode = metaInfo.getJdbcType().TYPE_CODE;
+                            if (typeCode == Types.SMALLINT) {
+                                // 自定义类型转换
+                                // tinyInt  smallInt  < int  < bigInt
+                                // byte      short      int    long
+                                return DbColumnType.INTEGER;
+                            }
+                            return typeRegistry.getColumnType(metaInfo);
+
+                        }))
+                .packageConfig(builder -> {
+                    builder.parent("com.sf") // 设置父包名 自定义的源代码地址 对应Application主程序入口的包名
+                            .moduleName("") // 设置父包模块名
+                            .pathInfo(Collections.singletonMap(
+                                    OutputFile.xml, "src/main/resources/mapper")) // 设置mapperXml生成路径
+                            .entity("po")  // 实体类对应的包名 entity->po
+                            .service("service")
+                            .serviceImpl("service.impl")  // 服务层实现类对应的位置
+                            .mapper("mapper")  // dao层对应的包名  dao->mapper
+                            .xml("mapper.xml")
+                            .controller("controller")
+                            //                            .other("other")
+                            //                            .pathInfo(Collections.singletonMap(OutputFile.mapperXml, "D://"))
+                            .build();
+
+                })
+                .strategyConfig(builder -> {
+                    // sys_user  t_user   User  UserMapper  UserService
+//                    List<String>  tableList = new ArrayList<>();
+//                    tableList.add("chapter_content");
+//                    tableList.add("fiction_shelf");
+//                    builder.addInclude(tableList); // 设置需要生成的表名
+//                    builder.addInclude("chapter_content","fiction_shelf"); // 设置需要生成的表名
+                    builder.addInclude("home_book"); // 设置需要生成的表名
+                    //                            .addTablePrefix("t_", "c_"); // 设置过滤表前缀
+                })
+                .templateEngine(new FreemarkerTemplateEngine()) // 使用Freemarker引擎模板,默认的是Velocity引擎模板
+                .execute();
+    }
+}

+ 1 - 0
novel-demo/src/main/resources/application.properties

@@ -0,0 +1 @@
+

+ 14 - 0
novel-demo/src/main/resources/application.yml

@@ -0,0 +1,14 @@
+server:
+  port: 8888
+
+spring:
+  datasource:
+    url: jdbc:mysql://localhost:3306/novel-cloud?useUnicode=true&characterEncoding=utf-8&allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=Asia/Shanghai
+    username: root
+    password: root123456
+  jackson:
+    generator:
+      # JSON 序列化时,将所有 Number 类型的属性都转为 String 类型返回,避免前端数据精度丢失的问题。
+      # 由于 Javascript 标准规定所有数字处理都应使用 64 位 IEEE 754 浮点值完成,
+      # 结果是某些 64 位整数值无法准确表示(尾数只有 51 位宽)
+      write-numbers-as-strings: true

+ 5 - 0
novel-demo/src/main/resources/mapper/BookInfoMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.sf.mapper.BookInfoMapper">
+
+</mapper>

+ 5 - 0
novel-demo/src/main/resources/mapper/HomeBookMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.sf.mapper.HomeBookMapper">
+
+</mapper>

+ 13 - 0
novel-demo/src/test/java/com/sf/ApplicationTests.java

@@ -0,0 +1,13 @@
+package com.sf;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+class ApplicationTests {
+
+    @Test
+    void contextLoads() {
+    }
+
+}

+ 18 - 0
novel-demo/src/test/java/com/sf/MybatisPlusTests.java

@@ -0,0 +1,18 @@
+package com.sf;
+
+import com.sf.mapper.BookInfoMapper;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+public class MybatisPlusTests {
+
+    @Autowired
+    private BookInfoMapper bookInfoMapper;
+
+    @Test
+    public void test(){
+        System.out.println(bookInfoMapper.selectCount(null));
+    }
+}