Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Dependabot/maven/org.springframework.security spring security core 4.2.0.release #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
20191111 유저전화번호 테이블 분리
  • Loading branch information
choiis committed Nov 11, 2019
commit 7815df7dac3bcca7ef2965c7bb8cb50dcd04d18e
38 changes: 36 additions & 2 deletions sql/OracleTables.sql
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
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
);

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,
Expand All @@ -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,
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/com/singer/common/Constants.java
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
9 changes: 1 addition & 8 deletions src/main/java/com/singer/controller/LoginController.java
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -72,7 +68,7 @@ public HashMap<String, Object> 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);
Expand All @@ -82,12 +78,9 @@ public HashMap<String, Object> 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());

Expand Down
14 changes: 14 additions & 0 deletions src/main/java/com/singer/controller/SM01Controller.java
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<SM01Vo> 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>(sm01Vo, HttpStatus.OK);
}

}
23 changes: 22 additions & 1 deletion src/main/java/com/singer/dao/SM01Dao.java
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,32 @@ 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")
public List<SM01Vo> selectSM01Vo(SM01Vo sm01Vo) throws Exception {
return (List<SM01Vo>) selectList(namespace + ".select", sm01Vo);
}

@SuppressWarnings("unchecked")
public List<SM01Vo> selectSMI1Vo(SM01Vo sm01Vo) throws Exception {
return (List<SM01Vo>) selectList(namespace + ".selectSMI1", sm01Vo);
}

public SM01Vo selectOneSM01Vo(SM01Vo sm01Vo) throws Exception {
return (SM01Vo) selectOne(namespace + ".selectOne", sm01Vo);
}
Expand All @@ -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<String, Object> hashMap) throws Exception {
return insert(namespace + ".insertImage", hashMap);
}
Expand Down
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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"))) {
Expand All @@ -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");
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/singer/service/SM01Service.java
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
92 changes: 87 additions & 5 deletions src/main/java/com/singer/service/SM01ServiceImpl.java
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -59,10 +59,6 @@ public HashMap<String, Object> 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<String> itr = request.getFileNames();
if (CommonUtil.isNull(itr)) {
Expand All @@ -77,6 +73,8 @@ public HashMap<String, Object> insertSM01Vo(SM01Vo sm01Vo, MultipartHttpServletR
}

hashMap.put("succeed", sm01Dao.insertSM01Vo(sm01Vo));
sm01Vo.setInfocode(PHONE_INFO_CODE.CELL.getValue());
sm01Dao.insertSMI1Vo(sm01Vo);
HashMap<String, Object> putHash = new HashMap<String, Object>();
putHash.put("userid", sm01Vo.getUserid());
putHash.put("regdate", DateUtil.getToday());
Expand All @@ -101,7 +99,34 @@ public List<SM01Vo> selectSM01Vo(SM01Vo sm01Vo) throws Exception {
@Transactional
@Override
public SM01Vo selectOneSM01Vo(SM01Vo sm01Vo) throws Exception {
sm01Vo = sm01Dao.selectOneSM01Vo(sm01Vo);
List<SM01Vo> 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);
}

Expand Down Expand Up @@ -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())) {

Expand All @@ -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;
}

}
Loading

AltStyle によって変換されたページ (->オリジナル) /