[TCO] 직원 기능 수정전

직원조회

  • 리스트 출력, 검색, 페이징 기능

EmpVO

package kr.or.tco.emp.vo;

@Repository
public class EmpVO {

	
	private String empId; // 직원아이디
	private String empNm; //직원명
	
	
	@DateTimeFormat(pattern="yyyy-MM-dd")
	private Date empJncmpYmd; //입사일
	
	
	@DateTimeFormat(pattern="yyyy-MM-dd")
	private Date empBrdt; //생년월일
	
	
	private String empMail; //이메일
	private String empPswd; //비밀번호
	private String empImg; // 이미지
	private String empIp; //아이피
	private String empActno; // 계좌번호
	private String empSe; // 직원유형
	private int rglrempCrtrpy; //기본급
	private int rglrempBns; // 상여금
	private int rglrempFdpy; // 식대
	private int rglrempCrpy; // 차량유지비
	private int rglrempBbpy; // 육아수당
	private int ctrtempHrpy; // 시급
	private int ctrtempTm; // 근무시간
	private String ctrtempSe; //근무형태
	private int ctrtempHdpy; // 주휴수당
	private int ctrtempTx; // 세금
	private String cmncdCd; // 공통코드 직급
	private String empTel;
	private String empPwsd;
	
	// 유형-소속
	private String opt;
	// 부서
	private String dptopt;
	// 직급
	private String lelopt;
	
	
	// 파일
	
	// 리스트 출력위한  순번 추가 부탁
	private int rnum;
	
	// 다중 파일 객체
	private MultipartFile[] uploadFile;
	
	// 다중 파일 객체의 파일명
	private String uploadFileName;
	
	// 다중 파일 업로드 객체
	private List<AttachFilesVO> attachFilesVO;
		
		
	public String getEmpPwsd() {
		return empPwsd;
	}
	public void setEmpPwsd(String empPwsd) {
		this.empPwsd = empPwsd;
	}
	public String getEmpId() {
		return empId;
	}
	public void setEmpId(String empId) {
		this.empId = empId;
	}
	public String getEmpNm() {
		return empNm;
	}
	public void setEmpNm(String empNm) {
		this.empNm = empNm;
	}

	public Date getEmpJncmpYmd() {
		return empJncmpYmd;
	}
	public void setEmpJncmpYmd(Date empJncmpYmd) {
		this.empJncmpYmd = empJncmpYmd;
	}
	public Date getEmpBrdt() {
		return empBrdt;
	}
	public void setEmpBrdt(Date empBrdt) {
		this.empBrdt = empBrdt;
	}
	public String getEmpMail() {
		return empMail;
	}
	public void setEmpMail(String empMail) {
		this.empMail = empMail;
	}
	public String getEmpPswd() {
		return empPswd;
	}
	public void setEmpPswd(String empPswd) {
		this.empPswd = empPswd;
	}
	public String getEmpImg() {
		return empImg;
	}
	public void setEmpImg(String empImg) {
		this.empImg = empImg;
	}
	public String getEmpIp() {
		return empIp;
	}
	public void setEmpIp(String empIp) {
		this.empIp = empIp;
	}
	public String getEmpActno() {
		return empActno;
	}
	public void setEmpActno(String empActno) {
		this.empActno = empActno;
	}
	public String getEmpSe() {
		return empSe;
	}
	public void setEmpSe(String empSe) {
		this.empSe = empSe;
	}
	public int getRglrempCrtrpy() {
		return rglrempCrtrpy;
	}
	public void setRglrempCrtrpy(int rglrempCrtrpy) {
		this.rglrempCrtrpy = rglrempCrtrpy;
	}
	public int getRglrempBns() {
		return rglrempBns;
	}
	public void setRglrempBns(int rglrempBns) {
		this.rglrempBns = rglrempBns;
	}
	public int getRglrempFdpy() {
		return rglrempFdpy;
	}
	public void setRglrempFdpy(int rglrempFdpy) {
		this.rglrempFdpy = rglrempFdpy;
	}
	public int getRglrempCrpy() {
		return rglrempCrpy;
	}
	public void setRglrempCrpy(int rglrempCrpy) {
		this.rglrempCrpy = rglrempCrpy;
	}
	public int getRglrempBbpy() {
		return rglrempBbpy;
	}
	public void setRglrempBbpy(int rglrempBbpy) {
		this.rglrempBbpy = rglrempBbpy;
	}
	public int getCtrtempHrpy() {
		return ctrtempHrpy;
	}
	public void setCtrtempHrpy(int ctrtempHrpy) {
		this.ctrtempHrpy = ctrtempHrpy;
	}
	public int getCtrtempTm() {
		return ctrtempTm;
	}
	public void setCtrtempTm(int ctrtempTm) {
		this.ctrtempTm = ctrtempTm;
	}
	public String getCtrtempSe() {
		return ctrtempSe;
	}
	public void setCtrtempSe(String ctrtempSe) {
		this.ctrtempSe = ctrtempSe;
	}
	public int getCtrtempHdpy() {
		return ctrtempHdpy;
	}
	public void setCtrtempHdpy(int ctrtempHdpy) {
		this.ctrtempHdpy = ctrtempHdpy;
	}
	public int getCtrtempTx() {
		return ctrtempTx;
	}
	public void setCtrtempTx(int ctrtempTx) {
		this.ctrtempTx = ctrtempTx;
	}
	public String getCmncdCd() {
		return cmncdCd;
	}
	public void setCmncdCd(String cmncdCd) {
		this.cmncdCd = cmncdCd;
	}
	
	
	
	public String getOpt() {
		return opt;
	}
	public void setOpt(String opt) {
		this.opt = opt;
	}
	public String getDptopt() {
		return dptopt;
	}
	public void setDptopt(String dptopt) {
		this.dptopt = dptopt;
	}
	public String getLelopt() {
		return lelopt;
	}
	public void setLelopt(String lelopt) {
		this.lelopt = lelopt;
	}
	
	
	public int getRnum() {
		return rnum;
	}
	public void setRnum(int rnum) {
		this.rnum = rnum;
	}
	public MultipartFile[] getUploadFile() {
		return uploadFile;
	}
	public void setUploadFile(MultipartFile[] uploadFile) {
		this.uploadFile = uploadFile;
	}
	public List<AttachFilesVO> getAttachFilesVO() {
		return attachFilesVO;
	}
	public void setAttachFilesVO(List<AttachFilesVO> attachFilesVO) {
		this.attachFilesVO = attachFilesVO;
	}
	
	
	public String getUploadFileName() {
		return uploadFileName;
	}
	public void setUploadFileName(String uploadFileName) {
		this.uploadFileName = uploadFileName;
	}
	
	
	public String getEmpTel() {
		return empTel;
	}
	public void setEmpTel(String empTel) {
		this.empTel = empTel;
	}
	@Override
	public String toString() {
		return "EmpVO [empId=" + empId + ", empNm=" + empNm + ", empJncmpYmd=" + empJncmpYmd + ", empBrdt=" + empBrdt
				+ ", empMail=" + empMail + ", empPswd=" + empPswd + ", empImg=" + empImg + ", empIp=" + empIp
				+ ", empActno=" + empActno + ", empSe=" + empSe + ", rglrempCrtrpy=" + rglrempCrtrpy + ", rglrempBns="
				+ rglrempBns + ", rglrempFdpy=" + rglrempFdpy + ", rglrempCrpy=" + rglrempCrpy + ", rglrempBbpy="
				+ rglrempBbpy + ", ctrtempHrpy=" + ctrtempHrpy + ", ctrtempTm=" + ctrtempTm + ", ctrtempSe=" + ctrtempSe
				+ ", ctrtempHdpy=" + ctrtempHdpy + ", ctrtempTx=" + ctrtempTx + ", cmncdCd=" + cmncdCd + ", empTel="
				+ empTel + ", empPwsd=" + empPwsd + ", opt=" + opt + ", dptopt=" + dptopt + ", lelopt=" + lelopt
				+ ", rnum=" + rnum + ", uploadFile=" + Arrays.toString(uploadFile) + ", uploadFileName="
				+ uploadFileName + ", attachFilesVO=" + attachFilesVO + "]";
	}

}

mapper.xml

<select id="emplist" resultType="EmpVO">
		SELECT T.RNUM, T.EMP_ID,T.EMP_NM , T.EMP_SE, T.CMNCD_CD
		FROM (
		    SELECT ROW_NUMBER() OVER (ORDER BY EMP_ID) RNUM, EMP_ID, EMP_NM, EMP_SE, CMNCD_CD
		    FROM   EMP
	               WHERE  1 = 1
		   <if test="keyWord!=null and keyWord!=''">
			    AND    (EMP_ID LIKE '%'||#{keyWord}||'%'
			    OR     EMP_NM LIKE '%'||#{keyWord}||'%' )
		  </if>
		) T
		WHERE T.RNUM BETWEEN #{currentPage}*7-6 AND #{currentPage}*7
	</select>

<select id="selectCount" parameterType="hashMap" resultType="int">
		SELECT COUNT(*)
		FROM   EMP
		WHERE  1 = 1
	    <if test="keyWord!=null and keyWord!=''">
		    AND    (EMP_ID LIKE '%'||#{keyWord}||'%'
			OR     EMP_NM LIKE '%'||#{keyWord}||'%' )
	    </if>
</select>

<select id="sdselect" parameterType="String" resultType="cmncdVO">
		SELECT CMNCD_GU_NM, CMNCD_NM1, CMNCD_NM2
		FROM CMNCD
		WHERE CMNCD_CD = #{cmncdCd}
	</select>

mapper.interface

// 고객목록
	public List<EmpVO> emplist(Map<String, Object> map);
		
		
// 행의 수
	public int selectCount(Map<String,Object> map) ;

service.java

// 직원 목록
	public List<EmpVO> emplist(Map<String, Object> map);
		
			
// 행의 수
public int selectCount(Map<String,Object> map) ;

service.impl

@Override
	public String cdselect(EmpVO empVO) {
		return empMapper.cdselect(empVO);
	}

	@Override
	public List<EmpVO> emplist(Map<String, Object> map) {
		return empMapper.emplist(map);
	}

controller

  • 공통코드에 따라 소속, 부서, 직급을 EmpVO에 넣어줘야 했는데,, 페이징 기능때문에 emplist값의 결과(EmpVO)를 List list에 넣어줘야했다.
    그래서 EmpVO에 소속, 부서, 직급을 넣어주기 위해 반복문을 통해 empVO에 set해줘서 해결했다
@RequestMapping("/emp")
@Controller
public class EmpController {
	@Autowired
	EmpService empService;
	
	private static final Logger logger = 
			LoggerFactory.getLogger(EmpController.class);

@GetMapping("/emplist")
	public String emplist(Model model, @RequestParam(defaultValue="1") int currentPage
			, @RequestParam(required=false) String keyWord
			, @RequestParam(defaultValue="7",required=false) int size, @RequestParam Map<String,Object> map) {	
		
		map.put("keyWord", keyWord);
		map.put("currentPage", currentPage);
		map.put("size", size);

		//직원 목록
		List<EmpVO> list = this.empService.emplist(map);
		for(EmpVO empVO : list) {
			CmncdVO cmncdVO = new CmncdVO(); 
			cmncdVO = empService.sdselect(empVO.getCmncdCd());
			
			empVO.setOpt(cmncdVO.getCmncdGuNm());
			empVO.setDptopt(cmncdVO.getCmncdNm1());
			empVO.setLelopt(cmncdVO.getCmncdNm2());
			logger.info("제발!!!!!!!!!!"+ empVO.toString());
		}
		
		logger.info("list능 ?" + list.toString());
		
		int total = this.empService.selectCount(map);
		model.addAttribute("list", 
				new ArticlePage(total, currentPage, size, 5, list));
		model.addAttribute("total", total);
		
		model.addAttribute("data", list);
		
		//forwarding
		return "emp/emplist";
	}
}

emplist.jsp

  • 검색 기능구현에서 검색 button의 type을 submit으로 안해서 검색이 안먹혔다
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>


<script type="text/javascript">
	function fn_click(){
		location.href="/emp/empinsert"
	}
	
	
    function fn_submit(){
    	
	    var frm = document.searchForm;
	    console.log("frm.size : " + frm.size.value);
	    console.log("frm.keyWord : " + frm.keyWord.value);
	    frm.submit();
	   }
	
</script>

    <!-- start page title -->
    <div class="row">
        <div class="col-12">
            <div class="page-title-box d-sm-flex align-items-center justify-content-between">
                <h4 class="mb-sm-0 font-size-18">직원관리</h4>

                <div class="page-title-right">
                    <ol class="breadcrumb m-0">
                        <li class="breadcrumb-item"><a href="javascript: void(0);">Ecommerce</a></li>
                        <li class="breadcrumb-item active">Checkout</li>
                    </ol>
                </div>

            </div>
        </div>
    </div>
    <!-- end page title -->

    <div class="checkout-tabs">
            <div class="row">
                <div class="col-xl-2 col-sm-3">
                    <div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical">
                      
                        <a class="nav-link active" id="v-pills-confir-tab" data-bs-toggle="pill" href="#" role="tab" aria-controls="v-pills-confir" aria-selected="true">
                            <i class="mdi mdi-account d-block check-nav-icon mt-4 mb-2"></i>
                            <p class="fw-bold mb-4">직원조회</p>
                        </a>
                        <a class="nav-link" id="v-pills-shipping-tab" data-bs-toggle="pill" href="#"  role="tab" aria-controls="v-pills-shipping" aria-selected="false" onclick="fn_click()">
                            <i class="mdi mdi-account-check d-block check-nav-icon mt-4 mb-2"></i>
                            <p class="fw-bold mb-4">직원등록</p>
                        </a>
                    </div>
                </div>
                
 <div class="col-xl-10 col-sm-9">
         <div class="card">
             <div class="card-body">
             
                 <div class="tab-content" id="v-pills-tabContent">
                     <div class="tab-pane fade active show" id="v-pills-shipping" role="tabpanel" aria-labelledby="v-pills-shipping-tab">
                         <div>
                             <h4 class="card-title">직원조회</h4>
                             <!-- 검색  -->
                             <form name="searchForm" id="searchForm" action="/emp/emplist" method="get">
                             <div>
                                            <input type="search"  name="keyWord" id="keyWord" value="${param.keyWord}" placeholder="사번(ID) 또는 이름을 입력해주세요" aria-label="Add your item here...">
                                            	<!--  제발 submit 해주시궜어요????????? -->
                                            <button type="submit" class="btn btn-secondary" onclick="fn_submit()">검색</button>
                                            <div class="vr"></div>
                                            <button type="button" class="btn btn-outline-danger">Reset</button>
                              </div>
                              </form>
                             <!-- 검색끝  -->
                                             
 <div class="row">
<div class="col-lg-12">
    <div class="card">
        <div class="card-body">
            <div>
                <table class="table align-middle table-nowrap table-hover" >
                    <thead class="table-light">
                        <tr>
                            <th scope="col" style="width: 70px;">No</th>
                                   <th scope="col">직원명</th>
                                   <th scope="col">ID</th>
                                   <th scope="col">소속</th>
                                   <th scope="col">직급</th>
                                   <th scope="col">구분</th>
                               </tr>
                           </thead>
                           <tbody>
                           <c:set var="i" value="${list.currentPage*7-6-1}" />
           					<c:forEach items="${data}" var="data">
                           
                               <tr onClick="location.href='/emp/empdetail?empId=${data.empId}'">
                                   <td>
                                       <div class="avatar-xs" >
                                           <span class="avatar-title rounded-circle" >
                                               ${data.rnum}
                                           </span>
                                       </div>
                                   </td>
                                   <td>
                                       <h5 class="font-size-16 mb-1"><a href="javascript: void(0);" class="text-dark">${data.empId}</a></h5>
                                       <p class="text-muted mb-0">지점</p>
                                   </td>
                                   <td>  <h5 class="font-size-16 mb-1"><a href="javascript: void(0);" class="text-dark">${data.empNm}</a></h5></td>
                                   <td>
                                       <div>
                                           <a href="javascript: void(0);" class="badge badge-soft-primary font-size-15 m-1">${data.opt}</a>
                                           <a href="javascript: void(0);" class="badge badge-soft-primary font-size-15 m-1">${data.dptopt}</a>
                                       </div>
                                   </td>
                                   <td>
                                        <h5 class="font-size-16 mb-1"><a href="javascript: void(0);" class="text-dark">${data.lelopt}</a></h5>
                                   </td>
                                   <td>
                                         <h5 class="font-size-16 mb-1"><a href="javascript: void(0);" class="text-dark">${data.empSe}</a></h5>
                                   </td>
                               </tr>
                               
                               </c:forEach>
                           </tbody>
                       </table>
                   </div>
                   
                   <!-- 페이징 처리 시작  -->
                   <div class="row">
                       <div class="col-lg-12">
                           <ul class="pagination pagination-rounded justify-content-center mt-4">
                               <li class="page-item disabled <c:if test='${list.startPage<6}'>disabled</c:if>" >
                                   <a href="/emp/emplist?currentPage=${list.startPage-5}" class="page-link"><i class="mdi mdi-chevron-left"></i></a>
                               </li>
                               
                               <c:forEach var="pNo" begin="${list.startPage}" end="${list.endPage}" step="1">
                               <li class="page-item <c:if test='${list.currentPage eq pNo}'>active</c:if> " >
                                   <a href="/emp/emplist?currentPage=${pNo}" class="page-link">${pNo}</a>
                               </li>       
                               </c:forEach> 
                                                   
                               <li class="page-item <c:if test='${list.endPage>=list.totalPages}'>disabled</c:if> "  > 
                                   <a href="/emp/emplist?currentPage=${list.startPage+5}" class="page-link"><i class="mdi mdi-chevron-right"></i></a>
                               </li>
                           </ul>
                       </div>
                   </div>
                   <!-- 페이징 처리 끝  -->
               </div>
           </div>
       </div>
   </div>
                                                </div>
                                            </div>
                                            
                                            
                                        </div>
                                    </div>
                                </div>
                                
                            </div>
    </div>
</div>
        <!-- end row -->
        
        <script src="assets/libs/jquery/jquery.min.js"></script>
        <script src="assets/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
        <script src="assets/libs/metismenu/metisMenu.min.js"></script>
        <script src="assets/libs/simplebar/simplebar.min.js"></script>
        <script src="assets/libs/node-waves/waves.min.js"></script>
        <script src="assets/js/app.js"></script>
        
     

직원 등록

  • 파일 , select옵션 기능

AttachFilesVO

package kr.or.tco.emp.vo;

import java.util.Date;

import org.springframework.stereotype.Repository;

@Repository
public class AttachFilesVO {

	private int atchfileId; // 파일 ID
	private String atchfileNm; // 파일명
	private String atchfileSz; // 파일 크기
	private String atchfileDt; // 파일 등록일
	private String cmncdCd;
	
	private String uploadFileName;
	private String uploadFileSize;
	
	public int getAtchfileId() {
		return atchfileId;
	}
	public void setAtchfileId(int atchfileId) {
		this.atchfileId = atchfileId;
	}
	public String getAtchfileNm() {
		return atchfileNm;
	}
	public void setAtchfileNm(String atchfileNm) {
		this.atchfileNm = atchfileNm;
	}
	public String getAtchfileSz() {
		return atchfileSz;
	}
	public void setAtchfileSz(String atchfileSz) {
		this.atchfileSz = atchfileSz;
	}
	
	public String getAtchfileDt() {
		return atchfileDt;
	}
	public void setAtchfileDt(String atchfileDt) {
		this.atchfileDt = atchfileDt;
	}

	
	public String getCmncdCd() {
		return cmncdCd;
	}
	public void setCmncdCd(String cmncdCd) {
		this.cmncdCd = cmncdCd;
	}
	
	
	public String getUploadFileName() {
		return uploadFileName;
	}
	public void setUploadFileName(String uploadFileName) {
		this.uploadFileName = uploadFileName;
	}
	public String getUploadFileSize() {
		return uploadFileSize;
	}
	public void setUploadFileSize(String uploadFileSize) {
		this.uploadFileSize = uploadFileSize;
	}
	
	
	@Override
	public String toString() {
		return "AttachFilesVO [atchfileId=" + atchfileId + ", atchfileNm=" + atchfileNm + ", atchfileSz=" + atchfileSz
				+ ", atchfileDt=" + atchfileDt + ", cmncdCd=" + cmncdCd + "]";
	}

	
}

mapper.xml

<insert id="empinsert" parameterType="empVO">
		
			<selectKey order="BEFORE" keyProperty="empId" resultType="String">
				SELECT 'EMP' || LPAD(NVL(MAX(SUBSTR(EMP_ID,4)),0)+1,5,'0') FROM EMP
			</selectKey>
			INSERT INTO EMP(EMP_ID, EMP_NM,  EMP_BRDT, EMP_MAIL, EMP_JNCMP_YMD,
	      					 EMP_PSWD, EMP_IP, EMP_ACTNO, EMP_SE, CMNCD_CD , EMP_IMG , EMP_TEL)
			VALUES(#{empId},#{empNm},#{empBrdt},#{empMail}, #{empJncmpYmd},
			#{empPswd},#{empIp},#{empActno},#{empSe}, #{cmncdCd}, #{empImg}, #{empTel})
	</insert>

	<!-- attach_files 테이블로 첨부파일 insert -->
	<insert id="insertAttachFiles" parameterType="attachFilesVO">
		<selectKey order="BEFORE" keyProperty="atchfileId" resultType="Integer">
			SELECT NVL(MAX(ATCHFILE_ID),0)+1 FROM ATCHFILE
		</selectKey>			
		INSERT INTO ATCHFILE (ATCHFILE_ID, ATCHFILE_NM, ATCHFILE_SZ, ATCHFILE_DT ) 
		VALUES (#{atchfileId}, #{atchfileNm}, #{atchfileSz}, SYSDATE)		
	</insert>
	
	<select id="cdselect" parameterType="empVO" resultType="String">
		SELECT CMNCD_CD 
		FROM CMNCD
		WHERE CMNCD_GU_NM = #{opt}
	    AND CMNCD_NM1 = #{dptopt}
        AND CMNCD_NM2 = #{lelopt}
	</select>

mapper.interface

public int empinsert(EmpVO empVO);
	
public int insertAttachFiles(AttachFilesVO attachFilesVO);
		
public String cdselect(EmpVO empVO);

service

public int empinsert(EmpVO empVO);

public int insertAttachFiles(AttachFilesVO attachFilesVO);
	
public String cdselect(EmpVO empVO);

service.impl

@Override
	public int empinsert(EmpVO empVO) {
		
			return empMapper.empinsert(empVO);
	}

	@Override
	public int insertAttachFiles(AttachFilesVO attachFilesVO) {
		return empMapper.insertAttachFiles(attachFilesVO);
	}

	@Override
	public String cdselect(EmpVO empVO) {
		return empMapper.cdselect(empVO);
	}

controller

@RequestMapping("/emp")
@Controller
public class EmpController {

	@Autowired
	EmpService empService;
	
	private static final Logger logger = 
			LoggerFactory.getLogger(EmpController.class);
 
 @GetMapping("/empinsert")
	public String getempinsert(Model model) {
	
		model.addAttribute("empVO", new EmpVO());
		return "emp/empinsert";
	}

		
	
	@PostMapping("/empinsert")
	public String postempinsert(EmpVO empVO) {
		
		logger.info("empVo는: "+ empVO);
		
		String cmncdCd = empService.cdselect(empVO);
		logger.info(cmncdCd);
		empVO.setCmncdCd(cmncdCd);
		
		
		//업로드한 파일 
		MultipartFile[] uploadFile = empVO.getUploadFile();
				
		//파일 저장 경로 설정
		String uploadFolder = 
		"D:\\A_TeachingMaterial\\6.JspSpring\\workspace\\TCO\\src\\main\\webapp\\resources\\upload";
		
		//연/월/일 폴더 생성 시작-------
		File uploadPath = new File(uploadFolder, getFolder());
		logger.info("uploadPath : " + uploadPath);
				
		if(uploadPath.exists()==false) {//해당 경로가 없으면 생성해줘야함
			uploadPath.mkdirs();			
		}
		//연/월/일 폴더 생성 끝-------
		
		
		AttachFilesVO vo = new AttachFilesVO();
	
		
		//이미지 3개를 업로드 한다면 3회 반복
		for(MultipartFile multipartFile : uploadFile) {
			logger.info("-----------");
			logger.info("파일명 : " + multipartFile.getOriginalFilename());
			logger.info("파일크기 : " + multipartFile.getSize());
			
			//각 파일 별로 세팅할 VO 
			
			
			//1) 파일id(기본키데이터), 파일시퀀스번호,파일명과 크기를 세팅
			
			vo.setAtchfileSz(""+multipartFile.getSize());
			vo.setAtchfileNm( multipartFile.getOriginalFilename());
			
			
			
			//-----------UUID 파일명 처리 시작 ----------------------------
			//동일한 이름으로 업로드되면 기존 파일을 지우게 되므로 이를 방지하기 위함
			UUID uuid = UUID.randomUUID();
			
			String uploadFileName = uuid.toString() + "-" + multipartFile.getOriginalFilename();
			// c:\\upload\\gongu03.jpg으로 조립
			// 이렇게 업로드 하겠다라고 설계 uploadFolder -> uploadPath
			// /resources/upload/2022/02/21/asdfsadfsdafsda_test.jpg
			vo.setUploadFileName("/resources/upload/" + getFolder() + "/" + uploadFileName);
			
			empVO.setEmpImg("/resources/upload/" + getFolder() + "/" + uploadFileName);
			
			File saveFile = new File(uploadPath,uploadFileName);
			//-----------UUID 파일명 처리 끝 ----------------------------
			
			try {
				//transferTo() : 물리적으로 파일 업로드가 됨
				multipartFile.transferTo(saveFile);
			
				
				
				
			}catch(Exception e){
				logger.info(e.getMessage());
			}//end catch
		}
		
		
		logger.info("attachFilesVO능?!" + vo);
		
		//attach_files 테이블로 insert
		empService.insertAttachFiles(vo);
				 
				
		logger.info("empVo는2: "+ empVO);
		int intresult = empService.empinsert(empVO);
		
		if(intresult>0) { //고객 등록 성공
			
			// 목록으로 이동
			return "redirect:/emp/emplist";
			
		}else {
			return "emp/empinsert";
		}
	}

	
 }

empinsert.jsp

  • select 옵션에서 본사와 지점에 따라 다음 select 옵션이 달라져야 해서 onclick이벤트를 주어 설정해주고 옵션의 value값을 넘겨주어 cdselect문을 실행해줌
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page import = "java.util.Calendar" %>

<%
	String Today = new java.text.SimpleDateFormat("yyyy-MM-dd").format(new java.util.Date());
%>
 <c:set value="<%=Today%>" var="Today" />
<script type="text/javascript">
function typeChange(e) {
	
    var c = ["인사(PM)", "기획(PL)", "영업(BU)", "물류(DT)"];
    var b = ["관리(AD)", "창고(WM)", "매장(SM)"];
   
    
    var cc = ["부장", "과장", "대리", "사원"];
    var bb = [ "팀장", "직원"];
    
    var target = document.getElementById("typeD");
    var targett = document.getElementById("typeDD");
    
    if(e.value == "본사") var d = c; 
    else if(e.value == "지점") var d = b;
    
    if(e.value == "본사") var dd = cc; 
    else if(e.value == "지점") var dd = bb; 
    
	/*  option이 중첩되지 않게 해준드아 */
    target.options.length = 0;
    targett.options.length = 0;
    

    for (x in d) {
        var opt = document.createElement("option");
        opt.value = d[x];
        opt.innerHTML = d[x];
        target.appendChild(opt);
    }   
    
    for (x in dd) {
    	//targett.empty();
        var opt = document.createElement("option");
        opt.value = dd[x];
        opt.innerHTML = dd[x];
        targett.appendChild(opt);
    }   
}

function fn_click(){
	
	location.href="/emp/emplist"
}

</script>


    <!-- start page title -->
    <div class="row">
        <div class="col-12">
            <div class="page-title-box d-sm-flex align-items-center justify-content-between">
                <h4 class="mb-sm-0 font-size-18">직원관리</h4>

                <div class="page-title-right">
                    <ol class="breadcrumb m-0">
                        <li class="breadcrumb-item"><a href="javascript: void(0);">Ecommerce</a></li>
                        <li class="breadcrumb-item active">Checkout</li>
                    </ol>
                </div>

            </div>
        </div>
    </div>
    <!-- end page title -->

    <div class="checkout-tabs">
            <div class="row">
                <div class="col-xl-2 col-sm-3">
                    <div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical">
                      
                        <a class="nav-link" id="v-pills-confir-tab" data-bs-toggle="pill" href="#" role="tab" aria-controls="v-pills-confir" aria-selected="false" onclick="fn_click()">
                             <i class="mdi mdi-account d-block check-nav-icon mt-4 mb-2"></i>
                            <p class="fw-bold mb-4">직원조회</p>
                        </a>
                        <a class="nav-link active" id="v-pills-shipping-tab" data-bs-toggle="pill" href="#v-pills-shipping" role="tab" aria-controls="v-pills-shipping" aria-selected="true">
                            <i class="mdi mdi-account-check d-block check-nav-icon mt-4 mb-2"></i>
                            <p class="fw-bold mb-4">직원등록</p>
                        </a>
                    </div>
                </div>
                
                <div class="col-xl-10 col-sm-9">
                    <div class="card">
                        <div class="card-body">
                            <div class="tab-content" id="v-pills-tabContent">
                                <div class="tab-pane fade active show" id="v-pills-shipping" role="tabpanel" aria-labelledby="v-pills-shipping-tab">
                                    <div>
                                        <h4 class="card-title">직원관리</h4>
                                        <p class="card-title-desc">직원등록</p>
                                        <!-- ****************** FORM  시작 ****************  -->
                                        <form:form modelAttribute="empVO" method="post" action="/emp/empinsert" enctype="multipart/form-data">  
                                            <div class="form-group row mb-4">
                                                <label for="billing-name" class="col-md-2 col-form-label">이름</label>
                                                <div class="col-md-10">
                                                    <form:input path="empNm" class="form-control"  placeholder="Enter your name" />
                                                </div>
                                            </div>
                                            
                                            
                                            <div class="mb-3 row">
                                            <label for="example-date-input" class="col-md-2 col-form-label" >생년월일</label>
                                            <div class="col-md-10">
                                                <form:input path="empBrdt" class="form-control" type="date" value="${Today}" id="example-date-input"  />
                                            </div>
                                        </div>
                                        
                                   <div class="mt-3">
                                                        <label for="formFile" class="form-label">프로필 사진</label>
                                                        <input class="form-control" type="file" id="empImg" name="uploadFile">
                                       </div>
                                                
                                           <div class="form-group row mb-4">
                                                <label class="col-md-2 col-form-label">직급</label>
                                                <div class="col-md-10">
                                                <label class="col-md-2 col-form-label" for="type">[유형]</label>
                                                    <form:select path ="opt" class="form-control select2 select2-hidden-accessible" title="Country" data-select2-id="4" tabindex="-1" aria-hidden="true" onchange="typeChange(this)">
                                                        <option value="0" data-select2-id="6">유형을 선택해주세요</option>
                                                        <option value="본사">본사</option>
                                                        <option value="지점">지점</option>
                                                       
                                                   </form:select>
                                                    <!-- <span class="select2 select2-container select2-container--default" dir="ltr" data-select2-id="5" style="width: 1085.7px;"><span class="selection">
                                                    <span class="select2-selection select2-selection--single" role="combobox" aria-haspopup="true" aria-expanded="false" title="Country" tabindex="0" aria-disabled="false" aria-labelledby="select2-d39j-container">
                                                    <span class="select2-selection__rendered" id="select2-d39j-container" role="textbox" aria-readonly="true" title="Select States">Select States</span>
                                                    <span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span></span></span>
                                                    <span class="dropdown-wrapper" aria-hidden="true"></span></span> -->
                                                     <label class="col-md-2 col-form-label" for="typeD">[부서]</label>
                                                      <form:select path="dptopt" class="form-control select2 select2-hidden-accessible" title="Country" data-select2-id="4" tabindex="-1" aria-hidden="true" id="typeD" name="typeD">
                                                        <option value="0" data-select2-id="6">부서를 선택해주세요</option>
                                                      </form:select>
                                                      
                                                      
                                                     <label class="col-md-2 col-form-label" for="typeDD">[직급]</label>
															<form:select path="lelopt" class="form-control select2 select2-hidden-accessible" title="Country" data-select2-id="4" tabindex="-1" aria-hidden="true" name="typeDD" id="typeDD">
															 <option value="0" data-select2-id="6">직급을 선택해주세요</option>
															</form:select>
                                                </div>
                                            </div>
                                            <div class="mb-3 row">
                                            <label for="example-date-input" class="col-md-2 col-form-label">입사일</label>
                                            <div class="col-md-10">
                                                <form:input path="empJncmpYmd" class="form-control" type="date" value="${Today}" />
                                            </div>
                                        </div>
                                        
                                        
                                        <div class="form-group row mb-4">
                                                <label for="billing-email-address" class="col-md-2 col-form-label">연락처</label>
                                                <div class="col-md-10">
                                                    <form:input path ="empTel"  class="form-control" placeholder="Enter your tel" />
                                                </div>
                                            </div>
                                            
                                            
                                            <div class="form-group row mb-4">
                                                <label for="billing-email-address" class="col-md-2 col-form-label">Email Address</label>
                                                <div class="col-md-10">
                                                    <form:input path ="empMail" type="email" class="form-control" placeholder="Enter your email" />
                                                </div>
                                            </div>
                                            
                                            <div class="mb-3 row">
                                            <label for="example-password-input" class="col-md-2 col-form-label">비밀번호</label>
                                            <div class="col-md-10">
                                                <form:input path="empPswd" class="form-control" type="password" value="hunter2" placeholder="Enter Password" />
                                            </div>
                                        </div>
                                        
                                            <div class="form-group row mb-4">
                                                <label for="billing-phone" class="col-md-2 col-form-label">IP주소</label>
                                                <div class="col-md-10">
                                                    <form:input path="empIp" type="text" class="form-control" placeholder="Enter your Phone no." />
                                                </div>
                                            </div>
                                            
                                            <div class="form-group row mb-4">
                                                <label for="billing-phone" class="col-md-2 col-form-label">계좌번호</label>
                                                <div class="col-md-10">
                                                    <form:input path ="empActno" type="text" class="form-control"  placeholder="Enter your Phone no." />
                                                </div>
                                            </div>
                                            
                                            <div class="col-xl-3 col-sm-6">
                                                <div class="mt-4">
                                                    <label for="billing-phone" class="col-md-2 col-form-label">직원유형</label>
                                                    <div>
                                                        <div class="form-check form-check-right mb-3">
                                                            <form:radiobutton path="empSe" class="form-check-input"  checked="" value="정규직" name="정규직"  />
                                                            <label class="form-check-label" for="formRadiosRight1" >정규직</label>
                                                            
                                                        </div>
                                                        <div class="form-check form-check-right mb-3">
                                                            <form:radiobutton path="empSe" class="form-check-input"  checked=""  value="비정규직" name="비정규직" />
                                                            <label class="form-check-label" for="formRadiosRight1" >비정규직</label>
                                                            
                                                        </div>
                                                        <div class="form-check form-check-right mb-3">
                                                            <form:radiobutton path="empSe" class="form-check-input"  checked=""  value="퇴사" name="퇴사" />
                                                            <label class="form-check-label" for="formRadiosRight1" >퇴사</label>
                                                            
                                                        </div>
                                                    </div>


                                                </div>
                                            </div>
                                         <div class="col-sm-6">
		                            <div class="text-end">
		                             <!--    <a href="ecommerce-checkout.html" class="btn btn-success">
		                                    <i class="mdi mdi-truck-fast me-1"></i> Proceed to Shipping </a> -->
		                                    <button type="submit" class="btn btn-primary waves-effect waves-light w-sm">
		                                       <i class="mdi mdi-download d-block font-size-10"></i> 저장
		                                   </button>
		                            </div>
		                        </div> <!-- end col -->
                                            
                                        </form:form>
                                    </div>
                                </div>
                                
                                
                                <div class="tab-pane fade" id="v-pills-confir" role="tabpanel" aria-labelledby="v-pills-confir-tab">
                                	
                                	<div class="row">
                            <div class="col-lg-12">
                                <div class="card">
                                    <div class="card-body">
                                        <div class="table-responsive">
                                            <table class="table align-middle table-nowrap table-hover">
                                                <thead class="table-light">
                                                    <tr>
                                                        <th scope="col" style="width: 70px;">#</th>
                                                        <th scope="col">Name</th>
                                                        <th scope="col">Email</th>
                                                        <th scope="col">Tags</th>
                                                        <th scope="col">Projects</th>
                                                        <th scope="col">Action</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <tr>
                                                        <td>
                                                            <div class="avatar-xs">
                                                                <span class="avatar-title rounded-circle">
                                                                    D
                                                                </span>
                                                            </div>
                                                        </td>
                                                        <td>
                                                            <h5 class="font-size-14 mb-1"><a href="javascript: void(0);" class="text-dark">David McHenry</a></h5>
                                                            <p class="text-muted mb-0">UI/UX Designer</p>
                                                        </td>
                                                        <td>[email protected]</td>
                                                        <td>
                                                            <div>
                                                                <a href="javascript: void(0);" class="badge badge-soft-primary font-size-11 m-1">Photoshop</a>
                                                                <a href="javascript: void(0);" class="badge badge-soft-primary font-size-11 m-1">illustrator</a>
                                                            </div>
                                                        </td>
                                                        <td>
                                                            125
                                                        </td>
                                                        <td>
                                                            <ul class="list-inline font-size-20 contact-links mb-0">
                                                                <li class="list-inline-item px-2">
                                                                    <a href="javascript: void(0);" title="Message"><i class="bx bx-message-square-dots"></i></a>
                                                                </li>
                                                                <li class="list-inline-item px-2">
                                                                    <a href="javascript: void(0);" title="Profile"><i class="bx bx-user-circle"></i></a>
                                                                </li>
                                                            </ul>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <div>
                                                                <img class="rounded-circle avatar-xs" src="assets/images/users/avatar-2.jpg" alt="">
                                                            </div>
                                                        </td>
                                                        <td>
                                                            <h5 class="font-size-14 mb-1"><a href="javascript: void(0);" class="text-dark">Frank Kirk</a></h5>
                                                            <p class="text-muted mb-0">Frontend Developer</p>
                                                        </td>
                                                        <td>[email protected]</td>
                                                        <td>
                                                            <div>
                                                                <a href="javascript: void(0);" class="badge badge-soft-primary font-size-11 m-1">Html</a>
                                                                <a href="javascript: void(0);" class="badge badge-soft-primary font-size-11 m-1">Css</a>
                                                                <a href="javascript: void(0);" class="badge badge-soft-primary font-size-11 m-1">2 + more</a>
                                                            </div>
                                                        </td>
                                                        <td>
                                                            132
                                                        </td>
                                                        <td>
                                                            <ul class="list-inline font-size-20 contact-links mb-0">
                                                                <li class="list-inline-item px-2">
                                                                    <a href="javascript: void(0);" title="Message"><i class="bx bx-message-square-dots"></i></a>
                                                                </li>
                                                                <li class="list-inline-item px-2">
                                                                    <a href="javascript: void(0);" title="Profile"><i class="bx bx-user-circle"></i></a>
                                                                </li>
                                                            </ul>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <div>
                                                                <img class="rounded-circle avatar-xs" src="assets/images/users/avatar-3.jpg" alt="">
                                                            </div>
                                                        </td>
                                                        <td>
                                                            <h5 class="font-size-14 mb-1"><a href="javascript: void(0);" class="text-dark">Rafael Morales</a></h5>
                                                            <p class="text-muted mb-0">Backend Developer</p>
                                                        </td>
                                                        <td>[email protected]</td>
                                                        <td>
                                                            <div>
                                                                <a href="javascript: void(0);" class="badge badge-soft-primary font-size-11 m-1">Php</a>
                                                                <a href="javascript: void(0);" class="badge badge-soft-primary font-size-11 m-1">Java</a>
                                                                <a href="javascript: void(0);" class="badge badge-soft-primary font-size-11 m-1">Python</a>
                                                            </div>
                                                        </td>
                                                        <td>
                                                            112
                                                        </td>
                                                        <td>
                                                            <ul class="list-inline font-size-20 contact-links mb-0">
                                                                <li class="list-inline-item px-2">
                                                                    <a href="javascript: void(0);" title="Message"><i class="bx bx-message-square-dots"></i></a>
                                                                </li>
                                                                <li class="list-inline-item px-2">
                                                                    <a href="javascript: void(0);" title="Profile"><i class="bx bx-user-circle"></i></a>
                                                                </li>
                                                            </ul>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <div class="avatar-xs">
                                                                <span class="avatar-title rounded-circle">
                                                                    M
                                                                </span>
                                                            </div>
                                                        </td>
                                                        <td>
                                                            <h5 class="font-size-14 mb-1"><a href="javascript: void(0);" class="text-dark">Mark Ellison</a></h5>
                                                            <p class="text-muted mb-0">Full Stack Developer</p>
                                                        </td>
                                                        <td>[email protected]</td>
                                                        <td>
                                                            <div>
                                                                <a href="javascript: void(0);" class="badge badge-soft-primary font-size-11 m-1">Ruby</a>
                                                                <a href="javascript: void(0);" class="badge badge-soft-primary font-size-11 m-1">Php</a>
                                                                <a href="javascript: void(0);" class="badge badge-soft-primary font-size-11 m-1">2 + more</a>
                                                            </div>
                                                        </td>
                                                        <td>
                                                            121
                                                        </td>
                                                        <td>
                                                            <ul class="list-inline font-size-20 contact-links mb-0">
                                                                <li class="list-inline-item px-2">
                                                                    <a href="javascript: void(0);" title="Message"><i class="bx bx-message-square-dots"></i></a>
                                                                </li>
                                                                <li class="list-inline-item px-2">
                                                                    <a href="javascript: void(0);" title="Profile"><i class="bx bx-user-circle"></i></a>
                                                                </li>
                                                            </ul>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <div>
                                                                <img class="rounded-circle avatar-xs" src="assets/images/users/avatar-4.jpg" alt="">
                                                            </div>
                                                        </td>
                                                        <td>
                                                            <h5 class="font-size-14 mb-1"><a href="javascript: void(0);" class="text-dark">Minnie Walter</a></h5>
                                                            <p class="text-muted mb-0">Frontend Developer</p>
                                                        </td>
                                                        <td>[email protected]</td>
                                                        <td>
                                                            <div>
                                                                <a href="javascript: void(0);" class="badge badge-soft-primary font-size-11 m-1">Html</a>
                                                                <a href="javascript: void(0);" class="badge badge-soft-primary font-size-11 m-1">Css</a>
                                                                <a href="javascript: void(0);" class="badge badge-soft-primary font-size-11 m-1">2 + more</a>
                                                            </div>
                                                        </td>
                                                        <td>
                                                            145
                                                        </td>
                                                        <td>
                                                            <ul class="list-inline font-size-20 contact-links mb-0">
                                                                <li class="list-inline-item px-2">
                                                                    <a href="javascript: void(0);" title="Message"><i class="bx bx-message-square-dots"></i></a>
                                                                </li>
                                                                <li class="list-inline-item px-2">
                                                                    <a href="javascript: void(0);" title="Profile"><i class="bx bx-user-circle"></i></a>
                                                                </li>
                                                            </ul>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <div>
                                                                <img class="rounded-circle avatar-xs" src="assets/images/users/avatar-5.jpg" alt="">
                                                            </div>
                                                        </td>
                                                        <td>
                                                            <h5 class="font-size-14 mb-1"><a href="javascript: void(0);" class="text-dark">Shirley Smith</a></h5>
                                                            <p class="text-muted mb-0">UI/UX Designer</p>
                                                        </td>
                                                        <td>[email protected]</td>
                                                        <td>
                                                            <div>
                                                                <a href="javascript: void(0);" class="badge badge-soft-primary font-size-11 m-1">Photoshop</a>
                                                                <a href="javascript: void(0);" class="badge badge-soft-primary font-size-11 m-1">illustrator</a>
                                                            </div>
                                                        </td>
                                                        <td>
                                                            136
                                                        </td>
                                                        <td>
                                                            <ul class="list-inline font-size-20 contact-links mb-0">
                                                                <li class="list-inline-item px-2">
                                                                    <a href="javascript: void(0);" title="Message"><i class="bx bx-message-square-dots"></i></a>
                                                                </li>
                                                                <li class="list-inline-item px-2">
                                                                    <a href="javascript: void(0);" title="Profile"><i class="bx bx-user-circle"></i></a>
                                                                </li>
                                                            </ul>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <div class="avatar-xs">
                                                                <span class="avatar-title rounded-circle">
                                                                    J
                                                                </span>
                                                            </div>
                                                        </td>
                                                        <td>
                                                            <h5 class="font-size-14 mb-1"><a href="javascript: void(0);" class="text-dark">John Santiago</a></h5>
                                                            <p class="text-muted mb-0">Full Stack Developer</p>
                                                        </td>
                                                        <td>[email protected]</td>
                                                        <td>
                                                            <div>
                                                                <a href="javascript: void(0);" class="badge badge-soft-primary font-size-11 m-1">Ruby</a>
                                                                <a href="javascript: void(0);" class="badge badge-soft-primary font-size-11 m-1">Php</a>
                                                                <a href="javascript: void(0);" class="badge badge-soft-primary font-size-11 m-1">2 + more</a>
                                                            </div>
                                                        </td>
                                                        <td>
                                                            125
                                                        </td>
                                                        <td>
                                                            <ul class="list-inline font-size-20 contact-links mb-0">
                                                                <li class="list-inline-item px-2">
                                                                    <a href="javascript: void(0);" title="Message"><i class="bx bx-message-square-dots"></i></a>
                                                                </li>
                                                                <li class="list-inline-item px-2">
                                                                    <a href="javascript: void(0);" title="Profile"><i class="bx bx-user-circle"></i></a>
                                                                </li>
                                                            </ul>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <div>
                                                                <img class="rounded-circle avatar-xs" src="assets/images/users/avatar-5.jpg" alt="">
                                                            </div>
                                                        </td>
                                                        <td>
                                                            <h5 class="font-size-14 mb-1"><a href="javascript: void(0);" class="text-dark">Colin Melton</a></h5>
                                                            <p class="text-muted mb-0">Backend Developer</p>
                                                        </td>
                                                        <td>[email protected]</td>
                                                        <td>
                                                            <div>
                                                                <a href="javascript: void(0);" class="badge badge-soft-primary font-size-11 m-1">Php</a>
                                                                <a href="javascript: void(0);" class="badge badge-soft-primary font-size-11 m-1">Java</a>
                                                                <a href="javascript: void(0);" class="badge badge-soft-primary font-size-11 m-1">Python</a>
                                                            </div>
                                                        </td>
                                                        <td>
                                                            136
                                                        </td>
                                                        <td>
                                                            <ul class="list-inline font-size-20 contact-links mb-0">
                                                                <li class="list-inline-item px-2">
                                                                    <a href="javascript: void(0);" title="Message"><i class="bx bx-message-square-dots"></i></a>
                                                                </li>
                                                                <li class="list-inline-item px-2">
                                                                    <a href="javascript: void(0);" title="Profile"><i class="bx bx-user-circle"></i></a>
                                                                </li>
                                                            </ul>
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                        <div class="row">
                                            <div class="col-lg-12">
                                                <ul class="pagination pagination-rounded justify-content-center mt-4">
                                                    <li class="page-item disabled">
                                                        <a href="javascript: void(0);" class="page-link"><i class="mdi mdi-chevron-left"></i></a>
                                                    </li>
                                                    <li class="page-item">
                                                        <a href="javascript: void(0);" class="page-link">1</a>
                                                    </li>
                                                    <li class="page-item active">
                                                        <a href="javascript: void(0);" class="page-link">2</a>
                                                    </li>
                                                    <li class="page-item">
                                                        <a href="javascript: void(0);" class="page-link">3</a>
                                                    </li>
                                                    <li class="page-item">
                                                        <a href="javascript: void(0);" class="page-link">4</a>
                                                    </li>
                                                    <li class="page-item">
                                                        <a href="javascript: void(0);" class="page-link">5</a>
                                                    </li>
                                                    <li class="page-item">
                                                        <a href="javascript: void(0);" class="page-link"><i class="mdi mdi-chevron-right"></i></a>
                                                    </li>
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row mt-4">
                        <div class="col-sm-6">
                            <a href="ecommerce-cart.html" class="btn text-muted d-none d-sm-inline-block btn-link">
                                <i class="mdi mdi-arrow-left me-1"></i> Back to Shopping Cart </a>
                        </div> <!-- end col -->
                        
                    </div> <!-- end row -->
                </div>
            </div>
        </div>
        <!-- end row -->
        
        <script src="assets/libs/jquery/jquery.min.js"></script>
        <script src="assets/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
        <script src="assets/libs/metismenu/metisMenu.min.js"></script>
        <script src="assets/libs/simplebar/simplebar.min.js"></script>
        <script src="assets/libs/node-waves/waves.min.js"></script>
        <script src="assets/js/app.js"></script>
        

직원 상세조회

mapper.xml

<select id="sdselect" parameterType="String" resultType="cmncdVO">
		SELECT CMNCD_GU_NM, CMNCD_NM1, CMNCD_NM2
		FROM CMNCD
		WHERE CMNCD_CD = #{cmncdCd}
	</select>
	
<select id="empdetail" parameterType="empVO" resultType="empVO">
		SELECT EMP_ID, EMP_NM, EMP_JNCMP_YMD, EMP_BRDT, EMP_MAIL, 
		EMP_PSWD, EMP_IMG, EMP_IP, EMP_SE, EMP_TEL, CMNCD_CD
		FROM EMP
		WHERE EMP_ID= #{empId}
</select>

mapper.interface / service.interface

// 직원 상세조회
public EmpVO empdetail(EmpVO empVO);
	
// 소속 부서 직급
public CmncdVO sdselect(String cmncdCd);

serviceimpl

@Override
	public EmpVO empdetail(EmpVO empVO) {
		return empMapper.empdetail(empVO);
	}

	@Override
	public CmncdVO sdselect(String cmncdCd) {
		return empMapper.sdselect(cmncdCd);
	}

controller

	@GetMapping("/empdetail")
	public String empdetail(Model model, @RequestParam Map<String, Object> map) {
		EmpVO empVO = new EmpVO();
		empVO.setEmpId((String)map.get("empId"));
		logger.info("before" + empVO.toString());
		
		empVO = empService.empdetail(empVO);
		logger.info("이게몬가용가리?"+ empVO.toString());
		
		
		CmncdVO cmncdVO = new CmncdVO(); 
		cmncdVO = empService.sdselect(empVO.getCmncdCd());
		
		empVO.setOpt(cmncdVO.getCmncdGuNm());
		empVO.setDptopt(cmncdVO.getCmncdNm1());
		empVO.setLelopt(cmncdVO.getCmncdNm2());
		
		model.addAttribute("data", empVO);
		
		return "emp/empdetail";
	}

empdetail

<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>


<script type="text/javascript">
	function list_click(){
		location.href="/emp/emplist"
	}
	
	function fn_click(){
		location.href="/emp/empinsert"
	}
	
	
  function fn_submit(){
  	
	    var frm = document.searchForm;
	    console.log("frm.size : " + frm.size.value);
	    console.log("frm.keyWord : " + frm.keyWord.value);
	    frm.submit();
	   }
	
</script>

<style>

.bu{
margin-left:1150px;
margin-top: 30px;
}

.im{
	width: 180px;
	height: 130px;
	border-radius: 5px;
	margin-left: 30px;
	margin-top: 30px;
}
</style>


  <!-- start page title -->
  <div class="row">
      <div class="col-12">
          <div class="page-title-box d-sm-flex align-items-center justify-content-between">
              <h4 class="mb-sm-0 font-size-18">직원정보</h4>

              

          </div>
      </div>
  </div>
  <!-- end page title -->

  <div class="checkout-tabs">
          <div class="row">
              <div class="col-xl-2 col-sm-3">
                  <div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical">
                    
                      <a class="nav-link active" id="v-pills-confir-tab" data-bs-toggle="pill" href="#" role="tab" aria-controls="v-pills-confir" aria-selected="false" onclick="list_click()">
                          <i class="bx bx-badge-check d-block check-nav-icon mt-4 mb-2"></i>
                          <p class="fw-bold mb-4">직원조회</p>
                      </a>
                      <a class="nav-link" id="v-pills-shipping-tab" data-bs-toggle="pill" href="#"  role="tab" aria-controls="v-pills-shipping" aria-selected="false" onclick="fn_click()">
                          <i class="bx bxs-truck d-block check-nav-icon mt-4 mb-2"></i>
                          <p class="fw-bold mb-4">직원등록</p>
                      </a>
                      
                  </div>
              </div>
              
<div class="col-xl-10 col-sm-9">
       <div class="card">
           <div class="card-body">
           
               <div class="tab-content" id="v-pills-tabContent">
                   <div class="tab-pane fade active show" id="v-pills-shipping" role="tabpanel" aria-labelledby="v-pills-shipping-tab">
                       <div>
                           
                          
                                           
<div>

  <div class="card">
      <div class="card-body">
          <h4 class="card-title mb-4">직원 상세정보</h4>
	<br>
          <p class="text-muted mb-4">
          <div class="card overflow-hidden">
                                  <div class="bg-info bg-gradient">
                                      <div class="row">
                                          <div class="col-7">
                                             
                                          </div>
                                          <div class="col-5 align-self-end">
                                              <img src="assets/images/profile-img.png" alt="" class="img-fluid">
                                          </div>
                                      </div>
                                  </div>
                                  <div class="card-body pt-0">
                                      <div class="row">
                                          <div class="col-sm-4">
                                              <div class="avatar-md profile-user-wid mb-4">
                                                  <img src="${data.empImg}" alt="" class="im">
                                              </div>
                                              
                                          </div>

                                          <div class="col-sm-8">
                                              <div class="pt-4">

                                                  <div class="row">
                                                      <div class="col-6">
                                                          <h4 class="font-size-18">이름</h4>
                                                          <b><p class="text-muted mb-0">${data.empNm}(${data.empId})</p></b>
                                                      </div>
                                                      <div class="col-6">
                                                          <h3 class="font-size-18">소속</h3>
                                                          <b><p class="text-muted mb-0">${data.opt}/${data.dptopt}</p></b>
                                                      </div>
                                                  </div>
                                                  <div class="mt-4">
                                                     <br>
                                                     <br>
                                                  </div>
                                              </div>
                                          </div>
                                      </div>
                                  </div>
                              </div>
          </p>
          <div>
              <table class="table table-nowrap mb-0">
                  <tbody>
                  
                      <tr>
                          <th scope="row">이름 :</th>
                          <td>${data.empNm}(${data.empId})</td>
                      </tr>
                      <tr>
                          <th scope="row">생년월일 :</th>
                          <td>${data.empBrdt}</td>
                      </tr>
                      <tr>
                          <th scope="row">연락처 :</th>
                          <td>${data.empTel}</td>
                      </tr>
                      <tr>
                          <th scope="row">이메일 :</th>
                          <td>${data.empMail}</td>
                      </tr>
                      <tr>
                          <th scope="row">입사일 :</th>
                          <td>${data.empJncmpYmd}</td>
                      </tr>
                      <tr>
                          <th scope="row">소속 :</th>
                          <td>${data.opt}</td>
                      </tr>
                      <tr>
                          <th scope="row">부서 :</th>
                          <td>${data.dptopt}</td>
                      </tr>
                      <tr>
                          <th scope="row">직급 :</th>
                          <td>${data.lelopt}</td>
                      </tr>
                      <tr>
                          <th scope="row">상태 :</th>
                          <td>${data.empSe}</td>
                      </tr>
                      <tr>
                          <th scope="row">IP :</th>
                          <td>${data.empIp}</td>
                      </tr>
                      <tr>
                          <th scope="row">비밀번호 :</th>
                          <td>${data.empPswd}</td>
                      </tr>
                  </tbody>
              </table>
              
              <div class="bu">
              <button type="button" class="btn btn-primary waves-effect waves-light" onClick="location.href='/emp/empupdate?empId=${data.empId}'">수정</button>
          	</div>
          </div>
      </div>
  </div>
  <!-- end card -->

  <div class="card">
      <div class="card-body">
          <h4 class="card-title mb-5">Experience</h4>
          <div class="">
              <ul class="verti-timeline list-unstyled">
                  <li class="event-list active">
                      <div class="event-timeline-dot">
                          <i class="bx bx-right-arrow-circle bx-fade-right"></i>
                      </div>
                      <div class="d-flex">
                          <div class="flex-shrink-0 me-3">
                              <i class="bx bx-server h4 text-primary"></i>
                          </div>
                          <div class="flex-grow-1">
                              <div>
                                  <h5 class="font-size-15"><a href="javascript: void(0);" class="text-dark">Back end Developer</a></h5>
                                  <span class="text-primary">2016 - 19</span>
                              </div>
                          </div>
                      </div>
                  </li>
                  <li class="event-list">
                      <div class="event-timeline-dot">
                          <i class="bx bx-right-arrow-circle"></i>
                      </div>
                      <div class="d-flex">
                          <div class="flex-shrink-0 me-3">
                              <i class="bx bx-code h4 text-primary"></i>
                          </div>
                          <div class="flex-grow-1">
                              <div>
                                  <h5 class="font-size-15"><a href="javascript: void(0);" class="text-dark">Front end Developer</a></h5>
                                  <span class="text-primary">2013 - 16</span>
                              </div>
                          </div>
                      </div>
                  </li>
                  <li class="event-list">
                      <div class="event-timeline-dot">
                          <i class="bx bx-right-arrow-circle"></i>
                      </div>
                      <div class="d-flex">
                          <div class="flex-shrink-0 me-3">
                              <i class="bx bx-edit h4 text-primary"></i>
                          </div>
                          <div class="flex-grow-1">
                              <div>
                                  <h5 class="font-size-15"><a href="javascript: void(0);" class="text-dark">UI /UX Designer</a></h5>
                                  <span class="text-primary">2011 - 13</span>
                                  
                              </div>
                          </div>
                      </div>
                  </li>
              </ul>
          </div>

      </div>
  </div>  
  <!-- end card -->
                      </div>
                   </div>
               </div>
               
               
           </div>
       </div>
   </div>
   
</div>
</div>
</div>
      <!-- end row -->
      
      <script src="assets/libs/jquery/jquery.min.js"></script>
      <script src="assets/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
      <script src="assets/libs/metismenu/metisMenu.min.js"></script>
      <script src="assets/libs/simplebar/simplebar.min.js"></script>
      <script src="assets/libs/node-waves/waves.min.js"></script>
      <script src="assets/js/app.js"></script>
      
   

좋은 웹페이지 즐겨찾기