new Object[] { new Integer(id) }, new MessageRowMapper());
MsgMessage msgMessage = (MsgMessage) list.get(0);
return msgMessage;
}
public List getMsgMessages() {
List list = getJdbcTemplate().query("select * from msg_Message order by m_id desc ",
new MessageRowMapper());
return list;
}
/**
*
* @param kinds 信息类别
* @param curPage 当前页
* @param pageSize 每页记录数
* @return
*/
public List getMsgMessages(String sql,int startRow,int endRow) {
// System.out.println(sql);
StringBuffer pagingSelect = new StringBuffer( sql.length()+100 );
pagingSelect.append("select * from ( select row_.*, rownum rownum_ from ( ");
pagingSelect.append(sql);
pagingSelect.append(" ) row_ where rownum <= "+endRow+") where rownum_ >= "+startRow+"");
List list = getJdbcTemplate().query(pagingSelect.toString(), new MessageRowMapper());
return list;
}
/**
* 审核
* @param m_id
*/
publicvoid Auditing(String m_id){
String sql="update msg_message set m_state=1 where m_id in("+m_id+")";
getJdbcTemplate().update(sql);
}
/**
* 反审核
* @param m_id
*/
publicvoid UnAuditing(int m_id){
String sql="update msg_message set m_state=0 where m_id="+m_id;
getJdbcTemplate().update(sql);
}
publicint getState(int m_id){
Integer state =(Integer)getJdbcTemplate().queryForObject("select m_state from msg_message t where m_state=?",new Object[]{new Integer(m_id)},Integer.class);
return state.intValue();
}
/**
* 删除所选的记录
*/
publicvoid deleteMsgMessage(String ids) {
String sql = "delete from msg_Message where m_id in(" + ids + ")";
getJdbcTemplate().update(sql);
}
/**
* 所选记录移入回收站
* @param ids
*/
publicvoid moveToTrash(String ids) {
String sql = "update msg_Message set m_state=-1 where m_id in(" + ids + ")";
getJdbcTemplate().update(sql);
}
/**
* 得到要签收的信息
* @param u_id
* @return
*/
public List getMessagesSign(int u_id){
String sql="select * from msg_message where M_STATE=1 and m_Id in (select distinct(S_MSGID) from msg_sign_in where S_SIGNINDATE is null and s_userid="+u_id+")";
List list = getJdbcTemplate().query(sql, new MessageRowMapper());
return list;
}
/**
* 得到这条消息的所有签收用户的签收状态
* @param m_id
* @return
*/
public List getSignMessageByMsgId(String m_id){
String sql="select u_name ,s.* from msg_user u,(select i.s_userid,i.s_msgid,i.s_limitdate,trunc(i.s_signindate) as s_signindate,i.s_remark from msg_sign_in i where s_msgId=" + m_id + ") s where s.s_userid=u.u_id";
List list = getJdbcTemplate().queryForList(sql);
return list;
}
publicvoid deleteHisMessage(String ids) {
String sql = "delete from msg_message_His where m_id in(" + ids + ")";