Esempio n. 1
0
  public void insert(Album album) {
    album.setDelflag("1");

    Timestamp sysdate = new Timestamp(System.currentTimeMillis());
    album.setCreateUser(SessionUtils.getCurrentUserId());
    album.setCreateTime(sysdate);
    album.setUpdateUser(SessionUtils.getCurrentUserId());
    album.setUpdateTime(sysdate);
    this.albumDao.insert(album);
  }
Esempio n. 2
0
  private void getAlbumList(Album parentAlbum, List<Album> albumList) {
    albumList.add(parentAlbum);

    Album paramAlbum = new Album();
    paramAlbum.setParentId(parentAlbum.getAlbumId());
    List newAlbumList = selectByCriteria(paramAlbum);
    if (newAlbumList != null)
      for (int i = 0; i < newAlbumList.size(); i++)
        getAlbumList((Album) newAlbumList.get(i), albumList);
  }
Esempio n. 3
0
  public JSONArray selectAlbumForTree(String parentId) {
    JSONArray res = new JSONArray();

    Album paramAlbum = new Album();
    if (StringUtils.isNotEmpty(parentId)) {
      paramAlbum.setParentId(Integer.valueOf(Integer.parseInt(parentId)));
    }

    List albumList = new ArrayList();
    albumList = selectByCriteria(paramAlbum);
    res = getAlbumTreeFromList(albumList, parentId);
    return res;
  }
Esempio n. 4
0
  public void delete(int albumId, String uploadFilePath) {
    List<Album> albumList = new ArrayList<Album>();

    Album parentAlbum = new Album();
    if (albumId == 0) parentAlbum.setAlbumId(Integer.valueOf(albumId));
    else {
      parentAlbum = selectByPrimaryKey(Integer.valueOf(albumId));
    }
    getAlbumList(parentAlbum, albumList);
    for (Album album : albumList) {
      if ("1".equals(album.getIsleaf())) {
        PictureWithBLOBs paramPicture = new PictureWithBLOBs();
        paramPicture.setAlbumId(album.getAlbumId());
        paramPicture.setDelflag("1");

        List<Picture> pictureList = this.pictureService.selectByCriteria(paramPicture);
        if ((pictureList != null) && (pictureList.size() > 0)) {
          for (Picture picture : pictureList) {
            File lfile = new File(uploadFilePath + "/" + picture.getLpath());
            if (lfile != null) {
              lfile.delete();
            }

            File sfile = new File(uploadFilePath + "/" + "thumbnail" + "/" + picture.getSpath());
            if (sfile != null) {
              sfile.delete();
            }
          }
        }
      }

      this.albumDao.deleteByPrimaryKey(album.getAlbumId().intValue());
    }
  }
Esempio n. 5
0
 public void update(Album album) {
   Timestamp sysdate = new Timestamp(System.currentTimeMillis());
   album.setUpdateUser(SessionUtils.getCurrentUserId());
   album.setUpdateTime(sysdate);
   this.albumDao.updateByPrimaryKey(album);
 }
Esempio n. 6
0
 private Album getConditions(Album parentAlbum) {
   parentAlbum.setCreateUser(SessionUtils.getCurrentUserId());
   return parentAlbum;
 }