jeecgjava 发表于 2018-9-11 23:16:30

执行第二次的时候无法查询到数据,复制在数据库却有。

//获取当前用户id
TSUser user = ResourceUtil.getSessionUserName();
String uid = user.getId();

int pageSize = Integer.parseInt(request.getParameter("pageSize"));//单页数量
int page = Integer.parseInt(request.getParameter("page"));//页码
String type = request.getParameter("type");//会诊状态

Map<String, Object> map = new HashMap<>();

String sql= "SELECT h.id, h.huanzid, h.xingb, h.xingm, h.nianl, z.zhuyh, CONVERT(VARCHAR(10) ,z.chuyrq ,120) chuyrq," +
      " CONVERT(VARCHAR(10) ,z.ruyrq ,120) ruyrq, datediff(dd, z.ruyrq, z.chuyrq) tian," +
      " (CASE z.tianxrid WHEN '"+ uid +"' THEN 'true' ELSE 'false' END) isMine,"+
      " ISNULL(zd.zhendmc, '无') zhendmc, ISNULL(zd.bingzmc, '无') bingzmc, ISNULL(zd.fenq, '') fenq," +
      " ISNULL(( SELECT TOP 1 wb.id FROM t_b_weibrlxx AS wb WHERE z.zhuyh = wb.zhuyh ), '' ) weib, " +
      "ISNULL(( SELECT TOP 1 hl.id FROM t_b_hualxx AS hl WHERE z.zhuyh = hl.zhuyh ), '' ) hual, " +
      "ISNULL(( SELECT TOP 1 ss.id FROM t_b_shouszlxx AS ss WHERE z.zhuyh = ss.zhuyh ), '' ) shous, " +
      "ISNULL(( SELECT TOP 1 fl.id FROM t_b_fanglxx AS fl WHERE z.zhuyh = fl.zhuyh ), '' ) fangl, " +
      "ISNULL(( SELECT TOP 1 bx.id FROM t_b_baxzlxx AS bx WHERE z.zhuyh = bx.zhuyh ), '' ) bax, " +
      "ISNULL(( SELECT TOP 1 my.id FROM t_b_mianyzlxx AS my WHERE z.zhuyh = my.zhuyh ), '' ) miany, " +
      "ISNULL(( SELECT TOP 1 nfm.id FROM t_b_neifmzlxx AS nfm WHERE z.zhuyh = nfm.zhuyh ), '' ) neifm, " +
      "ISNULL(( SELECT TOP 1 rgz.id FROM t_b_regzrl AS rgz WHERE z.zhuyh = rgz.zhuyh ), '' ) regz, " +
      "ISNULL(( SELECT TOP 1 dp.id FROM t_b_dipcsrl AS dp WHERE z.zhuyh = dp.zhuyh ), '' ) dip, " +
      "ISNULL(( SELECT TOP 1 sb.id FROM t_b_shenbrl AS sb WHERE z.zhuyh = sb.zhuyh ), '' ) shenb, " +
      "ISNULL(( SELECT TOP 1 tt.tengtpf FROM t_b_pingfxx AS tt WHERE z.zhuyh = tt.zhuyh ORDER BY tt.pingfrq DESC ), '') tengt ," +
      "ISNULL(yy.id, '') yid, " +
      "ISNULL(huizhenyj, '') huizhenyj, " +
      "ISNULL(TIME, '') TIME, " +
      "ISNULL(yishenid, '') yishenid, " +
      "ISNULL(type, '') type, " +
      "ISNULL(huanzxxid, '') huanzxxid, " +
      "ISNULL(shenqingysid, '') shenqingysid " +
      "FROM t_b_huanzxx AS h LEFT JOIN t_b_zhuyjbxx z ON z.huanzid = h.huanzid " +
      "LEFT JOIN t_b_zhendxx zd ON h.huanzid = zd.huanzid LEFT JOIN t_b_yuanchenhuizhen yy ON yy.huanzxxid = h.id AND z.zhuyh = zd.zhuyhwhere yishenid='"+uid+"' and type='"+type+"'";
List<Map<String, Object>> list = new ArrayList<>();

    list = systemService.findForJdbcParam(sql, page, pageSize);
    map.put("list", list);//执行第二次的时候无法查询到数据,复制sql在数据库却有。那位大佬帮看看
}

return JSONObject.fromObject(map);
页: [1]
查看完整版本: 执行第二次的时候无法查询到数据,复制在数据库却有。