|
package com.ekexiu.portal.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
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.OrderBy;
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
import org.jfw.apt.orm.annotation.dao.method.operator.QueryList;
import org.jfw.apt.orm.annotation.dao.method.operator.QueryOne;
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
import org.jfw.apt.orm.annotation.dao.param.Set;
import com.ekexiu.portal.po.AuthApply;
import com.ekexiu.portal.pojo.AuthApplyInfo;
@DAO
public abstract class AuthApplyDao {
@Insert
public abstract int insert(Connection con, AuthApply authApply) throws SQLException;
@UpdateWith
@From(AuthApply.class)
public abstract int updateSolveStatus(Connection con, @Set Integer solveStatus,String authApplyId) throws SQLException;
@Nullable
@SelectOne
public abstract AuthApply queryOne(Connection con, String authApplyId) throws SQLException;
public AuthApply queryPro(Connection con, String professorId) throws SQLException{
int _m_1 = 1;
String sql = "SELECT AUTH_APPLY_ID,PROFESSOR_ID,APPLY_TYPE,SOLVE_STATUS FROM AUTH_APPLY "
+ " WHERE PROFESSOR_ID = ? ORDER BY CREATE_TIME DESC LIMIT 1";
PreparedStatement ps = con.prepareStatement(sql);
try{
ps.setString(_m_1++,professorId);
ResultSet rs = ps.executeQuery();
try{
if(rs.next()){
AuthApply _result = new AuthApply();
_result.setAuthApplyId(rs.getString(1));
_result.setProfessorId(rs.getString(2));
_result.setApplyType(rs.getInt(3));
_result.setSolveStatus(rs.getInt(4));
return _result;
}else{
return null;
}
}finally{
try{rs.close();}catch(Exception e1){}
}
}finally{
try{ps.close();}catch(Exception e2){}
}
}
@SelectList
public abstract List<AuthApply> query(Connection con) throws SQLException;
@QueryList
@OrderBy("ORDER BY a.CREATE_TIME")
public abstract List<AuthApplyInfo> queryInfo(Connection con) throws SQLException;
@QueryOne
@Nullable
public abstract AuthApplyInfo queryInfo(Connection con,String authApplyId) throws SQLException;
}
|