保存报错:
Caused by: java.sql.SQLException
Incorrect string value:
'\xF0\x9F\xA4\xB4\xF0\x9F...'
for
操作步骤:
1、更改数据库字符集,改为:utf8mb4
2、mapper添加一条更新语句(添加在末尾即可)
<update id="setUTF">SET NAMES utf8mb4</update>
3、在dao层添加方法
void setUTF();
4、更改service层(含义:在执行insert或update方法前执行一下Dao层刚添加的方法:setUTF();)
public int insertSelective(Video record) {
videomapper.setUTF();
return videomapper.insertSelective(record);
}
5、重启,操作成功!