基礎資料功能開發(附件上傳、查看,擷取目前使用者資訊、時間)

來源:互聯網
上載者:User

標籤:

1.資料庫建表、SYS_MODULE掛菜單、給菜單添加許可權2.建立Action、Dao、model、service。。。3.struts-aqxx.xml配置 <action name="zlaqJczl/*" method="{1}" class="com.tech15.aqxx.action.ZlaqJczlAction">     <result name="*" type="direct">基礎資料</result></action> 4.類型、更新周期(使用資料字典)下拉選擇(_add.jsp )condition屬性 :由相應的資料字典id擷取資料字典項<tr><th width="150">類型:</th><td colspan="3"><mytag:select id="lx" title="請選擇類型" name="lx" sql="basedata" isSql="false"  condition="1662" dataType="Long" listKey="name" listValue="name" headerKey="" headerValue="請選擇"  checkEmpty="true" checkDesc="類型" /></td></tr><tr><th width="150">更新周期:</th><td colspan="3"><mytag:select id="gxzq" title="請選擇周期" name="gxzq" sql="basedata" isSql="false"  condition="1668" dataType="Long" listKey="bz" listValue="name" headerKey="" headerValue="請選擇"  checkEmpty="true" checkDesc="更新周期" />     </td></tr> 附件上傳:(_add.jsp )             <tr>                  <th width="150">附件:</th>                  <td colspan="3">                  <input name="attachFile" type="file" contenteditable="false" id="attachfile" size="40"  checkEmpty="true" checkDesc="附件">&nbsp;附件最大不能超過20.00M                  </td>            </tr> //Action save()方法try添加相應代碼String realpath = ServletActionContext.getServletContext().getRealPath(UPLOADPATH);                zlaqJczlManager.saveJczl(zlaqJczl,realpath,getAttachFile(),getAttachFileFileName(),getAttachFileContentType()); ZlaqJczlManager.java添加附件相關方法private static final String zl = "zlaq_jczl";      private ZlaqJczlDao zlaqJczlDao;      private AttachManager attachManager;       public void setAttachManager(AttachManager attachManager) {            this.attachManager = attachManager;      } //附件上傳public void saveJczl(ZlaqJczl zlaqJczl, String realpath, File attachFile,                  String attachFileFileName, String attachFileContentType) {             zlaqJczlDao.save(zlaqJczl);            zlaqJczlDao.flush();            if(attachFile != null && attachFileFileName != null){                  attachManager.saveAttach(realpath, zlaqJczl.getUserid(),zl, ""+zlaqJczl.getId(), attachFile, attachFileFileName, attachFileContentType);            }      }//更新附件      public void updateJczl(ZlaqJczl zlaqJczl, String realpath, File attachFile,                  String attachFileFileName, String attachFileContentType) {            zlaqJczlDao.update(zlaqJczl);            zlaqJczlDao.flush();            if(attachFile != null && attachFileFileName != null){                  attachManager.delete(zl, ""+zlaqJczl.getId());                  attachManager.saveAttach(realpath, zlaqJczl.getUserid(),zl, ""+zlaqJczl.getId(), attachFile, attachFileFileName, attachFileContentType);            }      } //附件查看(Manager)@Transactional(readOnly=true)      public ZlaqJczl getById(String id) {            ZlaqJczl dj = zlaqJczlDao.getById(id);            List<Attach> attach = attachManager.findByTableNameAndId(zl, ""+id);            dj.setAttach(attach);            return dj;      } 擷取當前員工姓名、編號、添加時間 //_list.jsp  <td align="left"><span title=‘${item.lx}‘>${item.lx}</span></td>                    //顯示最佳化                  <td align="left"><c:if test="${item.gxzq == 30}">一個月</c:if>                  <c:if test="${item.gxzq == 90}">一個季度</c:if>                  <c:if test="${item.gxzq == 180}">半年</c:if>                  <c:if test="${item.gxzq == 365}">一年</c:if>                  </td>                  <td align="left"><span title=‘${item.tjsjString}‘><c:out value=‘${item.tjsjString}‘/></span></td>                  <td align="left"><span title=‘${item.ygbh}‘>${item.ygbh}</span></td>                  <td align="left"><span title=‘${item.ygxm}‘>${item.ygxm}</span></td>Action save()方法try添加相應代碼:                  zlaqJczl.setYgbh(getLoginInfo().getUsername());                  zlaqJczl.setYgxm(getLoginInfo().getRealname());                  zlaqJczl.setTjsj(DateTools.getCurrentTime());zlaqJczl.java添加相應set、get方法

基礎資料功能開發(附件上傳、查看,擷取目前使用者資訊、時間)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.