insert into boardmaster (bmcode,bmposition,bmname,bmdesc,bmtype,disptype,isuseopening,isreply,isopen,isdefault,)
values (#bmcode#,#bmposition#,#bmname#,#bmdesc#,#bmtype#,#disptype#,#isuseopening#,#isreply#,#isopen#,0,);
SELECT LAST_INSERT_ID()
update boardmaster set
,bmname =#bmname#
,bmdesc =#bmdesc#
,bmtype =case when isdefault>0 then bmtype else #bmtype# end
,disptype =case when isdefault>0 then disptype else #disptype# end
,isuseopening =#isuseopening#
,isreply =#isreply#
,isopen =case when isdefault>0 then isopen else #isopen# end
where bmno=#bmno#
update board set rcount = rcount +1 where bno=#bno#
update boardmasteropening set isdel=1 where bmno=#bmno# opno not in ($opnosnot$)
insert into boardmasteropening (bmno,opname,isuse,isdel,dsort,cdt,cno,udt,uno,uip)
values $inquery$;
update boardmasteropening a
inner join (
select #BMOs[].opno# opno, #BMOs[].opname# opname,#BMOs[].isuse# isuse,#BMOs[].dsort# dsort
) b on b.opno=a.opno
set a.opname=b.opname,a.isuse=b.isuse,a.dsort=b.dsort,udt=now(),uno=#uno#,uip=#uip#
where a.bmno=#bmno#
update boardmaster set ,isopen=1 where bmno in (select bmno from (select bmno from boardmaster where asno=#asno# and isdefault=3) a);
insert into boardmaster (bmcode,bmposition,bmname,bmdesc,bmtype,disptype,isuseopening,isreply,isopen,isdefault,asno,)
select concat('assignnotice_',#asno#),0,'공지사항',null,0,0,0,1,1,3,#asno#,
from (select 1 col1) a
left outer join boardmaster b on b.asno=#asno# and b.isdefault=3
where b.bmno is null;
update boardmaster set ,isopen=0 where bmno in (select bmno from (select bmno from boardmaster where asno=#asno# and isdefault=3) a)
insert into board (pbno,bmno,opno,subject,contents,fgno,fgnothumb,cmno,rcount,rpcount,isdel,istop,issecr,isopen,)
values (#pbno#,#bmno#,#opno#,#subject#,#contents#,#fgno#,#fgnothumb#,#cmno#,0,0,0,#istop#,#issecr#,#isopen#,);
SELECT LAST_INSERT_ID()
insert into board (pbno,bmno,opno,subject,contents,fgno,fgnothumb,cmno,rcount,rpcount,isdel,istop,issecr,isopen,)
select bno,bmno,opno,#subject#,#contents#,#fgno#,#fgnothumb#,cmno,0,0,0,0,#issecr#,#isopen#,
from board where bno=#pbno#;
SELECT LAST_INSERT_ID()
update board set
,opno =case when pbno is null then #opno# else opno end
,subject =#subject#
,contents =#contents#
,fgno =#fgno#
,fgnothumb =#fgnothumb#
,istop =case when pbno is null then #istop# else istop end
,issecr =#issecr#
,isopen =#isopen#
where bno=#bno#
update board set ,isdel=1 where bno=#bno# and cno=#cno#
update board set rpcount = rpcount+1 where bno=#bno#;
insert into boardcmt (bno,ctext,isdel,)
values (#bno#,#ctext#,0,);
SELECT LAST_INSERT_ID()
update boardcmt set
,ctext=#ctext#
where bcno=#bcno# and cno=#cno#
update board a
inner join boardcmt b on b.bcno=#bcno# and a.bno=b.bno and b.cno=#cno#
set a.rpcount = a.rpcount-1
where a.bno=b.bno;
update boardcmt set ,isdel=1 where bcno=#bcno# and cno=#cno#