
package com.lideeyunji.module.biz.demo.test;

import com.lideeyunji.core.framework.config.aspect.enhance.model.EnhanceContext;
import com.lideeyunji.core.framework.config.aspect.enhance.model.EnhanceResult;
import com.lideeyunji.core.framework.config.aspect.enhance.plugin.AfterAdvicePlugin;
import com.lideeyunji.tool.framework.yunji.utils.FuncBase;

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

/**
 * @author JX
 * @create 2024-08-19 15:06
 * @dedescription:
 */
public class TestAfterAdvicePlugin02 implements AfterAdvicePlugin {
    @Override
    public void execute(EnhanceContext enhanceContext) {
        EnhanceResult result = enhanceContext.getResult();
        List<Map<String, Object>> records = result.getRecords();
        records.forEach(
                record -> {
                    if (FuncBase.getMap2Int(record,"id") >5){
                        record.replace("name", "test02");
                    }else {
                        record.replace("name", "test01");
                    }
                }
        );
    }
}
