📄 votedaoim.java
字号:
package com.yhbbs.vote.dao;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.yhbbs.data.AppSqlMap;
import com.yhbbs.vote.itface.Vote;
import com.yhbbs.vote.itface.VoteDao;
import com.yhbbs.vote.itface.VoteUser;
/**
* <p>Title:论坛投票数据存取模块Bean</p>
* <li> 论坛投票数据存取模块
* <br><b>WebSite: www.yyhweb.com</b>
* <br><b>CopyRight: yhbbs[永恒论坛]</b>
* @author stephen
* @version YH-1.0
*/
public class VoteDaoIm implements VoteDao {
private SqlMapClient sqlMapClient;
/**
* Constructor method
*/
public VoteDaoIm(){
sqlMapClient = AppSqlMap.getInstance();
}
private static VoteDao votedao = new VoteDaoIm();
/**
* @return get the instance of VoteDaoIm
*/
public static VoteDao getInstance(){
return votedao;
}
private int getInt(Object ob){
if(ob!=null)
return Integer.parseInt(ob.toString());
else
return 0;
}
public int getVoteMaxId() throws SQLException{
return getInt(sqlMapClient.queryForObject("getMaxId",null));
}
public int getVUserMaxId() throws SQLException{
return getInt(sqlMapClient.queryForObject("getUserMaxId",null));
}
public List getVote(int artId) throws SQLException {
return (List)sqlMapClient.queryForList("getVote",artId);
}
public List getVoteUser(HashMap idMap) throws SQLException {
return (List)sqlMapClient.queryForList("getVoteUser",idMap);
}
public void addVote(Vote vote) throws SQLException {
sqlMapClient.insert("addVote",vote);
}
public void addVoteUser(VoteUser voteuser) throws SQLException {
sqlMapClient.insert("addVoteUser",voteuser);
}
public boolean isUserVoted(HashMap userartid) throws SQLException {
return getInt(sqlMapClient.queryForObject("isUserVoted",userartid))>0;
}
public void deleteVote(int artId) throws SQLException {
sqlMapClient.delete("deleteVote",artId);
}
public void deleteVoteUser(int artId) throws SQLException {
sqlMapClient.delete("delVoteUser",artId);
}
public void postVote(int id) throws SQLException {
sqlMapClient.update("postVote",id);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -