use of org.springframework.jdbc.core.RowMapper in project topcom-cloud by 545314690.
the class RowMappers method kvPairHatRowMapper.
public static RowMapper<KVPair> kvPairHatRowMapper() {
return new RowMapper<KVPair>() {
@Override
public KVPair mapRow(ResultSet resultSet, int i) throws SQLException {
KVPair kvPair = new KVPair();
kvPair.setName(resultSet.getString("keyName"));
kvPair.setValue(resultSet.getString("value"));
return kvPair;
}
};
}
use of org.springframework.jdbc.core.RowMapper in project topcom-cloud by 545314690.
the class RowMappers method tjsSpecialCompanyRowMapper.
/**
* 企业RowMapper
* @return
*/
public static RowMapper<TjsSpecialCompany> tjsSpecialCompanyRowMapper() {
return new RowMapper<TjsSpecialCompany>() {
@Override
public TjsSpecialCompany mapRow(ResultSet resultSet, int i) throws SQLException {
TjsSpecialCompany company = new TjsSpecialCompany();
company.setId(resultSet.getLong("id"));
company.setCompanyName(resultSet.getString("companyName"));
company.setLng(resultSet.getDouble("lng"));
company.setLat(resultSet.getDouble("lat"));
company.setAddress(resultSet.getString("address"));
company.setSCC(resultSet.getString("SCC"));
company.setProvince(resultSet.getString("province"));
company.setCity(resultSet.getString("city"));
company.setSpecial(resultSet.getBoolean("special"));
company.setScale(resultSet.getBoolean("scale"));
company.setProductType(resultSet.getString("productType"));
company.setIndustryNumber(resultSet.getInt("industryNumber"));
company.setIndustryType(resultSet.getString("industryType"));
company.setCompanyAttribute(resultSet.getString("companyAttribute"));
company.setLogoType(resultSet.getString("logoType"));
company.setPersonNumber(resultSet.getInt("personNumber"));
company.setCompanyType(resultSet.getString("companyType"));
company.setLicence(resultSet.getString("licence"));
company.setNumber(resultSet.getLong("number"));
company.setOrganName(resultSet.getString("organName"));
company.setLicenceStartDate(resultSet.getDate("licenceStartDate"));
company.setLicenceEndDate(resultSet.getDate("licenceEndDate"));
company.setGLFL(resultSet.getString("GLFL"));
company.setHazardousChemicals(resultSet.getBoolean("hazardousChemicals"));
company.setLawPlan(resultSet.getBoolean("lawPlan"));
company.setCancellation(resultSet.getBoolean("cancellation"));
return company;
}
};
}
use of org.springframework.jdbc.core.RowMapper in project topcom-cloud by 545314690.
the class RowMappers method tjsZfyhByTime.
public static RowMapper<JSONObject> tjsZfyhByTime() {
return new RowMapper<JSONObject>() {
@Override
public JSONObject mapRow(ResultSet resultSet, int i) throws SQLException {
JSONObject jsonObject = new JSONObject();
jsonObject.put("年", resultSet.getInt("年"));
jsonObject.put("月", resultSet.getInt("月"));
jsonObject.put("一般隐患", resultSet.getInt("一般隐患"));
jsonObject.put("重大隐患", resultSet.getInt("重大隐患"));
jsonObject.put("违法行为", resultSet.getInt("违法行为"));
jsonObject.put("执法次数", resultSet.getInt("执法次数"));
return jsonObject;
}
};
}
use of org.springframework.jdbc.core.RowMapper in project topcom-cloud by 545314690.
the class RowMappers method tjsAccidentDeathnumberByTime.
public static RowMapper<JSONObject> tjsAccidentDeathnumberByTime() {
return new RowMapper<JSONObject>() {
@Override
public JSONObject mapRow(ResultSet resultSet, int i) throws SQLException {
JSONObject jsonObject = new JSONObject();
jsonObject.put("年", resultSet.getInt("年"));
jsonObject.put("月", resultSet.getInt("月"));
jsonObject.put("死亡人数", resultSet.getInt("死亡人数"));
jsonObject.put("事故起数", resultSet.getInt("事故起数"));
return jsonObject;
}
};
}
use of org.springframework.jdbc.core.RowMapper in project ma-core-public by infiniteautomation.
the class AbstractBasicDao method customizedQuery.
protected void customizedQuery(SelectJoinStep<Record> select, Condition condition, List<SortField<Object>> sort, Integer limit, Integer offset, MappedRowCallback<T> callback) {
SelectConnectByStep<Record> afterWhere = condition == null ? select : select.where(condition);
SelectLimitStep<Record> afterSort = sort == null ? afterWhere : afterWhere.orderBy(sort);
Select<Record> offsetStep = afterSort;
if (limit != null) {
if (offset != null) {
offsetStep = afterSort.limit(offset, limit);
} else {
offsetStep = afterSort.limit(limit);
}
}
String sql = offsetStep.getSQL();
List<Object> arguments = offsetStep.getBindValues();
Object[] argumentsArray = arguments.toArray(new Object[arguments.size()]);
LogStopWatch stopWatch = null;
if (useMetrics) {
stopWatch = new LogStopWatch();
}
// this.query(sql, argumentsArray, this.getRowMapper(), callback );
this.query(sql, argumentsArray, new ResultSetExtractor<Void>() {
@Override
public Void extractData(ResultSet rs) throws SQLException, DataAccessException {
RowMapper<T> rowMapper = getRowMapper();
int rowNum = 0;
while (rs.next()) {
try {
callback.row(rowMapper.mapRow(rs, rowNum), rowNum);
} catch (Exception e) {
if (e.getCause() instanceof ModuleNotLoadedException)
LOG.error(e.getCause().getMessage(), e.getCause());
else
LOG.error(e.getMessage(), e);
} finally {
rowNum++;
}
}
return null;
}
});
if (stopWatch != null) {
stopWatch.stop("customizedQuery(): " + this.create.renderInlined(offsetStep), metricsThreshold);
}
}
Aggregations