Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
R
ruoyi-bs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
过峰
ruoyi-bs
Commits
0868ec6f
提交
0868ec6f
authored
12月 17, 2024
作者:
陈柏江
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
delete方法的msg返回“删除成功”
上级
b8f968ad
显示空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
382 行增加
和
662 行删除
+382
-662
SysLogininforController.java
...ruoyi/web/controller/monitor/SysLogininforController.java
+8
-13
SysOperlogController.java
...om/ruoyi/web/controller/monitor/SysOperlogController.java
+12
-21
SysConfigController.java
.../com/ruoyi/web/controller/system/SysConfigController.java
+19
-36
SysDeptController.java
...va/com/ruoyi/web/controller/system/SysDeptController.java
+21
-42
SysDictDataController.java
...om/ruoyi/web/controller/system/SysDictDataController.java
+18
-33
SysDictTypeController.java
...om/ruoyi/web/controller/system/SysDictTypeController.java
+19
-36
SysMenuController.java
...va/com/ruoyi/web/controller/system/SysMenuController.java
+23
-46
SysNoticeController.java
.../com/ruoyi/web/controller/system/SysNoticeController.java
+13
-25
SysPostController.java
...va/com/ruoyi/web/controller/system/SysPostController.java
+20
-40
SysRoleController.java
...va/com/ruoyi/web/controller/system/SysRoleController.java
+30
-60
SysUserController.java
...va/com/ruoyi/web/controller/system/SysUserController.java
+34
-66
BaseController.java
...java/com/ruoyi/common/core/controller/BaseController.java
+41
-52
AjaxResult.java
...rc/main/java/com/ruoyi/common/core/domain/AjaxResult.java
+49
-43
GenController.java
...in/java/com/ruoyi/generator/controller/GenController.java
+33
-60
SysJobController.java
...in/java/com/ruoyi/quartz/controller/SysJobController.java
+29
-66
SysJobLogController.java
...java/com/ruoyi/quartz/controller/SysJobLogController.java
+13
-23
没有找到文件。
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java
浏览文件 @
0868ec6f
...
...
@@ -2,6 +2,7 @@ package com.ruoyi.web.controller.monitor;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
...
...
@@ -27,8 +28,7 @@ import com.ruoyi.system.service.ISysLogininforService;
*/
@RestController
@RequestMapping
(
"/monitor/logininfor"
)
public
class
SysLogininforController
extends
BaseController
{
public
class
SysLogininforController
extends
BaseController
{
@Autowired
private
ISysLogininforService
logininforService
;
...
...
@@ -37,8 +37,7 @@ public class SysLogininforController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('monitor:logininfor:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SysLogininfor
logininfor
)
{
public
TableDataInfo
list
(
SysLogininfor
logininfor
)
{
startPage
();
List
<
SysLogininfor
>
list
=
logininforService
.
selectLogininforList
(
logininfor
);
return
getDataTable
(
list
);
...
...
@@ -47,8 +46,7 @@ public class SysLogininforController extends BaseController
@Log
(
title
=
"登录日志"
,
businessType
=
BusinessType
.
EXPORT
)
@PreAuthorize
(
"@ss.hasPermi('monitor:logininfor:export')"
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
SysLogininfor
logininfor
)
{
public
void
export
(
HttpServletResponse
response
,
SysLogininfor
logininfor
)
{
List
<
SysLogininfor
>
list
=
logininforService
.
selectLogininforList
(
logininfor
);
ExcelUtil
<
SysLogininfor
>
util
=
new
ExcelUtil
<
SysLogininfor
>(
SysLogininfor
.
class
);
util
.
exportExcel
(
response
,
list
,
"登录日志"
);
...
...
@@ -57,16 +55,14 @@ public class SysLogininforController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('monitor:logininfor:remove')"
)
@Log
(
title
=
"登录日志"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{infoIds}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
infoIds
)
{
return
toAjax
(
logininforService
.
deleteLogininforByIds
(
infoIds
));
public
AjaxResult
remove
(
@PathVariable
Long
[]
infoIds
)
{
return
toAjaxDel
(
logininforService
.
deleteLogininforByIds
(
infoIds
));
}
@PreAuthorize
(
"@ss.hasPermi('monitor:logininfor:remove')"
)
@Log
(
title
=
"登录日志"
,
businessType
=
BusinessType
.
CLEAN
)
@DeleteMapping
(
"/clean"
)
public
AjaxResult
clean
()
{
public
AjaxResult
clean
()
{
logininforService
.
cleanLogininfor
();
return
success
();
}
...
...
@@ -74,8 +70,7 @@ public class SysLogininforController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('monitor:logininfor:unlock')"
)
@Log
(
title
=
"账户解锁"
,
businessType
=
BusinessType
.
OTHER
)
@GetMapping
(
"/unlock/{userName}"
)
public
AjaxResult
unlock
(
@PathVariable
(
"userName"
)
String
userName
)
{
public
AjaxResult
unlock
(
@PathVariable
(
"userName"
)
String
userName
)
{
passwordService
.
clearLoginRecordCache
(
userName
);
return
success
();
}
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java
浏览文件 @
0868ec6f
package
com
.
ruoyi
.
web
.
controller
.
monitor
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.domain.AjaxResult
;
...
...
@@ -18,6 +8,12 @@ import com.ruoyi.common.enums.BusinessType;
import
com.ruoyi.common.utils.poi.ExcelUtil
;
import
com.ruoyi.system.domain.SysOperLog
;
import
com.ruoyi.system.service.ISysOperLogService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
/**
* 操作日志记录
...
...
@@ -26,15 +22,13 @@ import com.ruoyi.system.service.ISysOperLogService;
*/
@RestController
@RequestMapping
(
"/monitor/operlog"
)
public
class
SysOperlogController
extends
BaseController
{
public
class
SysOperlogController
extends
BaseController
{
@Autowired
private
ISysOperLogService
operLogService
;
@PreAuthorize
(
"@ss.hasPermi('monitor:operlog:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SysOperLog
operLog
)
{
public
TableDataInfo
list
(
SysOperLog
operLog
)
{
startPage
();
List
<
SysOperLog
>
list
=
operLogService
.
selectOperLogList
(
operLog
);
return
getDataTable
(
list
);
...
...
@@ -43,8 +37,7 @@ public class SysOperlogController extends BaseController
@Log
(
title
=
"操作日志"
,
businessType
=
BusinessType
.
EXPORT
)
@PreAuthorize
(
"@ss.hasPermi('monitor:operlog:export')"
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
SysOperLog
operLog
)
{
public
void
export
(
HttpServletResponse
response
,
SysOperLog
operLog
)
{
List
<
SysOperLog
>
list
=
operLogService
.
selectOperLogList
(
operLog
);
ExcelUtil
<
SysOperLog
>
util
=
new
ExcelUtil
<
SysOperLog
>(
SysOperLog
.
class
);
util
.
exportExcel
(
response
,
list
,
"操作日志"
);
...
...
@@ -53,16 +46,14 @@ public class SysOperlogController extends BaseController
@Log
(
title
=
"操作日志"
,
businessType
=
BusinessType
.
DELETE
)
@PreAuthorize
(
"@ss.hasPermi('monitor:operlog:remove')"
)
@DeleteMapping
(
"/{operIds}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
operIds
)
{
return
toAjax
(
operLogService
.
deleteOperLogByIds
(
operIds
));
public
AjaxResult
remove
(
@PathVariable
Long
[]
operIds
)
{
return
toAjaxDel
(
operLogService
.
deleteOperLogByIds
(
operIds
));
}
@Log
(
title
=
"操作日志"
,
businessType
=
BusinessType
.
CLEAN
)
@PreAuthorize
(
"@ss.hasPermi('monitor:operlog:remove')"
)
@DeleteMapping
(
"/clean"
)
public
AjaxResult
clean
()
{
public
AjaxResult
clean
()
{
operLogService
.
cleanOperLog
();
return
success
();
}
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java
浏览文件 @
0868ec6f
package
com
.
ruoyi
.
web
.
controller
.
system
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.domain.AjaxResult
;
...
...
@@ -21,6 +8,13 @@ import com.ruoyi.common.enums.BusinessType;
import
com.ruoyi.common.utils.poi.ExcelUtil
;
import
com.ruoyi.system.domain.SysConfig
;
import
com.ruoyi.system.service.ISysConfigService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
/**
* 参数配置 信息操作处理
...
...
@@ -29,8 +23,7 @@ import com.ruoyi.system.service.ISysConfigService;
*/
@RestController
@RequestMapping
(
"/system/config"
)
public
class
SysConfigController
extends
BaseController
{
public
class
SysConfigController
extends
BaseController
{
@Autowired
private
ISysConfigService
configService
;
...
...
@@ -39,8 +32,7 @@ public class SysConfigController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('system:config:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SysConfig
config
)
{
public
TableDataInfo
list
(
SysConfig
config
)
{
startPage
();
List
<
SysConfig
>
list
=
configService
.
selectConfigList
(
config
);
return
getDataTable
(
list
);
...
...
@@ -49,8 +41,7 @@ public class SysConfigController extends BaseController
@Log
(
title
=
"参数管理"
,
businessType
=
BusinessType
.
EXPORT
)
@PreAuthorize
(
"@ss.hasPermi('system:config:export')"
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
SysConfig
config
)
{
public
void
export
(
HttpServletResponse
response
,
SysConfig
config
)
{
List
<
SysConfig
>
list
=
configService
.
selectConfigList
(
config
);
ExcelUtil
<
SysConfig
>
util
=
new
ExcelUtil
<
SysConfig
>(
SysConfig
.
class
);
util
.
exportExcel
(
response
,
list
,
"参数数据"
);
...
...
@@ -61,8 +52,7 @@ public class SysConfigController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('system:config:query')"
)
@GetMapping
(
value
=
"/{configId}"
)
public
AjaxResult
getInfo
(
@PathVariable
Long
configId
)
{
public
AjaxResult
getInfo
(
@PathVariable
Long
configId
)
{
return
success
(
configService
.
selectConfigById
(
configId
));
}
...
...
@@ -70,8 +60,7 @@ public class SysConfigController extends BaseController
* 根据参数键名查询参数值
*/
@GetMapping
(
value
=
"/configKey/{configKey}"
)
public
AjaxResult
getConfigKey
(
@PathVariable
String
configKey
)
{
public
AjaxResult
getConfigKey
(
@PathVariable
String
configKey
)
{
return
success
(
configService
.
selectConfigByKey
(
configKey
));
}
...
...
@@ -81,10 +70,8 @@ public class SysConfigController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:config:add')"
)
@Log
(
title
=
"参数管理"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@Validated
@RequestBody
SysConfig
config
)
{
if
(!
configService
.
checkConfigKeyUnique
(
config
))
{
public
AjaxResult
add
(
@Validated
@RequestBody
SysConfig
config
)
{
if
(!
configService
.
checkConfigKeyUnique
(
config
))
{
return
error
(
"新增参数'"
+
config
.
getConfigName
()
+
"'失败,参数键名已存在"
);
}
config
.
setCreateBy
(
getUsername
());
...
...
@@ -97,10 +84,8 @@ public class SysConfigController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:config:edit')"
)
@Log
(
title
=
"参数管理"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@Validated
@RequestBody
SysConfig
config
)
{
if
(!
configService
.
checkConfigKeyUnique
(
config
))
{
public
AjaxResult
edit
(
@Validated
@RequestBody
SysConfig
config
)
{
if
(!
configService
.
checkConfigKeyUnique
(
config
))
{
return
error
(
"修改参数'"
+
config
.
getConfigName
()
+
"'失败,参数键名已存在"
);
}
config
.
setUpdateBy
(
getUsername
());
...
...
@@ -113,10 +98,9 @@ public class SysConfigController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:config:remove')"
)
@Log
(
title
=
"参数管理"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{configIds}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
configIds
)
{
public
AjaxResult
remove
(
@PathVariable
Long
[]
configIds
)
{
configService
.
deleteConfigByIds
(
configIds
);
return
success
();
return
AjaxResult
.
successDel
();
}
/**
...
...
@@ -125,8 +109,7 @@ public class SysConfigController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:config:remove')"
)
@Log
(
title
=
"参数管理"
,
businessType
=
BusinessType
.
CLEAN
)
@DeleteMapping
(
"/refreshCache"
)
public
AjaxResult
refreshCache
()
{
public
AjaxResult
refreshCache
()
{
configService
.
resetConfigCache
();
return
success
();
}
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java
浏览文件 @
0868ec6f
package
com
.
ruoyi
.
web
.
controller
.
system
;
import
java.util.List
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.constant.UserConstants
;
import
com.ruoyi.common.core.controller.BaseController
;
...
...
@@ -21,6 +8,13 @@ import com.ruoyi.common.core.domain.entity.SysDept;
import
com.ruoyi.common.enums.BusinessType
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.system.service.ISysDeptService
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* 部门信息
...
...
@@ -29,8 +23,7 @@ import com.ruoyi.system.service.ISysDeptService;
*/
@RestController
@RequestMapping
(
"/system/dept"
)
public
class
SysDeptController
extends
BaseController
{
public
class
SysDeptController
extends
BaseController
{
@Autowired
private
ISysDeptService
deptService
;
...
...
@@ -39,8 +32,7 @@ public class SysDeptController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('system:dept:list')"
)
@GetMapping
(
"/list"
)
public
AjaxResult
list
(
SysDept
dept
)
{
public
AjaxResult
list
(
SysDept
dept
)
{
List
<
SysDept
>
depts
=
deptService
.
selectDeptList
(
dept
);
return
success
(
depts
);
}
...
...
@@ -50,8 +42,7 @@ public class SysDeptController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('system:dept:list')"
)
@GetMapping
(
"/list/exclude/{deptId}"
)
public
AjaxResult
excludeChild
(
@PathVariable
(
value
=
"deptId"
,
required
=
false
)
Long
deptId
)
{
public
AjaxResult
excludeChild
(
@PathVariable
(
value
=
"deptId"
,
required
=
false
)
Long
deptId
)
{
List
<
SysDept
>
depts
=
deptService
.
selectDeptList
(
new
SysDept
());
depts
.
removeIf
(
d
->
d
.
getDeptId
().
intValue
()
==
deptId
||
ArrayUtils
.
contains
(
StringUtils
.
split
(
d
.
getAncestors
(),
","
),
deptId
+
""
));
return
success
(
depts
);
...
...
@@ -62,8 +53,7 @@ public class SysDeptController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('system:dept:query')"
)
@GetMapping
(
value
=
"/{deptId}"
)
public
AjaxResult
getInfo
(
@PathVariable
Long
deptId
)
{
public
AjaxResult
getInfo
(
@PathVariable
Long
deptId
)
{
deptService
.
checkDeptDataScope
(
deptId
);
return
success
(
deptService
.
selectDeptById
(
deptId
));
}
...
...
@@ -74,10 +64,8 @@ public class SysDeptController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:dept:add')"
)
@Log
(
title
=
"部门管理"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@Validated
@RequestBody
SysDept
dept
)
{
if
(!
deptService
.
checkDeptNameUnique
(
dept
))
{
public
AjaxResult
add
(
@Validated
@RequestBody
SysDept
dept
)
{
if
(!
deptService
.
checkDeptNameUnique
(
dept
))
{
return
error
(
"新增部门'"
+
dept
.
getDeptName
()
+
"'失败,部门名称已存在"
);
}
dept
.
setCreateBy
(
getUsername
());
...
...
@@ -90,20 +78,14 @@ public class SysDeptController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:dept:edit')"
)
@Log
(
title
=
"部门管理"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@Validated
@RequestBody
SysDept
dept
)
{
public
AjaxResult
edit
(
@Validated
@RequestBody
SysDept
dept
)
{
Long
deptId
=
dept
.
getDeptId
();
deptService
.
checkDeptDataScope
(
deptId
);
if
(!
deptService
.
checkDeptNameUnique
(
dept
))
{
if
(!
deptService
.
checkDeptNameUnique
(
dept
))
{
return
error
(
"修改部门'"
+
dept
.
getDeptName
()
+
"'失败,部门名称已存在"
);
}
else
if
(
dept
.
getParentId
().
equals
(
deptId
))
{
}
else
if
(
dept
.
getParentId
().
equals
(
deptId
))
{
return
error
(
"修改部门'"
+
dept
.
getDeptName
()
+
"'失败,上级部门不能是自己"
);
}
else
if
(
StringUtils
.
equals
(
UserConstants
.
DEPT_DISABLE
,
dept
.
getStatus
())
&&
deptService
.
selectNormalChildrenDeptById
(
deptId
)
>
0
)
{
}
else
if
(
StringUtils
.
equals
(
UserConstants
.
DEPT_DISABLE
,
dept
.
getStatus
())
&&
deptService
.
selectNormalChildrenDeptById
(
deptId
)
>
0
)
{
return
error
(
"该部门包含未停用的子部门!"
);
}
dept
.
setUpdateBy
(
getUsername
());
...
...
@@ -116,17 +98,14 @@ public class SysDeptController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:dept:remove')"
)
@Log
(
title
=
"部门管理"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{deptId}"
)
public
AjaxResult
remove
(
@PathVariable
Long
deptId
)
{
if
(
deptService
.
hasChildByDeptId
(
deptId
))
{
public
AjaxResult
remove
(
@PathVariable
Long
deptId
)
{
if
(
deptService
.
hasChildByDeptId
(
deptId
))
{
return
warn
(
"存在下级部门,不允许删除"
);
}
if
(
deptService
.
checkDeptExistUser
(
deptId
))
{
if
(
deptService
.
checkDeptExistUser
(
deptId
))
{
return
warn
(
"部门存在用户,不允许删除"
);
}
deptService
.
checkDeptDataScope
(
deptId
);
return
toAjax
(
deptService
.
deleteDeptById
(
deptId
));
return
toAjax
Del
(
deptService
.
deleteDeptById
(
deptId
));
}
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java
浏览文件 @
0868ec6f
package
com
.
ruoyi
.
web
.
controller
.
system
;
import
java.util.ArrayList
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.domain.AjaxResult
;
...
...
@@ -24,6 +10,14 @@ import com.ruoyi.common.utils.StringUtils;
import
com.ruoyi.common.utils.poi.ExcelUtil
;
import
com.ruoyi.system.service.ISysDictDataService
;
import
com.ruoyi.system.service.ISysDictTypeService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* 数据字典信息
...
...
@@ -32,8 +26,7 @@ import com.ruoyi.system.service.ISysDictTypeService;
*/
@RestController
@RequestMapping
(
"/system/dict/data"
)
public
class
SysDictDataController
extends
BaseController
{
public
class
SysDictDataController
extends
BaseController
{
@Autowired
private
ISysDictDataService
dictDataService
;
...
...
@@ -42,8 +35,7 @@ public class SysDictDataController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:dict:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SysDictData
dictData
)
{
public
TableDataInfo
list
(
SysDictData
dictData
)
{
startPage
();
List
<
SysDictData
>
list
=
dictDataService
.
selectDictDataList
(
dictData
);
return
getDataTable
(
list
);
...
...
@@ -52,8 +44,7 @@ public class SysDictDataController extends BaseController
@Log
(
title
=
"字典数据"
,
businessType
=
BusinessType
.
EXPORT
)
@PreAuthorize
(
"@ss.hasPermi('system:dict:export')"
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
SysDictData
dictData
)
{
public
void
export
(
HttpServletResponse
response
,
SysDictData
dictData
)
{
List
<
SysDictData
>
list
=
dictDataService
.
selectDictDataList
(
dictData
);
ExcelUtil
<
SysDictData
>
util
=
new
ExcelUtil
<
SysDictData
>(
SysDictData
.
class
);
util
.
exportExcel
(
response
,
list
,
"字典数据"
);
...
...
@@ -64,8 +55,7 @@ public class SysDictDataController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('system:dict:query')"
)
@GetMapping
(
value
=
"/{dictCode}"
)
public
AjaxResult
getInfo
(
@PathVariable
Long
dictCode
)
{
public
AjaxResult
getInfo
(
@PathVariable
Long
dictCode
)
{
return
success
(
dictDataService
.
selectDictDataById
(
dictCode
));
}
...
...
@@ -73,11 +63,9 @@ public class SysDictDataController extends BaseController
* 根据字典类型查询字典数据信息
*/
@GetMapping
(
value
=
"/type/{dictType}"
)
public
AjaxResult
dictType
(
@PathVariable
String
dictType
)
{
public
AjaxResult
dictType
(
@PathVariable
String
dictType
)
{
List
<
SysDictData
>
data
=
dictTypeService
.
selectDictDataByType
(
dictType
);
if
(
StringUtils
.
isNull
(
data
))
{
if
(
StringUtils
.
isNull
(
data
))
{
data
=
new
ArrayList
<
SysDictData
>();
}
return
success
(
data
);
...
...
@@ -89,8 +77,7 @@ public class SysDictDataController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:dict:add')"
)
@Log
(
title
=
"字典数据"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@Validated
@RequestBody
SysDictData
dict
)
{
public
AjaxResult
add
(
@Validated
@RequestBody
SysDictData
dict
)
{
dict
.
setCreateBy
(
getUsername
());
return
toAjax
(
dictDataService
.
insertDictData
(
dict
));
}
...
...
@@ -101,8 +88,7 @@ public class SysDictDataController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:dict:edit')"
)
@Log
(
title
=
"字典数据"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@Validated
@RequestBody
SysDictData
dict
)
{
public
AjaxResult
edit
(
@Validated
@RequestBody
SysDictData
dict
)
{
dict
.
setUpdateBy
(
getUsername
());
return
toAjax
(
dictDataService
.
updateDictData
(
dict
));
}
...
...
@@ -113,9 +99,8 @@ public class SysDictDataController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:dict:remove')"
)
@Log
(
title
=
"字典类型"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{dictCodes}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
dictCodes
)
{
public
AjaxResult
remove
(
@PathVariable
Long
[]
dictCodes
)
{
dictDataService
.
deleteDictDataByIds
(
dictCodes
);
return
success
();
return
AjaxResult
.
successDel
();
}
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java
浏览文件 @
0868ec6f
package
com
.
ruoyi
.
web
.
controller
.
system
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.domain.AjaxResult
;
...
...
@@ -21,6 +8,13 @@ import com.ruoyi.common.core.page.TableDataInfo;
import
com.ruoyi.common.enums.BusinessType
;
import
com.ruoyi.common.utils.poi.ExcelUtil
;
import
com.ruoyi.system.service.ISysDictTypeService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
/**
* 数据字典信息
...
...
@@ -29,15 +23,13 @@ import com.ruoyi.system.service.ISysDictTypeService;
*/
@RestController
@RequestMapping
(
"/system/dict/type"
)
public
class
SysDictTypeController
extends
BaseController
{
public
class
SysDictTypeController
extends
BaseController
{
@Autowired
private
ISysDictTypeService
dictTypeService
;
@PreAuthorize
(
"@ss.hasPermi('system:dict:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SysDictType
dictType
)
{
public
TableDataInfo
list
(
SysDictType
dictType
)
{
startPage
();
List
<
SysDictType
>
list
=
dictTypeService
.
selectDictTypeList
(
dictType
);
return
getDataTable
(
list
);
...
...
@@ -46,8 +38,7 @@ public class SysDictTypeController extends BaseController
@Log
(
title
=
"字典类型"
,
businessType
=
BusinessType
.
EXPORT
)
@PreAuthorize
(
"@ss.hasPermi('system:dict:export')"
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
SysDictType
dictType
)
{
public
void
export
(
HttpServletResponse
response
,
SysDictType
dictType
)
{
List
<
SysDictType
>
list
=
dictTypeService
.
selectDictTypeList
(
dictType
);
ExcelUtil
<
SysDictType
>
util
=
new
ExcelUtil
<
SysDictType
>(
SysDictType
.
class
);
util
.
exportExcel
(
response
,
list
,
"字典类型"
);
...
...
@@ -58,8 +49,7 @@ public class SysDictTypeController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('system:dict:query')"
)
@GetMapping
(
value
=
"/{dictId}"
)
public
AjaxResult
getInfo
(
@PathVariable
Long
dictId
)
{
public
AjaxResult
getInfo
(
@PathVariable
Long
dictId
)
{
return
success
(
dictTypeService
.
selectDictTypeById
(
dictId
));
}
...
...
@@ -69,10 +59,8 @@ public class SysDictTypeController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:dict:add')"
)
@Log
(
title
=
"字典类型"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@Validated
@RequestBody
SysDictType
dict
)
{
if
(!
dictTypeService
.
checkDictTypeUnique
(
dict
))
{
public
AjaxResult
add
(
@Validated
@RequestBody
SysDictType
dict
)
{
if
(!
dictTypeService
.
checkDictTypeUnique
(
dict
))
{
return
error
(
"新增字典'"
+
dict
.
getDictName
()
+
"'失败,字典类型已存在"
);
}
dict
.
setCreateBy
(
getUsername
());
...
...
@@ -85,10 +73,8 @@ public class SysDictTypeController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:dict:edit')"
)
@Log
(
title
=
"字典类型"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@Validated
@RequestBody
SysDictType
dict
)
{
if
(!
dictTypeService
.
checkDictTypeUnique
(
dict
))
{
public
AjaxResult
edit
(
@Validated
@RequestBody
SysDictType
dict
)
{
if
(!
dictTypeService
.
checkDictTypeUnique
(
dict
))
{
return
error
(
"修改字典'"
+
dict
.
getDictName
()
+
"'失败,字典类型已存在"
);
}
dict
.
setUpdateBy
(
getUsername
());
...
...
@@ -101,10 +87,9 @@ public class SysDictTypeController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:dict:remove')"
)
@Log
(
title
=
"字典类型"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{dictIds}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
dictIds
)
{
public
AjaxResult
remove
(
@PathVariable
Long
[]
dictIds
)
{
dictTypeService
.
deleteDictTypeByIds
(
dictIds
);
return
success
();
return
AjaxResult
.
successDel
();
}
/**
...
...
@@ -113,8 +98,7 @@ public class SysDictTypeController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:dict:remove')"
)
@Log
(
title
=
"字典类型"
,
businessType
=
BusinessType
.
CLEAN
)
@DeleteMapping
(
"/refreshCache"
)
public
AjaxResult
refreshCache
()
{
public
AjaxResult
refreshCache
()
{
dictTypeService
.
resetDictCache
();
return
success
();
}
...
...
@@ -123,8 +107,7 @@ public class SysDictTypeController extends BaseController
* 获取字典选择框列表
*/
@GetMapping
(
"/optionselect"
)
public
AjaxResult
optionselect
()
{
public
AjaxResult
optionselect
()
{
List
<
SysDictType
>
dictTypes
=
dictTypeService
.
selectDictTypeAll
();
return
success
(
dictTypes
);
}
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java
浏览文件 @
0868ec6f
package
com
.
ruoyi
.
web
.
controller
.
system
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.constant.UserConstants
;
import
com.ruoyi.common.core.controller.BaseController
;
...
...
@@ -20,6 +8,12 @@ import com.ruoyi.common.core.domain.entity.SysMenu;
import
com.ruoyi.common.enums.BusinessType
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.system.service.ISysMenuService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* 菜单信息
...
...
@@ -28,8 +22,7 @@ import com.ruoyi.system.service.ISysMenuService;
*/
@RestController
@RequestMapping
(
"/system/menu"
)
public
class
SysMenuController
extends
BaseController
{
public
class
SysMenuController
extends
BaseController
{
@Autowired
private
ISysMenuService
menuService
;
...
...
@@ -38,8 +31,7 @@ public class SysMenuController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('system:menu:list')"
)
@GetMapping
(
"/list"
)
public
AjaxResult
list
(
SysMenu
menu
)
{
public
AjaxResult
list
(
SysMenu
menu
)
{
List
<
SysMenu
>
menus
=
menuService
.
selectMenuList
(
menu
,
getUserId
());
return
success
(
menus
);
}
...
...
@@ -49,8 +41,7 @@ public class SysMenuController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('system:menu:query')"
)
@GetMapping
(
value
=
"/{menuId}"
)
public
AjaxResult
getInfo
(
@PathVariable
Long
menuId
)
{
public
AjaxResult
getInfo
(
@PathVariable
Long
menuId
)
{
return
success
(
menuService
.
selectMenuById
(
menuId
));
}
...
...
@@ -58,8 +49,7 @@ public class SysMenuController extends BaseController
* 获取菜单下拉树列表
*/
@GetMapping
(
"/treeselect"
)
public
AjaxResult
treeselect
(
SysMenu
menu
)
{
public
AjaxResult
treeselect
(
SysMenu
menu
)
{
List
<
SysMenu
>
menus
=
menuService
.
selectMenuList
(
menu
,
getUserId
());
return
success
(
menuService
.
buildMenuTreeSelect
(
menus
));
}
...
...
@@ -68,8 +58,7 @@ public class SysMenuController extends BaseController
* 加载对应角色菜单列表树
*/
@GetMapping
(
value
=
"/roleMenuTreeselect/{roleId}"
)
public
AjaxResult
roleMenuTreeselect
(
@PathVariable
(
"roleId"
)
Long
roleId
)
{
public
AjaxResult
roleMenuTreeselect
(
@PathVariable
(
"roleId"
)
Long
roleId
)
{
List
<
SysMenu
>
menus
=
menuService
.
selectMenuList
(
getUserId
());
AjaxResult
ajax
=
AjaxResult
.
success
();
ajax
.
put
(
"checkedKeys"
,
menuService
.
selectMenuListByRoleId
(
roleId
));
...
...
@@ -83,14 +72,10 @@ public class SysMenuController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:menu:add')"
)
@Log
(
title
=
"菜单管理"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@Validated
@RequestBody
SysMenu
menu
)
{
if
(!
menuService
.
checkMenuNameUnique
(
menu
))
{
public
AjaxResult
add
(
@Validated
@RequestBody
SysMenu
menu
)
{
if
(!
menuService
.
checkMenuNameUnique
(
menu
))
{
return
error
(
"新增菜单'"
+
menu
.
getMenuName
()
+
"'失败,菜单名称已存在"
);
}
else
if
(
UserConstants
.
YES_FRAME
.
equals
(
menu
.
getIsFrame
())
&&
!
StringUtils
.
ishttp
(
menu
.
getPath
()))
{
}
else
if
(
UserConstants
.
YES_FRAME
.
equals
(
menu
.
getIsFrame
())
&&
!
StringUtils
.
ishttp
(
menu
.
getPath
()))
{
return
error
(
"新增菜单'"
+
menu
.
getMenuName
()
+
"'失败,地址必须以http(s)://开头"
);
}
menu
.
setCreateBy
(
getUsername
());
...
...
@@ -103,18 +88,12 @@ public class SysMenuController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:menu:edit')"
)
@Log
(
title
=
"菜单管理"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@Validated
@RequestBody
SysMenu
menu
)
{
if
(!
menuService
.
checkMenuNameUnique
(
menu
))
{
public
AjaxResult
edit
(
@Validated
@RequestBody
SysMenu
menu
)
{
if
(!
menuService
.
checkMenuNameUnique
(
menu
))
{
return
error
(
"修改菜单'"
+
menu
.
getMenuName
()
+
"'失败,菜单名称已存在"
);
}
else
if
(
UserConstants
.
YES_FRAME
.
equals
(
menu
.
getIsFrame
())
&&
!
StringUtils
.
ishttp
(
menu
.
getPath
()))
{
}
else
if
(
UserConstants
.
YES_FRAME
.
equals
(
menu
.
getIsFrame
())
&&
!
StringUtils
.
ishttp
(
menu
.
getPath
()))
{
return
error
(
"修改菜单'"
+
menu
.
getMenuName
()
+
"'失败,地址必须以http(s)://开头"
);
}
else
if
(
menu
.
getMenuId
().
equals
(
menu
.
getParentId
()))
{
}
else
if
(
menu
.
getMenuId
().
equals
(
menu
.
getParentId
()))
{
return
error
(
"修改菜单'"
+
menu
.
getMenuName
()
+
"'失败,上级菜单不能选择自己"
);
}
menu
.
setUpdateBy
(
getUsername
());
...
...
@@ -127,16 +106,13 @@ public class SysMenuController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:menu:remove')"
)
@Log
(
title
=
"菜单管理"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{menuId}"
)
public
AjaxResult
remove
(
@PathVariable
(
"menuId"
)
Long
menuId
)
{
if
(
menuService
.
hasChildByMenuId
(
menuId
))
{
public
AjaxResult
remove
(
@PathVariable
(
"menuId"
)
Long
menuId
)
{
if
(
menuService
.
hasChildByMenuId
(
menuId
))
{
return
warn
(
"存在子菜单,不允许删除"
);
}
if
(
menuService
.
checkMenuExistRole
(
menuId
))
{
if
(
menuService
.
checkMenuExistRole
(
menuId
))
{
return
warn
(
"菜单已分配,不允许删除"
);
}
return
toAjax
(
menuService
.
deleteMenuById
(
menuId
));
return
toAjax
Del
(
menuService
.
deleteMenuById
(
menuId
));
}
}
\ No newline at end of file
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java
浏览文件 @
0868ec6f
package
com
.
ruoyi
.
web
.
controller
.
system
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.domain.AjaxResult
;
...
...
@@ -19,6 +7,12 @@ import com.ruoyi.common.core.page.TableDataInfo;
import
com.ruoyi.common.enums.BusinessType
;
import
com.ruoyi.system.domain.SysNotice
;
import
com.ruoyi.system.service.ISysNoticeService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* 公告 信息操作处理
...
...
@@ -27,8 +21,7 @@ import com.ruoyi.system.service.ISysNoticeService;
*/
@RestController
@RequestMapping
(
"/system/notice"
)
public
class
SysNoticeController
extends
BaseController
{
public
class
SysNoticeController
extends
BaseController
{
@Autowired
private
ISysNoticeService
noticeService
;
...
...
@@ -37,8 +30,7 @@ public class SysNoticeController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('system:notice:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SysNotice
notice
)
{
public
TableDataInfo
list
(
SysNotice
notice
)
{
startPage
();
List
<
SysNotice
>
list
=
noticeService
.
selectNoticeList
(
notice
);
return
getDataTable
(
list
);
...
...
@@ -49,8 +41,7 @@ public class SysNoticeController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('system:notice:query')"
)
@GetMapping
(
value
=
"/{noticeId}"
)
public
AjaxResult
getInfo
(
@PathVariable
Long
noticeId
)
{
public
AjaxResult
getInfo
(
@PathVariable
Long
noticeId
)
{
return
success
(
noticeService
.
selectNoticeById
(
noticeId
));
}
...
...
@@ -60,8 +51,7 @@ public class SysNoticeController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:notice:add')"
)
@Log
(
title
=
"通知公告"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@Validated
@RequestBody
SysNotice
notice
)
{
public
AjaxResult
add
(
@Validated
@RequestBody
SysNotice
notice
)
{
notice
.
setCreateBy
(
getUsername
());
return
toAjax
(
noticeService
.
insertNotice
(
notice
));
}
...
...
@@ -72,8 +62,7 @@ public class SysNoticeController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:notice:edit')"
)
@Log
(
title
=
"通知公告"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@Validated
@RequestBody
SysNotice
notice
)
{
public
AjaxResult
edit
(
@Validated
@RequestBody
SysNotice
notice
)
{
notice
.
setUpdateBy
(
getUsername
());
return
toAjax
(
noticeService
.
updateNotice
(
notice
));
}
...
...
@@ -84,8 +73,7 @@ public class SysNoticeController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:notice:remove')"
)
@Log
(
title
=
"通知公告"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{noticeIds}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
noticeIds
)
{
return
toAjax
(
noticeService
.
deleteNoticeByIds
(
noticeIds
));
public
AjaxResult
remove
(
@PathVariable
Long
[]
noticeIds
)
{
return
toAjaxDel
(
noticeService
.
deleteNoticeByIds
(
noticeIds
));
}
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java
浏览文件 @
0868ec6f
package
com
.
ruoyi
.
web
.
controller
.
system
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.domain.AjaxResult
;
...
...
@@ -21,6 +8,13 @@ import com.ruoyi.common.enums.BusinessType;
import
com.ruoyi.common.utils.poi.ExcelUtil
;
import
com.ruoyi.system.domain.SysPost
;
import
com.ruoyi.system.service.ISysPostService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
/**
* 岗位信息操作处理
...
...
@@ -29,8 +23,7 @@ import com.ruoyi.system.service.ISysPostService;
*/
@RestController
@RequestMapping
(
"/system/post"
)
public
class
SysPostController
extends
BaseController
{
public
class
SysPostController
extends
BaseController
{
@Autowired
private
ISysPostService
postService
;
...
...
@@ -39,8 +32,7 @@ public class SysPostController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('system:post:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SysPost
post
)
{
public
TableDataInfo
list
(
SysPost
post
)
{
startPage
();
List
<
SysPost
>
list
=
postService
.
selectPostList
(
post
);
return
getDataTable
(
list
);
...
...
@@ -49,8 +41,7 @@ public class SysPostController extends BaseController
@Log
(
title
=
"岗位管理"
,
businessType
=
BusinessType
.
EXPORT
)
@PreAuthorize
(
"@ss.hasPermi('system:post:export')"
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
SysPost
post
)
{
public
void
export
(
HttpServletResponse
response
,
SysPost
post
)
{
List
<
SysPost
>
list
=
postService
.
selectPostList
(
post
);
ExcelUtil
<
SysPost
>
util
=
new
ExcelUtil
<
SysPost
>(
SysPost
.
class
);
util
.
exportExcel
(
response
,
list
,
"岗位数据"
);
...
...
@@ -61,8 +52,7 @@ public class SysPostController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('system:post:query')"
)
@GetMapping
(
value
=
"/{postId}"
)
public
AjaxResult
getInfo
(
@PathVariable
Long
postId
)
{
public
AjaxResult
getInfo
(
@PathVariable
Long
postId
)
{
return
success
(
postService
.
selectPostById
(
postId
));
}
...
...
@@ -72,14 +62,10 @@ public class SysPostController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:post:add')"
)
@Log
(
title
=
"岗位管理"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@Validated
@RequestBody
SysPost
post
)
{
if
(!
postService
.
checkPostNameUnique
(
post
))
{
public
AjaxResult
add
(
@Validated
@RequestBody
SysPost
post
)
{
if
(!
postService
.
checkPostNameUnique
(
post
))
{
return
error
(
"新增岗位'"
+
post
.
getPostName
()
+
"'失败,岗位名称已存在"
);
}
else
if
(!
postService
.
checkPostCodeUnique
(
post
))
{
}
else
if
(!
postService
.
checkPostCodeUnique
(
post
))
{
return
error
(
"新增岗位'"
+
post
.
getPostName
()
+
"'失败,岗位编码已存在"
);
}
post
.
setCreateBy
(
getUsername
());
...
...
@@ -92,14 +78,10 @@ public class SysPostController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:post:edit')"
)
@Log
(
title
=
"岗位管理"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@Validated
@RequestBody
SysPost
post
)
{
if
(!
postService
.
checkPostNameUnique
(
post
))
{
public
AjaxResult
edit
(
@Validated
@RequestBody
SysPost
post
)
{
if
(!
postService
.
checkPostNameUnique
(
post
))
{
return
error
(
"修改岗位'"
+
post
.
getPostName
()
+
"'失败,岗位名称已存在"
);
}
else
if
(!
postService
.
checkPostCodeUnique
(
post
))
{
}
else
if
(!
postService
.
checkPostCodeUnique
(
post
))
{
return
error
(
"修改岗位'"
+
post
.
getPostName
()
+
"'失败,岗位编码已存在"
);
}
post
.
setUpdateBy
(
getUsername
());
...
...
@@ -112,17 +94,15 @@ public class SysPostController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:post:remove')"
)
@Log
(
title
=
"岗位管理"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{postIds}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
postIds
)
{
return
toAjax
(
postService
.
deletePostByIds
(
postIds
));
public
AjaxResult
remove
(
@PathVariable
Long
[]
postIds
)
{
return
toAjaxDel
(
postService
.
deletePostByIds
(
postIds
));
}
/**
* 获取岗位选择框列表
*/
@GetMapping
(
"/optionselect"
)
public
AjaxResult
optionselect
()
{
public
AjaxResult
optionselect
()
{
List
<
SysPost
>
posts
=
postService
.
selectPostAll
();
return
success
(
posts
);
}
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java
浏览文件 @
0868ec6f
package
com
.
ruoyi
.
web
.
controller
.
system
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.domain.AjaxResult
;
...
...
@@ -30,6 +17,13 @@ import com.ruoyi.system.domain.SysUserRole;
import
com.ruoyi.system.service.ISysDeptService
;
import
com.ruoyi.system.service.ISysRoleService
;
import
com.ruoyi.system.service.ISysUserService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
/**
* 角色信息
...
...
@@ -38,8 +32,7 @@ import com.ruoyi.system.service.ISysUserService;
*/
@RestController
@RequestMapping
(
"/system/role"
)
public
class
SysRoleController
extends
BaseController
{
public
class
SysRoleController
extends
BaseController
{
@Autowired
private
ISysRoleService
roleService
;
...
...
@@ -57,8 +50,7 @@ public class SysRoleController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:role:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SysRole
role
)
{
public
TableDataInfo
list
(
SysRole
role
)
{
startPage
();
List
<
SysRole
>
list
=
roleService
.
selectRoleList
(
role
);
return
getDataTable
(
list
);
...
...
@@ -67,8 +59,7 @@ public class SysRoleController extends BaseController
@Log
(
title
=
"角色管理"
,
businessType
=
BusinessType
.
EXPORT
)
@PreAuthorize
(
"@ss.hasPermi('system:role:export')"
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
SysRole
role
)
{
public
void
export
(
HttpServletResponse
response
,
SysRole
role
)
{
List
<
SysRole
>
list
=
roleService
.
selectRoleList
(
role
);
ExcelUtil
<
SysRole
>
util
=
new
ExcelUtil
<
SysRole
>(
SysRole
.
class
);
util
.
exportExcel
(
response
,
list
,
"角色数据"
);
...
...
@@ -79,8 +70,7 @@ public class SysRoleController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('system:role:query')"
)
@GetMapping
(
value
=
"/{roleId}"
)
public
AjaxResult
getInfo
(
@PathVariable
Long
roleId
)
{
public
AjaxResult
getInfo
(
@PathVariable
Long
roleId
)
{
roleService
.
checkRoleDataScope
(
roleId
);
return
success
(
roleService
.
selectRoleById
(
roleId
));
}
...
...
@@ -91,14 +81,10 @@ public class SysRoleController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:role:add')"
)
@Log
(
title
=
"角色管理"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@Validated
@RequestBody
SysRole
role
)
{
if
(!
roleService
.
checkRoleNameUnique
(
role
))
{
public
AjaxResult
add
(
@Validated
@RequestBody
SysRole
role
)
{
if
(!
roleService
.
checkRoleNameUnique
(
role
))
{
return
error
(
"新增角色'"
+
role
.
getRoleName
()
+
"'失败,角色名称已存在"
);
}
else
if
(!
roleService
.
checkRoleKeyUnique
(
role
))
{
}
else
if
(!
roleService
.
checkRoleKeyUnique
(
role
))
{
return
error
(
"新增角色'"
+
role
.
getRoleName
()
+
"'失败,角色权限已存在"
);
}
role
.
setCreateBy
(
getUsername
());
...
...
@@ -112,26 +98,20 @@ public class SysRoleController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:role:edit')"
)
@Log
(
title
=
"角色管理"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@Validated
@RequestBody
SysRole
role
)
{
public
AjaxResult
edit
(
@Validated
@RequestBody
SysRole
role
)
{
roleService
.
checkRoleAllowed
(
role
);
roleService
.
checkRoleDataScope
(
role
.
getRoleId
());
if
(!
roleService
.
checkRoleNameUnique
(
role
))
{
if
(!
roleService
.
checkRoleNameUnique
(
role
))
{
return
error
(
"修改角色'"
+
role
.
getRoleName
()
+
"'失败,角色名称已存在"
);
}
else
if
(!
roleService
.
checkRoleKeyUnique
(
role
))
{
}
else
if
(!
roleService
.
checkRoleKeyUnique
(
role
))
{
return
error
(
"修改角色'"
+
role
.
getRoleName
()
+
"'失败,角色权限已存在"
);
}
role
.
setUpdateBy
(
getUsername
());
if
(
roleService
.
updateRole
(
role
)
>
0
)
{
if
(
roleService
.
updateRole
(
role
)
>
0
)
{
// 更新缓存用户权限
LoginUser
loginUser
=
getLoginUser
();
if
(
StringUtils
.
isNotNull
(
loginUser
.
getUser
())
&&
!
loginUser
.
getUser
().
isAdmin
())
{
if
(
StringUtils
.
isNotNull
(
loginUser
.
getUser
())
&&
!
loginUser
.
getUser
().
isAdmin
())
{
loginUser
.
setUser
(
userService
.
selectUserByUserName
(
loginUser
.
getUser
().
getUserName
()));
loginUser
.
setPermissions
(
permissionService
.
getMenuPermission
(
loginUser
.
getUser
()));
tokenService
.
setLoginUser
(
loginUser
);
...
...
@@ -147,8 +127,7 @@ public class SysRoleController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:role:edit')"
)
@Log
(
title
=
"角色管理"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
(
"/dataScope"
)
public
AjaxResult
dataScope
(
@RequestBody
SysRole
role
)
{
public
AjaxResult
dataScope
(
@RequestBody
SysRole
role
)
{
roleService
.
checkRoleAllowed
(
role
);
roleService
.
checkRoleDataScope
(
role
.
getRoleId
());
return
toAjax
(
roleService
.
authDataScope
(
role
));
...
...
@@ -160,8 +139,7 @@ public class SysRoleController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:role:edit')"
)
@Log
(
title
=
"角色管理"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
(
"/changeStatus"
)
public
AjaxResult
changeStatus
(
@RequestBody
SysRole
role
)
{
public
AjaxResult
changeStatus
(
@RequestBody
SysRole
role
)
{
roleService
.
checkRoleAllowed
(
role
);
roleService
.
checkRoleDataScope
(
role
.
getRoleId
());
role
.
setUpdateBy
(
getUsername
());
...
...
@@ -174,9 +152,8 @@ public class SysRoleController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:role:remove')"
)
@Log
(
title
=
"角色管理"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{roleIds}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
roleIds
)
{
return
toAjax
(
roleService
.
deleteRoleByIds
(
roleIds
));
public
AjaxResult
remove
(
@PathVariable
Long
[]
roleIds
)
{
return
toAjaxDel
(
roleService
.
deleteRoleByIds
(
roleIds
));
}
/**
...
...
@@ -184,8 +161,7 @@ public class SysRoleController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('system:role:query')"
)
@GetMapping
(
"/optionselect"
)
public
AjaxResult
optionselect
()
{
public
AjaxResult
optionselect
()
{
return
success
(
roleService
.
selectRoleAll
());
}
...
...
@@ -194,8 +170,7 @@ public class SysRoleController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('system:role:list')"
)
@GetMapping
(
"/authUser/allocatedList"
)
public
TableDataInfo
allocatedList
(
SysUser
user
)
{
public
TableDataInfo
allocatedList
(
SysUser
user
)
{
startPage
();
List
<
SysUser
>
list
=
userService
.
selectAllocatedList
(
user
);
return
getDataTable
(
list
);
...
...
@@ -206,8 +181,7 @@ public class SysRoleController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('system:role:list')"
)
@GetMapping
(
"/authUser/unallocatedList"
)
public
TableDataInfo
unallocatedList
(
SysUser
user
)
{
public
TableDataInfo
unallocatedList
(
SysUser
user
)
{
startPage
();
List
<
SysUser
>
list
=
userService
.
selectUnallocatedList
(
user
);
return
getDataTable
(
list
);
...
...
@@ -219,8 +193,7 @@ public class SysRoleController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:role:edit')"
)
@Log
(
title
=
"角色管理"
,
businessType
=
BusinessType
.
GRANT
)
@PutMapping
(
"/authUser/cancel"
)
public
AjaxResult
cancelAuthUser
(
@RequestBody
SysUserRole
userRole
)
{
public
AjaxResult
cancelAuthUser
(
@RequestBody
SysUserRole
userRole
)
{
return
toAjax
(
roleService
.
deleteAuthUser
(
userRole
));
}
...
...
@@ -230,8 +203,7 @@ public class SysRoleController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:role:edit')"
)
@Log
(
title
=
"角色管理"
,
businessType
=
BusinessType
.
GRANT
)
@PutMapping
(
"/authUser/cancelAll"
)
public
AjaxResult
cancelAuthUserAll
(
Long
roleId
,
Long
[]
userIds
)
{
public
AjaxResult
cancelAuthUserAll
(
Long
roleId
,
Long
[]
userIds
)
{
return
toAjax
(
roleService
.
deleteAuthUsers
(
roleId
,
userIds
));
}
...
...
@@ -241,8 +213,7 @@ public class SysRoleController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:role:edit')"
)
@Log
(
title
=
"角色管理"
,
businessType
=
BusinessType
.
GRANT
)
@PutMapping
(
"/authUser/selectAll"
)
public
AjaxResult
selectAuthUserAll
(
Long
roleId
,
Long
[]
userIds
)
{
public
AjaxResult
selectAuthUserAll
(
Long
roleId
,
Long
[]
userIds
)
{
roleService
.
checkRoleDataScope
(
roleId
);
return
toAjax
(
roleService
.
insertAuthUsers
(
roleId
,
userIds
));
}
...
...
@@ -252,8 +223,7 @@ public class SysRoleController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('system:role:query')"
)
@GetMapping
(
value
=
"/deptTree/{roleId}"
)
public
AjaxResult
deptTree
(
@PathVariable
(
"roleId"
)
Long
roleId
)
{
public
AjaxResult
deptTree
(
@PathVariable
(
"roleId"
)
Long
roleId
)
{
AjaxResult
ajax
=
AjaxResult
.
success
();
ajax
.
put
(
"checkedKeys"
,
deptService
.
selectDeptListByRoleId
(
roleId
));
ajax
.
put
(
"depts"
,
deptService
.
selectDeptTreeList
(
new
SysDept
()));
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
浏览文件 @
0868ec6f
package
com
.
ruoyi
.
web
.
controller
.
system
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.domain.AjaxResult
;
...
...
@@ -31,6 +15,16 @@ import com.ruoyi.system.service.ISysDeptService;
import
com.ruoyi.system.service.ISysPostService
;
import
com.ruoyi.system.service.ISysRoleService
;
import
com.ruoyi.system.service.ISysUserService
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 用户信息
...
...
@@ -39,8 +33,7 @@ import com.ruoyi.system.service.ISysUserService;
*/
@RestController
@RequestMapping
(
"/system/user"
)
public
class
SysUserController
extends
BaseController
{
public
class
SysUserController
extends
BaseController
{
@Autowired
private
ISysUserService
userService
;
...
...
@@ -58,8 +51,7 @@ public class SysUserController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('system:user:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SysUser
user
)
{
public
TableDataInfo
list
(
SysUser
user
)
{
startPage
();
List
<
SysUser
>
list
=
userService
.
selectUserList
(
user
);
return
getDataTable
(
list
);
...
...
@@ -68,8 +60,7 @@ public class SysUserController extends BaseController
@Log
(
title
=
"用户管理"
,
businessType
=
BusinessType
.
EXPORT
)
@PreAuthorize
(
"@ss.hasPermi('system:user:export')"
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
SysUser
user
)
{
public
void
export
(
HttpServletResponse
response
,
SysUser
user
)
{
List
<
SysUser
>
list
=
userService
.
selectUserList
(
user
);
ExcelUtil
<
SysUser
>
util
=
new
ExcelUtil
<
SysUser
>(
SysUser
.
class
);
util
.
exportExcel
(
response
,
list
,
"用户数据"
);
...
...
@@ -78,8 +69,7 @@ public class SysUserController extends BaseController
@Log
(
title
=
"用户管理"
,
businessType
=
BusinessType
.
IMPORT
)
@PreAuthorize
(
"@ss.hasPermi('system:user:import')"
)
@PostMapping
(
"/importData"
)
public
AjaxResult
importData
(
MultipartFile
file
,
boolean
updateSupport
)
throws
Exception
{
public
AjaxResult
importData
(
MultipartFile
file
,
boolean
updateSupport
)
throws
Exception
{
ExcelUtil
<
SysUser
>
util
=
new
ExcelUtil
<
SysUser
>(
SysUser
.
class
);
List
<
SysUser
>
userList
=
util
.
importExcel
(
file
.
getInputStream
());
String
operName
=
getUsername
();
...
...
@@ -88,8 +78,7 @@ public class SysUserController extends BaseController
}
@PostMapping
(
"/importTemplate"
)
public
void
importTemplate
(
HttpServletResponse
response
)
{
public
void
importTemplate
(
HttpServletResponse
response
)
{
ExcelUtil
<
SysUser
>
util
=
new
ExcelUtil
<
SysUser
>(
SysUser
.
class
);
util
.
importTemplateExcel
(
response
,
"用户数据"
);
}
...
...
@@ -98,12 +87,10 @@ public class SysUserController extends BaseController
* 根据用户编号获取详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('system:user:query')"
)
@GetMapping
(
value
=
{
"/"
,
"/{userId}"
})
public
AjaxResult
getInfo
(
@PathVariable
(
value
=
"userId"
,
required
=
false
)
Long
userId
)
{
@GetMapping
(
value
=
{
"/"
,
"/{userId}"
})
public
AjaxResult
getInfo
(
@PathVariable
(
value
=
"userId"
,
required
=
false
)
Long
userId
)
{
AjaxResult
ajax
=
AjaxResult
.
success
();
if
(
StringUtils
.
isNotNull
(
userId
))
{
if
(
StringUtils
.
isNotNull
(
userId
))
{
userService
.
checkUserDataScope
(
userId
);
SysUser
sysUser
=
userService
.
selectUserById
(
userId
);
ajax
.
put
(
AjaxResult
.
DATA_TAG
,
sysUser
);
...
...
@@ -122,20 +109,14 @@ public class SysUserController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:user:add')"
)
@Log
(
title
=
"用户管理"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@Validated
@RequestBody
SysUser
user
)
{
public
AjaxResult
add
(
@Validated
@RequestBody
SysUser
user
)
{
deptService
.
checkDeptDataScope
(
user
.
getDeptId
());
roleService
.
checkRoleDataScope
(
user
.
getRoleIds
());
if
(!
userService
.
checkUserNameUnique
(
user
))
{
if
(!
userService
.
checkUserNameUnique
(
user
))
{
return
error
(
"新增用户'"
+
user
.
getUserName
()
+
"'失败,登录账号已存在"
);
}
else
if
(
StringUtils
.
isNotEmpty
(
user
.
getPhonenumber
())
&&
!
userService
.
checkPhoneUnique
(
user
))
{
}
else
if
(
StringUtils
.
isNotEmpty
(
user
.
getPhonenumber
())
&&
!
userService
.
checkPhoneUnique
(
user
))
{
return
error
(
"新增用户'"
+
user
.
getUserName
()
+
"'失败,手机号码已存在"
);
}
else
if
(
StringUtils
.
isNotEmpty
(
user
.
getEmail
())
&&
!
userService
.
checkEmailUnique
(
user
))
{
}
else
if
(
StringUtils
.
isNotEmpty
(
user
.
getEmail
())
&&
!
userService
.
checkEmailUnique
(
user
))
{
return
error
(
"新增用户'"
+
user
.
getUserName
()
+
"'失败,邮箱账号已存在"
);
}
user
.
setCreateBy
(
getUsername
());
...
...
@@ -149,22 +130,16 @@ public class SysUserController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:user:edit')"
)
@Log
(
title
=
"用户管理"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@Validated
@RequestBody
SysUser
user
)
{
public
AjaxResult
edit
(
@Validated
@RequestBody
SysUser
user
)
{
userService
.
checkUserAllowed
(
user
);
userService
.
checkUserDataScope
(
user
.
getUserId
());
deptService
.
checkDeptDataScope
(
user
.
getDeptId
());
roleService
.
checkRoleDataScope
(
user
.
getRoleIds
());
if
(!
userService
.
checkUserNameUnique
(
user
))
{
if
(!
userService
.
checkUserNameUnique
(
user
))
{
return
error
(
"修改用户'"
+
user
.
getUserName
()
+
"'失败,登录账号已存在"
);
}
else
if
(
StringUtils
.
isNotEmpty
(
user
.
getPhonenumber
())
&&
!
userService
.
checkPhoneUnique
(
user
))
{
}
else
if
(
StringUtils
.
isNotEmpty
(
user
.
getPhonenumber
())
&&
!
userService
.
checkPhoneUnique
(
user
))
{
return
error
(
"修改用户'"
+
user
.
getUserName
()
+
"'失败,手机号码已存在"
);
}
else
if
(
StringUtils
.
isNotEmpty
(
user
.
getEmail
())
&&
!
userService
.
checkEmailUnique
(
user
))
{
}
else
if
(
StringUtils
.
isNotEmpty
(
user
.
getEmail
())
&&
!
userService
.
checkEmailUnique
(
user
))
{
return
error
(
"修改用户'"
+
user
.
getUserName
()
+
"'失败,邮箱账号已存在"
);
}
user
.
setUpdateBy
(
getUsername
());
...
...
@@ -177,13 +152,11 @@ public class SysUserController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:user:remove')"
)
@Log
(
title
=
"用户管理"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{userIds}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
userIds
)
{
if
(
ArrayUtils
.
contains
(
userIds
,
getUserId
()))
{
public
AjaxResult
remove
(
@PathVariable
Long
[]
userIds
)
{
if
(
ArrayUtils
.
contains
(
userIds
,
getUserId
()))
{
return
error
(
"当前用户不能删除"
);
}
return
toAjax
(
userService
.
deleteUserByIds
(
userIds
));
return
toAjax
Del
(
userService
.
deleteUserByIds
(
userIds
));
}
/**
...
...
@@ -192,8 +165,7 @@ public class SysUserController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:user:resetPwd')"
)
@Log
(
title
=
"用户管理"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
(
"/resetPwd"
)
public
AjaxResult
resetPwd
(
@RequestBody
SysUser
user
)
{
public
AjaxResult
resetPwd
(
@RequestBody
SysUser
user
)
{
userService
.
checkUserAllowed
(
user
);
userService
.
checkUserDataScope
(
user
.
getUserId
());
user
.
setPassword
(
SecurityUtils
.
encryptPassword
(
user
.
getPassword
()));
...
...
@@ -207,8 +179,7 @@ public class SysUserController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:user:edit')"
)
@Log
(
title
=
"用户管理"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
(
"/changeStatus"
)
public
AjaxResult
changeStatus
(
@RequestBody
SysUser
user
)
{
public
AjaxResult
changeStatus
(
@RequestBody
SysUser
user
)
{
userService
.
checkUserAllowed
(
user
);
userService
.
checkUserDataScope
(
user
.
getUserId
());
user
.
setUpdateBy
(
getUsername
());
...
...
@@ -220,8 +191,7 @@ public class SysUserController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('system:user:query')"
)
@GetMapping
(
"/authRole/{userId}"
)
public
AjaxResult
authRole
(
@PathVariable
(
"userId"
)
Long
userId
)
{
public
AjaxResult
authRole
(
@PathVariable
(
"userId"
)
Long
userId
)
{
AjaxResult
ajax
=
AjaxResult
.
success
();
SysUser
user
=
userService
.
selectUserById
(
userId
);
List
<
SysRole
>
roles
=
roleService
.
selectRolesByUserId
(
userId
);
...
...
@@ -236,8 +206,7 @@ public class SysUserController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:user:edit')"
)
@Log
(
title
=
"用户管理"
,
businessType
=
BusinessType
.
GRANT
)
@PutMapping
(
"/authRole"
)
public
AjaxResult
insertAuthRole
(
Long
userId
,
Long
[]
roleIds
)
{
public
AjaxResult
insertAuthRole
(
Long
userId
,
Long
[]
roleIds
)
{
userService
.
checkUserDataScope
(
userId
);
roleService
.
checkRoleDataScope
(
roleIds
);
userService
.
insertUserAuth
(
userId
,
roleIds
);
...
...
@@ -249,8 +218,7 @@ public class SysUserController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('system:user:list')"
)
@GetMapping
(
"/deptTree"
)
public
AjaxResult
deptTree
(
SysDept
dept
)
{
public
AjaxResult
deptTree
(
SysDept
dept
)
{
return
success
(
deptService
.
selectDeptTreeList
(
dept
));
}
}
ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java
浏览文件 @
0868ec6f
package
com
.
ruoyi
.
common
.
core
.
controller
;
import
java.beans.PropertyEditorSupport
;
import
java.util.Date
;
import
java.util.List
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.web.bind.WebDataBinder
;
import
org.springframework.web.bind.annotation.InitBinder
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.ruoyi.common.constant.HttpStatus
;
...
...
@@ -20,28 +13,32 @@ import com.ruoyi.common.utils.PageUtils;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.common.utils.sql.SqlUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.web.bind.WebDataBinder
;
import
org.springframework.web.bind.annotation.InitBinder
;
import
java.beans.PropertyEditorSupport
;
import
java.util.Date
;
import
java.util.List
;
/**
* web层通用数据处理
*
* @author ruoyi
*/
public
class
BaseController
{
public
class
BaseController
{
protected
final
Logger
logger
=
LoggerFactory
.
getLogger
(
this
.
getClass
());
/**
* 将前台传递过来的日期格式的字符串,自动转化为Date类型
*/
@InitBinder
public
void
initBinder
(
WebDataBinder
binder
)
{
public
void
initBinder
(
WebDataBinder
binder
)
{
// Date 类型转换
binder
.
registerCustomEditor
(
Date
.
class
,
new
PropertyEditorSupport
()
{
binder
.
registerCustomEditor
(
Date
.
class
,
new
PropertyEditorSupport
()
{
@Override
public
void
setAsText
(
String
text
)
{
public
void
setAsText
(
String
text
)
{
setValue
(
DateUtils
.
parseDate
(
text
));
}
});
...
...
@@ -50,19 +47,16 @@ public class BaseController
/**
* 设置请求分页数据
*/
protected
void
startPage
()
{
protected
void
startPage
()
{
PageUtils
.
startPage
();
}
/**
* 设置请求排序数据
*/
protected
void
startOrderBy
()
{
protected
void
startOrderBy
()
{
PageDomain
pageDomain
=
TableSupport
.
buildPageRequest
();
if
(
StringUtils
.
isNotEmpty
(
pageDomain
.
getOrderBy
()))
{
if
(
StringUtils
.
isNotEmpty
(
pageDomain
.
getOrderBy
()))
{
String
orderBy
=
SqlUtil
.
escapeOrderBySql
(
pageDomain
.
getOrderBy
());
PageHelper
.
orderBy
(
orderBy
);
}
...
...
@@ -71,17 +65,15 @@ public class BaseController
/**
* 清理分页的线程变量
*/
protected
void
clearPage
()
{
protected
void
clearPage
()
{
PageUtils
.
clearPage
();
}
/**
* 响应请求分页数据
*/
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
protected
TableDataInfo
getDataTable
(
List
<?>
list
)
{
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
protected
TableDataInfo
getDataTable
(
List
<?>
list
)
{
TableDataInfo
rspData
=
new
TableDataInfo
();
rspData
.
setCode
(
HttpStatus
.
SUCCESS
);
rspData
.
setMsg
(
"查询成功"
);
...
...
@@ -93,48 +85,42 @@ public class BaseController
/**
* 返回成功
*/
public
AjaxResult
success
()
{
public
AjaxResult
success
()
{
return
AjaxResult
.
success
();
}
/**
* 返回失败消息
*/
public
AjaxResult
error
()
{
public
AjaxResult
error
()
{
return
AjaxResult
.
error
();
}
/**
* 返回成功消息
*/
public
AjaxResult
success
(
String
message
)
{
public
AjaxResult
success
(
String
message
)
{
return
AjaxResult
.
success
(
message
);
}
/**
* 返回成功消息
*/
public
AjaxResult
success
(
Object
data
)
{
public
AjaxResult
success
(
Object
data
)
{
return
AjaxResult
.
success
(
data
);
}
/**
* 返回失败消息
*/
public
AjaxResult
error
(
String
message
)
{
public
AjaxResult
error
(
String
message
)
{
return
AjaxResult
.
error
(
message
);
}
/**
* 返回警告消息
*/
public
AjaxResult
warn
(
String
message
)
{
public
AjaxResult
warn
(
String
message
)
{
return
AjaxResult
.
warn
(
message
);
}
...
...
@@ -144,59 +130,62 @@ public class BaseController
* @param rows 影响行数
* @return 操作结果
*/
protected
AjaxResult
toAjax
(
int
rows
)
{
protected
AjaxResult
toAjax
(
int
rows
)
{
return
rows
>
0
?
AjaxResult
.
success
()
:
AjaxResult
.
error
();
}
/**
* 响应返回结果
*
* @param rows 影响行数
* @return 操作结果
*/
protected
AjaxResult
toAjaxDel
(
int
rows
)
{
return
rows
>
0
?
AjaxResult
.
successDel
()
:
AjaxResult
.
errorDel
();
}
/**
* 响应返回结果
*
* @param result 结果
* @return 操作结果
*/
protected
AjaxResult
toAjax
(
boolean
result
)
{
protected
AjaxResult
toAjax
(
boolean
result
)
{
return
result
?
success
()
:
error
();
}
/**
* 页面跳转
*/
public
String
redirect
(
String
url
)
{
public
String
redirect
(
String
url
)
{
return
StringUtils
.
format
(
"redirect:{}"
,
url
);
}
/**
* 获取用户缓存信息
*/
public
LoginUser
getLoginUser
()
{
public
LoginUser
getLoginUser
()
{
return
SecurityUtils
.
getLoginUser
();
}
/**
* 获取登录用户id
*/
public
Long
getUserId
()
{
public
Long
getUserId
()
{
return
getLoginUser
().
getUserId
();
}
/**
* 获取登录部门id
*/
public
Long
getDeptId
()
{
public
Long
getDeptId
()
{
return
getLoginUser
().
getDeptId
();
}
/**
* 获取登录用户名
*/
public
String
getUsername
()
{
public
String
getUsername
()
{
return
getLoginUser
().
getUsername
();
}
}
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java
浏览文件 @
0868ec6f
package
com
.
ruoyi
.
common
.
core
.
domain
;
import
java.util.HashMap
;
import
java.util.Objects
;
import
com.ruoyi.common.constant.HttpStatus
;
import
com.ruoyi.common.utils.StringUtils
;
import
java.util.HashMap
;
import
java.util.Objects
;
/**
* 操作消息提醒
*
* @author ruoyi
*/
public
class
AjaxResult
extends
HashMap
<
String
,
Object
>
{
public
class
AjaxResult
extends
HashMap
<
String
,
Object
>
{
private
static
final
long
serialVersionUID
=
1L
;
/** 状态码 */
/**
* 状态码
*/
public
static
final
String
CODE_TAG
=
"code"
;
/** 返回内容 */
/**
* 返回内容
*/
public
static
final
String
MSG_TAG
=
"msg"
;
/** 数据对象 */
/**
* 数据对象
*/
public
static
final
String
DATA_TAG
=
"data"
;
/**
* 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
*/
public
AjaxResult
()
{
public
AjaxResult
()
{
}
/**
...
...
@@ -36,8 +41,7 @@ public class AjaxResult extends HashMap<String, Object>
* @param code 状态码
* @param msg 返回内容
*/
public
AjaxResult
(
int
code
,
String
msg
)
{
public
AjaxResult
(
int
code
,
String
msg
)
{
super
.
put
(
CODE_TAG
,
code
);
super
.
put
(
MSG_TAG
,
msg
);
}
...
...
@@ -49,12 +53,10 @@ public class AjaxResult extends HashMap<String, Object>
* @param msg 返回内容
* @param data 数据对象
*/
public
AjaxResult
(
int
code
,
String
msg
,
Object
data
)
{
public
AjaxResult
(
int
code
,
String
msg
,
Object
data
)
{
super
.
put
(
CODE_TAG
,
code
);
super
.
put
(
MSG_TAG
,
msg
);
if
(
StringUtils
.
isNotNull
(
data
))
{
if
(
StringUtils
.
isNotNull
(
data
))
{
super
.
put
(
DATA_TAG
,
data
);
}
}
...
...
@@ -64,18 +66,25 @@ public class AjaxResult extends HashMap<String, Object>
*
* @return 成功消息
*/
public
static
AjaxResult
success
()
{
public
static
AjaxResult
success
()
{
return
AjaxResult
.
success
(
"操作成功"
);
}
/**
* 返回成功消息
*
* @return 成功消息
*/
public
static
AjaxResult
successDel
()
{
return
AjaxResult
.
success
(
"删除成功"
);
}
/**
* 返回成功数据
*
* @return 成功消息
*/
public
static
AjaxResult
success
(
Object
data
)
{
public
static
AjaxResult
success
(
Object
data
)
{
return
AjaxResult
.
success
(
"操作成功"
,
data
);
}
...
...
@@ -85,8 +94,7 @@ public class AjaxResult extends HashMap<String, Object>
* @param msg 返回内容
* @return 成功消息
*/
public
static
AjaxResult
success
(
String
msg
)
{
public
static
AjaxResult
success
(
String
msg
)
{
return
AjaxResult
.
success
(
msg
,
null
);
}
...
...
@@ -97,8 +105,7 @@ public class AjaxResult extends HashMap<String, Object>
* @param data 数据对象
* @return 成功消息
*/
public
static
AjaxResult
success
(
String
msg
,
Object
data
)
{
public
static
AjaxResult
success
(
String
msg
,
Object
data
)
{
return
new
AjaxResult
(
HttpStatus
.
SUCCESS
,
msg
,
data
);
}
...
...
@@ -108,8 +115,7 @@ public class AjaxResult extends HashMap<String, Object>
* @param msg 返回内容
* @return 警告消息
*/
public
static
AjaxResult
warn
(
String
msg
)
{
public
static
AjaxResult
warn
(
String
msg
)
{
return
AjaxResult
.
warn
(
msg
,
null
);
}
...
...
@@ -120,8 +126,7 @@ public class AjaxResult extends HashMap<String, Object>
* @param data 数据对象
* @return 警告消息
*/
public
static
AjaxResult
warn
(
String
msg
,
Object
data
)
{
public
static
AjaxResult
warn
(
String
msg
,
Object
data
)
{
return
new
AjaxResult
(
HttpStatus
.
WARN
,
msg
,
data
);
}
...
...
@@ -130,19 +135,26 @@ public class AjaxResult extends HashMap<String, Object>
*
* @return 错误消息
*/
public
static
AjaxResult
error
()
{
public
static
AjaxResult
error
()
{
return
AjaxResult
.
error
(
"操作失败"
);
}
/**
* 返回错误消息
*
* @return 错误消息
*/
public
static
AjaxResult
errorDel
()
{
return
AjaxResult
.
error
(
"删除失败"
);
}
/**
* 返回错误消息
*
* @param msg 返回内容
* @return 错误消息
*/
public
static
AjaxResult
error
(
String
msg
)
{
public
static
AjaxResult
error
(
String
msg
)
{
return
AjaxResult
.
error
(
msg
,
null
);
}
...
...
@@ -153,8 +165,7 @@ public class AjaxResult extends HashMap<String, Object>
* @param data 数据对象
* @return 错误消息
*/
public
static
AjaxResult
error
(
String
msg
,
Object
data
)
{
public
static
AjaxResult
error
(
String
msg
,
Object
data
)
{
return
new
AjaxResult
(
HttpStatus
.
ERROR
,
msg
,
data
);
}
...
...
@@ -165,8 +176,7 @@ public class AjaxResult extends HashMap<String, Object>
* @param msg 返回内容
* @return 错误消息
*/
public
static
AjaxResult
error
(
int
code
,
String
msg
)
{
public
static
AjaxResult
error
(
int
code
,
String
msg
)
{
return
new
AjaxResult
(
code
,
msg
,
null
);
}
...
...
@@ -175,8 +185,7 @@ public class AjaxResult extends HashMap<String, Object>
*
* @return 结果
*/
public
boolean
isSuccess
()
{
public
boolean
isSuccess
()
{
return
Objects
.
equals
(
HttpStatus
.
SUCCESS
,
this
.
get
(
CODE_TAG
));
}
...
...
@@ -185,8 +194,7 @@ public class AjaxResult extends HashMap<String, Object>
*
* @return 结果
*/
public
boolean
isWarn
()
{
public
boolean
isWarn
()
{
return
Objects
.
equals
(
HttpStatus
.
WARN
,
this
.
get
(
CODE_TAG
));
}
...
...
@@ -195,8 +203,7 @@ public class AjaxResult extends HashMap<String, Object>
*
* @return 结果
*/
public
boolean
isError
()
{
public
boolean
isError
()
{
return
Objects
.
equals
(
HttpStatus
.
ERROR
,
this
.
get
(
CODE_TAG
));
}
...
...
@@ -208,8 +215,7 @@ public class AjaxResult extends HashMap<String, Object>
* @return 数据对象
*/
@Override
public
AjaxResult
put
(
String
key
,
Object
value
)
{
public
AjaxResult
put
(
String
key
,
Object
value
)
{
super
.
put
(
key
,
value
);
return
this
;
}
...
...
ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java
浏览文件 @
0868ec6f
package
com
.
ruoyi
.
generator
.
controller
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.commons.io.IOUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.alibaba.druid.DbType
;
import
com.alibaba.druid.sql.SQLUtils
;
import
com.alibaba.druid.sql.ast.SQLStatement
;
...
...
@@ -34,6 +16,18 @@ import com.ruoyi.generator.domain.GenTable;
import
com.ruoyi.generator.domain.GenTableColumn
;
import
com.ruoyi.generator.service.IGenTableColumnService
;
import
com.ruoyi.generator.service.IGenTableService
;
import
org.apache.commons.io.IOUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 代码生成 操作处理
...
...
@@ -42,8 +36,7 @@ import com.ruoyi.generator.service.IGenTableService;
*/
@RestController
@RequestMapping
(
"/tool/gen"
)
public
class
GenController
extends
BaseController
{
public
class
GenController
extends
BaseController
{
@Autowired
private
IGenTableService
genTableService
;
...
...
@@ -55,8 +48,7 @@ public class GenController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('tool:gen:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
genList
(
GenTable
genTable
)
{
public
TableDataInfo
genList
(
GenTable
genTable
)
{
startPage
();
List
<
GenTable
>
list
=
genTableService
.
selectGenTableList
(
genTable
);
return
getDataTable
(
list
);
...
...
@@ -67,8 +59,7 @@ public class GenController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('tool:gen:query')"
)
@GetMapping
(
value
=
"/{tableId}"
)
public
AjaxResult
getInfo
(
@PathVariable
Long
tableId
)
{
public
AjaxResult
getInfo
(
@PathVariable
Long
tableId
)
{
GenTable
table
=
genTableService
.
selectGenTableById
(
tableId
);
List
<
GenTable
>
tables
=
genTableService
.
selectGenTableAll
();
List
<
GenTableColumn
>
list
=
genTableColumnService
.
selectGenTableColumnListByTableId
(
tableId
);
...
...
@@ -84,8 +75,7 @@ public class GenController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('tool:gen:list')"
)
@GetMapping
(
"/db/list"
)
public
TableDataInfo
dataList
(
GenTable
genTable
)
{
public
TableDataInfo
dataList
(
GenTable
genTable
)
{
startPage
();
List
<
GenTable
>
list
=
genTableService
.
selectDbTableList
(
genTable
);
return
getDataTable
(
list
);
...
...
@@ -96,8 +86,7 @@ public class GenController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('tool:gen:list')"
)
@GetMapping
(
value
=
"/column/{tableId}"
)
public
TableDataInfo
columnList
(
Long
tableId
)
{
public
TableDataInfo
columnList
(
Long
tableId
)
{
TableDataInfo
dataInfo
=
new
TableDataInfo
();
List
<
GenTableColumn
>
list
=
genTableColumnService
.
selectGenTableColumnListByTableId
(
tableId
);
dataInfo
.
setRows
(
list
);
...
...
@@ -111,8 +100,7 @@ public class GenController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('tool:gen:import')"
)
@Log
(
title
=
"代码生成"
,
businessType
=
BusinessType
.
IMPORT
)
@PostMapping
(
"/importTable"
)
public
AjaxResult
importTableSave
(
String
tables
)
{
public
AjaxResult
importTableSave
(
String
tables
)
{
String
[]
tableNames
=
Convert
.
toStrArray
(
tables
);
// 查询表信息
List
<
GenTable
>
tableList
=
genTableService
.
selectDbTableListByNames
(
tableNames
);
...
...
@@ -126,20 +114,15 @@ public class GenController extends BaseController
@PreAuthorize
(
"@ss.hasRole('admin')"
)
@Log
(
title
=
"创建表"
,
businessType
=
BusinessType
.
OTHER
)
@PostMapping
(
"/createTable"
)
public
AjaxResult
createTableSave
(
String
sql
)
{
try
{
public
AjaxResult
createTableSave
(
String
sql
)
{
try
{
SqlUtil
.
filterKeyword
(
sql
);
List
<
SQLStatement
>
sqlStatements
=
SQLUtils
.
parseStatements
(
sql
,
DbType
.
mysql
);
List
<
String
>
tableNames
=
new
ArrayList
<>();
for
(
SQLStatement
sqlStatement
:
sqlStatements
)
{
if
(
sqlStatement
instanceof
MySqlCreateTableStatement
)
{
for
(
SQLStatement
sqlStatement
:
sqlStatements
)
{
if
(
sqlStatement
instanceof
MySqlCreateTableStatement
)
{
MySqlCreateTableStatement
createTableStatement
=
(
MySqlCreateTableStatement
)
sqlStatement
;
if
(
genTableService
.
createTable
(
createTableStatement
.
toString
()))
{
if
(
genTableService
.
createTable
(
createTableStatement
.
toString
()))
{
String
tableName
=
createTableStatement
.
getTableName
().
replaceAll
(
"`"
,
""
);
tableNames
.
add
(
tableName
);
}
...
...
@@ -149,9 +132,7 @@ public class GenController extends BaseController
String
operName
=
SecurityUtils
.
getUsername
();
genTableService
.
importGenTable
(
tableList
,
operName
);
return
AjaxResult
.
success
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
return
AjaxResult
.
error
(
"创建表结构异常"
);
}
...
...
@@ -163,8 +144,7 @@ public class GenController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('tool:gen:edit')"
)
@Log
(
title
=
"代码生成"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
editSave
(
@Validated
@RequestBody
GenTable
genTable
)
{
public
AjaxResult
editSave
(
@Validated
@RequestBody
GenTable
genTable
)
{
genTableService
.
validateEdit
(
genTable
);
genTableService
.
updateGenTable
(
genTable
);
return
success
();
...
...
@@ -176,10 +156,9 @@ public class GenController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('tool:gen:remove')"
)
@Log
(
title
=
"代码生成"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{tableIds}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
tableIds
)
{
public
AjaxResult
remove
(
@PathVariable
Long
[]
tableIds
)
{
genTableService
.
deleteGenTableByIds
(
tableIds
);
return
success
();
return
AjaxResult
.
successDel
();
}
/**
...
...
@@ -187,8 +166,7 @@ public class GenController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('tool:gen:preview')"
)
@GetMapping
(
"/preview/{tableId}"
)
public
AjaxResult
preview
(
@PathVariable
(
"tableId"
)
Long
tableId
)
throws
IOException
{
public
AjaxResult
preview
(
@PathVariable
(
"tableId"
)
Long
tableId
)
throws
IOException
{
Map
<
String
,
String
>
dataMap
=
genTableService
.
previewCode
(
tableId
);
return
success
(
dataMap
);
}
...
...
@@ -199,8 +177,7 @@ public class GenController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('tool:gen:code')"
)
@Log
(
title
=
"代码生成"
,
businessType
=
BusinessType
.
GENCODE
)
@GetMapping
(
"/download/{tableName}"
)
public
void
download
(
HttpServletResponse
response
,
@PathVariable
(
"tableName"
)
String
tableName
)
throws
IOException
{
public
void
download
(
HttpServletResponse
response
,
@PathVariable
(
"tableName"
)
String
tableName
)
throws
IOException
{
byte
[]
data
=
genTableService
.
downloadCode
(
tableName
);
genCode
(
response
,
data
);
}
...
...
@@ -211,8 +188,7 @@ public class GenController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('tool:gen:code')"
)
@Log
(
title
=
"代码生成"
,
businessType
=
BusinessType
.
GENCODE
)
@GetMapping
(
"/genCode/{tableName}"
)
public
AjaxResult
genCode
(
@PathVariable
(
"tableName"
)
String
tableName
)
{
public
AjaxResult
genCode
(
@PathVariable
(
"tableName"
)
String
tableName
)
{
genTableService
.
generatorCode
(
tableName
);
return
success
();
}
...
...
@@ -223,8 +199,7 @@ public class GenController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('tool:gen:edit')"
)
@Log
(
title
=
"代码生成"
,
businessType
=
BusinessType
.
UPDATE
)
@GetMapping
(
"/synchDb/{tableName}"
)
public
AjaxResult
synchDb
(
@PathVariable
(
"tableName"
)
String
tableName
)
{
public
AjaxResult
synchDb
(
@PathVariable
(
"tableName"
)
String
tableName
)
{
genTableService
.
synchDb
(
tableName
);
return
success
();
}
...
...
@@ -235,8 +210,7 @@ public class GenController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('tool:gen:code')"
)
@Log
(
title
=
"代码生成"
,
businessType
=
BusinessType
.
GENCODE
)
@GetMapping
(
"/batchGenCode"
)
public
void
batchGenCode
(
HttpServletResponse
response
,
String
tables
)
throws
IOException
{
public
void
batchGenCode
(
HttpServletResponse
response
,
String
tables
)
throws
IOException
{
String
[]
tableNames
=
Convert
.
toStrArray
(
tables
);
byte
[]
data
=
genTableService
.
downloadCode
(
tableNames
);
genCode
(
response
,
data
);
...
...
@@ -245,8 +219,7 @@ public class GenController extends BaseController
/**
* 生成zip文件
*/
private
void
genCode
(
HttpServletResponse
response
,
byte
[]
data
)
throws
IOException
{
private
void
genCode
(
HttpServletResponse
response
,
byte
[]
data
)
throws
IOException
{
response
.
reset
();
response
.
addHeader
(
"Access-Control-Allow-Origin"
,
"*"
);
response
.
addHeader
(
"Access-Control-Expose-Headers"
,
"Content-Disposition"
);
...
...
ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java
浏览文件 @
0868ec6f
package
com
.
ruoyi
.
quartz
.
controller
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
org.quartz.SchedulerException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.constant.Constants
;
import
com.ruoyi.common.core.controller.BaseController
;
...
...
@@ -26,6 +13,13 @@ import com.ruoyi.quartz.domain.SysJob;
import
com.ruoyi.quartz.service.ISysJobService
;
import
com.ruoyi.quartz.util.CronUtils
;
import
com.ruoyi.quartz.util.ScheduleUtils
;
import
org.quartz.SchedulerException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
/**
* 调度任务信息操作处理
...
...
@@ -34,8 +28,7 @@ import com.ruoyi.quartz.util.ScheduleUtils;
*/
@RestController
@RequestMapping
(
"/monitor/job"
)
public
class
SysJobController
extends
BaseController
{
public
class
SysJobController
extends
BaseController
{
@Autowired
private
ISysJobService
jobService
;
...
...
@@ -44,8 +37,7 @@ public class SysJobController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('monitor:job:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SysJob
sysJob
)
{
public
TableDataInfo
list
(
SysJob
sysJob
)
{
startPage
();
List
<
SysJob
>
list
=
jobService
.
selectJobList
(
sysJob
);
return
getDataTable
(
list
);
...
...
@@ -57,8 +49,7 @@ public class SysJobController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('monitor:job:export')"
)
@Log
(
title
=
"定时任务"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
SysJob
sysJob
)
{
public
void
export
(
HttpServletResponse
response
,
SysJob
sysJob
)
{
List
<
SysJob
>
list
=
jobService
.
selectJobList
(
sysJob
);
ExcelUtil
<
SysJob
>
util
=
new
ExcelUtil
<
SysJob
>(
SysJob
.
class
);
util
.
exportExcel
(
response
,
list
,
"定时任务"
);
...
...
@@ -69,8 +60,7 @@ public class SysJobController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('monitor:job:query')"
)
@GetMapping
(
value
=
"/{jobId}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"jobId"
)
Long
jobId
)
{
public
AjaxResult
getInfo
(
@PathVariable
(
"jobId"
)
Long
jobId
)
{
return
success
(
jobService
.
selectJobById
(
jobId
));
}
...
...
@@ -80,30 +70,18 @@ public class SysJobController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('monitor:job:add')"
)
@Log
(
title
=
"定时任务"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
SysJob
job
)
throws
SchedulerException
,
TaskException
{
if
(!
CronUtils
.
isValid
(
job
.
getCronExpression
()))
{
public
AjaxResult
add
(
@RequestBody
SysJob
job
)
throws
SchedulerException
,
TaskException
{
if
(!
CronUtils
.
isValid
(
job
.
getCronExpression
()))
{
return
error
(
"新增任务'"
+
job
.
getJobName
()
+
"'失败,Cron表达式不正确"
);
}
else
if
(
StringUtils
.
containsIgnoreCase
(
job
.
getInvokeTarget
(),
Constants
.
LOOKUP_RMI
))
{
}
else
if
(
StringUtils
.
containsIgnoreCase
(
job
.
getInvokeTarget
(),
Constants
.
LOOKUP_RMI
))
{
return
error
(
"新增任务'"
+
job
.
getJobName
()
+
"'失败,目标字符串不允许'rmi'调用"
);
}
else
if
(
StringUtils
.
containsAnyIgnoreCase
(
job
.
getInvokeTarget
(),
new
String
[]
{
Constants
.
LOOKUP_LDAP
,
Constants
.
LOOKUP_LDAPS
}))
{
}
else
if
(
StringUtils
.
containsAnyIgnoreCase
(
job
.
getInvokeTarget
(),
new
String
[]{
Constants
.
LOOKUP_LDAP
,
Constants
.
LOOKUP_LDAPS
}))
{
return
error
(
"新增任务'"
+
job
.
getJobName
()
+
"'失败,目标字符串不允许'ldap(s)'调用"
);
}
else
if
(
StringUtils
.
containsAnyIgnoreCase
(
job
.
getInvokeTarget
(),
new
String
[]
{
Constants
.
HTTP
,
Constants
.
HTTPS
}))
{
}
else
if
(
StringUtils
.
containsAnyIgnoreCase
(
job
.
getInvokeTarget
(),
new
String
[]{
Constants
.
HTTP
,
Constants
.
HTTPS
}))
{
return
error
(
"新增任务'"
+
job
.
getJobName
()
+
"'失败,目标字符串不允许'http(s)'调用"
);
}
else
if
(
StringUtils
.
containsAnyIgnoreCase
(
job
.
getInvokeTarget
(),
Constants
.
JOB_ERROR_STR
))
{
}
else
if
(
StringUtils
.
containsAnyIgnoreCase
(
job
.
getInvokeTarget
(),
Constants
.
JOB_ERROR_STR
))
{
return
error
(
"新增任务'"
+
job
.
getJobName
()
+
"'失败,目标字符串存在违规"
);
}
else
if
(!
ScheduleUtils
.
whiteList
(
job
.
getInvokeTarget
()))
{
}
else
if
(!
ScheduleUtils
.
whiteList
(
job
.
getInvokeTarget
()))
{
return
error
(
"新增任务'"
+
job
.
getJobName
()
+
"'失败,目标字符串不在白名单内"
);
}
job
.
setCreateBy
(
getUsername
());
...
...
@@ -116,30 +94,18 @@ public class SysJobController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('monitor:job:edit')"
)
@Log
(
title
=
"定时任务"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
SysJob
job
)
throws
SchedulerException
,
TaskException
{
if
(!
CronUtils
.
isValid
(
job
.
getCronExpression
()))
{
public
AjaxResult
edit
(
@RequestBody
SysJob
job
)
throws
SchedulerException
,
TaskException
{
if
(!
CronUtils
.
isValid
(
job
.
getCronExpression
()))
{
return
error
(
"修改任务'"
+
job
.
getJobName
()
+
"'失败,Cron表达式不正确"
);
}
else
if
(
StringUtils
.
containsIgnoreCase
(
job
.
getInvokeTarget
(),
Constants
.
LOOKUP_RMI
))
{
}
else
if
(
StringUtils
.
containsIgnoreCase
(
job
.
getInvokeTarget
(),
Constants
.
LOOKUP_RMI
))
{
return
error
(
"修改任务'"
+
job
.
getJobName
()
+
"'失败,目标字符串不允许'rmi'调用"
);
}
else
if
(
StringUtils
.
containsAnyIgnoreCase
(
job
.
getInvokeTarget
(),
new
String
[]
{
Constants
.
LOOKUP_LDAP
,
Constants
.
LOOKUP_LDAPS
}))
{
}
else
if
(
StringUtils
.
containsAnyIgnoreCase
(
job
.
getInvokeTarget
(),
new
String
[]{
Constants
.
LOOKUP_LDAP
,
Constants
.
LOOKUP_LDAPS
}))
{
return
error
(
"修改任务'"
+
job
.
getJobName
()
+
"'失败,目标字符串不允许'ldap(s)'调用"
);
}
else
if
(
StringUtils
.
containsAnyIgnoreCase
(
job
.
getInvokeTarget
(),
new
String
[]
{
Constants
.
HTTP
,
Constants
.
HTTPS
}))
{
}
else
if
(
StringUtils
.
containsAnyIgnoreCase
(
job
.
getInvokeTarget
(),
new
String
[]{
Constants
.
HTTP
,
Constants
.
HTTPS
}))
{
return
error
(
"修改任务'"
+
job
.
getJobName
()
+
"'失败,目标字符串不允许'http(s)'调用"
);
}
else
if
(
StringUtils
.
containsAnyIgnoreCase
(
job
.
getInvokeTarget
(),
Constants
.
JOB_ERROR_STR
))
{
}
else
if
(
StringUtils
.
containsAnyIgnoreCase
(
job
.
getInvokeTarget
(),
Constants
.
JOB_ERROR_STR
))
{
return
error
(
"修改任务'"
+
job
.
getJobName
()
+
"'失败,目标字符串存在违规"
);
}
else
if
(!
ScheduleUtils
.
whiteList
(
job
.
getInvokeTarget
()))
{
}
else
if
(!
ScheduleUtils
.
whiteList
(
job
.
getInvokeTarget
()))
{
return
error
(
"修改任务'"
+
job
.
getJobName
()
+
"'失败,目标字符串不在白名单内"
);
}
job
.
setUpdateBy
(
getUsername
());
...
...
@@ -152,8 +118,7 @@ public class SysJobController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('monitor:job:changeStatus')"
)
@Log
(
title
=
"定时任务"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
(
"/changeStatus"
)
public
AjaxResult
changeStatus
(
@RequestBody
SysJob
job
)
throws
SchedulerException
{
public
AjaxResult
changeStatus
(
@RequestBody
SysJob
job
)
throws
SchedulerException
{
SysJob
newJob
=
jobService
.
selectJobById
(
job
.
getJobId
());
newJob
.
setStatus
(
job
.
getStatus
());
return
toAjax
(
jobService
.
changeStatus
(
newJob
));
...
...
@@ -165,8 +130,7 @@ public class SysJobController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('monitor:job:changeStatus')"
)
@Log
(
title
=
"定时任务"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
(
"/run"
)
public
AjaxResult
run
(
@RequestBody
SysJob
job
)
throws
SchedulerException
{
public
AjaxResult
run
(
@RequestBody
SysJob
job
)
throws
SchedulerException
{
boolean
result
=
jobService
.
run
(
job
);
return
result
?
success
()
:
error
(
"任务不存在或已过期!"
);
}
...
...
@@ -177,9 +141,8 @@ public class SysJobController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('monitor:job:remove')"
)
@Log
(
title
=
"定时任务"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{jobIds}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
jobIds
)
throws
SchedulerException
,
TaskException
{
public
AjaxResult
remove
(
@PathVariable
Long
[]
jobIds
)
throws
SchedulerException
,
TaskException
{
jobService
.
deleteJobByIds
(
jobIds
);
return
success
();
return
AjaxResult
.
successDel
();
}
}
ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java
浏览文件 @
0868ec6f
package
com
.
ruoyi
.
quartz
.
controller
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.domain.AjaxResult
;
...
...
@@ -18,6 +8,12 @@ import com.ruoyi.common.enums.BusinessType;
import
com.ruoyi.common.utils.poi.ExcelUtil
;
import
com.ruoyi.quartz.domain.SysJobLog
;
import
com.ruoyi.quartz.service.ISysJobLogService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
/**
* 调度日志操作处理
...
...
@@ -26,8 +22,7 @@ import com.ruoyi.quartz.service.ISysJobLogService;
*/
@RestController
@RequestMapping
(
"/monitor/jobLog"
)
public
class
SysJobLogController
extends
BaseController
{
public
class
SysJobLogController
extends
BaseController
{
@Autowired
private
ISysJobLogService
jobLogService
;
...
...
@@ -36,8 +31,7 @@ public class SysJobLogController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('monitor:job:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SysJobLog
sysJobLog
)
{
public
TableDataInfo
list
(
SysJobLog
sysJobLog
)
{
startPage
();
List
<
SysJobLog
>
list
=
jobLogService
.
selectJobLogList
(
sysJobLog
);
return
getDataTable
(
list
);
...
...
@@ -49,8 +43,7 @@ public class SysJobLogController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('monitor:job:export')"
)
@Log
(
title
=
"任务调度日志"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
SysJobLog
sysJobLog
)
{
public
void
export
(
HttpServletResponse
response
,
SysJobLog
sysJobLog
)
{
List
<
SysJobLog
>
list
=
jobLogService
.
selectJobLogList
(
sysJobLog
);
ExcelUtil
<
SysJobLog
>
util
=
new
ExcelUtil
<
SysJobLog
>(
SysJobLog
.
class
);
util
.
exportExcel
(
response
,
list
,
"调度日志"
);
...
...
@@ -61,8 +54,7 @@ public class SysJobLogController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('monitor:job:query')"
)
@GetMapping
(
value
=
"/{jobLogId}"
)
public
AjaxResult
getInfo
(
@PathVariable
Long
jobLogId
)
{
public
AjaxResult
getInfo
(
@PathVariable
Long
jobLogId
)
{
return
success
(
jobLogService
.
selectJobLogById
(
jobLogId
));
}
...
...
@@ -73,9 +65,8 @@ public class SysJobLogController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('monitor:job:remove')"
)
@Log
(
title
=
"定时任务调度日志"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{jobLogIds}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
jobLogIds
)
{
return
toAjax
(
jobLogService
.
deleteJobLogByIds
(
jobLogIds
));
public
AjaxResult
remove
(
@PathVariable
Long
[]
jobLogIds
)
{
return
toAjaxDel
(
jobLogService
.
deleteJobLogByIds
(
jobLogIds
));
}
/**
...
...
@@ -84,8 +75,7 @@ public class SysJobLogController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('monitor:job:remove')"
)
@Log
(
title
=
"调度日志"
,
businessType
=
BusinessType
.
CLEAN
)
@DeleteMapping
(
"/clean"
)
public
AjaxResult
clean
()
{
public
AjaxResult
clean
()
{
jobLogService
.
cleanJobLog
();
return
success
();
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论