Mysql 保存List或者数组、类等数据

2021-06-08  本文已影响0人  板栗炖牛肉

前言

     <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.4.1</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.2.75</version>
        </dependency>

解决方案

@Data
@TableName(value = "animal", autoResultMap = true)
public class AnimalSql {

    @TableId(value = "age", type = IdType.AUTO)
    private Integer age;


    private String name;


    @TableField(typeHandler = FastjsonTypeHandler.class)
    private List<String> data;
    private Bean data;
    private String[] data;
}

image.png image.png image.png
上一篇下一篇

猜你喜欢

热点阅读