package com.persagy.bdtp.adm.entity; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.persagy.dmp.common.helper.SpringHelper; import lombok.Data; import java.io.IOException; import java.util.List; @Data @TableName(value = "adm_infos_config",autoResultMap = true) public class AdmInfosConfig implements IAdmEntity { private String id; private String projectId; private String objType; private String name; private String classCode; private String majorCode; private String systemCode; @TableField( typeHandler = JacksonTypeHandler.class ) private List infos; private String flag; private String strInfos; @Override public void serializeJsonProp() { if(infos != null) { ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class); try { strInfos = objectMapper.writeValueAsString(infos); } catch (JsonProcessingException e) { } infos = null; } } @Override public void deserializeJsonProp() { if(StrUtil.isNotBlank(strInfos)) { ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class); try { infos = objectMapper.readValue(strInfos, List.class); } catch (IOException e) { } strInfos = null; } } }