• 大小: 13.4MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-07-02
  • 语言: 其他
  • 标签: 测试  spring  

资源简介

测试题目在这里:https://blog.csdn.net/qian_qian_123/article/details/85338167这是参考答案

资源截图

代码片段和文件信息

package zhang.controller;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import org.springframework.web.servlet.ModelAndView;

import zhang.pojo.Dept;
import zhang.pojo.Employee;
import zhang.pojo.FenYe;
import zhang.pojo.Query;
import zhang.pojo.UserPower;
import zhang.service.DeptService;
import zhang.service.EmployeeService;
import zhang.service.FileUploadService;
import zhang.service.UserPowerService;

@Controller
@RequestMapping(“/employeeController“)

public class EmployeeController {

@Autowired
private EmployeeService es;
@Autowired
private DeptService ds;
@Autowired
private UserPowerService us;
@Autowired
private FileUploadService fus;

// 登录方法
@RequestMapping(“/login.do“)
@ResponseBody
public Mapject> login(HttpSession session Employee employee) {
Mapject> json = new HashMapject>();
employee = es.login(employee);
if (employee != null) {
// 登录成功
json.put(“message“ true);
session.setAttribute(“loginUser“ employee);
} else {
// 登录失败
json.put(“message“ false);
}
System.out.println(“收到数据:“ + json);
return json;
}

// 判断用户名是否可用
@RequestMapping(“/empNameIsRight.do“)
@ResponseBody
public Mapject> empNameIsRight(Employee employee) {
Mapject> json = new HashMapject>();
employee = es.empNameIsRight(employee);
if (employee != null) {
// 数据库中存在此用户名,此用户名不可用
json.put(“message“ true);
} else {
// 此用户名可用
json.put(“message“ false);
}
System.out.println(“返回的数据:“ + json);
return json;
}

// 去添加员工的页面
@RequestMapping(“/toAddEmployee.do“)
public ModelAndView toAddEmployee() {
ModelAndView mv = new ModelAndView();

// 查询员工部门信息,在下拉列表框中显示
List depts = ds.queryAllDept();
// 查询员工职位信息,在下拉列表框中显示
List userPowers = us.queryAllPower();

mv.addobject(“depts“ depts);
mv.addobject(“userPowers“ userPowers);
System.out.println(depts);
System.out.println(userPowers);
System.out.println(mv.toString());

mv.setViewName(“/WEB-INF/employeeAdd“);
return mv;
}

// 添加员工
@RequestMapping(“/addEmployee.do“)
public ModelAndView addEmployee(Employee employee @RequestParam(“employeeImg“) CommonsMultipartFile employeeImg) {

System.out.println(“进入增加页面“);
ModelAndView mv = new ModelAndView();
System.out.println(employee);

// 处理多部件表单数据
employee = fus.fileUpload(employeeImg employee);


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件         842  2018-12-29 16:05  CompanyManagerSystem\.classpath
     文件         920  2018-12-29 16:05  CompanyManagerSystem\.project
     文件         567  2018-12-29 16:05  CompanyManagerSystem\.settings\.jsdtscope
     文件         364  2018-12-29 16:04  CompanyManagerSystem\.settings\org.eclipse.jdt.core.prefs
     文件         512  2018-12-29 16:05  CompanyManagerSystem\.settings\org.eclipse.wst.common.component
     文件         345  2018-12-29 16:05  CompanyManagerSystem\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2018-12-29 16:05  CompanyManagerSystem\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2018-12-29 16:05  CompanyManagerSystem\.settings\org.eclipse.wst.jsdt.ui.superType.name
     文件          39  2018-12-29 16:05  CompanyManagerSystem\WebContent\meta-INF\MANIFEST.MF
     文件       10235  2018-11-21 20:47  CompanyManagerSystem\WebContent\My97DatePicker\WdatePicker.js
     文件       22544  2018-11-21 20:47  CompanyManagerSystem\WebContent\My97DatePicker\calendar.js
     文件         644  2018-11-21 20:47  CompanyManagerSystem\WebContent\My97DatePicker\lang\en.js
     文件        1089  2018-11-21 20:47  CompanyManagerSystem\WebContent\My97DatePicker\lang\zh-cn.js
     文件        1088  2018-11-21 20:47  CompanyManagerSystem\WebContent\My97DatePicker\lang\zh-tw.js
     文件         192  2018-11-21 20:47  CompanyManagerSystem\WebContent\My97DatePicker\skin\WdatePicker.css
     文件        1043  2018-11-21 20:47  CompanyManagerSystem\WebContent\My97DatePicker\skin\datePicker.gif
     文件        3726  2018-11-21 20:47  CompanyManagerSystem\WebContent\My97DatePicker\skin\default\datepicker.css
     文件        1578  2018-11-21 20:47  CompanyManagerSystem\WebContent\My97DatePicker\skin\default\img.gif
     文件         307  2018-11-21 20:47  CompanyManagerSystem\WebContent\My97DatePicker\skin\whyGreen\bg.jpg
     文件        3933  2018-11-21 20:47  CompanyManagerSystem\WebContent\My97DatePicker\skin\whyGreen\datepicker.css
     文件        1679  2018-11-21 20:47  CompanyManagerSystem\WebContent\My97DatePicker\skin\whyGreen\img.gif
     文件        5485  2019-01-03 01:27  CompanyManagerSystem\WebContent\WEB-INF\employeeAdd.jsp
     文件         745  2019-01-02 10:51  CompanyManagerSystem\WebContent\WEB-INF\employeeAddSuccessfully.jsp
     文件        2796  2019-01-02 17:52  CompanyManagerSystem\WebContent\WEB-INF\employeeInfo.jsp
     文件        5654  2019-01-03 20:25  CompanyManagerSystem\WebContent\WEB-INF\employeeUpdate.jsp
     文件        7604  2019-01-02 22:09  CompanyManagerSystem\WebContent\WEB-INF\index.jsp
     文件       43581  2018-12-04 09:32  CompanyManagerSystem\WebContent\WEB-INF\lib\asm-3.3.1.jar
     文件      423876  2018-12-04 09:33  CompanyManagerSystem\WebContent\WEB-INF\lib\c3p0-0.9.2.1.jar
     文件      322362  2018-12-04 09:32  CompanyManagerSystem\WebContent\WEB-INF\lib\cglib-nodep-2.2.jar
     文件      326877  2018-12-04 09:34  CompanyManagerSystem\WebContent\WEB-INF\lib\com.springsource.net.sf.cglib-2.2.0.jar
     文件        4615  2018-12-04 09:34  CompanyManagerSystem\WebContent\WEB-INF\lib\com.springsource.org.aopalliance-1.0.0.jar
............此处省略81个文件信息

评论

共有 条评论