@Override public void insert(SalesSlipBean salesSlipBean, EmployeeBean employeeBean) { SalesSlipHeadBean salesSlipHeadBean = salesSlipBean.getSalesSlipHeadBean(); List<SalesSlipOptionmenuBean> salesSlipOptionmenuList = salesSlipBean.getSalesSlipOptionmenuList(); List<SalesSlipDiscountBean> salesSlipDiscountList = salesSlipBean.getSalesSlipDiscountList(); salesSlipHeadBean.setUpDay(DateUtil.getDay(0)); salesSlipHeadBean.setUpEmployeeId(employeeBean.getEmployeeId()); int slipId = salesSlipHeadDao.insert(salesSlipHeadBean); int detailId = 1; for (SalesSlipOptionmenuBean salesSlipOptionmenuBean : salesSlipOptionmenuList) { if (salesSlipOptionmenuBean.getOptionmenuId() != null) { salesSlipOptionmenuBean.setSlipId(slipId); salesSlipOptionmenuBean.setDetailId(detailId++); salesSlipOptionmenuBean.setUpDay(DateUtil.getDay(0)); salesSlipOptionmenuBean.setUpEmployeeId(employeeBean.getEmployeeId()); salesSlipOptionmenuDao.insert(salesSlipOptionmenuBean); } } detailId = 1; for (SalesSlipDiscountBean salesSlipDiscountBean : salesSlipDiscountList) { if (salesSlipDiscountBean.getDiscountId() != null) { salesSlipDiscountBean.setSlipId(slipId); salesSlipDiscountBean.setDetailId(detailId++); salesSlipDiscountBean.setUpDay(DateUtil.getDay(0)); salesSlipDiscountBean.setUpEmployeeId(employeeBean.getEmployeeId()); salesSlipDiscountDao.insert(salesSlipDiscountBean); } } }
@Override public SalesSlipBean selectBySlipId(int slipId) { SalesSlipBean salesSlipBean = new SalesSlipBean(); salesSlipBean.setSalesSlipHeadBean(salesSlipHeadDao.selectBySlipId(slipId)); salesSlipBean.setSalesSlipOptionmenuList(salesSlipOptionmenuDao.selectBySlipId(slipId)); salesSlipBean.setSalesSlipDiscountList(salesSlipDiscountDao.selectBySlipId(slipId)); return salesSlipBean; }