Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
  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;
  }
Exemplo n.º 3
0
  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);
  }
Exemplo n.º 4
0
 public NoteEntity get(NotePage notePage) {
   return noteEntityDao.get(NoteEntity.class, notePage.getObid());
 }
Exemplo n.º 5
0
 public void update(NotePage notePage) throws Exception {
   NoteEntity t = noteEntityDao.get(NoteEntity.class, notePage.getObid());
   if (t != null) {
     MyBeanUtils.copyBeanNotNull2Bean(notePage, t);
   }
 }