Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataWareHose
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
黄夏豪
dataWareHose
Commits
810ec6ba
提交
810ec6ba
authored
6月 28, 2021
作者:
ww1xhqc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[数据模型] 修改整合
上级
bfdd076d
全部展开
显示空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
200 行增加
和
438 行删除
+200
-438
MavenWrapperDownloader.java
.mvn/wrapper/MavenWrapperDownloader.java
+0
-118
maven-wrapper.jar
.mvn/wrapper/maven-wrapper.jar
+0
-0
maven-wrapper.properties
.mvn/wrapper/maven-wrapper.properties
+0
-2
HELP.md
HELP.md
+0
-22
mvnw
mvnw
+0
-0
mvnw.cmd
mvnw.cmd
+0
-182
pom.xml
pom.xml
+7
-1
QuoteDao.java
src/main/java/com/tykj/datawarehouse/model/dao/QuoteDao.java
+23
-0
Version.java
...ain/java/com/tykj/datawarehouse/model/entity/Version.java
+0
-41
QuoteService.java
...va/com/tykj/datawarehouse/model/service/QuoteService.java
+35
-0
ModelImpl.java
.../com/tykj/datawarehouse/model/service/impl/ModelImpl.java
+33
-11
QuoteServiceImpl.java
...kj/datawarehouse/model/service/impl/QuoteServiceImpl.java
+83
-0
ClassTypeLength.java
...a/com/tykj/datawarehouse/model/utils/ClassTypeLength.java
+1
-1
CreateTableUtil.java
...a/com/tykj/datawarehouse/model/utils/CreateTableUtil.java
+17
-17
InitAvatar.java
...n/java/com/tykj/datawarehouse/model/utils/InitAvatar.java
+0
-42
application.yml
src/main/resources/application.yml
+1
-1
没有找到文件。
.mvn/wrapper/MavenWrapperDownloader.java
deleted
100644 → 0
浏览文件 @
bfdd076d
/*
* Copyright 2007-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
java.net.*
;
import
java.io.*
;
import
java.nio.channels.*
;
import
java.util.Properties
;
public
class
MavenWrapperDownloader
{
private
static
final
String
WRAPPER_VERSION
=
"0.5.6"
;
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private
static
final
String
DEFAULT_DOWNLOAD_URL
=
"https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+
WRAPPER_VERSION
+
"/maven-wrapper-"
+
WRAPPER_VERSION
+
".jar"
;
/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private
static
final
String
MAVEN_WRAPPER_PROPERTIES_PATH
=
".mvn/wrapper/maven-wrapper.properties"
;
/**
* Path where the maven-wrapper.jar will be saved to.
*/
private
static
final
String
MAVEN_WRAPPER_JAR_PATH
=
".mvn/wrapper/maven-wrapper.jar"
;
/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private
static
final
String
PROPERTY_NAME_WRAPPER_URL
=
"wrapperUrl"
;
public
static
void
main
(
String
args
[])
{
System
.
out
.
println
(
"- Downloader started"
);
File
baseDirectory
=
new
File
(
args
[
0
]);
System
.
out
.
println
(
"- Using base directory: "
+
baseDirectory
.
getAbsolutePath
());
// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File
mavenWrapperPropertyFile
=
new
File
(
baseDirectory
,
MAVEN_WRAPPER_PROPERTIES_PATH
);
String
url
=
DEFAULT_DOWNLOAD_URL
;
if
(
mavenWrapperPropertyFile
.
exists
())
{
FileInputStream
mavenWrapperPropertyFileInputStream
=
null
;
try
{
mavenWrapperPropertyFileInputStream
=
new
FileInputStream
(
mavenWrapperPropertyFile
);
Properties
mavenWrapperProperties
=
new
Properties
();
mavenWrapperProperties
.
load
(
mavenWrapperPropertyFileInputStream
);
url
=
mavenWrapperProperties
.
getProperty
(
PROPERTY_NAME_WRAPPER_URL
,
url
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
"- ERROR loading '"
+
MAVEN_WRAPPER_PROPERTIES_PATH
+
"'"
);
}
finally
{
try
{
if
(
mavenWrapperPropertyFileInputStream
!=
null
)
{
mavenWrapperPropertyFileInputStream
.
close
();
}
}
catch
(
IOException
e
)
{
// Ignore ...
}
}
}
System
.
out
.
println
(
"- Downloading from: "
+
url
);
File
outputFile
=
new
File
(
baseDirectory
.
getAbsolutePath
(),
MAVEN_WRAPPER_JAR_PATH
);
if
(!
outputFile
.
getParentFile
().
exists
())
{
if
(!
outputFile
.
getParentFile
().
mkdirs
())
{
System
.
out
.
println
(
"- ERROR creating output directory '"
+
outputFile
.
getParentFile
().
getAbsolutePath
()
+
"'"
);
}
}
System
.
out
.
println
(
"- Downloading to: "
+
outputFile
.
getAbsolutePath
());
try
{
downloadFileFromURL
(
url
,
outputFile
);
System
.
out
.
println
(
"Done"
);
System
.
exit
(
0
);
}
catch
(
Throwable
e
)
{
System
.
out
.
println
(
"- Error downloading"
);
e
.
printStackTrace
();
System
.
exit
(
1
);
}
}
private
static
void
downloadFileFromURL
(
String
urlString
,
File
destination
)
throws
Exception
{
if
(
System
.
getenv
(
"MVNW_USERNAME"
)
!=
null
&&
System
.
getenv
(
"MVNW_PASSWORD"
)
!=
null
)
{
String
username
=
System
.
getenv
(
"MVNW_USERNAME"
);
char
[]
password
=
System
.
getenv
(
"MVNW_PASSWORD"
).
toCharArray
();
Authenticator
.
setDefault
(
new
Authenticator
()
{
@Override
protected
PasswordAuthentication
getPasswordAuthentication
()
{
return
new
PasswordAuthentication
(
username
,
password
);
}
});
}
URL
website
=
new
URL
(
urlString
);
ReadableByteChannel
rbc
;
rbc
=
Channels
.
newChannel
(
website
.
openStream
());
FileOutputStream
fos
=
new
FileOutputStream
(
destination
);
fos
.
getChannel
().
transferFrom
(
rbc
,
0
,
Long
.
MAX_VALUE
);
fos
.
close
();
rbc
.
close
();
}
}
.mvn/wrapper/maven-wrapper.jar
deleted
100644 → 0
浏览文件 @
bfdd076d
File deleted
.mvn/wrapper/maven-wrapper.properties
deleted
100644 → 0
浏览文件 @
bfdd076d
distributionUrl
=
https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip
wrapperUrl
=
https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
HELP.md
deleted
100644 → 0
浏览文件 @
bfdd076d
# Getting Started
### Reference Documentation
For further reference, please consider the following sections:
*
[
Official Apache Maven documentation
](
https://maven.apache.org/guides/index.html
)
*
[
Spring Boot Maven Plugin Reference Guide
](
https://docs.spring.io/spring-boot/docs/2.5.2/maven-plugin/reference/html/
)
*
[
Create an OCI image
](
https://docs.spring.io/spring-boot/docs/2.5.2/maven-plugin/reference/html/#build-image
)
*
[
Spring Web
](
https://docs.spring.io/spring-boot/docs/2.5.2/reference/htmlsingle/#boot-features-developing-web-applications
)
*
[
Spring Data JPA
](
https://docs.spring.io/spring-boot/docs/2.5.2/reference/htmlsingle/#boot-features-jpa-and-spring-data
)
### Guides
The following guides illustrate how to use some features concretely:
*
[
Building a RESTful Web Service
](
https://spring.io/guides/gs/rest-service/
)
*
[
Serving Web Content with Spring MVC
](
https://spring.io/guides/gs/serving-web-content/
)
*
[
Building REST services with Spring
](
https://spring.io/guides/tutorials/bookmarks/
)
*
[
Accessing Data with JPA
](
https://spring.io/guides/gs/accessing-data-jpa/
)
*
[
Accessing data with MySQL
](
https://spring.io/guides/gs/accessing-data-mysql/
)
mvnw
deleted
100644 → 0
浏览文件 @
bfdd076d
差异被折叠。
点击展开。
mvnw.cmd
deleted
100644 → 0
浏览文件 @
bfdd076d
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM https://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %DOWNLOAD_URL%
)
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM End of extension
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
exit /B %ERROR_CODE%
pom.xml
浏览文件 @
810ec6ba
...
...
@@ -57,11 +57,17 @@
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
<version>
2.8.0
</version>
<exclusions>
<exclusion>
<artifactId>
javassist
</artifactId>
<groupId>
org.javassist
</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-core
</artifactId>
<version>
2.1
1.4
</version>
<version>
2.1
2.3
</version>
</dependency>
<dependency>
<groupId>
io.springfox
</groupId>
...
...
src/main/java/com/tykj/datawarehouse/model/dao/QuoteDao.java
0 → 100644
浏览文件 @
810ec6ba
package
com
.
tykj
.
datawarehouse
.
model
.
dao
;
import
com.tykj.datawarehouse.model.entity.Quote
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
java.util.List
;
/**
* @Description TODO
* @Author WWW
* @Date 2021/5/17 15:23
*/
public
interface
QuoteDao
extends
JpaRepository
<
Quote
,
Integer
>,
JpaSpecificationExecutor
<
Quote
>
{
/**
* 根据Columnid查询全部
* @param id
* @return
*/
List
<
Quote
>
findAllByColumnId
(
Integer
id
);
}
src/main/java/com/tykj/datawarehouse/model/entity/Version.java
deleted
100644 → 0
浏览文件 @
bfdd076d
package
com
.
tykj
.
datawarehouse
.
model
.
entity
;
import
com.tykj.datawarehouse.base.entity.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
javax.persistence.Entity
;
import
javax.persistence.Table
;
/**
* @Description TODO
* @Author WWW
* @Date 2021/5/19 13:07
*/
@Entity
@Table
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
(
"版本控制表"
)
public
class
Version
extends
BaseEntity
{
@ApiModelProperty
(
"版本号"
)
private
String
versionId
;
@ApiModelProperty
(
"描述"
)
private
String
versionDesc
;
@ApiModelProperty
(
"描述"
)
private
String
ids
;
@ApiModelProperty
(
"对应数据表"
)
private
Integer
dbId
;
@ApiModelProperty
(
"是否当前版本 0为否 1为是"
)
private
Integer
currentVersionFlag
;
}
src/main/java/com/tykj/datawarehouse/model/service/QuoteService.java
0 → 100644
浏览文件 @
810ec6ba
package
com
.
tykj
.
datawarehouse
.
model
.
service
;
import
com.tykj.datawarehouse.model.entity.Quote
;
import
com.tykj.datawarehouse.model.entity.vo.SearchQuoteVO
;
import
com.tykj.datawarehouse.model.entity.vo.UpdateQuoteVO
;
import
java.util.List
;
/**
* @Description TODO
* @Author WWW
* @Date 2021/5/17 15:58
*/
public
interface
QuoteService
{
/**
* 更新quote
* @param updateQuoteVO
*/
List
<
Quote
>
updateQuote
(
UpdateQuoteVO
updateQuoteVO
);
/**
* 条件查询引用
* @param searchQuoteVO
* @return
*/
List
<
Quote
>
getAllQuote
(
SearchQuoteVO
searchQuoteVO
);
Quote
saveQuote
(
Quote
quote
);
Integer
delQuote
(
Integer
id
);
}
src/main/java/com/tykj/datawarehouse/model/service/impl/ModelImpl.java
浏览文件 @
810ec6ba
...
...
@@ -4,8 +4,10 @@ import com.github.wenhao.jpa.PredicateBuilder;
import
com.github.wenhao.jpa.Specifications
;
import
com.tykj.datawarehouse.base.result.ApiException
;
import
com.tykj.datawarehouse.model.dao.ColumnInfoDao
;
import
com.tykj.datawarehouse.model.dao.QuoteDao
;
import
com.tykj.datawarehouse.model.dao.TableInfoDao
;
import
com.tykj.datawarehouse.model.entity.ColumnInfo
;
import
com.tykj.datawarehouse.model.entity.Quote
;
import
com.tykj.datawarehouse.model.entity.TableInfo
;
import
com.tykj.datawarehouse.model.entity.customEnums.ConnectionType
;
import
com.tykj.datawarehouse.model.entity.vo.*
;
...
...
@@ -68,6 +70,9 @@ public class ModelImpl implements ModelService {
@Autowired
private
Environment
env
;
@Autowired
private
QuoteDao
quoteDao
;
/**
* @param
* @return java.util.List<com.tykj.workflowcore.model_layer.model.TableInfo>
...
...
@@ -123,7 +128,7 @@ public class ModelImpl implements ModelService {
* @Date 16:16 2021/3/5
**/
@Override
@Transactional
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
TableInfo
newTable
(
TableVO
tableVO
)
{
String
xmlMapping
=
createTable
(
tableVO
);
// 表名判重
...
...
@@ -154,6 +159,16 @@ public class ModelImpl implements ModelService {
,
tableInfo
.
getId
()
,
columnVO
.
getDescription
());
ColumnInfo
save
=
columnInfoDao
.
save
(
columnInfo
);
/***/
List
<
Quote
>
quoteList
=
columnVO
.
getQuoteList
();
if
(
quoteList
!=
null
)
{
for
(
Quote
quote
:
quoteList
)
{
if
(
isNotEmpty
(
quote
.
getValue
()))
{
quote
.
setColumnId
(
save
.
getId
());
quoteDao
.
save
(
quote
);
}
}
}
}
//关闭会话
return
tableInfo
;
...
...
@@ -265,9 +280,13 @@ public class ModelImpl implements ModelService {
public
List
<
Map
<
String
,
Object
>>
findAllByName
(
String
name
)
{
if
(
name
!=
null
&&
name
!=
""
)
{
String
sql
=
"select * from "
+
name
;
try
{
return
jdbcTemplate
.
queryForList
(
sql
);
}
catch
(
Exception
e
)
{
throw
new
ApiException
(
"查询SQL语句错误!"
);
}
return
null
;
}
return
new
ArrayList
<>();
}
@Override
...
...
@@ -325,7 +344,7 @@ public class ModelImpl implements ModelService {
}
@Override
@Transactional
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
int
updateTable
(
UpdateTableInfoVO
updateTableInfoVO
)
{
//tableInfo和columnInfo变化
//查询到TableInfo和ColumnInfo
...
...
@@ -416,17 +435,17 @@ public class ModelImpl implements ModelService {
.
findAny
()
.
orElse
(
null
);
if
(
isNull
(
originColumnInfo
))
{
String
sql
=
SqlUtil
.
addColumn
(
table
,
columnInfo
.
getFieldName
(),
columnInfo
.
getFieldType
(),
columnInfo
.
getFieldLength
(),
sqlTypeMap
);
String
sql
=
SqlUtil
.
addColumn
(
table
,
columnInfo
.
getFieldName
(),
columnInfo
.
getFieldType
(),
columnInfo
.
getFieldLength
(),
sqlTypeMap
);
result
.
add
(
sql
);
}
else
{
//判断 originColumnInfo 和 columnInfo 是否存在不一样的地方
if
(!
columnInfo
.
getFieldType
().
equals
(
originColumnInfo
.
getFieldType
())
||
!
columnInfo
.
getFieldLength
().
equals
(
originColumnInfo
.
getFieldLength
())
){
String
sql
=
SqlUtil
.
updateColumnType
(
table
,
originColumnInfo
.
getFieldName
(),
columnInfo
.
getFieldName
(),
columnInfo
.
getFieldType
(),
columnInfo
.
getFieldLength
(),
driverType
,
sqlTypeMap
);
)
{
String
sql
=
SqlUtil
.
updateColumnType
(
table
,
originColumnInfo
.
getFieldName
(),
columnInfo
.
getFieldName
(),
columnInfo
.
getFieldType
(),
columnInfo
.
getFieldLength
(),
driverType
,
sqlTypeMap
);
result
.
add
(
sql
);
}
if
(!
columnInfo
.
getFieldName
().
equals
(
originColumnInfo
.
getFieldName
())){
if
(!
columnInfo
.
getFieldName
().
equals
(
originColumnInfo
.
getFieldName
()))
{
String
sql
=
SqlUtil
.
updateColumnName
(
table
,
originColumnInfo
.
getFieldName
(),
columnInfo
.
getFieldName
());
result
.
add
(
sql
);
}
...
...
@@ -495,10 +514,14 @@ public class ModelImpl implements ModelService {
throw
new
ApiException
(
"此id已经被删除!"
);
}
else
{
TableInfo
tableInfo
=
byId
.
get
();
try
{
tableInfoDao
.
deleteById
(
delTableVO
.
getId
());
List
<
ColumnInfo
>
allByDbId
=
columnInfoDao
.
findAllByDbId
(
delTableVO
.
getId
());
columnInfoDao
.
deleteInBatch
(
allByDbId
);
jdbcTemplate
.
execute
(
"drop table "
+
tableInfo
.
getModelName
());
}
catch
(
Exception
e
)
{
throw
new
ApiException
(
"删除是出现错误!"
);
}
return
1
;
}
}
...
...
@@ -536,14 +559,13 @@ public class ModelImpl implements ModelService {
if
(
propertyType
instanceof
TimestampType
)
{
if
(
value
instanceof
String
)
{
if
(
StringUtils
.
isNotEmpty
((
String
)
value
))
{
try
{
try
{
Date
parse
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
).
parse
((
String
)
value
);
map
.
put
(
propertyName
,
parse
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
)
{
throw
new
ApiException
(
"时间格式输入错误,时间格式请参照=>\"yyyy-MM-dd HH:mm:ss"
);
}
}
else
{
}
else
{
map
.
put
(
propertyName
,
null
);
}
}
...
...
src/main/java/com/tykj/datawarehouse/model/service/impl/QuoteServiceImpl.java
0 → 100644
浏览文件 @
810ec6ba
package
com
.
tykj
.
datawarehouse
.
model
.
service
.
impl
;
import
com.github.wenhao.jpa.PredicateBuilder
;
import
com.github.wenhao.jpa.Specifications
;
import
com.tykj.datawarehouse.base.result.ApiException
;
import
com.tykj.datawarehouse.model.dao.QuoteDao
;
import
com.tykj.datawarehouse.model.entity.Quote
;
import
com.tykj.datawarehouse.model.entity.vo.SearchQuoteVO
;
import
com.tykj.datawarehouse.model.entity.vo.UpdateQuoteVO
;
import
com.tykj.datawarehouse.model.service.QuoteService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* @Description TODO
* @Author WWW
* @Date 2021/5/17 15:59
*/
@Service
public
class
QuoteServiceImpl
implements
QuoteService
{
@Autowired
private
QuoteDao
quoteDao
;
@Override
public
List
<
Quote
>
updateQuote
(
UpdateQuoteVO
updateQuoteVO
)
{
List
<
Quote
>
quoteList
=
updateQuoteVO
.
getQuoteList
();
for
(
Quote
quote
:
quoteList
)
{
quote
.
setColumnId
(
updateQuoteVO
.
getId
());
quoteDao
.
save
(
quote
);
}
return
new
ArrayList
<>();
}
@Override
public
List
<
Quote
>
getAllQuote
(
SearchQuoteVO
searchQuoteVO
)
{
PredicateBuilder
<
Quote
>
and
=
Specifications
.
and
();
if
(
searchQuoteVO
!=
null
){
and
.
like
(
searchQuoteVO
.
getValue
()
!=
null
&&
StringUtils
.
isNotEmpty
(
searchQuoteVO
.
getValue
()),
"value"
,
"%"
+
searchQuoteVO
.
getValue
()
+
"%"
);
and
.
in
(
searchQuoteVO
.
getColumnIds
()!=
null
&&
searchQuoteVO
.
getColumnIds
().
length
>
0
,
"columnId"
,
searchQuoteVO
.
getColumnIds
());
and
.
in
(
searchQuoteVO
.
getValues
()!=
null
&&
searchQuoteVO
.
getValues
().
length
>
0
,
"value"
,
searchQuoteVO
.
getValues
());
}
return
quoteDao
.
findAll
(
and
.
build
());
}
@Override
public
Quote
saveQuote
(
Quote
quote
)
{
if
(
existValue
(
quote
.
getColumnId
(),
quote
.
getValue
()))
{
return
quoteDao
.
save
(
quote
);
}
throw
new
ApiException
(
"插入错误!"
);
}
@Override
public
Integer
delQuote
(
Integer
id
)
{
quoteDao
.
deleteById
(
id
);
return
1
;
}
public
boolean
existValue
(
Integer
cId
,
String
value
)
{
List
<
String
>
collect
=
quoteDao
.
findAllByColumnId
(
cId
)
.
stream
()
.
map
(
Quote:
:
getValue
)
.
collect
(
Collectors
.
toList
());
if
(
collect
.
contains
(
value
))
{
return
true
;
}
return
false
;
}
}
src/main/java/com/tykj/datawarehouse/model/utils/ClassTypeLength.java
浏览文件 @
810ec6ba
...
...
@@ -18,7 +18,7 @@ public class ClassTypeLength {
int
length
;
if
(
STRING
.
equals
(
genericType
))
{
length
=
1
55
;
length
=
2
55
;
}
else
if
(
Integer
.
equals
(
genericType
))
{
length
=
11
;
}
else
if
(
Double
.
equals
(
genericType
))
{
...
...
src/main/java/com/tykj/datawarehouse/model/utils/CreateTableUtil.java
浏览文件 @
810ec6ba
package
com
.
tykj
.
datawarehouse
.
model
.
utils
;
import
com.tykj.datawarehouse.base.result.ApiException
;
import
com.tykj.datawarehouse.model.entity.vo.ColumnVO
;
import
com.tykj.datawarehouse.model.entity.vo.TableVO
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.Map
;
/**
...
...
@@ -43,8 +42,8 @@ public class CreateTableUtil {
TYPE_MAP
.
put
(
"java.sql.Timestamp"
,
"java.sql.Timestamp"
);
TYPE_MAP
.
put
(
"java.sql.Clob"
,
"java.sql.Clob"
);
TYPE_MAP
.
put
(
"java.sql.Blob"
,
"java.sql.Blob"
);
TYPE_MAP
.
put
(
"java.lang.Object"
,
"java.lang.String"
);
TYPE_MAP
.
put
(
"java.util.Map"
,
"java.lang.String"
);
TYPE_MAP
.
put
(
"java.lang.Object"
,
"java.lang.String"
);
TYPE_MAP
.
put
(
"java.util.Map"
,
"java.lang.String"
);
}
...
...
@@ -60,17 +59,21 @@ public class CreateTableUtil {
" <class entity-name=\""
+
tableVO
.
getModelName
()
+
"\" table=\""
+
tableVO
.
getModelName
()
+
"\">\n"
;
xmlMapping
+=
" <id name=\"id\" type=\"java.lang.Integer\" length=\"11\" unsaved-value=\"null\" >\n"
+
" <generator class=\"com.tykj.base.entity.XMQGenerator\" />"
+
" <generator class=\"com.tykj.base.entity.XMQGenerator\" />"
+
" </id>"
;
for
(
ColumnVO
columnVO
:
dataList
)
{
try
{
xmlMapping
+=
"\n <property type=\""
+
columnVO
.
getFieldType
()
+
"\" name=\""
+
columnVO
.
getFieldNam
e
()
+
"\" length=\""
+
columnVO
.
getFieldLength
()
+
"\" column=\""
+
columnVO
.
getFieldNam
e
()
+
"\"/>\n"
;
"\n <property type=\""
+
columnVO
.
getFieldType
()
+
"\" name=\""
+
columnVO
.
getFieldName
().
toUpperCas
e
()
+
"\" length=\""
+
columnVO
.
getFieldLength
()
+
"\" column=\""
+
columnVO
.
getFieldName
().
toUpperCas
e
()
+
"\"/>\n"
;
}
catch
(
Exception
e
){
throw
new
ApiException
(
"列名转为大写错误"
);
}
}
// xmlMapping+=" <property name =\"CREATE_TIME\" type =\"calendar\" generated=\"always\" insert=\"false\" update=\"false\" access=\"field\" >" +
// "<column name=\"CREATE_TIME\" not-null=\"true\" default=\"CURRENT_TIMESTAMP\" />\n"+
// "</property> " ;
...
...
@@ -78,8 +81,8 @@ public class CreateTableUtil {
// xmlMapping+=" <property name =\"UPDATE_TIME\" type =\"calendar\" generated=\"always\" insert=\"false\" update=\"false\" access=\"field\" >" +
// "<column name=\"UPDATE_TIME\" not-null=\"true\" default=\"CURRENT_TIMESTAMP\" />\n"+
// "</property> " ;
;
xmlMapping
+=
" <property name = \"CREATE_TIME\" type =\"calendar\" generated=\"always\" > \n"
+
;
xmlMapping
+=
" <property name = \"CREATE_TIME\" type =\"calendar\" generated=\"always\" > \n"
+
" <column name = \"CREATE_TIME\" default = \"CURRENT_TIMESTAMP\" /> \n"
+
" </property> \n"
+
" <property name = \"UPDATE_TIME\" type =\"calendar\" > \n"
+
...
...
@@ -91,8 +94,7 @@ public class CreateTableUtil {
}
public
static
String
createTable
(
String
entityName
,
ColumnVO
primaryColumn
,
List
<
ColumnVO
>
dataList
)
{
public
static
String
createTable
(
String
entityName
,
ColumnVO
primaryColumn
,
List
<
ColumnVO
>
dataList
)
{
// 1sql-type="text" string 转为text文本,2长度超过会自动转换
// List<ColumnVO> dataList = tableVO.getDataList();
String
xmlMapping
=
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+
...
...
@@ -102,7 +104,7 @@ public class CreateTableUtil {
"<hibernate-mapping>\n"
+
" <class entity-name=\""
+
entityName
+
"\" table=\""
+
entityName
+
"\">\n"
;
xmlMapping
+=
" <id name=\""
+
primaryColumn
.
getFieldName
()+
"\" type=\""
+
primaryColumn
.
getFieldType
()+
"\" unsaved-value=\"null\" >\n"
+
xmlMapping
+=
" <id name=\""
+
primaryColumn
.
getFieldName
()
+
"\" type=\""
+
primaryColumn
.
getFieldType
()
+
"\" unsaved-value=\"null\" >\n"
+
" </id>"
;
...
...
@@ -117,7 +119,7 @@ public class CreateTableUtil {
"\" column=\""
+
columnVO
.
getFieldName
()
+
"\"/>\n"
;
}
xmlMapping
+=
" <property name=\"createTime\" column=\"CREATETIME\" type=\"calendar\" insert=\"false\" \n"
+
xmlMapping
+=
" <property name=\"createTime\" column=\"CREATETIME\" type=\"calendar\" insert=\"false\" \n"
+
" update=\"false\" access=\"field\" generated=\"always\" default=\"CURRENT_TIMESTAMP\"/> \n"
+
" <property name=\"updateTime\" column=\"UPDATETIME\" type=\"calendar\" insert=\"false\" \n"
+
" update=\"false\" access=\"field\" generated=\"always\" default=\"CURRENT_TIMESTAMP\" /> "
;
...
...
@@ -127,8 +129,6 @@ public class CreateTableUtil {
}
public
static
String
getClassName
(
String
aClass
)
{
int
i
=
aClass
.
lastIndexOf
(
"."
);
String
substring
=
aClass
.
substring
(
i
+
1
);
...
...
src/main/java/com/tykj/datawarehouse/model/utils/InitAvatar.java
deleted
100644 → 0
浏览文件 @
bfdd076d
package
com
.
tykj
.
datawarehouse
.
model
.
utils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.stereotype.Component
;
/**
* @Description TODO
* @Author WWW
* @Date 2021/6/9 11:24
*/
@Slf4j
@Component
public
class
InitAvatar
implements
CommandLineRunner
{
@Value
(
"${spring.datasource.driver-class-name}"
)
private
String
driverName
;
@Override
public
void
run
(
String
...
args
)
{
// if (Objects.equal(driverName,"com.mysql.cj.jdbc.Driver")
// ||Objects.equal(driverName,"com.mysql.jdbc.Driver")){
// //do nothing
// }
// if (Objects.equal(driverName,"com.oscar.Driver")){
// //先删除
// avatarDao.deleteAll();
// }
// List<Integer> collect = avatarDao.findAll().stream().map(Avatar::getId).collect(Collectors.toList());
// if (collect.containsAll(Arrays.asList(1, 2, 3, 4))) {
// return;
// }
// for (int i = 1; i < 5; i++) {
// AvatarVO avatarVO = new AvatarVO();
// avatarVO.setId(i);
// avatarVO.setLocation(i);
// avatarService.updateAvatar(avatarVO);
// }
}
}
src/main/resources/application.yml
浏览文件 @
810ec6ba
...
...
@@ -5,7 +5,7 @@ spring:
datasource
:
username
:
punish
password
:
123456
url
:
jdbc:oscar://192.168.1
.11
0:2003/OSRDB
url
:
jdbc:oscar://192.168.1
02.20
0:2003/OSRDB
driver-class-name
:
com.oscar.Driver
hikari
:
read-only
:
false
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论