@Test
public void testInsertStudent(){
logger.info("Ìí¼ÓѧÉú");
Student student=new Student();
student.setName("ÕÅÈý4");
student.setAge(14);
student.setRemark("ºÜ³¤µÄ±¾ÎÄ...");
byte []pic=null;
try{
File file=new File("c://boy.jpg");
InputStream inputStream=new FileInputStream(file);
pic=new byte[inputStream.available()];
inputStream.read(pic);
inputStream.close();
}catch(Exception e){
e.printStackTrace();
}
student.setPic(pic);
studentMapper.insertStudent(student);
sqlSession.commit();
}
@Test
public void testGetStudentById(){
logger.info("");
Student student=studentMapper.getStudentById(4);
System.out.println(student);
byte []pic=student.getPic();
try{
File file=new File("d://boy2.jpg");
OutputStream outputStream=new FileOutputStream(file);
outputStream.write(pic);
outputStream.close();
}catch(Exception e){
e.printStackTrace();
}
}