From 8d5d4de8f86f6232e065605d5eab38d837b8d7d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=9D=B8=EC=84=B1?= Date: Sat, 9 Nov 2019 15:34:14 +0900 Subject: [PATCH 1/6] 20191109 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 60cae9e..2987507 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Java Spring Oracle Redis Kafka JQuery ### Tomcat Config - + tcpNoDelay="true" - +Context docBase="Singer" path="/" reloadable="true" source="org.eclipse.jst.jee.server:Singer" allowCasualMultipartParsing="true" From 8c2f6c9b1e3659d6a7e3c40110df8145605199f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=9D=B8=EC=84=B1?= Date: Sat, 9 Nov 2019 19:36:44 +0900 Subject: [PATCH 2/6] =?UTF-8?q?20191109=20xss=ED=95=84=ED=84=B0=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=20=EC=88=98=EC=A0=95,=20=EC=82=AC=EC=9D=B4?= =?UTF-8?q?=EC=A6=880=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20insert=EC=95=88?= =?UTF-8?q?=EB=90=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/singer/filter/RequestWrapper.java | 2 +- src/main/java/com/singer/service/SR01ServiceImpl.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/singer/filter/RequestWrapper.java b/src/main/java/com/singer/filter/RequestWrapper.java index 958771f..0bc0353 100644 --- a/src/main/java/com/singer/filter/RequestWrapper.java +++ b/src/main/java/com/singer/filter/RequestWrapper.java @@ -38,7 +38,7 @@ public String[] getParameterValues(String parameter) { if (!skiplist.contains(parameter)) { List blackListArray = b2cConfig.getSqlInjectionBlackList(); if (blackListArray != null) { - String val = values[i].toLowerCase(); + String val = encodedValues[i].toLowerCase(); int size = blackListArray.size(); for (int j = 0; j < size; j++) { diff --git a/src/main/java/com/singer/service/SR01ServiceImpl.java b/src/main/java/com/singer/service/SR01ServiceImpl.java index 9e91ce0..df7ff4d 100644 --- a/src/main/java/com/singer/service/SR01ServiceImpl.java +++ b/src/main/java/com/singer/service/SR01ServiceImpl.java @@ -61,6 +61,9 @@ public int insertSR01Vo(SR01Vo sr01Vo, MultipartHttpServletRequest request, Stri int idx = 0; ArrayList> arrayList = new ArrayList<>(); for (MultipartFile photo : fileList) { + if (photo.getSize() == 0) { + continue; + } if (!CommonUtil.chkIMGFile(photo.getOriginalFilename())) { throw new AppException(ExceptionMsg.EXT_MSG_INPUT_4); } From 6c1de5682de297906a89de21f050a7e54a9d4e98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=9D=B8=EC=84=B1?= Date: Sun, 10 Nov 2019 14:37:55 +0900 Subject: [PATCH 3/6] 20191110 Requestbody xss protect --- README.md | 2 +- .../com/singer/controller/SB02Controller.java | 3 +- .../com/singer/controller/SF02Controller.java | 3 +- .../com/singer/controller/SM02Controller.java | 3 +- .../com/singer/controller/SR03Controller.java | 3 +- .../com/singer/controller/SV04Controller.java | 3 +- .../com/singer/filter/RequestWrapper.java | 97 ++++++++++++++++++- .../webapp/WEB-INF/views/sb01view_detail.jsp | 4 +- .../webapp/WEB-INF/views/sf01view_detail.jsp | 4 +- src/main/webapp/WEB-INF/views/sm02view.jsp | 2 +- .../webapp/WEB-INF/views/sr01view_detail.jsp | 4 +- .../webapp/WEB-INF/views/sv01view_detail.jsp | 4 +- 12 files changed, 116 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 2987507..b6bf372 100644 --- a/README.md +++ b/README.md @@ -16,5 +16,5 @@ Connector connectionTimeout="20000" minSpareThreads="25" acceptCount="10" tcpNoDelay="true" - + maxPostSize="52428800" Context docBase="Singer" path="/" reloadable="true" source="org.eclipse.jst.jee.server:Singer" allowCasualMultipartParsing="true" diff --git a/src/main/java/com/singer/controller/SB02Controller.java b/src/main/java/com/singer/controller/SB02Controller.java index da059cb..e92beaa 100644 --- a/src/main/java/com/singer/controller/SB02Controller.java +++ b/src/main/java/com/singer/controller/SB02Controller.java @@ -11,6 +11,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @@ -41,7 +42,7 @@ public ResponseEntity selectSB02Vo(@ModelAttribute SB02Vo sb02Vo, HttpSe @ResponseBody @RequestMapping(value = "/sb02", method = RequestMethod.POST) - public ResponseEntity insertSB02Vo(SB02Vo sb02Vo, HttpSession session) throws Exception { + public ResponseEntity insertSB02Vo(@RequestBody SB02Vo sb02Vo, HttpSession session) throws Exception { log.debug("enter sb02 post"); String userid = (String) session.getAttribute("userid"); diff --git a/src/main/java/com/singer/controller/SF02Controller.java b/src/main/java/com/singer/controller/SF02Controller.java index 78a3bac..4d5ee8e 100644 --- a/src/main/java/com/singer/controller/SF02Controller.java +++ b/src/main/java/com/singer/controller/SF02Controller.java @@ -11,6 +11,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @@ -41,7 +42,7 @@ public ResponseEntity selectSF02Vo(@ModelAttribute SF02Vo sf02Vo, HttpSe @ResponseBody @RequestMapping(value = "/sf02", method = RequestMethod.POST) - public ResponseEntity insertSF02Vo(SF02Vo sf02Vo, HttpSession session) throws Exception { + public ResponseEntity insertSF02Vo(@RequestBody SF02Vo sf02Vo, HttpSession session) throws Exception { log.debug("enter sf02 post"); String userid = (String) session.getAttribute("userid"); diff --git a/src/main/java/com/singer/controller/SM02Controller.java b/src/main/java/com/singer/controller/SM02Controller.java index 28568eb..14fa1f4 100644 --- a/src/main/java/com/singer/controller/SM02Controller.java +++ b/src/main/java/com/singer/controller/SM02Controller.java @@ -11,6 +11,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @@ -64,7 +65,7 @@ public ResponseEntity deleteSM02Vo(@ModelAttribute SM02Vo sm02Vo, HttpSe @ResponseBody @RequestMapping(value = "/sm02", method = RequestMethod.POST) - public ResponseEntity insertSM02Vo(SM02Vo sm02Vo, HttpSession session) throws Exception { + public ResponseEntity insertSM02Vo(@RequestBody SM02Vo sm02Vo, HttpSession session) throws Exception { log.debug("enter sm02 post"); String userid = (String) session.getAttribute("userid"); diff --git a/src/main/java/com/singer/controller/SR03Controller.java b/src/main/java/com/singer/controller/SR03Controller.java index 7896cba..954c2d9 100644 --- a/src/main/java/com/singer/controller/SR03Controller.java +++ b/src/main/java/com/singer/controller/SR03Controller.java @@ -11,6 +11,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @@ -41,7 +42,7 @@ public ResponseEntity selectsr03Vo(@ModelAttribute SR03Vo sr03Vo, HttpSe @ResponseBody @RequestMapping(value = "/sr03", method = RequestMethod.POST) - public ResponseEntity insertsr03Vo(SR03Vo sr03Vo, HttpSession session) throws Exception { + public ResponseEntity insertsr03Vo(@RequestBody SR03Vo sr03Vo, HttpSession session) throws Exception { log.debug("enter sr03 post"); String userid = (String) session.getAttribute("userid"); diff --git a/src/main/java/com/singer/controller/SV04Controller.java b/src/main/java/com/singer/controller/SV04Controller.java index 46720c9..c0901be 100644 --- a/src/main/java/com/singer/controller/SV04Controller.java +++ b/src/main/java/com/singer/controller/SV04Controller.java @@ -11,6 +11,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @@ -41,7 +42,7 @@ public ResponseEntity selectSV04Vo(@ModelAttribute SV04Vo sv04Vo, HttpSe @ResponseBody @RequestMapping(value = "/sv04", method = RequestMethod.POST) - public ResponseEntity insertSV04Vo(SV04Vo sv04Vo, HttpSession session) throws Exception { + public ResponseEntity insertSV04Vo(@RequestBody SV04Vo sv04Vo, HttpSession session) throws Exception { log.debug("enter sv04 post"); String userid = (String) session.getAttribute("userid"); diff --git a/src/main/java/com/singer/filter/RequestWrapper.java b/src/main/java/com/singer/filter/RequestWrapper.java index 0bc0353..3a7f368 100644 --- a/src/main/java/com/singer/filter/RequestWrapper.java +++ b/src/main/java/com/singer/filter/RequestWrapper.java @@ -1,7 +1,14 @@ package com.singer.filter; +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.util.List; +import javax.servlet.ReadListener; +import javax.servlet.ServletInputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper; @@ -14,10 +21,98 @@ public class RequestWrapper extends HttpServletRequestWrapper { private final Log log = LogFactory.getLog(RequestWrapper.class); + private byte[] bytes; public RequestWrapper(HttpServletRequest request) { super(request); - log.info("RequestWrapper init"); + log.info("RequestWrapper init "); + if ("application/json;charset=UTF-8".equals(request.getContentType())) { // @RequestBody요청 + bytes = new String(getBody(request)).getBytes(); + + } + } + + public ServletInputStream getInputStream() throws IOException { + final ByteArrayInputStream bis = new ByteArrayInputStream(bytes); + return new ServletInputStreamImpl(bis); + } + + class ServletInputStreamImpl extends ServletInputStream { + + private InputStream is; + + public ServletInputStreamImpl(InputStream bis) { + is = bis; + } + + public int read() throws IOException { + return is.read(); + } + + public int read(byte[] b) throws IOException { + return is.read(b); + } + + @Override + public boolean isFinished() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isReady() { + // TODO Auto-generated method stub + return false; + } + + @Override + public void setReadListener(ReadListener readListener) { + // TODO Auto-generated method stub + + } + + } + + public String getBody(HttpServletRequest request) { + + String body = null; + StringBuilder stringBuilder = new StringBuilder(); + BufferedReader br = null; + InputStream is = null; + try { + is = request.getInputStream(); + if (is != null) { + br = new BufferedReader(new InputStreamReader(is)); + char[] charBuffer = new char[1024]; + int bytesRead = -1; + while ((bytesRead = br.read(charBuffer)) > 0) { + stringBuilder.append(charBuffer, 0, bytesRead); + } + } else { + stringBuilder.append(""); + } + } catch (IOException ex) { + + } finally { + + if (br != null) { + try { + br.close(); + } catch (IOException ex) { + + } + } + if (is != null) { + try { + is.close(); + } catch (IOException ex) { + + } + } + } + + body = cleanXSS(stringBuilder.toString()); + return body; } public String[] getParameterValues(String parameter) { diff --git a/src/main/webapp/WEB-INF/views/sb01view_detail.jsp b/src/main/webapp/WEB-INF/views/sb01view_detail.jsp index 42f6d6a..ea368a5 100644 --- a/src/main/webapp/WEB-INF/views/sb01view_detail.jsp +++ b/src/main/webapp/WEB-INF/views/sb01view_detail.jsp @@ -106,7 +106,7 @@ "nowPage" : 1 }; - gfn_ajax("sb02","POST" , sendData , function(data) { + gfn_ajaxRequestBody("sb02","POST" , sendData , function(data) { var html = drawTable(data); html += ''; @@ -209,7 +209,7 @@ "nowPage" : 1 }; - gfn_ajax("sb02","POST" , sendData , function(data) { + gfn_ajaxRequestBody("sb02","POST" , sendData , function(data) { for (var i = 0; i < $("#sb02viewTbody").find("tr").length; i++) { var tr = $("#sb02viewTbody").find("tr").eq(i); if(tr.find("td").eq(0).text() == data.parents) { diff --git a/src/main/webapp/WEB-INF/views/sf01view_detail.jsp b/src/main/webapp/WEB-INF/views/sf01view_detail.jsp index 3a223e7..6f29b24 100644 --- a/src/main/webapp/WEB-INF/views/sf01view_detail.jsp +++ b/src/main/webapp/WEB-INF/views/sf01view_detail.jsp @@ -105,7 +105,7 @@ "nowPage" : 1 }; - gfn_ajax("sf02","POST" , sendData , function(data) { + gfn_ajaxRequestBody("sf02","POST" , sendData , function(data) { var html = drawTable(data); html += ''; @@ -209,7 +209,7 @@ "nowPage" : 1 }; - gfn_ajax("sf02","POST" , sendData , function(data) { + gfn_ajaxRequestBody("sf02","POST" , sendData , function(data) { for (var i = 0; i < $("#sf02viewTbody").find("tr").length; i++) { var tr = $("#sf02viewTbody").find("tr").eq(i); if(tr.find("td").eq(0).text() == data.parents) { diff --git a/src/main/webapp/WEB-INF/views/sm02view.jsp b/src/main/webapp/WEB-INF/views/sm02view.jsp index e5879a7..bc314a2 100644 --- a/src/main/webapp/WEB-INF/views/sm02view.jsp +++ b/src/main/webapp/WEB-INF/views/sm02view.jsp @@ -46,7 +46,7 @@ "nowPage" : 1 }; - gfn_ajax("sm02","POST" , sendData , function(data) { + gfn_ajaxRequestBody("sm02","POST" , sendData , function(data) { var html = ""; // jQuery 유틸리티 메서드 diff --git a/src/main/webapp/WEB-INF/views/sr01view_detail.jsp b/src/main/webapp/WEB-INF/views/sr01view_detail.jsp index 9f1e4bb..917999e 100644 --- a/src/main/webapp/WEB-INF/views/sr01view_detail.jsp +++ b/src/main/webapp/WEB-INF/views/sr01view_detail.jsp @@ -205,7 +205,7 @@ "nowPage" : 1 }; - gfn_ajax("sr03","POST" , sendData , function(data) { + gfn_ajaxRequestBody("sr03","POST" , sendData , function(data) { var html = drawTable(data); html += ''; @@ -310,7 +310,7 @@ "nowPage" : 1 }; - gfn_ajax("sr03","POST" , sendData , function(data) { + gfn_ajaxRequestBody("sr03","POST" , sendData , function(data) { for (var i = 0; i < $("#sr03viewTbody").find("tr").length; i++) { var tr = $("#sr03viewTbody").find("tr").eq(i); if(tr.find("td").eq(0).text() == data.parents) { diff --git a/src/main/webapp/WEB-INF/views/sv01view_detail.jsp b/src/main/webapp/WEB-INF/views/sv01view_detail.jsp index 8d03b06..d27f1b3 100644 --- a/src/main/webapp/WEB-INF/views/sv01view_detail.jsp +++ b/src/main/webapp/WEB-INF/views/sv01view_detail.jsp @@ -238,7 +238,7 @@ "nowPage" : 1 }; - gfn_ajax("sv04","POST" , sendData , function(data) { + gfn_ajaxRequestBody("sv04","POST" , sendData , function(data) { var html = drawTable(data); html += ''; @@ -343,7 +343,7 @@ "nowPage" : 1 }; - gfn_ajax("sv04","POST" , sendData , function(data) { + gfn_ajaxRequestBody("sv04","POST" , sendData , function(data) { for (var i = 0; i < $("#sv04viewTbody").find("tr").length; i++) { var tr = $("#sv04viewTbody").find("tr").eq(i); if(tr.find("td").eq(0).text() == data.parents) { From 7815df7dac3bcca7ef2965c7bb8cb50dcd04d18e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=9D=B8=EC=84=B1?= Date: Mon, 11 Nov 2019 20:50:01 +0900 Subject: [PATCH 4/6] =?UTF-8?q?20191111=20=EC=9C=A0=EC=A0=80=EC=A0=84?= =?UTF-8?q?=ED=99=94=EB=B2=88=ED=98=B8=20=ED=85=8C=EC=9D=B4=EB=B8=94=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/OracleTables.sql | 38 +++++++- .../java/com/singer/common/Constants.java | 19 ++++ .../singer/controller/LoginController.java | 9 +- .../com/singer/controller/SM01Controller.java | 14 +++ src/main/java/com/singer/dao/SM01Dao.java | 23 ++++- .../exception/CommonExceptionHandler.java | 9 ++ .../java/com/singer/service/SM01Service.java | 4 + .../com/singer/service/SM01ServiceImpl.java | 92 +++++++++++++++++- src/main/java/com/singer/vo/SM01Vo.java | 24 ++++- src/main/java/com/singer/vo/SuperVo.java | 1 - src/main/resources/mappers/SM01VoMapper.xml | 96 +++++++++++++++---- src/main/webapp/WEB-INF/views/join.jsp | 11 +-- src/main/webapp/WEB-INF/views/sm01list.jsp | 7 +- src/main/webapp/WEB-INF/views/sm01update.jsp | 22 +++-- 14 files changed, 312 insertions(+), 57 deletions(-) diff --git a/sql/OracleTables.sql b/sql/OracleTables.sql index 48e073f..1b0773b 100644 --- a/sql/OracleTables.sql +++ b/sql/OracleTables.sql @@ -1,12 +1,10 @@ CREATE table SM01( userid varchar2(10) not null, passwd varchar2(30) not null, -adminyn number(1) default 0, username varchar2(20) not null, brth varchar2(8) not null, grade number(1) default 4 not null, regdate varchar2(8) not null, -phone varchar2(15) not null, email varchar2(30) not null, usertype number(1) default 4 not null ); @@ -14,6 +12,12 @@ usertype number(1) default 4 not null alter table SM01 add constraint pk_SM01 primary key(userid); +CREATE index idx_SM01_1 +on SM01(username); + +CREATE index idx_SM01_2 +on SM01(brth); + CREATE TABLE SMP1( userid varchar2(10) not null, regdate varchar2(8) not null, @@ -26,6 +30,36 @@ add constraint pk_SMP1 primary key(userid); alter table SMP1 add constraint fk_SMP1 foreign key(userid) references SM01(userid) on delete cascade; +CREATE table SMI1 ( +userid varchar2(10) not null, +infocode number(2) not null, +pfnum varchar2(5) not null, +pcnum varchar2(5) not null, +pbnum varchar2(5) not null, +regdate varchar2(8) not null +); + +ALTER TABLE SMI1 +add constraint pk_SMI1 primary key(userid,infocode); + +alter table SMI1 +add constraint fk_SMI1 foreign key(userid) references SM01(userid) on delete cascade; + +CREATE index idx_SMI1_1 +on SMI1(pbnum); + +CREATE table SME1 ( +userid varchar2(10) not null, +regdate varchar2(8) not NULL, +insertid varchar2(10) not null +); + +ALTER TABLE SME1 +add constraint pk_SME1 primary key(userid); + +alter table SME1 +add constraint fk_SME1 foreign key(userid) references SM01(userid) on delete cascade; + CREATE table MENU ( menucd varchar2(2) not null, menunm varchar2(20) not null, diff --git a/src/main/java/com/singer/common/Constants.java b/src/main/java/com/singer/common/Constants.java index cd060a1..751e167 100644 --- a/src/main/java/com/singer/common/Constants.java +++ b/src/main/java/com/singer/common/Constants.java @@ -63,4 +63,23 @@ public int getValue() { } } + public enum PHONE_INFO_CODE { + /** 핸드폰코드 */ + CELL(1), + /** 집번호코드 */ + HOME(2), + /** 회사번호코드 */ + COMPANY(3), + /** 그외번호코드 */ + OTHER(4),; + private final int value; + + private PHONE_INFO_CODE(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + } } diff --git a/src/main/java/com/singer/controller/LoginController.java b/src/main/java/com/singer/controller/LoginController.java index e1ace6c..7a2486d 100644 --- a/src/main/java/com/singer/controller/LoginController.java +++ b/src/main/java/com/singer/controller/LoginController.java @@ -47,12 +47,8 @@ public ModelAndView logout(HttpSession session) throws Exception { ModelAndView model = new ModelAndView("/index"); session.removeAttribute("userid"); - session.removeAttribute("adminyn"); session.removeAttribute("username"); - session.removeAttribute("brth"); session.removeAttribute("grade"); - session.removeAttribute("regdate"); - session.removeAttribute("phone"); session.removeAttribute("email"); session.removeAttribute("usertype"); session.removeAttribute("menuList"); @@ -72,7 +68,7 @@ public HashMap login(SM01Vo sm01Vo, HttpSession session, HttpSer String userId = sm01Vo.getUserid(); - SM01Vo one = sm01Service.selectOneSM01Vo(sm01Vo); + SM01Vo one = sm01Service.login(sm01Vo); if (CommonUtil.isNull(one)) { // 로그인 실패 hashMap.put("code", Constants.ERROR_LOGIN_FAIL); @@ -82,12 +78,9 @@ public HashMap login(SM01Vo sm01Vo, HttpSession session, HttpSer } else { session.setAttribute("userid", userId); - session.setAttribute("adminyn", one.getAdminyn()); session.setAttribute("username", one.getUsername()); - session.setAttribute("brth", one.getBrth()); session.setAttribute("grade", one.getGrade()); session.setAttribute("regdate", one.getRegdate()); - session.setAttribute("phone", one.getPhone()); session.setAttribute("email", one.getEmail()); session.setAttribute("usertype", one.getUsertype()); diff --git a/src/main/java/com/singer/controller/SM01Controller.java b/src/main/java/com/singer/controller/SM01Controller.java index 6e8eedc..8892993 100644 --- a/src/main/java/com/singer/controller/SM01Controller.java +++ b/src/main/java/com/singer/controller/SM01Controller.java @@ -15,6 +15,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @@ -131,4 +132,17 @@ public void selectPhotoSM01Vo(@ModelAttribute SM01Vo sm01Vo, HttpServletRequest } log.debug("exit sm01photo get"); } + + @ResponseBody + @RequestMapping(value = "/sme1", method = RequestMethod.PUT) + public ResponseEntity upateSME1Vo(@RequestBody SM01Vo sm01Vo, HttpSession session) throws Exception { + log.debug("enter sme1 put"); + + String userid = (String) session.getAttribute("userid"); + sm01Service.updateSME1Vo(sm01Vo, userid); + + log.debug("exit sme1 put"); + return new ResponseEntity(sm01Vo, HttpStatus.OK); + } + } diff --git a/src/main/java/com/singer/dao/SM01Dao.java b/src/main/java/com/singer/dao/SM01Dao.java index ddc6fa5..76f04af 100644 --- a/src/main/java/com/singer/dao/SM01Dao.java +++ b/src/main/java/com/singer/dao/SM01Dao.java @@ -17,8 +17,20 @@ public int insertSM01Vo(SM01Vo sm01Vo) throws Exception { return insert(namespace + ".insert", sm01Vo); } + public int insertSMI1Vo(SM01Vo sm01Vo) throws Exception { + return update(namespace + ".insertSMI1", sm01Vo); + } + + public int insertSME1Vo(SM01Vo sm01Vo) throws Exception { + return insert(namespace + ".insertSME1", sm01Vo); + } + public int updateSM01Vo(SM01Vo sm01Vo) throws Exception { - return insert(namespace + ".update", sm01Vo); + return update(namespace + ".update", sm01Vo); + } + + public int updateUserType(SM01Vo sm01Vo) throws Exception { + return update(namespace + ".updateUserType", sm01Vo); } @SuppressWarnings("unchecked") @@ -26,6 +38,11 @@ public List selectSM01Vo(SM01Vo sm01Vo) throws Exception { return (List) selectList(namespace + ".select", sm01Vo); } + @SuppressWarnings("unchecked") + public List selectSMI1Vo(SM01Vo sm01Vo) throws Exception { + return (List) selectList(namespace + ".selectSMI1", sm01Vo); + } + public SM01Vo selectOneSM01Vo(SM01Vo sm01Vo) throws Exception { return (SM01Vo) selectOne(namespace + ".selectOne", sm01Vo); } @@ -34,6 +51,10 @@ public int deleteSM01Vo(SM01Vo sm01Vo) throws Exception { return delete(namespace + ".delete", sm01Vo); } + public int deleteSME1Vo(SM01Vo sm01Vo) throws Exception { + return delete(namespace + ".deleteSME1", sm01Vo); + } + public int insertImage(Map hashMap) throws Exception { return insert(namespace + ".insertImage", hashMap); } diff --git a/src/main/java/com/singer/exception/CommonExceptionHandler.java b/src/main/java/com/singer/exception/CommonExceptionHandler.java index 989b37c..e0c384f 100644 --- a/src/main/java/com/singer/exception/CommonExceptionHandler.java +++ b/src/main/java/com/singer/exception/CommonExceptionHandler.java @@ -62,6 +62,9 @@ public ModelAndView defaultExceptionHandler(HttpServletRequest request, Exceptio public ModelAndView SQLExceptionHandler(HttpServletRequest request, Exception ext) { boolean isAjax = false; log.info("SQLException"); + if (CommonUtil.isNull(ext.getMessage())) { + return null; + } log.info(ext.getMessage()); InputQueryUtil queryUtil = new InputQueryUtil("log_error"); @@ -90,6 +93,9 @@ public ModelAndView SQLExceptionHandler(HttpServletRequest request, Exception ex public ModelAndView appExceptionHandler(HttpServletRequest request, Exception ext) { boolean isAjax = false; log.info("AppException"); + if (CommonUtil.isNull(ext.getMessage())) { + return null; + } log.info(ext.getMessage()); if ("XMLHttpRequest".equals(request.getHeader("X-Requested-With"))) { @@ -111,6 +117,9 @@ public ModelAndView appExceptionHandler(HttpServletRequest request, Exception ex public ModelAndView NoHandlerFoundException(HttpServletRequest request, Exception ext) { boolean isAjax = false; log.info("NoHandlerFoundException"); + if (CommonUtil.isNull(ext.getMessage())) { + return null; + } log.info(ext.getMessage()); InputQueryUtil queryUtil = new InputQueryUtil("log_error"); diff --git a/src/main/java/com/singer/service/SM01Service.java b/src/main/java/com/singer/service/SM01Service.java index 0646cac..be2eae2 100644 --- a/src/main/java/com/singer/service/SM01Service.java +++ b/src/main/java/com/singer/service/SM01Service.java @@ -18,9 +18,13 @@ public interface SM01Service { public SM01Vo selectOneSM01Vo(SM01Vo sm01Vo) throws Exception; + public SM01Vo login(SM01Vo sm01Vo) throws Exception; + public int deleteSM01Vo(SM01Vo sm01Vo) throws Exception; public SM01Vo updateSM01Vo(SM01Vo sm01Vo, MultipartHttpServletRequest request, String userId) throws Exception; public InputStream selectImage(SM01Vo sm01Vo, HttpServletRequest request) throws Exception; + + public int updateSME1Vo(SM01Vo sm01Vo, String userId) throws Exception; } \ No newline at end of file diff --git a/src/main/java/com/singer/service/SM01ServiceImpl.java b/src/main/java/com/singer/service/SM01ServiceImpl.java index 3d76dd4..3a2523d 100644 --- a/src/main/java/com/singer/service/SM01ServiceImpl.java +++ b/src/main/java/com/singer/service/SM01ServiceImpl.java @@ -20,7 +20,7 @@ import com.singer.exception.ExceptionMsg; import com.singer.common.CommonUtil; import com.singer.common.Constants; -import com.singer.common.Constants.YES_NO; +import com.singer.common.Constants.PHONE_INFO_CODE; import com.singer.common.DateUtil; import com.singer.dao.SM01Dao; import com.singer.vo.SM01Vo; @@ -59,10 +59,6 @@ public HashMap insertSM01Vo(SM01Vo sm01Vo, MultipartHttpServletR sm01Vo.setRegdate(DateUtil.getToday()); sm01Vo.setGrade(Constants.USER_CODE.NORMAL.getValue()); - if (CommonUtil.isNull(sm01Vo.getAdminyn())) { - sm01Vo.setAdminyn(YES_NO.NO.getValue()); - } - MultipartFile photo = null; Iterator itr = request.getFileNames(); if (CommonUtil.isNull(itr)) { @@ -77,6 +73,8 @@ public HashMap insertSM01Vo(SM01Vo sm01Vo, MultipartHttpServletR } hashMap.put("succeed", sm01Dao.insertSM01Vo(sm01Vo)); + sm01Vo.setInfocode(PHONE_INFO_CODE.CELL.getValue()); + sm01Dao.insertSMI1Vo(sm01Vo); HashMap putHash = new HashMap(); putHash.put("userid", sm01Vo.getUserid()); putHash.put("regdate", DateUtil.getToday()); @@ -101,7 +99,34 @@ public List selectSM01Vo(SM01Vo sm01Vo) throws Exception { @Transactional @Override public SM01Vo selectOneSM01Vo(SM01Vo sm01Vo) throws Exception { + sm01Vo = sm01Dao.selectOneSM01Vo(sm01Vo); + List list = sm01Dao.selectSMI1Vo(sm01Vo); + for (SM01Vo vo : list) { + + if (vo.getInfocode() == PHONE_INFO_CODE.CELL.getValue()) { + sm01Vo.setCellpfnum(vo.getPfnum()); + sm01Vo.setCellpcnum(vo.getPcnum()); + sm01Vo.setCellpbnum(vo.getPbnum()); + } else if (vo.getInfocode() == PHONE_INFO_CODE.HOME.getValue()) { + sm01Vo.setHomepfnum(vo.getPfnum()); + sm01Vo.setHomepcnum(vo.getPcnum()); + sm01Vo.setHomepbnum(vo.getPbnum()); + } else if (vo.getInfocode() == PHONE_INFO_CODE.COMPANY.getValue()) { + sm01Vo.setCompanypfnum(vo.getPfnum()); + sm01Vo.setCompanypcnum(vo.getPcnum()); + sm01Vo.setCompanypbnum(vo.getPbnum()); + } else if (vo.getInfocode() == PHONE_INFO_CODE.OTHER.getValue()) { + sm01Vo.setOtherpfnum(vo.getPfnum()); + sm01Vo.setOtherpcnum(vo.getPcnum()); + sm01Vo.setOtherpbnum(vo.getPbnum()); + } + } + return sm01Vo; + } + @Transactional + @Override + public SM01Vo login(SM01Vo sm01Vo) throws Exception { return sm01Dao.selectOneSM01Vo(sm01Vo); } @@ -155,6 +180,50 @@ public SM01Vo updateSM01Vo(SM01Vo sm01Vo, MultipartHttpServletRequest request, S } // 저장후 sm01Dao.updateSM01Vo(sm01Vo); + // 전화번호 변경 + if (!CommonUtil.isNull(sm01Vo.getCellpcnum()) && !CommonUtil.isNull(sm01Vo.getCellpbnum())) { + SM01Vo vo = new SM01Vo(); + vo.setUserid(sm01Vo.getUserid()); + vo.setInfocode(PHONE_INFO_CODE.CELL.getValue()); + vo.setPfnum(sm01Vo.getCellpfnum()); + vo.setPcnum(sm01Vo.getCellpcnum()); + vo.setPbnum(sm01Vo.getCellpbnum()); + vo.setRegdate(DateUtil.getToday()); + sm01Dao.insertSMI1Vo(vo); + } + + if (!CommonUtil.isNull(sm01Vo.getHomepcnum()) && !CommonUtil.isNull(sm01Vo.getHomepbnum())) { + SM01Vo vo = new SM01Vo(); + vo.setUserid(sm01Vo.getUserid()); + vo.setInfocode(PHONE_INFO_CODE.HOME.getValue()); + vo.setPfnum(sm01Vo.getHomepfnum()); + vo.setPcnum(sm01Vo.getHomepcnum()); + vo.setPbnum(sm01Vo.getHomepbnum()); + vo.setRegdate(DateUtil.getToday()); + sm01Dao.insertSMI1Vo(vo); + } + + if (!CommonUtil.isNull(sm01Vo.getCompanypcnum()) && !CommonUtil.isNull(sm01Vo.getCompanypbnum())) { + SM01Vo vo = new SM01Vo(); + vo.setUserid(sm01Vo.getUserid()); + vo.setInfocode(PHONE_INFO_CODE.COMPANY.getValue()); + vo.setPfnum(sm01Vo.getCompanypfnum()); + vo.setPcnum(sm01Vo.getCompanypcnum()); + vo.setPbnum(sm01Vo.getCompanypbnum()); + vo.setRegdate(DateUtil.getToday()); + sm01Dao.insertSMI1Vo(vo); + } + + if (!CommonUtil.isNull(sm01Vo.getOtherpcnum()) && !CommonUtil.isNull(sm01Vo.getOtherpbnum())) { + SM01Vo vo = new SM01Vo(); + vo.setUserid(sm01Vo.getUserid()); + vo.setInfocode(PHONE_INFO_CODE.OTHER.getValue()); + vo.setPfnum(sm01Vo.getOtherpfnum()); + vo.setPcnum(sm01Vo.getOtherpcnum()); + vo.setPbnum(sm01Vo.getOtherpbnum()); + vo.setRegdate(DateUtil.getToday()); + sm01Dao.insertSMI1Vo(vo); + } if (!CommonUtil.isNull(photo.getSize())) { @@ -173,4 +242,17 @@ public SM01Vo updateSM01Vo(SM01Vo sm01Vo, MultipartHttpServletRequest request, S return sm01Dao.selectOneSM01Vo(sm01Vo); } + @Transactional + @Override + public int updateSME1Vo(SM01Vo sm01Vo, String userId) throws Exception { + sm01Vo.setInsertid(userId); + sm01Dao.updateUserType(sm01Vo); + if (sm01Vo.getUsertype() == Constants.USER_CODE.ADMIN.getValue()) { + sm01Dao.insertSME1Vo(sm01Vo); + } else { + sm01Dao.deleteSME1Vo(sm01Vo); + } + return 0; + } + } diff --git a/src/main/java/com/singer/vo/SM01Vo.java b/src/main/java/com/singer/vo/SM01Vo.java index ecd22b1..b2ff30d 100644 --- a/src/main/java/com/singer/vo/SM01Vo.java +++ b/src/main/java/com/singer/vo/SM01Vo.java @@ -30,9 +30,31 @@ public class SM01Vo extends SuperVo { private String device; private String browser; - + private String insertid; + private List list; + private int infocode; + private String pfnum; + private String pcnum; + private String pbnum; + + private String cellpfnum; + private String cellpcnum; + private String cellpbnum; + + private String homepfnum; + private String homepcnum; + private String homepbnum; + + private String companypfnum; + private String companypcnum; + private String companypbnum; + + private String otherpfnum; + private String otherpcnum; + private String otherpbnum; + public void setList(List list) { this.list = list; super.setNowPage(super.getNowPage() + 1); diff --git a/src/main/java/com/singer/vo/SuperVo.java b/src/main/java/com/singer/vo/SuperVo.java index d05500e..14323d6 100644 --- a/src/main/java/com/singer/vo/SuperVo.java +++ b/src/main/java/com/singer/vo/SuperVo.java @@ -8,7 +8,6 @@ @Getter @Setter public class SuperVo { - protected int adminyn; protected boolean deleteYn; protected String showDate; protected int totCnt; diff --git a/src/main/resources/mappers/SM01VoMapper.xml b/src/main/resources/mappers/SM01VoMapper.xml index ab57d2a..568018d 100644 --- a/src/main/resources/mappers/SM01VoMapper.xml +++ b/src/main/resources/mappers/SM01VoMapper.xml @@ -7,15 +7,40 @@ - insert into SM01 (userid, passwd, adminyn, username, brth, grade, regdate, phone, email, usertype) - values (#{userid}, #{passwd}, #{adminyn}, #{username}, #{brth}, #{grade}, #{regdate}, #{phone}, #{email}, 4) + insert into SM01 (userid, passwd, username, brth, grade, regdate, email, usertype) + values (#{userid}, #{passwd}, #{username}, #{brth}, #{grade}, #{regdate}, #{email}, 4) + + merge into SMI1 S1 + using dual + on (S1.userid = #{userid} + and S1.infocode = #{infocode}) + when matched then + update set + S1.pfnum = #{pfnum}, + S1.pcnum = #{pcnum}, + S1.pbnum = #{pbnum}, + S1.regdate = #{regdate} + when not matched then + insert (S1.userid, S1.infocode, S1.pfnum, S1.pcnum, S1.pbnum, S1.regdate) + values (#{userid}, #{infocode}, #{pfnum}, #{pcnum}, #{pbnum}, #{regdate}) + + + + insert into SME1 (userid, regdate, insertid) + values (#{userid}, #{regdate}, #{insertid}) + + + + delete from SME1 + where userid = #{userid} + + update SM01 set username = #{username}, brth = #{brth}, - phone = #{phone}, email = #{email} , passwd = #{passwd} @@ -23,37 +48,68 @@ where userid = #{userid} + + update SM01 + set usertype = #{usertype} + where userid = #{userid} + + + + + diff --git a/src/main/webapp/WEB-INF/views/join.jsp b/src/main/webapp/WEB-INF/views/join.jsp index a5f22a3..2624b79 100644 --- a/src/main/webapp/WEB-INF/views/join.jsp +++ b/src/main/webapp/WEB-INF/views/join.jsp @@ -39,12 +39,7 @@ alert("이름엔 한글만 입력하세요"); return false; } - /* - if(!gfn_isPhoneNumber($("#phone").val())) { - alert("핸드폰번호 형식에 맞게 입력하세요"); - return false; - } - */ + if(!gfn_isEmail($("#email").val())) { alert("이메일 형식에 맞게 입력하세요"); return false; @@ -109,7 +104,9 @@ 아이디:

비밀번호:
이름: -
전화번호: +
전화번호: + +
생년월일:
이메일:
diff --git a/src/main/webapp/WEB-INF/views/sm01list.jsp b/src/main/webapp/WEB-INF/views/sm01list.jsp index 7a3cfd3..e198f89 100644 --- a/src/main/webapp/WEB-INF/views/sm01list.jsp +++ b/src/main/webapp/WEB-INF/views/sm01list.jsp @@ -64,7 +64,7 @@ var user_code = {}; e.preventDefault(); var tr = $(this).parent().parent(); var userid = tr.children("#userid").text(); - + $("#userId").val(userid); var popTitle = "회원정보상세"; var url = "sm01One/" + userid; @@ -97,7 +97,7 @@ var user_code = {}; html += '' + item.userid + ''; html += '' + item.brth + ''; html += '' + item.regdate + ''; - html += '' + item.phone + ''; + html += '' + item.pfnum + "-" + item.pcnum + "-" + item.pbnum + ''; html += '' + item.email + ''; html += '' + gfn_getCommCodeNm(user_code,item.usertype) + ''; html += '' + item.usertype + ''; @@ -126,7 +126,7 @@ var user_code = {}; html += '' + item.userid + ''; html += '' + item.brth + ''; html += '' + item.regdate + ''; - html += '' + item.phone + ''; + html += '' + item.pfnum + "-" + item.pcnum + "-" + item.pbnum + ''; html += '' + item.email + ''; html += '' + gfn_getCommCodeNm(user_code,item.usertype) + ''; html += ''; @@ -137,6 +137,7 @@ var user_code = {}; gfn_paging(data.nowPage, data.totCnt , "#pagenation", "page_move"); }); }; + diff --git a/src/main/webapp/WEB-INF/views/sm01update.jsp b/src/main/webapp/WEB-INF/views/sm01update.jsp index fa38916..93fc627 100644 --- a/src/main/webapp/WEB-INF/views/sm01update.jsp +++ b/src/main/webapp/WEB-INF/views/sm01update.jsp @@ -35,12 +35,7 @@ var product_code = {}; alert("이름엔 한글만 입력하세요"); return false; } - /* - if(!gfn_isPhoneNumber($("#phone").val())) { - alert("핸드폰번호 형식에 맞게 입력하세요"); - return false; - } - */ + if(!gfn_isEmail($("#email").val())) { alert("이메일 형식에 맞게 입력하세요"); return false; @@ -50,12 +45,12 @@ var product_code = {}; alert("생년월일에 숫자만 입력하세요"); return false; } - + /* if(!gfn_IsImage($("#fileInput").val())) { alert("이미지 파일만 입력하세요"); return false; } - + */ return true; } @@ -106,7 +101,16 @@ var product_code = {};


이름: -
전화번호: +
핸드폰번호: + + + + +
집번호: + + + +
생년월일:
이메일:
From 06f33dede3844f38f277d73479737278f3b8f6f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=9D=B8=EC=84=B1?= Date: Tue, 12 Nov 2019 21:42:16 +0900 Subject: [PATCH 5/6] =?UTF-8?q?20191112=20=EC=9C=A0=EC=A0=80=EA=B2=80?= =?UTF-8?q?=EC=83=89=20=EC=BF=BC=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/OracleTables.sql | 2 +- src/main/java/com/singer/dao/SMI1Dao.java | 28 ++++++ .../java/com/singer/service/SMI1Service.java | 10 +++ .../com/singer/service/SMI1ServiceImpl.java | 36 ++++++++ src/main/resources/mappers/SMI1VoMapper.xml | 90 +++++++++++++++++++ 5 files changed, 165 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/singer/dao/SMI1Dao.java create mode 100644 src/main/java/com/singer/service/SMI1Service.java create mode 100644 src/main/java/com/singer/service/SMI1ServiceImpl.java create mode 100644 src/main/resources/mappers/SMI1VoMapper.xml diff --git a/sql/OracleTables.sql b/sql/OracleTables.sql index 1b0773b..bfc603e 100644 --- a/sql/OracleTables.sql +++ b/sql/OracleTables.sql @@ -46,7 +46,7 @@ alter table SMI1 add constraint fk_SMI1 foreign key(userid) references SM01(userid) on delete cascade; CREATE index idx_SMI1_1 -on SMI1(pbnum); +on SMI1(pbnum,pcnum,pfnum); CREATE table SME1 ( userid varchar2(10) not null, diff --git a/src/main/java/com/singer/dao/SMI1Dao.java b/src/main/java/com/singer/dao/SMI1Dao.java new file mode 100644 index 0000000..f9dbeff --- /dev/null +++ b/src/main/java/com/singer/dao/SMI1Dao.java @@ -0,0 +1,28 @@ +package com.singer.dao; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import com.singer.vo.SM01Vo; + +@Repository("smi1Dao") +public class SMI1Dao extends SuperDao { + + private static final String namespace = "com.singer.mappers.SMI1"; + + @SuppressWarnings("unchecked") + public List selectByBrthSMI1Vo(SM01Vo sm01Vo) throws Exception { + return (List) selectList(namespace + ".selectByBrth", sm01Vo); + } + + @SuppressWarnings("unchecked") + public List selectByNameSMI1Vo(SM01Vo sm01Vo) throws Exception { + return (List) selectList(namespace + ".selectByName", sm01Vo); + } + + @SuppressWarnings("unchecked") + public List selectByPhoneSMI1Vo(SM01Vo sm01Vo) throws Exception { + return (List) selectList(namespace + ".selectByPhone", sm01Vo); + } +} diff --git a/src/main/java/com/singer/service/SMI1Service.java b/src/main/java/com/singer/service/SMI1Service.java new file mode 100644 index 0000000..2a53fe3 --- /dev/null +++ b/src/main/java/com/singer/service/SMI1Service.java @@ -0,0 +1,10 @@ +package com.singer.service; + +import java.util.List; + +import com.singer.vo.SM01Vo; + +public interface SMI1Service { + + public List selectSMI1Vo(SM01Vo sm01Vo) throws Exception; +} diff --git a/src/main/java/com/singer/service/SMI1ServiceImpl.java b/src/main/java/com/singer/service/SMI1ServiceImpl.java new file mode 100644 index 0000000..8eb1390 --- /dev/null +++ b/src/main/java/com/singer/service/SMI1ServiceImpl.java @@ -0,0 +1,36 @@ +package com.singer.service; + +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.singer.common.CommonUtil; +import com.singer.dao.SMI1Dao; +import com.singer.vo.SM01Vo; + +@Service("smi1Service") +public class SMI1ServiceImpl implements SMI1Service { + + @Resource(name = "smi1Dao") + private SMI1Dao smi1Dao; + + @Transactional + @Override + public List selectSMI1Vo(SM01Vo sm01Vo) throws Exception { + + List list = null; + if (!CommonUtil.isNull(sm01Vo.getUsername())) { + list = smi1Dao.selectByNameSMI1Vo(sm01Vo); + } else if (!CommonUtil.isNull(sm01Vo.getBrth())) { + list = smi1Dao.selectByBrthSMI1Vo(sm01Vo); + } else if (!CommonUtil.isNull(sm01Vo.getCellpbnum())) { + list = smi1Dao.selectByPhoneSMI1Vo(sm01Vo); + } + + return list; + } + +} diff --git a/src/main/resources/mappers/SMI1VoMapper.xml b/src/main/resources/mappers/SMI1VoMapper.xml new file mode 100644 index 0000000..f7e55cb --- /dev/null +++ b/src/main/resources/mappers/SMI1VoMapper.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + \ No newline at end of file From 19dd193104c5625de133426c73c43984cc5dceb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=9D=B8=EC=84=B1?= Date: Fri, 15 Nov 2019 19:50:20 +0900 Subject: [PATCH 6/6] =?UTF-8?q?20191115=20=EC=9C=A0=EC=A0=80=EA=B2=80?= =?UTF-8?q?=EC=83=89=20view?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/OracleTables.sql | 2 +- .../com/singer/controller/SMI1Controller.java | 47 +++++ src/main/resources/mappers/SMI1VoMapper.xml | 9 +- src/main/webapp/WEB-INF/views/smi1view.jsp | 164 ++++++++++++++++++ 4 files changed, 218 insertions(+), 4 deletions(-) create mode 100644 src/main/java/com/singer/controller/SMI1Controller.java create mode 100644 src/main/webapp/WEB-INF/views/smi1view.jsp diff --git a/sql/OracleTables.sql b/sql/OracleTables.sql index bfc603e..06f58ee 100644 --- a/sql/OracleTables.sql +++ b/sql/OracleTables.sql @@ -83,7 +83,7 @@ insert into MENU values('05','파일 게시판','/sf01page',4,'admin','20180901' insert into MENU values('06','투표 게시판','/sv01page',4,'admin','20180901','admin','20180901'); insert into MENU values('07','맛집 추천','/sr01page',4,'admin','20180901','admin','20180901'); insert into MENU values('08','나의 메모장','/sm02page',4,'admin','20180901','admin','20180901'); - +insert into MENU values('09','유저 검색','/smi1Page',4,'admin','20180901','admin','20180901'); CREATE table CODE_GRP ( codegrp varchar2(5) not null, diff --git a/src/main/java/com/singer/controller/SMI1Controller.java b/src/main/java/com/singer/controller/SMI1Controller.java new file mode 100644 index 0000000..a914ae7 --- /dev/null +++ b/src/main/java/com/singer/controller/SMI1Controller.java @@ -0,0 +1,47 @@ +package com.singer.controller; + +import java.util.List; + +import javax.annotation.Resource; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.ModelAndView; + +import com.singer.service.SMI1Service; +import com.singer.vo.SM01Vo; + +@Controller("smi1Controller") +public class SMI1Controller { + + private final Log log = LogFactory.getLog(SMI1Controller.class); + + @Resource(name = "smi1Service") + private SMI1Service smi1Service; + + @RequestMapping(value = "/smi1Page", method = RequestMethod.GET) + public ModelAndView page() { + ModelAndView model = new ModelAndView("smi1view"); + + return model; + } + + @ResponseBody + @RequestMapping(value = "smi1", method = RequestMethod.POST) + public ResponseEntity selectSMI1Vo(@RequestBody SM01Vo sm01Vo) throws Exception { + log.debug("enter smi1 get"); + + List list = smi1Service.selectSMI1Vo(sm01Vo); + sm01Vo.setList(list); + + log.debug("exit smi1 get"); + return new ResponseEntity(sm01Vo, HttpStatus.OK); + } +} diff --git a/src/main/resources/mappers/SMI1VoMapper.xml b/src/main/resources/mappers/SMI1VoMapper.xml index f7e55cb..a2139fc 100644 --- a/src/main/resources/mappers/SMI1VoMapper.xml +++ b/src/main/resources/mappers/SMI1VoMapper.xml @@ -20,6 +20,7 @@ T1.username, T1.brth, T1.email, + T1.regdate, T1.grade from SM01 T1 where T1.brth = #{brth} and not exists ( @@ -46,6 +47,7 @@ T1.username, T1.brth, T1.email, + T1.regdate, T1.grade from SM01 T1 where T1.username like #{username}||'%' and not exists ( @@ -64,6 +66,7 @@ S1.username as username, S1.brth as brth, S1.email as email, + S1.regdate as regdate, S1.grade as grade, S.pfnum as pfnum, S.pcnum as pcnum, @@ -71,12 +74,12 @@ from (select T1.* from SMI1 T1 - where T1.pbnum = #{pbnum} + where T1.pbnum = #{cellpbnum} - and T1.pcnum = #{pcnum} + and T1.pcnum = #{cellpcnum} - and T1.pfnum = #{pfnum} + and T1.pfnum = #{cellpfnum} AND T1.infocode = 1 and not exists ( diff --git a/src/main/webapp/WEB-INF/views/smi1view.jsp b/src/main/webapp/WEB-INF/views/smi1view.jsp new file mode 100644 index 0000000..52f7253 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/smi1view.jsp @@ -0,0 +1,164 @@ +<%@ page language="java" contentType="text/html; charset=utf-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> + + + + +전국노래자랑 + + + + +" rel="stylesheet"> + + + + +
+

+ 전국 노래자랑 +

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
이름생년월일가입일자핸드폰이메일
+
+

+

+ +