Examples of JeecgBlobDataEntity


Examples of org.jeecgframework.web.demo.entity.test.JeecgBlobDataEntity

  }
 
  @RequestMapping(params = "download")
  public void exportXls(HttpServletRequest request, String fileId, HttpServletResponse response) {
    // 从数据库取得数据
    JeecgBlobDataEntity obj = systemService.getEntity(JeecgBlobDataEntity.class, fileId);
      try {     
        Blob attachment = obj.getAttachmentcontent();
      response.setContentType("application/x-msdownload;");
      response.setHeader("Content-disposition", "attachment; filename="
          + new String((obj.getAttachmenttitle()+"."+obj.getExtend()).getBytes("GBK"), "ISO8859-1"));
          //从数据库中读取出来    , 输出给下载用
          InputStream bis = attachment.getBinaryStream();     
          BufferedOutputStream bos = new BufferedOutputStream(response.getOutputStream());
      byte[] buff = new byte[2048];
      int bytesRead;
View Full Code Here

Examples of org.jeecgframework.web.demo.entity.test.JeecgBlobDataEntity

  @ResponseBody
  public AjaxJson save(JeecgBlobDataEntity jeecgBlobData, HttpServletRequest request) {
    AjaxJson j = new AjaxJson();
    if (StringUtil.isNotEmpty(jeecgBlobData.getId())) {
      message = "更新成功";
      JeecgBlobDataEntity t = jeecgBlobDataService.get(JeecgBlobDataEntity.class, jeecgBlobData.getId());
      try {
        MyBeanUtils.copyBeanNotNull2Bean(jeecgBlobData, t);
        jeecgBlobDataService.saveOrUpdate(t);
        systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
      } catch (Exception e) {
View Full Code Here

Examples of org.jeecgframework.web.demo.entity.test.JeecgBlobDataEntity

@Service("jeecgBlobDataService")
@Transactional
public class JeecgBlobDataServiceImpl extends CommonServiceImpl implements JeecgBlobDataServiceI {
 
  public void saveObj(String documentTitle, MultipartFile file) {
    JeecgBlobDataEntity obj = new JeecgBlobDataEntity();
    LobHelper lobHelper = commonDao.getSession().getLobHelper();
    Blob data;
    try {
      data = lobHelper.createBlob(file.getInputStream(), 0);
      obj.setAttachmentcontent(data);
    } catch (IOException e) {
      e.printStackTrace();
    }
    obj.setAttachmenttitle(documentTitle);
    String sFileName = file.getOriginalFilename();
    int iPos = sFileName.lastIndexOf('.');
    if (iPos >= 0) {
      obj.setExtend(sFileName.substring(iPos+1));
    }
    super.save(obj);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.