mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-11-04 12:18:42 +08:00 
			
		
		
		
	适配 Oracle 数据库
1. 适配表名是大写的情况 2. 优化代码生成器的校验逻辑
This commit is contained in:
		@@ -10,7 +10,8 @@ import ${BaseDOClassName};
 | 
			
		||||
 *
 | 
			
		||||
 * @author ${table.author}
 | 
			
		||||
 */
 | 
			
		||||
@TableName("${table.tableName}")
 | 
			
		||||
@TableName("${table.tableName.toLowerCase()}")
 | 
			
		||||
@KeySequence("${table.tableName.toLowerCase()}_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = true)
 | 
			
		||||
@ToString(callSuper = true)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
-- 将该建表 SQL 语句,添加到 yudao-module-${table.moduleName}-biz 模块的 test/resources/sql/create_tables.sql 文件里
 | 
			
		||||
CREATE TABLE IF NOT EXISTS "${table.tableName}" (
 | 
			
		||||
CREATE TABLE IF NOT EXISTS "${table.tableName.toLowerCase()}" (
 | 
			
		||||
#foreach ($column in $columns)
 | 
			
		||||
#if (${column.javaType} == 'Long')
 | 
			
		||||
    #set ($dataType='bigint')
 | 
			
		||||
@@ -24,11 +24,11 @@ CREATE TABLE IF NOT EXISTS "${table.tableName}" (
 | 
			
		||||
    #elseif (${column.columnName} == 'deleted')
 | 
			
		||||
    "deleted" bit NOT NULL DEFAULT FALSE,
 | 
			
		||||
    #else
 | 
			
		||||
    "${column.columnName}" ${dataType}#if (${column.nullable} == false) NOT NULL#end,
 | 
			
		||||
    "${column.columnName.toLowerCase()}" ${dataType}#if (${column.nullable} == false) NOT NULL#end,
 | 
			
		||||
    #end
 | 
			
		||||
    #end
 | 
			
		||||
#end
 | 
			
		||||
    PRIMARY KEY ("${primaryColumn.columnName}")
 | 
			
		||||
    PRIMARY KEY ("${primaryColumn.columnName.toLowerCase()}")
 | 
			
		||||
) COMMENT '${table.tableComment}';
 | 
			
		||||
 | 
			
		||||
-- 将该删表 SQL 语句,添加到 yudao-module-${table.moduleName}-biz 模块的 test/resources/sql/clean.sql 文件里
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
-- 菜单 SQL
 | 
			
		||||
INSERT INTO `system_menu`(
 | 
			
		||||
    `name`, `permission`, `menu_type`, `sort`, `parent_id`,
 | 
			
		||||
    `path`, `icon`, `component`, `status`
 | 
			
		||||
INSERT INTO system_menu(
 | 
			
		||||
    name, permission, type, sort, parent_id,
 | 
			
		||||
    path, icon, component, status
 | 
			
		||||
)
 | 
			
		||||
VALUES (
 | 
			
		||||
    '${table.classComment}管理', '', 2, 0, ${table.parentMenuId},
 | 
			
		||||
@@ -16,9 +16,9 @@ SELECT @parentId := LAST_INSERT_ID();
 | 
			
		||||
#set ($functionOps = ['query', 'create', 'update', 'delete', 'export'])
 | 
			
		||||
#foreach ($functionName in $functionNames)
 | 
			
		||||
#set ($index = $foreach.count - 1)
 | 
			
		||||
INSERT INTO `system_menu`(
 | 
			
		||||
    `name`, `permission`, `menu_type`, `sort`, `parent_id`,
 | 
			
		||||
    `path`, `icon`, `component`, `status`
 | 
			
		||||
INSERT INTO system_menu(
 | 
			
		||||
    name, permission, type, sort, parent_id,
 | 
			
		||||
    path, icon, component, status
 | 
			
		||||
)
 | 
			
		||||
VALUES (
 | 
			
		||||
    '${table.classComment}${functionName}', '${permissionPrefix}:${functionOps.get($index)}', 3, $foreach.count, @parentId,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user