Package org.g4studio.core.metatype

Examples of org.g4studio.core.metatype.Dto


   *
   * @param pDto
   * @return
   */
  public Dto saveSfxmDomain(Dto pDto) {
    Dto outDto = new BaseDto();
    String xmid = IDHelper.getXmID();
    pDto.put("xmid", xmid);
    g4Dao.insert("Demo.insertEz_sfxmDomain", pDto);
    outDto.put("xmid", xmid);
    return outDto;
  }
View Full Code Here


   * @throws Exception
   */
  public ActionForward delFiles(ActionMapping mapping, ActionForm form, HttpServletRequest request,
      HttpServletResponse response) throws Exception {
    BaseActionForm aForm = (BaseActionForm) form;
    Dto dto = aForm.getParamAsDto(request);
    String[] strChecked = dto.getAsString("strChecked").split(",");
    for (int i = 0; i < strChecked.length; i++) {
      String fileid = strChecked[i];
      Dto fileDto = (BaseDto) g4Reader.queryForObject("Demo.queryFileByFileID", fileid);
      String path = fileDto.getAsString("path");
      File file = new File(path);
      file.delete();
      demoService.delFile(fileid);
    }
    setOkTipMsg("文件删除成功", response);
View Full Code Here

   * @param pDto
   * @return
   * @throws SQLException
   */
  public Dto batchSaveSfxmDomains(final Dto pDto) {
    Dto outDto = new BaseDto();
    g4Dao.getSqlMapClientTpl().execute(new SqlMapClientCallback() {
      public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException {
        executor.startBatch();
        for (int i = 0; i < pDto.getAsInteger("count").intValue(); i++) {
          Dto dto = new BaseDto();
          String xmid = IDHelper.getXmID();
          dto.put("xmid", xmid);
          dto.put("sfdlbm", "99");
          dto.put("xmmc", "阿司匹林(批量插入)");
          dto.put("xmrj", "aspl");
          executor.insert("Demo.insertEz_sfxmDomain", dto);
        }
        executor.executeBatch();
        return null;
      }
View Full Code Here

   * @throws Exception
   */
  public ActionForward downloadFile(ActionMapping mapping, ActionForm form, HttpServletRequest request,
      HttpServletResponse response) throws Exception {
    BaseActionForm aForm = (BaseActionForm) form;
    Dto dto = aForm.getParamAsDto(request);
    String fileid = dto.getAsString("fileid");
    Dto fileDto = (BaseDto) g4Reader.queryForObject("Demo.queryFileByFileID", fileid);
    // 这里可稍做优化,根据文件类型动态设置此属性
    // response.setContentType("application/vnd.ms-excel");
    String filename = G4Utils.encodeChineseDownloadFileName(request, fileDto.getAsString("title"));
    response.setHeader("Content-Disposition", "attachment; filename=" + filename + ";");
    String path = fileDto.getAsString("path");
    File file = new File(path);
    BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
    ByteArrayOutputStream out = new ByteArrayOutputStream(1024);
    byte[] temp = new byte[1024];
    int size = 0;
View Full Code Here

   *
   * @param pDto
   * @return
   */
  public Dto updateSfxmDomain(Dto pDto) {
    Dto outDto = new BaseDto();
    g4Dao.update("Demo.updatesfxm", pDto);
    return outDto;
  }
View Full Code Here

      os.write(myFile.getFileData());
      os.flush();
      os.close();
    }
    // 我们通常还会把这个文件的相关信息持久化到数据库
    Dto inDto = cForm.getParamAsDto(request);
    inDto.put("title", G4Utils.isEmpty(inDto.getAsString("title")) ? fileName : inDto.getAsString("title"));
    inDto.put("filesize", myFile.getFileSize());
    inDto.put("path", savePath + fileName);
    demoService.doUpload(inDto);
    setOkTipMsg("文件上传成功", response);
    return mapping.findForward(null);
  }
View Full Code Here

   *
   * @param pDto
   * @return
   */
  public Dto deleteSfxm(Dto pDto) {
    Dto outDto = new BaseDto();
    g4Dao.delete("Demo.deleteSfxm", pDto);
    return outDto;
  }
View Full Code Here

   * 调用存储过程演示
   *
   * @return
   */
  public Dto callPrc(Dto inDto) {
    Dto prcDto = new BaseDto();
    prcDto.put("myname", inDto.getAsString("myname"));
    prcDto.put("number1", inDto.getAsBigDecimal("number1"));
    prcDto.put("number2", inDto.getAsBigDecimal("number2"));
    g4Dao.callPrc("Demo.g4_prc_demo", prcDto);
    return prcDto;
  }
View Full Code Here

  /**
   * 演示声明式事务配置
   */
  public Dto doTransactionTest() {
    Dto dto = new BaseDto();
    dto.put("sxh", "BJLK1000000000935");
    dto.put("fyze", new BigDecimal(300));
    g4Dao.update("Demo.updateByjsb", dto);
    // 如果在这里制造一个异常,事务将被回滚
    dto.put("fyze", new BigDecimal(300));
    g4Dao.update("Demo.updateByjsb1", dto);
    Dto outDto = (Dto) g4Dao.queryForObject("Demo.queryBalanceInfo", dto);
    return outDto;
  }
View Full Code Here

  /**
   * 客户端异常处理
   */
  public Dto doError() {
    Dto dto = new BaseDto();
    dto.put("sxh", "BJLK1000000000935");
    Dto outDto = (Dto) g4Dao.queryForObject("Demo.queryBalanceInfo1", dto);
    return outDto;
  }
View Full Code Here

TOP

Related Classes of org.g4studio.core.metatype.Dto

Copyright © 2018 www.massapicom. 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.