⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 photoserviceimpl.java

📁 EasyJF开源Blog系统是一个由EasyJF开源团队组织开发的基于Java平台的开源博客系统。当前Blog已经实现了基本的基本的博客的书写、流量统计、排名、个人像册、RSS、支持自定义模板、静态h
💻 JAVA
字号:
package com.easyjf.blog.logic.impl;

import java.io.InputStream;

import com.easyjf.blog.domain.Photo;
import com.easyjf.blog.domain.PhotoDir;
import com.easyjf.blog.logic.PhotoService;
import com.easyjf.web.tools.DbPageList;
import com.easyjf.web.tools.IPageList;

public class PhotoServiceImpl extends DAOSupportService implements PhotoService {
private static PhotoServiceImpl singleton=new PhotoServiceImpl();
public static PhotoServiceImpl getInstance()
{
	return singleton;
}
	public Photo getPhoto(String cid) {		
		return (Photo)this.dao.get(Photo.class, cid);
	}

	public PhotoDir getPhotoDir(String cid) {		
		return (PhotoDir)this.dao.get(PhotoDir.class, cid);
	}

	public boolean addPhoto(Photo photo) {
		boolean ret=false;
		photo.setInputTime(new java.util.Date());
		photo.setStatus(new Integer(0));
		ret=this.dao.save(photo);
		return ret;
	}

	public boolean addPhotoDir(PhotoDir photoDir) {
		boolean ret=false;
		ret=this.dao.save(photoDir);
		return ret;
	}

	public int batchDelPhoto(String[] cids) {
		int ret = 0;
		for (int i = 0; i < cids.length; i++) {
			if (delPhoto(cids[i]))
				ret++;
		}
		return ret;
	}

	public int batchDelPhotoDir(String[] cids) {
		int ret = 0;
		for (int i = 0; i < cids.length; i++) {
			if (delPhotoDir(cids[i]))
				ret++;
		}
		return ret;
	}

	public boolean delPhoto(String cid) {
		boolean ret=false;
		ret=this.dao.del(getPhoto(cid));
		return ret;
	}

	public boolean delPhotoDir(String cid) {
		boolean ret=false;
		ret=this.dao.del(getPhotoDir(cid));
		return ret;
	}

	public IPageList queryPhoto(PhotoDir dir, int currentPage, int pageSize) {
		String scope = "dirId=? ";
		java.util.Collection paras = new java.util.ArrayList();
		paras.add(dir.getCid());
		DbPageList pList = new DbPageList(PhotoDir.class,scope,paras);
		pList.doList(currentPage, pageSize);
		return pList;	
	}

	public IPageList queryPhoto(String userName, String key, int currentPage,
			int pageSize) {
		String scope = "inputUser=? order by inputTime desc";
		java.util.Collection paras = new java.util.ArrayList();
		paras.add(userName);
		DbPageList pList = new DbPageList(Photo.class,scope,paras);
		pList.doList(currentPage, pageSize);
		return pList;		
	}

	public IPageList queryPhotoDir(String userName, String key, int currentPage,
			int pageSize) {
		String scope = "inputUser=? ";
		java.util.Collection paras = new java.util.ArrayList();
		paras.add(userName);
		DbPageList pList = new DbPageList(PhotoDir.class,scope,paras);
		pList.doList(currentPage, pageSize);
		return pList;		
	}

	public boolean updatePhoto(Photo photo) {
		boolean ret=false;
		ret=this.dao.update(photo);
		return ret;
	}

	public boolean updatePhotoDir(Photo photoDir) {
		boolean ret=false;
		ret=this.dao.update(photoDir);		
		return ret;
	}

	public void uploadPhoto(Photo photo, InputStream in) {
		// TODO Auto-generated method stub
		
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -