From 5ba49b3527481dd9aab4fb9c147ade5afef2d238 Mon Sep 17 00:00:00 2001 From: TaehunPark Date: Tue, 15 Nov 2022 17:26:52 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=99=B8=EC=82=AC=EA=B2=BD=EC=B0=B0?= =?UTF-8?q?=EA=B5=90=EC=9C=A1=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../faisp/main/userInfo/FaispController.java | 10 ++ .../faisp/main/userInfo/model/UserEdu.java | 71 +++++++++++ .../repository/UserEduRepository.java | 14 +++ src/main/resources/static/js/faisp/edu.js | 116 ++++++++++++++++++ .../templates/faisp/eduEditModal.html | 88 +++++++++++++ .../templates/faisp/educationMgt.html | 10 +- 6 files changed, 302 insertions(+), 7 deletions(-) create mode 100644 src/main/java/com/dbnt/faisp/main/userInfo/model/UserEdu.java create mode 100644 src/main/java/com/dbnt/faisp/main/userInfo/repository/UserEduRepository.java create mode 100644 src/main/resources/static/js/faisp/edu.js create mode 100644 src/main/resources/templates/faisp/eduEditModal.html diff --git a/src/main/java/com/dbnt/faisp/main/userInfo/FaispController.java b/src/main/java/com/dbnt/faisp/main/userInfo/FaispController.java index aeabb7ca..4968c8f7 100644 --- a/src/main/java/com/dbnt/faisp/main/userInfo/FaispController.java +++ b/src/main/java/com/dbnt/faisp/main/userInfo/FaispController.java @@ -196,4 +196,14 @@ public class FaispController { mav.addObject("searchParams", userInfo); return mav; } + + @GetMapping("/eduEditModal") + public ModelAndView eduEditModal(@AuthenticationPrincipal UserInfo loginUser,UserInfo userInfo){ + ModelAndView mav = new ModelAndView("/faisp/eduEditModal"); + + //메뉴권한 확인 + String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/faisp/policeList").get(0).getAccessAuth(); + mav.addObject("accessAuth", accessAuth); + return mav; + } } diff --git a/src/main/java/com/dbnt/faisp/main/userInfo/model/UserEdu.java b/src/main/java/com/dbnt/faisp/main/userInfo/model/UserEdu.java new file mode 100644 index 00000000..2f1476b8 --- /dev/null +++ b/src/main/java/com/dbnt/faisp/main/userInfo/model/UserEdu.java @@ -0,0 +1,71 @@ +package com.dbnt.faisp.main.userInfo.model; + + +import com.dbnt.faisp.config.BaseModel; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicInsert; +import org.hibernate.annotations.DynamicUpdate; +import org.springframework.format.annotation.DateTimeFormat; + + +import javax.persistence.*; + +import java.io.Serializable; +import java.time.LocalDate; +import java.time.LocalDateTime; + + +@Getter +@Setter +@Entity +@NoArgsConstructor +@DynamicInsert +@DynamicUpdate +@IdClass(UserEdu.UserEduId.class) +@Table(name = "user_edu") +public class UserEdu extends BaseModel{ + @Id + @Column(name = "edu_seq") + private Integer eduSeq; + @Id + @Column(name = "user_seq") + private Integer userSeq; + @Column(name = "edu_name") + private String eduName; + @Column(name = "edu_sdate") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate eduSdate; + @Column(name = "edu_edate") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate eduEdate; + @Column(name = "edu_ra") + private String eduRa; + @Column(name = "wrt_organ") + private String wrtOrgan; + @Column(name = "wrt_part") + private String wrtPart; + @Column(name = "wrt_title") + private String wrtTitle; + @Column(name = "wrt_user_seq") + private Integer wrtUserSeq; + @Column(name = "wrt_nm") + private String wrtNm; + @Column(name = "wrt_dt") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime wrtDt; + + @Embeddable + @Data + @NoArgsConstructor + @AllArgsConstructor + public static class UserEduId implements Serializable { + private Integer eduSeq; + private Integer userSeq; + } + +} diff --git a/src/main/java/com/dbnt/faisp/main/userInfo/repository/UserEduRepository.java b/src/main/java/com/dbnt/faisp/main/userInfo/repository/UserEduRepository.java new file mode 100644 index 00000000..92c32111 --- /dev/null +++ b/src/main/java/com/dbnt/faisp/main/userInfo/repository/UserEduRepository.java @@ -0,0 +1,14 @@ +package com.dbnt.faisp.main.userInfo.repository; + +import com.dbnt.faisp.main.userInfo.model.UserEdu; + +import org.springframework.data.jpa.repository.JpaRepository; + + + + +public interface UserEduRepository extends JpaRepository { + + + +} diff --git a/src/main/resources/static/js/faisp/edu.js b/src/main/resources/static/js/faisp/edu.js new file mode 100644 index 00000000..368fb1a3 --- /dev/null +++ b/src/main/resources/static/js/faisp/edu.js @@ -0,0 +1,116 @@ +let eduList=[]; +let selectedIdx=0; + +$(document).on('click', '.policeTr', function (event){ + const target = event.target; + if(!(target.className === "checkBoxTd" ||$(target).parents("td").length>0)){ + const userSeq = (Number($(this).find(".userSeq").val())); + showModal(1); + } +}); + +function showModal(userSeq){ + $.ajax({ + url: '/faisp/eduEditModal', + data: {userSeq: userSeq}, + type: 'GET', + dataType:"html", + success: function(html){ + $("#eduEditModalContent").empty().append(html); + $(".dateSelector").datepicker({ + format: "yyyy-mm-dd", + language: "ko", + autoclose: true + }); + $("#eduEditModal").modal('show'); + }, + error:function(){ + + } + }); +} + +$(document).on('click', '#previousTab', function (){ + const userStatus = $(this).data('userstatus'); + location.href = "/faisp/educationMgt?userStatus="+userStatus; +}) + +$(document).on('click', '#presentTab', function (){ + const userStatus = $(this).data('userstatus'); + location.href = "/faisp/educationMgt?userStatus="+userStatus; +}) +$(document).on('click', '#notPoliceTab', function (){ + const userStatus = $(this).data('userstatus'); + location.href = "/faisp/educationMgt?userStatus="+userStatus; +}) + +$(document).on('click', '#eduAddBtn', function (){ + const userSeq = (Number(1)); + $('#insertEdu').append( + '
'+ + '
'+ + ''+ + '
'+ + ''+ + '
'+ + ''+ + '
'+ + ''+ + '
'+ + ''+ + '
'+ + ''+ + '
'+ + ''+ + '
'+ + ''+ + '
'+ + '
'+ + '
'+ + '
'+ + ''+ + '
'+ + '
'+ + '
' + ) + $(".eduSdate").datepicker({ + format: "yyyy-mm-dd", + language: "ko" + }); + $(".eduEdate").datepicker({ + format: "yyyy-mm-dd", + language: "ko" + }); + eduList.push({useSeq:userSeq, eduName:"",eduSdate:"",eduEdate:"",eduRa:""}); +}) + +$(document).on('click', '.rowDeleteBtn', function (){ + selectedIdx = $(this).parents("#eduDiv").index()-1; + eduList.splice(selectedIdx,1); + $(this).parents('#eduDiv').remove(); +}) + +$(document).on('change', '.eduInput', function (){ + selectedIdx = $(this).parents("#eduDiv").index()-1; + const target = eduList[selectedIdx]; + switch (this.name){ + case "eduName": + target.eduName = this.value + break; + case "eduSdate": + target.eduSdate = this.value + break; + case "eduEdate": + target.eduEdate = this.value + break; + case "eduRa": + target.eduRa = this.value + break; + } +}) + +$(document).on('click', '#saveBtn', function (){ + console.log(eduList); +}) + + diff --git a/src/main/resources/templates/faisp/eduEditModal.html b/src/main/resources/templates/faisp/eduEditModal.html new file mode 100644 index 00000000..23c60621 --- /dev/null +++ b/src/main/resources/templates/faisp/eduEditModal.html @@ -0,0 +1,88 @@ + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/faisp/educationMgt.html b/src/main/resources/templates/faisp/educationMgt.html index 0b1673a2..daa96d98 100644 --- a/src/main/resources/templates/faisp/educationMgt.html +++ b/src/main/resources/templates/faisp/educationMgt.html @@ -3,7 +3,7 @@ xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{layout/layout}"> - +
@@ -96,7 +96,6 @@ 석사 박사 전공 - 최종
수정일 @@ -117,7 +116,6 @@ - @@ -152,8 +150,6 @@
- -
@@ -166,9 +162,9 @@ -