通用Mapper 枚举类型处理办法

在application.properties中添加配置

枚举按简单类型处理,如果有枚举字段则需要加上该配置才会做映射

mapper.enum-as-simple-type = true
或者
mapper:
  enumAsSimpleType: true

在实体类的枚举字段加注解@ColumnType

/**
 * 性别 男:MALE 女:FEMALE
 */
@ColumnType(jdbcType = JdbcType.VARCHAR)
private SexStatusEnum sex;
posted @ 2020-07-13 20:55  荭丶尘  阅读(728)  评论(0编辑  收藏  举报