Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nnjcy-data-model
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ljb
nnjcy-data-model
Commits
793ce0b5
Commit
793ce0b5
authored
Oct 16, 2023
by
wqc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加批量元数据修改
parent
d109ad43
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
53 deletions
+43
-53
common-client/src/main/java/com/zq/common/vo/PageReqVo.java
+2
-2
spider-flow-web/src/main/java/com/zq/spiderflow/controller/MetaDataController.java
+2
-2
spider-flow-web/src/main/java/com/zq/spiderflow/service/MetaDataService.java
+37
-49
spider-flow-web/src/main/java/com/zq/spiderflow/vo/MetaDataVo.java
+2
-0
No files found.
common-client/src/main/java/com/zq/common/vo/PageReqVo.java
View file @
793ce0b5
...
@@ -18,8 +18,8 @@ public class PageReqVo {
...
@@ -18,8 +18,8 @@ public class PageReqVo {
*/
*/
private
static
final
int
DEFAULT_SIZE
=
20
;
private
static
final
int
DEFAULT_SIZE
=
20
;
@ApiModelProperty
(
value
=
"当前页码, 首页为1"
,
example
=
"
1"
)
@ApiModelProperty
(
"当前页码, 首页为
1"
)
private
int
page
=
1
;
private
int
page
;
@ApiModelProperty
(
"每页记录条数"
)
@ApiModelProperty
(
"每页记录条数"
)
private
int
size
=
DEFAULT_SIZE
;
private
int
size
=
DEFAULT_SIZE
;
...
...
spider-flow-web/src/main/java/com/zq/spiderflow/controller/MetaDataController.java
View file @
793ce0b5
...
@@ -170,8 +170,8 @@ public class MetaDataController {
...
@@ -170,8 +170,8 @@ public class MetaDataController {
@ApiOperation
(
"批量添加元数据"
)
@ApiOperation
(
"批量添加元数据"
)
@PostMapping
(
"/addALLMetas"
)
@PostMapping
(
"/addALLMetas"
)
public
ResultVo
addALLMetas
(
@RequestBody
List
<
MetaDataVo
>
vos
,
@RequestBody
String
tableName
){
public
ResultVo
addALLMetas
(
@RequestBody
List
<
MetaDataVo
>
vos
){
AssertUtils
.
notNull
(
vos
,
"选择字段不能为空"
);
AssertUtils
.
notNull
(
vos
,
"选择字段不能为空"
);
return
ResultVo
.
success
(
metaDataService
.
addALLMetas
(
vos
,
tableName
));
return
ResultVo
.
success
(
metaDataService
.
addALLMetas
(
vos
));
}
}
}
}
spider-flow-web/src/main/java/com/zq/spiderflow/service/MetaDataService.java
View file @
793ce0b5
...
@@ -48,48 +48,36 @@ public class MetaDataService extends ServiceImpl<MetaDataDao, MetaData> {
...
@@ -48,48 +48,36 @@ public class MetaDataService extends ServiceImpl<MetaDataDao, MetaData> {
// return metaDataDao.selectList(new LambdaQueryWrapper<MetaData>().eq(MetaData::getCategoryId, categoryId));
// return metaDataDao.selectList(new LambdaQueryWrapper<MetaData>().eq(MetaData::getCategoryId, categoryId));
// }
// }
public
PageVo
<
MetaData
Vo
>
getPageByCategoryId
(
MetaDataReq
req
)
{
public
PageVo
<
MetaData
>
getPageByCategoryId
(
MetaDataReq
req
)
{
// 获取类别目录id参数
// 获取类别目录id参数
Long
categoryId
=
req
.
getCategoryId
();
Long
categoryId
=
req
.
getCategoryId
();
// 获取模糊查询的条件
// 获取模糊查询的条件
String
metaName
=
req
.
getMetaName
();
String
metaName
=
req
.
getMetaName
();
LambdaQueryWrapper
<
MetaData
>
wrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
MetaData
>
wrapper
=
new
LambdaQueryWrapper
<>();
// wrapper.eq(MetaData::getCategoryId, categoryId).last("LIMIT 10"
);
wrapper
.
eq
(
MetaData:
:
getCategoryId
,
categoryId
);
// 判断模糊查询的条件是否为空或空字符串
// 判断模糊查询的条件是否为空或空字符串
if
(
StringUtils
.
isNotBlank
(
metaName
))
{
if
(
StringUtils
.
isNotBlank
(
metaName
))
{
// 如果不为空或空字符串,添加一个模糊查询的条件
// 如果不为空或空字符串,添加一个模糊查询的条件
wrapper
.
like
(
MetaData:
:
getMetaName
,
metaName
);
wrapper
.
like
(
MetaData:
:
getMetaName
,
metaName
);
}
}
return
PagingUtils
.
paging
(
req
,
metaDataDao
,
wrapper
,
MetaData
.
class
);
List
<
MetaDataVo
>
pageList
=
metaDataDao
.
getPageList
(
req
);
int
start
=
0
;
// List<MetaDataVo> pageList = metaDataDao.getPageList(req);
PageVo
<
MetaDataVo
>
pageVo
=
new
PageVo
<>();
// int start = 0;
if
(
req
.
getPage
()
-
1
==
0
)
{
// PageVo<MetaDataVo> pageVo = new PageVo<>();
pageVo
.
setStart
(
0
);
// if (req.getPage() - 1 == 0) {
start
=
0
;
// pageVo.setStart(0);
}
else
{
// start = 0;
pageVo
.
setStart
((
req
.
getPage
()
-
1
)
*
req
.
getSize
());
// } else {
start
=
(
req
.
getPage
()
-
1
)
*
req
.
getSize
();
// pageVo.setStart((req.getPage() - 1) * req.getSize());
}
// start = (req.getPage() - 1) * req.getSize();
pageVo
.
setPage
(
req
.
getPage
());
pageVo
.
setSize
(
req
.
getSize
());
pageVo
.
setRows
(
pageList
);
pageVo
.
setTotal
(
pageList
.
size
());
return
pageVo
;
// LambdaQueryWrapper<MetaDataMapping> mappingWrapper = new LambdaQueryWrapper<>();
// List<MetaData> metaDatas = metaDataDao.selectList(wrapper.eq(MetaData::getCategoryId, categoryId));
// MetaDataReq metaDataReq = new MetaDataReq();
// ArrayList<Object> list = new ArrayList<>();
// for (MetaData metaData : metaDatas) {
// BeanUtil.copyProperties(metaData, metaDataReq);
// List<MetaDataMapping> metaDataMappings = metaDataMappingDao.selectList(mappingWrapper.eq(MetaDataMapping::getMetadataId, metaData.getId()));
// for (MetaDataMapping mapping : metaDataMappings) {
// Long queryDbId = mapping.getQueryDbId();
// metaDataReq.setQueryDbId(queryDbId);
// }
// list.add(metaDataReq);
// }
// }
// return list;
// pageVo.setPage(req.getPage());
// pageVo.setSize(req.getSize());
// pageVo.setRows(pageList);
// pageVo.setTotal(pageList.size());
// return pageVo;
}
}
...
@@ -186,40 +174,40 @@ public class MetaDataService extends ServiceImpl<MetaDataDao, MetaData> {
...
@@ -186,40 +174,40 @@ public class MetaDataService extends ServiceImpl<MetaDataDao, MetaData> {
}
}
public
ResultVo
addALLMetas
(
List
<
MetaDataVo
>
vos
,
String
tableName
)
{
public
ResultVo
addALLMetas
(
List
<
MetaDataVo
>
vos
)
{
MetaData
builder
=
null
;
MetaDataCategory
parent
=
null
;
MetaDataCategory
metaDataCategory
=
new
MetaDataCategory
();
MetaDataCategory
metaDataCategory
=
new
MetaDataCategory
();
MetaDataCategory
parent
=
metaDataCategoryService
.
getOne
(
new
LambdaQueryWrapper
<
MetaDataCategory
>()
.
eq
(
MetaDataCategory:
:
getId
,
vos
.
get
(
1
).
getCategoryId
()));
if
(
parent
!=
null
)
{
metaDataCategory
.
setCategoryCode
(
parent
.
getId
());
// 更新其subCount字段为原来的值加一
parent
.
setSubCount
(
parent
.
getSubCount
()
+
1
);
parent
.
setStandardLevel
(
Integer
.
valueOf
(
vos
.
get
(
1
).
getDataLevel
()));
}
// 如果存在记录,获取其id,并设置为新记录的parentId
BeanUtil
.
copyProperties
(
parent
,
metaDataCategory
);
metaDataCategory
.
setCategoryType
(
1
);
metaDataCategory
.
setCategoryName
(
vos
.
get
(
1
).
getTableName
());
metaDataCategoryService
.
save
(
metaDataCategory
);
MetaData
builder
=
null
;
for
(
MetaDataVo
metaVo
:
vos
)
{
for
(
MetaDataVo
metaVo
:
vos
)
{
builder
=
MetaData
.
builder
()
builder
=
MetaData
.
builder
()
.
metaName
(
metaVo
.
getMetaName
())
.
metaName
(
metaVo
.
getMetaName
())
.
dataType
(
metaVo
.
getDataType
())
.
dataType
(
metaVo
.
getDataType
())
.
dataLength
(
metaVo
.
getDataLength
())
.
dataLength
(
metaVo
.
getDataLength
())
.
fieldPrecision
(
metaVo
.
getFieldPrecision
())
.
fieldPrecision
(
metaVo
.
getFieldPrecision
())
.
dataCode
(
tableName
+
"_"
+
metaVo
.
getMetaName
())
.
dataCode
(
metaVo
.
getTableName
()
+
"_"
+
metaVo
.
getMetaName
())
.
englishName
(
metaVo
.
getEnglishName
())
.
englishName
(
metaVo
.
getEnglishName
())
.
dataLevel
(
metaVo
.
getDataLevel
())
.
dataLevel
(
metaVo
.
getDataLevel
())
.
notNull
(
metaVo
.
getNotNull
())
.
notNull
(
metaVo
.
getNotNull
())
.
categoryId
(
meta
Vo
.
getCategory
Id
())
.
categoryId
(
meta
DataCategory
.
get
Id
())
.
mutiMetaFlag
(
metaVo
.
getMutiMetaFlag
())
.
mutiMetaFlag
(
metaVo
.
getMutiMetaFlag
())
.
mutiMetaExpress
(
metaVo
.
getMutiMetaExpress
())
.
mutiMetaExpress
(
metaVo
.
getMutiMetaExpress
())
.
createTime
(
DateUtil
.
date
()).
build
();
.
createTime
(
DateUtil
.
date
()).
build
();
metaDataDao
.
insert
(
builder
);
metaDataDao
.
insert
(
builder
);
parent
=
metaDataCategoryService
.
getOne
(
new
LambdaQueryWrapper
<
MetaDataCategory
>()
.
eq
(
MetaDataCategory:
:
getId
,
metaVo
.
getCategoryId
()));
if
(
parent
!=
null
)
{
metaDataCategory
.
setCategoryCode
(
parent
.
getId
());
// 更新其subCount字段为原来的值加一
parent
.
setSubCount
(
parent
.
getSubCount
()
+
1
);
parent
.
setStandardLevel
(
Integer
.
valueOf
(
metaVo
.
getDataLevel
()));
}
}
}
// 如果存在记录,获取其id,并设置为新记录的parentId
BeanUtil
.
copyProperties
(
parent
,
metaDataCategory
);
metaDataCategory
.
setCategoryType
(
1
);
metaDataCategory
.
setCategoryName
(
tableName
);
metaDataCategoryService
.
save
(
metaDataCategory
);
return
ResultVo
.
success
(
builder
);
return
ResultVo
.
success
(
builder
);
}
}
}
}
spider-flow-web/src/main/java/com/zq/spiderflow/vo/MetaDataVo.java
View file @
793ce0b5
...
@@ -89,4 +89,6 @@ public class MetaDataVo {
...
@@ -89,4 +89,6 @@ public class MetaDataVo {
private
Date
updateTime
;
private
Date
updateTime
;
private
String
categoryName
;
private
String
categoryName
;
private
String
tableName
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment