diff --git a/VamPa/src/main/java/com/vam/controller/AdminController.java b/VamPa/src/main/java/com/vam/controller/AdminController.java
index a370921..170f84f 100644
--- a/VamPa/src/main/java/com/vam/controller/AdminController.java
+++ b/VamPa/src/main/java/com/vam/controller/AdminController.java
@@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
@@ -99,6 +100,20 @@ public class AdminController {
model.addAttribute("authorInfo", authorService.authorGetDetail(authorId));
}
+
+ /* 작가 정보 수정 */
+ @PostMapping("/authorModify")
+ public String authorModifyPOST(AuthorVO author, RedirectAttributes rttr) throws Exception{
+
+ logger.info("authorModifyPOST......." + author);
+
+ int result = authorService.authorModify(author);
+
+ rttr.addFlashAttribute("modify_result", result);
+
+ return "redirect:/admin/authorManage";
+
+ }
}
diff --git a/VamPa/src/main/java/com/vam/mapper/AuthorMapper.java b/VamPa/src/main/java/com/vam/mapper/AuthorMapper.java
index 8b25127..cda6633 100644
--- a/VamPa/src/main/java/com/vam/mapper/AuthorMapper.java
+++ b/VamPa/src/main/java/com/vam/mapper/AuthorMapper.java
@@ -19,4 +19,7 @@ public interface AuthorMapper {
/* 작가 상세 */
public AuthorVO authorGetDetail(int authorId);
+ /* 작가 정보 수정 */
+ public int authorModify(AuthorVO author);
+
}
diff --git a/VamPa/src/main/java/com/vam/service/AuthorService.java b/VamPa/src/main/java/com/vam/service/AuthorService.java
index 284ea9b..ce8fdf6 100644
--- a/VamPa/src/main/java/com/vam/service/AuthorService.java
+++ b/VamPa/src/main/java/com/vam/service/AuthorService.java
@@ -19,4 +19,7 @@ public interface AuthorService {
/* 작가 상세 페이지 */
public AuthorVO authorGetDetail(int authorId) throws Exception;
+ /* 작가 정보 수정 */
+ public int authorModify(AuthorVO author) throws Exception;
+
}
diff --git a/VamPa/src/main/java/com/vam/service/AuthorServiceImpl.java b/VamPa/src/main/java/com/vam/service/AuthorServiceImpl.java
index cb5f44c..307f50c 100644
--- a/VamPa/src/main/java/com/vam/service/AuthorServiceImpl.java
+++ b/VamPa/src/main/java/com/vam/service/AuthorServiceImpl.java
@@ -48,6 +48,13 @@ public class AuthorServiceImpl implements AuthorService {
public AuthorVO authorGetDetail(int authorId) throws Exception {
log.info("authorGetDetail........" + authorId);
return authorMapper.authorGetDetail(authorId);
- }
+ }
+
+ /* 작가 정보 수정 */
+ @Override
+ public int authorModify(AuthorVO author) throws Exception {
+ log.info("(service) authorModify........." + author);
+ return authorMapper.authorModify(author);
+ }
}
diff --git a/VamPa/src/main/resources/com/vam/mapper/AuthorMapper.xml b/VamPa/src/main/resources/com/vam/mapper/AuthorMapper.xml
index b6a306d..ad6dd8c 100644
--- a/VamPa/src/main/resources/com/vam/mapper/AuthorMapper.xml
+++ b/VamPa/src/main/resources/com/vam/mapper/AuthorMapper.xml
@@ -55,4 +55,11 @@
+
+
+
+ update vam_author set authorName=#{authorName}, nationId=#{nationId}, authorIntro=#{authorIntro}, updatedate=sysdate where authorId = #{authorId}
+
+
+
\ No newline at end of file
diff --git a/VamPa/src/main/webapp/WEB-INF/views/admin/authorManage.jsp b/VamPa/src/main/webapp/WEB-INF/views/admin/authorManage.jsp
index 22976b6..c76cada 100644
--- a/VamPa/src/main/webapp/WEB-INF/views/admin/authorManage.jsp
+++ b/VamPa/src/main/webapp/WEB-INF/views/admin/authorManage.jsp
@@ -115,8 +115,10 @@
$(document).ready(function(){
let result = '';
+ let mresult = '';
checkResult(result);
+ checkmResult(mresult);
function checkResult(result){
@@ -127,6 +129,17 @@ $(document).ready(function(){
alert("작가'${enroll_result}'을 등록하였습니다.");
}
+
+ function checkmResult(mresult){
+
+ if(mresult === '1'){
+ alert("작가 정보 수정을 완료하였습니다.");
+ } else if(mresult === '0') {
+ alert("작가 정부 수정을 하지 못하였습니다.")
+ }
+
+ }
+
});
diff --git a/VamPa/src/test/java/com/vam/mapper/AuthorMapperTests.java b/VamPa/src/test/java/com/vam/mapper/AuthorMapperTests.java
index fd88c48..c344cca 100644
--- a/VamPa/src/test/java/com/vam/mapper/AuthorMapperTests.java
+++ b/VamPa/src/test/java/com/vam/mapper/AuthorMapperTests.java
@@ -68,6 +68,7 @@ public class AuthorMapperTests {
*/
/* 작가 상세 페이지 */
+ /*
@Test
public void authorGetDetailTest() {
@@ -78,6 +79,25 @@ public class AuthorMapperTests {
System.out.println("author......." + author);
}
+ */
+
+ /* 작가 정보 수정 */
+ @Test
+ public void authorModifyTest() {
+
+ AuthorVO author = new AuthorVO();
+
+ author.setAuthorId(1);
+ System.out.println("수정 전...................." + mapper.authorGetDetail(author.getAuthorId()));
+
+ author.setAuthorName("수정");
+ author.setNationId("01");
+ author.setAuthorIntro("소개 수정 하였습니다.");
+
+ mapper.authorModify(author);
+ System.out.println("수정 후...................." + mapper.authorGetDetail(author.getAuthorId()));
+
+ }
diff --git a/VamPa/src/test/java/com/vam/service/AuthorServiceTests.java b/VamPa/src/test/java/com/vam/service/AuthorServiceTests.java
index 03ba087..7594294 100644
--- a/VamPa/src/test/java/com/vam/service/AuthorServiceTests.java
+++ b/VamPa/src/test/java/com/vam/service/AuthorServiceTests.java
@@ -1,14 +1,12 @@
package com.vam.service;
-import java.util.List;
-
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import com.vam.model.Criteria;
+import com.vam.model.AuthorVO;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("file:src/main/webapp/WEB-INF/spring/root-context.xml")
@@ -51,13 +49,33 @@ public class AuthorServiceTests {
*/
/*작가 상세 페이지*/
+ /*
@Test
public void authorGetDetailTest() throws Exception{
int authorId = 20;
- System.out.println("author......" + service.authorGetDetail(authorId));
+ Log.info("author......" + service.authorGetDetail(authorId));
+
+ }
+ */
+
+ /* 작가 정보 수정 */
+ @Test
+ public void authorModifyTest() throws Exception {
+
+ AuthorVO author = new AuthorVO();
+ author.setAuthorId(1);
+ System.out.println("(service)수정 전...................." + service.authorGetDetail(author.getAuthorId()));
+
+ author.setAuthorName("(service)수정");
+ author.setNationId("01");
+ author.setAuthorIntro("(service)소개 수정 하였습니다.");
+
+ service.authorModify(author);
+ System.out.println("(service)수정 후...................." + service.authorGetDetail(author.getAuthorId()));
+
}
}
diff --git a/VamPa/target/classes/com/vam/mapper/AuthorMapper.xml b/VamPa/target/classes/com/vam/mapper/AuthorMapper.xml
index b6a306d..ad6dd8c 100644
--- a/VamPa/target/classes/com/vam/mapper/AuthorMapper.xml
+++ b/VamPa/target/classes/com/vam/mapper/AuthorMapper.xml
@@ -55,4 +55,11 @@
+
+
+
+ update vam_author set authorName=#{authorName}, nationId=#{nationId}, authorIntro=#{authorIntro}, updatedate=sysdate where authorId = #{authorId}
+
+
+
\ No newline at end of file
diff --git a/VamPa_MySQL/src/main/java/com/vam/controller/AdminController.java b/VamPa_MySQL/src/main/java/com/vam/controller/AdminController.java
index 1977cf2..1bc6073 100644
--- a/VamPa_MySQL/src/main/java/com/vam/controller/AdminController.java
+++ b/VamPa_MySQL/src/main/java/com/vam/controller/AdminController.java
@@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
@@ -100,5 +101,19 @@ public class AdminController {
}
+ /* 작가 정보 수정 */
+ @PostMapping("/authorModify")
+ public String authorModifyPOST(AuthorVO author, RedirectAttributes rttr) throws Exception{
+
+ logger.info("authorModifyPOST......." + author);
+
+ int result = authorService.authorModify(author);
+
+ rttr.addFlashAttribute("modify_result", result);
+
+ return "redirect:/admin/authorManage";
+
+ }
+
}
diff --git a/VamPa_MySQL/src/main/java/com/vam/mapper/AuthorMapper.java b/VamPa_MySQL/src/main/java/com/vam/mapper/AuthorMapper.java
index dcb919d..1f2319d 100644
--- a/VamPa_MySQL/src/main/java/com/vam/mapper/AuthorMapper.java
+++ b/VamPa_MySQL/src/main/java/com/vam/mapper/AuthorMapper.java
@@ -19,4 +19,7 @@ public interface AuthorMapper {
/* 작가 상세 */
public AuthorVO authorGetDetail(int authorId);
+ /* 작가 정보 수정 */
+ public int authorModify(AuthorVO author);
+
}
diff --git a/VamPa_MySQL/src/main/java/com/vam/service/AuthorService.java b/VamPa_MySQL/src/main/java/com/vam/service/AuthorService.java
index 1a222c1..9f697a8 100644
--- a/VamPa_MySQL/src/main/java/com/vam/service/AuthorService.java
+++ b/VamPa_MySQL/src/main/java/com/vam/service/AuthorService.java
@@ -19,4 +19,7 @@ public interface AuthorService {
/* 작가 상세 페이지 */
public AuthorVO authorGetDetail(int authorId) throws Exception;
+ /* 작가 정보 수정 */
+ public int authorModify(AuthorVO author) throws Exception;
+
}
diff --git a/VamPa_MySQL/src/main/java/com/vam/service/AuthorServiceImpl.java b/VamPa_MySQL/src/main/java/com/vam/service/AuthorServiceImpl.java
index 594c9f6..22e206c 100644
--- a/VamPa_MySQL/src/main/java/com/vam/service/AuthorServiceImpl.java
+++ b/VamPa_MySQL/src/main/java/com/vam/service/AuthorServiceImpl.java
@@ -49,5 +49,12 @@ public class AuthorServiceImpl implements AuthorService {
log.info("authorGetDetail........" + authorId);
return authorMapper.authorGetDetail(authorId);
}
+
+ /* 작가 정보 수정 */
+ @Override
+ public int authorModify(AuthorVO author) throws Exception {
+ log.info("(service) authorModify........." + author);
+ return authorMapper.authorModify(author);
+ }
}
diff --git a/VamPa_MySQL/src/main/resources/com/vam/mapper/AuthorMapper.xml b/VamPa_MySQL/src/main/resources/com/vam/mapper/AuthorMapper.xml
index 2cc5353..d1dae07 100644
--- a/VamPa_MySQL/src/main/resources/com/vam/mapper/AuthorMapper.xml
+++ b/VamPa_MySQL/src/main/resources/com/vam/mapper/AuthorMapper.xml
@@ -45,5 +45,12 @@
+
+
+
+ update vam_author set authorName=#{authorName}, nationId=#{nationId}, authorIntro=#{authorIntro}, updatedate=now() where authorId = #{authorId}
+
+
+
\ No newline at end of file
diff --git a/VamPa_MySQL/src/main/webapp/WEB-INF/views/admin/authorManage.jsp b/VamPa_MySQL/src/main/webapp/WEB-INF/views/admin/authorManage.jsp
index 22976b6..c76cada 100644
--- a/VamPa_MySQL/src/main/webapp/WEB-INF/views/admin/authorManage.jsp
+++ b/VamPa_MySQL/src/main/webapp/WEB-INF/views/admin/authorManage.jsp
@@ -115,8 +115,10 @@
$(document).ready(function(){
let result = '';
+ let mresult = '';
checkResult(result);
+ checkmResult(mresult);
function checkResult(result){
@@ -127,6 +129,17 @@ $(document).ready(function(){
alert("작가'${enroll_result}'을 등록하였습니다.");
}
+
+ function checkmResult(mresult){
+
+ if(mresult === '1'){
+ alert("작가 정보 수정을 완료하였습니다.");
+ } else if(mresult === '0') {
+ alert("작가 정부 수정을 하지 못하였습니다.")
+ }
+
+ }
+
});
diff --git a/VamPa_MySQL/src/test/java/com/vam/mapper/AuthorMapperTests.java b/VamPa_MySQL/src/test/java/com/vam/mapper/AuthorMapperTests.java
index 799b69c..084755c 100644
--- a/VamPa_MySQL/src/test/java/com/vam/mapper/AuthorMapperTests.java
+++ b/VamPa_MySQL/src/test/java/com/vam/mapper/AuthorMapperTests.java
@@ -68,6 +68,7 @@ public class AuthorMapperTests {
*/
/* 작가 상세 페이지 */
+ /*
@Test
public void authorGetDetailTest() {
@@ -78,6 +79,25 @@ public class AuthorMapperTests {
System.out.println("author......." + author);
}
+ */
+
+ /* 작가 정보 수정 */
+ @Test
+ public void authorModifyTest() {
+
+ AuthorVO author = new AuthorVO();
+
+ author.setAuthorId(1);
+ System.out.println("수정 전...................." + mapper.authorGetDetail(author.getAuthorId()));
+
+ author.setAuthorName("수정");
+ author.setNationId("01");
+ author.setAuthorIntro("소개 수정 하였습니다.");
+
+ mapper.authorModify(author);
+ System.out.println("수정 후...................." + mapper.authorGetDetail(author.getAuthorId()));
+
+ }
}
diff --git a/VamPa_MySQL/src/test/java/com/vam/service/AuthorServiceTests.java b/VamPa_MySQL/src/test/java/com/vam/service/AuthorServiceTests.java
index 37c8f08..0b1a8cb 100644
--- a/VamPa_MySQL/src/test/java/com/vam/service/AuthorServiceTests.java
+++ b/VamPa_MySQL/src/test/java/com/vam/service/AuthorServiceTests.java
@@ -52,6 +52,7 @@ public class AuthorServiceTests {
*/
/*작가 상세 페이지*/
+ /*
@Test
public void authorGetDetailTest() throws Exception{
@@ -60,6 +61,27 @@ public class AuthorServiceTests {
Log.info("author......" + service.authorGetDetail(authorId));
}
+ */
+
+ /* 작가 정보 수정 */
+ @Test
+ public void authorModifyTest() throws Exception {
+
+ AuthorVO author = new AuthorVO();
+
+ author.setAuthorId(1);
+ System.out.println("(service)수정 전...................." + service.authorGetDetail(author.getAuthorId()));
+
+ author.setAuthorName("(service)수정");
+ author.setNationId("01");
+ author.setAuthorIntro("(service)소개 수정 하였습니다.");
+
+ service.authorModify(author);
+ System.out.println("(service)수정 후...................." + service.authorGetDetail(author.getAuthorId()));
+
+ }
+
+
}
diff --git a/VamPa_MySQL/target/classes/com/vam/mapper/AuthorMapper.xml b/VamPa_MySQL/target/classes/com/vam/mapper/AuthorMapper.xml
index 2cc5353..d1dae07 100644
--- a/VamPa_MySQL/target/classes/com/vam/mapper/AuthorMapper.xml
+++ b/VamPa_MySQL/target/classes/com/vam/mapper/AuthorMapper.xml
@@ -45,5 +45,12 @@
+
+
+
+ update vam_author set authorName=#{authorName}, nationId=#{nationId}, authorIntro=#{authorIntro}, updatedate=now() where authorId = #{authorId}
+
+
+
\ No newline at end of file