Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataWareHose
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
黄夏豪
dataWareHose
Commits
16572591
提交
16572591
authored
7月 01, 2021
作者:
ww1xhqc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[数据模型] 引用和规则接口
上级
aa84c38c
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
66 行增加
和
58 行删除
+66
-58
ModelController.java
.../tykj/datawarehouse/model/controller/ModelController.java
+25
-6
QuoteController.java
.../tykj/datawarehouse/model/controller/QuoteController.java
+5
-10
RuleController.java
...m/tykj/datawarehouse/model/controller/RuleController.java
+9
-8
RuleDao.java
src/main/java/com/tykj/datawarehouse/model/dao/RuleDao.java
+1
-1
ColumnInfo.java
.../java/com/tykj/datawarehouse/model/entity/ColumnInfo.java
+5
-0
ColumnVO.java
...java/com/tykj/datawarehouse/model/entity/vo/ColumnVO.java
+4
-0
ModelService.java
...va/com/tykj/datawarehouse/model/service/ModelService.java
+1
-2
ModelImpl.java
.../com/tykj/datawarehouse/model/service/impl/ModelImpl.java
+13
-12
CreateTableUtil.java
...a/com/tykj/datawarehouse/model/utils/CreateTableUtil.java
+1
-12
SessionUtil.java
.../java/com/tykj/datawarehouse/model/utils/SessionUtil.java
+0
-1
DataTestApplicationTests.java
...java/com/tykj/datawarehouse/DataTestApplicationTests.java
+2
-6
没有找到文件。
src/main/java/com/tykj/datawarehouse/model/controller/ModelController.java
浏览文件 @
16572591
package
com
.
tykj
.
datawarehouse
.
model
.
controller
;
package
com
.
tykj
.
datawarehouse
.
model
.
controller
;
import
com.tykj.datawarehouse.base.result.ApiException
;
import
com.tykj.datawarehouse.base.result.ResultUtil
;
import
com.tykj.datawarehouse.base.result.ResultUtil
;
import
com.tykj.datawarehouse.model.dao.QuoteDao
;
import
com.tykj.datawarehouse.model.dao.RuleDao
;
import
com.tykj.datawarehouse.model.entity.ColumnInfo
;
import
com.tykj.datawarehouse.model.entity.ColumnInfo
;
import
com.tykj.datawarehouse.model.entity.Quote
;
import
com.tykj.datawarehouse.model.entity.Rule
;
import
com.tykj.datawarehouse.model.entity.TableInfo
;
import
com.tykj.datawarehouse.model.entity.TableInfo
;
import
com.tykj.datawarehouse.model.entity.vo.*
;
import
com.tykj.datawarehouse.model.entity.vo.*
;
import
com.tykj.datawarehouse.model.service.ModelService
;
import
com.tykj.datawarehouse.model.service.ModelService
;
...
@@ -17,9 +22,7 @@ import org.springframework.http.ResponseEntity;
...
@@ -17,9 +22,7 @@ import org.springframework.http.ResponseEntity;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -41,6 +44,10 @@ public class ModelController {
...
@@ -41,6 +44,10 @@ public class ModelController {
@Autowired
@Autowired
private
ModelHelper
modelHelper
;
private
ModelHelper
modelHelper
;
@Autowired
private
QuoteDao
quoteDao
;
@Autowired
private
RuleDao
ruleDao
;
/**
/**
* @param
* @param
...
@@ -68,6 +75,18 @@ public class ModelController {
...
@@ -68,6 +75,18 @@ public class ModelController {
@PostMapping
(
"/getAllField"
)
@PostMapping
(
"/getAllField"
)
public
ResponseEntity
getFields
(
@RequestBody
SearchColumnInfoVo
searchColumnInfoVo
)
{
public
ResponseEntity
getFields
(
@RequestBody
SearchColumnInfoVo
searchColumnInfoVo
)
{
List
<
ColumnInfo
>
columnInfos
=
modelService
.
showModelFields
(
searchColumnInfoVo
);
List
<
ColumnInfo
>
columnInfos
=
modelService
.
showModelFields
(
searchColumnInfoVo
);
for
(
ColumnInfo
columnInfo
:
columnInfos
)
{
List
<
Quote
>
allQuote
=
quoteDao
.
findAllByColumnId
(
columnInfo
.
getId
());
Rule
rule
;
try
{
rule
=
ruleDao
.
findAllByColumnId
(
columnInfo
.
getId
());
}
catch
(
Exception
e
){
throw
new
ApiException
(
"规则不唯一!"
);
}
columnInfo
.
setRule
(
rule
);
columnInfo
.
setQuoteList
(
allQuote
);
}
return
ResultUtil
.
success
(
columnInfos
,
"数据查询成功!"
);
return
ResultUtil
.
success
(
columnInfos
,
"数据查询成功!"
);
}
}
...
@@ -209,10 +228,10 @@ public class ModelController {
...
@@ -209,10 +228,10 @@ public class ModelController {
public
ResponseEntity
type
()
{
public
ResponseEntity
type
()
{
//这代码狗都不改
//这代码狗都不改
List
<
ColumnTypeVO
>
list
=
new
ArrayList
<>();
List
<
ColumnTypeVO
>
list
=
new
ArrayList
<>();
ColumnTypeVO
c1
=
new
ColumnTypeVO
(
"数字"
,
"java.lang.Integer"
,
"11"
);
ColumnTypeVO
c1
=
new
ColumnTypeVO
(
"数字"
,
"java.lang.Integer"
,
"11"
);
ColumnTypeVO
c2
=
new
ColumnTypeVO
(
"浮点数"
,
"java.lang.Double"
,
"11"
);
ColumnTypeVO
c2
=
new
ColumnTypeVO
(
"浮点数"
,
"java.lang.Double"
,
"11"
);
ColumnTypeVO
c3
=
new
ColumnTypeVO
(
"单/多行文本"
,
"java.lang.String"
,
"255"
);
ColumnTypeVO
c3
=
new
ColumnTypeVO
(
"单/多行文本"
,
"java.lang.String"
,
"255"
);
ColumnTypeVO
c4
=
new
ColumnTypeVO
(
"布尔值"
,
"java.lang.Boolean"
,
"1"
);
ColumnTypeVO
c4
=
new
ColumnTypeVO
(
"布尔值"
,
"java.lang.Boolean"
,
"1"
);
list
.
add
(
c1
);
list
.
add
(
c1
);
list
.
add
(
c2
);
list
.
add
(
c2
);
...
...
src/main/java/com/tykj/datawarehouse/model/controller/QuoteController.java
浏览文件 @
16572591
package
com
.
tykj
.
datawarehouse
.
model
.
controller
;
package
com
.
tykj
.
datawarehouse
.
model
.
controller
;
import
com.tykj.datawarehouse.base.result.ApiException
;
import
com.tykj.datawarehouse.base.result.ResultUtil
;
import
com.tykj.datawarehouse.base.result.ResultUtil
;
import
com.tykj.datawarehouse.model.dao.ColumnInfoDao
;
import
com.tykj.datawarehouse.model.dao.ColumnInfoDao
;
import
com.tykj.datawarehouse.model.entity.ColumnInfo
;
import
com.tykj.datawarehouse.model.entity.Quote
;
import
com.tykj.datawarehouse.model.entity.Quote
;
import
com.tykj.datawarehouse.model.entity.customEnums.ConnectionType
;
import
com.tykj.datawarehouse.model.entity.vo.QueryCondition
;
import
com.tykj.datawarehouse.model.entity.vo.SearchQuoteVO
;
import
com.tykj.datawarehouse.model.entity.vo.SearchQuoteVO
;
import
com.tykj.datawarehouse.model.entity.vo.UpdateQuoteVO
;
import
com.tykj.datawarehouse.model.entity.vo.UpdateQuoteVO
;
import
com.tykj.datawarehouse.model.service.QuoteService
;
import
com.tykj.datawarehouse.model.service.QuoteService
;
import
com.tykj.datawarehouse.model.service.impl.ModelImpl
;
import
com.tykj.datawarehouse.model.service.impl.ModelImpl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
ModelProperty
;
import
io.swagger.annotations.Api
Operation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -38,24 +33,24 @@ public class QuoteController {
...
@@ -38,24 +33,24 @@ public class QuoteController {
@Autowired
@Autowired
ColumnInfoDao
columnInfoDao
;
ColumnInfoDao
columnInfoDao
;
@Api
ModelProperty
(
"引用删除"
)
@Api
Operation
(
"引用删除"
)
@GetMapping
(
"/delete"
)
@GetMapping
(
"/delete"
)
public
ResponseEntity
deleteQuote
(
Integer
id
)
{
public
ResponseEntity
deleteQuote
(
Integer
id
)
{
return
ResultUtil
.
success
(
quoteService
.
delQuote
(
id
),
"删除成功!"
);
return
ResultUtil
.
success
(
quoteService
.
delQuote
(
id
),
"删除成功!"
);
}
}
@Api
ModelProperty
(
"引用更新"
)
@Api
Operation
(
"引用更新"
)
@PostMapping
(
"/update"
)
@PostMapping
(
"/update"
)
public
ResponseEntity
UpdateQuote
(
@RequestBody
UpdateQuoteVO
updateQuoteVO
)
{
public
ResponseEntity
UpdateQuote
(
@RequestBody
UpdateQuoteVO
updateQuoteVO
)
{
return
ResultUtil
.
success
(
quoteService
.
updateQuote
(
updateQuoteVO
),
"更新成功!"
);
return
ResultUtil
.
success
(
quoteService
.
updateQuote
(
updateQuoteVO
),
"更新成功!"
);
}
}
@Api
ModelProperty
(
"查找所有引用"
)
@Api
Operation
(
"查找所有引用"
)
@PostMapping
(
"/getAllQuote"
)
@PostMapping
(
"/getAllQuote"
)
public
ResponseEntity
getAllQuote
(
@RequestBody
SearchQuoteVO
searchQuoteVO
)
{
public
ResponseEntity
getAllQuote
(
@RequestBody
SearchQuoteVO
searchQuoteVO
)
{
return
ResultUtil
.
success
(
quoteService
.
getAllQuote
(
searchQuoteVO
),
"查询成功!"
);
return
ResultUtil
.
success
(
quoteService
.
getAllQuote
(
searchQuoteVO
),
"查询成功!"
);
}
}
@Api
ModelProperty
(
"保存引用"
)
@Api
Operation
(
"保存引用"
)
@PostMapping
(
"/saveQuote"
)
@PostMapping
(
"/saveQuote"
)
public
ResponseEntity
saveQuote
(
@RequestBody
Quote
quote
)
{
public
ResponseEntity
saveQuote
(
@RequestBody
Quote
quote
)
{
return
ResultUtil
.
success
(
quoteService
.
saveQuote
(
quote
)
,
"保存成功!"
);
return
ResultUtil
.
success
(
quoteService
.
saveQuote
(
quote
)
,
"保存成功!"
);
...
...
src/main/java/com/tykj/datawarehouse/model/controller/RuleController.java
浏览文件 @
16572591
...
@@ -5,6 +5,7 @@ import com.tykj.datawarehouse.model.entity.vo.RuleVo;
...
@@ -5,6 +5,7 @@ import com.tykj.datawarehouse.model.entity.vo.RuleVo;
import
com.tykj.datawarehouse.model.service.RuleService
;
import
com.tykj.datawarehouse.model.service.RuleService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -22,7 +23,7 @@ public class RuleController {
...
@@ -22,7 +23,7 @@ public class RuleController {
@Autowired
@Autowired
RuleService
ruleService
;
RuleService
ruleService
;
@Api
ModelProperty
(
"规则删除"
)
@Api
Operation
(
"规则删除"
)
@GetMapping
(
"/delete"
)
@GetMapping
(
"/delete"
)
public
ResponseEntity
deleteRule
(
Integer
id
)
{
public
ResponseEntity
deleteRule
(
Integer
id
)
{
try
{
try
{
...
@@ -31,10 +32,10 @@ public class RuleController {
...
@@ -31,10 +32,10 @@ public class RuleController {
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
}
}
return
ResultUtil
.
failed
(
"
删除失败
!"
);
return
ResultUtil
.
failed
(
"
此id已经被删除
!"
);
}
}
@Api
ModelProperty
(
"规则新增"
)
@Api
Operation
(
"规则新增"
)
@PostMapping
(
"/save"
)
@PostMapping
(
"/save"
)
public
ResponseEntity
add
(
@RequestBody
RuleVo
ruleVo
)
{
public
ResponseEntity
add
(
@RequestBody
RuleVo
ruleVo
)
{
try
{
try
{
...
@@ -46,19 +47,19 @@ public class RuleController {
...
@@ -46,19 +47,19 @@ public class RuleController {
return
ResultUtil
.
failed
(
"保存失败!"
);
return
ResultUtil
.
failed
(
"保存失败!"
);
}
}
@Api
ModelProperty
(
"规则修改"
)
@Api
Operation
(
"规则修改"
)
@PostMapping
(
"/update"
)
@PostMapping
(
"/update"
)
public
ResponseEntity
update
(
@RequestBody
RuleVo
ruleVo
)
{
public
ResponseEntity
update
(
@RequestBody
RuleVo
ruleVo
)
{
try
{
try
{
ruleService
.
add
(
ruleVo
);
ruleService
.
update
(
ruleVo
);
return
ResultUtil
.
success
(
"
修改
成功!"
);
return
ResultUtil
.
success
(
"
操作
成功!"
);
}
catch
(
Exception
ignored
)
{
}
catch
(
Exception
ignored
)
{
}
}
return
ResultUtil
.
failed
(
"
修改
失败!"
);
return
ResultUtil
.
failed
(
"
操作
失败!"
);
}
}
@Api
ModelProperty
(
"规则修改
"
)
@Api
Operation
(
"查询全部
"
)
@PostMapping
(
"/getAll"
)
@PostMapping
(
"/getAll"
)
public
ResponseEntity
get
()
{
public
ResponseEntity
get
()
{
...
...
src/main/java/com/tykj/datawarehouse/model/dao/RuleDao.java
浏览文件 @
16572591
...
@@ -18,5 +18,5 @@ public interface RuleDao extends JpaRepository<Rule, Integer>, JpaSpecificationE
...
@@ -18,5 +18,5 @@ public interface RuleDao extends JpaRepository<Rule, Integer>, JpaSpecificationE
* @param id
* @param id
* @return
* @return
*/
*/
Rule
findByColumnId
(
Integer
id
);
Rule
find
All
ByColumnId
(
Integer
id
);
}
}
src/main/java/com/tykj/datawarehouse/model/entity/ColumnInfo.java
浏览文件 @
16572591
...
@@ -49,6 +49,10 @@ public class ColumnInfo extends BaseEntity {
...
@@ -49,6 +49,10 @@ public class ColumnInfo extends BaseEntity {
@ApiModelProperty
(
"详细描述"
)
@ApiModelProperty
(
"详细描述"
)
private
String
description
;
private
String
description
;
@ApiModelProperty
(
"规则"
)
@Transient
private
Rule
rule
=
new
Rule
();
@ApiModelProperty
(
"引用对象"
)
@ApiModelProperty
(
"引用对象"
)
@Transient
@Transient
private
List
<
Quote
>
quoteList
=
new
ArrayList
<>();
private
List
<
Quote
>
quoteList
=
new
ArrayList
<>();
...
@@ -62,6 +66,7 @@ public class ColumnInfo extends BaseEntity {
...
@@ -62,6 +66,7 @@ public class ColumnInfo extends BaseEntity {
this
.
dbName
=
dbName
;
this
.
dbName
=
dbName
;
this
.
dbId
=
dbId
;
this
.
dbId
=
dbId
;
this
.
description
=
description
;
this
.
description
=
description
;
}
}
...
...
src/main/java/com/tykj/datawarehouse/model/entity/vo/ColumnVO.java
浏览文件 @
16572591
package
com
.
tykj
.
datawarehouse
.
model
.
entity
.
vo
;
package
com
.
tykj
.
datawarehouse
.
model
.
entity
.
vo
;
import
com.tykj.datawarehouse.model.entity.Quote
;
import
com.tykj.datawarehouse.model.entity.Quote
;
import
com.tykj.datawarehouse.model.entity.Rule
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -34,6 +36,8 @@ public class ColumnVO {
...
@@ -34,6 +36,8 @@ public class ColumnVO {
private
String
fieldTitle
;
private
String
fieldTitle
;
@ApiModelProperty
(
"字段长度,有默认值"
)
@ApiModelProperty
(
"字段长度,有默认值"
)
private
Integer
fieldLength
;
private
Integer
fieldLength
;
@ApiModelProperty
(
"规则"
)
private
Rule
rule
;
@ApiModelProperty
(
"详细描述"
)
@ApiModelProperty
(
"详细描述"
)
private
String
description
;
private
String
description
;
@ApiModelProperty
(
"引用数组"
)
@ApiModelProperty
(
"引用数组"
)
...
...
src/main/java/com/tykj/datawarehouse/model/service/ModelService.java
浏览文件 @
16572591
...
@@ -56,8 +56,8 @@ public interface ModelService {
...
@@ -56,8 +56,8 @@ public interface ModelService {
TableInfo
newTable
(
TableVO
tableVO
);
TableInfo
newTable
(
TableVO
tableVO
);
/**
/**
* 根据表名插入数据
*
*
*根据表名插入数据
* @param map
* @param map
* @return
* @return
*/
*/
...
@@ -65,7 +65,6 @@ public interface ModelService {
...
@@ -65,7 +65,6 @@ public interface ModelService {
/**
/**
* 插入一组数据
* 插入一组数据
*
* @param mapList
* @param mapList
* @return
* @return
*/
*/
...
...
src/main/java/com/tykj/datawarehouse/model/service/impl/ModelImpl.java
浏览文件 @
16572591
...
@@ -31,7 +31,6 @@ import org.springframework.data.domain.Page;
...
@@ -31,7 +31,6 @@ import org.springframework.data.domain.Page;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.Assert
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
...
@@ -164,7 +163,8 @@ public class ModelImpl implements ModelService {
...
@@ -164,7 +163,8 @@ public class ModelImpl implements ModelService {
,
columnVO
.
getFieldLength
()
,
columnVO
.
getFieldLength
()
,
tableInfo
.
getModelName
().
toUpperCase
()
,
tableInfo
.
getModelName
().
toUpperCase
()
,
tableInfo
.
getId
()
,
tableInfo
.
getId
()
,
columnVO
.
getDescription
());
,
columnVO
.
getDescription
()
);
ColumnInfo
save
=
columnInfoDao
.
save
(
columnInfo
);
ColumnInfo
save
=
columnInfoDao
.
save
(
columnInfo
);
/***/
/***/
List
<
Quote
>
quoteList
=
columnVO
.
getQuoteList
();
List
<
Quote
>
quoteList
=
columnVO
.
getQuoteList
();
...
@@ -275,7 +275,7 @@ public class ModelImpl implements ModelService {
...
@@ -275,7 +275,7 @@ public class ModelImpl implements ModelService {
Type
propertyType
=
propertyTypes
[
i
];
Type
propertyType
=
propertyTypes
[
i
];
//根据目标Type转换
//根据目标Type转换
changeValueToTargetType
(
map
,
value
,
propertyType
,
propertyNames
[
i
]);
changeValueToTargetType
(
map
,
value
,
propertyType
,
propertyNames
[
i
]);
//验证
//验证
validationAllRuleAndQuote
(
tableInfo
,
value
,
propertyType
,
propertyNames
[
i
]);
validationAllRuleAndQuote
(
tableInfo
,
value
,
propertyType
,
propertyNames
[
i
]);
}
}
session
.
saveOrUpdate
(
tableName
,
map
);
session
.
saveOrUpdate
(
tableName
,
map
);
...
@@ -538,13 +538,14 @@ public class ModelImpl implements ModelService {
...
@@ -538,13 +538,14 @@ public class ModelImpl implements ModelService {
String
sql1
=
"DROP TABLE "
+
tableInfo
.
getModelName
().
toUpperCase
();
String
sql1
=
"DROP TABLE "
+
tableInfo
.
getModelName
().
toUpperCase
();
log
.
info
(
sql1
);
log
.
info
(
sql1
);
jdbcTemplate
.
execute
(
sql1
);
jdbcTemplate
.
execute
(
sql1
);
//删除SEQUENCE
if
(
"com.oscar.Driver"
.
equals
(
env
.
getProperty
(
"spring.datasource.driver-class-name"
)))
{
if
(
"com.oscar.Driver"
.
equals
(
env
.
getProperty
(
"spring.datasource.driver-class-name"
)))
{
String
sql
=
"DROP SEQUENCE "
+
"SEQUENCE_"
+
tableInfo
.
getModelName
().
toUpperCase
()
+
" CASCADE;"
;
String
sql
=
"DROP SEQUENCE "
+
"SEQUENCE_"
+
tableInfo
.
getModelName
().
toUpperCase
()
+
" CASCADE;"
;
log
.
info
(
sql
);
log
.
info
(
sql
);
jdbcTemplate
.
execute
(
sql
);
jdbcTemplate
.
execute
(
sql
);
//重新加载metaSource
sessionUtil
.
init
();
}
}
//删除此session
sessionUtil
.
deleteTableInMeteData
(
tableInfo
.
getModelName
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
ApiException
(
"删除表时出现错误!"
);
throw
new
ApiException
(
"删除表时出现错误!"
);
}
}
...
@@ -638,16 +639,16 @@ public class ModelImpl implements ModelService {
...
@@ -638,16 +639,16 @@ public class ModelImpl implements ModelService {
// 通过 tableInfo 的 Id + columnName 为查询条件 查出 columnInfo
// 通过 tableInfo 的 Id + columnName 为查询条件 查出 columnInfo
ColumnInfo
columnInfo
=
columnInfoDao
.
findByDbIdAndFieldName
(
tableInfo
.
getId
(),
propertyNames
);
ColumnInfo
columnInfo
=
columnInfoDao
.
findByDbIdAndFieldName
(
tableInfo
.
getId
(),
propertyNames
);
//引用校验
//引用校验
if
(!
isNull
(
quoteDao
.
findAllByColumnId
(
columnInfo
.
getId
()))){
if
(!
isNull
(
quoteDao
.
findAllByColumnId
(
columnInfo
.
getId
())))
{
List
<
String
>
quotes
=
quoteDao
.
findAllByColumnId
(
columnInfo
.
getId
()).
stream
().
map
(
Quote:
:
getValue
).
collect
(
Collectors
.
toList
());
List
<
String
>
quotes
=
quoteDao
.
findAllByColumnId
(
columnInfo
.
getId
()).
stream
().
map
(
Quote:
:
getValue
).
collect
(
Collectors
.
toList
());
if
(!
validationQuote
(
quotes
,
(
String
)
value
))
{
if
(!
validationQuote
(
quotes
,
(
String
)
value
))
{
throw
new
ApiException
(
"引用校验不通过!"
);
throw
new
ApiException
(
"引用校验不通过!"
);
}
}
}
}
//规则校验
//规则校验
if
(!
isNull
(
ruleDao
.
findByColumnId
(
columnInfo
.
getId
())))
{
if
(!
isNull
(
ruleDao
.
findAllByColumnId
(
columnInfo
.
getId
())))
{
String
regular
=
ruleDao
.
findByColumnId
(
columnInfo
.
getId
()).
getRegular
();
String
regular
=
ruleDao
.
find
All
ByColumnId
(
columnInfo
.
getId
()).
getRegular
();
if
(!
validationRule
(
regular
,
(
String
)
value
)){
if
(!
validationRule
(
regular
,
(
String
)
value
))
{
throw
new
ApiException
(
"正则校验不通过!"
);
throw
new
ApiException
(
"正则校验不通过!"
);
}
}
}
}
...
...
src/main/java/com/tykj/datawarehouse/model/utils/CreateTableUtil.java
浏览文件 @
16572591
...
@@ -57,7 +57,7 @@ public class CreateTableUtil {
...
@@ -57,7 +57,7 @@ public class CreateTableUtil {
"<hibernate-mapping>\n"
+
"<hibernate-mapping>\n"
+
" <class entity-name=\""
+
tableVO
.
getModelName
().
toLowerCase
().
toUpperCase
()
+
"\" table=\""
+
tableVO
.
getModelName
().
toLowerCase
().
toUpperCase
()
+
"\">\n"
;
" <class entity-name=\""
+
tableVO
.
getModelName
().
toLowerCase
().
toUpperCase
()
+
"\" table=\""
+
tableVO
.
getModelName
().
toLowerCase
().
toUpperCase
()
+
"\">\n"
;
xmlMapping
+=
" <id name=\"
ID
\" type=\"java.lang.Integer\" length=\"11\" unsaved-value=\"null\" >\n"
+
xmlMapping
+=
" <id name=\"
id
\" type=\"java.lang.Integer\" length=\"11\" unsaved-value=\"null\" >\n"
+
" <generator class=\"com.tykj.datawarehouse.base.entity.XMQGenerator\" >\n"
+
" <generator class=\"com.tykj.datawarehouse.base.entity.XMQGenerator\" >\n"
+
"<param name=\"sequence\">SEQUENCE_"
+
tableVO
.
getModelName
().
toLowerCase
().
toUpperCase
()
+
"</param>"
+
"<param name=\"sequence\">SEQUENCE_"
+
tableVO
.
getModelName
().
toLowerCase
().
toUpperCase
()
+
"</param>"
+
"</generator>"
+
"</generator>"
+
...
@@ -130,17 +130,6 @@ public class CreateTableUtil {
...
@@ -130,17 +130,6 @@ public class CreateTableUtil {
}
}
public
static
String
getClassName
(
String
aClass
)
{
int
i
=
aClass
.
lastIndexOf
(
"."
);
String
substring
=
aClass
.
substring
(
i
+
1
);
return
substring
;
}
public
static
String
getTypeName
(
String
aClass
)
{
String
class_
=
aClass
.
replace
(
"class "
,
""
);
return
TYPE_MAP
.
get
(
class_
);
}
/**
/**
*小写
*小写
...
...
src/main/java/com/tykj/datawarehouse/model/utils/SessionUtil.java
浏览文件 @
16572591
...
@@ -52,7 +52,6 @@ public class SessionUtil {
...
@@ -52,7 +52,6 @@ public class SessionUtil {
List
<
TableInfo
>
all
=
tableInfoDao
.
findAll
();
List
<
TableInfo
>
all
=
tableInfoDao
.
findAll
();
for
(
TableInfo
tableInfo
:
all
)
{
for
(
TableInfo
tableInfo
:
all
)
{
String
xml
=
tableInfo
.
getXml
();
String
xml
=
tableInfo
.
getXml
();
if
(!
Strings
.
isNullOrEmpty
(
xml
)){
if
(!
Strings
.
isNullOrEmpty
(
xml
)){
addXml
(
xml
);
addXml
(
xml
);
}
}
...
...
src/test/java/com/tykj/datawarehouse/DataTestApplicationTests.java
浏览文件 @
16572591
...
@@ -5,11 +5,6 @@ import org.junit.jupiter.api.Test;
...
@@ -5,11 +5,6 @@ import org.junit.jupiter.api.Test;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
javax.xml.soap.SAAJResult
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
@SpringBootTest
@SpringBootTest
class
DataTestApplicationTests
{
class
DataTestApplicationTests
{
...
@@ -27,7 +22,8 @@ class DataTestApplicationTests {
...
@@ -27,7 +22,8 @@ class DataTestApplicationTests {
// boolean matches = pattern.matcher(str).matches();
// boolean matches = pattern.matcher(str).matches();
//
//
// System.out.println(matches);
// System.out.println(matches);
System
.
out
.
println
(
ruleDao
.
findByColumnId
(
2
));
System
.
out
.
println
(
ruleDao
.
findAllByColumnId
(
71
));
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论