上篇文章《CRUD 正确姿势》步骤比较繁琐,可以通过 sharp-generator
生成固定代码
@Test
public void testGenerator() throws IOException {
SQLUtils.execute("Drop TABLE t_student");
generator.execute(Student.class,
"/Users/rick/Space/Workspace/sharp-project/sharp-admin/src/main/java/com/rick/admin/module/student",
Params.builder()
.pv(Generator.CONTROLLER, true) // 是否创建 controller
.pv(Generator.FORM_PAGE, "demos/student/edit") // 编辑页面路径
.pv(Generator.REPORT, true) // 是否创建 report
.pv(Generator.REPORT_TEST_PATH, "/Users/rick/Space/Workspace/sharp-project/sharp-admin/src/test/java/com/rick/admin/demo")
.pv(Generator.REPORT_TEST_PACKAGE, "com.rick.admin.demo")
.build());
}