@Override public void edit(Itemclass r) { Titemclass t = itemclassDao.get(Titemclass.class, r.getId()); t.setName(r.getName()); t.setCode(r.getCode()); itemclassDao.update(t); }
@Override public Itemclass get(Long id) { Titemclass t = itemclassDao.get(Titemclass.class, id); Itemclass r = new Itemclass(); BeanUtils.copyProperties(t, r); return r; }
@Override public List<Itemclass> dataGrid(Itemclass bc, PageFilter ph) { List<Itemclass> list = new ArrayList<Itemclass>(); Map<String, Object> params = new HashMap<String, Object>(); String hql = " from Titemclass t "; List<Titemclass> l = itemclassDao.find( hql + whereHql(bc, params) + orderHql(ph), params, ph.getPage(), ph.getRows()); for (Titemclass t : l) { Itemclass b = new Itemclass(); BeanUtils.copyProperties(t, b); list.add(b); } return list; }
@Override public Long count(Itemclass bc, PageFilter ph) { Map<String, Object> params = new HashMap<String, Object>(); String hql = " from Titemclass t "; return itemclassDao.count("select count(*) " + hql + whereHql(bc, params), params); }
@Override public void delete(Long id) { Titemclass t = itemclassDao.get(Titemclass.class, id); itemclassDao.delete(t); }
@Override public void add(Itemclass ic) { Titemclass t = new Titemclass(); BeanUtils.copyProperties(ic, t); itemclassDao.save(t); }