Search in sources :

Example 1 with IResultSetConverter

use of kyj.Fx.dao.wizard.core.IResultSetConverter in project Gargoyle by callakrsos.

the class GargoyleDbUtilBaseFxExtractDaoMethod method convert.

/* (non-Javadoc)
	 * @see kyj.Fx.dao.wizard.core.DaoBaseResultSetStatement#convert()
	 */
@Override
public String convert() {
    // 결과
    StringBuffer resultPart = new StringBuffer();
    // resultSet파트
    StringBuffer returnPart = new StringBuffer();
    // query 파트
    StringBuffer resultSetMappingPart = new StringBuffer();
    IRetrunStatement baseReturnStatement = getBaseReturnStatement();
    T mapper = getMapper();
    int appendTabKeyCount = getAppendTabKeyCount();
    String stringBufferVarName = mapper.getStringBufferVarName();
    String parameterMapVarName = mapper.getParameterMapVarName();
    String resultSetVarName = mapper.getResultSetVarName();
    String rowNumVarName = mapper.getRowNumVarName();
    List<TbpSysDaoFieldsDVO> inputFields = mapper.getT().getTbpSysDaoFieldsDVOList();
    List<TbpSysDaoColumnsDVO> columns = mapper.getT().getTbpSysDaoColumnsDVOList();
    String resultVoClass = mapper.getT().getResultVoClass();
    String type = getType(resultVoClass);
    /* 람다 expression */
    /* parameter part */
    returnPart.append(stringBufferVarName).append(".toString()").append(",");
    returnPart.append(parameterMapVarName).append(",(").append(resultSetVarName).append(",").append(rowNumVarName).append(")");
    returnPart.append("->{\n");
    /* [시작] Vo생성 statement */
    addImport(mapper.getFxDao(), resultVoClass);
    String varName = getVarName(resultVoClass);
    resultSetMappingPart.append(type).append(" ").append(varName).append(" = new ").append(type).append("();\n");
    /* [끝] Vo생성 statement */
    IResultSetConverter resultSetConverter = resultSetConverter();
    for (TbpSysDaoColumnsDVO col : columns) {
        String statement = resultSetConverter.convert(varName, resultSetVarName, col);
        resultSetMappingPart.append(statement).append("\n");
    }
    returnPart.append(applyedTabKeys(resultSetMappingPart.toString(), 1));
    returnPart.append(applyedTabKeys("return " + varName + ";", 1));
    returnPart.append("}\n");
    /* return문 베이스 */
    //.append(" query(").append(returnPart.toString()).append(");");
    resultPart.append(baseReturnStatement.returnKeyword()).append(baseReturnStatement.getReturnStatement(returnPart.toString()));
    return applyedTabKeys(resultPart.toString(), appendTabKeyCount);
}
Also used : IResultSetConverter(kyj.Fx.dao.wizard.core.IResultSetConverter) IRetrunStatement(kyj.Fx.dao.wizard.core.IRetrunStatement) TbpSysDaoColumnsDVO(kyj.Fx.dao.wizard.core.model.vo.TbpSysDaoColumnsDVO) TbpSysDaoFieldsDVO(kyj.Fx.dao.wizard.core.model.vo.TbpSysDaoFieldsDVO)

Aggregations

IResultSetConverter (kyj.Fx.dao.wizard.core.IResultSetConverter)1 IRetrunStatement (kyj.Fx.dao.wizard.core.IRetrunStatement)1 TbpSysDaoColumnsDVO (kyj.Fx.dao.wizard.core.model.vo.TbpSysDaoColumnsDVO)1 TbpSysDaoFieldsDVO (kyj.Fx.dao.wizard.core.model.vo.TbpSysDaoFieldsDVO)1