Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- Java
- 예외처리
- GRANT VIEW
- 정수형타입
- 메소드오버로딩
- 다형성
- 어윈 사용법
- 컬렉션 타입
- 집합_SET
- NestedFor
- 인터페이스
- 객체 비교
- exception
- 생성자오버로드
- cursor문
- 환경설정
- 사용자예외클래스생성
- 대덕인재개발원
- 예외미루기
- 오라클
- 한국건설관리시스템
- 제네릭
- 컬렉션프레임워크
- 자바
- 추상메서드
- EnhancedFor
- oracle
- abstract
- 자동차수리시스템
- 참조형변수
Archives
- Today
- Total
거니의 velog
(8) CommonDAO, CommonService 세팅 본문
[EmployeeVO.java]
package kr.or.ddit.vo;
public class EmployeeVO {
private String empno;
private String empname;
private String empjob;
private String empcostat;
private String empsal;
private String emphp1;
private String emphp2;
private String emphp3;
private String empaddr;
private String empjoindate;
private String empretiredate;
private String emppass;
private String empemail;
private String emppos;
private String emppercol;
private String empphoto;
// inner join 추가
private String empjobnm;
private String empposnm;
public EmployeeVO() {}
public EmployeeVO(String empno, String empname, String empjob, String empcostat, String empsal, String emphp1,
String emphp2, String emphp3, String empaddr, String empjoindate, String empretiredate, String emppass,
String empemail, String emppos, String emppercol, String empphoto, String empjobnm, String empposnm) {
super();
this.empno = empno;
this.empname = empname;
this.empjob = empjob;
this.empcostat = empcostat;
this.empsal = empsal;
this.emphp1 = emphp1;
this.emphp2 = emphp2;
this.emphp3 = emphp3;
this.empaddr = empaddr;
this.empjoindate = empjoindate;
this.empretiredate = empretiredate;
this.emppass = emppass;
this.empemail = empemail;
this.emppos = emppos;
this.emppercol = emppercol;
this.empphoto = empphoto;
this.empjobnm = empjobnm;
this.empposnm = empposnm;
}
public String getEmpno() {
return empno;
}
public void setEmpno(String empno) {
this.empno = empno;
}
public String getEmpname() {
return empname;
}
public void setEmpname(String empname) {
this.empname = empname;
}
public String getEmpjob() {
return empjob;
}
public void setEmpjob(String empjob) {
this.empjob = empjob;
}
public String getEmpcostat() {
return empcostat;
}
public void setEmpcostat(String empcostat) {
this.empcostat = empcostat;
}
public String getEmpsal() {
return empsal;
}
public void setEmpsal(String empsal) {
this.empsal = empsal;
}
public String getEmphp1() {
return emphp1;
}
public void setEmphp1(String emphp1) {
this.emphp1 = emphp1;
}
public String getEmphp2() {
return emphp2;
}
public void setEmphp2(String emphp2) {
this.emphp2 = emphp2;
}
public String getEmphp3() {
return emphp3;
}
public void setEmphp3(String emphp3) {
this.emphp3 = emphp3;
}
public String getEmpaddr() {
return empaddr;
}
public void setEmpaddr(String empaddr) {
this.empaddr = empaddr;
}
public String getEmpjoindate() {
return empjoindate;
}
public void setEmpjoindate(String empjoindate) {
this.empjoindate = empjoindate;
}
public String getEmpretiredate() {
return empretiredate;
}
public void setEmpretiredate(String empretiredate) {
this.empretiredate = empretiredate;
}
public String getEmppass() {
return emppass;
}
public void setEmppass(String emppass) {
this.emppass = emppass;
}
public String getEmpemail() {
return empemail;
}
public void setEmpemail(String empemail) {
this.empemail = empemail;
}
public String getEmppos() {
return emppos;
}
public void setEmppos(String emppos) {
this.emppos = emppos;
}
public String getEmppercol() {
return emppercol;
}
public void setEmppercol(String emppercol) {
this.emppercol = emppercol;
}
public String getEmpphoto() {
return empphoto;
}
public void setEmpphoto(String empphoto) {
this.empphoto = empphoto;
}
public String getEmpjobnm() {
return empjobnm;
}
public void setEmpjobnm(String empjobnm) {
this.empjobnm = empjobnm;
}
public String getEmpposnm() {
return empposnm;
}
public void setEmpposnm(String empposnm) {
this.empposnm = empposnm;
}
@Override
public String toString() {
return "EmployeeVO [empno=" + empno + ", empname=" + empname + ", empjob=" + empjob + ", empcostat=" + empcostat
+ ", empsal=" + empsal + ", emphp1=" + emphp1 + ", emphp2=" + emphp2 + ", emphp3=" + emphp3
+ ", empaddr=" + empaddr + ", empjoindate=" + empjoindate + ", empretiredate=" + empretiredate
+ ", emppass=" + emppass + ", empemail=" + empemail + ", emppos=" + emppos + ", emppercol=" + emppercol
+ ", empphoto=" + empphoto + ", empjobnm=" + empjobnm + ", empposnm=" + empposnm + "]";
}
}
[FileInfoVO.java]
package kr.or.ddit.vo;
public class FileInfoVO {
private int fileno;
private String filewriter;
private String originfilename;
private String savefilename;
private long filesize;
private String filedate;
public FileInfoVO() {}
public FileInfoVO(int fileno, String filewriter, String originfilename, String savefilename, long filesize,
String filedate) {
this.fileno = fileno;
this.filewriter = filewriter;
this.originfilename = originfilename;
this.savefilename = savefilename;
this.filesize = filesize;
this.filedate = filedate;
}
public int getFileno() {
return fileno;
}
public void setFileno(int fileno) {
this.fileno = fileno;
}
public String getFilewriter() {
return filewriter;
}
public void setFilewriter(String filewriter) {
this.filewriter = filewriter;
}
public String getOriginfilename() {
return originfilename;
}
public void setOriginfilename(String originfilename) {
this.originfilename = originfilename;
}
public String getSavefilename() {
return savefilename;
}
public void setSavefilename(String savefilename) {
this.savefilename = savefilename;
}
public long getFilesize() {
return filesize;
}
public void setFilesize(long filesize) {
this.filesize = filesize;
}
public String getFiledate() {
return filedate;
}
public void setFiledate(String filedate) {
this.filedate = filedate;
}
@Override
public String toString() {
return "FileInfoVO [fileno=" + fileno + ", filewriter=" + filewriter + ", originfilename=" + originfilename
+ ", savefilename=" + savefilename + ", filesize=" + filesize + ", filedate=" + filedate + "]";
}
}
[SealInfoVO.java]
package kr.or.ddit.vo;
public class SealInfoVO {
private int sealno;
private String fileno;
private String empno;
public SealInfoVO() {}
public SealInfoVO(int sealno, String fileno, String empno) {
this.sealno = sealno;
this.fileno = fileno;
this.empno = empno;
}
public int getSealno() {
return sealno;
}
public void setSealno(int sealno) {
this.sealno = sealno;
}
public String getFileno() {
return fileno;
}
public void setFileno(String fileno) {
this.fileno = fileno;
}
public String getEmpno() {
return empno;
}
public void setEmpno(String empno) {
this.empno = empno;
}
@Override
public String toString() {
return "SealInfoVO [sealno=" + sealno + ", fileno=" + fileno + ", empno=" + empno + "]";
}
}
[SignLineVO.java]
package kr.or.ddit.vo;
public class SignLineVO {
private int signno;
private String oriempno;
private String empnofir;
private String empnamefir;
private String empjobfir;
private String empposfir;
private String empnosec;
private String empnamesec;
private String empjobsec;
private String emppossec;
private String empnothi;
private String empnamethi;
private String empjobthi;
private String empposthi;
public SignLineVO() {}
public SignLineVO(int signno, String oriempno, String empnofir, String empnamefir, String empjobfir,
String empposfir, String empnosec, String empnamesec, String empjobsec, String emppossec, String empnothi,
String empnamethi, String empjobthi, String empposthi) {
this.signno = signno;
this.oriempno = oriempno;
this.empnofir = empnofir;
this.empnamefir = empnamefir;
this.empjobfir = empjobfir;
this.empposfir = empposfir;
this.empnosec = empnosec;
this.empnamesec = empnamesec;
this.empjobsec = empjobsec;
this.emppossec = emppossec;
this.empnothi = empnothi;
this.empnamethi = empnamethi;
this.empjobthi = empjobthi;
this.empposthi = empposthi;
}
public int getSignno() {
return signno;
}
public void setSignno(int signno) {
this.signno = signno;
}
public String getOriempno() {
return oriempno;
}
public void setOriempno(String oriempno) {
this.oriempno = oriempno;
}
public String getEmpnofir() {
return empnofir;
}
public void setEmpnofir(String empnofir) {
this.empnofir = empnofir;
}
public String getEmpnamefir() {
return empnamefir;
}
public void setEmpnamefir(String empnamefir) {
this.empnamefir = empnamefir;
}
public String getEmpjobfir() {
return empjobfir;
}
public void setEmpjobfir(String empjobfir) {
this.empjobfir = empjobfir;
}
public String getEmpposfir() {
return empposfir;
}
public void setEmpposfir(String empposfir) {
this.empposfir = empposfir;
}
public String getEmpnosec() {
return empnosec;
}
public void setEmpnosec(String empnosec) {
this.empnosec = empnosec;
}
public String getEmpnamesec() {
return empnamesec;
}
public void setEmpnamesec(String empnamesec) {
this.empnamesec = empnamesec;
}
public String getEmpjobsec() {
return empjobsec;
}
public void setEmpjobsec(String empjobsec) {
this.empjobsec = empjobsec;
}
public String getEmppossec() {
return emppossec;
}
public void setEmppossec(String emppossec) {
this.emppossec = emppossec;
}
public String getEmpnothi() {
return empnothi;
}
public void setEmpnothi(String empnothi) {
this.empnothi = empnothi;
}
public String getEmpnamethi() {
return empnamethi;
}
public void setEmpnamethi(String empnamethi) {
this.empnamethi = empnamethi;
}
public String getEmpjobthi() {
return empjobthi;
}
public void setEmpjobthi(String empjobthi) {
this.empjobthi = empjobthi;
}
public String getEmpposthi() {
return empposthi;
}
public void setEmpposthi(String empposthi) {
this.empposthi = empposthi;
}
@Override
public String toString() {
return "SignLineVO [signno=" + signno + ", oriempno=" + oriempno + ", empnofir=" + empnofir + ", empnamefir="
+ empnamefir + ", empjobfir=" + empjobfir + ", empposfir=" + empposfir + ", empnosec=" + empnosec
+ ", empnamesec=" + empnamesec + ", empjobsec=" + empjobsec + ", emppossec=" + emppossec + ", empnothi="
+ empnothi + ", empnamethi=" + empnamethi + ", empjobthi=" + empjobthi + ", empposthi=" + empposthi
+ "]";
}
}
[SignAcceptVO.java]
package kr.or.ddit.vo;
public class SignAcceptVO { // 품의서 VO
private int acceptno;
private String acceptoriempno;
private String acceptoriempphoto;
private String acceptnofir;
private String acceptnamefir;
private String acceptphotofir;
private String acceptnosec;
private String acceptnamesec;
private String acceptphotosec;
private String acceptnothi;
private String acceptnamethi;
private String acceptphotothi;
private String acceptoriempnm;
private String acceptoriempjob;
private String acceptoriemppos;
private String accepttitle;
private String acceptcont;
private String acceptdate;
public SignAcceptVO() {}
public SignAcceptVO(int acceptno, String acceptoriempno, String acceptoriempphoto, String acceptnofir,
String acceptnamefir, String acceptphotofir, String acceptnosec, String acceptnamesec,
String acceptphotosec, String acceptnothi, String acceptnamethi, String acceptphotothi,
String acceptoriempnm, String acceptoriempjob, String acceptoriemppos, String accepttitle,
String acceptcont, String acceptdate) {
this.acceptno = acceptno;
this.acceptoriempno = acceptoriempno;
this.acceptoriempphoto = acceptoriempphoto;
this.acceptnofir = acceptnofir;
this.acceptnamefir = acceptnamefir;
this.acceptphotofir = acceptphotofir;
this.acceptnosec = acceptnosec;
this.acceptnamesec = acceptnamesec;
this.acceptphotosec = acceptphotosec;
this.acceptnothi = acceptnothi;
this.acceptnamethi = acceptnamethi;
this.acceptphotothi = acceptphotothi;
this.acceptoriempnm = acceptoriempnm;
this.acceptoriempjob = acceptoriempjob;
this.acceptoriemppos = acceptoriemppos;
this.accepttitle = accepttitle;
this.acceptcont = acceptcont;
this.acceptdate = acceptdate;
}
public int getAcceptno() {
return acceptno;
}
public void setAcceptno(int acceptno) {
this.acceptno = acceptno;
}
public String getAcceptoriempno() {
return acceptoriempno;
}
public void setAcceptoriempno(String acceptoriempno) {
this.acceptoriempno = acceptoriempno;
}
public String getAcceptoriempphoto() {
return acceptoriempphoto;
}
public void setAcceptoriempphoto(String acceptoriempphoto) {
this.acceptoriempphoto = acceptoriempphoto;
}
public String getAcceptnofir() {
return acceptnofir;
}
public void setAcceptnofir(String acceptnofir) {
this.acceptnofir = acceptnofir;
}
public String getAcceptnamefir() {
return acceptnamefir;
}
public void setAcceptnamefir(String acceptnamefir) {
this.acceptnamefir = acceptnamefir;
}
public String getAcceptphotofir() {
return acceptphotofir;
}
public void setAcceptphotofir(String acceptphotofir) {
this.acceptphotofir = acceptphotofir;
}
public String getAcceptnosec() {
return acceptnosec;
}
public void setAcceptnosec(String acceptnosec) {
this.acceptnosec = acceptnosec;
}
public String getAcceptnamesec() {
return acceptnamesec;
}
public void setAcceptnamesec(String acceptnamesec) {
this.acceptnamesec = acceptnamesec;
}
public String getAcceptphotosec() {
return acceptphotosec;
}
public void setAcceptphotosec(String acceptphotosec) {
this.acceptphotosec = acceptphotosec;
}
public String getAcceptnothi() {
return acceptnothi;
}
public void setAcceptnothi(String acceptnothi) {
this.acceptnothi = acceptnothi;
}
public String getAcceptnamethi() {
return acceptnamethi;
}
public void setAcceptnamethi(String acceptnamethi) {
this.acceptnamethi = acceptnamethi;
}
public String getAcceptphotothi() {
return acceptphotothi;
}
public void setAcceptphotothi(String acceptphotothi) {
this.acceptphotothi = acceptphotothi;
}
public String getAcceptoriempnm() {
return acceptoriempnm;
}
public void setAcceptoriempnm(String acceptoriempnm) {
this.acceptoriempnm = acceptoriempnm;
}
public String getAcceptoriempjob() {
return acceptoriempjob;
}
public void setAcceptoriempjob(String acceptoriempjob) {
this.acceptoriempjob = acceptoriempjob;
}
public String getAcceptoriemppos() {
return acceptoriemppos;
}
public void setAcceptoriemppos(String acceptoriemppos) {
this.acceptoriemppos = acceptoriemppos;
}
public String getAccepttitle() {
return accepttitle;
}
public void setAccepttitle(String accepttitle) {
this.accepttitle = accepttitle;
}
public String getAcceptcont() {
return acceptcont;
}
public void setAcceptcont(String acceptcont) {
this.acceptcont = acceptcont;
}
public String getAcceptdate() {
return acceptdate;
}
public void setAcceptdate(String acceptdate) {
this.acceptdate = acceptdate;
}
@Override
public String toString() {
return "SignAcceptVO [acceptno=" + acceptno + ", acceptoriempno=" + acceptoriempno + ", acceptoriempphoto="
+ acceptoriempphoto + ", acceptnofir=" + acceptnofir + ", acceptnamefir=" + acceptnamefir
+ ", acceptphotofir=" + acceptphotofir + ", acceptnosec=" + acceptnosec + ", acceptnamesec="
+ acceptnamesec + ", acceptphotosec=" + acceptphotosec + ", acceptnothi=" + acceptnothi
+ ", acceptnamethi=" + acceptnamethi + ", acceptphotothi=" + acceptphotothi + ", acceptoriempnm="
+ acceptoriempnm + ", acceptoriempjob=" + acceptoriempjob + ", acceptoriemppos=" + acceptoriemppos
+ ", accepttitle=" + accepttitle + ", acceptcont=" + acceptcont + ", acceptdate=" + acceptdate + "]";
}
}
[ICommonDAO.java]
package kr.or.ddit.dao;
import java.util.List;
import kr.or.ddit.vo.EmployeeVO;
import kr.or.ddit.vo.FileInfoVO;
public interface ICommonDAO {
/**
* 사원번호를 입력해서 로그인 화면에서 실시간으로 조회하는 기능
* @param empno 사원번호
* @return 입력받은 사원번호와 일치하는 사원번호
*/
public String selectEmpNo(String empno);
/**
* 사원번호와 비밀번호를 입력받아 회원 정보 1건 반환
* @param evo 사원번호, 비밀번호
* @return 1건의 회원 전체 정보
*/
public EmployeeVO loginSelect(EmployeeVO evo);
/**
* 사원번호를 입력해서 해당 사원의 이메일로 비밀번호를 전송하는 기능
* @param empno 사원번호
* @return 1건의 회원 정보 중 이메일과 비밀번호 정보 리턴
*/
public EmployeeVO selectEmpPass(String empno);
/**
* 사원번호를 입력해서 해당 사원의 중복 체크 여부를 검사
* @param empno 사원번호
* @return 회원 정보중 가장 높은 값의 사원번호 1개 리턴
*/
public String dupChkEmpNo(String empno);
/**
* UPLOAD된 파일 정보가 저장된 FileInfoVO객체를 매개변수로 받아서
* DB에 insert하는 메서드
*
* @param fvo insert할 파일 정보가 저장된 FileInfoVO객체
* @return 작업 성공 : 1, 작업 실패 : 0
*/
public int insertFileInfo(FileInfoVO fvo);
/**
* DB에 저장된 전체 파일 목록을 가져와 List에 담아서 반환하는 메서드
*
* @return 전체 파일 정보가 저장된 List객체
*/
public List<FileInfoVO> getAllFileInfo();
/**
* 파일 번호를 매개변수로 받아서 해당 파일 정보를 검색하여 반환하는 메서드
*
* @param fileNo 검색할 파일 번호
* @return 검색된 파일 정보가 저장된 FileInfoVO객체
*/
public FileInfoVO getFileInfo(int fileNo);
public int getFileNoMax();
public int deleteFile(int fileNo);
/**
* 사원정보를 입력하여 새로운 사원을 등록하는 메서드
* @param evo 한 명의 사원정보 전체
* @return 성공시 1, 실패시 0
*/
public int insertEmployee(EmployeeVO evo);
public List<EmployeeVO> getAllEmpList();
public EmployeeVO empUpdateInfo(String empno);
public int deleteEmp(String empno);
public int updateEmp(EmployeeVO evo);
}
[CommonDaoImpl.java]
package kr.or.ddit.dao;
import java.util.List;
import org.apache.ibatis.session.SqlSession;
import kr.or.ddit.util.MyBatisUtil;
import kr.or.ddit.vo.EmployeeVO;
import kr.or.ddit.vo.FileInfoVO;
public class CommonDaoImpl implements ICommonDAO {
private static CommonDaoImpl dao;
private CommonDaoImpl() {}
public static CommonDaoImpl getInstance() {
if(dao == null) dao = new CommonDaoImpl();
return dao;
}
@Override
public String selectEmpNo(String empno) {
SqlSession session = MyBatisUtil.getSqlSession();
//System.out.println("empno : " + empno);
String findEmpNo = null; // 반환할 값
try {
findEmpNo = session.selectOne("employee.selectEmpNo", empno);
//System.out.println("findEmpNo : " + findEmpNo);
} catch (Exception e) {
e.printStackTrace();
} finally {
if(session != null) session.close();
}
return findEmpNo;
}
@Override
public EmployeeVO loginSelect(EmployeeVO evo) {
SqlSession session = MyBatisUtil.getSqlSession();
EmployeeVO resEvo = null;
try {
resEvo = session.selectOne("employee.loginSelect", evo);
} catch (Exception e) {
e.printStackTrace();
} finally {
if(session != null) session.close();
}
return resEvo;
}
@Override
public EmployeeVO selectEmpPass(String empno) {
SqlSession session = MyBatisUtil.getSqlSession();
EmployeeVO resEvo = null;
try {
resEvo = session.selectOne("employee.selectEmpPass", empno);
} catch (Exception e) {
e.printStackTrace();
} finally {
if(session != null) session.close();
}
return resEvo;
}
@Override
public String dupChkEmpNo(String empno) {
SqlSession session = MyBatisUtil.getSqlSession();
String dupEmpNo = null;
try {
dupEmpNo = session.selectOne("employee.dupChkEmpNo", empno);
} catch (Exception e) {
e.printStackTrace();
} finally {
if(session != null) session.close();
}
return dupEmpNo;
}
@Override
public int insertFileInfo(FileInfoVO fvo) {
SqlSession session = MyBatisUtil.getSqlSession();
int cnt = 0; // 반환값이 저장될 변수
try {
cnt = session.insert("fileinfo.insertFileInfo", fvo);
if(cnt > 0) session.commit();
} catch (Exception e) {
e.printStackTrace();
} finally {
if(session != null) session.close();
}
return cnt;
}
@Override
public List<FileInfoVO> getAllFileInfo() {
SqlSession session = MyBatisUtil.getSqlSession();
List<FileInfoVO> fileList = null; // 반환값이 저장될 변수
try {
fileList = session.selectList("fileinfo.getAllFileInfo");
} catch (Exception e) {
e.printStackTrace();
} finally {
if(session != null) session.close();
}
return fileList;
}
@Override
public FileInfoVO getFileInfo(int fileNo) {
SqlSession session = MyBatisUtil.getSqlSession();
FileInfoVO fileVo = null; // 반환값이 저장될 변수
try {
fileVo = session.selectOne("fileinfo.getFileInfo", fileNo);
} catch (Exception e) {
e.printStackTrace();
} finally {
if(session != null) session.close();
}
return fileVo;
}
@Override
public int getFileNoMax() {
SqlSession session = MyBatisUtil.getSqlSession();
int fileNoMax = 0;
try {
fileNoMax = session.selectOne("fileinfo.getFileNoMax");
} catch (Exception e) {
e.printStackTrace();
} finally {
if(session != null) session.close();
}
return fileNoMax;
}
@Override
public int deleteFile(int fileNo) {
SqlSession session = MyBatisUtil.getSqlSession();
int cnt = 0;
try {
cnt = session.delete("fileinfo.deleteFile", fileNo);
if(cnt > 0) session.commit();
} catch (Exception e) {
e.printStackTrace();
} finally {
if(session != null) session.close();
}
return cnt;
}
@Override
public int insertEmployee(EmployeeVO evo) {
SqlSession session = MyBatisUtil.getSqlSession();
int cnt = 0;
try {
cnt = session.insert("employee.insertEmployee", evo);
if(cnt > 0) session.commit();
} catch (Exception e) {
e.printStackTrace();
} finally {
if(session != null) session.close();
}
return cnt;
}
@Override
public List<EmployeeVO> getAllEmpList() {
SqlSession session = MyBatisUtil.getSqlSession();
List<EmployeeVO> empList = null;
try {
empList = session.selectList("employee.getAllEmpList");
} catch (Exception e) {
e.printStackTrace();
} finally {
if(session != null) session.close();
}
return empList;
}
@Override
public EmployeeVO empUpdateInfo(String empno) {
SqlSession session = MyBatisUtil.getSqlSession();
EmployeeVO evo = null;
try {
evo = session.selectOne("employee.empUpdateInfo", empno);
} catch (Exception e) {
e.printStackTrace();
} finally {
if(session != null) session.close();
}
return evo;
}
@Override
public int deleteEmp(String empno) {
SqlSession session = MyBatisUtil.getSqlSession();
int cnt = 0;
try {
cnt = session.delete("employee.deleteEmp", empno);
if(cnt > 0) session.commit();
} catch (Exception e) {
e.printStackTrace();
} finally {
if(session != null) session.close();
}
return cnt;
}
@Override
public int updateEmp(EmployeeVO evo) {
SqlSession session = MyBatisUtil.getSqlSession();
int cnt = 0;
try {
cnt = session.update("employee.updateEmp", evo);
if(cnt > 0) session.commit();
} catch (Exception e) {
e.printStackTrace();
} finally {
if(session != null) session.close();
}
return cnt;
}
}
[ICommonService.java]
package kr.or.ddit.service;
import java.util.List;
import kr.or.ddit.vo.EmployeeVO;
import kr.or.ddit.vo.FileInfoVO;
public interface ICommonService {
/**
* 사원번호를 입력해서 로그인 화면에서 실시간으로 조회하는 기능
* @param empno 사원번호
* @return 입력받은 사원번호와 일치하는 사원번호
*/
public String selectEmpNo(String empno);
/**
* 사원번호와 비밀번호를 입력받아 회원 정보 1건 반환
* @param evo 사원번호, 비밀번호
* @return 1건의 회원 전체 정보
*/
public EmployeeVO loginSelect(EmployeeVO evo);
/**
* 사원번호를 입력해서 해당 사원의 이메일로 비밀번호를 전송하는 기능
* @param empno 사원번호
* @return 1건의 회원 정보 중 이메일과 비밀번호 정보 리턴
*/
public EmployeeVO selectEmpPass(String empno);
/**
* 사원번호를 입력해서 해당 사원의 중복 체크 여부를 검사
* @param empno 사원번호
* @return 회원 정보중 가장 높은 값의 사원번호 1개 리턴
*/
public String dupChkEmpNo(String empno);
/**
* UPLOAD된 파일 정보가 저장된 FileInfoVO객체를 매개변수로 받아서
* DB에 insert하는 메서드
*
* @param fvo insert할 파일 정보가 저장된 FileInfoVO객체
* @return 작업 성공 : 1, 작업 실패 : 0
*/
public int insertFileInfo(FileInfoVO fvo);
/**
* DB에 저장된 전체 파일 목록을 가져와 List에 담아서 반환하는 메서드
*
* @return 전체 파일 정보가 저장된 List객체
*/
public List<FileInfoVO> getAllFileInfo();
/**
* 파일 번호를 매개변수로 받아서 해당 파일 정보를 검색하여 반환하는 메서드
*
* @param fileNo 검색할 파일 번호
* @return 검색된 파일 정보가 저장된 FileInfoVO객체
*/
public FileInfoVO getFileInfo(int fileNo);
public int getFileNoMax();
public int deleteFile(int fileNo);
/**
* 사원정보를 입력하여 새로운 사원을 등록하는 메서드
* @param evo 한 명의 사원정보 전체
* @return 성공시 1, 실패시 0
*/
public int insertEmployee(EmployeeVO evo);
public List<EmployeeVO> getAllEmpList();
public EmployeeVO empUpdateInfo(String empno);
public int deleteEmp(String empno);
public int updateEmp(EmployeeVO evo);
}
[CommonServiceImpl.java]
package kr.or.ddit.service;
import java.util.List;
import kr.or.ddit.dao.CommonDaoImpl;
import kr.or.ddit.dao.ICommonDAO;
import kr.or.ddit.vo.EmployeeVO;
import kr.or.ddit.vo.FileInfoVO;
public class CommonServiceImpl implements ICommonService {
private ICommonDAO dao;
private static CommonServiceImpl service;
private CommonServiceImpl() {
dao = CommonDaoImpl.getInstance();
}
public static CommonServiceImpl getInstance() {
if(service == null) service = new CommonServiceImpl();
return service;
}
@Override
public String selectEmpNo(String empno) {
return dao.selectEmpNo(empno);
}
@Override
public EmployeeVO loginSelect(EmployeeVO evo) {
return dao.loginSelect(evo);
}
@Override
public EmployeeVO selectEmpPass(String empno) {
return dao.selectEmpPass(empno);
}
@Override
public String dupChkEmpNo(String empno) {
return dao.dupChkEmpNo(empno);
}
@Override
public int insertFileInfo(FileInfoVO fvo) {
return dao.insertFileInfo(fvo);
}
@Override
public List<FileInfoVO> getAllFileInfo() {
return dao.getAllFileInfo();
}
@Override
public FileInfoVO getFileInfo(int fileNo) {
return dao.getFileInfo(fileNo);
}
@Override
public int getFileNoMax() {
return dao.getFileNoMax();
}
@Override
public int deleteFile(int fileNo) {
return dao.deleteFile(fileNo);
}
@Override
public int insertEmployee(EmployeeVO evo) {
return dao.insertEmployee(evo);
}
@Override
public List<EmployeeVO> getAllEmpList() {
return dao.getAllEmpList();
}
@Override
public EmployeeVO empUpdateInfo(String empno) {
return dao.empUpdateInfo(empno);
}
@Override
public int deleteEmp(String empno) {
return dao.deleteEmp(empno);
}
@Override
public int updateEmp(EmployeeVO evo) {
return dao.updateEmp(evo);
}
}
'대덕인재개발원_2nd project' 카테고리의 다른 글
(10) 배경 자료 수집 (0) | 2023.10.26 |
---|---|
(9) script.js (0) | 2023.10.20 |
(7) MyBatis 세팅 (0) | 2023.10.20 |
(6) common.css (0) | 2023.10.20 |
(5) 회원 삭제 페이지 (0) | 2023.10.20 |