Commit 69d97c2c by shenjinzhu

修复显示没有模板的问题

parent 98119bd5
......@@ -75,13 +75,13 @@ public class MessageDaoImpl implements MessageDao {
if (con == null) {
return null;
}
System.out.println(pt);
DBCursor cursor = con.find(new BasicDBObject("pt", pt).append("handle", false))
.skip((pageNo - 1) * pageSize).limit(pageSize).sort(new BasicDBObject("createDate", -1));
while (cursor.hasNext()) {
Map<String, Object> map = (Map<String, Object>) cursor.next();
Message msg = Change.toBean(Message.class, map);
msg.setMessageId(String.valueOf(map.get("_id")));
msg.setTempName(String.valueOf(map.get("tempName")));
msgList.add(msg);
}
return msgList;
......@@ -107,14 +107,10 @@ public class MessageDaoImpl implements MessageDao {
Map<String, Object> map = (Map<String, Object>) cursor.next();
Message msg = Change.toBean(Message.class, map);
msg.setMessageId(String.valueOf(map.get("_id")));
msg.setTempName(String.valueOf(map.get("tempName")));
msgList.add(msg);
}
return msgList;
//
// return
// mongo.find(Query.query(Criteria.where("templateName").regex(templateName)).skip((pageNo
// - 1) * pageSize)
// .limit(pageSize), Message.class);
}
@Override
......@@ -163,7 +159,7 @@ public class MessageDaoImpl implements MessageDao {
if (con == null) {
return 0;
}
return (int) con.count(new BasicDBObject("templateName", new BasicDBObject("$regex", templateName)).append("pt",pt ));
return (int) con.count(new BasicDBObject("tempName", new BasicDBObject("$regex", templateName)).append("pt",pt ));
// return (int)
// mongo.count(Query.query(Criteria.where("templateName").regex(templateName)),
// Message.class);
......@@ -193,7 +189,7 @@ public class MessageDaoImpl implements MessageDao {
return msgList;
} else {
DBCursor cur = con
.find(new BasicDBObject("handle", handle).append("templateName",
.find(new BasicDBObject("handle", handle).append("tempName",
new BasicDBObject("$regex", tempName)).append("pt",pt))
.sort(new BasicDBObject("createDate", -1)).skip((pageNo - 1) * pageSize).limit(pageSize);
while (cur.hasNext()) {
......@@ -222,7 +218,7 @@ public class MessageDaoImpl implements MessageDao {
return (int) con.count(new BasicDBObject("handle", handle).append("pt",pt));
} else {
return (int) con.count(new BasicDBObject("handle", handle)
.append("templateName", new BasicDBObject("$regex",tempName)).append("pt",pt));
.append("tempName", new BasicDBObject("$regex",tempName)).append("pt",pt));
}
}
}
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