From fd797fe91d1be5b46317bf3581e568204684fc31 Mon Sep 17 00:00:00 2001 From: liuhanqing Date: Thu, 11 Sep 2025 15:33:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E7=94=9F=E6=88=90?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/generator/GenTableColumnMapper.xml | 135 ++++++--- .../mapper/generator/GenTableMapper.xml | 283 ++++++++++-------- .../src/views/bas/traycodeFormat/index.vue | 16 +- ruoyi-ui/src/views/system/dict/data.vue | 2 +- 4 files changed, 245 insertions(+), 191 deletions(-) diff --git a/ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml b/ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml index 52857e8..545422c 100644 --- a/ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml +++ b/ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml @@ -1,7 +1,7 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> @@ -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,53 +40,90 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + SELECT + COLUMN_NAME = c.name, + is_required = CASE WHEN c.is_nullable = 0 AND pk.object_id IS NULL THEN '1' ELSE '0' END, + is_pk = CASE WHEN pk.object_id IS NOT NULL THEN '1' ELSE '0' END, + sort = c.column_id, + column_comment = ISNULL(ep.value, ''), + is_increment = CASE WHEN ic.column_id IS NOT NULL THEN '1' ELSE '0' END, + column_type = ty.name + + CASE WHEN ty.name IN ('char', 'nchar', 'varchar', 'nvarchar') THEN '(' + CAST(c.max_length AS VARCHAR(10)) + ')' + WHEN ty.name IN ('decimal', 'numeric') THEN '(' + CAST(c.precision AS VARCHAR(10)) + ',' + CAST(c.scale AS VARCHAR(10)) + ')' + ELSE '' + END + FROM + sys.columns c + INNER JOIN + (SELECT object_id, name FROM sys.tables + UNION ALL + SELECT object_id, name FROM sys.views) t ON c.object_id = t.object_id + LEFT JOIN + sys.types ty ON c.user_type_id = ty.user_type_id + LEFT JOIN ( + -- 获取主键列 + SELECT ic.object_id, ic.column_id + FROM sys.indexes i + INNER JOIN sys.index_columns ic ON i.object_id = ic.object_id AND i.index_id = ic.index_id + WHERE i.is_primary_key = 1 + ) pk ON c.object_id = pk.object_id AND c.column_id = pk.column_id + LEFT JOIN ( + -- 获取自增列 + SELECT object_id, column_id + FROM sys.identity_columns + ) ic ON c.object_id = ic.object_id AND c.column_id = ic.column_id + LEFT JOIN + sys.extended_properties ep ON ep.major_id = c.object_id AND ep.minor_id = c.column_id AND ep.name = 'MS_Description' + WHERE + t.name =#{table} + ORDER BY + c.column_id + 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}, - sysdate() - ) + 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 + )values( + #{columnId}, + #{tableId}, + #{columnName}, + #{columnComment}, + #{columnType}, + #{javaType}, + #{javaField}, + #{isPk}, + #{isIncrement}, + #{isRequired}, + #{isInsert}, + #{isEdit}, + #{isList}, + #{isQuery}, + #{queryType}, + #{htmlType}, + #{dictType}, + #{sort}, + #{createBy}, + GETDATE() + ) @@ -105,7 +142,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" dict_type = #{dictType}, sort = #{sort}, update_by = #{updateBy}, - update_time = sysdate() + update_time = GETDATE() where column_id = #{columnId} @@ -124,4 +161,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - \ No newline at end of file + diff --git a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml index d1110f7..cf84389 100644 --- a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml +++ b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml @@ -1,11 +1,11 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -28,37 +28,37 @@ 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 - - - @@ -77,134 +77,151 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + - + - + - + - + - - - 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 + + insert into gen_table ( + table_id, + 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( + #{tableId}, + #{tableName}, + #{tableComment}, + #{className}, + #{tplCategory}, + #{tplWebType}, + #{packageName}, + #{moduleName}, + #{businessName}, + #{functionName}, + #{functionAuthor}, + #{genType}, + #{genPath}, + #{remark}, + #{createBy}, + GETDATE() + ) + + + + ${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 = GETDATE() + + where table_id = #{tableId} + + + + delete from gen_table where table_id in + + #{tableId} + + + + diff --git a/ruoyi-ui/src/views/bas/traycodeFormat/index.vue b/ruoyi-ui/src/views/bas/traycodeFormat/index.vue index 9bf9c48..cf10f9f 100644 --- a/ruoyi-ui/src/views/bas/traycodeFormat/index.vue +++ b/ruoyi-ui/src/views/bas/traycodeFormat/index.vue @@ -356,7 +356,7 @@ export default { handleAdd() { this.reset() this.open = true - this.title = this.$t('traycodeFormat.addTitle') + this.title = '新增条码格式' }, /** 修改按钮操作 */ handleUpdate(row) { @@ -365,7 +365,7 @@ export default { getTraycodeFormat(id).then(response => { this.form = response.data this.open = true - this.title = this.$t('traycodeFormat.editTitle') + this.title = '修改条码格式' }) }, /** 提交按钮 */ @@ -374,13 +374,13 @@ export default { if (valid) { if (this.form.id != null) { updateTraycodeFormat(this.form).then(response => { - this.$modal.msgSuccess(this.$t('traycodeFormat.editSuccess')) + this.$modal.msgSuccess('修改成功') this.open = false this.getList() }) } else { addTraycodeFormat(this.form).then(response => { - this.$modal.msgSuccess(this.$t('traycodeFormat.addSuccess')) + this.$modal.msgSuccess('添加成功') this.open = false this.getList() }) @@ -391,11 +391,11 @@ export default { /** 删除按钮操作 */ handleDelete(row) { const ids = row.id || this.ids - this.$modal.confirm(this.$t('traycodeFormat.deleteConfirm', { id: ids })).then(function() { + this.$modal.confirm('删除条码格式', { id: ids }).then(function() { return delTraycodeFormat(ids) }).then(() => { this.getList() - this.$modal.msgSuccess(this.$t('traycodeFormat.deleteSuccess')) + this.$modal.msgSuccess('删除成功') }).catch(() => {}) }, /** 导出按钮操作 */ @@ -422,11 +422,11 @@ export default { }; if (Number(this.printForm.printCount)+Number(this.selectData[0].serialRule)-1>this.selectData[0].maxNum){ - this.$modal.msgError(this.$t('traycodeFormat.printCountError')) + this.$modal.msgError('生成打印数据失败') return } updateTraycodeFormat(printData).then(response => { - this.$modal.msgSuccess(this.$t('traycodeFormat.editSuccess')) + this.$modal.msgSuccess('生成打印数据成功') this.printDialogVisible = false; this.getList() }) diff --git a/ruoyi-ui/src/views/system/dict/data.vue b/ruoyi-ui/src/views/system/dict/data.vue index 2e52bd6..3f0c626 100644 --- a/ruoyi-ui/src/views/system/dict/data.vue +++ b/ruoyi-ui/src/views/system/dict/data.vue @@ -147,7 +147,7 @@ icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['system:dict:remove']" - >{{ }} + >删除