package com.bcxin.ars.strategy.ministerial;


import com.abcxin.smart.validator.annotation.MinisterialAttr;

import java.lang.reflect.Field;

/**
 * 取照片名
 * @author linqinglin
 * @date 2021/03/06 0006 13:20
 */
public class PhotoNameMinDataFormatStrategy implements MinDataFormatStrategy {
    @Override
    public String format(Field columnField, Object data) {
        if(data == null){
            MinisterialAttr resource = columnField.getAnnotation(MinisterialAttr.class);
            return resource.defaultValue();
        }

        return data.toString().substring(data.toString().lastIndexOf("/")+1);
    }
}
