mybatis插入图片处理--mysql
时间:2022-03-14 03:25
- public void showReportImage() {
- response.setContentType("image/jpeg");
- if (!"".equals(id)) {
- List<UserGraphicVo> list = userGraphicService.findUserGraphicVoById(id);
- if(null != list && !list.isEmpty()){
- OutputStream os = null;
- try {
- os = response.getOutputStream();
- os.write(list.get(0).getGraphicData());
- os.flush();
- } catch (IOException e) {
- Log.info("读取文件出错!" + e.getMessage());
- } finally {
- if(null != os){
- try {
- os.close();
- } catch (IOException e) {
- Log.info("关闭文件输出流出错!" + e.getMessage());
- }
- }
- }
- }
- }
- }