feat(system):重构系统配置相关接口以支持Vue前端

- 修改了系统配置、字典数据、部门管理等多个模块的URL路径,添加/vue前缀以区分新旧接口- 新增了针对Vue前端的控制器方法,提供更友好的RESTful API支持
- 更新了前端API调用地址,确保与后端新接口路径一致- 调整了部分字段名称,如登录名从userName改为loginName,提高前后端数据一致性
- 增加了对排序参数的处理逻辑,支持ascending和descending关键字转换
- 优化了文件下载功能,通过响应码判断是否成功并跳转到下载链接
- 扩展了导出功能,允许将字典数据等信息导出为Excel表格
- 完善了权限校验和日志记录机制,增强系统的安全性与可追溯性
dev_1.0.0
chenhao 2025-11-18 20:16:46 +08:00
parent d92dd377cc
commit d5c75ad04a
33 changed files with 973 additions and 233 deletions

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询定时任务调度列表
export function listJob(query) {
return request({
url: '/monitor/job/list',
url: '/monitor/job/list/vue',
method: 'get',
params: query
})
@ -12,7 +12,7 @@ export function listJob(query) {
// 查询定时任务调度详细
export function getJob(jobId) {
return request({
url: '/monitor/job/' + jobId,
url: '/monitor/job/vue/' + jobId,
method: 'get'
})
}
@ -20,7 +20,7 @@ export function getJob(jobId) {
// 新增定时任务调度
export function addJob(data) {
return request({
url: '/monitor/job',
url: '/monitor/job/vue',
method: 'post',
data: data
})
@ -29,7 +29,7 @@ export function addJob(data) {
// 修改定时任务调度
export function updateJob(data) {
return request({
url: '/monitor/job',
url: '/monitor/job/vue',
method: 'put',
data: data
})
@ -38,7 +38,7 @@ export function updateJob(data) {
// 删除定时任务调度
export function delJob(jobId) {
return request({
url: '/monitor/job/' + jobId,
url: '/monitor/job/vue/' + jobId,
method: 'delete'
})
}
@ -50,7 +50,7 @@ export function changeJobStatus(jobId, status) {
status
}
return request({
url: '/monitor/job/changeStatus',
url: '/monitor/job/changeStatus/vue',
method: 'put',
data: data
})
@ -64,7 +64,7 @@ export function runJob(jobId, jobGroup) {
jobGroup
}
return request({
url: '/monitor/job/run',
url: '/monitor/job/run/vue',
method: 'put',
data: data
})

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询调度日志列表
export function listJobLog(query) {
return request({
url: '/monitor/jobLog/list',
url: '/monitor/jobLog/list/vue',
method: 'get',
params: query
})
@ -12,7 +12,7 @@ export function listJobLog(query) {
// 删除调度日志
export function delJobLog(jobLogId) {
return request({
url: '/monitor/jobLog/' + jobLogId,
url: '/monitor/jobLog/vue/' + jobLogId,
method: 'delete'
})
}
@ -20,7 +20,7 @@ export function delJobLog(jobLogId) {
// 清空调度日志
export function cleanJobLog() {
return request({
url: '/monitor/jobLog/clean',
url: '/monitor/jobLog/clean/vue',
method: 'delete'
})
}

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询登录日志列表
export function list(query) {
return request({
url: '/monitor/logininfor/list',
url: '/monitor/logininfor/list/vue',
method: 'get',
params: query
})
@ -12,7 +12,7 @@ export function list(query) {
// 删除登录日志
export function delLogininfor(infoId) {
return request({
url: '/monitor/logininfor/' + infoId,
url: '/monitor/logininfor/vue/' + infoId,
method: 'delete'
})
}
@ -20,7 +20,7 @@ export function delLogininfor(infoId) {
// 解锁用户登录状态
export function unlockLogininfor(userName) {
return request({
url: '/monitor/logininfor/unlock/' + userName,
url: '/monitor/logininfor/unlock/vue/' + userName,
method: 'get'
})
}
@ -28,7 +28,7 @@ export function unlockLogininfor(userName) {
// 清空登录日志
export function cleanLogininfor() {
return request({
url: '/monitor/logininfor/clean',
url: '/monitor/logininfor/clean/vue',
method: 'delete'
})
}

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询在线用户列表
export function list(query) {
return request({
url: '/monitor/online/list',
url: '/monitor/online/list/vue',
method: 'get',
params: query
})
@ -12,7 +12,7 @@ export function list(query) {
// 强退用户
export function forceLogout(tokenId) {
return request({
url: '/monitor/online/' + tokenId,
url: '/monitor/online/vue/' + tokenId,
method: 'delete'
})
}

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询操作日志列表
export function list(query) {
return request({
url: '/monitor/operlog/list',
url: '/monitor/operlog/list/vue',
method: 'get',
params: query
})
@ -12,7 +12,7 @@ export function list(query) {
// 删除操作日志
export function delOperlog(operId) {
return request({
url: '/monitor/operlog/' + operId,
url: '/monitor/operlog/vue/' + operId,
method: 'delete'
})
}
@ -20,7 +20,7 @@ export function delOperlog(operId) {
// 清空操作日志
export function cleanOperlog() {
return request({
url: '/monitor/operlog/clean',
url: '/monitor/operlog/clean/vue',
method: 'delete'
})
}

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 获取服务信息
export function getServer() {
return request({
url: '/monitor/server',
url: '/monitor/server/vue',
method: 'get'
})
}

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询参数列表
export function listConfig(query) {
return request({
url: '/system/config/list',
url: '/system/config/list/vue',
method: 'get',
params: query
})
@ -12,7 +12,7 @@ export function listConfig(query) {
// 查询参数详细
export function getConfig(configId) {
return request({
url: '/system/config/' + configId,
url: '/system/config/vue/' + configId,
method: 'get'
})
}
@ -20,7 +20,7 @@ export function getConfig(configId) {
// 根据参数键名查询参数值
export function getConfigKey(configKey) {
return request({
url: '/system/config/configKey/' + configKey,
url: '/system/config/configKey/vue/' + configKey,
method: 'get'
})
}
@ -28,7 +28,7 @@ export function getConfigKey(configKey) {
// 新增参数配置
export function addConfig(data) {
return request({
url: '/system/config',
url: '/system/config/vue',
method: 'post',
data: data
})
@ -37,7 +37,7 @@ export function addConfig(data) {
// 修改参数配置
export function updateConfig(data) {
return request({
url: '/system/config',
url: '/system/config/vue',
method: 'put',
data: data
})
@ -46,7 +46,7 @@ export function updateConfig(data) {
// 删除参数配置
export function delConfig(configId) {
return request({
url: '/system/config/' + configId,
url: '/system/config/vue/' + configId,
method: 'delete'
})
}
@ -54,7 +54,7 @@ export function delConfig(configId) {
// 刷新参数缓存
export function refreshCache() {
return request({
url: '/system/config/refreshCache',
url: '/system/config/refreshCache/vue',
method: 'delete'
})
}

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询部门列表
export function listDept(query) {
return request({
url: '/system/dept/list',
url: '/system/dept/vue/list',
method: 'get',
params: query
})
@ -12,7 +12,7 @@ export function listDept(query) {
// 查询部门列表(排除节点)
export function listDeptExcludeChild(deptId) {
return request({
url: '/system/dept/list/exclude/' + deptId,
url: '/system/dept/vue/list/exclude/' + deptId,
method: 'get'
})
}
@ -20,7 +20,7 @@ export function listDeptExcludeChild(deptId) {
// 查询部门详细
export function getDept(deptId) {
return request({
url: '/system/dept/' + deptId,
url: '/system/dept/vue/' + deptId,
method: 'get'
})
}
@ -28,7 +28,7 @@ export function getDept(deptId) {
// 新增部门
export function addDept(data) {
return request({
url: '/system/dept',
url: '/system/dept/vue',
method: 'post',
data: data
})
@ -37,7 +37,7 @@ export function addDept(data) {
// 修改部门
export function updateDept(data) {
return request({
url: '/system/dept',
url: '/system/dept/vue',
method: 'put',
data: data
})
@ -46,7 +46,7 @@ export function updateDept(data) {
// 删除部门
export function delDept(deptId) {
return request({
url: '/system/dept/' + deptId,
url: '/system/dept/vue/' + deptId,
method: 'delete'
})
}

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询字典数据列表
export function listData(query) {
return request({
url: '/system/dict/data/list',
url: '/system/dict/data/vue/list',
method: 'get',
params: query
})
@ -12,7 +12,7 @@ export function listData(query) {
// 查询字典数据详细
export function getData(dictCode) {
return request({
url: '/system/dict/data/' + dictCode,
url: '/system/dict/data/vue/' + dictCode,
method: 'get'
})
}
@ -28,7 +28,7 @@ export function getDicts(dictType) {
// 新增字典数据
export function addData(data) {
return request({
url: '/system/dict/data',
url: '/system/dict/data/vue',
method: 'post',
data: data
})
@ -37,7 +37,7 @@ export function addData(data) {
// 修改字典数据
export function updateData(data) {
return request({
url: '/system/dict/data',
url: '/system/dict/data/vue',
method: 'put',
data: data
})
@ -46,7 +46,7 @@ export function updateData(data) {
// 删除字典数据
export function delData(dictCode) {
return request({
url: '/system/dict/data/' + dictCode,
url: '/system/dict/data/vue/' + dictCode,
method: 'delete'
})
}

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询字典类型列表
export function listType(query) {
return request({
url: '/system/dict/type/list',
url: '/system/dict/type/vue/list',
method: 'get',
params: query
})
@ -12,7 +12,7 @@ export function listType(query) {
// 查询字典类型详细
export function getType(dictId) {
return request({
url: '/system/dict/type/' + dictId,
url: '/system/dict/type/vue/' + dictId,
method: 'get'
})
}
@ -20,7 +20,7 @@ export function getType(dictId) {
// 新增字典类型
export function addType(data) {
return request({
url: '/system/dict/type',
url: '/system/dict/type/vue',
method: 'post',
data: data
})
@ -29,7 +29,7 @@ export function addType(data) {
// 修改字典类型
export function updateType(data) {
return request({
url: '/system/dict/type',
url: '/system/dict/type/vue',
method: 'put',
data: data
})
@ -38,7 +38,7 @@ export function updateType(data) {
// 删除字典类型
export function delType(dictId) {
return request({
url: '/system/dict/type/' + dictId,
url: '/system/dict/type/vue/' + dictId,
method: 'delete'
})
}
@ -46,7 +46,7 @@ export function delType(dictId) {
// 刷新字典缓存
export function refreshCache() {
return request({
url: '/system/dict/type/refreshCache',
url: '/system/dict/type/vue/refreshCache',
method: 'delete'
})
}
@ -54,7 +54,7 @@ export function refreshCache() {
// 获取字典选择框列表
export function optionselect() {
return request({
url: '/system/dict/type/optionselect',
url: '/system/dict/type/vue/optionselect',
method: 'get'
})
}

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询公告列表
export function listNotice(query) {
return request({
url: '/system/notice/list',
url: '/system/notice/list/vue',
method: 'get',
params: query
})
@ -12,7 +12,7 @@ export function listNotice(query) {
// 查询公告详细
export function getNotice(noticeId) {
return request({
url: '/system/notice/' + noticeId,
url: '/system/notice/vue/' + noticeId,
method: 'get'
})
}
@ -20,7 +20,7 @@ export function getNotice(noticeId) {
// 新增公告
export function addNotice(data) {
return request({
url: '/system/notice',
url: '/system/notice/vue',
method: 'post',
data: data
})
@ -29,7 +29,7 @@ export function addNotice(data) {
// 修改公告
export function updateNotice(data) {
return request({
url: '/system/notice',
url: '/system/notice/vue',
method: 'put',
data: data
})
@ -38,7 +38,7 @@ export function updateNotice(data) {
// 删除公告
export function delNotice(noticeId) {
return request({
url: '/system/notice/' + noticeId,
url: '/system/notice/vue/' + noticeId,
method: 'delete'
})
}

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询岗位列表
export function listPost(query) {
return request({
url: '/system/post/list',
url: '/system/post/vue/list',
method: 'get',
params: query
})
@ -12,7 +12,7 @@ export function listPost(query) {
// 查询岗位详细
export function getPost(postId) {
return request({
url: '/system/post/' + postId,
url: '/system/post/vue/' + postId,
method: 'get'
})
}
@ -20,7 +20,7 @@ export function getPost(postId) {
// 新增岗位
export function addPost(data) {
return request({
url: '/system/post',
url: '/system/post/vue',
method: 'post',
data: data
})
@ -29,7 +29,7 @@ export function addPost(data) {
// 修改岗位
export function updatePost(data) {
return request({
url: '/system/post',
url: '/system/post/vue',
method: 'put',
data: data
})
@ -38,7 +38,7 @@ export function updatePost(data) {
// 删除岗位
export function delPost(postId) {
return request({
url: '/system/post/' + postId,
url: '/system/post/vue/' + postId,
method: 'delete'
})
}

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询生成表数据
export function listTable(query) {
return request({
url: '/tool/gen/list',
url: '/tool/gen/list/vue',
method: 'get',
params: query
})
@ -11,7 +11,7 @@ export function listTable(query) {
// 查询db数据库列表
export function listDbTable(query) {
return request({
url: '/tool/gen/db/list',
url: '/tool/gen/db/list/vue',
method: 'get',
params: query
})
@ -20,7 +20,7 @@ export function listDbTable(query) {
// 查询表详细信息
export function getGenTable(tableId) {
return request({
url: '/tool/gen/' + tableId,
url: '/tool/gen/vue/' + tableId,
method: 'get'
})
}
@ -28,7 +28,7 @@ export function getGenTable(tableId) {
// 修改代码生成信息
export function updateGenTable(data) {
return request({
url: '/tool/gen',
url: '/tool/gen/vue',
method: 'put',
data: data
})
@ -37,7 +37,7 @@ export function updateGenTable(data) {
// 导入表
export function importTable(data) {
return request({
url: '/tool/gen/importTable',
url: '/tool/gen/importTable/vue',
method: 'post',
params: data
})
@ -46,7 +46,7 @@ export function importTable(data) {
// 创建表
export function createTable(data) {
return request({
url: '/tool/gen/createTable',
url: '/tool/gen/createTable/vue',
method: 'post',
params: data
})
@ -63,7 +63,7 @@ export function previewTable(tableId) {
// 删除表数据
export function delTable(tableId) {
return request({
url: '/tool/gen/' + tableId,
url: '/tool/gen/vue/' + tableId,
method: 'delete'
})
}

View File

@ -126,20 +126,15 @@ export function download(url, params, filename, config) {
return service.post(url, params, {
transformRequest: [(params) => { return tansParams(params) }],
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
responseType: 'blob',
...config
}).then(async (data) => {
const isBlob = blobValidate(data)
if (isBlob) {
const blob = new Blob([data])
saveAs(blob, filename)
}).then((res) => {
if (res.code === 0) {
const fileName = res.msg;
window.location.href = process.env.VUE_APP_BASE_API + "/common/download?fileName=" + encodeURIComponent(fileName) + "&delete=true";
} else {
const resText = await data.text()
const rspObj = JSON.parse(resText)
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
Message.error(errMsg)
Message.error(res.msg);
}
downloadLoadingInstance.close()
downloadLoadingInstance.close();
}).catch((r) => {
console.error(r)
Message.error('下载文件出现错误,请联系管理员!')

View File

@ -198,7 +198,7 @@ export default {
this.ids = selection.map(item => item.infoId)
this.single = selection.length!=1
this.multiple = !selection.length
this.selectName = selection.map(item => item.userName)
this.selectName = selection.map(item => item.loginName)
},
/** 排序触发事件 */
handleSortChange(column, prop, order) {

View File

@ -33,16 +33,21 @@
<span>{{(pageNum - 1) * pageSize + scope.$index + 1}}</span>
</template>
</el-table-column>
<el-table-column label="会话编号" align="center" prop="tokenId" :show-overflow-tooltip="true" />
<el-table-column label="登录名称" align="center" prop="userName" :show-overflow-tooltip="true" />
<el-table-column label="会话编号" align="center" prop="sessionId" :show-overflow-tooltip="true" />
<el-table-column label="登录名称" align="center" prop="loginName" :show-overflow-tooltip="true" />
<el-table-column label="部门名称" align="center" prop="deptName" />
<el-table-column label="主机" align="center" prop="ipaddr" :show-overflow-tooltip="true" />
<el-table-column label="登录地点" align="center" prop="loginLocation" :show-overflow-tooltip="true" />
<el-table-column label="浏览器" align="center" prop="browser" />
<el-table-column label="操作系统" align="center" prop="os" />
<el-table-column label="登录时间" align="center" prop="loginTime" width="180">
<el-table-column label="登录时间" align="center" prop="startTimestamp" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.loginTime) }}</span>
<span>{{ parseTime(scope.row.startTimestamp) }}</span>
</template>
</el-table-column>
<el-table-column label="最后访问时间" align="center" prop="lastAccessTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.lastAccessTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
@ -109,8 +114,8 @@ export default {
},
/** 强退按钮操作 */
handleForceLogout(row) {
this.$modal.confirm('是否确认强退名称为"' + row.userName + '"的用户?').then(function() {
return forceLogout(row.tokenId)
this.$modal.confirm('是否确认强退名称为"' + row.loginName + '"的用户?').then(function() {
return forceLogout(row.sessionId)
}).then(() => {
this.getList()
this.$modal.msgSuccess("强退成功")

View File

@ -157,7 +157,7 @@
</template>
<script>
import { listPost, getPost, delPost, addPost, updatePost } from "@/api/system/post"
import { listPost, getPost, delPost, addPost, updatePost,exportInfo } from "@/api/system/post"
export default {
name: "Post",

View File

@ -1,5 +1,6 @@
package com.ruoyi.web.controller.monitor;
import com.ruoyi.common.core.domain.AjaxResult;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
@ -7,6 +8,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.framework.web.domain.Server;
import org.springframework.web.bind.annotation.ResponseBody;
/**
*
@ -28,4 +30,14 @@ public class ServerController extends BaseController
mmap.put("server", server);
return prefix + "/server";
}
@RequiresPermissions("monitor:server:view")
@GetMapping("/vue")
@ResponseBody
public AjaxResult getServerVue() throws Exception
{
Server server = new Server();
server.copyTo();
return AjaxResult.success(server);
}
}

View File

@ -5,10 +5,7 @@ import com.ruoyi.framework.shiro.service.SysPasswordService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
@ -91,4 +88,43 @@ public class SysLogininforController extends BaseController
passwordService.clearLoginRecordCache(loginName);
return success();
}
@RequiresPermissions("monitor:logininfor:list")
@GetMapping("/list/vue")
@ResponseBody
public TableDataInfo listVue(SysLogininfor logininfor)
{
startPage();
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
return getDataTable(list);
}
@RequiresPermissions("monitor:logininfor:remove")
@Log(title = "登录日志", businessType = BusinessType.DELETE)
@DeleteMapping("/vue/{infoIds}")
@ResponseBody
public AjaxResult removeVue(@PathVariable String infoIds)
{
return toAjax(logininforService.deleteLogininforByIds(infoIds));
}
@RequiresPermissions("monitor:logininfor:remove")
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
@DeleteMapping("/clean/vue")
@ResponseBody
public AjaxResult cleanVue()
{
logininforService.cleanLogininfor();
return success();
}
@RequiresPermissions("monitor:logininfor:unlock")
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
@GetMapping("/unlock/vue/{userName}")
@ResponseBody
public AjaxResult unlockVue(@PathVariable("userName") String userName)
{
passwordService.clearLoginRecordCache(userName);
return success();
}
}

View File

@ -5,11 +5,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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.ResponseBody;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
@ -87,4 +83,41 @@ public class SysOperlogController extends BaseController
operLogService.cleanOperLog();
return success();
}
@RequiresPermissions("monitor:operlog:list")
@GetMapping("/list/vue")
@ResponseBody
public TableDataInfo listVue(SysOperLog operLog)
{
startPage();
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
return getDataTable(list);
}
@Log(title = "操作日志", businessType = BusinessType.DELETE)
@RequiresPermissions("monitor:operlog:remove")
@DeleteMapping("/vue/{operIds}")
@ResponseBody
public AjaxResult removeVue(@PathVariable String operIds)
{
return toAjax(operLogService.deleteOperLogByIds(operIds));
}
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
@RequiresPermissions("monitor:operlog:remove")
@DeleteMapping("/clean/vue")
@ResponseBody
public AjaxResult cleanVue()
{
operLogService.cleanOperLog();
return success();
}
@RequiresPermissions("monitor:operlog:detail")
@GetMapping("/vue/{operId}")
@ResponseBody
public AjaxResult detailVue(@PathVariable("operId") Long operId)
{
return success(operLogService.selectOperLogById(operId));
}
}

View File

@ -5,10 +5,7 @@ import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
@ -85,4 +82,41 @@ public class SysUserOnlineController extends BaseController
}
return success();
}
@RequiresPermissions("monitor:online:list")
@GetMapping("/list/vue")
@ResponseBody
public TableDataInfo listVue(SysUserOnline userOnline)
{
startPage();
List<SysUserOnline> list = userOnlineService.selectUserOnlineList(userOnline);
return getDataTable(list);
}
@RequiresPermissions("monitor:online:forceLogout")
@Log(title = "在线用户", businessType = BusinessType.FORCE)
@DeleteMapping("/vue/{tokenId}")
@ResponseBody
public AjaxResult forceLogoutVue(@PathVariable String tokenId)
{
SysUserOnline online = userOnlineService.selectOnlineById(tokenId);
if (online == null)
{
return error("用户已下线");
}
OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId());
if (onlineSession == null)
{
return error("用户已下线");
}
if (tokenId.equals(ShiroUtils.getSessionId()))
{
return error("当前登录用户无法强退");
}
onlineSessionDAO.delete(onlineSession);
online.setStatus(OnlineStatus.off_line);
userOnlineService.saveOnline(online);
userOnlineService.removeUserCache(online.getLoginName(), tokenId);
return success();
}
}

View File

@ -6,11 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
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.ResponseBody;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
@ -162,4 +158,99 @@ public class SysConfigController extends BaseController
return success(configService.selectConfigByKey(key));
}
/**
*
*/
@RequiresPermissions("system:config:list")
@GetMapping("/list/vue")
@ResponseBody
public TableDataInfo listVue(SysConfig config)
{
startPage();
List<SysConfig> list = configService.selectConfigList(config);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("system:config:query")
@GetMapping(value = "/vue/{configId}")
@ResponseBody
public AjaxResult getInfoVue(@PathVariable Long configId)
{
return success(configService.selectConfigById(configId));
}
/**
*
*/
@RequiresPermissions("system:config:add")
@Log(title = "参数管理", businessType = BusinessType.INSERT)
@PostMapping("/vue")
@ResponseBody
public AjaxResult addVue(@Validated @RequestBody SysConfig config)
{
if (!configService.checkConfigKeyUnique(config))
{
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
config.setCreateBy(getLoginName());
return toAjax(configService.insertConfig(config));
}
/**
*
*/
@RequiresPermissions("system:config:edit")
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
@PutMapping("/vue")
@ResponseBody
public AjaxResult editVue(@Validated @RequestBody SysConfig config)
{
if (!configService.checkConfigKeyUnique(config))
{
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
config.setUpdateBy(getLoginName());
return toAjax(configService.updateConfig(config));
}
/**
*
*/
@RequiresPermissions("system:config:remove")
@Log(title = "参数管理", businessType = BusinessType.DELETE)
@DeleteMapping("/vue/{configIds}")
@ResponseBody
public AjaxResult removeVue(@PathVariable String configIds)
{
configService.deleteConfigByIds(configIds);
return success();
}
/**
*
*/
@RequiresPermissions("system:config:remove")
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
@DeleteMapping("/refreshCache/vue")
@ResponseBody
public AjaxResult refreshCacheVue()
{
configService.resetConfigCache();
return success();
}
/**
*
*/
@GetMapping(value = "/configKey/vue/{configKey}")
@ResponseBody
public AjaxResult getConfigKeyVue(@PathVariable String configKey)
{
return success(configService.selectConfigByKey(configKey));
}
}

View File

@ -6,9 +6,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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.ResponseBody;
import com.ruoyi.common.annotation.Log;
@ -186,4 +189,93 @@ public class SysDeptController extends BaseController
List<Ztree> ztrees = deptService.selectDeptTreeExcludeChild(dept);
return ztrees;
}
// ================================= vue =================================
@RequiresPermissions("system:dept:list")
@GetMapping("/vue/list")
@ResponseBody
public AjaxResult listVue(SysDept dept)
{
List<SysDept> deptList = deptService.selectDeptList(dept);
return AjaxResult.success(deptService.buildDeptTree(deptList));
}
@RequiresPermissions("system:dept:list")
@GetMapping("/vue/list/exclude/{deptId}")
@ResponseBody
public AjaxResult listExcludeChildVue(@PathVariable(value = "deptId", required = false) Long deptId)
{
List<SysDept> depts = deptService.selectDeptList(new SysDept());
depts.removeIf(d -> d.getDeptId().intValue() == deptId
|| StringUtils.split(d.getAncestors(), ",").length > 0 && StringUtils.split(d.getAncestors(), ",")[0].equals(deptId.toString()));
return AjaxResult.success(deptService.buildDeptTree(depts));
}
@RequiresPermissions("system:dept:query")
@GetMapping(value = "/vue/{deptId}")
@ResponseBody
public AjaxResult getInfoVue(@PathVariable Long deptId)
{
deptService.checkDeptDataScope(deptId);
return AjaxResult.success(deptService.selectDeptById(deptId));
}
@RequiresPermissions("system:dept:add")
@Log(title = "部门管理", businessType = BusinessType.INSERT)
@PostMapping("/vue")
@ResponseBody
public AjaxResult addVue(@Validated @RequestBody SysDept dept)
{
if (!deptService.checkDeptNameUnique(dept))
{
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
dept.setCreateBy(getLoginName());
return toAjax(deptService.insertDept(dept));
}
@RequiresPermissions("system:dept:edit")
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
@PutMapping("/vue")
@ResponseBody
public AjaxResult editVue(@Validated @RequestBody SysDept dept)
{
Long deptId = dept.getDeptId();
deptService.checkDeptDataScope(deptId);
if (!deptService.checkDeptNameUnique(dept))
{
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
else if (dept.getParentId().equals(deptId))
{
return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
}
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
{
return AjaxResult.error("该部门包含未停用的子部门!");
}
dept.setUpdateBy(getLoginName());
return toAjax(deptService.updateDept(dept));
}
@RequiresPermissions("system:dept:remove")
@Log(title = "部门管理", businessType = BusinessType.DELETE)
@DeleteMapping("/vue/{deptId}")
@ResponseBody
public AjaxResult removeVue(@PathVariable(value="deptId") String deptId)
{
Long deptIdL = Long.parseLong(deptId);
if (deptService.selectDeptCount(deptIdL) > 0)
{
return AjaxResult.warn("存在下级部门,不允许删除");
}
if (deptService.checkDeptExistUser(deptIdL))
{
return AjaxResult.warn("部门存在用户,不允许删除");
}
deptService.checkDeptDataScope(deptIdL);
return toAjax(deptService.deleteDeptById(deptIdL));
}
}

View File

@ -10,9 +10,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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.ResponseBody;
import com.ruoyi.common.annotation.Log;
@ -140,4 +143,66 @@ public class SysDictDataController extends BaseController
dictDataService.deleteDictDataByIds(ids);
return success();
}
// ================================= vue =================================
@RequiresPermissions("system:dict:list")
@GetMapping("/vue/list")
@ResponseBody
public TableDataInfo listVue(SysDictData dictData)
{
startPage();
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
return getDataTable(list);
}
@RequiresPermissions("system:dict:query")
@GetMapping(value = "/vue/{dictCode}")
@ResponseBody
public AjaxResult getInfoVue(@PathVariable Long dictCode)
{
return AjaxResult.success(dictDataService.selectDictDataById(dictCode));
}
@RequiresPermissions("system:dict:add")
@Log(title = "字典数据", businessType = BusinessType.INSERT)
@PostMapping("/vue")
@ResponseBody
public AjaxResult addVue(@Validated @RequestBody SysDictData dict)
{
dict.setCreateBy(getLoginName());
return toAjax(dictDataService.insertDictData(dict));
}
@RequiresPermissions("system:dict:edit")
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
@PutMapping("/vue")
@ResponseBody
public AjaxResult editVue(@Validated @RequestBody SysDictData dict)
{
dict.setUpdateBy(getLoginName());
return toAjax(dictDataService.updateDictData(dict));
}
@RequiresPermissions("system:dict:remove")
@Log(title = "字典数据", businessType = BusinessType.DELETE)
@DeleteMapping("/vue/{dictCodes}")
@ResponseBody
public AjaxResult removeVue(@PathVariable(value="dictCodes") String dictCodes)
{
dictDataService.deleteDictDataByIds(dictCodes);
return success();
}
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:dict:export")
@PostMapping("/vue/export")
@ResponseBody
public AjaxResult exportVue(SysDictData dictData)
{
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
return util.exportExcel(list, "字典数据");
}
}

View File

@ -6,9 +6,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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.ResponseBody;
import com.ruoyi.common.annotation.Log;
@ -185,4 +188,92 @@ public class SysDictTypeController extends BaseController
List<Ztree> ztrees = dictTypeService.selectDictTree(new SysDictType());
return ztrees;
}
// ================================= vue =================================
@RequiresPermissions("system:dict:list")
@GetMapping("/type/vue/list")
@ResponseBody
public TableDataInfo listVue(SysDictType dictType)
{
startPage();
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
return getDataTable(list);
}
@RequiresPermissions("system:dict:query")
@GetMapping(value = "/type/vue/{dictId}")
@ResponseBody
public AjaxResult getInfoVue(@PathVariable Long dictId)
{
return AjaxResult.success(dictTypeService.selectDictTypeById(dictId));
}
@RequiresPermissions("system:dict:add")
@Log(title = "字典类型", businessType = BusinessType.INSERT)
@PostMapping("/type/vue")
@ResponseBody
public AjaxResult addVue(@Validated @RequestBody SysDictType dict)
{
if (!dictTypeService.checkDictTypeUnique(dict))
{
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
dict.setCreateBy(getLoginName());
return toAjax(dictTypeService.insertDictType(dict));
}
@RequiresPermissions("system:dict:edit")
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
@PutMapping("/type/vue")
@ResponseBody
public AjaxResult editVue(@Validated @RequestBody SysDictType dict)
{
if (!dictTypeService.checkDictTypeUnique(dict))
{
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
dict.setUpdateBy(getLoginName());
return toAjax(dictTypeService.updateDictType(dict));
}
@RequiresPermissions("system:dict:remove")
@Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/type/vue/{dictIds}")
@ResponseBody
public AjaxResult removeVue(@PathVariable(value="dictIds") String dictIds)
{
dictTypeService.deleteDictTypeByIds(dictIds);
return success();
}
@RequiresPermissions("system:dict:remove")
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
@DeleteMapping("/type/vue/refreshCache")
@ResponseBody
public AjaxResult refreshCacheVue()
{
dictTypeService.resetDictCache();
return success();
}
@GetMapping("/type/vue/optionselect")
@ResponseBody
public AjaxResult optionselectVue()
{
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
return AjaxResult.success(dictTypes);
}
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:dict:export")
@PostMapping("/type/vue/export")
@ResponseBody
public AjaxResult exportVue(SysDictType dictType)
{
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
return util.exportExcel(list, "字典类型");
}
}

View File

@ -6,11 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
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.ResponseBody;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
@ -122,4 +118,66 @@ public class SysNoticeController extends BaseController
{
return toAjax(noticeService.deleteNoticeByIds(ids));
}
/**
*
*/
@RequiresPermissions("system:notice:list")
@GetMapping("/list/vue")
@ResponseBody
public TableDataInfo listVue(SysNotice notice)
{
startPage();
List<SysNotice> list = noticeService.selectNoticeList(notice);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("system:notice:query")
@GetMapping(value = "/vue/{noticeId}")
@ResponseBody
public AjaxResult getInfoVue(@PathVariable("noticeId") Long noticeId)
{
return success(noticeService.selectNoticeById(noticeId));
}
/**
*
*/
@RequiresPermissions("system:notice:add")
@Log(title = "通知公告", businessType = BusinessType.INSERT)
@PostMapping("/vue")
@ResponseBody
public AjaxResult addVue(@Validated @RequestBody SysNotice notice)
{
notice.setCreateBy(getLoginName());
return toAjax(noticeService.insertNotice(notice));
}
/**
*
*/
@RequiresPermissions("system:notice:edit")
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
@PutMapping("/vue")
@ResponseBody
public AjaxResult editVue(@Validated @RequestBody SysNotice notice)
{
notice.setUpdateBy(getLoginName());
return toAjax(noticeService.updateNotice(notice));
}
/**
*
*/
@RequiresPermissions("system:notice:remove")
@Log(title = "通知公告", businessType = BusinessType.DELETE)
@DeleteMapping("/vue/{noticeIds}")
@ResponseBody
public AjaxResult removeVue(@PathVariable("noticeIds") String noticeIds)
{
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
}
}

View File

@ -6,9 +6,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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.ResponseBody;
import com.ruoyi.common.annotation.Log;
@ -153,4 +156,69 @@ public class SysPostController extends BaseController
{
return postService.checkPostCodeUnique(post);
}
// ================================= vue =================================
@RequiresPermissions("system:post:list")
@GetMapping("/vue/list")
@ResponseBody
public TableDataInfo listVue(SysPost post)
{
startPage();
List<SysPost> list = postService.selectPostList(post);
return getDataTable(list);
}
@RequiresPermissions("system:post:query")
@GetMapping(value = "/vue/{postId}")
@ResponseBody
public AjaxResult getInfoVue(@PathVariable Long postId)
{
return AjaxResult.success(postService.selectPostById(postId));
}
@RequiresPermissions("system:post:add")
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
@PostMapping("/vue")
@ResponseBody
public AjaxResult addVue(@Validated @RequestBody SysPost post)
{
if (!postService.checkPostNameUnique(post))
{
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
}
else if (!postService.checkPostCodeUnique(post))
{
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
}
post.setCreateBy(getLoginName());
return toAjax(postService.insertPost(post));
}
@RequiresPermissions("system:post:edit")
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
@PutMapping("/vue")
@ResponseBody
public AjaxResult editVue(@Validated @RequestBody SysPost post)
{
if (!postService.checkPostNameUnique(post))
{
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
}
else if (!postService.checkPostCodeUnique(post))
{
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
}
post.setUpdateBy(getLoginName());
return toAjax(postService.updatePost(post));
}
@RequiresPermissions("system:post:remove")
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
@DeleteMapping("/vue/{postIds}")
@ResponseBody
public AjaxResult removeVue(@PathVariable(value="postIds") String postIds)
{
return toAjax(postService.deletePostByIds(postIds));
}
}

View File

@ -30,9 +30,10 @@ public class PageDomain
{
return "";
}
return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc;
return StringUtils.toUnderScoreCase(orderByColumn) + " " + getIsAsc();
}
public Integer getPageNum()
{
return pageNum;
@ -65,6 +66,11 @@ public class PageDomain
public String getIsAsc()
{
if ("descending".equalsIgnoreCase(isAsc)){
return "desc";
}else if ("ascending".equalsIgnoreCase(isAsc)){
return "asc";
}
return isAsc;
}

View File

@ -12,11 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
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.ResponseBody;
import org.springframework.web.bind.annotation.*;
import com.alibaba.druid.DbType;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLStatement;
@ -306,4 +302,123 @@ public class GenController extends BaseController
response.setContentType("application/octet-stream; charset=UTF-8");
IOUtils.write(data, response.getOutputStream());
}
@RequiresPermissions("tool:gen:list")
@GetMapping("/list/vue")
@ResponseBody
public TableDataInfo genListVue(GenTable genTable)
{
startPage();
List<GenTable> list = genTableService.selectGenTableList(genTable);
return getDataTable(list);
}
@RequiresPermissions("tool:gen:list")
@GetMapping("/db/list/vue")
@ResponseBody
public TableDataInfo dataListVue(GenTable genTable)
{
startPage();
List<GenTable> list = genTableService.selectDbTableList(genTable);
return getDataTable(list);
}
@RequiresPermissions("tool:gen:query")
@GetMapping("/vue/{tableId}")
@ResponseBody
public AjaxResult getInfoVue(@PathVariable Long tableId)
{
GenTable table = genTableService.selectGenTableById(tableId);
List<GenTable> genTables = genTableService.selectGenTableAll();
List<CxSelect> cxSelect = new ArrayList<CxSelect>();
for (GenTable genTable : genTables)
{
if (!StringUtils.equals(table.getTableName(), genTable.getTableName()))
{
CxSelect cxTable = new CxSelect(genTable.getTableName(), genTable.getTableName() + '' + genTable.getTableComment());
List<CxSelect> cxColumns = new ArrayList<CxSelect>();
for (GenTableColumn tableColumn : genTable.getColumns())
{
cxColumns.add(new CxSelect(tableColumn.getColumnName(), tableColumn.getColumnName() + '' + tableColumn.getColumnComment()));
}
cxTable.setS(cxColumns);
cxSelect.add(cxTable);
}
}
AjaxResult ajax = AjaxResult.success();
ajax.put("info", table);
ajax.put("rows", table.getColumns());
ajax.put("tables", cxSelect);
return ajax;
}
@RequiresPermissions("tool:gen:edit")
@Log(title = "代码生成", businessType = BusinessType.UPDATE)
@PutMapping("/vue")
@ResponseBody
public AjaxResult editSaveVue(@Validated @RequestBody GenTable genTable)
{
genTableService.validateEdit(genTable);
genTableService.updateGenTable(genTable);
return AjaxResult.success();
}
@RequiresPermissions("tool:gen:list")
@Log(title = "代码生成", businessType = BusinessType.IMPORT)
@PostMapping("/importTable/vue")
@ResponseBody
public AjaxResult importTableSaveVue(String tables)
{
String[] tableNames = Convert.toStrArray(tables);
// 查询表信息
List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames);
String operName = Convert.toStr(PermissionUtils.getPrincipalProperty("loginName"));
genTableService.importGenTable(tableList, operName);
return AjaxResult.success();
}
@RequiresRoles("admin")
@Log(title = "创建表", businessType = BusinessType.OTHER)
@PostMapping("/createTable/vue")
@ResponseBody
public AjaxResult createVue(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)
{
MySqlCreateTableStatement createTableStatement = (MySqlCreateTableStatement) sqlStatement;
if (genTableService.createTable(createTableStatement.toString()))
{
String tableName = createTableStatement.getTableName().replaceAll("`", "");
tableNames.add(tableName);
}
}
}
List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames.toArray(new String[tableNames.size()]));
String operName = Convert.toStr(PermissionUtils.getPrincipalProperty("loginName"));
genTableService.importGenTable(tableList, operName);
return AjaxResult.success();
}
catch (Exception e)
{
logger.error(e.getMessage(), e);
return AjaxResult.error("创建表结构异常");
}
}
@RequiresPermissions("tool:gen:remove")
@Log(title = "代码生成", businessType = BusinessType.DELETE)
@DeleteMapping("/vue/{tableIds}")
@ResponseBody
public AjaxResult removeVue(@PathVariable String tableIds)
{
genTableService.deleteGenTableByIds(tableIds);
return AjaxResult.success();
}
}

View File

@ -7,12 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.controller.BaseController;
@ -245,4 +240,120 @@ public class SysJobController extends BaseController
return error("表达式无效");
}
}
@RequiresPermissions("monitor:job:list")
@GetMapping("/list/vue")
@ResponseBody
public TableDataInfo listVue(SysJob job)
{
startPage();
List<SysJob> list = jobService.selectJobList(job);
return getDataTable(list);
}
@RequiresPermissions("monitor:job:query")
@GetMapping("/vue/{jobId}")
@ResponseBody
public AjaxResult getInfoVue(@PathVariable("jobId") Long jobId)
{
return success(jobService.selectJobById(jobId));
}
@Log(title = "定时任务", businessType = BusinessType.INSERT)
@RequiresPermissions("monitor:job:add")
@PostMapping("/vue")
@ResponseBody
public AjaxResult addVue(@Validated @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))
{
return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi'调用");
}
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 }))
{
return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)'调用");
}
else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR))
{
return error("新增任务'" + job.getJobName() + "'失败,目标字符串存在违规");
}
else if (!ScheduleUtils.whiteList(job.getInvokeTarget()))
{
return error("新增任务'" + job.getJobName() + "'失败,目标字符串不在白名单内");
}
job.setCreateBy(getLoginName());
return toAjax(jobService.insertJob(job));
}
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
@RequiresPermissions("monitor:job:edit")
@PutMapping("/vue")
@ResponseBody
public AjaxResult editVue(@Validated @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))
{
return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi'调用");
}
else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS }))
{
return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'ldap'调用");
}
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))
{
return error("修改任务'" + job.getJobName() + "'失败,目标字符串存在违规");
}
else if (!ScheduleUtils.whiteList(job.getInvokeTarget()))
{
return error("修改任务'" + job.getJobName() + "'失败,目标字符串不在白名单内");
}
return toAjax(jobService.updateJob(job));
}
@Log(title = "定时任务", businessType = BusinessType.DELETE)
@RequiresPermissions("monitor:job:remove")
@DeleteMapping("/vue/{jobIds}")
@ResponseBody
public AjaxResult removeVue(@PathVariable String jobIds) throws SchedulerException
{
jobService.deleteJobByIds(jobIds);
return success();
}
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
@RequiresPermissions("monitor:job:changeStatus")
@PutMapping("/changeStatus/vue")
@ResponseBody
public AjaxResult changeStatusVue(@RequestBody SysJob job) throws SchedulerException
{
SysJob newJob = jobService.selectJobById(job.getJobId());
newJob.setStatus(job.getStatus());
return toAjax(jobService.changeStatus(newJob));
}
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
@RequiresPermissions("monitor:job:changeStatus")
@PutMapping("/run/vue")
@ResponseBody
public AjaxResult runVue(@RequestBody SysJob job) throws SchedulerException
{
boolean result = jobService.run(job);
return result ? success() : error("任务不存在或已过期!");
}
}

View File

@ -5,12 +5,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
@ -100,4 +95,33 @@ public class SysJobLogController extends BaseController
jobLogService.cleanJobLog();
return success();
}
@RequiresPermissions("monitor:job:list")
@GetMapping("/list/vue")
@ResponseBody
public TableDataInfo listVue(SysJobLog jobLog)
{
startPage();
List<SysJobLog> list = jobLogService.selectJobLogList(jobLog);
return getDataTable(list);
}
@Log(title = "调度日志", businessType = BusinessType.DELETE)
@RequiresPermissions("monitor:job:remove")
@DeleteMapping("/vue/{jobLogIds}")
@ResponseBody
public AjaxResult removeVue(@PathVariable String jobLogIds)
{
return toAjax(jobLogService.deleteJobLogByIds(jobLogIds));
}
@Log(title = "调度日志", businessType = BusinessType.CLEAN)
@RequiresPermissions("monitor:job:remove")
@DeleteMapping("/clean/vue")
@ResponseBody
public AjaxResult cleanVue()
{
jobLogService.cleanJobLog();
return success();
}
}

View File

@ -1,5 +1,6 @@
package com.ruoyi.system.domain;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
@ -12,6 +13,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
*
* @author ruoyi
*/
@Data
public class SysLogininfor extends BaseEntity
{
private static final long serialVersionUID = 1L;
@ -22,6 +24,7 @@ public class SysLogininfor extends BaseEntity
/** 用户账号 */
@Excel(name = "用户账号")
private String userName;
private String loginName;
/** 登录状态 0成功 1失败 */
@ -52,108 +55,4 @@ public class SysLogininfor extends BaseEntity
@Excel(name = "访问时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date loginTime;
public Long getInfoId()
{
return infoId;
}
public void setInfoId(Long infoId)
{
this.infoId = infoId;
}
public String getLoginName()
{
return loginName;
}
public void setLoginName(String loginName)
{
this.loginName = loginName;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
public String getIpaddr()
{
return ipaddr;
}
public void setIpaddr(String ipaddr)
{
this.ipaddr = ipaddr;
}
public String getLoginLocation()
{
return loginLocation;
}
public void setLoginLocation(String loginLocation)
{
this.loginLocation = loginLocation;
}
public String getBrowser()
{
return browser;
}
public void setBrowser(String browser)
{
this.browser = browser;
}
public String getOs()
{
return os;
}
public void setOs(String os)
{
this.os = os;
}
public String getMsg()
{
return msg;
}
public void setMsg(String msg)
{
this.msg = msg;
}
public Date getLoginTime()
{
return loginTime;
}
public void setLoginTime(Date loginTime)
{
this.loginTime = loginTime;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("infoId", getInfoId())
.append("loginName", getLoginName())
.append("ipaddr", getIpaddr())
.append("loginLocation", getLoginLocation())
.append("browser", getBrowser())
.append("os", getOs())
.append("status", getStatus())
.append("msg", getMsg())
.append("loginTime", getLoginTime())
.toString();
}
}

View File

@ -22,22 +22,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<select id="selectLogininforList" parameterType="SysLogininfor" resultMap="SysLogininforResult">
select info_id,login_name,ipaddr,login_location,browser,os,status,msg,login_time from sys_logininfor
<where>
select t1.info_id,t1.login_name,t1.ipaddr,t1.login_location,t1.browser,t1.os,t1.status,t1.msg,login_time,t2.user_name
from sys_logininfor t1
left join sys_user t2 on t1.login_name = t2.login_name
<where>
<if test="ipaddr != null and ipaddr != ''">
AND ipaddr like concat('%', #{ipaddr}, '%')
AND t1.ipaddr like concat('%', #{ipaddr}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
AND t1.status = #{status}
</if>
<if test="loginName != null and loginName != ''">
AND login_name like concat('%', #{loginName}, '%')
AND t1.login_name like concat('%', #{loginName}, '%')
</if>
<if test="userName != null and userName != ''">
AND t2.user_name like concat('%', #{userName}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND login_time &gt;= #{params.beginTime}
AND t1.login_time &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND login_time &lt;= #{params.endTime}
AND t1.login_time &lt;= #{params.endTime}
</if>
</where>
</select>