목록

조수경·2022년 2월 22일
0

Spring

목록 보기
35/43

cus_SQL.xml

<!-- 고객 목록 -->
	<select id="select" resultType="cusVO">
		SELECT T.RNUM, T.CUS_NUM,T.CUS_NM,T.ADDR,T.PNE
		FROM (
		    SELECT ROW_NUMBER() OVER (ORDER BY CUS_NUM) RNUM, CUS_NUM,CUS_NM,ADDR,PNE
		    FROM   CUS
		) T
	</select>

list.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<div class="row">
              <div class="col">
                <div class="card card-small mb-4">
                  <div class="card-header border-bottom">
                    <h6 class="m-0">Active Users</h6>
                  </div>
                  <div class="card-body p-0 pb-3 text-center">
                    <table class="table mb-0">
                      <thead class="bg-light">
                        <tr>
                          <th scope="col" class="border-0">번호</th>
                          <th scope="col" class="border-0">고객명</th>
                          <th scope="col" class="border-0">연락처</th>
                          <th scope="col" class="border-0">주소</th>
                        </tr>
                      </thead>
                      <tbody>

                        <c:forEach var="row" items="${list}">
                        <tr>
                          <td>${row.rnum}</td>
                          <td>${row.cusNm}</td>
                          <td>${row.pne}</td>
                          <td>${row.addr}</td>
                        </tr>
                       </c:forEach>
                      </tbody>
                    </table>
                  </div>
                </div>
              <a href="/cus/insert" class="mb-2 btn btn-sm btn-success mr-1" style="float:right;">고객등록</a>
              </div>
            </div>

CusService

//고객 목록
	public List<CusVO> select();

CusServicveImpl

//고객 목록
	@Override
	public List<CusVO> select(){
		return this.cusMapper.select();
	}

CusMapper

//고객 목록
	public List<CusVO> select();

CusVO

package kr.or.ddit.cus.vo;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.hibernate.validator.constraints.NotBlank;
import org.springframework.web.multipart.MultipartFile;

//자바빈 클래스(고객)
public class CusVO {
	//고객번호 CUS00001
	private String cusNum;
	@NotBlank
	private String cusNm;
	@NotBlank
	private String addr;
	
	private String addr1;
	private String addr2;
	
	@NotBlank
	private String pne;
	//순번
	private int rnum;
	
	//다중 파일 객체
	private MultipartFile[] uploadFile;
	//다중 파일 업로드 객체
	private List<AttachFilesVO> attachFilesVO;
	
	//다중 파일 객체의 파일명
	private String uploadFileName;
	
	
	public String getCusNum() {
		return cusNum;
	}
	public void setCusNum(String cusNum) {
		this.cusNum = cusNum;
	}
	public String getCusNm() {
		return cusNm;
	}
	public void setCusNm(String cusNm) {
		this.cusNm = cusNm;
	}
	public String getAddr() {
		return addr;
	}
	public void setAddr(String addr) {
		this.addr = addr;
	}
	public String getPne() {
		return pne;
	}
	public void setPne(String pne) {
		this.pne = pne;
	}
	
	public String getAddr1() {
		return addr1;
	}
	public void setAddr1(String addr1) {
		this.addr1 = addr1;
	}
	public String getAddr2() {
		return addr2;
	}
	public void setAddr2(String addr2) {
		this.addr2 = addr2;
	}
	
	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 int getRnum() {
		return rnum;
	}
	public void setRnum(int rnum) {
		this.rnum = rnum;
	}
	@Override
	public String toString() {
		return "CusVO [cusNum=" + cusNum + ", cusNm=" + cusNm + ", addr=" + addr + ", addr1=" + addr1 + ", addr2="
				+ addr2 + ", pne=" + pne + ", rnum=" + rnum + ", uploadFile=" + Arrays.toString(uploadFile)
				+ ", attachFilesVO=" + attachFilesVO + ", uploadFileName=" + uploadFileName + "]";
	}
	
	
}

profile
신입 개발자 입니다!!!

0개의 댓글