Skip to content

Commit

Permalink
feat(#2) : 게시판 기본 CRUD 기능 mapper 개발
Browse files Browse the repository at this point in the history
  • Loading branch information
jae-doo committed May 14, 2024
1 parent d9575bc commit 3a95c89
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions EnjoyTripBackend/src/main/resources/mapper/board-query.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?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.example.EnjoyTripBackend.repository.BoardRepository">
<insert id="save" parameterType="com.example.EnjoyTripBackend.dto.Board.BoardDto">
insert
into board
values (#{id}, #{memberId}, #{title}, #{content}, now(), now())
</insert>

<select id="findById" parameterType="long" resultType="com.example.EnjoyTripBackend.dto.Board.BoardDto">
select *
from board
where id = #{id}
</select>

<select id="findAll" resultType="com.example.EnjoyTripBackend.dto.Board.BoardDto">
select id, member_id, title, content, createdDate, modifiedDate
from board
</select>

<update id="update" parameterType="map">
update board
set member_id = #{boardDto.memberId},title = #{boardDto.title},content = #{boardDto.content},modifiedDate = now()
where id = #{id}
</update>

<delete id="delete">
delete
from board
where id = #{id}
</delete>
</mapper>

0 comments on commit 3a95c89

Please sign in to comment.