package com.lideeyunji.core.framework.config.aspect.enhance.strategy.sql;

import com.lideeyunji.core.framework.config.aspect.enhance.model.EnhanceContext;
import com.lideeyunji.core.framework.entity.EnhanceSqlEntity;
import com.lideeyunji.tool.framework.yunji.utils.FuncBase;

import java.util.Map;

/**
 * 新增策略
 */
public class AddEnhanceSqlStrategy extends BaseEnhanceSqlStrategy  implements EnhanceSqlStrategy {

    @Override
    public void execute(EnhanceContext context, EnhanceSqlEntity enhanceSqlEntity) {
        Map<String, Object> paramMap = context.getParam().getParams();
        if (FuncBase.isNotEmpty(context.getParam().getDataId())) {
            paramMap.put("id", context.getParam().getDataId());
        }
        super.executeSql(enhanceSqlEntity.getExecuteSql(), paramMap);
    }

}
