package leon.sms.controller;
import leon.sms.mapper.ShitiMapper;
import leon.sms.pojo.Shiti;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
public class ShitiController {
@Autowired
private ShitiMapper shitiMapper;
@RequestMapping("/list")
public ModelAndView getAllShiti(){
List<Shiti> shitis = shitiMapper.getShitis();
ModelAndView mav = new ModelAndView();
mav.addObject("shitis",shitis);
mav.setViewName("shitiList");
return mav;
}
@RequestMapping("/answer")
public ModelAndView answer(HttpServletRequest request){
String[] options1s = request.getParameterValues("options1");
String[] options2s = request.getParameterValues("options2");
Integer[] numbers = {1,2,3,4,5,6,7,8};
Map<Integer,Integer> tongji = new HashMap<>();
for (Integer number : numbers) {
int num = 0;
if(options1s!=null&&options1s.length>0){
for (String options1 : options1s) {
if(number==Integer.parseInt(options1)){
num++;
}
}
}
if(options2s!=null&&options2s.length>0) {
for (String options2 : options2s) {
if (number == Integer.parseInt(options2)) {
num++;
}
}
}
tongji.put(number,num);
}
List<Shiti> shitis = shitiMapper.getShitis();
ModelAndView mav = new ModelAndView();
mav.addObject("tongji",tongji);
mav.addObject("shitis",shitis);
mav.setViewName("shitiList");
return mav;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
基于SSM实现学生游戏爱好调查统计 (118个子文件)
ShitiController.class 3KB
ShitiController.class 3KB
Shiti.class 2KB
Shiti.class 2KB
ShitiMapper.class 224B
ShitiMapper.class 224B
common.css 481B
common.css 481B
.gitignore 184B
diaochaTongji.iml 2KB
druid-1.0.15.jar 1.86MB
druid-1.0.15.jar 1.86MB
jackson-databind-2.5.4.jar 1.09MB
jackson-databind-2.5.4.jar 1.09MB
spring-core-3.2.16.RELEASE.jar 865KB
spring-core-3.2.16.RELEASE.jar 865KB
spring-context-3.2.16.RELEASE.jar 848KB
spring-context-3.2.16.RELEASE.jar 848KB
mysql-connector-java-5.1.6-bin.jar 687KB
mysql-connector-java-5.1.6-bin.jar 687KB
mybatis-3.1.1.jar 636KB
mybatis-3.1.1.jar 636KB
spring-webmvc-3.2.16.RELEASE.jar 627KB
spring-webmvc-3.2.16.RELEASE.jar 627KB
spring-web-3.2.16.RELEASE.jar 617KB
spring-web-3.2.16.RELEASE.jar 617KB
spring-beans-3.2.16.RELEASE.jar 600KB
spring-beans-3.2.16.RELEASE.jar 600KB
spring-test-3.2.16.RELEASE.jar 448KB
spring-test-3.2.16.RELEASE.jar 448KB
fastjson-1.2.7.jar 407KB
fastjson-1.2.7.jar 407KB
jstl-1.2.jar 405KB
jstl-1.2.jar 405KB
spring-jdbc-3.2.16.RELEASE.jar 397KB
spring-jdbc-3.2.16.RELEASE.jar 397KB
com.springsource.org.apache.log4j-1.2.15.jar 387KB
com.springsource.org.apache.log4j-1.2.15.jar 387KB
spring-aop-3.2.16.RELEASE.jar 331KB
spring-aop-3.2.16.RELEASE.jar 331KB
junit-4.12.jar 308KB
junit-4.12.jar 308KB
hamcrest-all-1.3.jar 299KB
hamcrest-all-1.3.jar 299KB
spring-tx-3.2.16.RELEASE.jar 237KB
spring-tx-3.2.16.RELEASE.jar 237KB
jackson-core-2.5.4.jar 225KB
jackson-core-2.5.4.jar 225KB
servlet-api.jar 193KB
servlet-api.jar 193KB
spring-expression-3.2.16.RELEASE.jar 192KB
spring-expression-3.2.16.RELEASE.jar 192KB
com.springsource.org.apache.commons.logging-1.1.1.jar 60KB
com.springsource.org.apache.commons.logging-1.1.1.jar 60KB
spring-aspects-3.2.16.RELEASE.jar 50KB
spring-aspects-3.2.16.RELEASE.jar 50KB
mybatis-spring-1.2.3.jar 50KB
mybatis-spring-1.2.3.jar 50KB
jackson-annotations-2.5.0.jar 39KB
jackson-annotations-2.5.0.jar 39KB
com.springsource.org.aopalliance-1.0.0.jar 5KB
com.springsource.org.aopalliance-1.0.0.jar 5KB
ShitiController.java 2KB
Shiti.java 1KB
ShitiMapper.java 255B
1.jpg 562KB
1.jpg 562KB
3.jpg 302KB
3.jpg 302KB
2.jpg 236KB
2.jpg 236KB
login.jpg 27KB
login.jpg 27KB
common.js 433B
common.js 433B
registe.jsp 2KB
registe.jsp 2KB
shitiList.jsp 2KB
shitiList.jsp 2KB
index.jsp 318B
index.jsp 318B
SalesManagementSystem.kotlin_module 16B
MANIFEST.MF 39B
MANIFEST.MF 39B
.name 21B
back.png 928B
back.png 928B
modify.png 814B
modify.png 814B
delete.png 780B
delete.png 780B
save.png 615B
save.png 615B
add.png 403B
add.png 403B
log4j.properties 333B
log4j.properties 333B
log4j.properties 333B
testdb.sql 2KB
testdb.sql 2KB
共 118 条
- 1
- 2
资源评论
编程指南针
- 粉丝: 5w+
- 资源: 207
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功