All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.schoolwow.quickdao.module.database.ddl.flow.common.GetEscapeCheckFlow Maven / Gradle / Ivy

There is a newer version: 5.3.1
Show newest version
package cn.schoolwow.quickdao.module.database.ddl.flow.common;

import cn.schoolwow.quickdao.domain.QuickDAOConfig;
import cn.schoolwow.quickdao.domain.entity.PropertyOption;
import cn.schoolwow.quickflow.domain.FlowContext;
import cn.schoolwow.quickflow.flow.BusinessFlow;

public class GetEscapeCheckFlow implements BusinessFlow {
    @Override
    public void executeBusinessFlow(FlowContext flowContext) throws Exception {
        QuickDAOConfig quickDAOConfig = (QuickDAOConfig) flowContext.checkData("quickDAOConfig");
        PropertyOption propertyOption = (PropertyOption) flowContext.checkData("propertyOption");
        if (null != propertyOption.check) {
            if (!propertyOption.check.isEmpty() && !propertyOption.check.contains("(")) {
                propertyOption.check = "(" + propertyOption.check + ")";
            }
            propertyOption.check = propertyOption.check.replace("#{" + propertyOption.name + "}", propertyOption.column);

            String escapeCheck = propertyOption.check.replace(propertyOption.column, quickDAOConfig.databaseContext.databaseProvider.escape(propertyOption.column));;
            flowContext.putTemporaryData("escapeCheck", escapeCheck);
        }
    }

    @Override
    public String name() {
        return "获取转义后的check约束";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy