com.feingto.cloud.domain.converters.ConditionPersistenceConverters Maven / Gradle / Ivy
package com.feingto.cloud.domain.converters;
import com.feingto.cloud.dto.monitor.Condition;
import com.feingto.cloud.kit.json.JSON;
import org.springframework.util.StringUtils;
import javax.persistence.AttributeConverter;
import java.util.Objects;
/**
* Condition 规则表达式持久层转换
*
* @author longfei
*/
public class ConditionPersistenceConverters implements AttributeConverter {
@Override
public String convertToDatabaseColumn(Condition attribute) {
return Objects.nonNull(attribute) ? JSON.obj2json(Condition.convertCondition(attribute)) : null;
}
@Override
public Condition convertToEntityAttribute(String dbData) {
return StringUtils.hasText(dbData) ? JSON.json2pojo(dbData, Condition.class) : null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy