@Data
public class TitleVO {
private long boardSeq;
private String title;
private String writer;
private Date date;
private String dateString;
private long count;
private String userId; // userId가 아니라 Name아닌가?
private long userSeq;
private boolean boardDel;
private PostReplyVO postReplyVO; // 게시물 화면에서 그릴 때 순서 필요
public PostReplyVO getPostReplyVO() {
return postReplyVO;
}
}
@Data
@NoArgsConstructor
@AllArgsConstructor
public class PostReplyVO {
private long boardSeq;
private long parentSeq;
private int boardOrder;
private long boardDepth;
}
<resultMap id="postReply" type="TitleVO">
<id property="boardSeq" column="boardSeq" />
<id property="title" column="title" />
<id property="writer" column="writer" />
<id property="date" column="date" />
<id property="count" column="count" />
<association property="postReplyVO" javaType="PostReplyVO" >
<result property="boardSeq" column="boardSeq" />
<result property="parentSeq" column="parentSeq" />
<result property="boardOrder" column="boardOrder" />
<result property="boardDepth" column="boardDepth" />
</association>
</resultMap>
<select id="getTitleVOList" parameterType="SelectVO" resultMap="postReply">
SELECT board_seq as boardSeq
, title
, writer
, date
, count
, user_id as userId
, user_seq as userSeq
, board_del as boardDel
, parent_seq as parentSeq
, board_order as boardOrder
, board_depth as boardDepth
FROM board
<include refid="searchBoard"></include>
ORDER BY parent_seq DESC, board_order ASC
LIMIT #{start}, #{length}
</select>