use of com.zyf.bean.Info in project HeartWatchdogJsp by Viczyf.
the class InfoServlet method selectInfo.
public void selectInfo(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
InfoDao infodao = new InfoDao();
HttpSession session = request.getSession();
// 获取用户对象
User user = (User) session.getAttribute("user");
int id = user.getUid();
List infoList = infodao.queryInfo(id);
// request.setAttribute("infoList", infoList);
JsonArray array = new JsonArray();
for (int i = 0; i < infoList.size(); i++) {
Info single = (Info) infoList.get(i);
JsonObject ob = new JsonObject();
ob.addProperty("id", i + 1);
ob.addProperty("date", single.getDate());
ob.addProperty("read", "<a href=\"InfoServlet?action=single&id=" + single.getId() + " \"target=\"_blank\">查看记录</a>");
ob.addProperty("read1", "<a href=\"InfoServlet?action=singlepot&id=" + single.getId() + " \"target=\"_blank\">查看记录</a>");
ob.addProperty("del", "<a href=\"InfoServlet?action=delete&id=" + single.getId() + "\">删除记录</a>");
array.add(ob);
}
PrintWriter out = response.getWriter();
out.print(array);
System.out.println(array);
// RequestDispatcher rd = request.getRequestDispatcher("infolist.jsp");
// request.setAttribute("listjson", array);
// rd.forward(request, response);
}
use of com.zyf.bean.Info in project HeartWatchdogJsp by Viczyf.
the class InfoServlet method singlepotInfo.
public void singlepotInfo(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
InfoDao infodao = new InfoDao();
int id = MyTools.strToint(request.getParameter("id"));
HttpSession session = request.getSession();
// 获取用户对象
User user = (User) session.getAttribute("user");
int uid = user.getUid();
Info infosingle = infodao.queryInfoSingle(id, uid);
request.setAttribute("infosingle", infosingle);
RequestDispatcher rd = request.getRequestDispatcher("infosinglepot.jsp");
rd.forward(request, response);
}
use of com.zyf.bean.Info in project HeartWatchdogJsp by Viczyf.
the class RelaServlet method selectInfo.
public void selectInfo(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
InfoDao infodao = new InfoDao();
HttpSession session = request.getSession();
// 获取用户对象
User user = (User) session.getAttribute("user");
int uid = user.getUid();
int reid = MyTools.strToint(request.getParameter("para"));
List relainfolist = infodao.queryRelaInfo(uid, reid);
// request.setAttribute("relainfolist", relainfolist);
JsonArray array = new JsonArray();
for (int i = 0; i < relainfolist.size(); i++) {
Info single = (Info) relainfolist.get(i);
JsonObject ob = new JsonObject();
ob.addProperty("id", i + 1);
ob.addProperty("date", single.getDate());
ob.addProperty("read", "<a href=\"RelaServlet?action=RelaInfoSingle¶=" + single.getId() + "¶1=" + reid + " \"target=\"_blank\">查看记录</a>");
array.add(ob);
}
PrintWriter out = response.getWriter();
out.print(array);
System.out.println(array);
}
use of com.zyf.bean.Info in project HeartWatchdogJsp by Viczyf.
the class InfoDao method queryRelaInfo.
public List queryRelaInfo(int uid, int reid) {
String sql = "";
sql = "select * from info where uid=" + reid + " and uid in (select reid from userrela where uid=" + uid + " and status=1) union select * from info where uid=" + reid + " and uid in (select uid from userrela where reid=" + uid + " and status=1) order by id desc";
ArrayList list = null;
Info info = null;
ResultSet rs = this.connection.executeQuery(sql);
if (rs != null) {
list = new ArrayList();
try {
while (rs.next()) {
info = new Info();
info.setId(rs.getInt(1));
info.setUid(rs.getInt(2));
info.setDate(rs.getString(3));
info.setXinlv(rs.getInt(4));
info.setXdgs(rs.getInt(5));
info.setCon1(rs.getString(6));
info.setSxxdgs(rs.getInt(7));
info.setCon2(rs.getString(8));
info.setXdgh(rs.getInt(9));
info.setCon3(rs.getString(10));
info.setFxyb(rs.getInt(11));
info.setCon4(rs.getString(12));
info.setSxyb(rs.getInt(13));
info.setCon5(rs.getString(14));
info.setXlbq(rs.getInt(15));
info.setCon6(rs.getString(16));
info.setSxzb(rs.getInt(17));
info.setCon7(rs.getString(18));
info.setFxzb(rs.getInt(19));
info.setCon8(rs.getString(20));
info.setJjxzb(rs.getInt(21));
info.setCon9(rs.getString(22));
info.setFc(rs.getInt(23));
info.setCon10(rs.getString(24));
info.setData(rs.getString(25));
info.setPr(rs.getInt(26));
info.setQrs(rs.getInt(27));
info.setQt(rs.getInt(28));
info.setQtc(rs.getInt(29));
info.setP(rs.getInt(30));
info.setPlist(rs.getString(31));
info.setQlist(rs.getString(32));
info.setRlist(rs.getString(33));
info.setSlist(rs.getString(34));
info.setTlist(rs.getString(35));
list.add(info);
}
} catch (SQLException e) {
e.printStackTrace();
}
}
return list;
}
use of com.zyf.bean.Info in project HeartWatchdogJsp by Viczyf.
the class InfoDao method queryInfo.
public List queryInfo(int uid) {
String sql = "";
sql = "select * from info where uid='" + uid + "' order by id desc";
ArrayList list = null;
Info info = null;
ResultSet rs = this.connection.executeQuery(sql);
if (rs != null) {
list = new ArrayList();
try {
while (rs.next()) {
info = new Info();
info.setId(rs.getInt(1));
info.setUid(rs.getInt(2));
info.setDate(rs.getString(3));
info.setXinlv(rs.getInt(4));
info.setXdgs(rs.getInt(5));
info.setCon1(rs.getString(6));
info.setSxxdgs(rs.getInt(7));
info.setCon2(rs.getString(8));
info.setXdgh(rs.getInt(9));
info.setCon3(rs.getString(10));
info.setFxyb(rs.getInt(11));
info.setCon4(rs.getString(12));
info.setSxyb(rs.getInt(13));
info.setCon5(rs.getString(14));
info.setXlbq(rs.getInt(15));
info.setCon6(rs.getString(16));
info.setSxzb(rs.getInt(17));
info.setCon7(rs.getString(18));
info.setFxzb(rs.getInt(19));
info.setCon8(rs.getString(20));
info.setJjxzb(rs.getInt(21));
info.setCon9(rs.getString(22));
info.setFc(rs.getInt(23));
info.setCon10(rs.getString(24));
info.setData(rs.getString(25));
info.setPr(rs.getInt(26));
info.setQrs(rs.getInt(27));
info.setQt(rs.getInt(28));
info.setQtc(rs.getInt(29));
info.setP(rs.getInt(30));
info.setPlist(rs.getString(31));
info.setQlist(rs.getString(32));
info.setRlist(rs.getString(33));
info.setSlist(rs.getString(34));
info.setTlist(rs.getString(35));
list.add(info);
}
} catch (SQLException e) {
e.printStackTrace();
}
}
return list;
}
Aggregations