private RecordArticleStatAllTimeModel updateRecordArticleStatAllTime( RecordArticleStatAllTimeModel model) { String sql = "UPDATE recordarticlestatalltime SET uniquevisitor=?, uniquevisitorarticleid=?, uniquevisitorarticletitle=?, uniquevisitorarticleurl=?, pageview=?," + "pageviewarticleid=?, pageviewarticletitle=?, pageviewarticleurl=?, visit=?, visitarticleid=?, visitarticletitle=?, visitarticleurl=?, site_id=? WHERE id = ?"; jdbcTemplate.update( sql, model.getUniqueVisitor(), model.getUniqueVisitorArticleId(), model.getUniqueVisitorArticleTitle(), model.getUniqueVisitorArticleUrl(), model.getPageView(), model.getPageViewArticleId(), model.getPageViewArticleTitle(), model.getPageViewArticleUrl(), model.getVisit(), model.getVisitArticleId(), model.getVisitArticleTitle(), model.getVisitArticleUrl(), model.getSite().getId(), model.getId()); return model; }
@Override public PreparedStatement createPreparedStatement(Connection con) throws SQLException { String sql = "INSERT INTO " + RECORDARTICLESTATALLTIME_TABLE + " (" + RECORDARTICLESTATALLTIME_COLUMN_LIST + ")" + " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; PreparedStatement preparedStatement = con.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS); int parameterIndex = 1; preparedStatement.setLong(parameterIndex++, recordArticleStatAllTimeModel.getUniqueVisitor()); preparedStatement.setString( parameterIndex++, recordArticleStatAllTimeModel.getUniqueVisitorArticleId()); preparedStatement.setString( parameterIndex++, recordArticleStatAllTimeModel.getUniqueVisitorArticleTitle()); preparedStatement.setString( parameterIndex++, recordArticleStatAllTimeModel.getUniqueVisitorArticleUrl()); preparedStatement.setLong(parameterIndex++, recordArticleStatAllTimeModel.getPageView()); preparedStatement.setString( parameterIndex++, recordArticleStatAllTimeModel.getPageViewArticleId()); preparedStatement.setString( parameterIndex++, recordArticleStatAllTimeModel.getPageViewArticleTitle()); preparedStatement.setString( parameterIndex++, recordArticleStatAllTimeModel.getPageViewArticleUrl()); preparedStatement.setLong(parameterIndex++, recordArticleStatAllTimeModel.getVisit()); preparedStatement.setString( parameterIndex++, recordArticleStatAllTimeModel.getVisitArticleId()); preparedStatement.setString( parameterIndex++, recordArticleStatAllTimeModel.getVisitArticleTitle()); preparedStatement.setString( parameterIndex++, recordArticleStatAllTimeModel.getVisitArticleUrl()); preparedStatement.setLong(parameterIndex++, recordArticleStatAllTimeModel.getSite().getId()); log.debug("ps: {}", preparedStatement.toString()); return preparedStatement; }