| | |
| | | package com.ld.igds.drug.service; |
| | | |
| | | import com.bstek.bdf2.core.business.IUser; |
| | | import com.bstek.bdf2.core.orm.hibernate.HibernateDao; |
| | | import com.bstek.dorado.data.provider.Page; |
| | | import com.ld.igds.models.DrugLog; |
| | |
| | | public void pageData(Page<DrugLog> page, Map<String, Object> param) |
| | | throws Exception { |
| | | String hql = " from " + DrugLog.class.getName() |
| | | + " where companyId=:companyId"; |
| | | + " where deptId=:deptId"; |
| | | |
| | | Map<String, Object> args = new HashMap<String, Object>(); |
| | | args.put("companyId", ContextUtil.getCompanyId()); |
| | | args.put("deptId", ContextUtil.subDeptId(null)); |
| | | |
| | | if (null != param) { |
| | | |
| | |
| | | } |
| | | str = (String) param.get("name"); |
| | | if (StringUtils.isNotEmpty(str)) { |
| | | hql += " and user =:name"; |
| | | hql += " and user like:name"; |
| | | args.put("name", "%" + str + "%"); |
| | | } |
| | | Date date = (Date) param.get("start"); |
| | | if (null != date) { |
| | | hql +=(" and start >=:start"); |
| | | args.put("start", date); |
| | | } |
| | | date = (Date) param.get("end"); |
| | | if (null != date) { |
| | | hql +=(" and end <=:end"); |
| | | args.put("end", date); |
| | | } |
| | | |
| | | } |
| | |
| | | data.setUpdateUser(ContextUtil.getLoginUserCName()); |
| | | try { |
| | | if (null == data.getId()) { |
| | | data.setId(data.getDepotId() + DateFormatUtils.format(new Date(), "yyyyMMdd") + getIndex(data.getCompanyId())); |
| | | data.setId(DateFormatUtils.format(new Date(), "yyyyMMdd") + getIndex(data.getCompanyId())); |
| | | session.save(data); |
| | | } else { |
| | | session.update(data); |