首页 > 代码库 > 把查询出来的结果进行修改再赋值给list

把查询出来的结果进行修改再赋值给list

List<RivBillNoPatternL> list = this.jdbcTemplate.getJdbcOperations().query(sqlSb.toString(), params.toArray(), new RowMapper<RivBillNoPatternL>(){

            @Override
            public RivBillNoPatternL mapRow(ResultSet rs, int rowNum)
                    throws SQLException {
                RivBillNoPatternL billNoPatternL = new RivBillNoPatternL();
                billNoPatternL.setBnplId(rs.getInt("bnpl_id"));
                billNoPatternL.setBnplHeaderId(rs.getInt("bnpl_header_id"));
                billNoPatternL.setBnplOrder(rs.getBigDecimal("bnpl_order"));
                billNoPatternL.setBnplPatternType(rs.getString("bnpl_pattern_type"));
                billNoPatternL.setBnplPattern(rs.getString("bnpl_pattern"));
                billNoPatternL.setBnplResetNumber(rs.getBigDecimal("bnpl_reset_number"));
                return billNoPatternL;
            }});
final List<RivExpiredWarningL> list = new ArrayList<RivExpiredWarningL>();
        final Date date = new Date();
        jdbcTemplate.query(sql, params.toArray(),new RowCallbackHandler(){
            @Override
            public void processRow(ResultSet rs) throws SQLException {
                RivExpiredWarningL exw = new RivExpiredWarningL();
                exw.setExwWarningDatetime(date);
                exw.setExwOrgId(rs.getInt(1));
                exw.setExwOwnerId(rs.getInt(2));
                exw.setExwQuantId(rs.getInt(3));
                list.add(exw);
            }
        });
        return list;

 

把查询出来的结果进行修改再赋值给list