ALTER TABLE TABLE_NAME CONVERT TO CHARACTER SET utf8mb4;
JDBC解决方案:
//params
List<Object> params = Lists.newArrayList();
//sql
StringBuilder sql = new StringBuilder();
sql.append("INSERT into fxq_back_message(bank_id,content,create_date,is_delete,user_id,IMGS)" +
" VALUES('"+entity.getBank().getId()+"','"+
entity.getContent()+"','"+
DateUtil.parseDateToStr(entity.getCreateDate(),"yyyy-MM-dd HH:mm:ss") +"','"+
entity.getIsDelete()+"','"+entity.getBaseUser().getId()+"','"+entity.getImgs()+"')");
jdbcTemplate.execute("set names utf8mb4");
jdbcTemplate.execute(sql.toString());