package com.yjp.controller;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.yjp.dto.Emp;
import com.yjp.service.EmpService;
@Controller
@RequestMapping("/emp")
public class EmpController {
@Autowired
private EmpService empService;
@RequestMapping("/index")
public String index(){
return "search";
}
@RequestMapping(value="/search")
public String ByName(@RequestParam("ename") String ename,@RequestParam("type") String type,Model model){
System.out.println("进入");
List<Emp> emps=new ArrayList<Emp>();
int post_type=Integer.parseInt(type);
if("".equals(ename)){
emps=empService.ByType(post_type);
}else if(!"".equals(ename)){
emps=empService.ByName(ename,post_type);
System.out.println(emps.size());
}
System.out.println(emps.size());
if(emps.size()==0){
return "redirect:/";
}
model.addAttribute("emps",emps);
return "result";
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
spring boot 整合mybatis,基于@Select注解方式
共39个文件
java:9个
class:9个
xml:4个
4星 · 超过85%的资源 需积分: 50 115 下载量 10 浏览量
2016-11-21
11:40:48
上传
评论
收藏 21KB RAR 举报
温馨提示
很好的实例,简单易懂,适合新手
资源推荐
资源详情
资源评论
收起资源包目录
springbootMybatis.rar (39个子文件)
springbootMybatis
pom.xml 2KB
target
test-classes
m2e-wtp
web-resources
META-INF
maven
com.yjp
springbootMybatis
pom.xml 2KB
pom.properties 239B
MANIFEST.MF 290B
classes
application.properties 187B
templates
result.html 2KB
search.html 2KB
com
yjp
DemoApp.class 744B
dto
Demo.class 704B
Emp.class 2KB
mapper
EmpMapper.class 586B
DemoMapper.class 597B
controller
EmpController.class 2KB
DemoController.class 913B
service
EmpService.class 971B
DemoService.class 780B
.settings
org.eclipse.m2e.core.prefs 90B
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.wst.common.project.facet.core.xml 292B
org.eclipse.wst.common.component 692B
org.eclipse.wst.jsdt.ui.superType.container 49B
org.eclipse.wst.validation.prefs 50B
.jsdtscope 639B
org.eclipse.jdt.core.prefs 430B
src
test
demotest
main
webapp
WEB-INF
web.xml 222B
page
resources
application.properties 187B
templates
result.html 2KB
search.html 2KB
java
com
yjp
dto
Emp.java 1KB
Demo.java 297B
mapper
EmpMapper.java 402B
DemoMapper.java 453B
controller
DemoController.java 559B
EmpController.java 1KB
DemoApp.java 374B
service
EmpService.java 514B
DemoService.java 422B
.project 1KB
.classpath 2KB
共 39 条
- 1
资源评论
- hxl2082018-09-11一般般,初学者可以
malachi95
- 粉丝: 4
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功