首页>代码>struts2.3+hibernate4.1+spring3.2+EasyUI1.36整合实现的java后台管理系统>/ADP/src/com/edianxun/adp/action/ManagerAction.java
                
                package com.edianxun.adp.action;
/**
 * @author lhr
 * @date 2014-4-30
 */
import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import com.edianxun.adp.pojo.Manager;
import com.edianxun.adp.service.ManagerService;
import com.opensymphony.xwork2.ModelDriven;
@Results({@Result(name="main",location="/jsp/main.jsp",type="redirect")})
public class ManagerAction extends BaseAction 
		implements ModelDriven<Manager>{
	
	private static final long serialVersionUID = -1040088992400395429L;
	private static final Logger logger = Logger.getLogger(ManagerAction.class);
	private Manager manager = new Manager();
	private ManagerService managerService;
	private String name;
	public void setManagerService(ManagerService managerService) {
		this.managerService = managerService;
	}
	public String execute(){
		logger.debug("bingo");
		return SUCCESS;
	}
	
	@Action("mgrlogin")
	public String login(){
		Map<String, Object> session = getSession();
		try {
			int managerId = managerService.loginValidate(manager);
			logger.debug("manager Id :" + managerId);
			if (managerId > 0) {
				session.put("managerId", managerId);
				session.put("manager", manager.getName());
			}else {
				return LOGIN;
			}
		} catch (Exception e) {
			logger.debug("manager login exception");
			e.printStackTrace();
		}
		return "main";
	}
	
	@Action("mgrlogout")
	public String logout(){
		logger.debug("logout");
		Map<String, Object> session = getSession();
		session.remove("managerId");
		session.remove("manager");
		return null;
	}
	
	@Action("mgrlist")
	public void list(){
		logger.debug("query all manager");
		try {
			this.outJson(managerService.managerList());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	@Action("mgradd")
	public void add(){
		try {
			manager.setStatus("NORMAL");
			int managerId = managerService.addManager(manager);
			logger.debug("managerId : " + managerId);
			if (managerId <= 0) {
				
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	@Action("mgrupdate")
	public void update(){
		logger.debug("manager update password ...");
		try {
			Map<String, Object> session = getSession();
			int id = (Integer) session.get("managerId");
			Manager man = managerService.getManager(id);
			man.setPassword(manager.getPassword());
			managerService.update(man);
			this.outJson(man.getPassword());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	@Action("mgrUpdateInfo")
	public void updateInfo(){
		logger.debug("manager update info ...");
		try {
			System.out.println("####" + manager.getDescrition());
			managerService.update(manager);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	
	@Action("mgrdel")
	public void del(){
		logger.debug("manager delete");
		try {
			managerService.del(manager.getManagerId());
			this.outJson("ok");
		} catch (Exception e) {
			e.printStackTrace();
			this.outJson("nok");
		}
	}
	
	@Override
	public Manager getModel() {
		return manager;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
}
 最近下载更多
最近下载更多
                
                微信网友_7588149564329984     LV2
                7月8日
            
            
        
                educationAAA     LV11
                2024年6月23日
            
            
        
                17787885952     LV3
                2022年5月5日
            
            
        
                wanglinddad     LV55
                2022年4月14日
            
            
        
                王燕燕     LV3
                2021年12月23日
            
            
        
                afei115     LV4
                2021年11月20日
            
            
        
                cailizhu833     LV2
                2021年8月17日
            
            
        
                Vera.Wu     LV2
                2021年5月29日
            
            
        
                and123456     LV11
                2021年4月20日
            
            
        
                admin_z     LV22
                2021年4月18日
            
            
         最近浏览更多
最近浏览更多
                
                jenkens     LV3
                9月23日
            
            
        
                liry_mbzj     LV1
                8月31日
            
            
        
                微信网友_7588149564329984     LV2
                7月8日
            
            
        
                飒飒说     LV1
                7月7日
            
            
        
                sjwc88     LV4
                2024年12月4日
            
            
        
                isssssss7    
                2024年10月13日
            
            
                    暂无贡献等级
            
        
                Alan rui     LV1
                2024年8月1日
            
            
        
                微信网友_7096619637297152    
                2024年7月26日
            
            
                    暂无贡献等级
            
        
                cccccc1235    
                2024年5月22日
            
            
                    暂无贡献等级
            
        
                ruo12138     LV1
                2024年5月2日
            
            
        
 
                 
                 
                