📄 engagemajorreleaseaction.java
字号:
package org.better.hr.web.action;
import java.util.HashMap;
import java.util.List;
import org.better.hr.comm.CopyBean;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.better.hr.biz.ConfigFileFirstKindBiz;
import org.better.hr.biz.ConfigFileSecondKindBiz;
import org.better.hr.biz.ConfigFileThirdKindBiz;
import org.better.hr.biz.ConfigMajorBiz;
import org.better.hr.biz.ConfigMajorKindBiz;
import org.better.hr.biz.ConfigPublicCharBiz;
import org.better.hr.biz.EngageMajorReleaseBiz;
import org.better.hr.entity.EngageMajorRelease;
import org.better.hr.exception.HrException;
import org.better.hr.web.form.EngageMajorReleaseForm;
public class EngageMajorReleaseAction extends BasicAction {
private EngageMajorReleaseBiz engagemajorreleaseBiz;
private ConfigFileFirstKindBiz configfilefirstkindBiz;
private ConfigFileSecondKindBiz configfilesecondkindBiz;
private ConfigFileThirdKindBiz configfilethirdkindBiz;
private ConfigMajorKindBiz configmajorkindBiz;
private ConfigMajorBiz configmajorBiz;
private ConfigPublicCharBiz configpubliccharBiz;
public ConfigPublicCharBiz getConfigpubliccharBiz() {
return configpubliccharBiz;
}
public void setConfigpubliccharBiz(ConfigPublicCharBiz configpubliccharBiz) {
this.configpubliccharBiz = configpubliccharBiz;
}
public ConfigFileSecondKindBiz getConfigfilesecondkindBiz() {
return configfilesecondkindBiz;
}
public void setConfigfilesecondkindBiz(
ConfigFileSecondKindBiz configfilesecondkindBiz) {
this.configfilesecondkindBiz = configfilesecondkindBiz;
}
public ConfigFileThirdKindBiz getConfigfilethirdkindBiz() {
return configfilethirdkindBiz;
}
public void setConfigfilethirdkindBiz(
ConfigFileThirdKindBiz configfilethirdkindBiz) {
this.configfilethirdkindBiz = configfilethirdkindBiz;
}
public ConfigMajorBiz getConfigmajorBiz() {
return configmajorBiz;
}
public void setConfigmajorBiz(ConfigMajorBiz configmajorBiz) {
this.configmajorBiz = configmajorBiz;
}
public ConfigMajorKindBiz getConfigmajorkindBiz() {
return configmajorkindBiz;
}
public void setConfigmajorkindBiz(ConfigMajorKindBiz configmajorkindBiz) {
this.configmajorkindBiz = configmajorkindBiz;
}
public ConfigFileFirstKindBiz getConfigfilefirstkindBiz() {
return configfilefirstkindBiz;
}
public void setConfigfilefirstkindBiz(
ConfigFileFirstKindBiz configfilefirstkindBiz) {
this.configfilefirstkindBiz = configfilefirstkindBiz;
}
public EngageMajorReleaseBiz getEngagemajorreleaseBiz() {
return engagemajorreleaseBiz;
}
public void setEngagemajorreleaseBiz(EngageMajorReleaseBiz engagemajorreleaseBiz) {
this.engagemajorreleaseBiz = engagemajorreleaseBiz;
}
/**
* 跳转到新增页面,需要把I级机构,II级机构,III级机构,机构名称,分类名称等各记录加载新增页面中的下拉列表框中
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
public ActionForward toAdd(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws HrException
{
/**
* 查询数据库,传入空对象,将得到所有记录,存入内置对象中供页面调用
*/
List list_firstkind = this.getConfigfilefirstkindBiz().list(null);
List list_secondkind = this.getConfigfilesecondkindBiz().list(null);
List list_thirdkind = this.getConfigfilethirdkindBiz().list(null);
List list_majorkind = this.getConfigmajorkindBiz().list(null);
List list_major = this.getConfigmajorBiz().list(null);
request.setAttribute("list_firstkind", list_firstkind);
request.setAttribute("list_secondkind", list_secondkind);
request.setAttribute("list_thirdkind", list_thirdkind);
request.setAttribute("list_majorkind", list_majorkind);
request.setAttribute("list_major", list_major);
return mapping.findForward("add");
}
/**
* 执行新增
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
public ActionForward doAdd(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws HrException
{
EngageMajorReleaseForm myForm = (EngageMajorReleaseForm)form;
EngageMajorRelease ee = myForm.getItem(); //得到所有存有表单值的实体 EngageMajorRelease
this.getEngagemajorreleaseBiz().add(ee);
return mapping.findForward("addsuccess");
}
/**
* 跳转到更新的页面(由“修改”超链调用),转到change页面
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
public ActionForward toUpdate(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws HrException
{
EngageMajorReleaseForm myForm = (EngageMajorReleaseForm)form;
short id = Short.valueOf(request.getParameter("id")); //得到所申请职位的编号
EngageMajorRelease emr_update = this.getEngagemajorreleaseBiz().getEMRbyID(id); //根据改编号得到该条职位
emr_update.setStr_deadline(emr_update.getDeadline().toString());//将日期值转换为字符串放入自定义的字符串变量Str_deadline中
myForm.setItem(emr_update); //并把该条职位存入内置对象中
return mapping.findForward("update");
}
/**
* 由发布职位查询列表中的"申请该职位"按钮调用,并转到query页面
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
public ActionForward toApply(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws HrException
{
EngageMajorReleaseForm myForm = (EngageMajorReleaseForm)form;
short id = Short.valueOf(request.getParameter("id")); //得到所申请职位的编号
EngageMajorRelease emr_update = this.getEngagemajorreleaseBiz().getEMRbyID(id); //根据改编号得到该条职位
myForm.setItem(emr_update); //并把该条职位存入form中
return mapping.findForward("apply");
}
/**
* 申请该职位,并转到简历登记页面
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws HrException
*/
public ActionForward doApply(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws HrException
{
short id = Short.valueOf(request.getParameter("id")); //得到所申请职位的编号
EngageMajorRelease emr_update = this.getEngagemajorreleaseBiz().getEMRbyID(id); //根据改编号得到该条职位
request.setAttribute("EngageMajorRelease", emr_update);
List list_majorkind = this.getConfigmajorkindBiz().list(null);
List list_major = this.getConfigmajorBiz().list(null);
HashMap map = this.getConfigpubliccharBiz().listForHumanFile(null);
request.setAttribute("list_majorkind", list_majorkind);
request.setAttribute("list_major", list_major);
request.setAttribute("map", map);
return mapping.findForward("do_apply");
}
/**
* 由左边超链"职位发布变更"调用,跳转到职位发布变更列表页面
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
public ActionForward toEdit(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws HrException
{
/**
* 将从数据库中得到的所有职位信息list 存入内置对象中,以便显示等待变更的职位列表
*/
List list_majorreleasechange = this.getEngagemajorreleaseBiz().list(null);
request.setAttribute("list", list_majorreleasechange);
return mapping.findForward("edit");
}
/**
* 执行更新,由"重新提交"按钮调用,转到修改成功页面
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
public ActionForward doEdit(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws HrException
{
EngageMajorReleaseForm myForm = (EngageMajorReleaseForm)form;
short id = Short.valueOf(request.getParameter("id")); //得到所申请职位的编号,参数为调用doEdit方法是传入
EngageMajorRelease condition = this.getEngagemajorreleaseBiz().getEMRbyID(id);//得到原来的对象
EngageMajorRelease emr = myForm.getItem(); //得到表单对象
try
{
CopyBean.copyProperties(condition, emr); //该方法将表单上需要修改的值重新存入原来的对象相应属性中,而其他值不变
}
catch(Exception ce){
ce.printStackTrace();
}
//condition.setHumanAmount(emr.getHumanAmount());
this.getEngagemajorreleaseBiz().update(condition); //更新该 EngageMajorRelease
return mapping.findForward("change_success");
}
/**
* 由等待变更的职位列表中的超链"删除"调用,跳转到删除确认页面
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
public ActionForward toDelete(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws HrException
{
/**
* 得到点击"删除"时传入的职位编号存入内置对象中,以便下个页面根据该编号删除职位
*/
short id = Short.valueOf(request.getParameter("id")); //得到所申请职位的编号
EngageMajorRelease emr = this.getEngagemajorreleaseBiz().getEMRbyID(id);
request.setAttribute("emr", emr);
return mapping.findForward("delete");
}
/**
* 执行删除
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
public ActionForward doDelete(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws HrException
{
/**
* 得到删除确认页面传入的职位编号,根据该编号执行删除功能,并跳转到删除成功页面
*/
short id = Short.valueOf(request.getParameter("id")); //得到所申请职位的编号
this.getEngagemajorreleaseBiz().delete(id);
return mapping.findForward("del_success");
}
/**
* 由左边超链"职位发布查询"调用,跳转到职位发布查询列表页面
* @param mapping
* @param form
* @param request
* @param messages
* @return
*/
public ActionForward list(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response)
throws HrException
{
/**
* 传入空值,得到所有所发布的职位list,存入request中,跳转到query_list页面以进行遍历
*/
List list_majorrelease = this.getEngagemajorreleaseBiz().list(null);
request.setAttribute("list", list_majorrelease);
return mapping.findForward("list");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -