85 lines
2.8 KiB
Plaintext
85 lines
2.8 KiB
Plaintext
|
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 ${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 {
|
||
|
@Resource
|
||
|
private I${ClassName}Service ${className}Service;
|
||
|
|
||
|
/**
|
||
|
* ${functionName}列表
|
||
|
*/
|
||
|
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')")
|
||
|
@ApiOperation(value = "${functionName}列表", notes = "${functionName}列表信息")
|
||
|
@GetMapping("/list")
|
||
|
public R<List<${ClassName}>> 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<Boolean> 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<Boolean> 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<Boolean> remove(Long id) {
|
||
|
boolean res = ${className}Service.removeById(id);
|
||
|
return R.ok(res);
|
||
|
}
|
||
|
}
|