package com.ekexiu.portal.service;

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

import org.jfw.apt.annotation.Autowrie;
import org.jfw.apt.web.annotation.Path;
import org.jfw.apt.web.annotation.operate.Delete;
import org.jfw.apt.web.annotation.operate.Get;
import org.jfw.apt.web.annotation.operate.Post;
import org.jfw.apt.web.annotation.operate.Put;
import org.jfw.apt.web.annotation.param.JdbcConn;
import org.jfw.apt.web.annotation.param.PathVar;
import org.jfw.apt.web.annotation.param.RequestBody;
import org.jfw.util.StringUtil;

import com.ekexiu.portal.dao.ProfessorEduBgDao;
import com.ekexiu.portal.po.ProfessorEduBg;

@Path("/edu")
public class ProfessorEduBgService {
	@Autowrie
	private ProfessorEduBgDao professorEduBgDao;
	
	public ProfessorEduBgDao getProfessorEduBgDao() {
		return professorEduBgDao;
	}

	public void setProfessorEduBgDao(ProfessorEduBgDao professorEduBgDao) {
		this.professorEduBgDao = professorEduBgDao;
	}

	@Get
	@Path("/{id}")
	public ProfessorEduBg query(@JdbcConn Connection con,@PathVar String id) throws SQLException
	{
		return this.professorEduBgDao.queryOne(con, id);
	}
	@Post
	@Path
	public void insert(@JdbcConn(true) Connection con, ProfessorEduBg honor) throws SQLException {
		String id = StringUtil.buildUUID();
		honor.setId(id);
		this.professorEduBgDao.insert(con, honor);
	}

	@Put
	@Path
	public void update(@JdbcConn(true) Connection con, @RequestBody ProfessorEduBg honor) throws SQLException {
		this.professorEduBgDao.update(con, honor);
	}

	@Get
	@Path("/professor")
	public List<ProfessorEduBg> queryByProfessor(@JdbcConn(false) Connection con, String professorId) throws SQLException {
		return this.professorEduBgDao.query(con, professorId);
	}

	@Delete
	@Path("/{id}")
	public void delete(@JdbcConn(true) Connection con, @PathVar String id) throws SQLException {
		this.professorEduBgDao.delete(con, id);
	}
}
