Exemplo n.º 1
0
 @Override
 public void edit(LvFollow lvFollow) {
   TlvFollow t = lvFollowDao.get(TlvFollow.class, lvFollow.getId());
   if (t != null) {
     MyBeanUtils.copyProperties(lvFollow, t, new String[] {"id", "createdatetime"}, true);
     // t.setModifydatetime(new Date());
   }
 }
Exemplo n.º 2
0
 @Override
 public LvFollow get(String id) {
   Map<String, Object> params = new HashMap<String, Object>();
   params.put("id", id);
   TlvFollow t = lvFollowDao.get("from TlvFollow t  where t.id = :id", params);
   LvFollow o = new LvFollow();
   BeanUtils.copyProperties(t, o);
   return o;
 }
Exemplo n.º 3
0
 public LvFollow get(Integer fromOpenId, Integer toOpenId) {
   Map<String, Object> params = new HashMap<String, Object>();
   params.put("fromOpenId", fromOpenId);
   params.put("toOpenId", toOpenId);
   TlvFollow t =
       lvFollowDao.get(
           "from TlvFollow t  where t.fromOpenId = :fromOpenId and t.toOpenId = :toOpenId",
           params);
   if (t == null) return null;
   LvFollow f = new LvFollow();
   BeanUtils.copyProperties(t, f);
   return f;
 }
Exemplo n.º 4
0
  @Override
  public int add(LvFollow lvFollow) {
    LvFollow f = get(lvFollow.getFromOpenId(), lvFollow.getToOpenId());
    if (f != null) {
      lvFollow.setId(f.getId());
      this.edit(lvFollow);
      return -1;
    }
    TlvFollow t = new TlvFollow();
    BeanUtils.copyProperties(lvFollow, t);
    t.setId(UUID.randomUUID().toString());
    lvFollowDao.save(t);

    LvAccount a = accountService.get(lvFollow.getToOpenId());
    a.setFollowNum(a.getFollowNum() + 1);
    accountService.edit(a);

    return 1;
  }
Exemplo n.º 5
0
 @Override
 public void delete(String id) {
   lvFollowDao.delete(lvFollowDao.get(TlvFollow.class, id));
 }