통역인현황 수정 작업완료.
parent
7543382848
commit
7ec8d0a5ca
|
|
@ -126,14 +126,16 @@ public class TranslatorController {
|
|||
}
|
||||
|
||||
@GetMapping("/careerInsertTr")
|
||||
public ModelAndView careerInsertTr(){
|
||||
return new ModelAndView("translator/careerTr");
|
||||
public ModelAndView careerInsertTr(TranslatorCrr translatorCrr){
|
||||
ModelAndView mav = new ModelAndView("translator/careerTr");
|
||||
mav.addObject("career", translatorCrr);
|
||||
return mav;
|
||||
}
|
||||
|
||||
@PostMapping("/insertTranslatorCareer")
|
||||
@PostMapping("/saveTranslatorCareer")
|
||||
@ResponseBody
|
||||
public int insertTranslatorCareer(@RequestBody List<TranslatorCrr> translatorCrr){
|
||||
int trKey = translatorSevice.insertTranslatorCareer(translatorCrr);
|
||||
public int saveTranslatorCareer(@RequestBody List<TranslatorCrr> translatorCrr){
|
||||
int trKey = translatorSevice.saveTranslatorCareer(translatorCrr);
|
||||
return trKey;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,21 +40,16 @@ public class TranslatorCrr extends BaseModel implements Serializable{
|
|||
private LocalDate tcDt;
|
||||
@Column(name = "remark")
|
||||
private String remark;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TranslatorCrr [careerSeq=" + careerSeq + ", translatorKey=" + translatorKey + ", hisGubun=" + hisGubun
|
||||
+ ", contents=" + contents + ", tcDt=" + tcDt + ", remark=" + remark + "]";
|
||||
}
|
||||
|
||||
|
||||
@Embeddable
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class TranslatorCrrId implements Serializable {
|
||||
private Integer careerSeq;
|
||||
private Integer translatorKey;
|
||||
}
|
||||
@Transient
|
||||
private String state;
|
||||
|
||||
@Embeddable
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class TranslatorCrrId implements Serializable {
|
||||
private Integer careerSeq;
|
||||
private Integer translatorKey;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import java.util.Optional;
|
|||
|
||||
public interface TranslatorCareerRepository extends JpaRepository<TranslatorCrr, TranslatorCrr.TranslatorCrrId> {
|
||||
|
||||
TranslatorCrr findTopByTranslatorKeyOrderByCareerSeqDesc(Integer translatorKey);
|
||||
Optional<TranslatorCrr> findTopByTranslatorKeyOrderByCareerSeqDesc(Integer translatorKey);
|
||||
|
||||
Optional<TranslatorCrr> findByCareerSeqAndTranslatorKey(Integer careerSeq, Integer translatorKey);
|
||||
|
||||
|
|
|
|||
|
|
@ -57,19 +57,27 @@ public class TranslatorService {
|
|||
return translatorCareerRepository.findByTranslatorKeyOrderByCareerSeqDesc(translatorKey);
|
||||
}
|
||||
|
||||
public int insertTranslatorCareer(List<TranslatorCrr> translatorCrr) {
|
||||
int trKey = 0;
|
||||
for(TranslatorCrr tCrr : translatorCrr ) {
|
||||
TranslatorCrr dbCareer = translatorCareerRepository.findTopByTranslatorKeyOrderByCareerSeqDesc(tCrr.getTranslatorKey());
|
||||
if (dbCareer == null) {
|
||||
tCrr.setCareerSeq(1);
|
||||
translatorCareerRepository.save(tCrr);
|
||||
} else {
|
||||
tCrr.setCareerSeq(dbCareer.getCareerSeq()+ 1);
|
||||
translatorCareerRepository.save(tCrr);
|
||||
}
|
||||
trKey = tCrr.getTranslatorKey();
|
||||
@Transactional
|
||||
public int saveTranslatorCareer(List<TranslatorCrr> crrList) {
|
||||
int trKey = crrList.get(0).getTranslatorKey();
|
||||
TranslatorCrr dbCareer = translatorCareerRepository.findTopByTranslatorKeyOrderByCareerSeqDesc(trKey).orElse(null);
|
||||
int lastSeq = dbCareer==null?1:(dbCareer.getCareerSeq()+1);
|
||||
List<TranslatorCrr> saveList = new ArrayList<>();
|
||||
List<TranslatorCrr> deleteList = new ArrayList<>();
|
||||
for(TranslatorCrr tCrr : crrList ) {
|
||||
switch (tCrr.getState()){
|
||||
case "new":
|
||||
tCrr.setCareerSeq(lastSeq++);
|
||||
case "updated":
|
||||
saveList.add(tCrr);
|
||||
break;
|
||||
case "deleted":
|
||||
deleteList.add(tCrr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
translatorCareerRepository.deleteAll(deleteList);
|
||||
translatorCareerRepository.saveAll(saveList);
|
||||
return trKey;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,10 @@ $(document).on('click', '.infoTr', function (){
|
|||
getTranslatorEditModal($(this).find(".trKey").val(), $(this).find(".verNo").val());
|
||||
})
|
||||
|
||||
$(document).on('change', '.careerInfo', function (){
|
||||
$(this).parents('tr').find('.state').val('updated')
|
||||
})
|
||||
|
||||
|
||||
function getTranslatorEditModal(translatorKey, versionNo){
|
||||
$.ajax({
|
||||
|
|
@ -34,6 +38,11 @@ function getTranslatorEditModal(translatorKey, versionNo){
|
|||
success: function(html){
|
||||
$("#translatorEditModalContent").empty().append(html)
|
||||
$("#translatorEditModal").modal('show');
|
||||
$(".tcDt").datepicker({
|
||||
format: "yyyy-mm-dd",
|
||||
language: "ko",
|
||||
autoclose: true
|
||||
});
|
||||
$("#viewAptDt").datepicker({
|
||||
format: "yyyy-mm-dd",
|
||||
language: "ko",
|
||||
|
|
@ -103,39 +112,6 @@ $(document).on('click', '#approvalTab', function (){
|
|||
document.getElementById('approvalTab').classList.add('active');
|
||||
})
|
||||
|
||||
$(document).on('click', '#accessTab', function (){
|
||||
const trKey = (Number($('.tapTrKey').val()));
|
||||
const verNo = (Number($('.tapVerNo').val()));
|
||||
const url = '/translator/translatorEditModal';
|
||||
revisionHistory(trKey,verNo,url);
|
||||
document.getElementById('approvalTab').classList.remove('active');
|
||||
document.getElementById('accessTab').classList.add('active');
|
||||
})
|
||||
|
||||
function revisionHistory(trKey,verNo,url){
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: {
|
||||
translatorKey: trKey,
|
||||
versionNo : verNo
|
||||
},
|
||||
type: 'GET',
|
||||
dataType:"html",
|
||||
success: function(html){
|
||||
$("#translatorEditContent").empty().append(html)
|
||||
$("#translatorEditModal").modal('show');
|
||||
$("#viewAptDt").datepicker({
|
||||
format: "yyyy-mm-dd",
|
||||
language: "ko",
|
||||
autoclose: true
|
||||
});
|
||||
},
|
||||
error:function(e){
|
||||
ajaxErrorAction(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('change', '#trNny', function (){
|
||||
if($(this).val() === "NNY001"){
|
||||
$("#trVisa").attr("disabled", "disabled");
|
||||
|
|
@ -160,6 +136,7 @@ $(document).on('click', '.addCareerBtn', function (){
|
|||
const hisGubun = $(this).attr('data-hisgubun')
|
||||
$.ajax({
|
||||
url: '/translator/careerInsertTr',
|
||||
data: {hisGubun: hisGubun},
|
||||
type: 'GET',
|
||||
dataType:"html",
|
||||
success: function(html){
|
||||
|
|
@ -181,30 +158,49 @@ $(document).on('click', '.addCareerBtn', function (){
|
|||
});
|
||||
})
|
||||
|
||||
$(document).on('click', '#crrInsertBtn', function (){
|
||||
|
||||
})
|
||||
|
||||
$(document).on('click', '#crrSaveBtn', function (){
|
||||
if(confirm("저장하시겠습니까?")){
|
||||
contentFade("in");
|
||||
const translatorKey = $(this).attr('data-translatorkey');
|
||||
const careerList = [];
|
||||
$.each($(".kcgCareerTr"), function (idx, tr){
|
||||
careerList.push({
|
||||
translatorKey: translatorKey,
|
||||
careerSeq: $(tr).find(".careerSeq").val(),
|
||||
hisGubun: $(tr).find(".hisGubun").val(),
|
||||
tcDt: $(tr).find(".tcDt").val(),
|
||||
contents: $(tr).find(".contents").val(),
|
||||
remark: $(tr).find(".remark").val(),
|
||||
state: $(tr).find(".state").val(),
|
||||
})
|
||||
})
|
||||
$.each($(".otherCareerTr"), function (idx, tr){
|
||||
careerList.push({
|
||||
translatorKey: translatorKey,
|
||||
careerSeq: $(tr).find(".careerSeq").val(),
|
||||
hisGubun: $(tr).find(".hisGubun").val(),
|
||||
tcDt: $(tr).find(".tcDt").val(),
|
||||
contents: $(tr).find(".contents").val(),
|
||||
remark: $(tr).find(".remark").val(),
|
||||
state: $(tr).find(".state").val(),
|
||||
})
|
||||
})
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
data : JSON.stringify(trCarrerList),
|
||||
url : "/translator/insertTranslatorCareer",
|
||||
data : JSON.stringify(careerList),
|
||||
url : "/translator/saveTranslatorCareer",
|
||||
contentType: 'application/json',
|
||||
beforeSend: function (xhr){
|
||||
xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val());
|
||||
},
|
||||
success : function(data) {
|
||||
contentFade("out");
|
||||
alert("이력등록이 완료되었습니다.");
|
||||
showCareer(data);
|
||||
trCarrerList.length = 0;
|
||||
alert("경력이 저장되었습니다.");
|
||||
location.reload();
|
||||
},
|
||||
error : function(xhr, status) {
|
||||
contentFade("out");
|
||||
alert("이력등록을 실패하였습니다");
|
||||
alert("경력 저장을 실패하였습니다");
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -212,23 +208,18 @@ $(document).on('click', '#crrSaveBtn', function (){
|
|||
|
||||
$(document).on('click', '.deleteCareerBtn', function (){
|
||||
if(confirm("삭제하시겠습니까?")){
|
||||
/*$.ajax({
|
||||
type : 'POST',
|
||||
url : "/translator/deleteCareer",
|
||||
data : JSON.stringify({careerSeq:crrSeq,
|
||||
translatorKey:trKey}),
|
||||
contentType: 'application/json',
|
||||
beforeSend: function (xhr){
|
||||
xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val());
|
||||
},
|
||||
success : function(data) {
|
||||
alert("삭제 처리되었습니다.");
|
||||
showCareer(data);
|
||||
},
|
||||
error : function(xhr, status) {
|
||||
alert("삭제 처리에 실패하였습니다");
|
||||
}
|
||||
})*/
|
||||
const tr = $(this).parents('tr')
|
||||
const state = tr.find('.state');
|
||||
switch (state.val()){
|
||||
case "new":
|
||||
tr.remove();
|
||||
break;
|
||||
case "saved":
|
||||
case "update":
|
||||
state.val("deleted");
|
||||
tr.hide();
|
||||
break;
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -245,12 +236,12 @@ $(document).on('click', '#trDeleteBtn', function (){
|
|||
xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val());
|
||||
},
|
||||
success : function() {
|
||||
alert("해임되었습니다.");
|
||||
alert("삭제되었습니다.");
|
||||
contentFade("out");
|
||||
location.reload();
|
||||
},
|
||||
error : function(xhr, status) {
|
||||
alert("해임을 실패하였습니다.");
|
||||
alert("삭제를 실패하였습니다.");
|
||||
contentFade("out");
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -2,7 +2,10 @@
|
|||
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
|
||||
<table>
|
||||
<tbody id="addBody">
|
||||
<tr>
|
||||
<tr th:class="${career.hisGubun eq 'Y'?'kcgCareerTr':'otherCareerTr'}">
|
||||
<input type="hidden" class="careerSeq">
|
||||
<input type="hidden" class="hisGubun" th:value="${career.hisGubun}">
|
||||
<input type="hidden" class="state" value="new">
|
||||
<td></td>
|
||||
<td><input type="text" class="form-control form-control-sm tcDt" placeholder="날짜"></td>
|
||||
<td><input type="text" class="form-control form-control-sm contents" placeholder="내용"></td>
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="row justify-content-end">
|
||||
<button type="button" class="btn btn-secondary col-auto mx-1" id="trDeleteBtn" th:if="${accessAuth eq 'ACC003' or wrtUserSeq eq userSeq}">해임</button>
|
||||
<button type="button" class="btn btn-secondary col-auto mx-1" id="trDeleteBtn" th:if="${accessAuth eq 'ACC003' or wrtUserSeq eq userSeq}">삭제</button>
|
||||
<button type="button" class="btn btn-warning col-auto mx-1" id="updateBtn" th:if="${accessAuth eq 'ACC003' or wrtUserSeq eq userSeq}">수정</button>
|
||||
<button type="button" class="btn btn-primary col-auto mx-1" id="saveBtn" th:if="${accessAuth ne 'ACC001' and trInfo.translatorKey eq null}">저장</button>
|
||||
</div>
|
||||
|
|
@ -201,8 +201,8 @@
|
|||
<table class="table table-sm table-hover table-bordered text-center">
|
||||
<colgroup>
|
||||
<col style="width: 5%">
|
||||
<col style="width: 15%">
|
||||
<col style="width: 35%">
|
||||
<col style="width: 10%">
|
||||
<col style="width: 40%">
|
||||
<col style="width: 35%">
|
||||
<col style="width: 10%">
|
||||
</colgroup>
|
||||
|
|
@ -216,11 +216,14 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody class="overflow-scroll table-group-divider text-center" id="kcgCareerTbody">
|
||||
<tr class="" th:each="crrInfo,i:${kcgCareerList}">
|
||||
<tr class="kcgCareerTr" th:each="crrInfo,i:${kcgCareerList}">
|
||||
<input type="hidden" class="careerSeq" th:value="${crrInfo.careerSeq}">
|
||||
<input type="hidden" class="hisGubun" th:value="${crrInfo.hisGubun}">
|
||||
<input type="hidden" class="state" value="saved">
|
||||
<td th:text="${kcgCareerList.size()-i.index}"></td>
|
||||
<td th:text="${crrInfo.tcDt}"></td>
|
||||
<td th:text="${crrInfo.contents}"></td>
|
||||
<td th:text="${crrInfo.remark}"></td>
|
||||
<td><input type="text" class="form-control form-control-sm careerInfo tcDt" th:value="${crrInfo.tcDt}"></td>
|
||||
<td><input type="text" class="form-control form-control-sm careerInfo contents" th:value="${crrInfo.contents}"></td>
|
||||
<td><input type="text" class="form-control form-control-sm careerInfo remark" th:value="${crrInfo.remark}"></td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-danger m-0 deleteCareerBtn"
|
||||
th:if="${accessAuth eq 'ACC003' or wrtUserSeq eq userSeq}">삭제</button>
|
||||
|
|
@ -244,8 +247,8 @@
|
|||
<table class="table table-sm table-hover table-bordered text-center">
|
||||
<colgroup>
|
||||
<col style="width: 5%">
|
||||
<col style="width: 15%">
|
||||
<col style="width: 35%">
|
||||
<col style="width: 10%">
|
||||
<col style="width: 40%">
|
||||
<col style="width: 35%">
|
||||
<col style="width: 10%">
|
||||
</colgroup>
|
||||
|
|
@ -259,11 +262,14 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody class="overflow-scroll table-group-divider" id="otherCareerTbody">
|
||||
<tr class="" th:each="crrInfo,i:${otherCareerList}">
|
||||
<tr class="otherCareerTr" th:each="crrInfo,i:${otherCareerList}">
|
||||
<input type="hidden" class="careerSeq" th:value="${crrInfo.careerSeq}">
|
||||
<input type="hidden" class="hisGubun" th:value="${crrInfo.hisGubun}">
|
||||
<input type="hidden" class="state" value="saved">
|
||||
<td th:text="${otherCareerList.size()-i.index}"></td>
|
||||
<td th:text="${crrInfo.tcDt}"></td>
|
||||
<td th:text="${crrInfo.contents}"></td>
|
||||
<td th:text="${crrInfo.remark}"></td>
|
||||
<td><input type="text" class="form-control form-control-sm careerInfo tcDt" th:value="${crrInfo.tcDt}"></td>
|
||||
<td><input type="text" class="form-control form-control-sm careerInfo contents" th:value="${crrInfo.contents}"></td>
|
||||
<td><input type="text" class="form-control form-control-sm careerInfo remark" th:value="${crrInfo.remark}"></td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-danger m-0 deleteCareerBtn"
|
||||
th:if="${accessAuth eq 'ACC003' or wrtUserSeq eq userSeq}">삭제</button>
|
||||
|
|
@ -283,7 +289,7 @@
|
|||
</table>
|
||||
</div>
|
||||
<div class="row justify-content-end">
|
||||
<button type="button" class="btn btn-primary col-auto" id="crrInsertBtn" th:if="${accessAuth eq 'ACC003' or wrtUserSeq eq userSeq}" th:data-translatorkey="${trInfo.translatorKey}">저장</button>
|
||||
<button type="button" class="btn btn-primary col-auto" id="crrSaveBtn" th:if="${accessAuth eq 'ACC003' or wrtUserSeq eq userSeq}" th:data-translatorkey="${trInfo.translatorKey}">저장</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue