package com.etoak.mssm.emp.controller;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.etoak.mssm.emp.entity.Emp;
import com.etoak.mssm.emp.service.EmpService;
@Controller
@RequestMapping("/emp")
public class EmpConteoller {
@Autowired
private EmpService empService ;
// 跳转页面
@RequestMapping("/empHome")
public String empHome(){
return "emp/empHome";
}
// 返回前台
//查询所有符合条件的Emp
@RequestMapping("/getEmps")
@ResponseBody
public Map<String,Object> getEmps(int limit,int offset,String empno , String ename ,String job,String deptno ,String mgr){
Emp emp = new Emp();
emp.setStartSize(offset);
emp.setEndSize(offset+limit);
if("" != empno ){emp.setEmpno(Integer.parseInt(empno));}
emp.setEname(ename);
emp.setJob(job);
if("" != deptno ){emp.setDeptno(Integer.parseInt(deptno));}
if("" != mgr ){emp.setMgr(Integer.parseInt(mgr));}
List<Emp> data = empService.getEmps(emp);
int total = empService.getCount(emp);
Map<String, Object> map = new HashMap<String, Object>();// 定义map
map.put("total", total);// total键 存放总记录数,必须的
map.put("rows", data);// rows键 存放每页记录 list
return map;
}
//新增或更新员工信息
@RequestMapping("/updateEmp")
@ResponseBody
public String updateEmp(String empno , String ename ,String job,String deptno ,String mgr,String sal,String comm , String hiredate){
Emp emp = new Emp();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
if(null != empno && "" != empno ){emp.setEmpno(Integer.parseInt(empno));}
if(null != ename && "" != ename ) emp.setEname(ename);
if(null != job && "" != job ) emp.setJob(job);
if(null != deptno && "" != deptno ){emp.setDeptno(Integer.parseInt(deptno));}
if(null != mgr && "" != mgr ){emp.setMgr(Integer.parseInt(mgr));}
if(null != sal && "" != sal ) emp.setSal(Integer.parseInt(sal));
if(null != hiredate && "" != hiredate ){
try {
emp.setHiredate(sdf.parse(hiredate));
} catch (ParseException e) {
e.printStackTrace();
}
}
if(emp.getEmpno() != 0 ){
int r = empService.updateEmp(emp);//更新员工信息
if( r == 1 ){
return "updateOk";
}else{
return "updateFail";
}
}else{
int r = empService.addEmp(emp); // 添加一个新员工信息
if( r == 1){
return "addOk";
}else{
return "addFail";
}
}
}
//新增或更新员工信息
@RequestMapping("/deleteEmp")
@ResponseBody
public String deleteEmp(String empno){
Emp emp = new Emp();
if(null != empno && "" != empno ){emp.setEmpno(Integer.parseInt(empno));}
int r = empService.deleteEmp(emp); // 添加一个新员工信息
if( r == 1){
return "deleteOk";
}else{
return "deleteFail";
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
maven spring springmvc mybatis bootstrap oracle 整合项目
共55个文件
js:10个
xml:9个
css:8个
需积分: 13 75 下载量 133 浏览量
2017-06-19
15:57:29
上传
评论 2
收藏 374KB ZIP 举报
温馨提示
maven spring springmvc mybatis bootstrap oracle 整合项目
资源推荐
资源详情
资源评论
收起资源包目录
mssm02.zip (55个子文件)
mssm02
.project 1KB
src
test
resources
java
main
webapp
WEB-INF
pages
emp
empHome.jsp 9KB
welcome
welcomeHome.jsp 669B
lib
web.xml 3KB
index.jsp 683B
META-INF
MANIFEST.MF 39B
static
common
bootstrap
js
npm.js 484B
bootstrap.js 67KB
bootstrap.min.js 36KB
fonts
glyphicons-halflings-regular.ttf 44KB
glyphicons-halflings-regular.woff2 18KB
glyphicons-halflings-regular.eot 20KB
glyphicons-halflings-regular.svg 106KB
glyphicons-halflings-regular.woff 23KB
css
bootstrap-theme.css.map 47KB
bootstrap.min.css 120KB
bootstrap-theme.min.css 23KB
constyle.css 2KB
bootstrap-theme.css 26KB
bootstrap.css.map 381KB
bootstrap.css 144KB
bootstrap-table
js
bootstrap-table-zh-CN.min.js 951B
bootstrap-table.min.js 53KB
css
bootstrap-table.min.css 6KB
jquery
jquery.min.js 94KB
bootstrap-datetimepicker
js
bootstrap-datetimepicker.min.js 38KB
bootstrap-datetimepicker.zh-CN.js 813B
bootstrap-datetimepicker.js 68KB
css
bootstrap-datetimepicker.css 12KB
bootstrap-datetimepicker.min.css 11KB
emp
empHome.js 8KB
resources
config
properties
oracle.properties 178B
log4j.properties 7KB
xml
application.xml 1KB
mybatis-db.xml 3KB
spring-mvc.xml 2KB
mybatis-dao.xml 1006B
spring-tx.xml 1KB
mybatis
mappers
emp
EmpDao.xml 4KB
java
com
etoak
mssm
common
controller
WelcomeController.java 476B
emp
service
impl
EmpServeiceImpl.java 824B
EmpService.java 332B
controller
EmpConteoller.java 3KB
dao
EmpDao.java 332B
entity
Emp.java 2KB
target
.settings
org.eclipse.wst.jsdt.ui.superType.container 49B
org.eclipse.wst.common.project.facet.core.xml 252B
org.eclipse.m2e.core.prefs 90B
org.eclipse.jdt.core.prefs 430B
org.eclipse.wst.validation.prefs 50B
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.wst.common.component 566B
.jsdtscope 639B
pom.xml 7KB
.classpath 2KB
共 55 条
- 1
资源评论
sanmubird
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功