com.nbsaas.boot.contoller.AppController Maven / Gradle / Ivy
package com.nbsaas.boot.contoller;
import com.nbsaas.boot.app.ext.apis.AppExtApi;
import com.nbsaas.boot.rest.annotations.AddOperator;
import com.nbsaas.boot.rest.annotations.DeleteOperator;
import com.nbsaas.boot.rest.annotations.UpdateOperator;
import com.nbsaas.boot.rest.annotations.ViewOperator;
import com.nbsaas.boot.rest.response.ListResponse;
import com.nbsaas.boot.rest.response.PageResponse;
import com.nbsaas.boot.rest.response.ResponseObject;
import com.nbsaas.boot.rest.annotations.CreateData;
import com.nbsaas.boot.rest.annotations.UpdateData;
import com.nbsaas.boot.app.api.domain.request.AppRequest;
import com.nbsaas.boot.app.api.domain.request.AppSearch;
import com.nbsaas.boot.app.api.domain.response.AppResponse;
import com.nbsaas.boot.app.api.domain.simple.AppSimple;
import com.nbsaas.boot.app.api.apis.AppApi;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* 对外控制器
*/
@RequiresAuthentication
@RestController
@RequestMapping("/app")
public class AppController {
@Resource
private AppApi appApi;
@Resource
private AppExtApi appExtApi;
@RequiresPermissions("app")
@RequestMapping("/search")
public PageResponse search(AppSearch request) {
return appApi.search(request);
}
@RequiresPermissions("app")
@RequestMapping("/list")
public ListResponse list(AppSearch request) {
return appApi.list(request);
}
/**
* 添加数据
*
* @param request
* @return
*/
@RequiresPermissions("app")
@CreateData
@RequestMapping("/create")
public ResponseObject create(@Validated(AddOperator.class) AppRequest request) {
return appExtApi.create(request);
}
@RequiresPermissions("app")
@UpdateData
@RequestMapping("/update")
public ResponseObject update(@Validated(UpdateOperator.class) AppRequest request) {
return appExtApi.update(request);
}
@RequiresPermissions("app")
@RequestMapping("/delete")
public ResponseObject> delete(@Validated(DeleteOperator.class) AppRequest request) {
return appApi.delete(request);
}
@RequiresPermissions("app")
@RequestMapping("/view")
public ResponseObject view(@Validated(ViewOperator.class) AppRequest request) {
return appApi.view(request);
}
}