点击回首页
我的浏览记录 | | 帮助?
当前位置:

源码截图

源码目录树

当前路径:src/com/struts/dao/IndexDao.java     package com.struts.dao;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.stereotype.Component;

import com.form.LoginForm;
import com.hibernate.AdminsEntity;
import com.hibernate.PlanEntity;
import com.hibernate.ResourceEntity;
import com.hibernate.RoomsEntity;
import com.hibernate.RoomsResourceEntity;
import com.struts.util.DateUtil;

@Component("indexDao")
public class IndexDao extends HibernateDaoSupport {



	/**
	 * 登录
	 * 
	 * @param request
	 * @return
	 */
	public LoginForm login(HttpServletRequest request) {
		String hql = null;
		LoginForm lf = new LoginForm();
		
		hql = "from AdminsEntity where loginname = '"
			+ request.getParameter("username") + "' and password = '"
			+ request.getParameter("password")+"'";
		
		List list = this.getHibernateTemplate().find(hql);
		if (list != null && list.size() == 1){
			AdminsEntity ue = (AdminsEntity)list.get(0);
			
			lf.setId(ue.getId().toString());
			lf.setLoginname(ue.getLoginname());
			lf.setUsername(ue.getUsername());
			
			return lf;
		}
		else
			return null;
			
		
	}
 
	/**
	 * 管理员管理:修改信息后保存到数据库
	 * @param request
	 * @return
	 */
	public String adminsAdd(HttpServletRequest request) {
		try {

			AdminsEntity aa = new AdminsEntity();
			
			DateUtil du = new DateUtil();
			
			aa.setUsername(getNotNull(request.getParameter("username")));
			aa.setLoginname(getNotNull(request.getParameter("loginname")));
			
			aa.setPassword(getNotNull(request.getParameter("password")));
			aa.setTel(getNotNull(request.getParameter("tel")));
			aa.setEmail(getNotNull(request.getParameter("email")));
			aa.setInputTime(du.getDate());

			this.getHibernateTemplate().save(aa);
			return "true";
		} catch (Exception e) {
			e.printStackTrace();
			return "false";
		}
	}
	
	/**
	 * 管理员管理:查看信息
	 * @param request
	 * @return
	 */
	public List adminsList(HttpServletRequest request) {
		
		String hql = null;
		LoginForm lf = (LoginForm)request.getSession().getAttribute("loginmessage");

		hql = "from AdminsEntity";
		

		return this.getHibernateTemplate().find(hql);
	}
	
	
	/**
	 * 管理员管理:查看单个信息
	 * 
	 * @param id
	 * @return
	 */
	public AdminsEntity adminsShow(HttpServletRequest request) {
		return (AdminsEntity) this.getHibernateTemplate().get(
				AdminsEntity.class, Long.valueOf(request.getParameter("id")));
	}
	
	/**
	 * 管理员管理:修改信息后保存到数据库
	 * @param request
	 * @return
	 */
	public String adminsUpdDB(HttpServletRequest request) {
		try {

			AdminsEntity aa = this.getHibernateTemplate().get(
					AdminsEntity.class, Long.valueOf(request.getParameter("id")));
			
			DateUtil du = new DateUtil();
			
			aa.setUsername(getNotNull(request.getParameter("username")));
			aa.setLoginname(getNotNull(request.getParameter("loginname")));
			
		...
完整源码文件,请先购买后再查看
关于我们 | 顾问团队 | 发展历程 | 联系我们 | 源码上传
联系电话(Tel):4008-010-151(免长途)
地址:北京市海淀区大恒科技大厦五层 邮编:100080
Floor 5th,Daheng Building,Zhongguancun,Beijing,China,100080
51Aspx.com 版权所有 CopyRight © 2006-2022. 京ICP备09089570号 | 京公网安备11010702000869号