MybatisPlus 中文入库变成问号

环境

依赖

pom
	<dependency>
	  <groupId>com.baomidou</groupId>
	  <artifactId>mybatis-plus-boot-starter</artifactId>
	  <version>3.5.1</version>
	</dependency>

配置

yml
spring:
    datasource:
        username: root
        password: xxxxxxxx
        url: jdbc:mysql://192.168.2.111:3306/xxx
        driver-class-name: com.mysql.cj.jdbc.Driver
        type: com.alibaba.druid.pool.DruidDataSource

代码

sql
    <insert id="save" parameterType="com.xxx.xxx.xxx.entity.Article" useGeneratedKeys="true" keyProperty="id">
        insert into
            `article`(file_name, sub_title, description, file_type,
                      file_path, user_id, create_time, is_lock)
        values
            (#{fileName}, #{subTitle}, #{description}, #{fileType}, #{filePath}, #{userId}, #{createTime}, #{isLock})
    </insert>

异常原因

配置信息异常,数据库连接信息中应该包含字符集,修改url后正常录入数据。jdbc:mysql://192.168.2.111:3306/mylog?userUnicode=true&characterEncoding=utf8

posted @   惊邪  阅读(124)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
点击右上角即可分享
微信分享提示