All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aizuda.snailjob.server.web.controller.NamespaceController Maven / Gradle / Ivy

package com.aizuda.snailjob.server.web.controller;

import com.aizuda.snailjob.server.web.annotation.LoginRequired;
import com.aizuda.snailjob.server.web.annotation.RoleEnum;
import com.aizuda.snailjob.server.web.model.base.PageResult;
import com.aizuda.snailjob.server.web.model.request.NamespaceQueryVO;
import com.aizuda.snailjob.server.web.model.request.NamespaceRequestVO;
import com.aizuda.snailjob.server.web.model.response.NamespaceResponseVO;
import com.aizuda.snailjob.server.web.service.NamespaceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: xiaowoniu
 * @date : 2023-11-21 15:02
 * @since : 2.5.0
 */
@RestController
@RequestMapping("/namespace")
public class NamespaceController {

    @Autowired
    private NamespaceService namespaceService;

    @LoginRequired(role = RoleEnum.ADMIN)
    @PostMapping
    public Boolean saveNamespace(@RequestBody @Validated NamespaceRequestVO namespaceRequestVO) {
        return namespaceService.saveNamespace(namespaceRequestVO);
    }

    @LoginRequired(role = RoleEnum.ADMIN)
    @PutMapping
    public Boolean updateNamespace(@RequestBody @Validated NamespaceRequestVO namespaceRequestVO) {
        return namespaceService.updateNamespace(namespaceRequestVO);
    }

    @LoginRequired(role = RoleEnum.ADMIN)
    @GetMapping("list")
    public PageResult> getNamespacePage(NamespaceQueryVO queryVO) {
        return namespaceService.getNamespacePage(queryVO);
    }

    @LoginRequired(role = RoleEnum.ADMIN)
    @DeleteMapping("{id}")
    public Boolean deleteNamespace(@PathVariable("id") Long id) {
        return namespaceService.deleteNamespace(id);
    }

    @LoginRequired(role = RoleEnum.ADMIN)
    @GetMapping("/all")
    public List getAllNamespace() {
        return namespaceService.getAllNamespace();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy