package com.kym.entity.typehandle;

import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.core.type.TypeReference;
import com.kym.entity.awoara.Detail;

import java.io.IOException;
import java.util.List;

/**
 * @author skyline
 * @description 洗车详情类型处理器
 * https://github.com/baomidou/mybatis-plus-samples/blob/master/mybatis-plus-sample-typehandler/src/main/java/com/baomidou/mybatisplus/samples/typehandler/WalletListTypeHandler.java
 */
public class WashOrderDetailTypeHandle extends JacksonTypeHandler {
    public WashOrderDetailTypeHandle(Class<?> type) {
        super(type);
    }

    @Override
    public Object parse(String json) {
        try {
            return getObjectMapper().readValue(json, new TypeReference<List<Detail>>() {
            });
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
