Commit a5a8f0d7 authored by fangxinjiang's avatar fangxinjiang

代码生成模板调整

parent 542b518f
......@@ -17,6 +17,7 @@
package ${package}.${moduleName}.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
......@@ -55,11 +56,21 @@ public class ${className}Controller {
*/
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_get')" )
public R get${className}Page(Page page, ${className} ${classname}) {
//@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_get')" )
public R<IPage<${className}>> get${className}Page(Page page, ${className} ${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}
......@@ -69,7 +80,7 @@ public class ${className}Controller {
@Operation(summary = "通过id查询", description = "通过id查询:hasPermission('${moduleName}_${pathName}_get')")
@GetMapping("/{${pk.lowerAttrName}}" )
@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}));
}
......@@ -82,7 +93,7 @@ public class ${className}Controller {
@SysLog("新增${comments}" )
@PostMapping
@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}));
}
......@@ -95,7 +106,7 @@ public class ${className}Controller {
@SysLog("修改${comments}" )
@PutMapping
@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}));
}
......@@ -108,7 +119,7 @@ public class ${className}Controller {
@SysLog("通过id删除${comments}" )
@DeleteMapping("/{${pk.lowerAttrName}}" )
@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}));
}
......
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