mirror of
https://gitcode.com/ageerle/ruoyi-ai.git
synced 2026-04-15 04:43:40 +00:00
feat: 调整生成代码结构
This commit is contained in:
@@ -8,6 +8,7 @@ import org.ruoyi.generator.service.IGenTableService;
|
|||||||
import org.ruoyi.generator.service.SchemaFieldService;
|
import org.ruoyi.generator.service.SchemaFieldService;
|
||||||
import org.springframework.context.annotation.Profile;
|
import org.springframework.context.annotation.Profile;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@@ -40,8 +41,8 @@ public class GenController extends BaseController {
|
|||||||
*
|
*
|
||||||
* @param tableNameStr 表名
|
* @param tableNameStr 表名
|
||||||
*/
|
*/
|
||||||
@GetMapping("/batchGenCode")
|
@GetMapping("/batchGenCode/{tableNameStr}")
|
||||||
public R<String> batchGenCode(String tableNameStr) {
|
public R<String> batchGenCode(@PathVariable("tableNameStr") String tableNameStr) {
|
||||||
genTableService.generateCodeToClasspathByTableNames(tableNameStr);
|
genTableService.generateCodeToClasspathByTableNames(tableNameStr);
|
||||||
return R.ok("代码生成成功");
|
return R.ok("代码生成成功");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -289,24 +289,12 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||||||
*/
|
*/
|
||||||
private void addImportForJavaType(String javaType, Set<String> importList) {
|
private void addImportForJavaType(String javaType, Set<String> importList) {
|
||||||
switch (javaType) {
|
switch (javaType) {
|
||||||
case "BigDecimal":
|
case "BigDecimal" -> importList.add("java.math.BigDecimal");
|
||||||
importList.add("java.math.BigDecimal");
|
case "Date" -> importList.add("java.util.Date");
|
||||||
break;
|
case "LocalDateTime" -> importList.add("java.time.LocalDateTime");
|
||||||
case "Date":
|
case "LocalDate" -> importList.add("java.time.LocalDate");
|
||||||
importList.add("java.util.Date");
|
case "LocalTime" -> importList.add("java.time.LocalTime");
|
||||||
break;
|
default -> {}
|
||||||
case "LocalDateTime":
|
|
||||||
importList.add("java.time.LocalDateTime");
|
|
||||||
break;
|
|
||||||
case "LocalDate":
|
|
||||||
importList.add("java.time.LocalDate");
|
|
||||||
break;
|
|
||||||
case "LocalTime":
|
|
||||||
importList.add("java.time.LocalTime");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// 基本类型不需要导入
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user