2024-04-22 08:45:46 +08:00
|
|
|
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;
|
2024-04-23 08:39:01 +08:00
|
|
|
import com.jg.framework.web.controller.BaseController;
|
2024-04-22 08:45:46 +08:00
|
|
|
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}")
|
2024-04-23 08:39:01 +08:00
|
|
|
public class ${ClassName}Controller extends BaseController{
|
2024-04-22 08:45:46 +08:00
|
|
|
@Resource
|
|
|
|
private I${ClassName}Service ${className}Service;
|
|
|
|
|
2024-04-23 08:39:01 +08:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ${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);
|
|
|
|
}
|
2024-04-22 08:45:46 +08:00
|
|
|
/**
|
|
|
|
* ${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);
|
|
|
|
}
|
|
|
|
}
|