package edu.zzuli.model.xt.pzzc.gnsq;
import java.io.Serializable;
import java.util.Map;
import javax.annotation.Resource;
import org.apache.struts2.ServletActionContext;
import org.springframework.stereotype.Controller;
import edu.zzuli.common.Constants_core;
import edu.zzuli.common.MyVisit;
import edu.zzuli.model.orm.po.GG_CZLB;
import edu.zzuli.model.xt.pzzc.gnsq.iface.GnsqService;
/**
* @author tianshaojie
* @date 2011-1-16
* @discription :
*/
@SuppressWarnings("serial")
@Controller
public class AddorModGG_CZLBAction implements Serializable{
@Resource
GnsqService gnsqService;
private GG_CZLB gg_czlb;
private String ajaxResult;
private Map roletype;
public String execute() {
try {
if (gg_czlb.getId() == null || "".equals(gg_czlb.getId())) {
MyVisit myVisit = (MyVisit) ServletActionContext. getRequest().getSession().getAttribute("myVisit");
gg_czlb.setJgbh(myVisit.getGG_JGBH().getJgbh());
}
gnsqService.saveOrUpdatePO(gg_czlb);
this.setGg_czlb(gg_czlb);
ajaxResult = "success";
} catch (Exception e) {
ajaxResult = "error";
}
return ajaxResult;
}
public String add() {
try {
gnsqService.saveOrUpdatePO(gg_czlb);
ajaxResult = "success";
} catch (Exception e) {
ajaxResult = "error";
}
return ajaxResult;
}
public String addOrModPage() {
String lbid = ServletActionContext.getRequest().getParameter("id");
if (lbid != null && !"".equals(lbid)) {
gg_czlb = (GG_CZLB) gnsqService.selectSinglePO(new GG_CZLB(lbid));
ServletActionContext.getRequest().setAttribute("gg_czlb", gg_czlb);
} else {
ServletActionContext.getRequest().setAttribute("gg_czlb", new GG_CZLB());
}
return "success";
}
public void setGg_czlb(GG_CZLB gg_czlb) {
this.gg_czlb = gg_czlb;
}
public GG_CZLB getGg_czlb() {
return gg_czlb;
}
public void setRoletype(Map roletype) {
this.roletype = roletype;
}
public Map getRoletype() {
this.roletype = Constants_core.MAP_JGSF;
return this.roletype;
}
public void setAjaxResult(String ajaxResult) {
this.ajaxResult = ajaxResult;
}
public String getAjaxResult() {
return ajaxResult;
}
}