xml配置增加typeHandler="org.apache.ibatis.type.ArrayTypeHandler
<resultMap id="BaseResultMap" type="com.aaa.emission.domain.dao.ConfigModule">
<!--@mbg.generated-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="page_id" jdbcType="VARCHAR" property="pageId" />
<result column="page_name" jdbcType="VARCHAR" property="pageName" />
<result column="module_id" jdbcType="VARCHAR" property="moduleId" />
<result column="module_name" jdbcType="VARCHAR" property="moduleName" />
<result column="category_ids" jdbcType="ARRAY" property="categoryIds" typeHandler="org.apache.ibatis.type.ArrayTypeHandler"/>
<result column="property_ids" jdbcType="ARRAY" property="propertyIds" typeHandler="org.apache.ibatis.type.ArrayTypeHandler"/>
<result column="data_type" jdbcType="SMALLINT" property="dataType" />
<result column="deleted" jdbcType="SMALLINT" property="deleted" />
<result column="revision" jdbcType="INTEGER" property="revision" />
<result column="admin_code" jdbcType="VARCHAR" property="adminCode" />
<result column="company_code" jdbcType="VARCHAR" property="companyCode" />
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
</resultMap>
实体配置
package com.aaa.emission.domain.dao;
import com.baomidou.mybatisplus.annotation.*;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import org.apache.ibatis.type.ArrayTypeHandler;
/**
* 统计模块配置表;
*/
@Data
@TableName(value = config_module",autoResultMap = true)
public class ConfigModule implements Serializable {
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 页面标识
*/
@TableField(value = "page_id")
private String pageId;
/**
* 页面名称
*/
@TableField(value = "page_name")
private String pageName;
/**
* 模块标识
*/
@TableField(value = "module_id")
private String moduleId;
/**
* 模块名称
*/
@TableField(value = "module_name")
private String moduleName;
/**
* 分类编码数组(数据来源)
*/
@TableField(value = "category_ids", typeHandler = ArrayTypeHandler.class)
private Integer[] categoryIds;
/**
* 属性编码数组(监测因子)
*/
@TableField(value = "property_ids", typeHandler = ArrayTypeHandler.class)
private Integer[] propertyIds;
/**
* 数据类型 1-小时
*/
@TableField(value = "data_type")
private Integer dataType;
/**
* 是否删除 0-未删除;1-删除;
*/
@TableField(value = "deleted")
private Integer deleted;
/**
* 版本号(乐观锁)
*/
@Version
private Integer revision;
/**
* 行政区划编码
*/
@TableField(value = "admin_code")
private String adminCode;
/**
* 企业编码
*/
@TableField(value = "company_code")
private String companyCode;
/**
* 创建人
*/
@TableField(value = "created_by")
private String createdBy;
/**
* 创建时间
*/
@TableField(value = "created_time")
private Date createdTime;
/**
* 更新人
*/
@TableField(value = "updated_by")
private String updatedBy;
/**
* 更新时间
*/
@TableField(value = "updated_time")
private Date updatedTime;
}
注意
1、XML配置resultMap
<result column="category_ids" jdbcType="ARRAY" property="categoryIds" typeHandler="org.apache.ibatis.type.ArrayTypeHandler"/>
2、实体配置
@TableName(autoResultMap = true)
@TableField(value = "property_ids", typeHandler = ArrayTypeHandler.class)