76 lines
2.1 KiB
Plaintext
76 lines
2.1 KiB
Plaintext
<%
|
|
var entityName = toCamelCase(isBlank(prefix) ? table.name : subAfter(table.name, prefix));
|
|
var controllerClass = upperFirst(entityName) + "Controller";
|
|
var entityClass = upperFirst(entityName) + "Entity";
|
|
var entityInstance = entityName + "Entity";
|
|
var serviceClass = upperFirst(entityName) + "Service";
|
|
var serviceInstance = entityName + "Service";
|
|
var mapperClass = upperFirst(entityName) + "Mapper";
|
|
var baseUrl = isBlank(prefix) ? table.name : subAfter(table.name, prefix);
|
|
%>
|
|
package ${basePackage}.${moduleName}.controller;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.RequiredArgsConstructor;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import com.njzscloud.common.core.utils.R;
|
|
import com.njzscloud.common.mp.support.PageParam;
|
|
import com.njzscloud.common.mp.support.PageResult;
|
|
import java.util.List;
|
|
import ${basePackage}.${moduleName}.pojo.entity.${entityClass};
|
|
import ${basePackage}.${moduleName}.service.${serviceClass};
|
|
|
|
/**
|
|
* ${table.comment}
|
|
*/
|
|
@Slf4j
|
|
@RestController
|
|
@RequestMapping("/${baseUrl}")
|
|
@RequiredArgsConstructor
|
|
public class ${controllerClass} {
|
|
private final ${serviceClass} ${serviceInstance};
|
|
|
|
/**
|
|
* 新增
|
|
*/
|
|
@PostMapping("/add")
|
|
public R<?> add(@RequestBody ${entityClass} ${entityInstance}) {
|
|
${serviceInstance}.add(${entityInstance});
|
|
return R.success();
|
|
}
|
|
|
|
/**
|
|
* 修改
|
|
*/
|
|
@PostMapping("/modify")
|
|
public R<?> modify(@RequestBody ${entityClass} ${entityInstance}) {
|
|
${serviceInstance}.modify(${entityInstance});
|
|
return R.success();
|
|
}
|
|
|
|
/**
|
|
* 删除
|
|
*/
|
|
@PostMapping("/del")
|
|
public R<?> del(@RequestBody List<Long> ids) {
|
|
${serviceInstance}.del(ids);
|
|
return R.success();
|
|
}
|
|
|
|
/**
|
|
* 详情
|
|
*/
|
|
@GetMapping("/detail")
|
|
public R<${entityClass}> detail(@RequestParam("id") Long id) {
|
|
return R.success(${serviceInstance}.detail(id));
|
|
}
|
|
|
|
/**
|
|
* 分页查询
|
|
*/
|
|
@GetMapping("/paging")
|
|
public R<PageResult<${entityClass}>> paging(PageParam pageParam, ${entityClass} ${entityInstance}) {
|
|
return R.success(${serviceInstance}.paging(pageParam, ${entityInstance}));
|
|
}
|
|
}
|