DAO:
public List<Object[]> findbyContSQL()
{
String sql="SELECT count(*),count(case nationality when 'CN' then id end) as countCN,"
+" count(case nationality when 'CN' then case substring(cardno,0,3) when '110' then id end end) as countBeiJing,"
+" count(case nationality when 'CN' then case substring(cardno,0,3) when '110' then null else id end end) as countWaiSheng,"
+" count(case nationality when 'CN' then null else id end) as countJingwai"
+" FROM dbo.ES_USER";
return getSession().createSQLQuery(sql).list();
}
SERVICE:
public List<Object[]> findbyContSQL()
{
return esUserDao.findbyContSQL();
}
ACTION:
protected static final String JOB_SHOW="/WEB-INF/pages/es/EsUser/psShow.jsp";
public String jobTable(){
try {
List<Object[]> cont=esUserManager.findbyContSQL();
getRequest().setAttribute("obj", obj);
} catch (Exception e) {
e.printStackTrace();
}
return JOB_SHOW;
}
JSP:
<td rowspan=2 height=38 class=xl6523224 style='border-bottom:1.0pt solid black;
height:28.5pt;border-top:none'>${obj[0]}</td>