AND a.wrt_nm LIKE '%'||#{wrtNm}||'%'
AND a.wrt_organ = #{wrtOrgan}
AND a.content_title LIKE '%'||#{contentTitle}||'%'
And a.wrt_dt >= #{startDate}::DATE
AND a.wrt_dt <= #{endDate}::DATE+1
SELECT a.ivsgt_key,
a.ivsgt_type,
a.content_title,
a.content_info,
a.content_main,
a.content_status,
a.wrt_organ,
a.wrt_user_seq,
a.wrt_nm,
a.wrt_dt,
b.fileCnt,
t.arrest_cd,
t.arrest_cd2,
cm.item_value AS arrestCdName,
cm2.item_value AS arrestCd2Name
FROM board_investigation a
LEFT OUTER JOIN (
SELECT
ivsgt_key,
count(file_seq) AS fileCnt
FROM ivsgt_file
GROUP BY ivsgt_key
) b
ON a.ivsgt_key = b.ivsgt_key
INNER JOIN arrest_type t
ON a.ivsgt_key = t.ivsgt_key
INNER JOIN code_mgt cm
ON t.arrest_cd = cm.item_cd
INNER JOIN code_mgt cm2
ON t.arrest_cd2 = cm2.item_cd
ORDER BY ivsgt_key DESC
LIMIT #{rowCnt} OFFSET #{firstIndex}
SELECT count(*)
FROM board_investigation a
SELECT aa.hashTags
FROM (
SELECT
array_to_string(array_agg(b.tag_nm), ' ') AS hashTags
FROM hash_tag_link_ivsgt a
INNER JOIN hash_tag b ON a.tag_key = b.tag_key
WHERE a.ivsgt_key = #{ivsgtKey}
GROUP BY a.ivsgt_key) aa
SELECT
a.arrest_type_key,
a.ivsgt_key,
a.arrest_cd,
a.arrest_cd2,
cm.item_value AS arrestCdName,
cm2.item_value AS arrestCd2Name
FROM arrest_type a
INNER JOIN board_investigation i
ON i.ivsgt_key = a.ivsgt_key
INNER JOIN code_mgt cm
ON a.arrest_cd = cm.item_cd
INNER JOIN code_mgt cm2
ON a.arrest_cd2 = cm2.item_cd
WHERE a.ivsgt_key = #{ivsgtKey}