日期:2014-05-17 浏览次数:20874 次
import #{dao_p}.#{Entity}Dao;
import #{entity_p}.#{Entity};
import #{manager_p}.#{Entity}Mng;
@Service
@Transactional
public class #{Entity}MngImpl implements #{Entity}Mng {
@Transactional(readOnly = true)
public Pagination getPage(int pageNo, int pageSize) {
Pagination page = dao.getPage(pageNo, pageSize);
return page;
}
@Transactional(readOnly = true)
public #{Entity} findById(Integer id) {
#{Entity} entity = dao.findById(id);
return entity;
}
public #{Entity} save(#{Entity} bean) {
dao.save(bean);
return bean;
}
public #{Entity} update(#{Entity} bean) {
Updater<#{Entity}> updater = new Updater<#{Entity}>(bean);
bean = dao.updateByUpdater(updater);
return bean;
}
public #{Entity} deleteById(Integer id) {
#{Entity} bean = dao.deleteById(id);
return bean;
}
public #{Entity}[] deleteByIds(Integer[] ids) {
#{Entity}[] beans = new #{Entity}[ids.length];
for (int i = 0,len = ids.length; i < len; i++) {
beans[i] = deleteById(ids[i]);
}
return beans;
}
private #{Entity}Dao dao;
@Autowired
public void setDao(#{Entity}Dao dao) {
this.dao = dao;
}
}