package weaver.formmode.recruit.customsearch;

import org.apache.commons.lang3.StringUtils;
import weaver.formmode.customjavacode.AbstractCustomSqlConditionJavaCode;
import weaver.general.Util;

import java.util.Map;

/**
 * @author:dxfeng
 * @createTime: 2024/10/15
 * @version: 1.0
 */
public class FlowStepSearchTemplate extends AbstractCustomSqlConditionJavaCode {
    @Override
    public String generateSqlCondition(Map<String, Object> param) throws Exception {
        // 只展示启用的数据
        String whereSql = "";
        Map<String, String> extensionParam = (Map<String, String>) param.get("extensionParam");
        String currenttime = Util.null2String(extensionParam.get("currenttime"));
        String zplc = Util.null2String(extensionParam.get("zplc"));
        if (StringUtils.isNotBlank(currenttime)) {
            String s = extensionParam.get("zplc_" + currenttime);
            zplc = StringUtils.isNotBlank(s) ? s : zplc;
        }

        if (StringUtils.isBlank(zplc)) {
            zplc = "-1";
        }
        whereSql += " t1.zplc = '" + zplc + "' ";
        return whereSql;
    }
}
