Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql Spring StoredProcess对象返回对象的列表_Mysql_Spring_Stored Procedures_Jdbctemplate - Fatal编程技术网

Mysql Spring StoredProcess对象返回对象的列表

Mysql Spring StoredProcess对象返回对象的列表,mysql,spring,stored-procedures,jdbctemplate,Mysql,Spring,Stored Procedures,Jdbctemplate,我使用mysql存储过程来检索对象列表。这可能吗 我正在关注这个 问题: 如何使用结果集检索select语句中的对象列表? 如何将结果集映射到对象列表 创建定义器=root@localhost过程生成CRREPORTIN countryCodeParam INT、OUT countryCode INT、OUT dialCode INT、OUT custPrefix VARCHAR50、OUT vendorPrefix VARCHAR50、OUT custPrice FLOAT、OUT vendo

我使用mysql存储过程来检索对象列表。这可能吗

我正在关注这个

问题:

如何使用结果集检索select语句中的对象列表? 如何将结果集映射到对象列表

创建定义器=root@localhost过程生成CRREPORTIN countryCodeParam INT、OUT countryCode INT、OUT dialCode INT、OUT custPrefix VARCHAR50、OUT vendorPrefix VARCHAR50、OUT custPrice FLOAT、OUT vendorCost FLOAT、OUT profit FLOAT 语言SQL 确定性 读取SQL数据 SQL安全定义程序 注释“generateLCRReport” 开始 选择c.国家/地区代码作为国家/地区代码,选择c.拨号代码作为拨号代码, c、 客户前缀为custPrefix,c.供应商前缀为vendorPrefix, 最大客户费率作为客户价格,最小客户费率作为供应商成本, roundmaxcust_rate.rate-minven_rate.rate,3作为利润 来自cdr c

内连接 从费率r中选择a.id、r.rate、re.country\u code、re.dial\u code、ap.prefix r.region\u id=re.id上的内部连接区域re r.account上的内部联接帐户\前缀ap\前缀\ id=ap.id a.id=ap.account\u id上的内部联接帐户a 其中ap.prefix_type=0 作为客户费率

关于c.country\u代码=客户费率.country\u代码 c.拨码=客户费率.拨码 c.customer\u prefix=cust\u rate.prefix c.customer\u id=cust\u rate.id

内连接 从费率r中选择a.id、r.rate、re.country\u code、re.dial\u code、ap.prefix r.region\u id=re.id上的内部连接区域re r.account上的内部联接帐户\前缀ap\前缀\ id=ap.id a.id=ap.account\u id上的内部联接帐户a 其中ap.prefix_type=1 如文率

关于c.country\u代码=ven\u rate.country\u代码 和c.拨号代码=ven_rate.拨号代码 和c.vendor\u prefix=ven\u rate.prefix 和c.供应商id=ven_rate.id 其中c.country_code=countryCodeParam 按c.国家代码和c.拨号代码分组 按c.国家/地区代码asc订购 限额5000

结束

公共类LCRRReportSP扩展了StoredProcess{

/**
 * 
 */
@Autowired
public LCRReportSP(JdbcTemplate jdbcTemplate, String storedProcName, RowMapper<CostReport> mapper) {
    super(jdbcTemplate, storedProcName);

    SqlReturnResultSet rs = new SqlReturnResultSet("", mapper);
    SqlOutParameter outParam = new SqlOutParameter("countryCode", Types.INTEGER);
    SqlOutParameter outParam1 = new SqlOutParameter("dialCode", Types.INTEGER);
    SqlOutParameter outParam2 = new SqlOutParameter("custPrefix", Types.VARCHAR);
    SqlOutParameter outParam3 = new SqlOutParameter("vendorPrefix", Types.VARCHAR);
    SqlOutParameter outParam4 = new SqlOutParameter("custPrice", Types.FLOAT);
    SqlOutParameter outParam5 = new SqlOutParameter("vendorCost", Types.FLOAT);
    SqlOutParameter outParam6 = new SqlOutParameter("profit", Types.FLOAT);

    this.declareParameter(rs);
    this.declareParameter(outParam);
    this.declareParameter(outParam1);
    this.declareParameter(outParam2);
    this.declareParameter(outParam3);
    this.declareParameter(outParam4);
    this.declareParameter(outParam5);
    this.declareParameter(outParam6);

    this.setFunction(false);
    this.compile();
}

/**
 * @param countryCode
 * @return
 */
public Map<String, ?> generateLCRReport(int countryCode) {

    Map<String, Object> inParam = new HashMap<String, Object>();

    inParam.put("countryCodeParam", new Integer(countryCode));

    return this.execute(inParam);
}
}

请帮忙


谢谢

我正在使用行映射器和声明的参数SqlReturnResultSet

您可以尝试ResultSetTextRactor