package com.ekexiu.portal.dao;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

import org.jfw.apt.annotation.Nullable;
import org.jfw.apt.orm.annotation.dao.DAO;
import org.jfw.apt.orm.annotation.dao.method.From;
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;

import com.ekexiu.portal.po.Image;

@DAO
public abstract class ImageDao {
	@Insert
	public abstract int insert(Connection con, Image image) throws SQLException;
	
	@SelectOne
	@Nullable
	public abstract Image query(Connection con, String imageId) throws SQLException;
	
	@SelectList
	public abstract List<Image> query(Connection con) throws SQLException;
	
	@SelectOne
	@Nullable
	public abstract Image queryOne(Connection con, String resourceId) throws SQLException;
	
	@SelectList
	public abstract List<Image> queryRes(Connection con, String resourceId) throws SQLException;
	
	@DeleteWith
	@From(Image.class)
	public abstract int deleteId(Connection con, String imageId) throws SQLException;
	
	@DeleteWith
	@From(Image.class)
	public abstract int deleteSrc(Connection con, String imageSrc) throws SQLException;
	
	@DeleteWith
	@From(Image.class)
	public abstract int deleteRes(Connection con, String resourceId) throws SQLException;
}
