You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
808 B
23 lines
808 B
|
4 weeks ago
|
package com.mathvision.diet.convert;
|
||
|
|
|
||
|
|
import com.alibaba.fastjson2.JSON;
|
||
|
|
import com.alibaba.fastjson2.TypeReference;
|
||
|
|
|
||
|
|
import javax.persistence.AttributeConverter;
|
||
|
|
import javax.persistence.Converter;
|
||
|
|
import java.math.BigDecimal;
|
||
|
|
import java.util.Map;
|
||
|
|
|
||
|
|
@Converter(autoApply = true)
|
||
|
|
public class IngredientConvert implements AttributeConverter<Map<String, Map<String, Map<String, BigDecimal>>>,String> {
|
||
|
|
@Override
|
||
|
|
public String convertToDatabaseColumn(Map<String, Map<String, Map<String, BigDecimal>>> stringMapMap) {
|
||
|
|
return JSON.toJSONString(stringMapMap);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public Map<String, Map<String, Map<String, BigDecimal>>> convertToEntityAttribute(String s) {
|
||
|
|
return JSON.parseObject(s, new TypeReference<Map<String, Map<String, Map<String, BigDecimal>>>>(){});
|
||
|
|
}
|
||
|
|
}
|