查看资讯回复

public String getReplyMy() throws Exception{
Map<String, Object> jsonMap = new HashMap<String, Object>();
String params = request().getParameter("data");
String userId=CJSON.getUserId(params);
long pageNum=Convert.strToLong(CJSON.getData(params,"pageNum"), 1);
try {
List<Map<String, Object>> replyMyList= appMessageService.getReplyMy(userId,pageNum);
//查看资讯回复
List<Map<String, Object>> replyMyConsultList= appMessageService.getReplyMyConsult(userId,pageNum);
jsonMap.put("replyMyConsultList", replyMyConsultList);
jsonMap.put("replyMyList", replyMyList);
jsonMap.put("code","-1");
jsonMap.put("msg","查询成功");
CJSON.printObject(true, jsonMap);
} catch (Exception e) {
e.printStackTrace();
jsonMap.put("code", "0");
jsonMap.put("msg", "未知异常");
JSONUtils.printObject(CJSON.setRetData(false, jsonMap));
log.error(e);
}
return null;

}

//service

public List<Map<String, Object>> getReplyMyConsult(String userId, long pageNum) throws SQLException, DataException {
List<Map<String, Object>>list = null;
Connection conn = null;
try {
conn = MySQL.getConnection();
list = appMessageDao.getReplyMyConsult(conn, userId, pageNum);
} catch (SQLException e) {
conn.rollback();
log.error(e);
e.printStackTrace();
throw e;
}finally{
if(conn != null){
conn.close();
}
}
return list;
}

//dao

public List<Map<String, Object>> getReplyMyConsult(Connection conn, String userId, long pageNum) throws SQLException, DataException {
StringBuffer sql = new StringBuffer();
sql.append("select reply.id,mr.msg as message ,date_format(mr.create_time,'%m-%d %H:%i') as create_time,admin.nickName,admin.img as imgUrl ");
sql.append(" from xyd_p_reply reply ");
sql.append(" LEFT JOIN xyd_information mm on reply.preemption_id=mm.id ");
sql.append(" LEFT JOIN xyd_p_reply mr on mr.parentId=reply.id ");
sql.append(" LEFT JOIN t_admin ad on reply.creator=ad.id ");
sql.append(" LEFT JOIN t_admin admin on mr.creator=admin.id ");
sql.append("where mr.parentId in (select id from xyd_p_reply where creator='"+userId+"')");
// sql.append(" LIMIT " + (pageNum-1) * IConstant.STAR_MESSAGE_LIMIT_NUM + "," + IConstant.STAR_MESSAGE_LIMIT_NUM);
DataSet dataSet = MySQL.executeQuery(conn, sql.toString());
dataSet.tables.get(0).rows.genRowsMap();
return dataSet.tables.get(0).rows.rowsMap;
}

//struts2别忘了配XML。注意拦截方法

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值