首页>代码>SSH+JSP 图书管理系统>/src/com/lhq/prj/bms/action/DutyAction.java
package com.lhq.prj.bms.action;

import com.lhq.prj.bms.core.BaseAction;
import com.lhq.prj.bms.core.MyUtils;
import com.lhq.prj.bms.core.Page;
import com.lhq.prj.bms.po.Duty;
import com.lhq.prj.bms.service.IDutyService;

/**
 * DutyAction.java Create on 2008-9-18 下午08:10:48
 * 
 * 职务管理
 * 
 * Copyright (c) 2008 by MTA.
 * 
 * @author 廖瀚卿
 * @version 1.0
 */
@SuppressWarnings("serial")
public class DutyAction extends BaseAction {

	private IDutyService dutyService;

	private Duty duty;

	private Integer dutyId;

	private boolean success;

	private Page page;
	
	
	/**
	 * 保存职务到数据库
	 *
	 * @return
	 */
	public String saveDuty() {
		dutyId = (Integer) dutyService.saveDuty(duty);
		if (dutyId != null) {
			success = true;
		}
		return SUCCESS;
	}
	
	
	/**
	 * 查找所有职务
	 * 
	 * @return
	 */
	public String findAllDuty(){
		page = new Page();
		page.setRoot(dutyService.findAll());
		return SUCCESS;
	}


	/**
	 * 删除职务
	 * 
	 * @return
	 */
	public String deleteDuty() {
		String strDutyId = getRequest().getParameter("dutyId");
		if (strDutyId != null && !"".equals(strDutyId)) {
			success = dutyService.deleteDuty(Integer.valueOf(strDutyId));
		}
		return SUCCESS;
	}

	/**
	 * 修改职务指定字段的值
	 * 
	 * @return
	 * @throws Exception
	 */
	public String updateDuty() throws Exception {
		String fieldName = getRequest().getParameter("fieldName");
		String fieldValue = getRequest().getParameter("fieldValue");
		String strDutyId = getRequest().getParameter("dutyId");
		if (strDutyId != null && !"".equals(strDutyId)) {
			Duty c = new Duty();
			c.setDutyId(Integer.valueOf(strDutyId));
			MyUtils.invokeSetMethod(fieldName, c, new Object[] { fieldValue });
			success = dutyService.updateDuty(c);
		}
		return SUCCESS;
	}
	
	
	public Duty getDuty() {
		return duty;
	}

	public void setDuty(Duty duty) {
		this.duty = duty;
	}

	public Integer getDutyId() {
		return dutyId;
	}

	public void setDutyId(Integer dutyId) {
		this.dutyId = dutyId;
	}

	public Page getPage() {
		return page;
	}

	public void setPage(Page page) {
		this.page = page;
	}

	public boolean isSuccess() {
		return success;
	}

	public void setSuccess(boolean success) {
		this.success = success;
	}

	public void setDutyService(IDutyService dutyService) {
		this.dutyService = dutyService;
	}
}
最近下载更多
wxy1995  LV2 2023年4月27日
齐吊大神  LV6 2022年12月19日
ken8lee  LV3 2022年5月24日
郭海亮  LV1 2022年5月9日
孙有才  LV1 2022年5月3日
缪亦豪  LV1 2022年4月27日
微信网友_5934495911317504  LV1 2022年4月27日
qwertyuiopwyd  LV3 2022年3月29日
林祎凯马群耀  LV1 2021年12月2日
2209367302  LV1 2021年11月26日
最近浏览更多
wj3679  LV13 2月28日
jhyan127 2月18日
暂无贡献等级
duoduo1234  LV2 1月16日
1587039373  LV3 1月4日
微信网友_6050164023693312  LV2 2023年12月27日
17693282606  LV11 2023年12月20日
WBelong  LV7 2023年12月19日
吉吉jijiji  LV1 2023年12月9日
丝绸之路  LV1 2023年12月6日
15694996276  LV1 2023年11月21日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友