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
c24882e5
Commit
c24882e5
authored
Aug 25, 2023
by
wqc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
通用查询——自定义sql完成
parent
f9598eed
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
4 deletions
+18
-4
dataoperation-server/src/main/java/com/zq/dataoperation/service/CommonQueryService.java
+3
-3
spider-flow-web/src/main/java/com/zq/spiderflow/dao/MetaDataMappingDao.java
+2
-0
spider-flow-web/src/main/java/com/zq/spiderflow/service/MetaDataService.java
+2
-1
spider-flow-web/src/main/resources/mapper/MetaDataMappingMapper.xml
+11
-0
No files found.
dataoperation-server/src/main/java/com/zq/dataoperation/service/CommonQueryService.java
View file @
c24882e5
...
...
@@ -7,6 +7,7 @@ import com.alibaba.druid.pool.DruidPooledConnection;
import
com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.zq.common.exception.BusinessException
;
import
com.zq.common.vo.ResultVo
;
...
...
@@ -16,6 +17,7 @@ import com.zq.dataoperation.entity.CommonQuerySetting;
import
com.zq.dataoperation.entity.QueryDb
;
import
com.zq.dataoperation.utils.ConnectionUtil
;
import
com.zq.spiderflow.dao.MetaDataMappingDao
;
import
com.zq.spiderflow.entity.MetaData
;
import
com.zq.spiderflow.entity.MetaDataMapping
;
import
org.springframework.stereotype.Service
;
...
...
@@ -145,9 +147,7 @@ public class CommonQueryService extends ServiceImpl<CommonQuerySettingDao, Commo
JSONObject
jsonObject
=
JSONUtil
.
parseObj
(
body
);
String
querySql
=
jsonObject
.
get
(
"querySql"
).
toString
();
Long
id
=
Long
.
valueOf
(
jsonObject
.
get
(
"id"
).
toString
());
LambdaQueryWrapper
<
MetaDataMapping
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
MetaDataMapping:
:
getMetadataId
,
id
);
List
<
MetaDataMapping
>
list
=
metaDataMappingDao
.
selectList
(
wrapper
);
List
<
MetaDataMapping
>
list
=
metaDataMappingDao
.
selectByCateId
(
id
);
ResultSet
resultSet
=
null
;
String
tableSqlname
=
null
;
Long
queryDbId
=
null
;
...
...
spider-flow-web/src/main/java/com/zq/spiderflow/dao/MetaDataMappingDao.java
View file @
c24882e5
...
...
@@ -14,4 +14,6 @@ public interface MetaDataMappingDao extends BaseMapper<MetaDataMapping> {
List
<
MetaDataMapping
>
selectRepeat
(
String
tableSqlname
);
List
<
MetaDataMapping
>
getSqlName
();
List
<
MetaDataMapping
>
selectByCateId
(
Long
id
);
}
spider-flow-web/src/main/java/com/zq/spiderflow/service/MetaDataService.java
View file @
c24882e5
...
...
@@ -99,7 +99,8 @@ public class MetaDataService extends ServiceImpl<MetaDataDao, MetaData> {
}
BeanUtil
.
copyProperties
(
parent
,
metaDataCategory
);
metaDataCategory
.
setCategoryType
(
1
);
metaDataCategory
.
setCategoryName
(
file
.
getName
());
String
fileName
=
file
.
getOriginalFilename
().
substring
(
0
,
file
.
getOriginalFilename
().
lastIndexOf
(
"."
));
metaDataCategory
.
setCategoryName
(
fileName
);
metaDataCategoryService
.
save
(
metaDataCategory
);
List
<
List
<
Object
>>
readList
=
reader
.
read
(
1
);
for
(
List
<
Object
>
objectList
:
readList
)
{
...
...
spider-flow-web/src/main/resources/mapper/MetaDataMappingMapper.xml
View file @
c24882e5
...
...
@@ -32,4 +32,15 @@
HAVING
COUNT( table_sqlname ) > 1)
</select>
<select
id=
"selectByCateId"
resultType=
"com.zq.spiderflow.entity.MetaDataMapping"
>
SELECT
DISTINCT
t.table_sqlname,
t.query_db_id
FROM
meta_data_mapping t
LEFT JOIN meta_data m ON t.metadata_id = m.id
LEFT JOIN meta_data_category y ON m.category_id = y.id
WHERE y.id=#{id}
</select>
</mapper>
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