Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataDeclaration
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
黄夏豪
dataDeclaration
Commits
26415330
提交
26415330
authored
5月 19, 2021
作者:
ww1xhqc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[数据模型] 版本类相关
上级
9abe7c74
显示空白字符变更
内嵌
并排
正在显示
19 个修改的文件
包含
83 行增加
和
259 行删除
+83
-259
WebMvcConfig.java
src/main/java/com/tykj/base/config/WebMvcConfig.java
+1
-1
ModelController.java
...java/com/tykj/model_layer/controller/ModelController.java
+2
-7
VersionController.java
...va/com/tykj/model_layer/controller/VersionController.java
+13
-7
IndexDao.java
src/main/java/com/tykj/model_layer/dao/IndexDao.java
+0
-13
VersionBackupDao.java
src/main/java/com/tykj/model_layer/dao/VersionBackupDao.java
+0
-13
MyIndex.java
src/main/java/com/tykj/model_layer/entity/MyIndex.java
+0
-30
TableInfo.java
src/main/java/com/tykj/model_layer/entity/TableInfo.java
+5
-0
Version.java
src/main/java/com/tykj/model_layer/entity/Version.java
+10
-3
VersionBackup.java
src/main/java/com/tykj/model_layer/entity/VersionBackup.java
+0
-34
VersionBackupService.java
...va/com/tykj/model_layer/service/VersionBackupService.java
+0
-15
VersionService.java
...ain/java/com/tykj/model_layer/service/VersionService.java
+2
-2
IndexServiceImpl.java
...a/com/tykj/model_layer/service/impl/IndexServiceImpl.java
+0
-39
ModelImpl.java
...ain/java/com/tykj/model_layer/service/impl/ModelImpl.java
+16
-18
VersionBackupServiceImpl.java
...kj/model_layer/service/impl/VersionBackupServiceImpl.java
+0
-22
VersionServiceImpl.java
...com/tykj/model_layer/service/impl/VersionServiceImpl.java
+0
-52
CreateTableUtil.java
...main/java/com/tykj/model_layer/utils/CreateTableUtil.java
+27
-0
SessionUtil.java
src/main/java/com/tykj/model_layer/utils/SessionUtil.java
+4
-0
GroupSettingController.java
...a/com/tykj/setting/controller/GroupSettingController.java
+1
-1
ScreenSettingController.java
.../com/tykj/setting/controller/ScreenSettingController.java
+2
-2
没有找到文件。
src/main/java/com/tykj/base/config/WebMvcConfig.java
浏览文件 @
26415330
...
@@ -48,7 +48,7 @@ public class WebMvcConfig {
...
@@ -48,7 +48,7 @@ public class WebMvcConfig {
.
apiInfo
(
apiInfo
())
.
apiInfo
(
apiInfo
())
.
select
()
.
select
()
// 自行修改为自己的包路径
// 自行修改为自己的包路径
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"com.tykj
.model_layer
"
))
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"com.tykj"
))
.
paths
(
PathSelectors
.
any
())
.
paths
(
PathSelectors
.
any
())
.
build
();
.
build
();
}
}
...
...
src/main/java/com/tykj/model_layer/controller/ModelController.java
浏览文件 @
26415330
...
@@ -6,8 +6,6 @@ import com.tykj.model_layer.dao.QuoteDao;
...
@@ -6,8 +6,6 @@ import com.tykj.model_layer.dao.QuoteDao;
import
com.tykj.model_layer.entity.*
;
import
com.tykj.model_layer.entity.*
;
import
com.tykj.model_layer.entity.vo.*
;
import
com.tykj.model_layer.entity.vo.*
;
import
com.tykj.model_layer.service.ModelService
;
import
com.tykj.model_layer.service.ModelService
;
import
com.tykj.model_layer.service.QuoteService
;
import
com.tykj.model_layer.service.VersionBackupService
;
import
com.tykj.model_layer.service.VersionService
;
import
com.tykj.model_layer.service.VersionService
;
import
com.tykj.model_layer.service.impl.ModelHelper
;
import
com.tykj.model_layer.service.impl.ModelHelper
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -48,8 +46,7 @@ public class ModelController {
...
@@ -48,8 +46,7 @@ public class ModelController {
@Autowired
@Autowired
private
VersionService
versionService
;
private
VersionService
versionService
;
@Autowired
private
VersionBackupService
versionBackupService
;
/**
/**
...
@@ -106,8 +103,7 @@ public class ModelController {
...
@@ -106,8 +103,7 @@ public class ModelController {
modelService
.
newTable
(
tableVO
);
modelService
.
newTable
(
tableVO
);
long
end
=
System
.
currentTimeMillis
();
long
end
=
System
.
currentTimeMillis
();
log
.
warn
(
"创建总用时为:{}秒"
,
(
end
-
start
)
/
1000.0
);
log
.
warn
(
"创建总用时为:{}秒"
,
(
end
-
start
)
/
1000.0
);
// versionService.addVersion(new Version("1.0","这是初始版本",""));
// versionBackupService.addVersion(new VersionBackup("1.0","这是初始备份版本",""));
return
ResultUtil
.
success
(
""
,
"新建成功!"
);
return
ResultUtil
.
success
(
""
,
"新建成功!"
);
}
}
...
@@ -208,7 +204,6 @@ public class ModelController {
...
@@ -208,7 +204,6 @@ public class ModelController {
@ApiOperation
(
"删除操作"
)
@ApiOperation
(
"删除操作"
)
@DeleteMapping
(
"/delete"
)
@DeleteMapping
(
"/delete"
)
public
ResponseEntity
delTable
(
DelTableVO
delTableVO
)
{
public
ResponseEntity
delTable
(
DelTableVO
delTableVO
)
{
int
i
=
modelService
.
delTable
(
delTableVO
);
int
i
=
modelService
.
delTable
(
delTableVO
);
if
(
i
==
1
)
{
if
(
i
==
1
)
{
return
ResultUtil
.
success
(
""
,
"删除成功!"
);
return
ResultUtil
.
success
(
""
,
"删除成功!"
);
...
...
src/main/java/com/tykj/model_layer/controller/VersionController.java
浏览文件 @
26415330
...
@@ -8,8 +8,7 @@ import com.tykj.model_layer.service.VersionService;
...
@@ -8,8 +8,7 @@ import com.tykj.model_layer.service.VersionService;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
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.RequestMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RestController
;
/**
/**
* @Description TODO
* @Description TODO
...
@@ -23,14 +22,21 @@ public class VersionController {
...
@@ -23,14 +22,21 @@ public class VersionController {
@Autowired
@Autowired
private
VersionService
versionService
;
private
VersionService
versionService
;
@
Request
Mapping
(
"/delVersion"
)
@
Delete
Mapping
(
"/delVersion"
)
public
ResponseEntity
delVersion
(){
public
ResponseEntity
delVersion
(
Integer
id
){
versionService
.
delVersion
();
versionService
.
delVersion
(
id
);
return
ResultUtil
.
success
(
"删除成功!"
);
return
ResultUtil
.
success
(
"删除成功!"
);
}
}
@
Reque
stMapping
(
"/addVersion"
)
@
Po
stMapping
(
"/addVersion"
)
public
ResponseEntity
addVersion
(
VersionVO
versionVO
){
public
ResponseEntity
addVersion
(
@RequestBody
VersionVO
versionVO
){
return
ResultUtil
.
success
(
versionService
.
addVersion
(
versionVO
),
"保存成功!"
);
return
ResultUtil
.
success
(
versionService
.
addVersion
(
versionVO
),
"保存成功!"
);
}
}
@RequestMapping
(
"/goBack"
)
public
ResponseEntity
goBack
(
Integer
integer
){
return
ResultUtil
.
success
(
""
);
}
}
}
src/main/java/com/tykj/model_layer/dao/IndexDao.java
deleted
100644 → 0
浏览文件 @
9abe7c74
package
com
.
tykj
.
model_layer
.
dao
;
import
com.tykj.model_layer.entity.MyIndex
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
/**
* @Description TODO
* @Author WWW
* @Date 2021/5/19 14:34
*/
public
interface
IndexDao
extends
JpaRepository
<
MyIndex
,
Integer
>,
JpaSpecificationExecutor
<
MyIndex
>
{
}
src/main/java/com/tykj/model_layer/dao/VersionBackupDao.java
deleted
100644 → 0
浏览文件 @
9abe7c74
package
com
.
tykj
.
model_layer
.
dao
;
import
com.tykj.model_layer.entity.VersionBackup
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
/**
* @Description TODO
* @Author WWW
* @Date 2021/5/19 13:51
*/
public
interface
VersionBackupDao
extends
JpaRepository
<
VersionBackup
,
Integer
>,
JpaSpecificationExecutor
<
VersionBackup
>
{
}
src/main/java/com/tykj/model_layer/entity/MyIndex.java
deleted
100644 → 0
浏览文件 @
9abe7c74
package
com
.
tykj
.
model_layer
.
entity
;
import
com.tykj.base.entity.BaseEntity
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.springframework.data.jpa.repository.config.EnableJpaRepositories
;
import
javax.persistence.Entity
;
import
javax.persistence.Table
;
/**
* @Description TODO
* @Author WWW
* @Date 2021/5/19 14:28
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table
public
class
MyIndex
extends
BaseEntity
{
@ApiModelProperty
(
"版本"
)
private
String
versionId
;
@ApiModelProperty
(
"索引"
)
private
String
ids
;
}
src/main/java/com/tykj/model_layer/entity/TableInfo.java
浏览文件 @
26415330
...
@@ -63,6 +63,11 @@ public class TableInfo extends BaseEntity {
...
@@ -63,6 +63,11 @@ public class TableInfo extends BaseEntity {
@ApiModelProperty
(
"表对应hbm.xml"
)
@ApiModelProperty
(
"表对应hbm.xml"
)
private
String
xml
;
private
String
xml
;
@ApiModelProperty
(
"备份表"
)
private
String
backName
;
@Lob
@ApiModelProperty
(
"备份表XML"
)
private
String
backXml
;
}
}
src/main/java/com/tykj/model_layer/entity/Version.java
浏览文件 @
26415330
...
@@ -23,12 +23,19 @@ import javax.persistence.Table;
...
@@ -23,12 +23,19 @@ import javax.persistence.Table;
@NoArgsConstructor
@NoArgsConstructor
@ApiModel
(
"版本控制表"
)
@ApiModel
(
"版本控制表"
)
public
class
Version
extends
BaseEntity
{
public
class
Version
extends
BaseEntity
{
@ApiModelProperty
(
"版本号"
)
@ApiModelProperty
(
"版本号"
)
private
String
versionId
;
private
String
versionId
;
@ApiModelProperty
(
"版本号"
)
@ApiModelProperty
(
"描述"
)
private
String
versionDesc
;
private
String
versionDesc
;
@Lob
@ApiModelProperty
(
"描述"
)
private
String
ids
;
@Lob
@Lob
@ApiModelProperty
(
"
版本对应数据
"
)
@ApiModelProperty
(
"
对应数据表
"
)
private
String
content
;
private
Integer
dbId
;
}
}
src/main/java/com/tykj/model_layer/entity/VersionBackup.java
deleted
100644 → 0
浏览文件 @
9abe7c74
package
com
.
tykj
.
model_layer
.
entity
;
import
com.tykj.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.Lob
;
import
javax.persistence.Table
;
/**
* @Description TODO
* @Author WWW
* @Date 2021/5/19 13:18
*/
@Entity
@Table
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
(
"版本备份控制表"
)
public
class
VersionBackup
extends
BaseEntity
{
@ApiModelProperty
(
"版本号"
)
private
String
versionId
;
@ApiModelProperty
(
"版本号"
)
private
String
versionDesc
;
@Lob
@ApiModelProperty
(
"版本对应数据"
)
private
String
content
;
}
src/main/java/com/tykj/model_layer/service/VersionBackupService.java
deleted
100644 → 0
浏览文件 @
9abe7c74
package
com
.
tykj
.
model_layer
.
service
;
import
com.tykj.model_layer.entity.VersionBackup
;
/**
* @Description TODO
* @Author WWW
* @Date 2021/5/19 13:59
*/
public
interface
VersionBackupService
{
/**
*
*/
void
addVersion
(
VersionBackup
versionBackup
);
}
src/main/java/com/tykj/model_layer/service/VersionService.java
浏览文件 @
26415330
...
@@ -20,7 +20,7 @@ public interface VersionService {
...
@@ -20,7 +20,7 @@ public interface VersionService {
/**
/**
* 删除
* 删除
*/
*/
void
delVersion
(
);
void
delVersion
(
Integer
id
);
void
Synchronize
(
);
void
goback
(
Integer
id
);
}
}
src/main/java/com/tykj/model_layer/service/impl/IndexServiceImpl.java
deleted
100644 → 0
浏览文件 @
9abe7c74
package
com
.
tykj
.
model_layer
.
service
.
impl
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.tykj.model_layer.dao.ColumnInfoDao
;
import
com.tykj.model_layer.dao.IndexDao
;
import
com.tykj.model_layer.entity.ColumnInfo
;
import
com.tykj.model_layer.entity.MyIndex
;
import
com.tykj.model_layer.entity.vo.IndexVO
;
import
com.tykj.model_layer.service.IndexService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* @Description TODO
* @Author WWW
* @Date 2021/5/19 14:37
*/
@Service
public
class
IndexServiceImpl
implements
IndexService
{
@Autowired
private
IndexDao
indexDao
;
@Autowired
private
ColumnInfoDao
columnInfoDao
;
@Override
public
void
addIndex
(
IndexVO
indexVO
)
{
MyIndex
index
=
new
MyIndex
();
index
.
setVersionId
(
indexVO
.
getVersionId
());
List
<
Integer
>
collect
=
columnInfoDao
.
findAllByDbId
(
indexVO
.
getDbId
()).
stream
()
.
map
(
ColumnInfo:
:
getId
)
.
collect
(
Collectors
.
toList
());
index
.
setIds
(
JSONArray
.
toJSONString
(
collect
));
indexDao
.
save
(
index
);
}
}
src/main/java/com/tykj/model_layer/service/impl/ModelImpl.java
浏览文件 @
26415330
...
@@ -49,6 +49,7 @@ import java.util.stream.Collectors;
...
@@ -49,6 +49,7 @@ import java.util.stream.Collectors;
import
static
com
.
tykj
.
model_layer
.
utils
.
CreateTableUtil
.
createTable
;
import
static
com
.
tykj
.
model_layer
.
utils
.
CreateTableUtil
.
createTable
;
import
static
com
.
tykj
.
model_layer
.
utils
.
CreateTableUtil
.
createTableBack
;
import
static
com
.
tykj
.
model_layer
.
utils
.
HqlUtil
.
createQuery
;
import
static
com
.
tykj
.
model_layer
.
utils
.
HqlUtil
.
createQuery
;
import
static
java
.
util
.
Objects
.
isNull
;
import
static
java
.
util
.
Objects
.
isNull
;
import
static
java
.
util
.
Objects
.
nonNull
;
import
static
java
.
util
.
Objects
.
nonNull
;
...
@@ -140,10 +141,9 @@ public class ModelImpl implements ModelService {
...
@@ -140,10 +141,9 @@ public class ModelImpl implements ModelService {
@Override
@Override
public
TableInfo
newTable
(
TableVO
tableVO
)
{
public
TableInfo
newTable
(
TableVO
tableVO
)
{
String
xmlMapping
=
createTable
(
tableVO
);
String
xmlMapping
=
createTable
(
tableVO
);
String
xmlBack
=
createTableBack
(
tableVO
);
sessionUtil
.
addXml
(
xmlMapping
);
sessionUtil
.
addXml
(
xmlMapping
);
sessionUtil
.
addXml
(
xmlBack
);
Session
session
=
sessionUtil
.
getSession
();
Session
session
=
sessionUtil
.
getSession
();
List
<
ColumnVO
>
dataList
=
tableVO
.
getDataList
();
List
<
ColumnVO
>
dataList
=
tableVO
.
getDataList
();
List
<
String
>
collect
=
tableInfoDao
.
findAll
()
List
<
String
>
collect
=
tableInfoDao
.
findAll
()
...
@@ -157,6 +157,8 @@ public class ModelImpl implements ModelService {
...
@@ -157,6 +157,8 @@ public class ModelImpl implements ModelService {
tableInfo
.
setModelName
(
tableVO
.
getModelName
());
tableInfo
.
setModelName
(
tableVO
.
getModelName
());
tableInfo
.
setModelTitle
(
tableVO
.
getModelTitle
());
tableInfo
.
setModelTitle
(
tableVO
.
getModelTitle
());
tableInfo
.
setXml
(
xmlMapping
);
tableInfo
.
setXml
(
xmlMapping
);
tableInfo
.
setBackName
(
tableVO
.
getModelName
()+
"_back"
);
tableInfo
.
setBackXml
(
xmlBack
);
tableInfo
.
setModelType
(
tableVO
.
getModelType
());
tableInfo
.
setModelType
(
tableVO
.
getModelType
());
tableInfo
.
setDescription
(
tableVO
.
getDescription
());
tableInfo
.
setDescription
(
tableVO
.
getDescription
());
tableInfoDao
.
save
(
tableInfo
);
tableInfoDao
.
save
(
tableInfo
);
...
@@ -215,11 +217,13 @@ public class ModelImpl implements ModelService {
...
@@ -215,11 +217,13 @@ public class ModelImpl implements ModelService {
Integer
modelType
=
tableInfo
.
getModelType
();
Integer
modelType
=
tableInfo
.
getModelType
();
SessionImpl
session
=
(
SessionImpl
)
sessionUtil
.
getSession
();
SessionImpl
session
=
(
SessionImpl
)
sessionUtil
.
getSession
();
session
.
getTransaction
().
begin
();
if
(
modelType
.
equals
(
ModelType
.
VIRTUAL
))
{
if
(
modelType
.
equals
(
ModelType
.
VIRTUAL
))
{
Object
values
=
map
.
get
(
tableName
);
Object
values
=
map
.
get
(
tableName
);
if
(
values
instanceof
Map
)
{
if
(
values
instanceof
Map
)
{
//插入数据
//插入数据
insertValue
(
tableInfo
.
getModelName
(),
(
Map
)
values
,
session
);
insertValue
(
tableInfo
.
getModelName
(),
(
Map
)
values
,
session
);
}
else
{
}
else
{
//循环插入数据
//循环插入数据
List
valuesList
=
(
List
)
values
;
List
valuesList
=
(
List
)
values
;
...
@@ -227,8 +231,6 @@ public class ModelImpl implements ModelService {
...
@@ -227,8 +231,6 @@ public class ModelImpl implements ModelService {
insertValue
(
tableInfo
.
getModelName
(),
(
Map
)
valuesList
.
get
(
i
),
session
);
insertValue
(
tableInfo
.
getModelName
(),
(
Map
)
valuesList
.
get
(
i
),
session
);
}
}
}
}
session
.
saveOrUpdate
(
tableName
,
map
);
session
.
getTransaction
().
begin
();
session
.
getTransaction
().
commit
();
session
.
getTransaction
().
commit
();
session
.
close
();
session
.
close
();
...
@@ -240,7 +242,7 @@ public class ModelImpl implements ModelService {
...
@@ -240,7 +242,7 @@ public class ModelImpl implements ModelService {
}
}
/**
/**
* @param
map
* @param
* @return int
* @return int
* @Author WWW
* @Author WWW
* @Description 根据表名新增数据
* @Description 根据表名新增数据
...
@@ -329,7 +331,10 @@ public class ModelImpl implements ModelService {
...
@@ -329,7 +331,10 @@ public class ModelImpl implements ModelService {
map
.
put
(
propertyNames
[
i
],
value
);
map
.
put
(
propertyNames
[
i
],
value
);
}
}
}
}
HashMap
hashMap
=
new
HashMap
();
hashMap
.
putAll
(
map
);
session
.
saveOrUpdate
(
tableName
,
map
);
session
.
saveOrUpdate
(
tableName
,
map
);
session
.
saveOrUpdate
(
tableName
+
"_back"
,
hashMap
);
}
}
...
@@ -411,8 +416,6 @@ public class ModelImpl implements ModelService {
...
@@ -411,8 +416,6 @@ public class ModelImpl implements ModelService {
TableVO
tableVO
=
updateTableInfoVO
.
getTableVO
();
TableVO
tableVO
=
updateTableInfoVO
.
getTableVO
();
Integer
dbId
=
updateTableInfoVO
.
getDbId
();
Integer
dbId
=
updateTableInfoVO
.
getDbId
();
TableInfo
tableInfo
=
tableInfoDao
.
findById
(
dbId
).
orElseThrow
(()
->
new
RuntimeException
(
"未找到该id的表信息"
));
TableInfo
tableInfo
=
tableInfoDao
.
findById
(
dbId
).
orElseThrow
(()
->
new
RuntimeException
(
"未找到该id的表信息"
));
Integer
modelType
=
tableInfo
.
getModelType
();
if
(
modelType
.
equals
(
ModelType
.
VIRTUAL
))
{
tableInfo
.
setUpdatedTime
(
new
Date
());
tableInfo
.
setUpdatedTime
(
new
Date
());
tableInfo
.
setDescription
(
tableVO
.
getDescription
());
tableInfo
.
setDescription
(
tableVO
.
getDescription
());
tableInfo
.
setModelTitle
(
tableVO
.
getModelTitle
());
tableInfo
.
setModelTitle
(
tableVO
.
getModelTitle
());
...
@@ -456,11 +459,6 @@ public class ModelImpl implements ModelService {
...
@@ -456,11 +459,6 @@ public class ModelImpl implements ModelService {
for
(
ColumnInfo
originColumnInfo
:
columnsFordDelete
)
{
for
(
ColumnInfo
originColumnInfo
:
columnsFordDelete
)
{
columnInfoDao
.
delete
(
originColumnInfo
);
columnInfoDao
.
delete
(
originColumnInfo
);
}
}
return
1
;
}
if
(
modelType
.
equals
(
ModelType
.
VIRTUAL
))
{
columnInfoDao
.
deleteAllByDbId
(
updateTableInfoVO
.
getDbId
());
columnInfoDao
.
deleteAllByDbId
(
updateTableInfoVO
.
getDbId
());
List
<
ColumnInfo
>
dataList
=
updateTableInfoVO
.
getTableVO
().
getDataList
().
stream
()
List
<
ColumnInfo
>
dataList
=
updateTableInfoVO
.
getTableVO
().
getDataList
().
stream
()
...
@@ -468,17 +466,17 @@ public class ModelImpl implements ModelService {
...
@@ -468,17 +466,17 @@ public class ModelImpl implements ModelService {
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
for
(
ColumnInfo
columnInfo
:
dataList
)
{
for
(
ColumnInfo
columnInfo
:
dataList
)
{
columnInfo
.
setId
(
null
);
columnInfo
.
setId
(
null
);
columnInfo
.
setPrimaryKey
(
1
);
columnInfoDao
.
save
(
columnInfo
);
columnInfoDao
.
save
(
columnInfo
);
}
}
tableInfo
.
setUpdatedTime
(
new
Date
());
tableInfo
.
setUpdatedTime
(
new
Date
());
String
xml
=
createTable
(
tableVO
);
String
xml
2
=
createTable
(
tableVO
);
// 重新存xml
// 重新存xml
tableInfo
.
setXml
(
xml
);
tableInfo
.
setXml
(
xml
2
);
tableInfoDao
.
save
(
tableInfo
);
tableInfoDao
.
save
(
tableInfo
);
return
1
;
return
1
;
}
return
0
;
}
}
/**
/**
...
@@ -581,7 +579,7 @@ public class ModelImpl implements ModelService {
...
@@ -581,7 +579,7 @@ public class ModelImpl implements ModelService {
tableInfoDao
.
deleteById
(
delTableVO
.
getId
());
tableInfoDao
.
deleteById
(
delTableVO
.
getId
());
List
<
ColumnInfo
>
allByDbId
=
columnInfoDao
.
findAllByDbId
(
delTableVO
.
getId
());
List
<
ColumnInfo
>
allByDbId
=
columnInfoDao
.
findAllByDbId
(
delTableVO
.
getId
());
columnInfoDao
.
deleteInBatch
(
allByDbId
);
columnInfoDao
.
deleteInBatch
(
allByDbId
);
//
jdbcTemplate.execute("drop table " + tableInfo.getModelName());
jdbcTemplate
.
execute
(
"drop table "
+
tableInfo
.
getModelName
());
return
1
;
return
1
;
}
}
...
...
src/main/java/com/tykj/model_layer/service/impl/VersionBackupServiceImpl.java
deleted
100644 → 0
浏览文件 @
9abe7c74
package
com
.
tykj
.
model_layer
.
service
.
impl
;
import
com.tykj.model_layer.dao.VersionBackupDao
;
import
com.tykj.model_layer.entity.VersionBackup
;
import
com.tykj.model_layer.service.VersionBackupService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
/**
* @Description TODO
* @Author WWW
* @Date 2021/5/19 14:00
*/
@Service
public
class
VersionBackupServiceImpl
implements
VersionBackupService
{
@Autowired
private
VersionBackupDao
versionBackupDao
;
@Override
public
void
addVersion
(
VersionBackup
versionBackup
)
{
VersionBackup
save
=
versionBackupDao
.
save
(
versionBackup
);
}
}
src/main/java/com/tykj/model_layer/service/impl/VersionServiceImpl.java
deleted
100644 → 0
浏览文件 @
9abe7c74
package
com
.
tykj
.
model_layer
.
service
.
impl
;
import
com.alibaba.fastjson.JSONArray
;
import
com.tykj.model_layer.dao.ColumnInfoDao
;
import
com.tykj.model_layer.dao.VersionDao
;
import
com.tykj.model_layer.entity.ColumnInfo
;
import
com.tykj.model_layer.entity.Version
;
import
com.tykj.model_layer.entity.vo.VersionVO
;
import
com.tykj.model_layer.service.VersionService
;
import
org.checkerframework.checker.units.qual.A
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* @Description TODO
* @Author WWW
* @Date 2021/5/19 13:57
*/
@Service
public
class
VersionServiceImpl
implements
VersionService
{
@Autowired
VersionDao
versionDao
;
@Autowired
ColumnInfoDao
columnInfoDao
;
@Override
public
Version
addVersion
(
VersionVO
versionVO
)
{
Version
version
=
new
Version
();
version
.
setVersionId
(
versionVO
.
getVersionId
());
version
.
setVersionDesc
(
versionVO
.
getVersionDesc
());
List
<
Integer
>
collect
=
columnInfoDao
.
findAllByDbId
(
versionVO
.
getDbId
()).
stream
()
.
map
(
ColumnInfo:
:
getId
)
.
collect
(
Collectors
.
toList
());
version
.
setContent
(
JSONArray
.
toJSONString
(
collect
));
return
versionDao
.
save
(
version
);
}
@Override
public
void
delVersion
()
{
versionDao
.
deleteAll
();
}
@Override
public
void
Synchronize
()
{
}
}
src/main/java/com/tykj/model_layer/utils/CreateTableUtil.java
浏览文件 @
26415330
...
@@ -75,6 +75,33 @@ public class CreateTableUtil {
...
@@ -75,6 +75,33 @@ public class CreateTableUtil {
return
xmlMapping
;
return
xmlMapping
;
}
}
public
static
String
createTableBack
(
TableVO
tableVO
)
{
// 1sql-type="text" string 转为text文本,2长度超过会自动转换
List
<
ColumnVO
>
dataList
=
tableVO
.
getDataList
();
String
xmlMapping
=
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+
"<!DOCTYPE hibernate-mapping PUBLIC\n"
+
" \"-//Hibernate/Hibernate Mapping DTD 3.0//EN\"\n"
+
" \"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd\">\n"
+
"<hibernate-mapping>\n"
+
" <class entity-name=\""
+
tableVO
.
getModelName
()+
"_back"
+
"\" table=\""
+
tableVO
.
getModelName
()+
"_back"
+
"\">\n"
;
xmlMapping
+=
" <id name=\"id\" type=\"java.lang.Integer\" length=\"11\" unsaved-value=\"null\" >\n"
+
" <generator class=\"identity\" />"
+
" </id>"
;
for
(
ColumnVO
columnVO
:
dataList
)
{
xmlMapping
+=
"\n <property type=\""
+
columnVO
.
getFieldType
()
+
"\" name=\""
+
columnVO
.
getFieldName
()
+
"\" length=\""
+
columnVO
.
getFieldLength
()
+
"\" column=\""
+
columnVO
.
getFieldName
()
+
"\"/>\n"
;
}
xmlMapping
+=
" </class>\n"
+
"</hibernate-mapping>"
;
return
xmlMapping
;
}
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长度超过会自动转换
// 1sql-type="text" string 转为text文本,2长度超过会自动转换
...
...
src/main/java/com/tykj/model_layer/utils/SessionUtil.java
浏览文件 @
26415330
...
@@ -52,9 +52,13 @@ public class SessionUtil {
...
@@ -52,9 +52,13 @@ 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
();
String
xmlBack
=
tableInfo
.
getBackXml
();
if
(!
Strings
.
isNullOrEmpty
(
xml
)){
if
(!
Strings
.
isNullOrEmpty
(
xml
)){
addXml
(
xml
);
addXml
(
xml
);
}
}
if
(!
Strings
.
isNullOrEmpty
(
xmlBack
)){
addXml
(
xmlBack
);
}
}
}
}
}
...
...
src/main/java/com/tykj/setting/controller/GroupSettingController.java
浏览文件 @
26415330
...
@@ -37,7 +37,7 @@ public class GroupSettingController {
...
@@ -37,7 +37,7 @@ public class GroupSettingController {
return
ResultUtil
.
success
(
groupSettingService
.
findAll
(),
"查找成功"
);
return
ResultUtil
.
success
(
groupSettingService
.
findAll
(),
"查找成功"
);
}
}
@GetMapping
(
"/{id}"
)
@GetMapping
(
"/
byId/
{id}"
)
@ApiOperation
(
"按id查找单个分类设置"
)
@ApiOperation
(
"按id查找单个分类设置"
)
public
ResponseEntity
findById
(
@PathVariable
Integer
id
){
public
ResponseEntity
findById
(
@PathVariable
Integer
id
){
return
ResultUtil
.
success
(
groupSettingService
.
findById
(
id
),
"查找成功"
);
return
ResultUtil
.
success
(
groupSettingService
.
findById
(
id
),
"查找成功"
);
...
...
src/main/java/com/tykj/setting/controller/ScreenSettingController.java
浏览文件 @
26415330
...
@@ -10,7 +10,7 @@ import org.springframework.http.ResponseEntity;
...
@@ -10,7 +10,7 @@ import org.springframework.http.ResponseEntity;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
@Api
(
tags
=
"筛选设置相关接口"
)
@Api
(
tags
=
"筛选设置相关接口"
)
@RequestMapping
(
"/setting/
group
"
)
@RequestMapping
(
"/setting/
screen
"
)
@RestController
@RestController
public
class
ScreenSettingController
{
public
class
ScreenSettingController
{
...
@@ -38,7 +38,7 @@ public class ScreenSettingController {
...
@@ -38,7 +38,7 @@ public class ScreenSettingController {
return
ResultUtil
.
success
(
screenSettingService
.
findAll
(),
"查找成功"
);
return
ResultUtil
.
success
(
screenSettingService
.
findAll
(),
"查找成功"
);
}
}
@GetMapping
(
"/{id}"
)
@GetMapping
(
"/
byId/
{id}"
)
@ApiOperation
(
"按id查找单个筛选设置"
)
@ApiOperation
(
"按id查找单个筛选设置"
)
public
ResponseEntity
findById
(
@PathVariable
Integer
id
){
public
ResponseEntity
findById
(
@PathVariable
Integer
id
){
return
ResultUtil
.
success
(
screenSettingService
.
findById
(
id
),
"查找成功"
);
return
ResultUtil
.
success
(
screenSettingService
.
findById
(
id
),
"查找成功"
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论