|
|
|
@ -5,106 +5,105 @@
|
|
|
|
|
SELECT
|
|
|
|
|
x.*
|
|
|
|
|
FROM (
|
|
|
|
|
SELECT
|
|
|
|
|
x.bd_no
|
|
|
|
|
,x.bd_tp
|
|
|
|
|
,x.title
|
|
|
|
|
,x.content
|
|
|
|
|
,x.hashtag
|
|
|
|
|
,x.member_id
|
|
|
|
|
,z.title as bd_tp_nm
|
|
|
|
|
,IFNULL(star,0) as star
|
|
|
|
|
,IFNULL(h_nt ,0) as h_nt
|
|
|
|
|
,(select count(*)
|
|
|
|
|
from tbl_bf_board_like tbl
|
|
|
|
|
where tbl.bd_no = x.bd_no ) as l_nt
|
|
|
|
|
,(select count(*)
|
|
|
|
|
from tbl_bf_board_comment tbc
|
|
|
|
|
where tbc.bd_no = x.bd_no ) as c_nt
|
|
|
|
|
,DATE_FORMAT(x.reg_dt,'%H:%i') reg_tm
|
|
|
|
|
,tbv.v_content
|
|
|
|
|
,x.thumbnail
|
|
|
|
|
,m.profile_path
|
|
|
|
|
,m.name
|
|
|
|
|
,m.nickname
|
|
|
|
|
,tmf.mt_file_seq
|
|
|
|
|
,tmf.mt_file_local_url
|
|
|
|
|
,ROW_NUMBER() OVER (ORDER BY x.reg_dt DESC) AS row_num
|
|
|
|
|
FROM tbl_bf_board x
|
|
|
|
|
LEFT JOIN tbl_code_item z
|
|
|
|
|
on x.bd_tp = z.val_1 and cg_cd ='BF_COMMUNITY_TP'
|
|
|
|
|
LEFT JOIN (select bd_no, group_concat(concat (v_content, '♭⊙♭', nvl(v_nt, 0)) separator '♭§♭') v_content
|
|
|
|
|
from tbl_bf_board_vote group by bd_no) tbv ON tbv.bd_no = x.bd_no
|
|
|
|
|
LEFT JOIN tbl_member m ON m.member_id = x.member_id
|
|
|
|
|
LEFT JOIN tbl_bf_board_attach tba ON tba.bd_no = x.bd_no
|
|
|
|
|
and tba.file_seq = (
|
|
|
|
|
SELECT file_seq
|
|
|
|
|
FROM tbl_bf_board_attach fa
|
|
|
|
|
WHERE fa.bd_no = x.bd_no
|
|
|
|
|
LIMIT 1
|
|
|
|
|
)
|
|
|
|
|
LEFT JOIN tbl_mt_file tmf ON tmf.mt_file_seq = tba.file_seq
|
|
|
|
|
|
|
|
|
|
WHERE DATE_FORMAT(x.reg_dt,'%Y%M%d') = DATE_FORMAT(now(),'%Y%M%d')
|
|
|
|
|
and x.use_yn ='Y'
|
|
|
|
|
and x.bd_tp !='BF_CT_TP_5'
|
|
|
|
|
<isNotEmpty property="who" prepend="">
|
|
|
|
|
AND member_id = #member_id#
|
|
|
|
|
</isNotEmpty>
|
|
|
|
|
<isNotEmpty property="bd_tp" prepend="">
|
|
|
|
|
AND x.bd_tp = #bd_tp#
|
|
|
|
|
</isNotEmpty>
|
|
|
|
|
UNION
|
|
|
|
|
SELECT
|
|
|
|
|
x.bd_no
|
|
|
|
|
,x.bd_tp
|
|
|
|
|
,x.title
|
|
|
|
|
,x.content
|
|
|
|
|
,x.hashtag
|
|
|
|
|
,x.member_id
|
|
|
|
|
,z.title as bd_tp_nm
|
|
|
|
|
,IFNULL(star,0) as star
|
|
|
|
|
,IFNULL(h_nt ,0) as h_nt
|
|
|
|
|
,(select count(*)
|
|
|
|
|
from tbl_bf_board_like tbl
|
|
|
|
|
where tbl.bd_no = x.bd_no ) as l_nt
|
|
|
|
|
,(select count(*)
|
|
|
|
|
from tbl_bf_board_comment tbc
|
|
|
|
|
where tbc.bd_no = x.bd_no ) as c_nt
|
|
|
|
|
,DATE_FORMAT(x.reg_dt,'%H:%i') reg_tm
|
|
|
|
|
,tbv.v_content
|
|
|
|
|
,x.thumbnail
|
|
|
|
|
,m.profile_path
|
|
|
|
|
,m.name
|
|
|
|
|
,m.nickname
|
|
|
|
|
,tmf.mt_file_seq
|
|
|
|
|
,tmf.mt_file_local_url
|
|
|
|
|
,ROW_NUMBER() OVER (ORDER BY x.reg_dt DESC) AS row_num
|
|
|
|
|
FROM tbl_bf_board x
|
|
|
|
|
LEFT JOIN tbl_code_item z
|
|
|
|
|
on x.bd_tp = z.val_1 and cg_cd ='BF_COMMUNITY_TP'
|
|
|
|
|
LEFT JOIN (select bd_no, group_concat(concat (v_content, '♭⊙♭', nvl(v_nt, 0)) separator '♭§♭') v_content
|
|
|
|
|
from tbl_bf_board_vote group by bd_no) tbv ON tbv.bd_no = x.bd_no
|
|
|
|
|
LEFT JOIN tbl_member m ON m.member_id = x.member_id
|
|
|
|
|
LEFT JOIN tbl_bf_board_attach tba ON tba.bd_no = x.bd_no
|
|
|
|
|
and tba.file_seq = (
|
|
|
|
|
SELECT file_seq
|
|
|
|
|
FROM tbl_bf_board_attach fa
|
|
|
|
|
WHERE fa.bd_no = x.bd_no
|
|
|
|
|
LIMIT 1
|
|
|
|
|
)
|
|
|
|
|
LEFT JOIN tbl_mt_file tmf ON tmf.mt_file_seq = tba.file_seq
|
|
|
|
|
|
|
|
|
|
WHERE 1 = 1
|
|
|
|
|
and x.use_yn ='Y'
|
|
|
|
|
and x.bd_tp ='BF_CT_TP_5'
|
|
|
|
|
<isNotEmpty property="who" prepend="">
|
|
|
|
|
AND member_id = #member_id#
|
|
|
|
|
</isNotEmpty>
|
|
|
|
|
<isNotEmpty property="bd_tp" prepend="">
|
|
|
|
|
AND x.bd_tp = #bd_tp#
|
|
|
|
|
</isNotEmpty>
|
|
|
|
|
LIMIT 8
|
|
|
|
|
<isNotEqual property="bd_tp" compareValue="BF_CT_TP_5">
|
|
|
|
|
SELECT
|
|
|
|
|
x.bd_no
|
|
|
|
|
,x.bd_tp
|
|
|
|
|
,x.title
|
|
|
|
|
,x.content
|
|
|
|
|
,x.hashtag
|
|
|
|
|
,x.member_id
|
|
|
|
|
,z.title as bd_tp_nm
|
|
|
|
|
,IFNULL(star,0) as star
|
|
|
|
|
,IFNULL(h_nt ,0) as h_nt
|
|
|
|
|
,(select count(*)
|
|
|
|
|
from tbl_bf_board_like tbl
|
|
|
|
|
where tbl.bd_no = x.bd_no ) as l_nt
|
|
|
|
|
,(select count(*)
|
|
|
|
|
from tbl_bf_board_comment tbc
|
|
|
|
|
where tbc.bd_no = x.bd_no ) as c_nt
|
|
|
|
|
,DATE_FORMAT(x.reg_dt,'%H:%i') reg_tm
|
|
|
|
|
,tbv.v_content
|
|
|
|
|
,x.thumbnail
|
|
|
|
|
,m.profile_path
|
|
|
|
|
,m.name
|
|
|
|
|
,m.nickname
|
|
|
|
|
,tmf.mt_file_seq
|
|
|
|
|
,tmf.mt_file_local_url
|
|
|
|
|
,ROW_NUMBER() OVER (ORDER BY x.h_nt desc, x.bd_no desc) AS row_num
|
|
|
|
|
FROM tbl_bf_board x
|
|
|
|
|
LEFT JOIN tbl_code_item z
|
|
|
|
|
on x.bd_tp = z.val_1 and cg_cd ='BF_COMMUNITY_TP'
|
|
|
|
|
LEFT JOIN (select bd_no, group_concat(concat (v_content, '♭⊙♭', nvl(v_nt, 0)) separator '♭§♭') v_content
|
|
|
|
|
from tbl_bf_board_vote group by bd_no) tbv ON tbv.bd_no = x.bd_no
|
|
|
|
|
LEFT JOIN tbl_member m ON m.member_id = x.member_id
|
|
|
|
|
LEFT JOIN tbl_bf_board_attach tba ON tba.bd_no = x.bd_no
|
|
|
|
|
and tba.file_seq = (
|
|
|
|
|
SELECT file_seq
|
|
|
|
|
FROM tbl_bf_board_attach fa
|
|
|
|
|
WHERE fa.bd_no = x.bd_no
|
|
|
|
|
LIMIT 1
|
|
|
|
|
)
|
|
|
|
|
LEFT JOIN tbl_mt_file tmf ON tmf.mt_file_seq = tba.file_seq
|
|
|
|
|
|
|
|
|
|
WHERE DATE_FORMAT(x.reg_dt,'%Y%M%d') = DATE_FORMAT(now(),'%Y%M%d')
|
|
|
|
|
and x.use_yn ='Y'
|
|
|
|
|
<isNotEmpty property="who" prepend="">
|
|
|
|
|
AND member_id = #member_id#
|
|
|
|
|
</isNotEmpty>
|
|
|
|
|
<isNotEmpty property="bd_tp" prepend="">
|
|
|
|
|
AND x.bd_tp = #bd_tp#
|
|
|
|
|
</isNotEmpty>
|
|
|
|
|
</isNotEqual>
|
|
|
|
|
<isEqual property="bd_tp" compareValue="BF_CT_TP_5">
|
|
|
|
|
SELECT
|
|
|
|
|
x.bd_no
|
|
|
|
|
,x.bd_tp
|
|
|
|
|
,x.title
|
|
|
|
|
,x.content
|
|
|
|
|
,x.hashtag
|
|
|
|
|
,x.member_id
|
|
|
|
|
,z.title as bd_tp_nm
|
|
|
|
|
,IFNULL(star,0) as star
|
|
|
|
|
,IFNULL(h_nt ,0) as h_nt
|
|
|
|
|
,(select count(*)
|
|
|
|
|
from tbl_bf_board_like tbl
|
|
|
|
|
where tbl.bd_no = x.bd_no ) as l_nt
|
|
|
|
|
,(select count(*)
|
|
|
|
|
from tbl_bf_board_comment tbc
|
|
|
|
|
where tbc.bd_no = x.bd_no ) as c_nt
|
|
|
|
|
,DATE_FORMAT(x.reg_dt,'%H:%i') reg_tm
|
|
|
|
|
,tbv.v_content
|
|
|
|
|
,x.thumbnail
|
|
|
|
|
,m.profile_path
|
|
|
|
|
,m.name
|
|
|
|
|
,m.nickname
|
|
|
|
|
,tmf.mt_file_seq
|
|
|
|
|
,tmf.mt_file_local_url
|
|
|
|
|
,ROW_NUMBER() OVER (ORDER BY x.reg_dt DESC) AS row_num
|
|
|
|
|
FROM tbl_bf_board x
|
|
|
|
|
LEFT JOIN tbl_code_item z
|
|
|
|
|
on x.bd_tp = z.val_1 and cg_cd ='BF_COMMUNITY_TP'
|
|
|
|
|
LEFT JOIN (select bd_no, group_concat(concat (v_content, '♭⊙♭', nvl(v_nt, 0)) separator '♭§♭') v_content
|
|
|
|
|
from tbl_bf_board_vote group by bd_no) tbv ON tbv.bd_no = x.bd_no
|
|
|
|
|
LEFT JOIN tbl_member m ON m.member_id = x.member_id
|
|
|
|
|
LEFT JOIN tbl_bf_board_attach tba ON tba.bd_no = x.bd_no
|
|
|
|
|
and tba.file_seq = (
|
|
|
|
|
SELECT file_seq
|
|
|
|
|
FROM tbl_bf_board_attach fa
|
|
|
|
|
WHERE fa.bd_no = x.bd_no
|
|
|
|
|
LIMIT 1
|
|
|
|
|
)
|
|
|
|
|
LEFT JOIN tbl_mt_file tmf ON tmf.mt_file_seq = tba.file_seq
|
|
|
|
|
|
|
|
|
|
WHERE 1 = 1
|
|
|
|
|
and x.use_yn ='Y'
|
|
|
|
|
and x.bd_tp ='BF_CT_TP_5'
|
|
|
|
|
<isNotEmpty property="who" prepend="">
|
|
|
|
|
AND member_id = #member_id#
|
|
|
|
|
</isNotEmpty>
|
|
|
|
|
LIMIT 8
|
|
|
|
|
</isEqual>
|
|
|
|
|
)x
|
|
|
|
|
|
|
|
|
|
WHERE 1 = 1
|
|
|
|
@ -122,9 +121,7 @@
|
|
|
|
|
where member_id = #member_id#
|
|
|
|
|
)
|
|
|
|
|
</isEqual>
|
|
|
|
|
</isNotEmpty>
|
|
|
|
|
|
|
|
|
|
ORDER BY x.h_nt desc, x.l_nt desc, x.bd_no desc
|
|
|
|
|
</isNotEmpty>
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|