SSH—员工管理模块之添加员工.删除.修改

这篇博客探讨了在SSH框架中实现员工管理模块的功能,包括添加、删除和修改员工信息。文章提到员工与小组、小组与部门之间存在多对一的关系,并展示了如何在新增员工时处理这些关联。虽然删除和修改功能与之前会员管理类似,但重点在于展示如何在添加过程中处理部门和小组的持久层信息。
摘要由CSDN通过智能技术生成

我的员工管理界面中,员工和小组属于多对一关系,小组和到部门属于多对一关系,这几张表关联在一块。

emp:

/*
Navicat MySQL Data Transfer

Source Server         : localhost_3306
Source Server Version : 50515
Source Host           : localhost:3306
Source Database       : message

Target Server Type    : MYSQL
Target Server Version : 50515
File Encoding         : 65001

Date: 2017-06-15 17:38:40
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for `emp`
-- ----------------------------
DROP TABLE IF EXISTS `emp`;
CREATE TABLE `emp` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  `tid` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `tid` (`tid`),
  CONSTRAINT `tid` FOREIGN KEY (`tid`) REFERENCES `team` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=301004 DEFAULT CHARSET=utf8;

-- --------
ssh 框架整合的实例。 applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"> <bean id="mydataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="username" value="root"> </property> <property name="password" value="tarena"> </property> <property name="url" value="jdbc:mysql://localhost:3306/test"> </property> <property name="driverClassName" value="com.mysql.jdbc.Driver"></property> <property name="initialSize" value="2"> </property> </bean> <bean id="mysessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="mydataSource"> </property> <property name="mappingResources"> <list> <value>com/mysteelsoft/entity/Employee.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.format_sql">true</prop> <prop key="hibernate.dialect"> org.hibernate.dialect.SQLServerDialect </prop> </props> </property> </bean> <bean id="employeeDao" class="com.mysteelsoft.dao.impl.EmployeeDaoHibernateImpl"> <property name="sessionFactory" ref="mysessionFactory"> </property> </bean> <bean name="/searchEmployee" scope="prototype" class="com.mysteelsoft.action.EmployeeAction"> <property name="employeeDao" ref="employeeDao"/> </bean> <bean name="/addEmployee" scope="prototype" class="com.mysteelsoft.action.AddEmployeeAction"> <property name="employeeDao" ref="employeeDao"/> </bean> <bean name="/deleteEmployee" scope="prototype" class="com.mysteelsoft.action.DeleteEmployeeAction"> <property name="employeeDao" ref="employeeDao"/> </bean> <bean name="/showEmployee" scope="prototype" class="com.mysteelsoft.action.ShowEmployeeAction"> <property name="employeeDao" ref="employeeDao"/> </bean> <bean name="/updateEmployee" scope="prototype" class="com.mysteelsoft.action.UpdateEmployeeAction"> <property name="employeeDao" ref="employeeDao"/> </bean> </beans>
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值