Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-cloud
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data-hook
gic-cloud
Commits
511cca5a
Commit
511cca5a
authored
May 22, 2023
by
fudahua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 回收站
parent
c682f9b3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
0 deletions
+88
-0
StoreCodeQueryFilter.java
...a/hook/service/deal/queryfilter/StoreCodeQueryFilter.java
+1
-0
StoreNameQueryFilter.java
...a/hook/service/deal/queryfilter/StoreNameQueryFilter.java
+1
-0
TestQuery.java
...ud-data-hook-service/src/test/java/com/gic/TestQuery.java
+86
-0
No files found.
gic-cloud-data-hook-service/src/main/java/com/gic/cloud/data/hook/service/deal/queryfilter/StoreCodeQueryFilter.java
View file @
511cca5a
...
...
@@ -43,6 +43,7 @@ public class StoreCodeQueryFilter implements BaseQueryFilter {
StoreSearchDTO
storeSearchDTO
=
new
StoreSearchDTO
();
storeSearchDTO
.
setEnterpriseId
(
context
.
getEnterpriseId
());
storeSearchDTO
.
setSearchName
(
context
.
getSearch
());
storeSearchDTO
.
setStatusIn
(
"-3"
);
Page
retPage
=
storeService
.
storeListPage
(
page
,
storeSearchDTO
);
Page
<
StoreDTO
>
storeDTOPage
=
PageHelperUtils
.
changePageToCurrentPage
(
retPage
,
StoreDTO
.
class
);
...
...
gic-cloud-data-hook-service/src/main/java/com/gic/cloud/data/hook/service/deal/queryfilter/StoreNameQueryFilter.java
View file @
511cca5a
...
...
@@ -41,6 +41,7 @@ public class StoreNameQueryFilter implements BaseQueryFilter {
StoreSearchDTO
storeSearchDTO
=
new
StoreSearchDTO
();
storeSearchDTO
.
setEnterpriseId
(
context
.
getEnterpriseId
());
storeSearchDTO
.
setSearchName
(
context
.
getSearch
());
storeSearchDTO
.
setStatusIn
(
"-3"
);
Page
retPage
=
storeService
.
storeListPage
(
page
,
storeSearchDTO
);
Page
<
StoreDTO
>
storeDTOPage
=
PageHelperUtils
.
changePageToCurrentPage
(
retPage
,
StoreDTO
.
class
);
...
...
gic-cloud-data-hook-service/src/test/java/com/gic/TestQuery.java
0 → 100644
View file @
511cca5a
package
com
.
gic
;
import
cn.hutool.db.Db
;
import
cn.hutool.db.Entity
;
import
com.alibaba.druid.pool.DruidDataSource
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ctrip.framework.apollo.ConfigService
;
import
com.ctrip.framework.apollo.build.ApolloInjector
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.util.ConfigUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
javax.sql.DataSource
;
import
java.sql.SQLException
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
TestQuery
{
public
static
void
main
(
String
[]
args
)
{
System
.
setProperty
(
"env"
,
"dev"
);
Env
env
=
ApolloInjector
.
getInstance
(
ConfigUtil
.
class
).
getApolloEnv
();
System
.
out
.
println
(
"当前activity profile is :"
+
env
.
name
());
ConfigService
.
getAppConfig
();
DruidDataSource
druidDataSource
=
new
DruidDataSource
();
druidDataSource
.
setUrl
(
"jdbc:mysql://10.0.30.101:3306/datahook?useUnicode=true&characterEncoding=utf-8&statementInterceptors=com.gic.commons.mysql.APMStatementInterceptor"
);
druidDataSource
.
setUsername
(
"datahook"
);
druidDataSource
.
setPassword
(
"wyWEbOItmrpeZ4Lq"
);
try
{
Db
db
=
Db
.
use
(
druidDataSource
);
List
<
Entity
>
list
=
db
.
findAll
(
"dh_my_flat_query"
);
List
<
Entity
>
fields
=
db
.
findAll
(
"dh_flat_query_field"
);
Map
<
String
,
String
>
fieldFilterMap
=
new
HashMap
<>();
for
(
Entity
field
:
fields
)
{
Object
filter_code
=
field
.
get
(
"filter_code"
);
String
tableId
=
field
.
getStr
(
"table_id"
);
String
fieldName
=
field
.
getStr
(
"field_name"
);
String
key
=
tableId
+
fieldName
;
if
(
filter_code
!=
null
){
fieldFilterMap
.
put
(
key
,(
String
)
filter_code
);
}
}
for
(
Entity
entity
:
list
)
{
Object
conditions_text
=
entity
.
get
(
"conditions_text"
);
Object
tableId
=
entity
.
get
(
"table_id"
);
Object
id
=
entity
.
get
(
"id"
);
// if (!id.equals("1648002839121")){
// continue;
// }
JSONArray
objects
=
JSONArray
.
parseArray
((
String
)
conditions_text
);
boolean
change
=
false
;
for
(
int
i
=
0
;
i
<
objects
.
size
();
i
++)
{
JSONObject
jsonObject
=
objects
.
getJSONObject
(
i
);
String
fieldName
=
jsonObject
.
getString
(
"fieldName"
);
String
key
=
tableId
+
fieldName
;
String
filterCode
=
fieldFilterMap
.
get
(
key
);
if
(
StringUtils
.
isBlank
(
filterCode
)){
continue
;
}
change
=
true
;
jsonObject
.
put
(
"filterCode"
,
filterCode
);
}
if
(
change
){
String
s
=
objects
.
toJSONString
();
System
.
out
.
println
(
"======================================"
);
System
.
out
.
println
(
"id:"
+
id
);
System
.
out
.
println
(
"原始:"
+
conditions_text
);
System
.
out
.
println
(
"后来:"
+
s
);
db
.
execute
(
"update dh_my_flat_query set conditions_text = ?,update_time=now() where id = ?"
,
s
,
id
);
}
}
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
}
}
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