初始化

This commit is contained in:
KongChengwen
2025-03-29 16:53:36 +08:00
commit fd463367b8
42 changed files with 2168 additions and 0 deletions

2
.gitattributes vendored Normal file
View File

@@ -0,0 +1,2 @@
/mvnw text eol=lf
*.cmd text eol=crlf

33
.gitignore vendored Normal file
View File

@@ -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/

19
.mvn/wrapper/maven-wrapper.properties vendored Normal file
View File

@@ -0,0 +1,19 @@
# 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
#
# http://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.
wrapperVersion=3.3.2
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip

259
mvnw vendored Normal file
View File

@@ -0,0 +1,259 @@
#!/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
#
# http://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.3.2
#
# Optional ENV vars
# -----------------
# JAVA_HOME - location of a JDK home dir, required when download maven via java source
# MVNW_REPOURL - repo url base for downloading maven distribution
# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output
# ----------------------------------------------------------------------------
set -euf
[ "${MVNW_VERBOSE-}" != debug ] || set -x
# OS specific support.
native_path() { printf %s\\n "$1"; }
case "$(uname)" in
CYGWIN* | MINGW*)
[ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")"
native_path() { cygpath --path --windows "$1"; }
;;
esac
# set JAVACMD and JAVACCMD
set_java_home() {
# For Cygwin and MinGW, ensure paths are in Unix format before anything is touched
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"
JAVACCMD="$JAVA_HOME/jre/sh/javac"
else
JAVACMD="$JAVA_HOME/bin/java"
JAVACCMD="$JAVA_HOME/bin/javac"
if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then
echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2
echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2
return 1
fi
fi
else
JAVACMD="$(
'set' +e
'unset' -f command 2>/dev/null
'command' -v java
)" || :
JAVACCMD="$(
'set' +e
'unset' -f command 2>/dev/null
'command' -v javac
)" || :
if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then
echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2
return 1
fi
fi
}
# hash string like Java String::hashCode
hash_string() {
str="${1:-}" h=0
while [ -n "$str" ]; do
char="${str%"${str#?}"}"
h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296))
str="${str#?}"
done
printf %x\\n $h
}
verbose() { :; }
[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; }
die() {
printf %s\\n "$1" >&2
exit 1
}
trim() {
# MWRAPPER-139:
# Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds.
# Needed for removing poorly interpreted newline sequences when running in more
# exotic environments such as mingw bash on Windows.
printf "%s" "${1}" | tr -d '[:space:]'
}
# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties
while IFS="=" read -r key value; do
case "${key-}" in
distributionUrl) distributionUrl=$(trim "${value-}") ;;
distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;;
esac
done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties"
[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties"
case "${distributionUrl##*/}" in
maven-mvnd-*bin.*)
MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/
case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in
*AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;;
:Darwin*x86_64) distributionPlatform=darwin-amd64 ;;
:Darwin*arm64) distributionPlatform=darwin-aarch64 ;;
:Linux*x86_64*) distributionPlatform=linux-amd64 ;;
*)
echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2
distributionPlatform=linux-amd64
;;
esac
distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip"
;;
maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;;
*) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;;
esac
# apply MVNW_REPOURL and calculate MAVEN_HOME
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}"
distributionUrlName="${distributionUrl##*/}"
distributionUrlNameMain="${distributionUrlName%.*}"
distributionUrlNameMain="${distributionUrlNameMain%-bin}"
MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}"
MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")"
exec_maven() {
unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || :
exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD"
}
if [ -d "$MAVEN_HOME" ]; then
verbose "found existing MAVEN_HOME at $MAVEN_HOME"
exec_maven "$@"
fi
case "${distributionUrl-}" in
*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;;
*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;;
esac
# prepare tmp dir
if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then
clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; }
trap clean HUP INT TERM EXIT
else
die "cannot create temp dir"
fi
mkdir -p -- "${MAVEN_HOME%/*}"
# Download and Install Apache Maven
verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
verbose "Downloading from: $distributionUrl"
verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
# select .zip or .tar.gz
if ! command -v unzip >/dev/null; then
distributionUrl="${distributionUrl%.zip}.tar.gz"
distributionUrlName="${distributionUrl##*/}"
fi
# verbose opt
__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR=''
[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v
# normalize http auth
case "${MVNW_PASSWORD:+has-password}" in
'') MVNW_USERNAME='' MVNW_PASSWORD='' ;;
has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;;
esac
if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then
verbose "Found wget ... using wget"
wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl"
elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then
verbose "Found curl ... using curl"
curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl"
elif set_java_home; then
verbose "Falling back to use Java to download"
javaSource="$TMP_DOWNLOAD_DIR/Downloader.java"
targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName"
cat >"$javaSource" <<-END
public class Downloader extends java.net.Authenticator
{
protected java.net.PasswordAuthentication getPasswordAuthentication()
{
return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() );
}
public static void main( String[] args ) throws Exception
{
setDefault( new Downloader() );
java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() );
}
}
END
# For Cygwin/MinGW, switch paths to Windows format before running javac and java
verbose " - Compiling Downloader.java ..."
"$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java"
verbose " - Running Downloader.java ..."
"$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")"
fi
# If specified, validate the SHA-256 sum of the Maven distribution zip file
if [ -n "${distributionSha256Sum-}" ]; then
distributionSha256Result=false
if [ "$MVN_CMD" = mvnd.sh ]; then
echo "Checksum validation is not supported for maven-mvnd." >&2
echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
exit 1
elif command -v sha256sum >/dev/null; then
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then
distributionSha256Result=true
fi
elif command -v shasum >/dev/null; then
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then
distributionSha256Result=true
fi
else
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2
echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
exit 1
fi
if [ $distributionSha256Result = false ]; then
echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2
echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2
exit 1
fi
fi
# unzip and move
if command -v unzip >/dev/null; then
unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip"
else
tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar"
fi
printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url"
mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME"
clean || :
exec_maven "$@"

149
mvnw.cmd vendored Normal file
View File

@@ -0,0 +1,149 @@
<# : batch portion
@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 http://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.3.2
@REM
@REM Optional ENV vars
@REM MVNW_REPOURL - repo url base for downloading maven distribution
@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output
@REM ----------------------------------------------------------------------------
@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0)
@SET __MVNW_CMD__=
@SET __MVNW_ERROR__=
@SET __MVNW_PSMODULEP_SAVE=%PSModulePath%
@SET PSModulePath=
@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @(
IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B)
)
@SET PSModulePath=%__MVNW_PSMODULEP_SAVE%
@SET __MVNW_PSMODULEP_SAVE=
@SET __MVNW_ARG0_NAME__=
@SET MVNW_USERNAME=
@SET MVNW_PASSWORD=
@IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*)
@echo Cannot start maven from wrapper >&2 && exit /b 1
@GOTO :EOF
: end batch / begin powershell #>
$ErrorActionPreference = "Stop"
if ($env:MVNW_VERBOSE -eq "true") {
$VerbosePreference = "Continue"
}
# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties
$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl
if (!$distributionUrl) {
Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
}
switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) {
"maven-mvnd-*" {
$USE_MVND = $true
$distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip"
$MVN_CMD = "mvnd.cmd"
break
}
default {
$USE_MVND = $false
$MVN_CMD = $script -replace '^mvnw','mvn'
break
}
}
# apply MVNW_REPOURL and calculate MAVEN_HOME
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
if ($env:MVNW_REPOURL) {
$MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" }
$distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')"
}
$distributionUrlName = $distributionUrl -replace '^.*/',''
$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$',''
$MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain"
if ($env:MAVEN_USER_HOME) {
$MAVEN_HOME_PARENT = "$env:MAVEN_USER_HOME/wrapper/dists/$distributionUrlNameMain"
}
$MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join ''
$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME"
if (Test-Path -Path "$MAVEN_HOME" -PathType Container) {
Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME"
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
exit $?
}
if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) {
Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl"
}
# prepare tmp dir
$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile
$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir"
$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null
trap {
if ($TMP_DOWNLOAD_DIR.Exists) {
try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
}
}
New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null
# Download and Install Apache Maven
Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
Write-Verbose "Downloading from: $distributionUrl"
Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
$webclient = New-Object System.Net.WebClient
if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) {
$webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD)
}
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null
# If specified, validate the SHA-256 sum of the Maven distribution zip file
$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum
if ($distributionSha256Sum) {
if ($USE_MVND) {
Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties."
}
Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash
if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) {
Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property."
}
}
# unzip and move
Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null
Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null
try {
Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null
} catch {
if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) {
Write-Error "fail to move MAVEN_HOME"
}
} finally {
try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
}
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"

107
pom.xml Normal file
View File

@@ -0,0 +1,107 @@
<?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.4.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.kkz</groupId>
<artifactId>kpersonalre</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>kpersonalre</name>
<description>kpersonalre</description>
<url/>
<licenses>
<license/>
</licenses>
<developers>
<developer/>
</developers>
<scm>
<connection/>
<developerConnection/>
<tag/>
<url/>
</scm>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-jdbc</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</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>
<!-- https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-spring-boot3-starter -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
<version>3.5.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/cn.hutool/hutool-all -->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.36</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-generator -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
<version>3.5.10.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.mysql/mysql-connector-j -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>9.1.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<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>

View File

@@ -0,0 +1,25 @@
package com.kkz.kpersonalre;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
//@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@SpringBootApplication
@MapperScan("com.kkz.kpersonalre.mapper")
public class KPersonalApplication {
public static void main(String[] args) {
SpringApplication.run(KPersonalApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 启动成功 ლ(´ڡ`ლ)゙ \n" +
" .oooooo. oooo oooo .oooooo. oooo oooo .oooooo. oooo oooo .oooooo. oooo oooo \n" +
" d8P' `Y8b `888 .8P' d8P' `Y8b `888 .8P' d8P' `Y8b `888 .8P' d8P' `Y8b `888 .8P' \n" +
"888 888 888 d8' 888 888 888 d8' 888 888 888 d8' 888 888 888 d8' \n" +
"888 888 88888[ 888 888 88888[ 888 888 88888[ 888 888 88888[ \n" +
"888 888 888`88b. 888 888 888`88b. 888 888 888`88b. 888 888 888`88b. \n" +
"`88b d88' 888 `88b. `88b d88' 888 `88b. `88b d88' 888 `88b. `88b d88' 888 `88b. \n" +
" `Y8bood8P' o888o o888o `Y8bood8P' o888o o888o `Y8bood8P' o888o o888o `Y8bood8P' o888o o888o \n");
}
}

View File

@@ -0,0 +1,10 @@
package com.kkz.kpersonalre.api;
/**
* @program: kpersonalre
* @description:
* @author: 孔成文
* @createTime: 2025-03-29 16:49
**/
public class Assert {
}

View File

@@ -0,0 +1,21 @@
package com.kkz.kpersonalre.api;
/**
* REST API 错误码接口
*
* @author hubin
* @since 2018-06-05
*/
public interface IErrorCode {
/**
* 错误编码 -1、失败 0、成功
*/
long getCode();
/**
* 错误描述
*/
String getMsg();
}

View File

@@ -0,0 +1,90 @@
package com.kkz.kpersonalre.api;
import com.kkz.kpersonalre.enums.ApiErrorCode;
import com.kkz.kpersonalre.exception.ApiException;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Optional;
/**
* REST API 返回结果
*
* @author hubin
* @since 2018-06-05
*/
@Data
@Accessors(chain = true)
public class R<T> implements Serializable {
/**
* serialVersionUID
*/
private static final long serialVersionUID = 1L;
/**
* 业务错误码
*/
private long code;
/**
* 结果集
*/
private T data;
/**
* 描述
*/
private String msg;
public R() {
// to do nothing
}
public R(IErrorCode errorCode) {
errorCode = Optional.ofNullable(errorCode).orElse(ApiErrorCode.FAILED);
this.code = errorCode.getCode();
this.msg = errorCode.getMsg();
}
public static <T> R<T> ok(T data) {
ApiErrorCode aec = ApiErrorCode.SUCCESS;
if (data instanceof Boolean && Boolean.FALSE.equals(data)) {
aec = ApiErrorCode.FAILED;
}
return restResult(data, aec);
}
public static <T> R<T> failed(String msg) {
return restResult(null, ApiErrorCode.FAILED.getCode(), msg);
}
public static <T> R<T> failed(IErrorCode errorCode) {
return restResult(null, errorCode);
}
public static <T> R<T> restResult(T data, IErrorCode errorCode) {
return restResult(data, errorCode.getCode(), errorCode.getMsg());
}
private static <T> R<T> restResult(T data, long code, String msg) {
R<T> apiResult = new R<>();
apiResult.setCode(code);
apiResult.setData(data);
apiResult.setMsg(msg);
return apiResult;
}
public boolean ok() {
return ApiErrorCode.SUCCESS.getCode() == code;
}
/**
* 服务间调用非业务正常,异常直接释放
*/
public T serviceData() {
if (!ok()) {
throw new ApiException(this.msg);
}
return data;
}
}

View File

@@ -0,0 +1,38 @@
package com.kkz.kpersonalre.controller;
import com.kkz.kpersonalre.api.R;
import com.kkz.kpersonalre.service.AlarmService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @program: KPersonal
* @description: 闹钟入口
* @author: 孔成文
* @createTime: 2025-03-27 16:14
**/
@Slf4j
@RestController
@RequestMapping("/alarm")
public class AlarmController {
@Autowired
private AlarmService alarmService;
/**
* 上传位置信息
* @param location
* @return
*/
@GetMapping
public R<String> uploadLocation(String location) {
log.info("进入[上传位置信息接口],入参:{}", location);
R<String> result = alarmService.uploadLocation(location);
log.info("离开[上传位置信息接口],出参:{}", result);
return result;
}
}

View File

@@ -0,0 +1,60 @@
package com.kkz.kpersonalre.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import java.time.LocalDateTime;
/**
* @ClassName: BaseEntity
* @Description: 业务基类
* @Auther: 张强
* @Date: 2024年09月24日 11:32
* @Version 1.0.0
*/
@Data
public class BaseEntity {
/**
* 唯一标识
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
* 使用mp自带方法删除和查找都会附带逻辑删除功能 (自己写的xml不会)
*/
@TableLogic
@TableField("del_flag")
private Integer delFlag;
/**
* 创建者
*/
@TableField(value = "create_by", fill = FieldFill.INSERT)
private String createBy;
/**
* 创建时间
*/
@TableField(value = "create_time", fill = FieldFill.INSERT)
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
/**
* 更新者
*/
@TableField(value = "update_by", fill = FieldFill.INSERT_UPDATE)
private String updateBy;
/**
* 更新时间
*/
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE,update = "now()")
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime updateTime;
}

View File

@@ -0,0 +1,36 @@
package com.kkz.kpersonalre.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.time.LocalTime;
/**
* <p>
* 闹钟时刻配置表
* </p>
*
* @author auto-generation-by-kcw
* @since 2025-03-27
*/
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@Builder
@TableName("tb_alarm_clock_config")
public class TbAlarmClockConfigEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 闹钟时间
*/
private LocalTime alarmTime;
}

View File

@@ -0,0 +1,46 @@
package com.kkz.kpersonalre.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import lombok.Builder;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
/**
* <p>
* 闹钟规则配置表
* </p>
*
* @author auto-generation-by-kcw
* @since 2025-03-27
*/
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@Builder
@TableName("tb_alarm_person_config")
public class TbAlarmPersonConfigEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 类型 1融合 2单独 融合的优先级最高
*/
private String type;
/**
* 配置描述
*/
private String describe;
/**
* json类型
融合为数组[[personId,localtionId,alarmClockId],[personId,localtionId,alarmClockId]]
单独不为数组,但元素一样,如果融合规则匹配则不匹配单独类型
*/
private String config;
}

View File

@@ -0,0 +1,42 @@
package com.kkz.kpersonalre.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDate;
import java.sql.Blob;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import lombok.Builder;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
/**
* <p>
* 日期是否节假日表
* </p>
*
* @author auto-generation-by-kcw
* @since 2025-03-27
*/
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@Builder
@TableName("tb_date_holiday")
public class TbDateHolidayEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 日期
*/
private LocalDate date;
/**
* 是否节假日 0否 1是
*/
@TableField("holidayFlag")
private Blob holidayFlag;
}

View File

@@ -0,0 +1,42 @@
package com.kkz.kpersonalre.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDate;
import java.sql.Blob;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import lombok.Builder;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
/**
* <p>
* 排班配置表
* </p>
*
* @author auto-generation-by-kcw
* @since 2025-03-27
*/
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@Builder
@TableName("tb_force_weekday_config")
public class TbForceWeekdayConfigEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
private Integer personConfigId;
/**
* 日期
*/
private LocalDate date;
/**
* 是否节假日 0否 1是
*/
private Blob holidayFlag;
}

View File

@@ -0,0 +1,33 @@
package com.kkz.kpersonalre.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import lombok.Builder;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
/**
* <p>
* 地址配置表
* </p>
*
* @author auto-generation-by-kcw
* @since 2025-03-27
*/
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@Builder
@TableName("tb_location_config")
public class TbLocationConfigEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 名称
*/
private String name;
}

View File

@@ -0,0 +1,33 @@
package com.kkz.kpersonalre.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import lombok.Builder;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
/**
* <p>
* 闹钟时刻表
* </p>
*
* @author auto-generation-by-kcw
* @since 2025-03-27
*/
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@Builder
@TableName("tb_location_upload")
public class TbLocationUploadEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 地址配置表id
*/
private Integer locationConfigId;
}

View File

@@ -0,0 +1,33 @@
package com.kkz.kpersonalre.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import lombok.Builder;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
/**
* <p>
* 闹钟时刻表
* </p>
*
* @author auto-generation-by-kcw
* @since 2025-03-27
*/
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@Builder
@TableName("tb_person_config")
public class TbPersonConfigEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 人kkww
*/
private String person;
}

View File

@@ -0,0 +1,55 @@
package com.kkz.kpersonalre.enums;
import com.kkz.kpersonalre.api.IErrorCode;
/**
* REST API 错误码
*
* @author hubin
* @since 2017-06-26
*/
public enum ApiErrorCode implements IErrorCode {
/**
* 失败
*/
FAILED(-1, "操作失败"),
/**
* 成功
*/
SUCCESS(0, "执行成功");
private final long code;
private final String msg;
ApiErrorCode(final long code, final String msg) {
this.code = code;
this.msg = msg;
}
public static ApiErrorCode fromCode(long code) {
ApiErrorCode[] ecs = ApiErrorCode.values();
for (ApiErrorCode ec : ecs) {
if (ec.getCode() == code) {
return ec;
}
}
return SUCCESS;
}
@Override
public long getCode() {
return code;
}
@Override
public String getMsg() {
return msg;
}
@Override
public String toString() {
return String.format(" ErrorCode:{code=%s, msg=%s} ", code, msg);
}
}

View File

@@ -0,0 +1,44 @@
package com.kkz.kpersonalre.exception;
import com.kkz.kpersonalre.api.IErrorCode;
/**
* REST API 请求异常类
*
* @author hubin
* @since 2017-06-26
*/
public class ApiException extends RuntimeException {
/**
* serialVersionUID
*/
private static final long serialVersionUID = -5885155226898287919L;
/**
* 错误码
*/
private IErrorCode errorCode;
public ApiException(IErrorCode errorCode) {
super(errorCode.getMsg());
this.errorCode = errorCode;
}
public ApiException(String message) {
super(message);
}
public ApiException(Throwable cause) {
super(cause);
}
public ApiException(String message, Throwable cause) {
super(message, cause);
}
public IErrorCode getErrorCode() {
return errorCode;
}
}

View File

@@ -0,0 +1,48 @@
package com.kkz.kpersonalre.generator;
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.Collections;
/**
* @program: kpersonalre
* @description:
* @author: 孔成文
* @createTime: 2025-03-29 16:36
**/
public class CodeGenerator {
public static void main(String[] args) {
FastAutoGenerator.create("url", "username", "password")
.globalConfig(builder -> {
builder.author("baomidou") // 设置作者
.enableSwagger() // 开启 swagger 模式
.outputDir("D://"); // 指定输出目录
})
.dataSourceConfig(builder ->
builder.typeConvertHandler((globalConfig, typeRegistry, metaInfo) -> {
int typeCode = metaInfo.getJdbcType().TYPE_CODE;
if (typeCode == Types.SMALLINT) {
// 自定义类型转换
return DbColumnType.INTEGER;
}
return typeRegistry.getColumnType(metaInfo);
})
)
.packageConfig(builder ->
builder.parent("com.baomidou.mybatisplus.samples.generator") // 设置父包名
.moduleName("system") // 设置父包模块名
.pathInfo(Collections.singletonMap(OutputFile.xml, "D://")) // 设置mapperXml生成路径
)
.strategyConfig(builder ->
builder.addInclude("t_simple") // 设置需要生成的表名
.addTablePrefix("t_", "c_") // 设置过滤表前缀
)
.templateEngine(new FreemarkerTemplateEngine()) // 使用Freemarker引擎模板默认的是Velocity引擎模板
.execute();
}
}

View File

@@ -0,0 +1,201 @@
package com.kkz.kpersonalre.generator;
/**
* @ClassName CodeGenerators
* @Description
* @Author 孔成文
* @Date 2020/4/3 10:12
* @Version 1.0
*/
public class logisticsCodeGenerator {}/*{
*//**
* <p>
* 读取控制台内容
* </p>
*//*
public static String scanner(String tip) {
Scanner scanner = new Scanner(System.in);
System.out.println("请输入表名,如有多个表,请以\",\"分割:");
if (scanner.hasNext()) {
String ipt = scanner.next();
if (StrUtil.isNotEmpty(ipt)) {
ipt = ipt.replace("", ",");
return ipt;
}
}
throw new MybatisPlusException("请输入正确的" + tip + "");
}
*//**
* 逆向工程入口
*
* @param args
* @throws java.io.IOException
*//*
public static void main(String[] args) throws IOException {
//正常情况下切换model在这里修改对应数据
//该model的springboot启动类的位置全路径
String parentPath = "com.kk.kpersonal";
//该model的名字
String modelName = "";
//该model的springboot启动类的位置单包
String packageName = "";
String databaseName = "kkpersonal";
//以下字段只有在复制到其它项目时才需要修改
//
String modelPath = "/" + modelName + "src/main/java/com/kk/kpersonal" + packageName;
String databaseServer = "124.220.110.250:3306";
String databaseUsername = "root";
String databasePwd = "a695752274A";
//这是生成的entity的父类
String superEntityClass = "com.kk.kpersonal.entity.BaseEntity";
//这是生成的父类中的公共字段(必须以数据库的命名为标准)
String[] superEntityColumns = {
"id",
"del_flag",
"create_by",
"create_time",
"update_by",
"update_time"};
// 代码生成器
AutoGenerator mpg = new AutoGenerator();
// 全局配置
GlobalConfig gc = new GlobalConfig();
String projectPath = System.getProperty("user.dir");
gc.setOutputDir(projectPath + "/src/main/java");
gc.setAuthor("auto-generation-by-kcw");
gc.setEntityName("%sEntity");
gc.setMapperName("%sMapper");
gc.setOpen(false);
// gc.setSwagger2(true); 实体属性 Swagger2 注解
mpg.setGlobalConfig(gc);
// 数据源配置
DataSourceConfig dsc = new DataSourceConfig();
dsc.setUrl("jdbc:mysql://" + databaseServer + "/" + databaseName + "?characterEncoding=utf8&useSSL=false&allowMultiQueries=true");
dsc.setDriverName("com.mysql.cj.jdbc.Driver");
dsc.setUsername(databaseUsername);
dsc.setPassword(databasePwd);
mpg.setDataSource(dsc);
// 包配置
PackageConfig pc = new PackageConfig();
pc.setParent(parentPath);
pc.setEntity("entity");
pc.setMapper("mapper");
mpg.setPackageInfo(pc);
// 自定义配置
InjectionConfig cfg = new InjectionConfig() {
@Override
public void initMap() {
// to do nothing
}
};
//自定义参数
// final HashMap<String, Object> map = new HashMap<>(1);
// //entity的后缀
// map.put("entityName", "Entity");
// cfg.setMap(map);
// 自定义输出配置
List<FileOutConfig> focList = new ArrayList<>();
// 自定义配置会被优先输出
// focList.add(new FileOutConfig("/templates/mapper.xml.btl") {
// @Override
// public String outputFile(TableInfo tableInfo) {
// // 自定义输出文件名 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
// return projectPath + "/cic-mapper" + "/src/main/resources/mapper"
// + "/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML;
// }
// });
// 自定义配置会被优先输出
focList.add(new FileOutConfig("/templates/mapper.java.btl") {
@Override
public String outputFile(TableInfo tableInfo) {
// 自定义输出文件名 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
return projectPath + modelPath + "/mapper"
+ "/" + tableInfo.getMapperName() + StringPool.DOT_JAVA;
}
});
// 自定义配置会被优先输出
focList.add(new FileOutConfig("/templates/entity.java.btl") {
@Override
public String outputFile(TableInfo tableInfo) {
// 自定义输出文件名 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
return projectPath + modelPath + "/entity"
+ "/" + tableInfo.getEntityName() + StringPool.DOT_JAVA;
}
});
// // 自定义配置会被优先输出
// focList.add(new FileOutConfig("/templates/service.java.btl") {
// @Override
// public String outputFile(TableInfo tableInfo) {
// // 自定义输出文件名 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
// return projectPath + "/cic-service" + "/src/main/java/com/thjinrong/cic/service"
// + "/I" + tableInfo.getEntityName() + "Service" + StringPool.DOT_JAVA;
// }
// });
// // 自定义配置会被优先输出
// focList.add(new FileOutConfig("/templates/serviceImpl.java.btl") {
// @Override
// public String outputFile(TableInfo tableInfo) {
// // 自定义输出文件名 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
// return projectPath + "/cic-service" + "/src/main/java/com/thjinrong/cic/service/impl"
// + "/" + tableInfo.getEntityName() + "ServiceImpl" + StringPool.DOT_JAVA;
// }
// });
cfg.setFileOutConfigList(focList);
mpg.setCfg(cfg);
TemplateConfig templateConfig = new TemplateConfig();
// 配置自定义输出模板
//指定自定义模板路径,注意不要带上.ftl/.vm, 会根据使用的模板引擎自动识别
templateConfig.setEntity(null);
templateConfig.setService(null);
templateConfig.setController(null);
templateConfig.setXml(null);
templateConfig.setEntityKt(null);
templateConfig.setServiceImpl(null);
templateConfig.setMapper(null);
templateConfig.setEntity(null);
mpg.setTemplate(templateConfig);
// 策略配置
StrategyConfig strategy = new StrategyConfig();
strategy.setNaming(NamingStrategy.underline_to_camel);
strategy.setColumnNaming(NamingStrategy.underline_to_camel);
strategy.setSuperEntityClass(superEntityClass);
strategy.setEntityLombokModel(true);
strategy.setEntityBuilderModel(true);
strategy.setLogicDeleteFieldName("deleted");
// strategy.setRestControllerStyle(true);
// 公共父类
// strategy.setSuperControllerClass("com.thjinrong.cic.base.BaseController");
// 写于父类中的公共字段
strategy.setSuperEntityColumns(
superEntityColumns);
strategy.setInclude(scanner("表名,多个英文逗号分割").split(","));
// strategy.setControllerMappingHyphenStyle(true);
strategy.setTablePrefix(pc.getModuleName() + "_");
mpg.setStrategy(strategy);
mpg.setTemplateEngine(new BeetlTemplateEngine());
mpg.execute();
}
}*/

View File

@@ -0,0 +1,18 @@
package com.kkz.kpersonalre.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kkz.kpersonalre.entity.TbAlarmClockConfigEntity;
import org.springframework.stereotype.Repository;
/**
* <p>
* 闹钟时刻配置表 Mapper 接口
* </p>
*
* @author auto-generation-by-kcw
* @since 2025-03-27
*/
@Repository
public interface TbAlarmClockConfigMapper extends BaseMapper<TbAlarmClockConfigEntity> {
}

View File

@@ -0,0 +1,18 @@
package com.kkz.kpersonalre.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kkz.kpersonalre.entity.TbAlarmPersonConfigEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 闹钟规则配置表 Mapper 接口
* </p>
*
* @author auto-generation-by-kcw
* @since 2025-03-27
*/
@Mapper
public interface TbAlarmPersonConfigMapper extends BaseMapper<TbAlarmPersonConfigEntity> {
}

View File

@@ -0,0 +1,18 @@
package com.kkz.kpersonalre.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kkz.kpersonalre.entity.TbDateHolidayEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 日期是否节假日表 Mapper 接口
* </p>
*
* @author auto-generation-by-kcw
* @since 2025-03-27
*/
@Mapper
public interface TbDateHolidayMapper extends BaseMapper<TbDateHolidayEntity> {
}

View File

@@ -0,0 +1,18 @@
package com.kkz.kpersonalre.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kkz.kpersonalre.entity.TbForceWeekdayConfigEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 排班配置表 Mapper 接口
* </p>
*
* @author auto-generation-by-kcw
* @since 2025-03-27
*/
@Mapper
public interface TbForceWeekdayConfigMapper extends BaseMapper<TbForceWeekdayConfigEntity> {
}

View File

@@ -0,0 +1,18 @@
package com.kkz.kpersonalre.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kkz.kpersonalre.entity.TbLocationConfigEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 地址配置表 Mapper 接口
* </p>
*
* @author auto-generation-by-kcw
* @since 2025-03-27
*/
@Mapper
public interface TbLocationConfigMapper extends BaseMapper<TbLocationConfigEntity> {
}

View File

@@ -0,0 +1,18 @@
package com.kkz.kpersonalre.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kkz.kpersonalre.entity.TbLocationUploadEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 闹钟时刻表 Mapper 接口
* </p>
*
* @author auto-generation-by-kcw
* @since 2025-03-27
*/
@Mapper
public interface TbLocationUploadMapper extends BaseMapper<TbLocationUploadEntity> {
}

View File

@@ -0,0 +1,18 @@
package com.kkz.kpersonalre.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kkz.kpersonalre.entity.TbPersonConfigEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 闹钟时刻表 Mapper 接口
* </p>
*
* @author auto-generation-by-kcw
* @since 2025-03-27
*/
@Mapper
public interface TbPersonConfigMapper extends BaseMapper<TbPersonConfigEntity> {
}

View File

@@ -0,0 +1,14 @@
package com.kkz.kpersonalre.service;
import com.kkz.kpersonalre.api.R;
public interface AlarmService {
/**
* 上传位置接口
* @param location
* @return
*/
R<String> uploadLocation(String location);
}

View File

@@ -0,0 +1,69 @@
package com.kkz.kpersonalre.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.kkz.kpersonalre.api.R;
import com.kkz.kpersonalre.entity.TbLocationConfigEntity;
import com.kkz.kpersonalre.entity.TbLocationUploadEntity;
import com.kkz.kpersonalre.mapper.TbAlarmClockConfigMapper;
import com.kkz.kpersonalre.mapper.TbAlarmPersonConfigMapper;
import com.kkz.kpersonalre.mapper.TbDateHolidayMapper;
import com.kkz.kpersonalre.mapper.TbForceWeekdayConfigMapper;
import com.kkz.kpersonalre.mapper.TbLocationConfigMapper;
import com.kkz.kpersonalre.mapper.TbLocationUploadMapper;
import com.kkz.kpersonalre.mapper.TbPersonConfigMapper;
import com.kkz.kpersonalre.service.AlarmService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @program: KPersonal
* @description:
* @author: 孔成文
* @createTime: 2025-03-27 16:13
**/
@Slf4j
@Service
public class AlarmServiceImpl implements AlarmService {
@Autowired
private TbAlarmClockConfigMapper alarmClockConfigMapper;
@Autowired
private TbAlarmPersonConfigMapper alarmPersonConfigMapper;
@Autowired
private TbDateHolidayMapper dateHolidayMapper;
@Autowired
private TbForceWeekdayConfigMapper forceWeekdayConfigMapper;
@Autowired
private TbLocationConfigMapper locationConfigMapper;
@Autowired
private TbLocationUploadMapper locationUploadMapper;
@Autowired
private TbPersonConfigMapper personConfigMapper;
/**
* 上传位置接口
*
* @param location
* @return
*/
@Override
public R<String> uploadLocation(String location) {
TbLocationConfigEntity locationConfigEntity = locationConfigMapper.selectOne(new LambdaQueryWrapper<TbLocationConfigEntity>()
.eq(TbLocationConfigEntity::getName, location));
if (locationConfigEntity == null) {
return R.failed("位置不存在");
}
locationUploadMapper.insert(new TbLocationUploadEntity()
.setLocationConfigId(locationConfigEntity.getId().intValue()));
return R.ok("上传成功");
}
}

View File

@@ -0,0 +1,57 @@
# 开发环境配置
server:
# 服务器的HTTP端口默认为8080
port: 4088
servlet:
# 应用的访问路径
context-path: /kk
tomcat:
# tomcat的URI编码
uri-encoding: UTF-8
# 连接数满后的排队数默认为100
accept-count: 1000
threads:
# tomcat最大线程数默认为200
max: 800
# Tomcat启动初始化的线程数默认值10
min-spare: 100
spring:
application:
name: kpersonalre
instance-id: kpersonalre-1
datasource:
url: jdbc:mysql://124.220.110.250:3306/kkpersonal?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: a695752274A
driver-class-name: com.mysql.cj.jdbc.Driver
# type: com.alibaba.druid.pool.DruidDataSource
hikari:
maximum-pool-size: 100 #最大连接数
minimum-idle: 50 #最小空闲连接
connection-timeout: 60000 #连接超时时间(毫秒)
idle-timeout: 60000
max-lifetime: 6000000 #连接最大存活时间设置应该比mysql设置的超时时间短
leak-detection-threshold: 5000
## mp配置 mapper路径和日志
mybatis-plus:
mapper-locations: classpath:/**/mapper/*.xml
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
global-config:
db-config:
logic-delete-field: delFlag # 全局逻辑删除字段名
logic-delete-value: 1 # 逻辑已删除值
logic-not-delete-value: 0 # 逻辑未删除值
##日志
logging:
file:
name: ./logs/${spring.application.name}/${spring.application.instance-id}.log
logback:
rollingpolicy:
max-file-size: 500MB
max-history: 30
level:
root: info

View File

@@ -0,0 +1,23 @@
Spring Boot Version: ${spring-boot.version}
////////////////////////////////////////////////////////////////////
// _ooOoo_ //
// o8888888o //
// 88" . "88 //
// (| ^_^ |) //
// O\ = /O //
// ____/`---'\____ //
// .' \\| |// `. //
// / \\||| : |||// \ //
// / _||||| -:- |||||- \ //
// | | \\\ - /// | | //
// | \_| ''\---/'' | | //
// \ .-\__ `-` ___/-. / //
// ___`. .' /--.--\ `. . ___ //
// ."" '< `.___\_<|>_/___.' >'"". //
// | | : `- \`.;`\ _ /`;.`/ - ` : | | //
// \ \ `-. \_ __\ /__ _/ .-` / / //
// ========`-.____`-.___\_____/___.-`____.-'======== //
// `=---=' //
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
// 佛祖保佑 永不宕机 永无BUG //
////////////////////////////////////////////////////////////////////

View File

@@ -0,0 +1,39 @@
package ${package.Controller};
import org.springframework.web.bind.annotation.RequestMapping;
<% if(restControllerStyle){ %>
import org.springframework.web.bind.annotation.RestController;
<% }else{ %>
import org.springframework.stereotype.Controller;
<% } %>
<% if(isNotEmpty(superControllerClassPackage)){ %>
import ${superControllerClassPackage};
<% } %>
/**
* <p>
* ${table.comment!} 前端控制器
* </p>
*
* @author ${author}
* @since ${date}
*/
<% if(restControllerStyle){ %>
@RestController
<% }else{ %>
@Controller
<% } %>
@RequestMapping("<% if(isNotEmpty(package.ModuleName)){ %>/${package.ModuleName}<% } %>/<% if(isNotEmpty(controllerMappingHyphenStyle)){ %>${controllerMappingHyphen}<% }else{ %>${table.entityPath}<% } %>")
<% if(kotlin){ %>
class ${table.controllerName}<% if(isNotEmpty(superControllerClass)){ %> : ${superControllerClass}()<% } %>
<% }else{ %>
<% if(isNotEmpty(superControllerClass)){ %>
public class ${table.controllerName} extends ${superControllerClass} {
<% }else{ %>
public class ${table.controllerName} {
<% } %>
}
<% } %>

View File

@@ -0,0 +1,168 @@
package ${package.Entity};
<% for(pkg in table.importPackages){ %>
import ${pkg};
<% } %>
<% if(swagger2){ %>
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
<% } %>
<% if(entityLombokModel){ %>
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import lombok.Builder;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
<% } %>
/**
* <p>
* ${table.comment!}
* </p>
*
* @author ${author}
* @since ${date}
*/
<% if(entityLombokModel){ %>
@Data
<% if(isNotEmpty(superEntityClass)){ %>
@EqualsAndHashCode(callSuper = true)
<% }else{ %>
@EqualsAndHashCode(callSuper = false)
<% } %>
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@Builder
<% } %>
<% if(table.convert){ %>
@TableName("${table.name}")
<% } %>
<% if(swagger2){ %>
@ApiModel(value="${entity}对象", description="${table.comment!''}")
<% } %>
<% if(isNotEmpty(superEntityClass)){ %>
public class ${entity} extends ${superEntityClass}<% if(activeRecord){ %><${entity}><%}%> {
<% }else if(activeRecord){ %>
public class ${entity} extends Model<${entity}> {
<% }else{ %>
public class ${entity} implements Serializable {
<% } %>
<% if(entitySerialVersionUID){ %>
private static final long serialVersionUID = 1L;
<% } %>
<% /** -----------BEGIN 字段循环遍历----------- **/ %>
<% for(field in table.fields){ %>
<%
if(field.keyFlag){
var keyPropertyName = field.propertyName;
}
%>
<% if(isNotEmpty(field.comment)){ %>
<% if(swagger2){ %>
@ApiModelProperty(value = "${field.comment}")
<% }else{ %>
/**
* ${field.comment}
*/
<% } %>
<% } %>
<% if(field.keyFlag){ %>
<%
/*主键*/
%>
<% if(field.keyIdentityFlag){ %>
@TableId(value = "${field.name}", type = IdType.AUTO)
<% }else if(isNotEmpty(idType)){ %>
@TableId(value = "${field.name}", type = IdType.${idType})
<% }else if(field.convert){ %>
@TableId("${field.name}")
<% } %>
<%
/*普通字段*/
%>
<% }else if(isNotEmpty(field.fill)){ %>
<% if(field.convert){ %>
@TableField(value = "${field.name}", fill = FieldFill.${field.fill})
<% }else{ %>
@TableField(fill = FieldFill.${field.fill})
<% } %>
<% }else if(field.convert){ %>
@TableField("${field.name}")
<% } %>
<%
/*乐观锁注解*/
%>
<% if(versionFieldName!'' == field.name){ %>
@Version
<% } %>
<%
/*逻辑删除注解*/
%>
<% if(logicDeleteFieldName!'' == field.name){ %>
@TableLogic
<% } %>
private ${field.propertyType} ${field.propertyName};
<% } %>
<% /** -----------END 字段循环遍历----------- **/ %>
<% if(!entityLombokModel){ %>
<% for(field in table.fields){ %>
<%
var getprefix ='';
if(field.propertyType=='boolean'){
getprefix='is';
}else{
getprefix='get';
}
%>
public ${field.propertyType} ${getprefix}${field.capitalName}() {
return ${field.propertyName};
}
<% if(entityBuilderModel){ %>
public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
<% }else{ %>
public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
<% } %>
this.${field.propertyName} = ${field.propertyName};
<% if(entityBuilderModel){ %>
return this;
<% } %>
}
<% } %>
<% } %>
<% if(entityColumnConstant){ %>
<% for(field in table.fields){ %>
public static final String ${strutil.toUpperCase(field.name)} = "${field.name}";
<% } %>
<% } %>
<% if(activeRecord){ %>
@Override
protected Serializable pkVal() {
<% if(isNotEmpty(keyPropertyName)){ %>
return this.${keyPropertyName};
<% }else{ %>
return null;
<% } %>
}
<% } %>
<% if(!entityLombokModel){ %>
@Override
public String toString() {
return "${entity}{" +
<% for(field in table.fields){ %>
<% if(fieldLP.index==0){ %>
"${field.propertyName}=" + ${field.propertyName} +
<% }else{ %>
", ${field.propertyName}=" + ${field.propertyName} +
<% } %>
<% } %>
"}";
}
<% } %>
}

View File

@@ -0,0 +1,124 @@
package ${package.Entity}
<% for(pkg in table.importPackages){ %>
import ${pkg}
<% } %>
<% if(swagger2){ %>
import io.swagger.annotations.ApiModel
import io.swagger.annotations.ApiModelProperty
<% } %>
/**
* <p>
* ${table.comment!}
* </p>
*
* @author ${author}
* @since ${date}
*/
<% if(table.convert){ %>
@TableName("${table.name}")
<% } %>
<% if(swagger2){ %>
@ApiModel(value="${entity}对象", description="${table.comment!''}")
<% } %>
<% if(isNotEmpty(superEntityClass)){ %>
class ${entity} : ${superEntityClass}<% if(activeRecord){ %><${entity}><%}%>{
<% }else if(activeRecord){ %>
class ${entity} : Model<${entity}> {
<% }else{ %>
class ${entity} : Serializable {
<% } %>
<% /** -----------BEGIN 字段循环遍历----------- **/ %>
<% for(field in table.fields){ %>
<%
if(field.keyFlag){
var keyPropertyName = field.propertyName;
}
%>
<% if(isNotEmpty(field.comment)){ %>
<% if(swagger2){ %>
@ApiModelProperty(value = "${field.comment}")
<% }else{ %>
/**
* ${field.comment}
*/
<% } %>
<% } %>
<% if(field.keyFlag){ %>
<%
/*主键*/
%>
<% if(field.keyIdentityFlag){ %>
@TableId(value = "${field.name}", type = IdType.AUTO)
<% }else if(isNotEmpty(idType)){ %>
@TableId(value = "${field.name}", type = IdType.${idType})
<% }else if(field.convert){ %>
@TableId("${field.name}")
<% } %>
<%
/*普通字段*/
%>
<% }else if(isNotEmpty(field.fill)){ %>
<% if(field.convert){ %>
@TableField(value = "${field.name}", fill = FieldFill.${field.fill})
<% }else{ %>
@TableField(fill = FieldFill.${field.fill})
<% } %>
<% }else if(field.convert){ %>
@TableField("${field.name}")
<% } %>
<%
/*乐观锁注解*/
%>
<% if(versionFieldName!'' == field.name){ %>
@Version
<% } %>
<%
/*逻辑删除注解*/
%>
<% if(logicDeleteFieldName!'' == field.name){ %>
@TableLogic
<% } %>
<% if(field.propertyType == 'Integer'){ %>
var ${field.propertyName}: Int ? = null
<% }else{ %>
var ${field.propertyName}: ${field.propertyType} ? = null
<% } %>
<% } %>
<% /** -----------END 字段循环遍历----------- **/ %>
<% if(entityColumnConstant){ %>
companion object {
<% for(field in table.fields){ %>
const val ${strutil.toUpperCase(field.name)} : String = "${field.name}"
<% } %>
}
<% } %>
<% if(activeRecord){ %>
@Override
override fun pkVal(): Serializable? {
<% if(isNotEmpty(keyPropertyName)){ %>
return this.${keyPropertyName}
<% }else{ %>
return null;
<% } %>
}
<% } %>
<% if(!entityLombokModel){ %>
@Override
override fun toString(): String {
return "${entity}{" +
<% for(field in table.fields){ %>
<% if(fieldLP.index==0){ %>
"${field.propertyName}=" + ${field.propertyName} +
<% }else{ %>
", ${field.propertyName}=" + ${field.propertyName} +
<% } %>
<% } %>
"}"
}
<% } %>
}

View File

@@ -0,0 +1,22 @@
package ${package.Mapper};
import ${package.Entity}.${entity};
import ${superMapperClassPackage};
import org.springframework.stereotype.Repository;
/**
* <p>
* ${table.comment!} Mapper 接口
* </p>
*
* @author ${author}
* @since ${date}
*/
@Repository
<% if(kotlin){ %>
interface ${table.mapperName} : ${superMapperClass}<${entity}>
<% }else{ %>
public interface ${table.mapperName} extends ${superMapperClass}<${entity}> {
}
<% } %>

View File

@@ -0,0 +1,41 @@
<?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="${package.Mapper}.${table.mapperName}">
<% if(enableCache){ %>
<!-- 开启二级缓存 -->
<cache type="org.mybatis.caches.ehcache.LoggingEhcache"/>
<% } %>
<% if(baseResultMap){ %>
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="${package.Entity}.${entity}">
<% for(field in table.fields){ %>
<% /** 生成主键排在第一位 **/ %>
<% if(field.keyFlag){ %>
<id column="${field.name}" property="${field.propertyName}" />
<% } %>
<% } %>
<% for(field in table.commonFields){ %>
<% /** 生成公共字段 **/ %>
<result column="${field.name}" property="${field.propertyName}" />
<% } %>
<% for(field in table.fields){ %>
<% /** 生成普通字段 **/ %>
<% if(!field.keyFlag){ %>
<result column="${field.name}" property="${field.propertyName}" />
<% } %>
<% } %>
</resultMap>
<% } %>
<% if(baseColumnList){ %>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
<% for(field in table.commonFields){ %>
${field.name},
<% } %>
${table.fieldNames}
</sql>
<% } %>
</mapper>

View File

@@ -0,0 +1,20 @@
package ${package.Service};
import ${package.Entity}.${entity};
import ${superServiceClassPackage};
/**
* <p>
* ${table.comment!} 服务类
* </p>
*
* @author ${author}
* @since ${date}
*/
<% if(kotlin){ %>
interface ${table.serviceName} : ${superServiceClass}<${entity}>
<% }else{ %>
public interface ${table.serviceName} extends ${superServiceClass}<${entity}> {
}
<% } %>

View File

@@ -0,0 +1,26 @@
package ${package.ServiceImpl};
import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
import ${package.Service}.${table.serviceName};
import ${superServiceImplClassPackage};
import org.springframework.stereotype.Service;
/**
* <p>
* ${table.comment!} 服务实现类
* </p>
*
* @author ${author}
* @since ${date}
*/
@Service
<% if(kotlin){ %>
open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} {
}
<% }else{ %>
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {
}
<% } %>

View File

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