Search in sources :

Example 1 with IterateTag

use of com.nhn.dbtool.query.parser.sqlmap.model.IterateTag in project cubrid-manager by CUBRID.

the class MapperFileImpl method prepareQueryConditionList.

private void prepareQueryConditionList(Map<String, QueryCondition> queryConditionMap, List<SqlMapCondition> sqlMapConditionList) {
    for (SqlMapCondition sqlMapCondition : sqlMapConditionList) {
        if (sqlMapCondition == null) {
            continue;
        }
        if (sqlMapCondition.getMyBatisTestConditions() == null || sqlMapCondition.getMyBatisTestConditions().size() == 0) {
            String value = sqlMapCondition.getValue();
            if (sqlMapCondition instanceof SelectKeyTag) {
                continue;
            }
            if (!(sqlMapCondition instanceof DynamicTag)) {
                if (sqlMapCondition instanceof IsNotEmptyTag) {
                    value = "isNotEmpty";
                } else if (sqlMapCondition instanceof IsEmptyTag) {
                    value = "isEmpty";
                } else if (sqlMapCondition.getCompareValue() != null && sqlMapCondition.getCompareValue().length() > 0) {
                    value = sqlMapCondition.getCompareValue();
                }
                if (sqlMapCondition instanceof IterateTag) {
                // skip
                } else if (!"dynamic_param".equals(sqlMapCondition.getProperty())) {
                    String key = sqlMapCondition.getProperty() + ":" + value;
                    queryConditionMap.put(key, new QueryCondition(sqlMapCondition.getProperty(), value));
                }
            }
        } else {
            for (MyBatisTestCondition mybatisTestCondition : sqlMapCondition.getMyBatisTestConditions()) {
                if (mybatisTestCondition != null) {
                    String key = mybatisTestCondition.getProperty() + ":" + mybatisTestCondition.getValue();
                    queryConditionMap.put(key, new QueryCondition(mybatisTestCondition.getProperty(), mybatisTestCondition.getValue()));
                }
            }
        }
        if (sqlMapCondition.getChildConditionList() != null) {
            prepareQueryConditionList(queryConditionMap, sqlMapCondition.getChildConditionList());
        }
    }
}
Also used : IsNotEmptyTag(com.nhn.dbtool.query.parser.sqlmap.model.IsNotEmptyTag) DynamicTag(com.nhn.dbtool.query.parser.sqlmap.model.DynamicTag) IsEmptyTag(com.nhn.dbtool.query.parser.sqlmap.model.IsEmptyTag) IterateTag(com.nhn.dbtool.query.parser.sqlmap.model.IterateTag) QueryCondition(com.navercorp.dbtools.sqlmap.parser.QueryCondition) MyBatisTestCondition(com.nhn.dbtool.query.parser.sqlmap.model.MyBatisTestCondition) SqlMapCondition(com.nhn.dbtool.query.parser.sqlmap.model.SqlMapCondition) SelectKeyTag(com.nhn.dbtool.query.parser.sqlmap.model.SelectKeyTag)

Aggregations

QueryCondition (com.navercorp.dbtools.sqlmap.parser.QueryCondition)1 DynamicTag (com.nhn.dbtool.query.parser.sqlmap.model.DynamicTag)1 IsEmptyTag (com.nhn.dbtool.query.parser.sqlmap.model.IsEmptyTag)1 IsNotEmptyTag (com.nhn.dbtool.query.parser.sqlmap.model.IsNotEmptyTag)1 IterateTag (com.nhn.dbtool.query.parser.sqlmap.model.IterateTag)1 MyBatisTestCondition (com.nhn.dbtool.query.parser.sqlmap.model.MyBatisTestCondition)1 SelectKeyTag (com.nhn.dbtool.query.parser.sqlmap.model.SelectKeyTag)1 SqlMapCondition (com.nhn.dbtool.query.parser.sqlmap.model.SqlMapCondition)1