|
|
|
@ -64,8 +64,11 @@ import org.springframework.core.io.Resource;
|
|
|
|
|
import org.springframework.http.HttpHeaders; |
|
|
|
|
import org.springframework.http.HttpStatus; |
|
|
|
|
import org.springframework.http.ResponseEntity; |
|
|
|
|
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.RequestAttribute; |
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam; |
|
|
|
@ -112,7 +115,7 @@ public class ResourcesController extends BaseController {
|
|
|
|
|
@ApiImplicitParam(name = "pid", value = "RESOURCE_PID", required = true, dataType = "Int", example = "10"), |
|
|
|
|
@ApiImplicitParam(name = "currentDir", value = "RESOURCE_CURRENTDIR", required = true, dataType = "String") |
|
|
|
|
}) |
|
|
|
|
@PostMapping(value = "/directory/create") |
|
|
|
|
@PostMapping(value = "/directory") |
|
|
|
|
@ApiException(CREATE_RESOURCE_ERROR) |
|
|
|
|
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") |
|
|
|
|
public Result createDirectory(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
@ -138,7 +141,7 @@ public class ResourcesController extends BaseController {
|
|
|
|
|
@ApiImplicitParam(name = "pid", value = "RESOURCE_PID", required = true, dataType = "Int", example = "10"), |
|
|
|
|
@ApiImplicitParam(name = "currentDir", value = "RESOURCE_CURRENTDIR", required = true, dataType = "String") |
|
|
|
|
}) |
|
|
|
|
@PostMapping(value = "/create") |
|
|
|
|
@PostMapping() |
|
|
|
|
@ApiException(CREATE_RESOURCE_ERROR) |
|
|
|
|
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") |
|
|
|
|
public Result createResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
@ -170,11 +173,11 @@ public class ResourcesController extends BaseController {
|
|
|
|
|
@ApiImplicitParam(name = "description", value = "RESOURCE_DESC", dataType = "String"), |
|
|
|
|
@ApiImplicitParam(name = "file", value = "RESOURCE_FILE", required = true, dataType = "MultipartFile") |
|
|
|
|
}) |
|
|
|
|
@PostMapping(value = "/update") |
|
|
|
|
@PutMapping(value = "/{id}") |
|
|
|
|
@ApiException(UPDATE_RESOURCE_ERROR) |
|
|
|
|
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") |
|
|
|
|
public Result updateResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
|
@RequestParam(value = "id") int resourceId, |
|
|
|
|
@PathVariable(value = "id") int resourceId, |
|
|
|
|
@RequestParam(value = "type") ResourceType type, |
|
|
|
|
@RequestParam(value = "name") String alias, |
|
|
|
|
@RequestParam(value = "description", required = false) String description, |
|
|
|
@ -222,7 +225,7 @@ public class ResourcesController extends BaseController {
|
|
|
|
|
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), |
|
|
|
|
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") |
|
|
|
|
}) |
|
|
|
|
@GetMapping(value = "/list-paging") |
|
|
|
|
@GetMapping() |
|
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
|
@ApiException(QUERY_RESOURCES_LIST_PAGING) |
|
|
|
|
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") |
|
|
|
@ -255,12 +258,12 @@ public class ResourcesController extends BaseController {
|
|
|
|
|
@ApiImplicitParams({ |
|
|
|
|
@ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100") |
|
|
|
|
}) |
|
|
|
|
@GetMapping(value = "/delete") |
|
|
|
|
@DeleteMapping(value = "/{id}") |
|
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
|
@ApiException(DELETE_RESOURCE_ERROR) |
|
|
|
|
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") |
|
|
|
|
public Result deleteResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
|
@RequestParam(value = "id") int resourceId |
|
|
|
|
@PathVariable(value = "id") int resourceId |
|
|
|
|
) throws Exception { |
|
|
|
|
return resourceService.delete(loginUser, resourceId); |
|
|
|
|
} |
|
|
|
@ -291,7 +294,7 @@ public class ResourcesController extends BaseController {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* query resources jar list |
|
|
|
|
* query resources by type |
|
|
|
|
* |
|
|
|
|
* @param loginUser login user |
|
|
|
|
* @param type resource type |
|
|
|
@ -301,7 +304,7 @@ public class ResourcesController extends BaseController {
|
|
|
|
|
@ApiImplicitParams({ |
|
|
|
|
@ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType") |
|
|
|
|
}) |
|
|
|
|
@GetMapping(value = "/list/jar") |
|
|
|
|
@GetMapping(value = "/query-by-type") |
|
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
|
@ApiException(QUERY_RESOURCES_LIST_ERROR) |
|
|
|
|
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") |
|
|
|
@ -328,13 +331,13 @@ public class ResourcesController extends BaseController {
|
|
|
|
|
@ApiImplicitParam(name = "fullName", value = "RESOURCE_FULL_NAME", required = true, dataType = "String"), |
|
|
|
|
@ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = false, dataType = "Int", example = "10") |
|
|
|
|
}) |
|
|
|
|
@GetMapping(value = "/queryResource") |
|
|
|
|
@GetMapping(value = "/{id}") |
|
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
|
@ApiException(RESOURCE_NOT_EXIST) |
|
|
|
|
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") |
|
|
|
|
public Result queryResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
|
@RequestParam(value = "fullName", required = false) String fullName, |
|
|
|
|
@RequestParam(value = "id", required = false) Integer id, |
|
|
|
|
@PathVariable(value = "id", required = false) Integer id, |
|
|
|
|
@RequestParam(value = "type") ResourceType type |
|
|
|
|
) { |
|
|
|
|
|
|
|
|
@ -356,11 +359,11 @@ public class ResourcesController extends BaseController {
|
|
|
|
|
@ApiImplicitParam(name = "skipLineNum", value = "SKIP_LINE_NUM", required = true, dataType = "Int", example = "100"), |
|
|
|
|
@ApiImplicitParam(name = "limit", value = "LIMIT", required = true, dataType = "Int", example = "100") |
|
|
|
|
}) |
|
|
|
|
@GetMapping(value = "/view") |
|
|
|
|
@GetMapping(value = "/{id}/view") |
|
|
|
|
@ApiException(VIEW_RESOURCE_FILE_ON_LINE_ERROR) |
|
|
|
|
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") |
|
|
|
|
public Result viewResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
|
@RequestParam(value = "id") int resourceId, |
|
|
|
|
@PathVariable(value = "id") int resourceId, |
|
|
|
|
@RequestParam(value = "skipLineNum") int skipLineNum, |
|
|
|
|
@RequestParam(value = "limit") int limit |
|
|
|
|
) { |
|
|
|
@ -414,11 +417,11 @@ public class ResourcesController extends BaseController {
|
|
|
|
|
@ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100"), |
|
|
|
|
@ApiImplicitParam(name = "content", value = "CONTENT", required = true, dataType = "String") |
|
|
|
|
}) |
|
|
|
|
@PostMapping(value = "/update-content") |
|
|
|
|
@PutMapping(value = "/{id}/update-content") |
|
|
|
|
@ApiException(EDIT_RESOURCE_FILE_ON_LINE_ERROR) |
|
|
|
|
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") |
|
|
|
|
public Result updateResourceContent(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
|
@RequestParam(value = "id") int resourceId, |
|
|
|
|
@PathVariable(value = "id") int resourceId, |
|
|
|
|
@RequestParam(value = "content") String content |
|
|
|
|
) { |
|
|
|
|
if (StringUtils.isEmpty(content)) { |
|
|
|
@ -439,12 +442,12 @@ public class ResourcesController extends BaseController {
|
|
|
|
|
@ApiImplicitParams({ |
|
|
|
|
@ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100") |
|
|
|
|
}) |
|
|
|
|
@GetMapping(value = "/download") |
|
|
|
|
@GetMapping(value = "/{id}/download") |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiException(DOWNLOAD_RESOURCE_FILE_ERROR) |
|
|
|
|
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") |
|
|
|
|
public ResponseEntity downloadResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
|
@RequestParam(value = "id") int resourceId) throws Exception { |
|
|
|
|
@PathVariable(value = "id") int resourceId) throws Exception { |
|
|
|
|
Resource file = resourceService.downloadResource(resourceId); |
|
|
|
|
if (file == null) { |
|
|
|
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(Status.RESOURCE_NOT_EXIST.getMsg()); |
|
|
|
@ -480,7 +483,7 @@ public class ResourcesController extends BaseController {
|
|
|
|
|
@ApiImplicitParam(name = "resourceId", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100") |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
@PostMapping(value = "/udf-func/create") |
|
|
|
|
@PostMapping(value = "/{resourceId}/udf-func") |
|
|
|
|
@ResponseStatus(HttpStatus.CREATED) |
|
|
|
|
@ApiException(CREATE_UDF_FUNCTION_ERROR) |
|
|
|
|
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") |
|
|
|
@ -491,7 +494,7 @@ public class ResourcesController extends BaseController {
|
|
|
|
|
@RequestParam(value = "argTypes", required = false) String argTypes, |
|
|
|
|
@RequestParam(value = "database", required = false) String database, |
|
|
|
|
@RequestParam(value = "description", required = false) String description, |
|
|
|
|
@RequestParam(value = "resourceId") int resourceId) { |
|
|
|
|
@PathVariable(value = "resourceId") int resourceId) { |
|
|
|
|
return udfFuncService.createUdfFunction(loginUser, funcName, className, argTypes, database, description, type, resourceId); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -507,12 +510,12 @@ public class ResourcesController extends BaseController {
|
|
|
|
|
@ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100") |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
@GetMapping(value = "/udf-func/update-ui") |
|
|
|
|
@GetMapping(value = "/{id}/udf-func") |
|
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
|
@ApiException(VIEW_UDF_FUNCTION_ERROR) |
|
|
|
|
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") |
|
|
|
|
public Result viewUIUdfFunction(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
|
@RequestParam("id") int id) { |
|
|
|
|
@PathVariable("id") int id) { |
|
|
|
|
Map<String, Object> map = udfFuncService.queryUdfFuncDetail(id); |
|
|
|
|
return returnDataList(map); |
|
|
|
|
} |
|
|
|
@ -543,18 +546,18 @@ public class ResourcesController extends BaseController {
|
|
|
|
|
@ApiImplicitParam(name = "resourceId", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100") |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
@PostMapping(value = "/udf-func/update") |
|
|
|
|
@PutMapping(value = "/{resourceId}/udf-func/{id}") |
|
|
|
|
@ApiException(UPDATE_UDF_FUNCTION_ERROR) |
|
|
|
|
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") |
|
|
|
|
public Result updateUdfFunc(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
|
@RequestParam(value = "id") int udfFuncId, |
|
|
|
|
@PathVariable(value = "id") int udfFuncId, |
|
|
|
|
@RequestParam(value = "type") UdfType type, |
|
|
|
|
@RequestParam(value = "funcName") String funcName, |
|
|
|
|
@RequestParam(value = "className") String className, |
|
|
|
|
@RequestParam(value = "argTypes", required = false) String argTypes, |
|
|
|
|
@RequestParam(value = "database", required = false) String database, |
|
|
|
|
@RequestParam(value = "description", required = false) String description, |
|
|
|
|
@RequestParam(value = "resourceId") int resourceId) { |
|
|
|
|
@PathVariable(value = "resourceId") int resourceId) { |
|
|
|
|
Map<String, Object> result = udfFuncService.updateUdfFunc(udfFuncId, funcName, className, argTypes, database, description, type, resourceId); |
|
|
|
|
return returnDataList(result); |
|
|
|
|
} |
|
|
|
@ -574,7 +577,7 @@ public class ResourcesController extends BaseController {
|
|
|
|
|
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), |
|
|
|
|
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") |
|
|
|
|
}) |
|
|
|
|
@GetMapping(value = "/udf-func/list-paging") |
|
|
|
|
@GetMapping(value = "/udf-func") |
|
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
|
@ApiException(QUERY_UDF_FUNCTION_LIST_PAGING_ERROR) |
|
|
|
|
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") |
|
|
|
@ -645,14 +648,14 @@ public class ResourcesController extends BaseController {
|
|
|
|
|
*/ |
|
|
|
|
@ApiOperation(value = "deleteUdfFunc", notes = "DELETE_UDF_FUNCTION_NOTES") |
|
|
|
|
@ApiImplicitParams({ |
|
|
|
|
@ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100") |
|
|
|
|
@ApiImplicitParam(name = "id", value = "UDF_FUNC_ID", required = true, dataType = "Int", example = "100") |
|
|
|
|
}) |
|
|
|
|
@GetMapping(value = "/udf-func/delete") |
|
|
|
|
@DeleteMapping(value = "/udf-func/{id}") |
|
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
|
@ApiException(DELETE_UDF_FUNCTION_ERROR) |
|
|
|
|
@AccessLogAnnotation |
|
|
|
|
public Result deleteUdfFunc(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
|
@RequestParam(value = "id") int udfFuncId |
|
|
|
|
@PathVariable(value = "id") int udfFuncId |
|
|
|
|
) { |
|
|
|
|
return udfFuncService.delete(udfFuncId); |
|
|
|
|
} |
|
|
|
@ -690,7 +693,7 @@ public class ResourcesController extends BaseController {
|
|
|
|
|
@ApiImplicitParams({ |
|
|
|
|
@ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100") |
|
|
|
|
}) |
|
|
|
|
@GetMapping(value = "/authorize-resource-tree") |
|
|
|
|
@GetMapping(value = "/authed-resource-tree") |
|
|
|
|
@ResponseStatus(HttpStatus.CREATED) |
|
|
|
|
@ApiException(AUTHORIZE_RESOURCE_TREE) |
|
|
|
|
@AccessLogAnnotation |
|
|
|
|