init
This commit is contained in:
38
.gitignore
vendored
Normal file
38
.gitignore
vendored
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea/modules.xml
|
||||||
|
.idea/jarRepositories.xml
|
||||||
|
.idea/compiler.xml
|
||||||
|
.idea/libraries/
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
### Mac OS ###
|
||||||
|
.DS_Store
|
||||||
8
.idea/.gitignore
generated
vendored
Normal file
8
.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# 默认忽略的文件
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# 基于编辑器的 HTTP 客户端请求
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
17
.idea/dataSources.xml
generated
Normal file
17
.idea/dataSources.xml
generated
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||||
|
<data-source source="LOCAL" name="NBA@110.42.255.182" uuid="989a1610-33a4-4371-ba47-77639ee274e4">
|
||||||
|
<driver-ref>mysql.8</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:mysql://110.42.255.182:3306/NBA</jdbc-url>
|
||||||
|
<jdbc-additional-properties>
|
||||||
|
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||||
|
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||||
|
<property name="com.intellij.clouds.kubernetes.db.container.port" />
|
||||||
|
</jdbc-additional-properties>
|
||||||
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
|
</data-source>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
8
.idea/encodings.xml
generated
Normal file
8
.idea/encodings.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8">
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="PROJECT" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
14
.idea/misc.xml
generated
Normal file
14
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
66
.idea/mybatisx/templates.xml
generated
Normal file
66
.idea/mybatisx/templates.xml
generated
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="TemplatesSettings">
|
||||||
|
<option name="templateConfigs">
|
||||||
|
<TemplateContext>
|
||||||
|
<option name="generateConfig">
|
||||||
|
<GenerateConfig>
|
||||||
|
<option name="annotationType" value="NONE" />
|
||||||
|
<option name="basePackage" value="com.ping.study" />
|
||||||
|
<option name="basePath" value="src/main/java" />
|
||||||
|
<option name="classNameStrategy" value="camel" />
|
||||||
|
<option name="encoding" value="UTF-8" />
|
||||||
|
<option name="extraClassSuffix" value="" />
|
||||||
|
<option name="ignoreFieldPrefix" value="" />
|
||||||
|
<option name="ignoreFieldSuffix" value="" />
|
||||||
|
<option name="ignoreTablePrefix" value="" />
|
||||||
|
<option name="ignoreTableSuffix" value="" />
|
||||||
|
<option name="moduleName" value="NBA" />
|
||||||
|
<option name="modulePath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="moduleUIInfoList">
|
||||||
|
<list>
|
||||||
|
<ModuleInfoGo>
|
||||||
|
<option name="basePath" value="${domain.basePath}" />
|
||||||
|
<option name="configFileName" value="mapperInterface.ftl" />
|
||||||
|
<option name="configName" value="mapperInterface" />
|
||||||
|
<option name="encoding" value="${domain.encoding}" />
|
||||||
|
<option name="fileName" value="${domain.fileName}Mapper" />
|
||||||
|
<option name="fileNameWithSuffix" value="${domain.fileName}Mapper.java" />
|
||||||
|
<option name="modulePath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="packageName" value="${domain.basePackage}.mapper" />
|
||||||
|
</ModuleInfoGo>
|
||||||
|
<ModuleInfoGo>
|
||||||
|
<option name="basePath" value="src/main/resources" />
|
||||||
|
<option name="configFileName" value="mapperXml.ftl" />
|
||||||
|
<option name="configName" value="mapperXml" />
|
||||||
|
<option name="encoding" value="${domain.encoding}" />
|
||||||
|
<option name="fileName" value="${domain.fileName}Mapper" />
|
||||||
|
<option name="fileNameWithSuffix" value="${domain.fileName}Mapper.xml" />
|
||||||
|
<option name="modulePath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="packageName" value="mapper" />
|
||||||
|
</ModuleInfoGo>
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
<option name="needsComment" value="true" />
|
||||||
|
<option name="needsModel" value="true" />
|
||||||
|
<option name="relativePackage" value="pojo" />
|
||||||
|
<option name="superClass" value="" />
|
||||||
|
<option name="tableUIInfoList">
|
||||||
|
<list>
|
||||||
|
<TableUIInfo>
|
||||||
|
<option name="className" value="Urls" />
|
||||||
|
<option name="tableName" value="urls" />
|
||||||
|
</TableUIInfo>
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
<option name="templatesName" value="default-all" />
|
||||||
|
<option name="useLombokPlugin" value="true" />
|
||||||
|
</GenerateConfig>
|
||||||
|
</option>
|
||||||
|
<option name="moduleName" value="NBA" />
|
||||||
|
<option name="projectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="templateName" value="default-all" />
|
||||||
|
</TemplateContext>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
124
.idea/uiDesigner.xml
generated
Normal file
124
.idea/uiDesigner.xml
generated
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Palette2">
|
||||||
|
<group name="Swing">
|
||||||
|
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Button" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="RadioButton" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="CheckBox" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Label" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||||
|
<preferred-size width="-1" height="20" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
</group>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
80
pom.xml
Normal file
80
pom.xml
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>com.ping.study</groupId>
|
||||||
|
<artifactId>NBA</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>3.4.1</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<name>NBA</name>
|
||||||
|
<url>http://maven.apache.org</url>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<version>8.0.33</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
|
<version>3.0.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<version>3.4.1</version> <!-- 使用你的Spring Boot版本 -->
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
22
src/main/java/com/ping/study/App.java
Normal file
22
src/main/java/com/ping/study/App.java
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
package com.ping.study;
|
||||||
|
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hello world!
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@EnableScheduling
|
||||||
|
@SpringBootApplication
|
||||||
|
@MapperScan("com.ping.study.mapper")
|
||||||
|
public class App
|
||||||
|
{
|
||||||
|
public static void main( String[] args )
|
||||||
|
{
|
||||||
|
SpringApplication.run(App.class, args);
|
||||||
|
System.out.println( "Hello World!" );
|
||||||
|
}
|
||||||
|
}
|
||||||
13
src/main/java/com/ping/study/config/GlobalException.java
Normal file
13
src/main/java/com/ping/study/config/GlobalException.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package com.ping.study.config;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||||
|
|
||||||
|
@RestControllerAdvice
|
||||||
|
public class GlobalException {
|
||||||
|
@ExceptionHandler(Exception.class)
|
||||||
|
public Object handleException(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return e.getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
15
src/main/java/com/ping/study/config/WebMvc.java
Normal file
15
src/main/java/com/ping/study/config/WebMvc.java
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package com.ping.study.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.reactive.function.client.WebClient;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class WebMvc implements WebMvcConfigurer {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public WebClient webClient() {
|
||||||
|
return WebClient.create("https://api.nba.cn/sib/v2");
|
||||||
|
}
|
||||||
|
}
|
||||||
64
src/main/java/com/ping/study/controller/NbaController.java
Normal file
64
src/main/java/com/ping/study/controller/NbaController.java
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
package com.ping.study.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.ping.study.model.dto.addUrls;
|
||||||
|
import com.ping.study.pojo.Games;
|
||||||
|
import com.ping.study.service.GamesService;
|
||||||
|
import com.ping.study.service.UrlsService;
|
||||||
|
import com.ping.study.utils.NbaApi;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RequestMapping("/api")
|
||||||
|
@RestController
|
||||||
|
@Data
|
||||||
|
@Slf4j
|
||||||
|
//@CrossOrigin(origins = "http://nba.new9.me")
|
||||||
|
@CrossOrigin
|
||||||
|
public class NbaController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NbaApi nbaApi;
|
||||||
|
@Autowired
|
||||||
|
private GamesService gamesService;
|
||||||
|
@Autowired
|
||||||
|
private UrlsService urlsService;
|
||||||
|
|
||||||
|
//添加定时任务,每日凌晨0点执行一次
|
||||||
|
// 每天 00:00:00 执行
|
||||||
|
@Scheduled(cron = "0 0 0 * * ?")
|
||||||
|
@RequestMapping("/add")
|
||||||
|
public List<Games> addGames() {
|
||||||
|
log.info("执行定时方法添加当天赛程");
|
||||||
|
return nbaApi.addGames();
|
||||||
|
}
|
||||||
|
@RequestMapping("/games")
|
||||||
|
public List<Games> getGames() {
|
||||||
|
log.info("获取所有赛程");
|
||||||
|
return gamesService.getGames();
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/urls")
|
||||||
|
public List<HashMap<String, List<HashMap<String, String>>>> getUrls() {
|
||||||
|
log.info("获取所有赛程直播链接");
|
||||||
|
return urlsService.getUrls();
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/go")
|
||||||
|
public Boolean go(@RequestParam("pwd")String pwd) {
|
||||||
|
return pwd.equals("inspur123");
|
||||||
|
}
|
||||||
|
@RequestMapping(value = "/addUrls",method = RequestMethod.POST)
|
||||||
|
public void addUrls(@RequestBody addUrls addUrls) {
|
||||||
|
log.info("添加所有赛程直播链接");
|
||||||
|
urlsService.addUrls(addUrls);
|
||||||
|
}
|
||||||
|
}
|
||||||
30
src/main/java/com/ping/study/mapper/GamesMapper.java
Normal file
30
src/main/java/com/ping/study/mapper/GamesMapper.java
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
package com.ping.study.mapper;
|
||||||
|
|
||||||
|
import com.ping.study.pojo.Games;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Administrator
|
||||||
|
* @description 针对表【games】的数据库操作Mapper
|
||||||
|
* @createDate 2025-04-17 21:23:08
|
||||||
|
* @Entity com.ping.study.pojo.Games
|
||||||
|
*/
|
||||||
|
public interface GamesMapper {
|
||||||
|
|
||||||
|
int deleteByPrimaryKey(Long id);
|
||||||
|
|
||||||
|
int insert(Games record);
|
||||||
|
|
||||||
|
int insertSelective(Games record);
|
||||||
|
|
||||||
|
Games selectByPrimaryKey(Long id);
|
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(Games record);
|
||||||
|
|
||||||
|
int updateByPrimaryKey(Games record);
|
||||||
|
|
||||||
|
Games selectByGameId(String gameId);
|
||||||
|
|
||||||
|
List<Games> selectAll();
|
||||||
|
}
|
||||||
34
src/main/java/com/ping/study/mapper/UrlsMapper.java
Normal file
34
src/main/java/com/ping/study/mapper/UrlsMapper.java
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
package com.ping.study.mapper;
|
||||||
|
|
||||||
|
import com.ping.study.model.vo.live.LiveUrl;
|
||||||
|
import com.ping.study.pojo.Urls;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Administrator
|
||||||
|
* @description 针对表【urls】的数据库操作Mapper
|
||||||
|
* @createDate 2025-04-18 00:09:37
|
||||||
|
* @Entity com.ping.study.pojo.Urls
|
||||||
|
*/
|
||||||
|
public interface UrlsMapper {
|
||||||
|
|
||||||
|
int deleteByPrimaryKey(Long id);
|
||||||
|
|
||||||
|
int insert(Urls record);
|
||||||
|
|
||||||
|
int insertSelective(Urls record);
|
||||||
|
|
||||||
|
Urls selectByPrimaryKey(Long id);
|
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(Urls record);
|
||||||
|
|
||||||
|
int updateByPrimaryKey(Urls record);
|
||||||
|
List<String> selectGameIds();
|
||||||
|
|
||||||
|
List<HashMap<String, String>> selectUrlsListByGameId(String gameId);
|
||||||
|
|
||||||
|
void insertUrlsWithGameId(@Param("gameId") String gameId, @Param("list") List<LiveUrl> urls);
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.ping.study.model.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class NbaStatsRequestDto {
|
||||||
|
// 默认值字段
|
||||||
|
private final String appKey = "tiKB2tNdncnZFPOi";
|
||||||
|
private final String appVersion = "1.1.0";
|
||||||
|
private final String channel = "NBA";
|
||||||
|
private final String deviceId = "cd4920b68041f06fcc6ea358c85710bd";
|
||||||
|
private final String installId = "1502934360";
|
||||||
|
private final String network = "N/A";
|
||||||
|
private final String osType = "3";
|
||||||
|
private final String osVersion = "1.0.0";
|
||||||
|
private final String sign = "sign_v2";
|
||||||
|
private final String sign2 = "67BB8937A32E512826D59467E803B28CD82E179FCE8B2A470C20AA0BD4AE08DB";
|
||||||
|
|
||||||
|
// 动态字段
|
||||||
|
private final long t = System.currentTimeMillis() / 1000; // 当前时间戳(秒)
|
||||||
|
private final String start = LocalDate.now().format(DateTimeFormatter.ISO_DATE); // 当天日期
|
||||||
|
private final String end = LocalDate.now().format(DateTimeFormatter.ISO_DATE); // 当天日期
|
||||||
|
}
|
||||||
14
src/main/java/com/ping/study/model/dto/addUrls.java
Normal file
14
src/main/java/com/ping/study/model/dto/addUrls.java
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package com.ping.study.model.dto;
|
||||||
|
|
||||||
|
|
||||||
|
import com.ping.study.model.vo.live.LiveUrl;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class addUrls {
|
||||||
|
|
||||||
|
private String gameId;
|
||||||
|
private List<LiveUrl> urls;
|
||||||
|
}
|
||||||
10
src/main/java/com/ping/study/model/vo/ApiResponse.java
Normal file
10
src/main/java/com/ping/study/model/vo/ApiResponse.java
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package com.ping.study.model.vo;
|
||||||
|
import com.ping.study.model.vo.ResponseData;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ApiResponse {
|
||||||
|
private int code;
|
||||||
|
private ResponseData data;
|
||||||
|
private String msg;
|
||||||
|
}
|
||||||
14
src/main/java/com/ping/study/model/vo/Game.java
Normal file
14
src/main/java/com/ping/study/model/vo/Game.java
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package com.ping.study.model.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class Game {
|
||||||
|
private String gameId;
|
||||||
|
private String homeTeamName;
|
||||||
|
private String awayTeamName;
|
||||||
|
private String homeTeamLogoDark;
|
||||||
|
private String awayTeamLogoDark;
|
||||||
|
private String startDate; // 格式:"2025-04-17"
|
||||||
|
private String startTime; // 格式:"07:30:00"
|
||||||
|
}
|
||||||
10
src/main/java/com/ping/study/model/vo/Group.java
Normal file
10
src/main/java/com/ping/study/model/vo/Group.java
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package com.ping.study.model.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class Group {
|
||||||
|
private List<Game> games;
|
||||||
|
}
|
||||||
10
src/main/java/com/ping/study/model/vo/ResponseData.java
Normal file
10
src/main/java/com/ping/study/model/vo/ResponseData.java
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package com.ping.study.model.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ResponseData {
|
||||||
|
private List<Group> groups;
|
||||||
|
}
|
||||||
20
src/main/java/com/ping/study/model/vo/live/LiveUrl.java
Normal file
20
src/main/java/com/ping/study/model/vo/live/LiveUrl.java
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package com.ping.study.model.vo.live;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class LiveUrl {
|
||||||
|
|
||||||
|
// private Integer gameId;
|
||||||
|
private String type;
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
51
src/main/java/com/ping/study/pojo/Games.java
Normal file
51
src/main/java/com/ping/study/pojo/Games.java
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
package com.ping.study.pojo;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @TableName games
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class Games {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String gameId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Date startTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String homeTeamName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String awayTeamName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String homeTeamLogoDark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String awayTeamLogoDark;
|
||||||
|
}
|
||||||
30
src/main/java/com/ping/study/pojo/Urls.java
Normal file
30
src/main/java/com/ping/study/pojo/Urls.java
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
package com.ping.study.pojo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @TableName urls
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class Urls {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String gameId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
}
|
||||||
13
src/main/java/com/ping/study/service/GamesService.java
Normal file
13
src/main/java/com/ping/study/service/GamesService.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package com.ping.study.service;
|
||||||
|
|
||||||
|
import com.ping.study.pojo.Games;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface GamesService {
|
||||||
|
//插入每日比赛数据到数据库
|
||||||
|
void insertGames(Games games);
|
||||||
|
|
||||||
|
//获取当时比赛赛程
|
||||||
|
List<Games> getGames();
|
||||||
|
}
|
||||||
18
src/main/java/com/ping/study/service/UrlsService.java
Normal file
18
src/main/java/com/ping/study/service/UrlsService.java
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
package com.ping.study.service;
|
||||||
|
|
||||||
|
import com.ping.study.model.dto.addUrls;
|
||||||
|
import com.ping.study.model.vo.live.LiveUrl;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public interface UrlsService {
|
||||||
|
|
||||||
|
|
||||||
|
//查询当天的直播地址
|
||||||
|
public List<HashMap<String, List<HashMap<String, String>>>> getUrls();
|
||||||
|
|
||||||
|
//添加直播地址到对应赛事
|
||||||
|
public void addUrls(addUrls addUrls);
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.ping.study.service.impl;
|
||||||
|
|
||||||
|
import com.ping.study.mapper.GamesMapper;
|
||||||
|
import com.ping.study.pojo.Games;
|
||||||
|
import com.ping.study.service.GamesService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class GamesServiceImpl implements GamesService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private GamesMapper gamesMapper;
|
||||||
|
//先查询数据库有没有比赛信息
|
||||||
|
public Games getGames(String gameId) {
|
||||||
|
return gamesMapper.selectByGameId(gameId);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void insertGames(Games games) {
|
||||||
|
if (getGames(games.getGameId())!=null){
|
||||||
|
//抛出异常
|
||||||
|
throw new RuntimeException("该比赛已存在");
|
||||||
|
}
|
||||||
|
gamesMapper.insert(games);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Games> getGames() {
|
||||||
|
|
||||||
|
return gamesMapper.selectAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.ping.study.service.impl;
|
||||||
|
|
||||||
|
import com.ping.study.mapper.UrlsMapper;
|
||||||
|
import com.ping.study.model.dto.addUrls;
|
||||||
|
import com.ping.study.model.vo.live.LiveUrl;
|
||||||
|
import com.ping.study.service.UrlsService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class UrlsServiceImpl implements UrlsService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UrlsMapper urlsMapper;
|
||||||
|
@Override
|
||||||
|
public List<HashMap<String, List<HashMap<String, String>>>> getUrls() {
|
||||||
|
List<HashMap<String,List<HashMap<String, String>>>> urlsList = new ArrayList<>();
|
||||||
|
List<String> gameIds = urlsMapper.selectGameIds();
|
||||||
|
gameIds.forEach(gameId -> {
|
||||||
|
List<HashMap<String, String>> maps = urlsMapper.selectUrlsListByGameId(gameId);
|
||||||
|
HashMap<String, List<HashMap<String, String>>> map = new HashMap<>();
|
||||||
|
map.put(gameId,maps);
|
||||||
|
urlsList.add(map);
|
||||||
|
}); // 添加右括号和分号
|
||||||
|
return urlsList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addUrls(addUrls addUrls) {
|
||||||
|
urlsMapper.insertUrlsWithGameId(addUrls.getGameId(), addUrls.getUrls());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
90
src/main/java/com/ping/study/utils/NbaApi.java
Normal file
90
src/main/java/com/ping/study/utils/NbaApi.java
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
package com.ping.study.utils;
|
||||||
|
|
||||||
|
import com.ping.study.model.dto.NbaStatsRequestDto;
|
||||||
|
import com.ping.study.model.vo.ApiResponse;
|
||||||
|
import com.ping.study.model.vo.Game;
|
||||||
|
import com.ping.study.model.vo.Group;
|
||||||
|
import com.ping.study.pojo.Games;
|
||||||
|
import com.ping.study.service.GamesService;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.reactive.function.client.WebClient;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Data
|
||||||
|
@Slf4j
|
||||||
|
public class NbaApi {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private GamesService gamesService;
|
||||||
|
|
||||||
|
private WebClient webClient;
|
||||||
|
|
||||||
|
public NbaApi(WebClient webClient) {
|
||||||
|
this.webClient = webClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Games> addGames() {
|
||||||
|
// 创建请求DTO(会自动设置当前时间戳和日期)
|
||||||
|
NbaStatsRequestDto requestParams = new NbaStatsRequestDto();
|
||||||
|
log.info("{}", requestParams);
|
||||||
|
log.info("进入{},执行{}", this.getClass().getName(), "getGames");
|
||||||
|
List<Games> gameEntities = webClient.get()
|
||||||
|
.uri("/game/schedule", uriBuilder -> uriBuilder
|
||||||
|
.queryParam("app_key", requestParams.getAppKey())
|
||||||
|
.queryParam("app_version", requestParams.getAppVersion())
|
||||||
|
.queryParam("channel", requestParams.getChannel())
|
||||||
|
.queryParam("device_id", requestParams.getDeviceId())
|
||||||
|
.queryParam("install_id", requestParams.getInstallId())
|
||||||
|
.queryParam("network", requestParams.getNetwork())
|
||||||
|
.queryParam("os_type", requestParams.getOsType())
|
||||||
|
.queryParam("os_version", requestParams.getOsVersion())
|
||||||
|
.queryParam("sign", requestParams.getSign())
|
||||||
|
.queryParam("sign2", requestParams.getSign2())
|
||||||
|
.queryParam("t", requestParams.getT())
|
||||||
|
.queryParam("start", requestParams.getStart())
|
||||||
|
.queryParam("end", requestParams.getEnd())
|
||||||
|
.build())
|
||||||
|
.retrieve()
|
||||||
|
.bodyToMono(ApiResponse.class)
|
||||||
|
.map(response -> {
|
||||||
|
log.info("{}", response);
|
||||||
|
List<Games> entities = new ArrayList<>();
|
||||||
|
// 遍历groups中的games
|
||||||
|
for (Group group : response.getData().getGroups()) {
|
||||||
|
for (Game game : group.getGames()) {
|
||||||
|
Games entity = new Games();
|
||||||
|
entity.setDate(new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
|
||||||
|
entity.setGameId(game.getGameId());
|
||||||
|
entity.setHomeTeamName(game.getHomeTeamName());
|
||||||
|
entity.setAwayTeamName(game.getAwayTeamName());
|
||||||
|
entity.setHomeTeamLogoDark(game.getHomeTeamLogoDark());
|
||||||
|
entity.setAwayTeamLogoDark(game.getAwayTeamLogoDark());
|
||||||
|
|
||||||
|
// 合并日期和时间
|
||||||
|
String dateTimeStr = game.getStartDate() + " " + game.getStartTime();
|
||||||
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
try {
|
||||||
|
entity.setStartTime(format.parse(dateTimeStr));
|
||||||
|
} catch (ParseException e) {
|
||||||
|
// 处理异常或设置默认值
|
||||||
|
entity.setStartTime(null);
|
||||||
|
}
|
||||||
|
gamesService.insertGames(entity);
|
||||||
|
entities.add(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return entities;
|
||||||
|
})
|
||||||
|
.block();
|
||||||
|
return gameEntities;
|
||||||
|
}
|
||||||
|
}
|
||||||
16
src/main/resources/application.yml
Normal file
16
src/main/resources/application.yml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
server:
|
||||||
|
port: 9005
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: NBA
|
||||||
|
datasource:
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
url: jdbc:mysql://110.42.255.182:3306/NBA?useUnicode=true&characterEncoding=utf-8&useSSL=false
|
||||||
|
username: root
|
||||||
|
password: inspur123
|
||||||
|
mybatis:
|
||||||
|
configuration:
|
||||||
|
map-underscore-to-camel-case: true
|
||||||
|
log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
|
||||||
|
type-aliases-package: com.ping.study.pojo
|
||||||
|
mapper-locations: classpath:mapper/*.xml
|
||||||
120
src/main/resources/mapper/GamesMapper.xml
Normal file
120
src/main/resources/mapper/GamesMapper.xml
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
<?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.ping.study.mapper.GamesMapper">
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMap" type="com.ping.study.pojo.Games">
|
||||||
|
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||||
|
<result property="date" column="date" jdbcType="VARCHAR"/>
|
||||||
|
<result property="gameId" column="game_id" jdbcType="VARCHAR"/>
|
||||||
|
<result property="startTime" column="start_time" jdbcType="TIMESTAMP"/>
|
||||||
|
<result property="homeTeamName" column="home_team_name" jdbcType="VARCHAR"/>
|
||||||
|
<result property="awayTeamName" column="away_team_name" jdbcType="VARCHAR"/>
|
||||||
|
<result property="homeTeamLogoDark" column="home_team_logo_dark" jdbcType="VARCHAR"/>
|
||||||
|
<result property="awayTeamLogoDark" column="away_team_logo_dark" jdbcType="VARCHAR"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id,date,game_id,
|
||||||
|
start_time,home_team_name,away_team_name,
|
||||||
|
home_team_logo_dark,away_team_logo_dark
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from games
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||||
|
delete from games
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</delete>
|
||||||
|
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.ping.study.pojo.Games" useGeneratedKeys="true">
|
||||||
|
insert into games
|
||||||
|
( id,date,game_id
|
||||||
|
,start_time,home_team_name,away_team_name
|
||||||
|
,home_team_logo_dark,away_team_logo_dark)
|
||||||
|
values (#{id,jdbcType=INTEGER},#{date,jdbcType=VARCHAR},#{gameId,jdbcType=VARCHAR}
|
||||||
|
,#{startTime,jdbcType=TIMESTAMP},#{homeTeamName,jdbcType=VARCHAR},#{awayTeamName,jdbcType=VARCHAR}
|
||||||
|
,#{homeTeamLogoDark,jdbcType=VARCHAR},#{awayTeamLogoDark,jdbcType=VARCHAR})
|
||||||
|
</insert>
|
||||||
|
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.ping.study.pojo.Games" useGeneratedKeys="true">
|
||||||
|
insert into games
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">id,</if>
|
||||||
|
<if test="date != null">date,</if>
|
||||||
|
<if test="gameId != null">game_id,</if>
|
||||||
|
<if test="startTime != null">start_time,</if>
|
||||||
|
<if test="homeTeamName != null">home_team_name,</if>
|
||||||
|
<if test="awayTeamName != null">away_team_name,</if>
|
||||||
|
<if test="homeTeamLogoDark != null">home_team_logo_dark,</if>
|
||||||
|
<if test="awayTeamLogoDark != null">away_team_logo_dark,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">#{id,jdbcType=INTEGER},</if>
|
||||||
|
<if test="date != null">#{date,jdbcType=VARCHAR},</if>
|
||||||
|
<if test="gameId != null">#{gameId,jdbcType=VARCHAR},</if>
|
||||||
|
<if test="startTime != null">#{startTime,jdbcType=TIMESTAMP},</if>
|
||||||
|
<if test="homeTeamName != null">#{homeTeamName,jdbcType=VARCHAR},</if>
|
||||||
|
<if test="awayTeamName != null">#{awayTeamName,jdbcType=VARCHAR},</if>
|
||||||
|
<if test="homeTeamLogoDark != null">#{homeTeamLogoDark,jdbcType=VARCHAR},</if>
|
||||||
|
<if test="awayTeamLogoDark != null">#{awayTeamLogoDark,jdbcType=VARCHAR},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<update id="updateByPrimaryKeySelective" parameterType="com.ping.study.pojo.Games">
|
||||||
|
update games
|
||||||
|
<set>
|
||||||
|
<if test="date != null">
|
||||||
|
date = #{date,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="gameId != null">
|
||||||
|
game_id = #{gameId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="startTime != null">
|
||||||
|
start_time = #{startTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="homeTeamName != null">
|
||||||
|
home_team_name = #{homeTeamName,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="awayTeamName != null">
|
||||||
|
away_team_name = #{awayTeamName,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="homeTeamLogoDark != null">
|
||||||
|
home_team_logo_dark = #{homeTeamLogoDark,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="awayTeamLogoDark != null">
|
||||||
|
away_team_logo_dark = #{awayTeamLogoDark,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
<update id="updateByPrimaryKey" parameterType="com.ping.study.pojo.Games">
|
||||||
|
update games
|
||||||
|
set
|
||||||
|
date = #{date,jdbcType=VARCHAR},
|
||||||
|
game_id = #{gameId,jdbcType=VARCHAR},
|
||||||
|
start_time = #{startTime,jdbcType=TIMESTAMP},
|
||||||
|
home_team_name = #{homeTeamName,jdbcType=VARCHAR},
|
||||||
|
away_team_name = #{awayTeamName,jdbcType=VARCHAR},
|
||||||
|
home_team_logo_dark = #{homeTeamLogoDark,jdbcType=VARCHAR},
|
||||||
|
away_team_logo_dark = #{awayTeamLogoDark,jdbcType=VARCHAR}
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="selectByGameId" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from games
|
||||||
|
where game_id = #{gameId,jdbcType=VARCHAR}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAll" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from games
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
91
src/main/resources/mapper/UrlsMapper.xml
Normal file
91
src/main/resources/mapper/UrlsMapper.xml
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
<?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.ping.study.mapper.UrlsMapper">
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMap" type="com.ping.study.pojo.Urls">
|
||||||
|
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||||
|
<result property="gameId" column="game_id" jdbcType="VARCHAR"/>
|
||||||
|
<result property="url" column="url" jdbcType="VARCHAR"/>
|
||||||
|
<result property="type" column="type" jdbcType="VARCHAR"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id,game_id,url,
|
||||||
|
type
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from urls
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||||
|
delete from urls
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</delete>
|
||||||
|
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.ping.study.pojo.Urls" useGeneratedKeys="true">
|
||||||
|
insert into urls
|
||||||
|
( id,game_id,url
|
||||||
|
,type)
|
||||||
|
values (#{id,jdbcType=INTEGER},#{gameId,jdbcType=VARCHAR},#{url,jdbcType=VARCHAR}
|
||||||
|
,#{type,jdbcType=VARCHAR})
|
||||||
|
</insert>
|
||||||
|
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.ping.study.pojo.Urls" useGeneratedKeys="true">
|
||||||
|
insert into urls
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">id,</if>
|
||||||
|
<if test="gameId != null">game_id,</if>
|
||||||
|
<if test="url != null">url,</if>
|
||||||
|
<if test="type != null">type,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">#{id,jdbcType=INTEGER},</if>
|
||||||
|
<if test="gameId != null">#{gameId,jdbcType=VARCHAR},</if>
|
||||||
|
<if test="url != null">#{url,jdbcType=VARCHAR},</if>
|
||||||
|
<if test="type != null">#{type,jdbcType=VARCHAR},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<update id="updateByPrimaryKeySelective" parameterType="com.ping.study.pojo.Urls">
|
||||||
|
update urls
|
||||||
|
<set>
|
||||||
|
<if test="gameId != null">
|
||||||
|
game_id = #{gameId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="url != null">
|
||||||
|
url = #{url,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="type != null">
|
||||||
|
type = #{type,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
<update id="updateByPrimaryKey" parameterType="com.ping.study.pojo.Urls">
|
||||||
|
update urls
|
||||||
|
set
|
||||||
|
game_id = #{gameId,jdbcType=VARCHAR},
|
||||||
|
url = #{url,jdbcType=VARCHAR},
|
||||||
|
type = #{type,jdbcType=VARCHAR}
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
<select id="selectGameIds" resultType="java.lang.String">
|
||||||
|
select distinct game_id from urls
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectUrlsListByGameId" resultType="map">
|
||||||
|
select urls.type,urls.url from urls where game_id = #{gameId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertUrlsWithGameId">
|
||||||
|
insert into urls
|
||||||
|
(game_id, url, type)
|
||||||
|
values
|
||||||
|
<foreach collection="list" item="item" separator=",">
|
||||||
|
(#{gameId}, #{item.url}, #{item.type})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
</mapper>
|
||||||
38
src/test/java/com/ping/study/AppTest.java
Normal file
38
src/test/java/com/ping/study/AppTest.java
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
package com.ping.study;
|
||||||
|
|
||||||
|
import junit.framework.Test;
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test for simple App.
|
||||||
|
*/
|
||||||
|
public class AppTest
|
||||||
|
extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Create the test case
|
||||||
|
*
|
||||||
|
* @param testName name of the test case
|
||||||
|
*/
|
||||||
|
public AppTest( String testName )
|
||||||
|
{
|
||||||
|
super( testName );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the suite of tests being tested
|
||||||
|
*/
|
||||||
|
public static Test suite()
|
||||||
|
{
|
||||||
|
return new TestSuite( AppTest.class );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rigourous Test :-)
|
||||||
|
*/
|
||||||
|
public void testApp()
|
||||||
|
{
|
||||||
|
assertTrue( true );
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user