Commit a5a8f0d7 authored by fangxinjiang's avatar fangxinjiang

代码生成模板调整

parent 542b518f
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
package ${package}.${moduleName}.controller; package ${package}.${moduleName}.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
...@@ -55,11 +56,21 @@ public class ${className}Controller { ...@@ -55,11 +56,21 @@ public class ${className}Controller {
*/ */
@Operation(summary = "分页查询", description = "分页查询") @Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page" ) @GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_get')" ) //@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_get')" )
public R get${className}Page(Page page, ${className} ${classname}) { public R<IPage<${className}>> get${className}Page(Page page, ${className} ${classname}) {
return R.ok(${classname}Service.page(page, Wrappers.query(${classname}))); return R.ok(${classname}Service.page(page, Wrappers.query(${classname})));
} }
/**
* 不分页查询
* @param ${classname} ${comments}
* @return
*/
@Operation(summary = "不分页查询", description = "不分页查询")
@GetMapping("/noPage" )
//@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_get')" )
public R<List<${className}>> get${className}NoPage(${className} ${classname}) {
return R.ok(${classname}Service.list(Wrappers.query(${classname})));
}
/** /**
* 通过id查询${comments} * 通过id查询${comments}
...@@ -69,7 +80,7 @@ public class ${className}Controller { ...@@ -69,7 +80,7 @@ public class ${className}Controller {
@Operation(summary = "通过id查询", description = "通过id查询:hasPermission('${moduleName}_${pathName}_get')") @Operation(summary = "通过id查询", description = "通过id查询:hasPermission('${moduleName}_${pathName}_get')")
@GetMapping("/{${pk.lowerAttrName}}" ) @GetMapping("/{${pk.lowerAttrName}}" )
@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_get')" ) @PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_get')" )
public R getById(@PathVariable("${pk.lowerAttrName}" ) ${pk.attrType} ${pk.lowerAttrName}) { public R<${classname}> getById(@PathVariable("${pk.lowerAttrName}" ) ${pk.attrType} ${pk.lowerAttrName}) {
return R.ok(${classname}Service.getById(${pk.lowerAttrName})); return R.ok(${classname}Service.getById(${pk.lowerAttrName}));
} }
...@@ -82,7 +93,7 @@ public class ${className}Controller { ...@@ -82,7 +93,7 @@ public class ${className}Controller {
@SysLog("新增${comments}" ) @SysLog("新增${comments}" )
@PostMapping @PostMapping
@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_add')" ) @PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_add')" )
public R save(@RequestBody ${className} ${classname}) { public R<Boolean> save(@RequestBody ${className} ${classname}) {
return R.ok(${classname}Service.save(${classname})); return R.ok(${classname}Service.save(${classname}));
} }
...@@ -95,7 +106,7 @@ public class ${className}Controller { ...@@ -95,7 +106,7 @@ public class ${className}Controller {
@SysLog("修改${comments}" ) @SysLog("修改${comments}" )
@PutMapping @PutMapping
@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_edit')" ) @PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_edit')" )
public R updateById(@RequestBody ${className} ${classname}) { public R<Boolean> updateById(@RequestBody ${className} ${classname}) {
return R.ok(${classname}Service.updateById(${classname})); return R.ok(${classname}Service.updateById(${classname}));
} }
...@@ -108,7 +119,7 @@ public class ${className}Controller { ...@@ -108,7 +119,7 @@ public class ${className}Controller {
@SysLog("通过id删除${comments}" ) @SysLog("通过id删除${comments}" )
@DeleteMapping("/{${pk.lowerAttrName}}" ) @DeleteMapping("/{${pk.lowerAttrName}}" )
@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_del')" ) @PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_del')" )
public R removeById(@PathVariable ${pk.attrType} ${pk.lowerAttrName}) { public R<Boolean> removeById(@PathVariable ${pk.attrType} ${pk.lowerAttrName}) {
return R.ok(${classname}Service.removeById(${pk.lowerAttrName})); return R.ok(${classname}Service.removeById(${pk.lowerAttrName}));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment