|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
|
|
|
|
<sqlMap namespace="com.backoffice.m.bf_board">
|
|
|
|
<select id="select_list_bf_board" resultClass="dataMap" parameterClass="dataMap">
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
x.*
|
|
|
|
,m.profile_path
|
|
|
|
,m.name
|
|
|
|
,tmf.mt_file_seq
|
|
|
|
,tmf.mt_file_local_url
|
|
|
|
,v_content
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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>
|
|
|
|
)x
|
|
|
|
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
|
|
|
|
ORDER BY x.h_nt desc , x.bd_no DESC
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="select_bf_view_board" resultClass="dataMap" parameterClass="dataMap">
|
|
|
|
SELECT
|
|
|
|
x.*
|
|
|
|
,m.profile_path
|
|
|
|
,m.name
|
|
|
|
,tmf.mt_file_seq
|
|
|
|
,tmf.mt_file_local_url
|
|
|
|
,v_content
|
|
|
|
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
|
|
|
|
FROM tbl_bf_board x
|
|
|
|
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
|
|
|
|
INNER JOIN tbl_code_item z
|
|
|
|
on x.bd_tp = z.val_1 and cg_cd ='BF_COMMUNITY_TP'
|
|
|
|
WHERE DATE_FORMAT(x.reg_dt,'%Y%M%d') = DATE_FORMAT(now(),'%Y%M%d')
|
|
|
|
and x.use_yn ='Y'
|
|
|
|
and x.bd_no = #bd_no#
|
|
|
|
)x
|
|
|
|
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
|
|
|
|
LEFT JOIN tbl_mt_file tmf ON tmf.mt_file_seq = tba.file_seq
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<insert id="insert_bf_board" parameterClass="dataMap">
|
|
|
|
INSERT tbl_bf_board
|
|
|
|
(
|
|
|
|
reg_dt
|
|
|
|
,title
|
|
|
|
,content
|
|
|
|
,member_id
|
|
|
|
,bd_tp
|
|
|
|
,hashtag
|
|
|
|
) VALUES (
|
|
|
|
NOW()
|
|
|
|
,#title#
|
|
|
|
,#content#
|
|
|
|
,#member_id#
|
|
|
|
,#bd_tp#
|
|
|
|
,replace(replace(#hashtag#,'[',''),']','')
|
|
|
|
)
|
|
|
|
|
|
|
|
<selectKey resultClass="Integer" keyProperty="primaryKey">
|
|
|
|
SELECT LAST_INSERT_ID();
|
|
|
|
</selectKey>
|
|
|
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<insert id="insert_bf_board_img_by_b_no" parameterClass="dataMap">
|
|
|
|
INSERT tbl_bf_board_attach
|
|
|
|
(
|
|
|
|
bd_no
|
|
|
|
,ct_no
|
|
|
|
,file_seq
|
|
|
|
,reg_dt
|
|
|
|
) VALUES (
|
|
|
|
#bd_no#
|
|
|
|
,#ct_no#
|
|
|
|
,#file_seq#
|
|
|
|
,NOW()
|
|
|
|
)
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<insert id="insert_bf_board_vote_by_b_no" parameterClass="dataMap">
|
|
|
|
INSERT tbl_bf_board_vote
|
|
|
|
(
|
|
|
|
bd_no
|
|
|
|
,v_content
|
|
|
|
,reg_dt
|
|
|
|
) VALUES (
|
|
|
|
#bd_no#
|
|
|
|
,#v_content#
|
|
|
|
,NOW()
|
|
|
|
)
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<delete id="delete_bf_board_img_by_b_no" parameterClass="dataMap">
|
|
|
|
DELETE FROM tbl_bf_board_attach
|
|
|
|
WHERE bd_no = #bd_no#
|
|
|
|
</delete>
|
|
|
|
<delete id="delete_bf_board_vote_by_b_no" parameterClass="dataMap">
|
|
|
|
DELETE FROM tbl_bf_board_vote
|
|
|
|
WHERE bd_no = #bd_no#
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="select_bf_board_img_by_b_no" resultClass="dataMap" parameterClass="dataMap">
|
|
|
|
SELECT tmf.mt_file_seq
|
|
|
|
,tmf.mt_file_nm
|
|
|
|
,tmf.mt_file_local_url
|
|
|
|
,tmf.mt_file_size
|
|
|
|
,tmf.mt_file_type
|
|
|
|
,tmf.height
|
|
|
|
,tmf.width
|
|
|
|
FROM tbl_bf_board_attach tba
|
|
|
|
LEFT JOIN tbl_mt_file tmf ON tmf.mt_file_seq = tba.file_seq
|
|
|
|
WHERE tba.bd_no = #bd_no#
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="select_bf_board_vote_by_b_no" resultClass="dataMap" parameterClass="dataMap">
|
|
|
|
SELECT
|
|
|
|
v_content
|
|
|
|
,v_nt
|
|
|
|
FROM tbl_bf_board_vote tba
|
|
|
|
WHERE tba.bd_no = #bd_no#
|
|
|
|
ORDER BY vt_no
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
</sqlMap>
|