若依框架代码生成报错解决方案

21:15:50.614 [http-nio-8080-exec-10] ERROR c.r.f.w.e.GlobalExceptionHandler - [handleServiceException,61] - 导入失败:
### Error updating database.  Cause: java.sql.SQLException: Incorrect string value: '\xE5\xAD\xA6\xE7\xA7\x91...' for column 'column_comment' at row 1
### The error may exist in file [/Users/jingzhe/WEB/msbd002/RuoYi-Vue-master/ruoyi-generator/target/classes/mapper/generator/GenTableColumnMapper.xml]
### The error may involve com.ruoyi.generator.mapper.GenTableColumnMapper.insertGenTableColumn-Inline
### The error occurred while setting parameters
### SQL: 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,           sort,      create_by,     create_time          )values(     ?,      ?,      ?,      ?,      ?,      ?,      ?,      ?,      ?,      ?,      ?,      ?,      ?,      ?,      ?,           ?,      ?,     sysdate()          )
### Cause: java.sql.SQLException: Incorrect string value: '\xE5\xAD\xA6\xE7\xA7\x91...' for column 'column_comment' at row 1
; uncategorized SQLException; SQL state [HY000]; error code [1366]; Incorrect string value: '\xE5\xAD\xA6\xE7\xA7\x91...' for column 'column_comment' at row 1; nested exception is java.sql.SQLException: Incorrect string value: '\xE5\xAD\xA6\xE7\xA7\x91...' for column 'column_comment' at row 1
com.ruoyi.common.exception.ServiceException: 导入失败:
### Error updating database.  Cause: java.sql.SQLException: Incorrect string value: '\xE5\xAD\xA6\xE7\xA7\x91...' for column 'column_comment' at row 1
### The error may exist in file [/Users/jingzhe/WEB/msbd002/RuoYi-Vue-master/ruoyi-generator/target/classes/mapper/generator/GenTableColumnMapper.xml]
### The error may involve com.ruoyi.generator.mapper.GenTableColumnMapper.insertGenTableColumn-Inline
### The error occurred while setting parameters
### SQL: 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,           sort,      create_by,     create_time          )values(     ?,      ?,      ?,      ?,      ?,      ?,      ?,      ?,      ?,      ?,      ?,      ?,      ?,      ?,      ?,           ?,      ?,     sysdate()          )
### Cause: java.sql.SQLException: Incorrect string value: '\xE5\xAD\xA6\xE7\xA7\x91...' for column 'column_comment' at row 1
; uncategorized SQLException; SQL state [HY000]; error code [1366]; Incorrect string value: '\xE5\xAD\xA6\xE7\xA7\x91...' for column 'column_comment' at row 1; nested exception is java.sql.SQLException: Incorrect string value: '\xE5\xAD\xA6\xE7\xA7\x91...' for column 'column_comment' at row 1
	at com.ruoyi.generator.service.GenTableServiceImpl.importGenTable(GenTableServiceImpl.java:194)

在使用系统工具----代码生成----导入SQL报错

可以执行以下SQL解决报错

 

-- 修改表字符集
ALTER TABLE gen_table_column CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

-- 修改字段字符集
ALTER TABLE gen_table_column MODIFY column_comment VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值