Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
Project
Project
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
wangpeng
dinky
Commits
25e65271
Unverified
Commit
25e65271
authored
Oct 30, 2023
by
cainiao-cnj
Committed by
GitHub
Oct 30, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor admin's bean define (#2445)
Co-authored-by:
shuhang.chang
<
shuhang.chang@mtime
>
parent
fd3dea14
Show whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
600 additions
and
84 deletions
+600
-84
AlertInstanceController.java
...in/java/org/dinky/controller/AlertInstanceController.java
+8
-7
ClusterInstanceController.java
.../java/org/dinky/controller/ClusterInstanceController.java
+10
-8
DataBaseController.java
...rc/main/java/org/dinky/controller/DataBaseController.java
+19
-18
MenuController.java
...in/src/main/java/org/dinky/controller/MenuController.java
+11
-10
RoleController.java
...in/src/main/java/org/dinky/controller/RoleController.java
+7
-6
RoleMenuController.java
...rc/main/java/org/dinky/controller/RoleMenuController.java
+4
-4
AlertInstanceDTO.java
...in/src/main/java/org/dinky/data/dto/AlertInstanceDTO.java
+72
-0
AssignMenuToRoleDTO.java
...src/main/java/org/dinky/data/dto/AssignMenuToRoleDTO.java
+1
-1
ClusterInstanceDTO.java
.../src/main/java/org/dinky/data/dto/ClusterInstanceDTO.java
+119
-0
DataBaseDTO.java
...y-admin/src/main/java/org/dinky/data/dto/DataBaseDTO.java
+95
-0
MenuDTO.java
dinky-admin/src/main/java/org/dinky/data/dto/MenuDTO.java
+113
-0
RoleDTO.java
dinky-admin/src/main/java/org/dinky/data/dto/RoleDTO.java
+76
-0
RoleMenuDTO.java
...y-admin/src/main/java/org/dinky/data/dto/RoleMenuDTO.java
+1
-1
Job2MysqlHandler.java
...y-admin/src/main/java/org/dinky/job/Job2MysqlHandler.java
+3
-2
AlertInstanceService.java
...src/main/java/org/dinky/service/AlertInstanceService.java
+3
-2
ClusterInstanceService.java
...c/main/java/org/dinky/service/ClusterInstanceService.java
+10
-1
DataBaseService.java
...dmin/src/main/java/org/dinky/service/DataBaseService.java
+7
-6
MenuService.java
dinky-admin/src/main/java/org/dinky/service/MenuService.java
+3
-2
RoleMenuService.java
...dmin/src/main/java/org/dinky/service/RoleMenuService.java
+2
-2
RoleService.java
dinky-admin/src/main/java/org/dinky/service/RoleService.java
+3
-2
AlertInstanceServiceImpl.java
...java/org/dinky/service/impl/AlertInstanceServiceImpl.java
+3
-2
ClusterInstanceServiceImpl.java
...va/org/dinky/service/impl/ClusterInstanceServiceImpl.java
+10
-1
DataBaseServiceImpl.java
...main/java/org/dinky/service/impl/DataBaseServiceImpl.java
+9
-4
MenuServiceImpl.java
...src/main/java/org/dinky/service/impl/MenuServiceImpl.java
+5
-2
RoleMenuServiceImpl.java
...main/java/org/dinky/service/impl/RoleMenuServiceImpl.java
+2
-2
RoleServiceImpl.java
...src/main/java/org/dinky/service/impl/RoleServiceImpl.java
+4
-1
No files found.
dinky-admin/src/main/java/org/dinky/controller/AlertInstanceController.java
View file @
25e65271
...
@@ -23,6 +23,7 @@ import org.dinky.alert.AlertPool;
...
@@ -23,6 +23,7 @@ import org.dinky.alert.AlertPool;
import
org.dinky.alert.AlertResult
;
import
org.dinky.alert.AlertResult
;
import
org.dinky.data.annotation.Log
;
import
org.dinky.data.annotation.Log
;
import
org.dinky.data.constant.PermissionConstants
;
import
org.dinky.data.constant.PermissionConstants
;
import
org.dinky.data.dto.AlertInstanceDTO
;
import
org.dinky.data.enums.BusinessType
;
import
org.dinky.data.enums.BusinessType
;
import
org.dinky.data.enums.Status
;
import
org.dinky.data.enums.Status
;
import
org.dinky.data.model.AlertInstance
;
import
org.dinky.data.model.AlertInstance
;
...
@@ -186,21 +187,21 @@ public class AlertInstanceController {
...
@@ -186,21 +187,21 @@ public class AlertInstanceController {
/**
/**
* send test alert message
* send test alert message
*
*
* @param alertInstance
{@link AlertInstance
}
* @param alertInstance
DTO {@link AlertInstanceDTO
}
* @return {@link Result} of {@link Void}
* @return {@link Result} of {@link Void}
*/
*/
@PostMapping
(
"/sendTest"
)
@PostMapping
(
"/sendTest"
)
@Log
(
title
=
"Test Send To AlertInstance"
,
businessType
=
BusinessType
.
TEST
)
@Log
(
title
=
"Test Send To AlertInstance"
,
businessType
=
BusinessType
.
TEST
)
@ApiOperation
(
"Test Send To AlertInstance"
)
@ApiOperation
(
"Test Send To AlertInstance"
)
@ApiImplicitParam
(
@ApiImplicitParam
(
name
=
"alertInstance"
,
name
=
"alertInstance
DTO
"
,
value
=
"AlertInstance"
,
value
=
"AlertInstance
DTO
"
,
dataType
=
"AlertInstance"
,
dataType
=
"AlertInstance
DTO
"
,
paramType
=
"body"
,
paramType
=
"body"
,
required
=
true
,
required
=
true
,
dataTypeClass
=
AlertInstance
.
class
)
dataTypeClass
=
AlertInstance
DTO
.
class
)
public
Result
<
Void
>
sendAlertMsgTest
(
@RequestBody
AlertInstance
alertInstance
)
{
public
Result
<
Void
>
sendAlertMsgTest
(
@RequestBody
AlertInstance
DTO
alertInstanceDTO
)
{
AlertResult
alertResult
=
alertInstanceService
.
testAlert
(
alertInstance
);
AlertResult
alertResult
=
alertInstanceService
.
testAlert
(
alertInstance
DTO
);
if
(
alertResult
.
getSuccess
())
{
if
(
alertResult
.
getSuccess
())
{
return
Result
.
succeed
(
Status
.
SEND_TEST_SUCCESS
);
return
Result
.
succeed
(
Status
.
SEND_TEST_SUCCESS
);
}
else
{
}
else
{
...
...
dinky-admin/src/main/java/org/dinky/controller/ClusterInstanceController.java
View file @
25e65271
...
@@ -21,6 +21,7 @@ package org.dinky.controller;
...
@@ -21,6 +21,7 @@ package org.dinky.controller;
import
org.dinky.data.annotation.Log
;
import
org.dinky.data.annotation.Log
;
import
org.dinky.data.constant.PermissionConstants
;
import
org.dinky.data.constant.PermissionConstants
;
import
org.dinky.data.dto.ClusterInstanceDTO
;
import
org.dinky.data.enums.BusinessType
;
import
org.dinky.data.enums.BusinessType
;
import
org.dinky.data.enums.Status
;
import
org.dinky.data.enums.Status
;
import
org.dinky.data.model.ClusterInstance
;
import
org.dinky.data.model.ClusterInstance
;
...
@@ -63,7 +64,7 @@ public class ClusterInstanceController {
...
@@ -63,7 +64,7 @@ public class ClusterInstanceController {
/**
/**
* added or updated cluster instance
* added or updated cluster instance
*
*
* @param clusterInstance
{@link ClusterInstance
} cluster instance
* @param clusterInstance
DTO {@link ClusterInstanceDTO
} cluster instance
* @return {@link Result}<{@link Void}>
* @return {@link Result}<{@link Void}>
* @throws Exception exception
* @throws Exception exception
*/
*/
...
@@ -71,21 +72,22 @@ public class ClusterInstanceController {
...
@@ -71,21 +72,22 @@ public class ClusterInstanceController {
@Log
(
title
=
"Insert Or Update Cluster Instance"
,
businessType
=
BusinessType
.
INSERT_OR_UPDATE
)
@Log
(
title
=
"Insert Or Update Cluster Instance"
,
businessType
=
BusinessType
.
INSERT_OR_UPDATE
)
@ApiOperation
(
"Insert Or Update Cluster Instance"
)
@ApiOperation
(
"Insert Or Update Cluster Instance"
)
@ApiImplicitParam
(
@ApiImplicitParam
(
name
=
"clusterInstance"
,
name
=
"clusterInstance
DTO
"
,
value
=
"ClusterInstance Instance"
,
value
=
"ClusterInstance
DTO
Instance"
,
dataType
=
"ClusterInstance"
,
dataType
=
"ClusterInstance
DTO
"
,
paramType
=
"body"
,
paramType
=
"body"
,
required
=
true
,
required
=
true
,
dataTypeClass
=
ClusterInstance
.
class
)
dataTypeClass
=
ClusterInstance
DTO
.
class
)
@SaCheckPermission
(
@SaCheckPermission
(
value
=
{
value
=
{
PermissionConstants
.
REGISTRATION_CLUSTER_INSTANCE_EDIT
,
PermissionConstants
.
REGISTRATION_CLUSTER_INSTANCE_EDIT
,
PermissionConstants
.
REGISTRATION_CLUSTER_INSTANCE_ADD
PermissionConstants
.
REGISTRATION_CLUSTER_INSTANCE_ADD
},
},
mode
=
SaMode
.
OR
)
mode
=
SaMode
.
OR
)
public
Result
<
Void
>
saveOrUpdateClusterInstance
(
@RequestBody
ClusterInstance
clusterInstance
)
throws
Exception
{
public
Result
<
Void
>
saveOrUpdateClusterInstance
(
@RequestBody
ClusterInstanceDTO
clusterInstanceDTO
)
clusterInstance
.
setAutoRegisters
(
false
);
throws
Exception
{
clusterInstanceService
.
registersCluster
(
clusterInstance
);
clusterInstanceDTO
.
setAutoRegisters
(
false
);
clusterInstanceService
.
registersCluster
(
clusterInstanceDTO
);
return
Result
.
succeed
(
Status
.
SAVE_SUCCESS
);
return
Result
.
succeed
(
Status
.
SAVE_SUCCESS
);
}
}
...
...
dinky-admin/src/main/java/org/dinky/controller/DataBaseController.java
View file @
25e65271
...
@@ -23,6 +23,7 @@ import org.dinky.assertion.Asserts;
...
@@ -23,6 +23,7 @@ import org.dinky.assertion.Asserts;
import
org.dinky.data.annotation.Log
;
import
org.dinky.data.annotation.Log
;
import
org.dinky.data.constant.CommonConstant
;
import
org.dinky.data.constant.CommonConstant
;
import
org.dinky.data.constant.PermissionConstants
;
import
org.dinky.data.constant.PermissionConstants
;
import
org.dinky.data.dto.DataBaseDTO
;
import
org.dinky.data.enums.BusinessType
;
import
org.dinky.data.enums.BusinessType
;
import
org.dinky.data.enums.Status
;
import
org.dinky.data.enums.Status
;
import
org.dinky.data.model.Column
;
import
org.dinky.data.model.Column
;
...
@@ -77,26 +78,26 @@ public class DataBaseController {
...
@@ -77,26 +78,26 @@ public class DataBaseController {
/**
/**
* save or update database
* save or update database
*
*
* @param data
base {@link DataBase
}
* @param data
BaseDTO {@link DataBaseDTO
}
* @return {@link Result}< {@link Void}>
* @return {@link Result}< {@link Void}>
*/
*/
@PutMapping
@PutMapping
@Log
(
title
=
"Insert Or Update DataBase"
,
businessType
=
BusinessType
.
INSERT_OR_UPDATE
)
@Log
(
title
=
"Insert Or Update DataBase"
,
businessType
=
BusinessType
.
INSERT_OR_UPDATE
)
@ApiOperation
(
"Insert Or Update DataBase"
)
@ApiOperation
(
"Insert Or Update DataBase"
)
@ApiImplicitParam
(
@ApiImplicitParam
(
name
=
"database"
,
name
=
"database
DTO
"
,
value
=
"DataBase"
,
value
=
"DataBase
DTO
"
,
required
=
true
,
required
=
true
,
dataType
=
"DataBase"
,
dataType
=
"DataBase
DTO
"
,
paramType
=
"body"
,
paramType
=
"body"
,
dataTypeClass
=
DataBase
.
class
)
dataTypeClass
=
DataBase
DTO
.
class
)
@SaCheckPermission
(
@SaCheckPermission
(
value
=
{
PermissionConstants
.
REGISTRATION_DATA_SOURCE_ADD
,
PermissionConstants
.
REGISTRATION_DATA_SOURCE_EDIT
value
=
{
PermissionConstants
.
REGISTRATION_DATA_SOURCE_ADD
,
PermissionConstants
.
REGISTRATION_DATA_SOURCE_EDIT
},
},
mode
=
SaMode
.
OR
)
mode
=
SaMode
.
OR
)
public
Result
<
Void
>
saveOrUpdateDataBase
(
@RequestBody
DataBase
database
)
{
public
Result
<
Void
>
saveOrUpdateDataBase
(
@RequestBody
DataBase
DTO
dataBaseDTO
)
{
if
(
databaseService
.
saveOrUpdateDataBase
(
data
base
))
{
if
(
databaseService
.
saveOrUpdateDataBase
(
data
BaseDTO
))
{
DriverPool
.
remove
(
data
base
.
getName
());
DriverPool
.
remove
(
data
BaseDTO
.
getName
());
return
Result
.
succeed
(
Status
.
SAVE_SUCCESS
);
return
Result
.
succeed
(
Status
.
SAVE_SUCCESS
);
}
else
{
}
else
{
return
Result
.
failed
(
Status
.
SAVE_FAILED
);
return
Result
.
failed
(
Status
.
SAVE_FAILED
);
...
@@ -192,21 +193,21 @@ public class DataBaseController {
...
@@ -192,21 +193,21 @@ public class DataBaseController {
/**
/**
* test connect database
* test connect database
*
*
* @param data
base {@link DataBase
}
* @param data
BaseDTO {@link DataBaseDTO
}
* @return {@link Result}< {@link Void}>
* @return {@link Result}< {@link Void}>
*/
*/
@PostMapping
(
"/testConnect"
)
@PostMapping
(
"/testConnect"
)
@Log
(
title
=
"DataBase Test Connect"
,
businessType
=
BusinessType
.
TEST
)
@Log
(
title
=
"DataBase Test Connect"
,
businessType
=
BusinessType
.
TEST
)
@ApiOperation
(
"DataBase Test Connect"
)
@ApiOperation
(
"DataBase Test Connect"
)
@ApiImplicitParam
(
@ApiImplicitParam
(
name
=
"data
base
"
,
name
=
"data
BaseDTO
"
,
value
=
"DataBase"
,
value
=
"DataBase
DTO
"
,
required
=
true
,
required
=
true
,
dataType
=
"DataBase"
,
dataType
=
"DataBase
DTO
"
,
paramType
=
"body"
,
paramType
=
"body"
,
dataTypeClass
=
DataBase
.
class
)
dataTypeClass
=
DataBase
DTO
.
class
)
public
Result
<
Void
>
testConnect
(
@RequestBody
DataBase
database
)
{
public
Result
<
Void
>
testConnect
(
@RequestBody
DataBase
DTO
dataBaseDTO
)
{
String
msg
=
databaseService
.
testConnect
(
data
base
);
String
msg
=
databaseService
.
testConnect
(
data
BaseDTO
);
boolean
isHealthy
=
Asserts
.
isEquals
(
CommonConstant
.
HEALTHY
,
msg
);
boolean
isHealthy
=
Asserts
.
isEquals
(
CommonConstant
.
HEALTHY
,
msg
);
if
(
isHealthy
)
{
if
(
isHealthy
)
{
return
Result
.
succeed
(
Status
.
DATASOURCE_CONNECT_SUCCESS
);
return
Result
.
succeed
(
Status
.
DATASOURCE_CONNECT_SUCCESS
);
...
@@ -428,15 +429,15 @@ public class DataBaseController {
...
@@ -428,15 +429,15 @@ public class DataBaseController {
/**
/**
* copy database
* copy database
*
*
* @param data
base {@link DataBase
}
* @param data
BaseDTO {@link DataBaseDTO
}
* @return {@link Result}< {@link Void}>
* @return {@link Result}< {@link Void}>
*/
*/
@PostMapping
(
"/copyDatabase"
)
@PostMapping
(
"/copyDatabase"
)
@Log
(
title
=
"Copy Database"
,
businessType
=
BusinessType
.
INSERT_OR_UPDATE
)
@Log
(
title
=
"Copy Database"
,
businessType
=
BusinessType
.
INSERT_OR_UPDATE
)
@ApiOperation
(
"Copy Database"
)
@ApiOperation
(
"Copy Database"
)
@SaCheckPermission
(
PermissionConstants
.
REGISTRATION_DATA_SOURCE_COPY
)
@SaCheckPermission
(
PermissionConstants
.
REGISTRATION_DATA_SOURCE_COPY
)
public
Result
<
Void
>
copyDatabase
(
@RequestBody
DataBase
database
)
{
public
Result
<
Void
>
copyDatabase
(
@RequestBody
DataBase
DTO
dataBaseDTO
)
{
if
(
databaseService
.
copyDatabase
(
data
base
))
{
if
(
databaseService
.
copyDatabase
(
data
BaseDTO
))
{
return
Result
.
succeed
(
Status
.
COPY_SUCCESS
);
return
Result
.
succeed
(
Status
.
COPY_SUCCESS
);
}
else
{
}
else
{
return
Result
.
failed
(
Status
.
COPY_FAILED
);
return
Result
.
failed
(
Status
.
COPY_FAILED
);
...
...
dinky-admin/src/main/java/org/dinky/controller/MenuController.java
View file @
25e65271
...
@@ -21,7 +21,8 @@ package org.dinky.controller;
...
@@ -21,7 +21,8 @@ package org.dinky.controller;
import
org.dinky.data.annotation.Log
;
import
org.dinky.data.annotation.Log
;
import
org.dinky.data.constant.PermissionConstants
;
import
org.dinky.data.constant.PermissionConstants
;
import
org.dinky.data.dto.RoleMenuDto
;
import
org.dinky.data.dto.MenuDTO
;
import
org.dinky.data.dto.RoleMenuDTO
;
import
org.dinky.data.dto.TreeNodeDTO
;
import
org.dinky.data.dto.TreeNodeDTO
;
import
org.dinky.data.enums.BusinessType
;
import
org.dinky.data.enums.BusinessType
;
import
org.dinky.data.enums.Status
;
import
org.dinky.data.enums.Status
;
...
@@ -59,16 +60,16 @@ public class MenuController {
...
@@ -59,16 +60,16 @@ public class MenuController {
/**
/**
* save or update menu
* save or update menu
*
*
* @param menu
{@link Menu
}
* @param menu
DTO {@link MenuDTO
}
* @return {@link Result} with {@link Void}
* @return {@link Result} with {@link Void}
*/
*/
@PutMapping
(
"addOrUpdate"
)
@PutMapping
(
"addOrUpdate"
)
@Log
(
title
=
"Insert Or Update Menu "
,
businessType
=
BusinessType
.
INSERT_OR_UPDATE
)
@Log
(
title
=
"Insert Or Update Menu "
,
businessType
=
BusinessType
.
INSERT_OR_UPDATE
)
@ApiOperation
(
"Insert Or Update Menu"
)
@ApiOperation
(
"Insert Or Update Menu"
)
@ApiImplicitParam
(
@ApiImplicitParam
(
name
=
"menu"
,
name
=
"menu
DTO
"
,
value
=
"Menu"
,
value
=
"Menu
DTO
"
,
dataType
=
"Menu"
,
dataType
=
"Menu
DTO
"
,
paramType
=
"body"
,
paramType
=
"body"
,
required
=
true
,
required
=
true
,
dataTypeClass
=
Menu
.
class
)
dataTypeClass
=
Menu
.
class
)
...
@@ -79,8 +80,8 @@ public class MenuController {
...
@@ -79,8 +80,8 @@ public class MenuController {
PermissionConstants
.
AUTH_MENU_ADD_SUB
PermissionConstants
.
AUTH_MENU_ADD_SUB
},
},
mode
=
SaMode
.
OR
)
mode
=
SaMode
.
OR
)
public
Result
<
Void
>
saveOrUpdateMenu
(
@RequestBody
Menu
menu
)
{
public
Result
<
Void
>
saveOrUpdateMenu
(
@RequestBody
Menu
DTO
menuDTO
)
{
if
(
menuService
.
saveOrUpdateMenu
(
menu
))
{
if
(
menuService
.
saveOrUpdateMenu
(
menu
DTO
))
{
return
Result
.
succeed
(
Status
.
SAVE_SUCCESS
);
return
Result
.
succeed
(
Status
.
SAVE_SUCCESS
);
}
else
{
}
else
{
return
Result
.
failed
(
Status
.
SAVE_FAILED
);
return
Result
.
failed
(
Status
.
SAVE_FAILED
);
...
@@ -118,14 +119,14 @@ public class MenuController {
...
@@ -118,14 +119,14 @@ public class MenuController {
* load role menu tree
* load role menu tree
*
*
* @param roleId role id
* @param roleId role id
* @return {@link RoleMenuD
to
}
* @return {@link RoleMenuD
TO
}
*/
*/
@GetMapping
(
value
=
"/roleMenus"
)
@GetMapping
(
value
=
"/roleMenus"
)
@ApiOperation
(
"Load Role Menu"
)
@ApiOperation
(
"Load Role Menu"
)
@ApiImplicitParam
(
name
=
"roleId"
,
value
=
"Role Id"
,
dataType
=
"Integer"
,
paramType
=
"query"
,
required
=
true
)
@ApiImplicitParam
(
name
=
"roleId"
,
value
=
"Role Id"
,
dataType
=
"Integer"
,
paramType
=
"query"
,
required
=
true
)
public
Result
<
RoleMenuD
to
>
roleMenuTreeSelect
(
@RequestParam
(
"id"
)
Integer
roleId
)
{
public
Result
<
RoleMenuD
TO
>
roleMenuTreeSelect
(
@RequestParam
(
"id"
)
Integer
roleId
)
{
List
<
Menu
>
menus
=
menuService
.
buildMenuTree
(
menuService
.
list
());
List
<
Menu
>
menus
=
menuService
.
buildMenuTree
(
menuService
.
list
());
RoleMenuD
to
menuVO
=
RoleMenuDto
.
builder
()
RoleMenuD
TO
menuVO
=
RoleMenuDTO
.
builder
()
.
roleId
(
roleId
)
.
roleId
(
roleId
)
.
selectedMenuIds
(
menuService
.
selectMenuListByRoleId
(
roleId
))
.
selectedMenuIds
(
menuService
.
selectMenuListByRoleId
(
roleId
))
.
menus
(
menus
)
.
menus
(
menus
)
...
...
dinky-admin/src/main/java/org/dinky/controller/RoleController.java
View file @
25e65271
...
@@ -21,6 +21,7 @@ package org.dinky.controller;
...
@@ -21,6 +21,7 @@ package org.dinky.controller;
import
org.dinky.data.annotation.Log
;
import
org.dinky.data.annotation.Log
;
import
org.dinky.data.constant.PermissionConstants
;
import
org.dinky.data.constant.PermissionConstants
;
import
org.dinky.data.dto.RoleDTO
;
import
org.dinky.data.enums.BusinessType
;
import
org.dinky.data.enums.BusinessType
;
import
org.dinky.data.model.Role
;
import
org.dinky.data.model.Role
;
import
org.dinky.data.model.User
;
import
org.dinky.data.model.User
;
...
@@ -66,24 +67,24 @@ public class RoleController {
...
@@ -66,24 +67,24 @@ public class RoleController {
/**
/**
* create or update role
* create or update role
*
*
* @param role {@link Role}
* @param role
DTO
{@link Role}
* @return {@link Role} of {@link Void}
* @return {@link Role} of {@link Void}
*/
*/
@PutMapping
(
"/addedOrUpdateRole"
)
@PutMapping
(
"/addedOrUpdateRole"
)
@ApiOperation
(
"Insert Or Update Role"
)
@ApiOperation
(
"Insert Or Update Role"
)
@Log
(
title
=
"Insert Or Update Role"
,
businessType
=
BusinessType
.
INSERT_OR_UPDATE
)
@Log
(
title
=
"Insert Or Update Role"
,
businessType
=
BusinessType
.
INSERT_OR_UPDATE
)
@ApiImplicitParam
(
@ApiImplicitParam
(
name
=
"role"
,
name
=
"role
DTO
"
,
value
=
"
role
"
,
value
=
"
RoleDTO
"
,
required
=
true
,
required
=
true
,
dataType
=
"Role"
,
dataType
=
"Role
DTO
"
,
paramType
=
"body"
,
paramType
=
"body"
,
dataTypeClass
=
Role
.
class
)
dataTypeClass
=
Role
.
class
)
@SaCheckPermission
(
@SaCheckPermission
(
value
=
{
PermissionConstants
.
AUTH_ROLE_ADD
,
PermissionConstants
.
AUTH_ROLE_EDIT
},
value
=
{
PermissionConstants
.
AUTH_ROLE_ADD
,
PermissionConstants
.
AUTH_ROLE_EDIT
},
mode
=
SaMode
.
OR
)
mode
=
SaMode
.
OR
)
public
Result
<
Void
>
addedOrUpdateRole
(
@RequestBody
Role
role
)
{
public
Result
<
Void
>
addedOrUpdateRole
(
@RequestBody
Role
DTO
roleDTO
)
{
return
roleService
.
addedOrUpdateRole
(
role
);
return
roleService
.
addedOrUpdateRole
(
role
DTO
);
}
}
/**
/**
...
...
dinky-admin/src/main/java/org/dinky/controller/RoleMenuController.java
View file @
25e65271
...
@@ -21,7 +21,7 @@ package org.dinky.controller;
...
@@ -21,7 +21,7 @@ package org.dinky.controller;
import
org.dinky.data.annotation.Log
;
import
org.dinky.data.annotation.Log
;
import
org.dinky.data.constant.PermissionConstants
;
import
org.dinky.data.constant.PermissionConstants
;
import
org.dinky.data.dto.AssignMenuToRoleD
to
;
import
org.dinky.data.dto.AssignMenuToRoleD
TO
;
import
org.dinky.data.enums.BusinessType
;
import
org.dinky.data.enums.BusinessType
;
import
org.dinky.data.result.Result
;
import
org.dinky.data.result.Result
;
import
org.dinky.service.RoleMenuService
;
import
org.dinky.service.RoleMenuService
;
...
@@ -50,7 +50,7 @@ public class RoleMenuController {
...
@@ -50,7 +50,7 @@ public class RoleMenuController {
/**
/**
* assign menus to role
* assign menus to role
*
*
* @param assignMenuToRoleD
to
* @param assignMenuToRoleD
TO
* @return {@link Result} with {@link Void}
* @return {@link Result} with {@link Void}
*/
*/
@PostMapping
(
"assignMenuToRole"
)
@PostMapping
(
"assignMenuToRole"
)
...
@@ -63,7 +63,7 @@ public class RoleMenuController {
...
@@ -63,7 +63,7 @@ public class RoleMenuController {
dataType
=
"AssignMenuToRoleDto"
,
dataType
=
"AssignMenuToRoleDto"
,
paramType
=
"body"
)
paramType
=
"body"
)
@SaCheckPermission
(
PermissionConstants
.
AUTH_ROLE_ASSIGN_MENU
)
@SaCheckPermission
(
PermissionConstants
.
AUTH_ROLE_ASSIGN_MENU
)
public
Result
<
Void
>
assignMenuToRole
(
@RequestBody
AssignMenuToRoleD
to
assignMenuToRoleDto
)
{
public
Result
<
Void
>
assignMenuToRole
(
@RequestBody
AssignMenuToRoleD
TO
assignMenuToRoleDTO
)
{
return
roleMenuService
.
assignMenuToRole
(
assignMenuToRoleD
to
);
return
roleMenuService
.
assignMenuToRole
(
assignMenuToRoleD
TO
);
}
}
}
}
dinky-admin/src/main/java/org/dinky/data/dto/AlertInstanceDTO.java
0 → 100644
View file @
25e65271
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org
.
dinky
.
data
.
dto
;
import
org.dinky.mybatis.annotation.Save
;
import
javax.validation.constraints.NotNull
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.Extension
;
import
io.swagger.annotations.ExtensionProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* AlertInstanceDTO
*
* @since 2023/10/20 16:36
**/
@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel
(
value
=
"AlertInstanceDTO"
,
description
=
"API Alert Instance Data Transfer Object"
)
public
class
AlertInstanceDTO
{
@NotNull
(
message
=
"Name cannot be null"
,
groups
=
{
Save
.
class
})
@ApiModelProperty
(
value
=
"Name"
,
required
=
true
,
dataType
=
"String"
,
example
=
"Name"
)
private
String
name
;
@ApiModelProperty
(
value
=
"Tenant ID"
,
required
=
true
,
dataType
=
"Integer"
,
example
=
"1"
)
private
Integer
tenantId
;
@ApiModelProperty
(
value
=
"Alert Instance Type"
,
required
=
true
,
dataType
=
"String"
,
example
=
"DingTalk"
,
extensions
=
{
@Extension
(
name
=
"alertType-enum"
,
properties
=
{
@ExtensionProperty
(
name
=
"values"
,
value
=
"DingTalk,WeChat,Email,FeiShu,Sms"
)})
})
private
String
type
;
@ApiModelProperty
(
value
=
"Alert Instance Params"
,
required
=
true
,
dataType
=
"String"
,
example
=
"{\"webhook\":\"https://oapi.dingtalk.com/robot/send?access_token=xxxxxx\"}"
)
private
String
params
;
}
dinky-admin/src/main/java/org/dinky/data/dto/AssignMenuToRoleD
to
.java
→
dinky-admin/src/main/java/org/dinky/data/dto/AssignMenuToRoleD
TO
.java
View file @
25e65271
...
@@ -31,7 +31,7 @@ import lombok.NoArgsConstructor;
...
@@ -31,7 +31,7 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
@ApiModel
(
value
=
"AssignMenuToRoleDto"
,
description
=
"DTO for assigning menus to a role"
)
@ApiModel
(
value
=
"AssignMenuToRoleDto"
,
description
=
"DTO for assigning menus to a role"
)
public
class
AssignMenuToRoleD
to
{
public
class
AssignMenuToRoleD
TO
{
@ApiModelProperty
(
value
=
"Role ID"
,
dataType
=
"Integer"
,
example
=
"1"
,
notes
=
"The ID of the role"
)
@ApiModelProperty
(
value
=
"Role ID"
,
dataType
=
"Integer"
,
example
=
"1"
,
notes
=
"The ID of the role"
)
private
Integer
roleId
;
private
Integer
roleId
;
...
...
dinky-admin/src/main/java/org/dinky/data/dto/ClusterInstanceDTO.java
0 → 100644
View file @
25e65271
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org
.
dinky
.
data
.
dto
;
import
org.dinky.data.model.ClusterInstance
;
import
org.dinky.mybatis.annotation.Save
;
import
javax.validation.constraints.NotNull
;
import
cn.hutool.core.bean.BeanUtil
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* ClusterInstanceDTO
*
* @since 2023/10/23 10:18
**/
@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel
(
value
=
"ClusterInstanceDTO"
,
description
=
"API Cluster Instance Data Transfer Object"
)
public
class
ClusterInstanceDTO
{
@ApiModelProperty
(
value
=
"Name"
,
required
=
true
,
dataType
=
"String"
,
example
=
"Name"
)
private
String
name
;
@ApiModelProperty
(
value
=
"alias"
,
required
=
true
,
dataType
=
"String"
,
example
=
"test"
,
notes
=
"cluster alias, if this is auto register, it will be has value, and can not modify it"
)
private
String
alias
;
@ApiModelProperty
(
value
=
"type"
,
required
=
true
,
dataType
=
"String"
,
example
=
"test"
,
notes
=
"cluster type, such as: standalone ,yarn-session"
)
private
String
type
;
@ApiModelProperty
(
value
=
"hosts"
,
required
=
true
,
dataType
=
"String"
,
example
=
"test"
,
notes
=
"cluster hosts"
)
private
String
hosts
;
@ApiModelProperty
(
value
=
"jobManagerHost"
,
required
=
true
,
dataType
=
"String"
,
example
=
"test"
,
notes
=
"job manager host"
)
private
String
jobManagerHost
;
@ApiModelProperty
(
value
=
"autoRegisters"
,
required
=
true
,
dataType
=
"Boolean"
,
example
=
"test"
,
notes
=
"is auto registers, if this record from projob/application mode , it will be true"
)
private
Boolean
autoRegisters
;
@ApiModelProperty
(
value
=
"clusterConfigurationId"
,
required
=
true
,
dataType
=
"Integer"
,
example
=
"test"
,
notes
=
"cluster configuration id"
)
private
Integer
clusterConfigurationId
;
@ApiModelProperty
(
value
=
"taskId"
,
required
=
true
,
dataType
=
"Integer"
,
example
=
"test"
,
notes
=
"task id"
)
private
Integer
taskId
;
@NotNull
(
message
=
"Enabled cannot be null"
,
groups
=
{
Save
.
class
})
@ApiModelProperty
(
value
=
"Enabled"
,
required
=
true
,
dataType
=
"Boolean"
,
example
=
"true"
)
private
Boolean
enabled
;
public
ClusterInstance
toBean
()
{
ClusterInstance
clusterInstance
=
new
ClusterInstance
();
BeanUtil
.
copyProperties
(
this
,
clusterInstance
);
return
clusterInstance
;
}
public
static
ClusterInstanceDTO
autoRegistersClusterDTO
(
String
hosts
,
String
name
,
String
alias
,
String
type
,
Integer
clusterConfigurationId
,
Integer
taskId
)
{
ClusterInstanceDTO
clusterInstanceDTO
=
new
ClusterInstanceDTO
();
clusterInstanceDTO
.
setName
(
name
);
clusterInstanceDTO
.
setAlias
(
alias
);
clusterInstanceDTO
.
setHosts
(
hosts
);
clusterInstanceDTO
.
setType
(
type
);
clusterInstanceDTO
.
setClusterConfigurationId
(
clusterConfigurationId
);
clusterInstanceDTO
.
setTaskId
(
taskId
);
clusterInstanceDTO
.
setAutoRegisters
(
true
);
clusterInstanceDTO
.
setEnabled
(
true
);
return
clusterInstanceDTO
;
}
}
dinky-admin/src/main/java/org/dinky/data/dto/DataBaseDTO.java
0 → 100644
View file @
25e65271
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org
.
dinky
.
data
.
dto
;
import
org.dinky.data.model.DataBase
;
import
org.dinky.mybatis.crypto.CryptoTypeHandler
;
import
org.dinky.mybatis.model.SuperEntity
;
import
java.time.LocalDateTime
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
cn.hutool.core.bean.BeanUtil
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
/**
* DataBaseDTO
*
* @since 2023/10/23 10:59
**/
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
@ApiModel
(
value
=
"DataBaseDTO"
,
description
=
"API Database Data Transfer Object"
)
public
class
DataBaseDTO
extends
SuperEntity
{
@ApiModelProperty
(
value
=
"tenantId"
,
required
=
true
,
dataType
=
"Integer"
,
example
=
"1"
)
private
Integer
tenantId
;
@ApiModelProperty
(
value
=
"groupName"
,
required
=
true
,
dataType
=
"String"
,
example
=
"source"
)
private
String
groupName
;
@ApiModelProperty
(
value
=
"type"
,
required
=
true
,
dataType
=
"String"
,
example
=
"MySQL"
)
private
String
type
;
@ApiModelProperty
(
value
=
"url"
,
required
=
true
,
dataType
=
"String"
,
example
=
"jdbc:mysql://localhost:3306/test"
)
private
String
url
;
@ApiModelProperty
(
value
=
"username"
,
required
=
true
,
dataType
=
"String"
,
example
=
"root"
)
private
String
username
;
@TableField
(
typeHandler
=
CryptoTypeHandler
.
class
)
@ApiModelProperty
(
value
=
"password"
,
required
=
true
,
dataType
=
"String"
,
example
=
"123456"
)
private
String
password
;
@ApiModelProperty
(
value
=
"note"
,
dataType
=
"String"
,
example
=
"note"
)
private
String
note
;
@ApiModelProperty
(
value
=
"flinkConfig"
,
dataType
=
"String"
,
example
=
"flinkConfig"
)
private
String
flinkConfig
;
@ApiModelProperty
(
value
=
"flinkTemplate"
,
dataType
=
"String"
,
example
=
"flinkTemplate"
)
private
String
flinkTemplate
;
@ApiModelProperty
(
value
=
"dbVersion"
,
dataType
=
"String"
,
example
=
"dbVersion"
)
private
String
dbVersion
;
@ApiModelProperty
(
value
=
"status"
,
dataType
=
"Boolean"
,
example
=
"true"
)
private
Boolean
status
;
@ApiModelProperty
(
value
=
"healthTime"
,
dataType
=
"LocalDateTime"
,
example
=
"2021-07-20 20:53:00"
)
private
LocalDateTime
healthTime
;
@ApiModelProperty
(
value
=
"heartbeatTime"
,
dataType
=
"LocalDateTime"
,
example
=
"2021-07-20 20:53:00"
)
private
LocalDateTime
heartbeatTime
;
public
DataBase
toBean
()
{
DataBase
dataBase
=
new
DataBase
();
BeanUtil
.
copyProperties
(
this
,
dataBase
);
return
dataBase
;
}
}
dinky-admin/src/main/java/org/dinky/data/dto/MenuDTO.java
0 → 100644
View file @
25e65271
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org
.
dinky
.
data
.
dto
;
import
org.dinky.data.model.Menu
;
import
org.dinky.mybatis.annotation.Save
;
import
java.util.ArrayList
;
import
java.util.List
;
import
javax.validation.constraints.NotNull
;
import
cn.hutool.core.bean.BeanUtil
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* MenuDTO
*
* @since 2023/10/23 15:23
**/
@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel
(
value
=
"MenuDTO"
,
description
=
"API Menu Data Transfer Object"
)
public
class
MenuDTO
{
@ApiModelProperty
(
value
=
"Parent ID"
,
dataType
=
"Integer"
,
example
=
"0"
,
notes
=
"ID of the parent menu"
)
private
Integer
parentId
;
@NotNull
(
message
=
"Name cannot be null"
,
groups
=
{
Save
.
class
})
@ApiModelProperty
(
value
=
"Name"
,
dataType
=
"String"
,
example
=
"Home"
,
notes
=
"Name of the menu"
)
private
String
name
;
@NotNull
(
message
=
"Path cannot be null"
,
groups
=
{
Save
.
class
})
@ApiModelProperty
(
value
=
"Path"
,
dataType
=
"String"
,
example
=
"/home"
,
notes
=
"Path associated with the menu"
)
private
String
path
;
@NotNull
(
message
=
"Component cannot be null"
,
groups
=
{
Save
.
class
})
@ApiModelProperty
(
value
=
"Component"
,
dataType
=
"String"
,
example
=
"HomeComponent"
,
notes
=
"Component associated with the menu"
)
private
String
component
;
@NotNull
(
message
=
"Permissions cannot be null"
,
groups
=
{
Save
.
class
})
@ApiModelProperty
(
value
=
"Permissions"
,
dataType
=
"String"
,
example
=
"menu:home:view"
,
notes
=
"Permissions required to access the menu"
)
private
String
perms
;
@ApiModelProperty
(
value
=
"Icon"
,
dataType
=
"String"
,
notes
=
"Icon associated with the menu"
)
private
String
icon
;
@ApiModelProperty
(
value
=
"Type"
,
dataType
=
"String"
,
notes
=
"Type of the menu"
)
private
String
type
;
@ApiModelProperty
(
value
=
"Order Number"
,
dataType
=
"Double"
,
example
=
"1.0"
,
notes
=
"Order number for menu positioning"
)
private
Double
orderNum
;
@ApiModelProperty
(
value
=
"Display"
,
dataType
=
"Boolean"
,
notes
=
"Flag indicating if the menu is displayed"
)
private
boolean
display
;
@ApiModelProperty
(
value
=
"Note"
,
dataType
=
"String"
,
notes
=
"Additional notes or details about the menu"
)
private
String
note
;
@ApiModelProperty
(
value
=
"Children"
,
dataType
=
"List<Menu>"
,
notes
=
"List of child menus"
)
private
List
<
Menu
>
children
=
new
ArrayList
<>();
@ApiModelProperty
(
value
=
"Root Menu"
,
dataType
=
"Boolean"
,
notes
=
"Flag indicating if the menu is a root menu"
)
private
boolean
rootMenu
;
public
Menu
toBean
()
{
Menu
menu
=
new
Menu
();
BeanUtil
.
copyProperties
(
this
,
menu
);
return
menu
;
}
}
dinky-admin/src/main/java/org/dinky/data/dto/RoleDTO.java
0 → 100644
View file @
25e65271
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org
.
dinky
.
data
.
dto
;
import
org.dinky.data.model.Role
;
import
cn.hutool.core.bean.BeanUtil
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* RoleDTO
*
* @since 2023/10/23 15:34
**/
@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel
(
value
=
"RoleDTO"
,
description
=
"API Role Data Transfer Object"
)
public
class
RoleDTO
{
@ApiModelProperty
(
value
=
"ID"
,
dataType
=
"Integer"
,
example
=
"1"
,
notes
=
"Unique identifier for the role"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"Tenant ID"
,
dataType
=
"Integer"
,
example
=
"1001"
,
notes
=
"ID of the tenant associated with the role"
)
private
Integer
tenantId
;
@ApiModelProperty
(
value
=
"Role Code"
,
dataType
=
"String"
,
example
=
"ROLE_ADMIN"
,
notes
=
"Code representing the role"
)
private
String
roleCode
;
@ApiModelProperty
(
value
=
"Role Name"
,
dataType
=
"String"
,
example
=
"Administrator"
,
notes
=
"Name of the role"
)
private
String
roleName
;
@ApiModelProperty
(
value
=
"Is Delete"
,
dataType
=
"Boolean"
,
notes
=
"Flag indicating if the role is marked as deleted"
)
private
Boolean
isDelete
;
@ApiModelProperty
(
value
=
"Note"
,
dataType
=
"String"
,
notes
=
"Additional notes or details about the role"
)
private
String
note
;
public
Role
toBean
()
{
Role
role
=
new
Role
();
BeanUtil
.
copyProperties
(
this
,
role
);
return
role
;
}
}
dinky-admin/src/main/java/org/dinky/data/dto/RoleMenuD
to
.java
→
dinky-admin/src/main/java/org/dinky/data/dto/RoleMenuD
TO
.java
View file @
25e65271
...
@@ -36,7 +36,7 @@ import lombok.NoArgsConstructor;
...
@@ -36,7 +36,7 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
@AllArgsConstructor
@Builder
@Builder
@ApiModel
(
value
=
"RoleMenuDto"
,
description
=
"DTO for assigning menus to a role"
)
@ApiModel
(
value
=
"RoleMenuDto"
,
description
=
"DTO for assigning menus to a role"
)
public
class
RoleMenuD
to
implements
Serializable
{
public
class
RoleMenuD
TO
implements
Serializable
{
@ApiModelProperty
(
@ApiModelProperty
(
value
=
"Role ID"
,
value
=
"Role ID"
,
...
...
dinky-admin/src/main/java/org/dinky/job/Job2MysqlHandler.java
View file @
25e65271
...
@@ -23,6 +23,7 @@ import org.dinky.assertion.Asserts;
...
@@ -23,6 +23,7 @@ import org.dinky.assertion.Asserts;
import
org.dinky.context.SpringContextUtils
;
import
org.dinky.context.SpringContextUtils
;
import
org.dinky.daemon.task.DaemonFactory
;
import
org.dinky.daemon.task.DaemonFactory
;
import
org.dinky.daemon.task.DaemonTaskConfig
;
import
org.dinky.daemon.task.DaemonTaskConfig
;
import
org.dinky.data.dto.ClusterInstanceDTO
;
import
org.dinky.data.enums.JobStatus
;
import
org.dinky.data.enums.JobStatus
;
import
org.dinky.data.model.ClusterInstance
;
import
org.dinky.data.model.ClusterInstance
;
import
org.dinky.data.model.History
;
import
org.dinky.data.model.History
;
...
@@ -133,7 +134,7 @@ public class Job2MysqlHandler implements JobHandler {
...
@@ -133,7 +134,7 @@ public class Job2MysqlHandler implements JobHandler {
ClusterInstance
clusterInstance
;
ClusterInstance
clusterInstance
;
final
Integer
clusterConfigurationId
=
job
.
getJobConfig
().
getClusterConfigurationId
();
final
Integer
clusterConfigurationId
=
job
.
getJobConfig
().
getClusterConfigurationId
();
if
(
job
.
isUseGateway
())
{
if
(
job
.
isUseGateway
())
{
clusterInstance
=
clusterInstanceService
.
registersCluster
(
ClusterInstance
.
autoRegistersCluster
(
clusterInstance
=
clusterInstanceService
.
registersCluster
(
ClusterInstance
DTO
.
autoRegistersClusterDTO
(
job
.
getJobManagerAddress
(),
job
.
getJobManagerAddress
(),
job
.
getJobId
(),
job
.
getJobId
(),
job
.
getJobConfig
().
getJobName
()
+
"_"
+
LocalDateTime
.
now
(),
job
.
getJobConfig
().
getJobName
()
+
"_"
+
LocalDateTime
.
now
(),
...
@@ -145,7 +146,7 @@ public class Job2MysqlHandler implements JobHandler {
...
@@ -145,7 +146,7 @@ public class Job2MysqlHandler implements JobHandler {
}
}
}
else
if
(
GatewayType
.
LOCAL
.
equalsValue
(
job
.
getJobConfig
().
getType
())
}
else
if
(
GatewayType
.
LOCAL
.
equalsValue
(
job
.
getJobConfig
().
getType
())
&&
Asserts
.
isNotNullString
(
job
.
getJobManagerAddress
()))
{
&&
Asserts
.
isNotNullString
(
job
.
getJobManagerAddress
()))
{
clusterInstance
=
clusterInstanceService
.
registersCluster
(
ClusterInstance
.
autoRegistersCluster
(
clusterInstance
=
clusterInstanceService
.
registersCluster
(
ClusterInstance
DTO
.
autoRegistersClusterDTO
(
job
.
getJobManagerAddress
(),
job
.
getJobManagerAddress
(),
job
.
getJobId
(),
job
.
getJobId
(),
job
.
getJobConfig
().
getJobName
()
+
"_"
+
LocalDateTime
.
now
(),
job
.
getJobConfig
().
getJobName
()
+
"_"
+
LocalDateTime
.
now
(),
...
...
dinky-admin/src/main/java/org/dinky/service/AlertInstanceService.java
View file @
25e65271
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
package
org
.
dinky
.
service
;
package
org
.
dinky
.
service
;
import
org.dinky.alert.AlertResult
;
import
org.dinky.alert.AlertResult
;
import
org.dinky.data.dto.AlertInstanceDTO
;
import
org.dinky.data.model.AlertInstance
;
import
org.dinky.data.model.AlertInstance
;
import
org.dinky.data.result.Result
;
import
org.dinky.data.result.Result
;
import
org.dinky.mybatis.service.ISuperService
;
import
org.dinky.mybatis.service.ISuperService
;
...
@@ -39,10 +40,10 @@ public interface AlertInstanceService extends ISuperService<AlertInstance> {
...
@@ -39,10 +40,10 @@ public interface AlertInstanceService extends ISuperService<AlertInstance> {
/**
/**
* test one alert instance
* test one alert instance
*
*
* @param alertInstance
{@link AlertInstance
}
* @param alertInstance
DTO {@link AlertInstanceDTO
}
* @return {@link AlertResult}
* @return {@link AlertResult}
*/
*/
AlertResult
testAlert
(
AlertInstance
alertInstance
);
AlertResult
testAlert
(
AlertInstance
DTO
alertInstanceDTO
);
/**
/**
* delete alert instance
* delete alert instance
...
...
dinky-admin/src/main/java/org/dinky/service/ClusterInstanceService.java
View file @
25e65271
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
package
org
.
dinky
.
service
;
package
org
.
dinky
.
service
;
import
org.dinky.cluster.FlinkClusterInfo
;
import
org.dinky.cluster.FlinkClusterInfo
;
import
org.dinky.data.dto.ClusterInstanceDTO
;
import
org.dinky.data.model.ClusterInstance
;
import
org.dinky.data.model.ClusterInstance
;
import
org.dinky.mybatis.service.ISuperService
;
import
org.dinky.mybatis.service.ISuperService
;
...
@@ -93,7 +94,15 @@ public interface ClusterInstanceService extends ISuperService<ClusterInstance> {
...
@@ -93,7 +94,15 @@ public interface ClusterInstanceService extends ISuperService<ClusterInstance> {
/**
/**
* register clusterInstance instance
* register clusterInstance instance
*
*
* @param clusterInstance {@link ClusterInstance} clusterInstance instance
* @param clusterInstanceDTO {@link ClusterInstanceDTO} clusterInstanceDTO instance
* @return {@link ClusterInstance}
*/
ClusterInstance
registersCluster
(
ClusterInstanceDTO
clusterInstanceDTO
);
/**
* register clusterInstance instance
*
* @param clusterInstance {@link ClusterInstance} clusterInstanceDTO instance
* @return {@link ClusterInstance}
* @return {@link ClusterInstance}
*/
*/
ClusterInstance
registersCluster
(
ClusterInstance
clusterInstance
);
ClusterInstance
registersCluster
(
ClusterInstance
clusterInstance
);
...
...
dinky-admin/src/main/java/org/dinky/service/DataBaseService.java
View file @
25e65271
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
package
org
.
dinky
.
service
;
package
org
.
dinky
.
service
;
import
org.dinky.data.dto.DataBaseDTO
;
import
org.dinky.data.dto.SqlDTO
;
import
org.dinky.data.dto.SqlDTO
;
import
org.dinky.data.dto.TaskDTO
;
import
org.dinky.data.dto.TaskDTO
;
import
org.dinky.data.model.Column
;
import
org.dinky.data.model.Column
;
...
@@ -43,10 +44,10 @@ public interface DataBaseService extends ISuperService<DataBase> {
...
@@ -43,10 +44,10 @@ public interface DataBaseService extends ISuperService<DataBase> {
/**
/**
* test connect database
* test connect database
*
*
* @param dataBase
{@link DataBase
}
* @param dataBase
DTO {@link DataBaseDTO
}
* @return {@link String}
* @return {@link String}
*/
*/
String
testConnect
(
DataBase
dataBase
);
String
testConnect
(
DataBase
DTO
dataBaseDTO
);
/**
/**
* check heart beat
* check heart beat
...
@@ -59,10 +60,10 @@ public interface DataBaseService extends ISuperService<DataBase> {
...
@@ -59,10 +60,10 @@ public interface DataBaseService extends ISuperService<DataBase> {
/**
/**
* save or update database
* save or update database
*
*
* @param dataBase
{@link DataBase
}
* @param dataBase
DTO {@link DataBaseDTO
}
* @return {@link Boolean}
* @return {@link Boolean}
*/
*/
Boolean
saveOrUpdateDataBase
(
DataBase
dataBase
);
Boolean
saveOrUpdateDataBase
(
DataBase
DTO
dataBaseDTO
);
/**
/**
* enable or disable database
* enable or disable database
...
@@ -173,10 +174,10 @@ public interface DataBaseService extends ISuperService<DataBase> {
...
@@ -173,10 +174,10 @@ public interface DataBaseService extends ISuperService<DataBase> {
/**
/**
* copy database
* copy database
*
*
* @param data
base {@link DataBase
}
* @param data
BaseDTO {@link DataBaseDTO
}
* @return {@link Boolean}
* @return {@link Boolean}
*/
*/
Boolean
copyDatabase
(
DataBase
database
);
Boolean
copyDatabase
(
DataBase
DTO
dataBaseDTO
);
/**
/**
* Explain common SQL statements for the given task.
* Explain common SQL statements for the given task.
...
...
dinky-admin/src/main/java/org/dinky/service/MenuService.java
View file @
25e65271
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
package
org
.
dinky
.
service
;
package
org
.
dinky
.
service
;
import
org.dinky.data.dto.MenuDTO
;
import
org.dinky.data.model.Menu
;
import
org.dinky.data.model.Menu
;
import
org.dinky.data.model.User
;
import
org.dinky.data.model.User
;
import
org.dinky.data.result.Result
;
import
org.dinky.data.result.Result
;
...
@@ -133,8 +134,8 @@ public interface MenuService extends ISuperService<Menu> {
...
@@ -133,8 +134,8 @@ public interface MenuService extends ISuperService<Menu> {
/**
/**
* save or update menu
* save or update menu
* @param menu
* @param menu
DTO
* @return
* @return
*/
*/
boolean
saveOrUpdateMenu
(
Menu
menu
);
boolean
saveOrUpdateMenu
(
Menu
DTO
menuDTO
);
}
}
dinky-admin/src/main/java/org/dinky/service/RoleMenuService.java
View file @
25e65271
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
package
org
.
dinky
.
service
;
package
org
.
dinky
.
service
;
import
org.dinky.data.dto.AssignMenuToRoleD
to
;
import
org.dinky.data.dto.AssignMenuToRoleD
TO
;
import
org.dinky.data.model.RoleMenu
;
import
org.dinky.data.model.RoleMenu
;
import
org.dinky.data.result.Result
;
import
org.dinky.data.result.Result
;
import
org.dinky.mybatis.service.ISuperService
;
import
org.dinky.mybatis.service.ISuperService
;
...
@@ -32,5 +32,5 @@ public interface RoleMenuService extends ISuperService<RoleMenu> {
...
@@ -32,5 +32,5 @@ public interface RoleMenuService extends ISuperService<RoleMenu> {
* @param assignMenuToRoleDto
* @param assignMenuToRoleDto
* @return
* @return
*/
*/
Result
<
Void
>
assignMenuToRole
(
AssignMenuToRoleD
to
assignMenuToRoleDto
);
Result
<
Void
>
assignMenuToRole
(
AssignMenuToRoleD
TO
assignMenuToRoleDto
);
}
}
dinky-admin/src/main/java/org/dinky/service/RoleService.java
View file @
25e65271
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
package
org
.
dinky
.
service
;
package
org
.
dinky
.
service
;
import
org.dinky.data.dto.RoleDTO
;
import
org.dinky.data.model.Role
;
import
org.dinky.data.model.Role
;
import
org.dinky.data.model.User
;
import
org.dinky.data.model.User
;
import
org.dinky.data.result.ProTableResult
;
import
org.dinky.data.result.ProTableResult
;
...
@@ -35,10 +36,10 @@ public interface RoleService extends ISuperService<Role> {
...
@@ -35,10 +36,10 @@ public interface RoleService extends ISuperService<Role> {
/**
/**
* create or update role
* create or update role
*
*
* @param role
{@link Role
}
* @param role
DTO {@link RoleDTO
}
* @return {@link Result} of {@link Void}
* @return {@link Result} of {@link Void}
*/
*/
Result
<
Void
>
addedOrUpdateRole
(
Role
role
);
Result
<
Void
>
addedOrUpdateRole
(
Role
DTO
roleDTO
);
@Override
@Override
ProTableResult
<
Role
>
selectForProTable
(
JsonNode
para
);
ProTableResult
<
Role
>
selectForProTable
(
JsonNode
para
);
...
...
dinky-admin/src/main/java/org/dinky/service/impl/AlertInstanceServiceImpl.java
View file @
25e65271
...
@@ -22,6 +22,7 @@ package org.dinky.service.impl;
...
@@ -22,6 +22,7 @@ package org.dinky.service.impl;
import
org.dinky.alert.Alert
;
import
org.dinky.alert.Alert
;
import
org.dinky.alert.AlertConfig
;
import
org.dinky.alert.AlertConfig
;
import
org.dinky.alert.AlertResult
;
import
org.dinky.alert.AlertResult
;
import
org.dinky.data.dto.AlertInstanceDTO
;
import
org.dinky.data.model.AlertGroup
;
import
org.dinky.data.model.AlertGroup
;
import
org.dinky.data.model.AlertInstance
;
import
org.dinky.data.model.AlertInstance
;
import
org.dinky.data.result.Result
;
import
org.dinky.data.result.Result
;
...
@@ -66,9 +67,9 @@ public class AlertInstanceServiceImpl extends SuperServiceImpl<AlertInstanceMapp
...
@@ -66,9 +67,9 @@ public class AlertInstanceServiceImpl extends SuperServiceImpl<AlertInstanceMapp
}
}
@Override
@Override
public
AlertResult
testAlert
(
AlertInstance
alertInstance
)
{
public
AlertResult
testAlert
(
AlertInstance
DTO
alertInstanceDTO
)
{
AlertConfig
alertConfig
=
AlertConfig
.
build
(
AlertConfig
alertConfig
=
AlertConfig
.
build
(
alertInstance
.
getName
(),
alertInstance
.
getType
(),
JsonUtils
.
toMap
(
alertInstance
.
getParams
()));
alertInstance
DTO
.
getName
(),
alertInstanceDTO
.
getType
(),
JsonUtils
.
toMap
(
alertInstanceDTO
.
getParams
()));
Alert
alert
=
Alert
.
buildTest
(
alertConfig
);
Alert
alert
=
Alert
.
buildTest
(
alertConfig
);
String
msg
=
"\n- **Job Name :** <font color='gray'>Test Job</font>\n"
String
msg
=
"\n- **Job Name :** <font color='gray'>Test Job</font>\n"
...
...
dinky-admin/src/main/java/org/dinky/service/impl/ClusterInstanceServiceImpl.java
View file @
25e65271
...
@@ -24,6 +24,7 @@ import org.dinky.assertion.Asserts;
...
@@ -24,6 +24,7 @@ import org.dinky.assertion.Asserts;
import
org.dinky.cluster.FlinkCluster
;
import
org.dinky.cluster.FlinkCluster
;
import
org.dinky.cluster.FlinkClusterInfo
;
import
org.dinky.cluster.FlinkClusterInfo
;
import
org.dinky.constant.FlinkConstant
;
import
org.dinky.constant.FlinkConstant
;
import
org.dinky.data.dto.ClusterInstanceDTO
;
import
org.dinky.data.model.ClusterConfiguration
;
import
org.dinky.data.model.ClusterConfiguration
;
import
org.dinky.data.model.ClusterInstance
;
import
org.dinky.data.model.ClusterInstance
;
import
org.dinky.gateway.config.GatewayConfig
;
import
org.dinky.gateway.config.GatewayConfig
;
...
@@ -126,6 +127,14 @@ public class ClusterInstanceServiceImpl extends SuperServiceImpl<ClusterInstance
...
@@ -126,6 +127,14 @@ public class ClusterInstanceServiceImpl extends SuperServiceImpl<ClusterInstance
return
list
(
new
QueryWrapper
<
ClusterInstance
>().
eq
(
"enabled"
,
1
).
eq
(
"auto_registers"
,
1
));
return
list
(
new
QueryWrapper
<
ClusterInstance
>().
eq
(
"enabled"
,
1
).
eq
(
"auto_registers"
,
1
));
}
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ClusterInstance
registersCluster
(
ClusterInstanceDTO
clusterInstanceDTO
)
{
ClusterInstance
clusterInstance
=
clusterInstanceDTO
.
toBean
();
return
this
.
registersCluster
(
clusterInstance
);
}
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ClusterInstance
registersCluster
(
ClusterInstance
clusterInstance
)
{
public
ClusterInstance
registersCluster
(
ClusterInstance
clusterInstance
)
{
...
@@ -189,7 +198,7 @@ public class ClusterInstanceServiceImpl extends SuperServiceImpl<ClusterInstance
...
@@ -189,7 +198,7 @@ public class ClusterInstanceServiceImpl extends SuperServiceImpl<ClusterInstance
GatewayConfig
gatewayConfig
=
GatewayConfig
gatewayConfig
=
GatewayConfig
.
build
(
FlinkClusterConfig
.
create
(
clusterCfg
.
getType
(),
clusterCfg
.
getConfigJson
()));
GatewayConfig
.
build
(
FlinkClusterConfig
.
create
(
clusterCfg
.
getType
(),
clusterCfg
.
getConfigJson
()));
GatewayResult
gatewayResult
=
JobManager
.
deploySessionCluster
(
gatewayConfig
);
GatewayResult
gatewayResult
=
JobManager
.
deploySessionCluster
(
gatewayConfig
);
return
registersCluster
(
ClusterInstance
.
autoRegistersCluster
(
return
registersCluster
(
ClusterInstance
DTO
.
autoRegistersClusterDTO
(
gatewayResult
.
getWebURL
().
replace
(
"http://"
,
""
),
gatewayResult
.
getWebURL
().
replace
(
"http://"
,
""
),
gatewayResult
.
getId
(),
gatewayResult
.
getId
(),
clusterCfg
.
getName
()
+
"_"
+
LocalDateTime
.
now
(),
clusterCfg
.
getName
()
+
"_"
+
LocalDateTime
.
now
(),
...
...
dinky-admin/src/main/java/org/dinky/service/impl/DataBaseServiceImpl.java
View file @
25e65271
...
@@ -22,6 +22,7 @@ package org.dinky.service.impl;
...
@@ -22,6 +22,7 @@ package org.dinky.service.impl;
import
org.dinky.assertion.Asserts
;
import
org.dinky.assertion.Asserts
;
import
org.dinky.data.annotations.ProcessStep
;
import
org.dinky.data.annotations.ProcessStep
;
import
org.dinky.data.constant.CommonConstant
;
import
org.dinky.data.constant.CommonConstant
;
import
org.dinky.data.dto.DataBaseDTO
;
import
org.dinky.data.dto.SqlDTO
;
import
org.dinky.data.dto.SqlDTO
;
import
org.dinky.data.dto.TaskDTO
;
import
org.dinky.data.dto.TaskDTO
;
import
org.dinky.data.enums.ProcessStepType
;
import
org.dinky.data.enums.ProcessStepType
;
...
@@ -61,8 +62,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...
@@ -61,8 +62,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
public
class
DataBaseServiceImpl
extends
SuperServiceImpl
<
DataBaseMapper
,
DataBase
>
implements
DataBaseService
{
public
class
DataBaseServiceImpl
extends
SuperServiceImpl
<
DataBaseMapper
,
DataBase
>
implements
DataBaseService
{
@Override
@Override
public
String
testConnect
(
DataBase
dataBase
)
{
public
String
testConnect
(
DataBase
DTO
dataBaseDTO
)
{
return
Driver
.
buildUnconnected
(
dataBase
.
getDriverConfig
()).
test
();
return
Driver
.
buildUnconnected
(
dataBase
DTO
.
toBean
()
.
getDriverConfig
()).
test
();
}
}
@Override
@Override
...
@@ -86,7 +87,9 @@ public class DataBaseServiceImpl extends SuperServiceImpl<DataBaseMapper, DataBa
...
@@ -86,7 +87,9 @@ public class DataBaseServiceImpl extends SuperServiceImpl<DataBaseMapper, DataBa
}
}
@Override
@Override
public
Boolean
saveOrUpdateDataBase
(
DataBase
dataBase
)
{
public
Boolean
saveOrUpdateDataBase
(
DataBaseDTO
dataBaseDTO
)
{
DataBase
dataBase
=
dataBaseDTO
.
toBean
();
if
(
Asserts
.
isNull
(
dataBase
))
{
if
(
Asserts
.
isNull
(
dataBase
))
{
return
false
;
return
false
;
}
}
...
@@ -238,7 +241,9 @@ public class DataBaseServiceImpl extends SuperServiceImpl<DataBaseMapper, DataBa
...
@@ -238,7 +241,9 @@ public class DataBaseServiceImpl extends SuperServiceImpl<DataBaseMapper, DataBa
}
}
@Override
@Override
public
Boolean
copyDatabase
(
DataBase
database
)
{
public
Boolean
copyDatabase
(
DataBaseDTO
dataBaseDTO
)
{
DataBase
database
=
dataBaseDTO
.
toBean
();
String
name
=
UUID
.
randomUUID
().
toString
().
replaceAll
(
"-"
,
""
).
substring
(
0
,
10
);
String
name
=
UUID
.
randomUUID
().
toString
().
replaceAll
(
"-"
,
""
).
substring
(
0
,
10
);
database
.
setId
(
null
);
database
.
setId
(
null
);
database
.
setName
((
database
.
getName
().
length
()
>
10
?
database
.
getName
().
substring
(
0
,
10
)
:
database
.
getName
())
database
.
setName
((
database
.
getName
().
length
()
>
10
?
database
.
getName
().
substring
(
0
,
10
)
:
database
.
getName
())
...
...
dinky-admin/src/main/java/org/dinky/service/impl/MenuServiceImpl.java
View file @
25e65271
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
package
org
.
dinky
.
service
.
impl
;
package
org
.
dinky
.
service
.
impl
;
import
org.dinky.data.constant.BaseConstant
;
import
org.dinky.data.constant.BaseConstant
;
import
org.dinky.data.dto.MenuDTO
;
import
org.dinky.data.enums.Status
;
import
org.dinky.data.enums.Status
;
import
org.dinky.data.model.Menu
;
import
org.dinky.data.model.Menu
;
import
org.dinky.data.model.RoleMenu
;
import
org.dinky.data.model.RoleMenu
;
...
@@ -289,12 +290,14 @@ public class MenuServiceImpl extends SuperServiceImpl<MenuMapper, Menu> implemen
...
@@ -289,12 +290,14 @@ public class MenuServiceImpl extends SuperServiceImpl<MenuMapper, Menu> implemen
/**
/**
* save or update menu
* save or update menu
*
*
* @param menu
* @param menu
DTO
* @return
* @return
*/
*/
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
saveOrUpdateMenu
(
Menu
menu
)
{
public
boolean
saveOrUpdateMenu
(
MenuDTO
menuDTO
)
{
Menu
menu
=
menuDTO
.
toBean
();
if
(
StrUtil
.
isNotEmpty
(
menu
.
getPath
()))
{
if
(
StrUtil
.
isNotEmpty
(
menu
.
getPath
()))
{
// replace first / and replace other / to : for router
// replace first / and replace other / to : for router
String
replacedPerms
=
menu
.
getPath
().
replaceFirst
(
"/"
,
""
).
replaceAll
(
"/"
,
":"
);
String
replacedPerms
=
menu
.
getPath
().
replaceFirst
(
"/"
,
""
).
replaceAll
(
"/"
,
":"
);
...
...
dinky-admin/src/main/java/org/dinky/service/impl/RoleMenuServiceImpl.java
View file @
25e65271
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
package
org
.
dinky
.
service
.
impl
;
package
org
.
dinky
.
service
.
impl
;
import
org.dinky.data.dto.AssignMenuToRoleD
to
;
import
org.dinky.data.dto.AssignMenuToRoleD
TO
;
import
org.dinky.data.enums.Status
;
import
org.dinky.data.enums.Status
;
import
org.dinky.data.model.RoleMenu
;
import
org.dinky.data.model.RoleMenu
;
import
org.dinky.data.result.Result
;
import
org.dinky.data.result.Result
;
...
@@ -38,7 +38,7 @@ import cn.hutool.core.collection.CollUtil;
...
@@ -38,7 +38,7 @@ import cn.hutool.core.collection.CollUtil;
@Service
@Service
public
class
RoleMenuServiceImpl
extends
SuperServiceImpl
<
RoleMenuMapper
,
RoleMenu
>
implements
RoleMenuService
{
public
class
RoleMenuServiceImpl
extends
SuperServiceImpl
<
RoleMenuMapper
,
RoleMenu
>
implements
RoleMenuService
{
@Override
@Override
public
Result
<
Void
>
assignMenuToRole
(
AssignMenuToRoleD
to
assignMenuToRoleDto
)
{
public
Result
<
Void
>
assignMenuToRole
(
AssignMenuToRoleD
TO
assignMenuToRoleDto
)
{
if
(
CollUtil
.
isEmpty
(
assignMenuToRoleDto
.
getMenuIds
()))
{
if
(
CollUtil
.
isEmpty
(
assignMenuToRoleDto
.
getMenuIds
()))
{
return
Result
.
failed
(
Status
.
SELECT_MENU
);
return
Result
.
failed
(
Status
.
SELECT_MENU
);
...
...
dinky-admin/src/main/java/org/dinky/service/impl/RoleServiceImpl.java
View file @
25e65271
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
package
org
.
dinky
.
service
.
impl
;
package
org
.
dinky
.
service
.
impl
;
import
org.dinky.assertion.Asserts
;
import
org.dinky.assertion.Asserts
;
import
org.dinky.data.dto.RoleDTO
;
import
org.dinky.data.enums.Status
;
import
org.dinky.data.enums.Status
;
import
org.dinky.data.model.Role
;
import
org.dinky.data.model.Role
;
import
org.dinky.data.model.RowPermissions
;
import
org.dinky.data.model.RowPermissions
;
...
@@ -77,7 +78,9 @@ public class RoleServiceImpl extends SuperServiceImpl<RoleMapper, Role> implemen
...
@@ -77,7 +78,9 @@ public class RoleServiceImpl extends SuperServiceImpl<RoleMapper, Role> implemen
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Result
<
Void
>
addedOrUpdateRole
(
Role
role
)
{
public
Result
<
Void
>
addedOrUpdateRole
(
RoleDTO
roleDTO
)
{
Role
role
=
roleDTO
.
toBean
();
if
(
Asserts
.
isNull
(
role
.
getId
()))
{
if
(
Asserts
.
isNull
(
role
.
getId
()))
{
Role
roleCode
=
Role
roleCode
=
roleService
.
getOne
(
new
LambdaQueryWrapper
<
Role
>().
eq
(
Role:
:
getRoleCode
,
role
.
getRoleCode
()));
roleService
.
getOne
(
new
LambdaQueryWrapper
<
Role
>().
eq
(
Role:
:
getRoleCode
,
role
.
getRoleCode
()));
...
...
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