package ${packageName}.controller; import java.util.List; import javax.annotation.Resource; import lombok.extern.slf4j.Slf4j; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.jg.framework.web.controller.BaseController; import ${packageName}.domain.${ClassName}; import ${packageName}.service.I${ClassName}Service; import com.ruoyi.framework.web.domain.R; #if($table.crud || $table.sub) #elseif($table.tree) #end /** * ${functionName}Controller * * @author ${author} * @date ${datetime} */ @Slf4j @Api(tags = "${functionName}") @RestController @RequestMapping("/${moduleName}") public class ${ClassName}Controller extends BaseController{ @Resource private I${ClassName}Service ${className}Service; /** * ${functionName}分页列表 */ @PreAuthorize("@ss.hasPermi('${permissionPrefix}:listPage')") @ApiOperation(value = "${functionName}分页列表", notes = "${functionName}分页列表信息") @PostMapping("/listPage") public R listPage(QueryPage queryPage,${ClassName} ${className}) { startPage(); List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); return R.page(queryPage.getPageNum(),queryPage.getPageSize(),list.size(),list); } /** * ${functionName}列表 */ @PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')") @ApiOperation(value = "${functionName}列表", notes = "${functionName}列表信息") @GetMapping("/list") public R> list() { List<${ClassName}> list = ${className}Service.list(); return R.ok(list); } /** * ${functionName}id详细信息 */ @PreAuthorize("@ss.hasPermi('${permissionPrefix}:query')") @ApiOperation(value = "${functionName}id详细信息", notes = "${functionName}id详细信息") @GetMapping("/query") public R<${ClassName}> query(Long id) { ${ClassName} queryinfo = ${className}Service.getById(id); return R.ok(queryinfo); } /** * ${functionName}新增信息 */ @PreAuthorize("@ss.hasPermi('${permissionPrefix}:add')") @ApiOperation(value = "${functionName}新增信息", notes = "${functionName}新增信息") @PostMapping("/add") public R add(${ClassName} ${className}) { boolean res = ${className}Service.save(${className}); return R.ok(res); } /** * ${functionName}修改信息 */ @PreAuthorize("@ss.hasPermi('${permissionPrefix}:edit')") @ApiOperation(value = "${functionName}修改信息", notes = "${functionName}修改信息") @PostMapping("/edit") public R edit(${ClassName} ${className}) { boolean res = ${className}Service.updateById(${className}); return R.ok(res); } /** * ${functionName}删除信息 */ @PreAuthorize("@ss.hasPermi('${permissionPrefix}:remove')") @ApiOperation(value = "${functionName}删除信息", notes = "${functionName}删除信息") @PostMapping("/remove") public R remove(Long id) { boolean res = ${className}Service.removeById(id); return R.ok(res); } }