

package com.lideeyunji.core.framework.enhance.example.dbform.student;

import com.lideeyunji.core.framework.config.aspect.enhance.model.EnhanceContext;
import com.lideeyunji.core.framework.config.aspect.enhance.plugin.AfterAdvicePlugin;
import com.lideeyunji.tool.framework.yunji.utils.FuncBase;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * 学生-详情-后置增强
 */
@Slf4j
@Component("studentAfterEnhanceDetail")
public class ExampleStudentAfterEnhanceDetail implements AfterAdvicePlugin {

    @Override
    public void execute(EnhanceContext enhanceContext) {
        log.info("进入=======>studentAfterEnhanceDetail=======>execute");
        List<Map<String, Object>> records = enhanceContext.getResult().getRecords();
        if (FuncBase.isEmpty(records)) {
            return;
        }
        // 处理返回的数据
        Map<String, Object> map = records.get(0);
        // 注：如果要在这里添加虚拟字段，需先在 [表单开发-数据库属性-同步数据库] 的对应字段处取消打勾，并确认该字段处在 [表单开发-虚拟化字段格式]
        map.put("classe", "1");
    }
}
