Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
tool
/
xxl-job
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d127f262
authored
Sep 26, 2019
by
xuxueli
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
update document
1 parent
6716c767
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
49 deletions
xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobGroupDao.java
xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/AdminBizImpl.java
xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobGroupMapper.xml
xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobGroupDao.java
View file @
d127f26
...
...
@@ -16,10 +16,6 @@ public interface XxlJobGroupDao {
public
List
<
XxlJobGroup
>
findByAddressType
(
@Param
(
"addressType"
)
int
addressType
);
public
List
<
XxlJobGroup
>
findAutoRegisterGroupByAppName
(
@Param
(
"appName"
)
String
appName
);
public
int
updateAddressListById
(
@Param
(
"id"
)
int
id
,
@Param
(
"addressList"
)
String
addressList
);
public
int
save
(
XxlJobGroup
xxlJobGroup
);
public
int
update
(
XxlJobGroup
xxlJobGroup
);
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/AdminBizImpl.java
View file @
d127f26
package
com
.
xxl
.
job
.
admin
.
service
.
impl
;
import
com.xxl.job.admin.core.model.XxlJobGroup
;
import
com.xxl.job.admin.core.model.XxlJobInfo
;
import
com.xxl.job.admin.core.model.XxlJobLog
;
import
com.xxl.job.admin.core.thread.JobTriggerPoolHelper
;
...
...
@@ -18,8 +17,6 @@ import com.xxl.job.core.handler.IJobHandler;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.StringUtils
;
import
javax.annotation.Resource
;
import
java.text.MessageFormat
;
...
...
@@ -132,6 +129,9 @@ public class AdminBizImpl implements AdminBiz {
int
ret
=
xxlJobRegistryDao
.
registryUpdate
(
registryParam
.
getRegistGroup
(),
registryParam
.
getRegistryKey
(),
registryParam
.
getRegistryValue
());
if
(
ret
<
1
)
{
xxlJobRegistryDao
.
registrySave
(
registryParam
.
getRegistGroup
(),
registryParam
.
getRegistryKey
(),
registryParam
.
getRegistryValue
());
// fresh
freshGroupRegistryInfo
(
registryParam
);
}
return
ReturnT
.
SUCCESS
;
}
...
...
@@ -139,39 +139,16 @@ public class AdminBizImpl implements AdminBiz {
@Override
public
ReturnT
<
String
>
registryRemove
(
RegistryParam
registryParam
)
{
int
ret
=
xxlJobRegistryDao
.
registryDelete
(
registryParam
.
getRegistGroup
(),
registryParam
.
getRegistryKey
(),
registryParam
.
getRegistryValue
());
if
(
ret
==
1
)
{
List
<
XxlJobGroup
>
autoRegisterGroups
=
xxlJobGroupDao
.
findAutoRegisterGroupByAppName
(
registryParam
.
getRegistryKey
());
removeRegisterFromGroups
(
autoRegisterGroups
,
registryParam
.
getRegistryValue
());
if
(
ret
>
0
)
{
// fresh
freshGroupRegistryInfo
(
registryParam
);
}
return
ReturnT
.
SUCCESS
;
}
private
void
removeRegisterFromGroups
(
List
<
XxlJobGroup
>
groups
,
String
address
)
{
if
(
StringUtils
.
isEmpty
(
address
))
{
return
;
}
if
(
CollectionUtils
.
isEmpty
(
groups
))
{
return
;
}
for
(
XxlJobGroup
group
:
groups
)
{
List
<
String
>
addressList
=
group
.
getRegistryList
();
if
(
addressList
==
null
)
{
continue
;
}
if
(!
addressList
.
contains
(
address
))
{
continue
;
}
addressList
.
remove
(
address
);
String
newAddressListStr
=
StringUtils
.
collectionToCommaDelimitedString
(
addressList
);
String
oldAddressListStr
=
group
.
getAddressList
();
int
update
=
xxlJobGroupDao
.
updateAddressListById
(
group
.
getId
(),
newAddressListStr
);
if
(
logger
.
isDebugEnabled
())
{
logger
.
debug
(
"update group name [{}] title [{}] old address list [{}] new address list [{}] update result [{}]"
,
group
.
getAppName
(),
group
.
getTitle
(),
oldAddressListStr
,
newAddressListStr
,
update
);
}
}
private
void
freshGroupRegistryInfo
(
RegistryParam
registryParam
){
// Under consideration, prevent affecting core tables
}
}
xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobGroupMapper.xml
View file @
d127f26
...
...
@@ -27,13 +27,6 @@
ORDER BY t.order ASC
</select>
<select
id=
"findAutoRegisterGroupByAppName"
resultMap=
"XxlJobGroup"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM xxl_job_group AS t
WHERE `app_name` = #{appName}
AND `address_type` = 0
</select>
<select
id=
"findByAddressType"
parameterType=
"java.lang.Integer"
resultMap=
"XxlJobGroup"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM xxl_job_group AS t
...
...
@@ -56,12 +49,6 @@
WHERE id = #{id}
</update>
<update
id=
"updateAddressListById"
>
UPDATE xxl_job_group
SET `address_list` = #{addressList}
WHERE id = #{id}
</update>
<delete
id=
"remove"
parameterType=
"java.lang.Integer"
>
DELETE FROM xxl_job_group
WHERE id = #{id}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment