| 对比新文件 |
| | |
| | | package ${package.Controller}; |
| | | |
| | | import ${package.Base}.core.annotation.excel.ExcelExporter; |
| | | import ${package.Base}.core.annotation.pr.PreventRepeat; |
| | | |
| | | import ${package.Base}.core.model.ApiResponse; |
| | | import ${package.Base}.core.model.PageData; |
| | | import ${package.Base}.core.model.PageWrap; |
| | | import ${package.Entity}.${entityName}; |
| | | import ${package.Base}.core.utils.Utils; |
| | | import ${package.Service}.${entityName}Service; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import ${package.Base}.api.BaseController; |
| | | /** |
| | | * ${tableComment}Controller瀹氫箟 |
| | | * @author doumee |
| | | * @date ${nowDate} |
| | | */ |
| | | @Api(tags = "${tableName}鎺ュ彛") |
| | | @RestController |
| | | @RequestMapping("/business/${entityNameLower}") |
| | | public class ${entityName}Controller extends BaseController { |
| | | |
| | | @Autowired |
| | | private ${entityName}Service ${entityNameLower}Service; |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("鏂板缓") |
| | | @PostMapping("/create") |
| | | @RequiresPermissions("business:${entityNameLowerFull}:create") |
| | | public ApiResponse create(@RequestBody ${entityName} ${entityNameLower}) { |
| | | return ApiResponse.success(${entityNameLower}Service.create(${entityNameLower})); |
| | | } |
| | | |
| | | @ApiOperation("鏍规嵁ID鍒犻櫎") |
| | | @GetMapping("/delete/{id}") |
| | | @RequiresPermissions("business:${entityNameLowerFull}:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id) { |
| | | ${entityNameLower}Service.deleteById(id); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("鎵归噺鍒犻櫎") |
| | | @GetMapping("/delete/batch") |
| | | @RequiresPermissions("business:${entityNameLowerFull}:delete") |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids) { |
| | | ${entityNameLower}Service.deleteByIdInBatch(this.getIdList(ids)); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("鏍规嵁ID淇敼") |
| | | @PostMapping("/updateById") |
| | | @RequiresPermissions("business:${entityNameLowerFull}:update") |
| | | public ApiResponse updateById(@RequestBody ${entityName} ${entityNameLower}) { |
| | | ${entityNameLower}Service.updateById(${entityNameLower}); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("鍒嗛〉鏌ヨ") |
| | | @PostMapping("/page") |
| | | @RequiresPermissions("business:${entityNameLowerFull}:query") |
| | | public ApiResponse<PageData<${entityName}>> findPage (@RequestBody PageWrap<${entityName}> pageWrap) { |
| | | return ApiResponse.success(${entityNameLower}Service.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("瀵煎嚭Excel") |
| | | @PostMapping("/exportExcel") |
| | | @RequiresPermissions("business:${entityNameLowerFull}:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<${entityName}> pageWrap, HttpServletResponse response) { |
| | | ExcelExporter.build(${entityName}.class).export(${entityNameLower}Service.findPage(pageWrap).getRecords(), "${tableComment}", response); |
| | | } |
| | | |
| | | @ApiOperation("鏍规嵁ID鏌ヨ") |
| | | @GetMapping("/{id}") |
| | | @RequiresPermissions("business:${entityNameLowerFull}:query") |
| | | public ApiResponse findById(@PathVariable Integer id) { |
| | | return ApiResponse.success(${entityNameLower}Service.findById(id)); |
| | | } |
| | | } |