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

tpl.controller.vm Maven / Gradle / Ivy

The newest version!
package ${package.Controller};

import java.util.Map;

import ${package.Entity}.${entity};
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

#if(${superControllerClassPackage})
import ${superControllerClassPackage};
#end
#if(${providerClassPackage})
import ${providerClassPackage};
#end

/**
 * 

* ${table.comment} 前端控制器 *

* * @author ${author} * @since ${date} */ #if(${restControllerStyle}) @RestController #else @Controller #end @RequestMapping("/if(${controllerMappingHyphenStyle})${controllerMappingHyphen}#else${table.entityPath}#end") @Api(value = "${table.comment}接口", description = "${table.comment}接口") #if(${superControllerClass}) public class ${table.controllerName} extends ${superControllerClass}<${cfg.providerClass}> { #else public class ${table.controllerName} { #end public String getService() { return "if(${controllerMappingHyphenStyle})${controllerMappingHyphen}#else${table.entityPath}#endService"; } @RequiresPermissions("if(${controllerMappingHyphenStyle})${controllerMappingHyphen}#else${table.entityPath}#end.read") @PutMapping(value = "/read/list") @ApiOperation(value = "查询${table.comment}", produces = MediaType.APPLICATION_JSON_VALUE) public Object query(HttpServletRequest request) { Map param = WebUtil.getParameter(request); ModelMap modelMap = new ModelMap(); return super.query(modelMap, param); } @RequiresPermissions("if(${controllerMappingHyphenStyle})${controllerMappingHyphen}#else${table.entityPath}#end.read") @PutMapping(value = "/read/detail") @ApiOperation(value = "${table.comment}详情", produces = MediaType.APPLICATION_JSON_VALUE) public Object get(HttpServletRequest request) { ${entity} param = WebUtil.getParameter(request, ${entity}.class); ModelMap modelMap = new ModelMap(); return super.get(modelMap, param); } @PostMapping @RequiresPermissions("if(${controllerMappingHyphenStyle})${controllerMappingHyphen}#else${table.entityPath}#end.update") @ApiOperation(value = "修改${table.comment}", produces = MediaType.APPLICATION_JSON_VALUE) public Object update(HttpServletRequest request) { ${entity} param = WebUtil.getParameter(request, ${entity}.class); ModelMap modelMap = new ModelMap(); return super.update(modelMap, param); } @DeleteMapping @RequiresPermissions("if(${controllerMappingHyphenStyle})${controllerMappingHyphen}#else${table.entityPath}#end.delete") @ApiOperation(value = "删除${table.comment}", produces = MediaType.APPLICATION_JSON_VALUE) public Object delete(HttpServletRequest request) { ${entity} param = WebUtil.getParameter(request, ${entity}.class); ModelMap modelMap = new ModelMap(); return super.delete(modelMap, param); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy