static.template.server.tree.TreeDemoController.tp Maven / Gradle / Ivy
package {packPath}.{rootModule}.{moduleName}.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import io.github.wslxm.springbootplus2.core.base.model.BasePage;
import {packPath}.{rootModule}.{moduleName}.model.vo.{tableNameUp}VO;
import {packPath}.{rootModule}.{moduleName}.model.dto.{tableNameUp}DTO;
import {packPath}.{rootModule}.{moduleName}.model.query.{tableNameUp}Query;
import {packPath}.{rootModule}.{moduleName}.service.{tableNameUp}Service;
import io.github.wslxm.springbootplus2.core.base.controller.BaseController;
import io.github.wslxm.springbootplus2.core.constant.BaseConstant;
import io.github.wslxm.springbootplus2.core.result.Result;
import java.util.List;
/**
* {tableComment} 前端控制器
*
*
* {describe}
*
*
* @author {author}
* @email {email}
* @date {date}
*/
@RestController
@RequestMapping(BaseConstant.Uri.API_ADMIN + "/{moduleName}/{tableNameLower}")
@Api(value = "{tableNameUp}Controller", tags = "{tableComment}")
public class {tableNameUp}Controller extends BaseController<{tableNameUp}Service> {
{filterCrud}
@GetMapping(value = "/tree")
@ApiOperation(value = "树结构数据")
public Result> tree(@ModelAttribute @Validated {tableNameUp}Query query) {
return Result.success(baseService.tree(query));
}
@GetMapping(value = "/findPage")
@ApiOperation(value = "列表查询")
public Result> findPage(@ModelAttribute @Validated {tableNameUp}Query query) {
return Result.success(baseService.findPage(query));
}
@GetMapping(value = "/{id}")
@ApiOperation(value = "ID查询")
public Result<{tableNameUp}VO> findId(@PathVariable String id) {
return Result.success(baseService.findId(id));
}
@PostMapping
@ApiOperation(value = "添加")
public Result insert(@RequestBody @Validated {tableNameUp}DTO dto) {
return Result.successInsert(baseService.insert(dto));
}
@PutMapping(value = "/{id}")
@ApiOperation(value = "ID编辑")
public Result upd(@PathVariable String id, @RequestBody @Validated {tableNameUp}DTO dto) {
return Result.successUpdate(baseService.upd(id, dto));
}
@DeleteMapping(value = "/{id}")
@ApiOperation(value = "ID删除")
public Result del(@PathVariable String id) {
return Result.successDelete(baseService.del(id));
}
{filterCrud}
}