package com.db.admin;
import java.io.IOException;
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;
import org.springframework.orm.ibatis.SqlMapClientTemplate;
import com.db.organization.*;
import com.db.user.UserVO;
import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;
public class AdminDAO {
private SqlMapClientTemplate template;
public void setTemplate(SqlMapClientTemplate template) {
this.template = template;
}
public Integer UserCount() throws Exception{
return (Integer)template.queryForObject("UserCount");
}
public List<UserVO> UserList() throws Exception {
List<UserVO> list = new ArrayList<UserVO>();
return template.queryForList("UserList");
}
public List<DeptVO> DeptList() throws Exception {
List<DeptVO> list = new ArrayList<DeptVO>();
return template.queryForList("DeptList");
}
public List<JobVO> JobList() throws Exception {
List<JobVO> list = new ArrayList<JobVO>();
return template.queryForList("jobListAll");
}
public UserVO Update(int sabun) throws Exception {
UserVO vo = (UserVO) template.queryForObject("Update", sabun);
return vo;
}
public void UpdateOk(UserVO vo){
try {
template.update("UpdateOk", vo);
} catch (Exception e) {
}
}
public void InsertUser(UserVO vo) throws Exception {
int sabun = (Integer) template.queryForObject("getSabun");
vo.setSabun(sabun);
System.out.println("dao"+vo.toString());
template.insert("InsertUser",vo);
}
public List Loginfo() throws Exception {
List<LoginfoVO> list = new ArrayList<LoginfoVO>();
return template.queryForList("LogInfo");
}
public void LogInput(LoginfoVO lvo) throws Exception {
template.insert("LogInput",lvo);
}
public Integer loginCount() throws Exception {
return (Integer)template.queryForObject("loginCount");
}
public List<UserVO> sawonSerch(String name) throws Exception {
return template.queryForList("sawonSerch", name);
}
public List<UserVO> serchDept(String dname) throws Exception {
return template.queryForList("serchDept", dname);
}
//신규 직위 추가
public void jobInsert(JobVO vo) throws Exception {
template.insert("jobInsert",vo);
}
//직위 삭제
public void jobDelete(int jobno) throws Exception {
template.delete("jobDelete", jobno);
}
public List<Object> lgSerchDept(int deptno) throws Exception {
return template.queryForList("lgSerchDept", deptno);
}
}