zoukankan      html  css  js  c++  java
  • struts+hibernate+oracle+easyui实现lazyout组件的简单案例——Action的实现类

      主要的业务操作都在这个struts的Action里面,大家来看看:

     /**  
    * @Title: EmpAction.java
    * @Package org.web
    * @Description: TODO该方法的主要作用:
    * @author A18ccms A18ccms_gmail_com  
    * @date 2017-4-19 下午8:37:00
    * @version V1.0  
    */
    package org.web;
    
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;
    
    import org.dao.IDeptDao;
    import org.dao.IEmpDao;
    import org.dao.impl.DeptDaoImpl;
    import org.dao.impl.EmpDaoImpl;
    import org.entity.Dept;
    import org.entity.Emp;
    import org.entity.EmpCondition;
    import org.util.pageUtil;
    
    import com.opensymphony.xwork2.ActionSupport;
    
     /**   
     *    
     * 项目名称:struts_easyui   
     * 类名称:EmpAction   
     * 类描述:   
     * 创建人:Mu Xiongxiong  
     * 创建时间:2017-4-19 下午8:37:00   
     * 修改人:Mu Xiongxiong   
     * 修改时间:2017-4-19 下午8:37:00   
     * 修改备注:   
     * @version    
     *    
     */
    public class EmpAction extends ActionSupport {
    	
    	private List<Map> deptJson;
    	private Map<String,Object> empJson;
    	
    	private EmpCondition cond;
    	private int rows;           //页大小
    	private int page;           //当前页
    	
    	IDeptDao deptDao = new DeptDaoImpl();
    	IEmpDao  empDao  = new EmpDaoImpl();
    	
    	/**
    	 * 
    	* @Title: getallDept
    	* @Description: 该方法的主要作用:查询所有的部门
    	* @param  @return 设定文件  
    	* @return  返回类型:String   
    	* @throws
    	 */
    	public String getallDept(){
    		//添加根节点
    		Map<String,Object> rootMap=new HashMap<String, Object>();
    		rootMap.put("id",0);
    		rootMap.put("text","部门");
    		List<Dept> deptList=deptDao.getAllDept();
    		List<Map> deptMapList=new ArrayList<Map>();
    		//将部门列表数据转换为treejson需要的数据格式
    		for (Dept dept : deptList) {
    			Map<String,String> deptMap=new HashMap<String, String>();
    			deptMap.put("id",dept.getDeptno().toString());
    			deptMap.put("text",dept.getDname());
    			deptMapList.add(deptMap);
    		}
    		rootMap.put("children", deptMapList);
    		deptJson=new ArrayList<Map>();
    		deptJson.add(rootMap);
    		return SUCCESS;
    	}
    
    	/**
    	 * 
    	* @Title: getEmp
    	* @Description: 该方法的主要作用:分页动态查询员工信息
    	* @param  @return 设定文件  
    	* @return  返回类型:String   
    	* @throws
    	 */
    	public String getEmp(){
    		empJson=new HashMap<String, Object>();
    		pageUtil<Emp> pageUtil=empDao.getEmpByPage(page,rows, cond);
    		empJson.put("total", pageUtil.getTotalCount());
    		empJson.put("rows",pageUtil.getList());
    		
    		return SUCCESS;
    	}
    	
    	public List<Map> getDeptJson() {
    		return deptJson;
    	}
    
    	public void setDeptJson(List<Map> deptJson) {
    		this.deptJson = deptJson;
    	}
    
    
    
    	public EmpCondition getCond() {
    		return cond;
    	}
    
    
    
    	public void setCond(EmpCondition cond) {
    		this.cond = cond;
    	}
    
    	public int getRows() {
    		return rows;
    	}
    
    	public void setRows(int rows) {
    		this.rows = rows;
    	}
    
    	public int getPage() {
    		return page;
    	}
    
    	public void setPage(int page) {
    		this.page = page;
    	}
    
    	public Map<String, Object> getEmpJson() {
    		return empJson;
    	}
    
    	public void setEmpJson(Map<String, Object> empJson) {
    		this.empJson = empJson;
    	}
    	
    	
    	
    
    }
    


  • 相关阅读:
    检测c/c++中内存泄露
    在一个集合S中寻找最大的C使A+B=C且A,B,C均在集合当中
    《为学》
    U盘windows无法格式化的解决办法
    java.lang.AbstractMethodError: oracle.jdbc.driver...解决方法
    sqlplus连接远程Oracle
    oracle字符集导致的乱码问题
    大端与小端存储模式详解
    《劝学》原文
    《报任安书》司马迁
  • 原文地址:https://www.cnblogs.com/a1111/p/7459724.html
Copyright © 2011-2022 走看看