标签:boolean 旅游 set nsa imp wordcount new nat 用户
Java小项目之:旅游网站前台功能:
1用户的注册和登录,
2旅游线路的报名(一人只能报一条线路);
3用户对每条旅游线路的评论。
4查询一个城市的所有线路
5查询单一的一条线路
后台管理功能:
1旅游线路的增删改查
2对用户评论的删除或回复
3删除查询用户
部分代码展示:
package biz;
import java.util.List;
import java.util.Set;
import org.hibernate.Transaction;
import util.HibernateUtil;
import dao.ManagerDAO;
import dao.ManagerDAOImpl;
import entity.Manage;
import entity.User;
import entity.Word;
public class ManagerBizImpl implements ManagerBiz {
private ManagerDAO manageDAO = new ManagerDAOImpl();
private final int PAGESIZE = 3;
public boolean queryManage(Manage manage) {
return manageDAO.queryManage(manage);
}
public boolean saveManage(Manage manage) {
Transaction ts = HibernateUtil.getCurrentSession().beginTransaction();
boolean b = manageDAO.saveManage(manage);
ts.commit();
return b;
}
public Set<User> queryAllUser(int page) {
Set<User> users = manageDAO.queryAllUser(page, PAGESIZE);
return users;
}
public int queryUserCount() {
int count = manageDAO.queryUserCount();
int totalPage = 0;
if(count % PAGESIZE == 0) {
totalPage = count / PAGESIZE;
} else {
totalPage = (count / PAGESIZE) + 1;
}
return totalPage;
}
public Set<User> queryUserByUsername(String username) {
return manageDAO.queryUserByUsername(username);
}
public boolean deleteUserByUsername(Integer id) {
Transaction ts = HibernateUtil.getCurrentSession().beginTransaction();
boolean b = manageDAO.deleteUserByUsername(id);
ts.commit();
return b;
}
public List<Word> getAllWords(int page) {
return manageDAO.queryAllWords(page, PAGESIZE);
}
public boolean updateWord(Integer id, String restore) {
Transaction ts = HibernateUtil.getCurrentSession().beginTransaction();
boolean b = manageDAO.updateWord(id, restore);
ts.commit();
return b;
}
public boolean deleteWordById(Integer id) {
Transaction ts = HibernateUtil.getCurrentSession().beginTransaction();
boolean b = manageDAO.deleteWordById(id);
ts.commit();
return b;
}
public Word queryWordById(Integer id) {
return manageDAO.queryWordById(id);
}
public int queryWordCount() {
int count = manageDAO.queryWordCount();
int totalPage = 0;
if(count % PAGESIZE == 0) {
totalPage = count / PAGESIZE;
} else {
totalPage = (count / PAGESIZE) + 1;
}
return totalPage;
}
}
喜欢这样文章的可以关注我,我会持续更新,你们的关注是我更新的动力!需要更多java学习资料的也可以私信我!
祝关注我的人都:身体健康,财源广进,福如东海,寿比南山,早生贵子,从不掉发!
标签:boolean 旅游 set nsa imp wordcount new nat 用户
原文地址:https://blog.51cto.com/14623707/2470563