@@ -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";
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -19,4 +19,7 @@ public interface AuthorMapper {
|
||||
/* 작가 상세 */
|
||||
public AuthorVO authorGetDetail(int authorId);
|
||||
|
||||
/* 작가 정보 수정 */
|
||||
public int authorModify(AuthorVO author);
|
||||
|
||||
}
|
||||
|
||||
@@ -19,4 +19,7 @@ public interface AuthorService {
|
||||
/* 작가 상세 페이지 */
|
||||
public AuthorVO authorGetDetail(int authorId) throws Exception;
|
||||
|
||||
/* 작가 정보 수정 */
|
||||
public int authorModify(AuthorVO author) throws Exception;
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -55,4 +55,11 @@
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 작가 정보 수정 -->
|
||||
<update id="authorModify">
|
||||
|
||||
update vam_author set authorName=#{authorName}, nationId=#{nationId}, authorIntro=#{authorIntro}, updatedate=sysdate where authorId = #{authorId}
|
||||
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -115,8 +115,10 @@
|
||||
$(document).ready(function(){
|
||||
|
||||
let result = '<c:out value="${enroll_result}"/>';
|
||||
let mresult = '<c:out value="${modify_result}"/>';
|
||||
|
||||
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("작가 정부 수정을 하지 못하였습니다.")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -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()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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()));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -55,4 +55,11 @@
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 작가 정보 수정 -->
|
||||
<update id="authorModify">
|
||||
|
||||
update vam_author set authorName=#{authorName}, nationId=#{nationId}, authorIntro=#{authorIntro}, updatedate=sysdate where authorId = #{authorId}
|
||||
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -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";
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -19,4 +19,7 @@ public interface AuthorMapper {
|
||||
/* 작가 상세 */
|
||||
public AuthorVO authorGetDetail(int authorId);
|
||||
|
||||
/* 작가 정보 수정 */
|
||||
public int authorModify(AuthorVO author);
|
||||
|
||||
}
|
||||
|
||||
@@ -19,4 +19,7 @@ public interface AuthorService {
|
||||
/* 작가 상세 페이지 */
|
||||
public AuthorVO authorGetDetail(int authorId) throws Exception;
|
||||
|
||||
/* 작가 정보 수정 */
|
||||
public int authorModify(AuthorVO author) throws Exception;
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -45,5 +45,12 @@
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 작가 내용 수정 -->
|
||||
<update id="authorModify">
|
||||
|
||||
update vam_author set authorName=#{authorName}, nationId=#{nationId}, authorIntro=#{authorIntro}, updatedate=now() where authorId = #{authorId}
|
||||
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -115,8 +115,10 @@
|
||||
$(document).ready(function(){
|
||||
|
||||
let result = '<c:out value="${enroll_result}"/>';
|
||||
let mresult = '<c:out value="${modify_result}"/>';
|
||||
|
||||
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("작가 정부 수정을 하지 못하였습니다.")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -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()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -45,5 +45,12 @@
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 작가 내용 수정 -->
|
||||
<update id="authorModify">
|
||||
|
||||
update vam_author set authorName=#{authorName}, nationId=#{nationId}, authorIntro=#{authorIntro}, updatedate=now() where authorId = #{authorId}
|
||||
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user