mirror of
https://github.com/hs-web/hsweb-framework.git
synced 2026-05-31 18:03:52 +08:00
增加访问日志
This commit is contained in:
@@ -44,6 +44,7 @@ public class DynamicScriptController extends GenericController<DynamicScript, St
|
||||
|
||||
@RequestMapping(value = "/compile", method = {RequestMethod.GET})
|
||||
@Authorize(action = "compile")
|
||||
@AccessLogger("编译所有脚本")
|
||||
public ResponseMessage compileAll() throws Exception {
|
||||
dynamicScriptService.compileAll();
|
||||
return ResponseMessage.ok("success");
|
||||
@@ -51,6 +52,7 @@ public class DynamicScriptController extends GenericController<DynamicScript, St
|
||||
|
||||
@RequestMapping(value = "/compile/{id:.+}", method = {RequestMethod.GET})
|
||||
@Authorize(action = "compile")
|
||||
@AccessLogger("编译脚本")
|
||||
public ResponseMessage compile(@PathVariable("id") String id) throws Exception {
|
||||
dynamicScriptService.compile(id);
|
||||
return ResponseMessage.ok("success");
|
||||
@@ -58,6 +60,7 @@ public class DynamicScriptController extends GenericController<DynamicScript, St
|
||||
|
||||
@RequestMapping(value = "/exec/{id:.+}", method = {RequestMethod.GET})
|
||||
@Authorize(action = "exec")
|
||||
@AccessLogger("执行脚本")
|
||||
public ResponseMessage execGet(@PathVariable("id") String id,
|
||||
QueryParam queryParam,
|
||||
@RequestParam(required = false) Map<String, Object> param) throws Throwable {
|
||||
@@ -72,6 +75,7 @@ public class DynamicScriptController extends GenericController<DynamicScript, St
|
||||
|
||||
@RequestMapping(value = "/exec/{id:.+}", method = {RequestMethod.POST, RequestMethod.PUT})
|
||||
@Authorize(action = "exec")
|
||||
@AccessLogger("执行脚本")
|
||||
public ResponseMessage execPostOrPut(@PathVariable("id") String id,
|
||||
@RequestBody(required = false) Map<String, Object> param) throws Throwable {
|
||||
if (param == null)
|
||||
@@ -83,6 +87,7 @@ public class DynamicScriptController extends GenericController<DynamicScript, St
|
||||
|
||||
@RequestMapping(value = "/exec/{id:.+}", method = RequestMethod.DELETE)
|
||||
@Authorize(action = "exec")
|
||||
@AccessLogger("执行脚本")
|
||||
public ResponseMessage execDelete(@PathVariable("id") String id) throws Throwable {
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put("user", WebUtil.getLoginUser());
|
||||
@@ -92,6 +97,7 @@ public class DynamicScriptController extends GenericController<DynamicScript, St
|
||||
|
||||
@RequestMapping(value = "/exec/runtime/{type}", method = RequestMethod.POST)
|
||||
@Authorize(action = "runtime")
|
||||
@AccessLogger("执行脚本-runtime")
|
||||
public ResponseMessage runtime(@PathVariable("type") String type,
|
||||
@RequestBody String script) throws Throwable {
|
||||
DynamicScriptEngine engine = DynamicScriptEngineFactory.getEngine(type);
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.hsweb.web.bean.po.user.User;
|
||||
import org.hsweb.web.core.authorize.annotation.Authorize;
|
||||
import org.hsweb.web.core.exception.AuthorizeException;
|
||||
import org.hsweb.web.core.exception.AuthorizeForbiddenException;
|
||||
import org.hsweb.web.core.logger.annotation.AccessLogger;
|
||||
import org.hsweb.web.core.message.ResponseMessage;
|
||||
import org.hsweb.web.core.utils.WebUtil;
|
||||
import org.hsweb.web.service.form.DynamicFormService;
|
||||
@@ -33,12 +34,14 @@ import java.util.List;
|
||||
@RestController
|
||||
@RequestMapping("/database")
|
||||
@Authorize(module = "database")
|
||||
@AccessLogger("数据库管理")
|
||||
public class DatabaseManagerController {
|
||||
@Resource
|
||||
private DataBaseManagerService dataBaseManagerService;
|
||||
|
||||
@RequestMapping(value = "/tables", method = RequestMethod.GET)
|
||||
@Authorize(action = "R")
|
||||
@AccessLogger("获取所有表结构")
|
||||
public ResponseMessage showTables() throws SQLException {
|
||||
return ResponseMessage.ok(dataBaseManagerService.getTableList())
|
||||
.include(TableMetaData.class, "name", "alias", "comment", "fields")
|
||||
@@ -47,6 +50,7 @@ public class DatabaseManagerController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/exec", method = RequestMethod.POST)
|
||||
@AccessLogger("执行SQL")
|
||||
public ResponseMessage exec(@RequestBody String sql) throws Exception {
|
||||
String[] list = sql.split("[\n]");
|
||||
List<SqlAppender> sqlList = new LinkedList<>();
|
||||
@@ -77,11 +81,13 @@ public class DatabaseManagerController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/sql/alter", method = RequestMethod.POST)
|
||||
@AccessLogger("查询修改表结构SQL")
|
||||
public ResponseMessage showAlterSql(@RequestBody JSONObject jsonObject) throws Exception {
|
||||
return ResponseMessage.ok(dataBaseManagerService.createAlterSql(createTableMetaDataByJson(jsonObject)));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/sql/create", method = RequestMethod.POST)
|
||||
@AccessLogger("查询创建表结构SQL")
|
||||
public ResponseMessage showCreateSql(@RequestBody JSONObject jsonObject) throws Exception {
|
||||
return ResponseMessage.ok(dataBaseManagerService.createCreateSql(createTableMetaDataByJson(jsonObject)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user