10
VamPa/src/main/java/com/vam/mapper/AuthorMapper.java
Normal file
10
VamPa/src/main/java/com/vam/mapper/AuthorMapper.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.vam.mapper;
|
||||
|
||||
import com.vam.model.AuthorVO;
|
||||
|
||||
public interface AuthorMapper {
|
||||
|
||||
/* 작가 등록 */
|
||||
public void authorEnroll(AuthorVO author);
|
||||
|
||||
}
|
||||
91
VamPa/src/main/java/com/vam/model/AuthorVO.java
Normal file
91
VamPa/src/main/java/com/vam/model/AuthorVO.java
Normal file
@@ -0,0 +1,91 @@
|
||||
package com.vam.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class AuthorVO {
|
||||
|
||||
/* 작가 아이디 */
|
||||
private int authorId;
|
||||
|
||||
/* 작가 이름 */
|
||||
private String authorName;
|
||||
|
||||
/* 국가 id */
|
||||
private String nationId;
|
||||
|
||||
/* 작가 국가 */
|
||||
private String nationName;
|
||||
|
||||
/* 작가 소개 */
|
||||
private String authorIntro;
|
||||
|
||||
/*등록 날짜*/
|
||||
private Date regDate;
|
||||
|
||||
/* 수정 날짜 */
|
||||
private Date updateDate;
|
||||
|
||||
public int getAuthorId() {
|
||||
return authorId;
|
||||
}
|
||||
|
||||
public void setAuthorId(int authorId) {
|
||||
this.authorId = authorId;
|
||||
}
|
||||
|
||||
public String getAuthorName() {
|
||||
return authorName;
|
||||
}
|
||||
|
||||
public void setAuthorName(String authorName) {
|
||||
this.authorName = authorName;
|
||||
}
|
||||
|
||||
public String getNationId() {
|
||||
return nationId;
|
||||
}
|
||||
|
||||
public void setNationId(String nationId) {
|
||||
this.nationId = nationId;
|
||||
}
|
||||
|
||||
public String getNationName() {
|
||||
return nationName;
|
||||
}
|
||||
|
||||
public void setNationName(String nationName) {
|
||||
this.nationName = nationName;
|
||||
}
|
||||
|
||||
public String getAuthorIntro() {
|
||||
return authorIntro;
|
||||
}
|
||||
|
||||
public void setAuthorIntro(String authorIntro) {
|
||||
this.authorIntro = authorIntro;
|
||||
}
|
||||
|
||||
public Date getRegDate() {
|
||||
return regDate;
|
||||
}
|
||||
|
||||
public void setRegDate(Date regDate) {
|
||||
this.regDate = regDate;
|
||||
}
|
||||
|
||||
public Date getUpdateDate() {
|
||||
return updateDate;
|
||||
}
|
||||
|
||||
public void setUpdateDate(Date updateDate) {
|
||||
this.updateDate = updateDate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AuthorVO [authorId=" + authorId + ", authorName=" + authorName + ", nationId=" + nationId
|
||||
+ ", nationName=" + nationName + ", authorIntro=" + authorIntro + ", regDate=" + regDate
|
||||
+ ", updateDate=" + updateDate + "]";
|
||||
}
|
||||
|
||||
}
|
||||
10
VamPa/src/main/java/com/vam/service/AuthorService.java
Normal file
10
VamPa/src/main/java/com/vam/service/AuthorService.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.vam.service;
|
||||
|
||||
import com.vam.model.AuthorVO;
|
||||
|
||||
public interface AuthorService {
|
||||
|
||||
/* 작가 등록 */
|
||||
public void authorEnroll(AuthorVO author) throws Exception;
|
||||
|
||||
}
|
||||
22
VamPa/src/main/java/com/vam/service/AuthorServiceImpl.java
Normal file
22
VamPa/src/main/java/com/vam/service/AuthorServiceImpl.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package com.vam.service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.vam.mapper.AuthorMapper;
|
||||
import com.vam.model.AuthorVO;
|
||||
|
||||
@Service
|
||||
public class AuthorServiceImpl implements AuthorService {
|
||||
|
||||
@Autowired
|
||||
AuthorMapper authorMapper;
|
||||
|
||||
@Override
|
||||
public void authorEnroll(AuthorVO author) throws Exception {
|
||||
|
||||
authorMapper.authorEnroll(author);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
14
VamPa/src/main/resources/com/vam/mapper/AuthorMapper.xml
Normal file
14
VamPa/src/main/resources/com/vam/mapper/AuthorMapper.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.vam.mapper.AuthorMapper">
|
||||
|
||||
<!-- 작가 등록 -->
|
||||
<insert id="authorEnroll">
|
||||
|
||||
insert into vam_author(authorName, nationId, authorIntro) values(#{authorName}, #{nationId}, #{authorIntro} )
|
||||
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
32
VamPa/src/test/java/com/vam/mapper/AuthorMapperTests.java
Normal file
32
VamPa/src/test/java/com/vam/mapper/AuthorMapperTests.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.vam.mapper;
|
||||
|
||||
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.AuthorVO;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("file:src/main/webapp/WEB-INF/spring/root-context.xml")
|
||||
public class AuthorMapperTests {
|
||||
|
||||
@Autowired
|
||||
private AuthorMapper mapper;
|
||||
|
||||
/* 작가 등록 테스트 */
|
||||
@Test
|
||||
public void authorEnroll() throws Exception{
|
||||
|
||||
AuthorVO author = new AuthorVO();
|
||||
|
||||
author.setNationId("01");
|
||||
author.setAuthorName("테스트");
|
||||
author.setAuthorIntro("테스트 소개");
|
||||
|
||||
mapper.authorEnroll(author);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
14
VamPa/target/classes/com/vam/mapper/AuthorMapper.xml
Normal file
14
VamPa/target/classes/com/vam/mapper/AuthorMapper.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.vam.mapper.AuthorMapper">
|
||||
|
||||
<!-- 작가 등록 -->
|
||||
<insert id="authorEnroll">
|
||||
|
||||
insert into vam_author(authorName, nationId, authorIntro) values(#{authorName}, #{nationId}, #{authorIntro} )
|
||||
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
@@ -1,5 +1,5 @@
|
||||
#Generated by Maven Integration for Eclipse
|
||||
#Fri Feb 05 03:32:23 KST 2021
|
||||
#Mon Feb 08 06:13:16 KST 2021
|
||||
m2e.projectLocation=C\:\\Users\\sjinj\\git\\Blog_Project\\VamPa
|
||||
m2e.projectName=VamPa
|
||||
groupId=com.vam
|
||||
|
||||
10
VamPa_MySQL/src/main/java/com/vam/mapper/AuthorMapper.java
Normal file
10
VamPa_MySQL/src/main/java/com/vam/mapper/AuthorMapper.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.vam.mapper;
|
||||
|
||||
import com.vam.model.AuthorVO;
|
||||
|
||||
public interface AuthorMapper {
|
||||
|
||||
/* 작가 등록 */
|
||||
public void authorEnroll(AuthorVO author);
|
||||
|
||||
}
|
||||
91
VamPa_MySQL/src/main/java/com/vam/model/AuthorVO.java
Normal file
91
VamPa_MySQL/src/main/java/com/vam/model/AuthorVO.java
Normal file
@@ -0,0 +1,91 @@
|
||||
package com.vam.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class AuthorVO {
|
||||
|
||||
/* 작가 아이디 */
|
||||
private int authorId;
|
||||
|
||||
/* 작가 이름 */
|
||||
private String authorName;
|
||||
|
||||
/* 국가 id */
|
||||
private String nationId;
|
||||
|
||||
/* 작가 국가 */
|
||||
private String nationName;
|
||||
|
||||
/* 작가 소개 */
|
||||
private String authorIntro;
|
||||
|
||||
/*등록 날짜*/
|
||||
private Date regDate;
|
||||
|
||||
/* 수정 날짜 */
|
||||
private Date updateDate;
|
||||
|
||||
public int getAuthorId() {
|
||||
return authorId;
|
||||
}
|
||||
|
||||
public void setAuthorId(int authorId) {
|
||||
this.authorId = authorId;
|
||||
}
|
||||
|
||||
public String getAuthorName() {
|
||||
return authorName;
|
||||
}
|
||||
|
||||
public void setAuthorName(String authorName) {
|
||||
this.authorName = authorName;
|
||||
}
|
||||
|
||||
public String getNationId() {
|
||||
return nationId;
|
||||
}
|
||||
|
||||
public void setNationId(String nationId) {
|
||||
this.nationId = nationId;
|
||||
}
|
||||
|
||||
public String getNationName() {
|
||||
return nationName;
|
||||
}
|
||||
|
||||
public void setNationName(String nationName) {
|
||||
this.nationName = nationName;
|
||||
}
|
||||
|
||||
public String getAuthorIntro() {
|
||||
return authorIntro;
|
||||
}
|
||||
|
||||
public void setAuthorIntro(String authorIntro) {
|
||||
this.authorIntro = authorIntro;
|
||||
}
|
||||
|
||||
public Date getRegDate() {
|
||||
return regDate;
|
||||
}
|
||||
|
||||
public void setRegDate(Date regDate) {
|
||||
this.regDate = regDate;
|
||||
}
|
||||
|
||||
public Date getUpdateDate() {
|
||||
return updateDate;
|
||||
}
|
||||
|
||||
public void setUpdateDate(Date updateDate) {
|
||||
this.updateDate = updateDate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AuthorVO [authorId=" + authorId + ", authorName=" + authorName + ", nationId=" + nationId
|
||||
+ ", nationName=" + nationName + ", authorIntro=" + authorIntro + ", regDate=" + regDate
|
||||
+ ", updateDate=" + updateDate + "]";
|
||||
}
|
||||
|
||||
}
|
||||
10
VamPa_MySQL/src/main/java/com/vam/service/AuthorService.java
Normal file
10
VamPa_MySQL/src/main/java/com/vam/service/AuthorService.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.vam.service;
|
||||
|
||||
import com.vam.model.AuthorVO;
|
||||
|
||||
public interface AuthorService {
|
||||
|
||||
/* 작가 등록 */
|
||||
public void authorEnroll(AuthorVO author) throws Exception;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.vam.service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.vam.mapper.AuthorMapper;
|
||||
import com.vam.model.AuthorVO;
|
||||
|
||||
@Service
|
||||
public class AuthorServiceImpl implements AuthorService {
|
||||
|
||||
@Autowired
|
||||
AuthorMapper authorMapper;
|
||||
|
||||
@Override
|
||||
public void authorEnroll(AuthorVO author) throws Exception {
|
||||
|
||||
authorMapper.authorEnroll(author);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.vam.mapper.AuthorMapper">
|
||||
|
||||
<!-- 작가 등록 -->
|
||||
<insert id="authorEnroll">
|
||||
|
||||
insert into vam_author(authorName, nationId, authorIntro) values(#{authorName}, #{nationId}, #{authorIntro} )
|
||||
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.vam.mapper;
|
||||
|
||||
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.AuthorVO;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("file:src/main/webapp/WEB-INF/spring/root-context.xml")
|
||||
public class AuthorMapperTests {
|
||||
|
||||
@Autowired
|
||||
private AuthorMapper mapper;
|
||||
|
||||
/* 작가 등록 테스트 */
|
||||
@Test
|
||||
public void authorEnroll() throws Exception{
|
||||
|
||||
AuthorVO author = new AuthorVO();
|
||||
|
||||
author.setNationId("01");
|
||||
author.setAuthorName("테스트");
|
||||
author.setAuthorIntro("테스트 소개");
|
||||
|
||||
mapper.authorEnroll(author);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
14
VamPa_MySQL/target/classes/com/vam/mapper/AuthorMapper.xml
Normal file
14
VamPa_MySQL/target/classes/com/vam/mapper/AuthorMapper.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.vam.mapper.AuthorMapper">
|
||||
|
||||
<!-- 작가 등록 -->
|
||||
<insert id="authorEnroll">
|
||||
|
||||
insert into vam_author(authorName, nationId, authorIntro) values(#{authorName}, #{nationId}, #{authorIntro} )
|
||||
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
@@ -1,5 +1,5 @@
|
||||
#Generated by Maven Integration for Eclipse
|
||||
#Fri Feb 05 03:32:24 KST 2021
|
||||
#Mon Feb 08 06:13:18 KST 2021
|
||||
m2e.projectLocation=C\:\\Users\\sjinj\\git\\Blog_Project\\VamPa_MySQL
|
||||
m2e.projectName=VamPa_MySQL
|
||||
groupId=com.vam
|
||||
|
||||
Reference in New Issue
Block a user