package cn.edu.xaut.test;
import java.sql.Date;
import java.sql.Timestamp;
import java.util.List;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import cn.edu.xaut.bean.Student;
import cn.edu.xaut.bean.User;
import cn.edu.xaut.dao.IStudentDao;
import cn.edu.xaut.dao.IUserDao;
import cn.edu.xaut.service.IStudentService;
import cn.edu.xaut.service.IUserService;
import cn.edu.xaut.service.StudentServiceImpl;
public class DaoTest {
@Test
public void userDaoTest() {
ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
IUserService userService = (IUserService) ac.getBean("userService");
boolean u = userService.loginCheck("xiong", "123");
System.out.println(u);
}
@Test
public void studentDaoTest() {
ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
IStudentService studentService = (IStudentService) ac.getBean("studentService");
List<Student> ss = studentService.findAllStudents();
for(Student s : ss)
System.out.println(s);
}
// 查询ID成功
@Test
public void studentDaoTest01() {
ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
IStudentService studentService = (IStudentService) ac.getBean("studentService");
Student s=studentService.selectStudentById(1);
System.out.println(s);
}
// 删除成功
@Test
public void studentDaoTest02() {
ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
IStudentService studentService = (IStudentService) ac.getBean("studentService");
studentService.deleteStudent(17);
}
// 插入成功
@Test
public void studentDaoTest03() {
ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
IStudentService studentService = (IStudentService) ac.getBean("studentService");
Student s= new Student();
s.setStuId(55);
s.setStuName("小熊");
s.setBirthday(Date.valueOf("1999-03-03"));
s.setAffiliation("计173");
s.setLastLoginTime(new Timestamp(System.currentTimeMillis()));
studentService.insertStudent(s);
}
// 修改成功
@Test
public void studentDaoTest04() {
ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
IStudentService studentService = (IStudentService) ac.getBean("studentService");
Student s= new Student();
s.setStuName("小熊");
s.setBirthday(Date.valueOf("1999-03-03"));
s.setAffiliation("计ke173");
s.setLastLoginTime(new Timestamp(System.currentTimeMillis()));
studentService.updateStudent(s);
}
// 模糊查询
@Test
public void studentDaoTest05() {
ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
IStudentService studentService = (IStudentService) ac.getBean("studentService");
List<Student> s=studentService.FuzzyQueryUser("雷");
System.out.println(s);
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
SpringMVC-StudentManage3.rar (108个子文件)
validateCodeController.class 4KB
ManageController.class 4KB
DaoTest.class 3KB
LoginController.class 3KB
Dao2Test.class 2KB
Student.class 2KB
StudentServiceImpl2.class 2KB
ServiceTest.class 2KB
StudentServiceImpl.class 2KB
User.class 2KB
DaoGradeTest.class 2KB
DBUtil.class 2KB
Grade.class 1KB
UserServiceImpl.class 1KB
GradeServiceImpl.class 1KB
IStudentService2.class 582B
IStudentDao.class 562B
IStudentService.class 557B
IStudentDao2.class 438B
GradeService.class 246B
GradeDao.class 234B
IUserDao.class 198B
IUserService.class 188B
.classpath 2KB
org.eclipse.wst.common.component 899B
org.eclipse.wst.jsdt.ui.superType.container 49B
Style.css 1KB
Thumbs.db 16KB
nane.gif 12KB
tableheader-bg.gif 3KB
footer.gif 2KB
tableheader-bg-grey.gif 1KB
bg.gif 446B
footer_bg.gif 439B
top_left.gif 258B
bullet_green.gif 182B
content_bg.gif 143B
bullet_grey.gif 128B
button.gif 104B
DaoTest.java 3KB
validateCodeController.java 3KB
ManageController.java 2KB
LoginController.java 2KB
Dao2Test.java 2KB
DaoGradeTest.java 1KB
Student.java 1KB
StudentServiceImpl2.java 1KB
DBUtil.java 1KB
StudentServiceImpl.java 1012B
ServiceTest.java 997B
User.java 940B
GradeServiceImpl.java 639B
UserServiceImpl.java 611B
Grade.java 604B
IStudentDao2.java 416B
IStudentService2.java 411B
IStudentDao.java 404B
IStudentService.java 403B
GradeService.java 258B
GradeDao.java 252B
IUserDao.java 153B
IUserService.java 131B
ground.jpg 269KB
1.jpg 105KB
timg.jpg 21KB
liying.jpg 19KB
timg1.jpg 13KB
login.js 2KB
ret.js 174B
.jsdtscope 639B
manage.jsp 5KB
stuAdd.jsp 3KB
login.jsp 3KB
stuUpdate.jsp 3KB
LoginResult.jsp 781B
index.jsp 134B
MANIFEST.MF 106B
MANIFEST.MF 39B
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.jdt.core.prefs 478B
org.eclipse.m2e.core.prefs 90B
org.eclipse.wst.validation.prefs 50B
.project 1KB
log4j.properties 487B
log4j.properties 487B
pom.properties 292B
pom.properties 292B
pom.properties 291B
db.properties 134B
db.properties 134B
applicationContext.xml 3KB
applicationContext.xml 3KB
pom.xml 3KB
pom.xml 3KB
pom.xml 2KB
web.xml 2KB
IStudentDao2.xml 2KB
IStudentDao2.xml 2KB
springmvc-servlet.xml 1KB
springmvc-servlet.xml 1KB
共 108 条
- 1
- 2
资源评论
zhazhayong
- 粉丝: 5
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功