diff --git a/os-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml b/os-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml
index 3706536..1e97f36 100644
--- a/os-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml
+++ b/os-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml
@@ -29,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-
+
select column_id, table_id, column_name, column_comment, column_type, java_type, java_field, is_pk, is_increment, is_required, is_insert, is_edit, is_list, is_query, query_type, html_type, dict_type, sort, create_by, create_time, update_by, update_time from gen_table_column
@@ -40,98 +40,72 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ select column_name, (case when (is_nullable = 'no' column_key != 'PRI') then '1' else '0' end) as is_required, (case when column_key = 'PRI' then '1' else '0' end) as is_pk, ordinal_position as sort, column_comment, (case when extra = 'auto_increment' then '1' else '0' end) as is_increment, column_type
+ from information_schema.columns where table_schema = (select database()) and table_name = (#{tableName})
+ order by ordinal_position
+
insert into gen_table_column (
- table_id,
- column_name,
- column_comment,
- column_type,
- java_type,
- java_field,
- is_pk,
- is_increment,
- is_required,
- is_insert,
- is_edit,
- is_list,
- is_query,
- query_type,
- html_type,
- dict_type,
- sort,
- create_by,
- create_time
- )values(
- #{tableId},
- #{columnName},
- #{columnComment},
- #{columnType},
- #{javaType},
- #{javaField},
- #{isPk},
- #{isIncrement},
- #{isRequired},
- #{isInsert},
- #{isEdit},
- #{isList},
- #{isQuery},
- #{queryType},
- #{htmlType},
- #{dictType},
- #{sort},
- #{createBy},
- now()
- )
+ table_id,
+ column_name,
+ column_comment,
+ column_type,
+ java_type,
+ java_field,
+ is_pk,
+ is_increment,
+ is_required,
+ is_insert,
+ is_edit,
+ is_list,
+ is_query,
+ query_type,
+ html_type,
+ dict_type,
+ sort,
+ create_by,
+ create_time
+ )values(
+ #{tableId},
+ #{columnName},
+ #{columnComment},
+ #{columnType},
+ #{javaType},
+ #{javaField},
+ #{isPk},
+ #{isIncrement},
+ #{isRequired},
+ #{isInsert},
+ #{isEdit},
+ #{isList},
+ #{isQuery},
+ #{queryType},
+ #{htmlType},
+ #{dictType},
+ #{sort},
+ #{createBy},
+ sysdate()
+ )
update gen_table_column
+ column_comment = #{columnComment},
+ java_type = #{javaType},
+ java_field = #{javaField},
is_insert = #{isInsert},
is_edit = #{isEdit},
is_list = #{isList},
is_query = #{isQuery},
is_required = #{isRequired},
- column_comment = #{columnComment},
- java_type = #{javaType},
- java_field = #{javaField},
query_type = #{queryType},
html_type = #{htmlType},
dict_type = #{dictType},
sort = #{sort},
update_by = #{updateBy},
- update_time = now()
+ update_time = sysdate()
where column_id = #{columnId}
diff --git a/os-generator/src/main/resources/mapper/generator/GenTableMapper.xml b/os-generator/src/main/resources/mapper/generator/GenTableMapper.xml
index 6b81f9d..803f3b6 100644
--- a/os-generator/src/main/resources/mapper/generator/GenTableMapper.xml
+++ b/os-generator/src/main/resources/mapper/generator/GenTableMapper.xml
@@ -5,7 +5,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-
+
@@ -26,39 +26,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- select table_id, table_name, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, tpl_web_type, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options, create_by, create_time, update_by, update_time, remark from gen_table
-
-
-
+
+
-
+
-
+
-
+
-
+
-
-
- insert into gen_table (
- table_name,
- table_comment,
- class_name,
- tpl_category,
- tpl_web_type,
- package_name,
- module_name,
- business_name,
- function_name,
- function_author,
- gen_type,
- gen_path,
- remark,
- create_by,
- create_time
- )values(
- #{tableName},
- #{tableComment},
- #{className},
- #{tplCategory},
- #{tplWebType},
- #{packageName},
- #{moduleName},
- #{businessName},
- #{functionName},
- #{functionAuthor},
- #{genType},
- #{genPath},
- #{remark},
- #{createBy},
- now()
- )
-
-
-
- ${sql}
-
-
- update gen_table
-
- table_name = #{tableName},
- table_comment = #{tableComment},
- sub_table_name = #{subTableName},
- sub_table_fk_name = #{subTableFkName},
- class_name = #{className},
- function_author = #{functionAuthor},
- gen_type = #{genType},
- gen_path = #{genPath},
- tpl_category = #{tplCategory},
- tpl_web_type = #{tplWebType},
- package_name = #{packageName},
- module_name = #{moduleName},
- business_name = #{businessName},
- function_name = #{functionName},
- options = #{options},
- update_by = #{updateBy},
- remark = #{remark},
- update_time = now()
-
- where table_id = #{tableId}
-
-
-
- delete from gen_table where table_id in
-
- #{tableId}
-
-
+
+ insert into gen_table (
+ table_name,
+ table_comment,
+ class_name,
+ tpl_category,
+ tpl_web_type,
+ package_name,
+ module_name,
+ business_name,
+ function_name,
+ function_author,
+ gen_type,
+ gen_path,
+ remark,
+ create_by,
+ create_time
+ )values(
+ #{tableName},
+ #{tableComment},
+ #{className},
+ #{tplCategory},
+ #{tplWebType},
+ #{packageName},
+ #{moduleName},
+ #{businessName},
+ #{functionName},
+ #{functionAuthor},
+ #{genType},
+ #{genPath},
+ #{remark},
+ #{createBy},
+ sysdate()
+ )
+
+
+
+ ${sql}
+
+
+
+ update gen_table
+
+ table_name = #{tableName},
+ table_comment = #{tableComment},
+ sub_table_name = #{subTableName},
+ sub_table_fk_name = #{subTableFkName},
+ class_name = #{className},
+ function_author = #{functionAuthor},
+ gen_type = #{genType},
+ gen_path = #{genPath},
+ tpl_category = #{tplCategory},
+ tpl_web_type = #{tplWebType},
+ package_name = #{packageName},
+ module_name = #{moduleName},
+ business_name = #{businessName},
+ function_name = #{functionName},
+ options = #{options},
+ update_by = #{updateBy},
+ remark = #{remark},
+ update_time = sysdate()
+
+ where table_id = #{tableId}
+
+
+
+ delete from gen_table where table_id in
+
+ #{tableId}
+
+
\ No newline at end of file
diff --git a/os-generator/src/main/resources/vm/sql/sql.vm b/os-generator/src/main/resources/vm/sql/sql.vm
index 8921ca5..ee4f1f7 100644
--- a/os-generator/src/main/resources/vm/sql/sql.vm
+++ b/os-generator/src/main/resources/vm/sql/sql.vm
@@ -3,8 +3,7 @@ insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame
values('${functionName}', '${parentMenuId}', '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 0, 'C', '0', '0', '${permissionPrefix}:list', '#', 'admin', now(), '', null, '${functionName}菜单');
-- 按钮父菜单ID
-DECLARE @parentId INT;
-SET @parentId = SCOPE_IDENTITY();
+SET @parentId = LAST_INSERT_ID();
-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)