public void add(NotePage notePage) {
   if (notePage.getObid() == null || notePage.getObid().trim().equals("")) {
     notePage.setObid(UUID.randomUUID().toString());
   }
   NoteEntity t = new NoteEntity();
   BeanUtils.copyProperties(notePage, t);
   noteEntityDao.save(t);
 }
  private String addWhere(NotePage notePage, String hql, List<Object> values) {
    // 循环查询条件Page的所有[Integer][String]类型的字段,如果字段不为空则动态加上查询条件
    // -----------------------------------------------------
    StringBuffer hqlbf = new StringBuffer(hql);

    NoteEntity noteEntity = new NoteEntity();
    BeanUtils.copyProperties(notePage, noteEntity);
    SearchSqlGenerateUtil.createSearchParamsHql(hqlbf, values, noteEntity);
    hql = hqlbf.toString();
    // -----------------------------------------------------
    if (notePage.getCcreatedatetimeStart() != null) {
      hql += " and createDt>=? ";
      values.add(notePage.getCcreatedatetimeStart());
    }
    if (notePage.getCcreatedatetimeEnd() != null) {
      hql += " and createDt<=? ";
      values.add(notePage.getCcreatedatetimeEnd());
    }
    if (notePage.getCmodifydatetimeStart() != null) {
      hql += " and modifyDt>=? ";
      values.add(notePage.getCmodifydatetimeStart());
    }
    if (notePage.getCmodifydatetimeEnd() != null) {
      hql += " and modifyDt<=? ";
      values.add(notePage.getCmodifydatetimeEnd());
    }
    return hql;
  }
  private List<NoteEntity> find(NotePage notePage) {
    String hql = "from NoteEntity t where 1=1 ";

    List<Object> values = new ArrayList<Object>();
    hql = addWhere(notePage, hql, values);

    if (notePage.getSort() != null && notePage.getOrder() != null) {
      hql += " order by " + notePage.getSort() + " " + notePage.getOrder();
    }
    return noteEntityDao.find(hql, notePage.getPage(), notePage.getRows(), values);
  }
 public NoteEntity get(NotePage notePage) {
   return noteEntityDao.get(NoteEntity.class, notePage.getObid());
 }
 public void update(NotePage notePage) throws Exception {
   NoteEntity t = noteEntityDao.get(NoteEntity.class, notePage.getObid());
   if (t != null) {
     MyBeanUtils.copyBeanNotNull2Bean(notePage, t);
   }
 }