您的位置:首页 > 博客中心 > 数据库 >

mybatis插入图片处理--mysql

时间:2022-03-14 03:25

  1. public void showReportImage() {  
  2.                 response.setContentType("image/jpeg");  
  3.   
  4.                 if (!"".equals(id)) {  
  5.             List<UserGraphicVo> list = userGraphicService.findUserGraphicVoById(id);  
  6.             if(null != list && !list.isEmpty()){  
  7.                 OutputStream os = null;  
  8.                 try {  
  9.                     os = response.getOutputStream();  
  10.                     os.write(list.get(0).getGraphicData());  
  11.                     os.flush();  
  12.                 } catch (IOException e) {  
  13.                     Log.info("读取文件出错!" + e.getMessage());  
  14.                 } finally {  
  15.                     if(null != os){  
  16.                         try {  
  17.                             os.close();  
  18.                         } catch (IOException e) {  
  19.                             Log.info("关闭文件输出流出错!" + e.getMessage());  
  20.                         }  
  21.                     }  
  22.                 }                 
  23.             }  
  24.         }  
  25.     }  


热门排行

今日推荐

热门手游