com.kasinf.framework.rest.web.controller.BaseTreeController Maven / Gradle / Ivy
The newest version!
package com.kasinf.framework.rest.web.controller;
import com.kasinf.framework.core.response.R;
import com.kasinf.framework.rest.annotation.SearchableDefaults;
import com.kasinf.framework.rest.config.SearchableConfiguration;
import com.kasinf.framework.rest.eneity.AbstractEntity;
import com.kasinf.framework.rest.eneity.projection.TreeProjection;
import com.kasinf.framework.rest.eneity.type.TreeEntity;
import com.kasinf.framework.rest.support.Searchable;
import com.kasinf.framework.rest.web.service.BaseTreeService;
import org.springframework.data.projection.ProjectionFactory;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import java.io.Serializable;
/**
* @author lkhsh
*/
@SuppressWarnings("all")
public class BaseTreeController extends BaseCrudController {
protected BaseTreeService getBaseTreeService() {
return (BaseTreeService) baseService;
}
@Override
public R batchDelete(@PathVariable ID[] ids) {
return R.error(config.getHttpCode().get(HttpStatus.METHOD_NOT_ALLOWED));
}
@GetMapping("tree")
@SearchableDefaults(projection = TreeProjection.class)
public R getTree(Searchable searchable) {
return setSuccess(searchable, getBaseService().findAllWithSort(searchable));
}
}