Commit 5cda20ae authored by xinglei's avatar xinglei

*)修改统计bug

parent 9e37e9c1
......@@ -19,6 +19,8 @@ import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import org.apache.commons.lang.text.StrSubstitutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
......@@ -32,6 +34,8 @@ import java.util.*;
@Service
public class InspectionServiceImpl implements InspectionService {
private final Logger log = LoggerFactory.getLogger(InspectionServiceImpl.class);
@Autowired
JdbcTemplate jdbcTemplate;
......@@ -116,8 +120,9 @@ public class InspectionServiceImpl implements InspectionService {
selectSql = selectSql + (selectSql.contains("WHERE") ? " AND" : " WHERE") + " ${fieldKey}='${fieldValue}'";
}
selectSql = ss.replace(selectSql);
Map<String, Object> queryResult = bizJdbcTemplate.queryForMap(selectSql);
Map<String, Object> queryResult = bizJdbcTemplate.queryForMap(selectSql);
log.info("查询sql:" + selectSql);
HashMap<String, Object> item = new HashMap<>();
item.put("key", bizRecordCount.getTitle());
item.put("value", queryResult.get("count"));
......@@ -209,7 +214,7 @@ public class InspectionServiceImpl implements InspectionService {
for (int i = 1; i <= item.getColumnIndex(); i++) {
whereSql.add(String.format("%s%s='%s'", item.getColumnPrefix(), i, item.getColumnValue()));
}
sql = ValidationUtil.isEmpty(sql) ? "" : "+" + String.format("(SELECT count(*) FROM %s WHERE %s)", item.getTableName(), whereSql);
sql = sql + ((ValidationUtil.isEmpty(sql) ? "" : "+") + String.format("(SELECT count(*) FROM %s WHERE %s)", item.getTableName(), whereSql));
}
return sql;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment