• 大小: 17.32MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-06-19
  • 语言: Java
  • 标签: ssh  源代码  增删改查  

资源简介

基于java ssh的基本的oa管理系统,包括简单详细的增删改查,可供初学者学习参考

资源截图

代码片段和文件信息

package com.workit.action;

import java.util.List;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;


import com.opensymphony.xwork2.ActionContext;
import com.workit.base.baseAction;
import com.workit.bean.Department;
import com.workit.util.DepartmentUtils;
@Controller
@Scope(“prototype“)
@SuppressWarnings(“serial“)
public class DepartmentAction extends baseAction{
private Long parentId; 
private Long id;
List departmentList  =null;
 /** 列表 */
 public String list() throws Exception {
 if(parentId == null){
   departmentList = departmentService.findTopList(); 
 }else{ 
  departmentList = departmentService.findChildren(parentId);
  Department parent = departmentService.getbyid(parentId);
  ActionContext.getContext().put(“parent“ parent);
 }
 ActionContext.getContext().put(“departmentList“ departmentList);
     return “list“;
 }

 /** 删除 */
 public String delete() throws Exception {
 departmentService.delete(model.getId());
  return “toList“;
 }

 /** 添加页面 */
 public String addUI() throws Exception {
List topList = departmentService.findTopList();
List departmentList = DepartmentUtils.getAllDepartments(topList);
ActionContext.getContext().put(“departmentList“ departmentList);
  return “saveUI“;
 }

 /** 添加 */
public String add() throws Exception {
// 封装信息到对象中
// Department department = new Department();
// department.setName(name);
// department.setDescription(description)
Department parent = departmentService.getbyid(parentId);

model.setParent(parent);
// 保存
departmentService.add(model);

return “toList“;
}

 /** 修改页面 */
 public String editUI() throws Exception {
// 准备数据 departmentList
List topList = departmentService.findTopList();
List departmentList = DepartmentUtils.getAllDepartments(topList);
ActionContext.getContext().put(“departmentList“ departmentList);

// 准备回显的数据
Department department = departmentService.getbyid(model.getId());
ActionContext.getContext().getValueStack().push(department);
if (department.getParent() != null) {
parentId = department.getParent().getId();
}
  return “saveUI“;
 }

 /** 修改 */
 public String edit() throws Exception {
 Department department = departmentService.getbyid(model.getId());
 
 department.setName(model.getName());
 department.setDescription(model.getDescription());
 department.setParent(departmentService.getbyid(parentId));
  return “toList“;
 }

public Long getParentId() {
return parentId;
}

public void setParentId(Long parentId) {
this.parentId = parentId;
}

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-11-17 09:57  itcastOA\
     文件        2351  2015-11-04 15:18  itcastOA\.classpath
     目录           0  2015-11-03 10:12  itcastOA\.myeclipse\
     文件         297  2015-11-12 17:33  itcastOA\.mymetadata
     文件        1281  2015-11-03 13:02  itcastOA\.project
     目录           0  2015-11-17 09:57  itcastOA\.settings\
     文件         330  2015-11-03 10:12  itcastOA\.settings\org.eclipse.jdt.core.prefs
     目录           0  2015-11-17 09:57  itcastOA\config\
     文件        5124  2015-11-09 14:18  itcastOA\config\.struts.mex
     文件        3064  2015-11-03 12:46  itcastOA\config\applicationContext.xml
     文件        1273  2015-11-04 15:11  itcastOA\config\hibernate.cfg.xml
     文件         152  2015-11-05 14:26  itcastOA\config\jdbc.properties
     文件         756  2015-11-03 11:41  itcastOA\config\log4j.properties
     文件        4048  2015-11-09 14:18  itcastOA\config\struts.xml
     目录           0  2015-11-03 11:36  itcastOA\src\
     目录           0  2015-11-03 10:13  itcastOA\src\com\
     目录           0  2015-11-04 16:43  itcastOA\src\com\workit\
     目录           0  2015-11-17 09:57  itcastOA\src\com\workit\action\
     文件        2982  2015-11-06 16:49  itcastOA\src\com\workit\action\DepartmentAction.java
     文件        1913  2015-11-09 11:38  itcastOA\src\com\workit\action\ForumAction.java
     文件        1785  2015-11-09 09:47  itcastOA\src\com\workit\action\ForumManageAction.java
     文件         644  2015-11-04 15:46  itcastOA\src\com\workit\action\HomeAction.java
     文件         338  2015-11-05 15:19  itcastOA\src\com\workit\action\PrivilegeAction.java
     文件        1497  2015-11-09 18:04  itcastOA\src\com\workit\action\ReplyAction.java
     文件        3022  2015-11-07 18:37  itcastOA\src\com\workit\action\RoleAction.java
     文件        1859  2015-11-09 14:17  itcastOA\src\com\workit\action\TopicAction.java
     文件        4849  2015-11-07 18:30  itcastOA\src\com\workit\action\UserAction.java
     目录           0  2015-11-17 09:57  itcastOA\src\com\workit\base\
     文件        2123  2015-11-09 10:35  itcastOA\src\com\workit\base\baseAction.java
     文件         716  2015-11-09 10:35  itcastOA\src\com\workit\base\DaoSupport.java
     文件        2867  2015-11-09 10:35  itcastOA\src\com\workit\base\DaoSupportImpl.java
............此处省略1424个文件信息

评论

共有 条评论