📄 inventorylogic.java~7~
字号:
package com.inv.logic;import com.inv.dao.HbmDAO;import com.inv.actionform.InventoryActionForm;import java.util.*;import com.inv.vo.Inventory;public class InventoryLogic { private HbmDAO dao; private InventoryActionForm form; public InventoryLogic() { dao = new HbmDAO(); dao.setAutoClose(false); } public void getInventorys() { String str = "from User"; List inventorys = dao.list(str); form.setInventorys(inventorys); } public void addInventory() { Inventory inventory = new Inventory(); inventory.setInvName(""); inventory.setInvUID(null); form.getInventorys().add(inventory); } public void saveUser() { List users = form.getUsers(); for (Iterator iter = users.iterator(); iter.hasNext(); ) { User item = (User)iter.next(); if(item.getUserUID().equals(new Long(0))) { item.setUserUID(null); } try { dao.store(item); } catch (DAOException ex) { ex.printStackTrace(); } } } public void deleteUser() { Long uid = form.getDeleteUID(); try { dao.remove(User.class, uid); } catch (DAOException ex) { ex.printStackTrace(); } } public void closeDAO() { dao.closeSession(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -