findSmsTemplateByCpid
===
select cpid, smstype, content
  from td_directed_cptosms a
 where cpid=#cpid#
 order by CONVERT(a.smstype, signed) asc
 
searchSmstemplate
===
select @pageTag(){
       a.cpid, b.cpname, a.smstype, a.content
       @}
  from td_directed_cptosms a 
  left join tb_directed_cpinfo b on a.cpid=b.cpid
   
 where 1=1
 @if(!isEmpty(cpname)){
     and b.cpname like #'%'+cpname+'%'#
 @}
 
 @if(!isEmpty(content)){
  and a.content like #'%'+content+'%'#
 @}
 order by CONVERT(a.smstype, signed) asc
 
saveSmstemplate
===
insert into td_directed_cptosms(smstype, cpid, content)
select max(smstype+1), #cpid#, #content#
  from td_directed_cptosms
 
updateSmstemplate
===
update td_directed_cptosms
   set content=#content#
 where smstype=#smstype# and cpid=#cpid#

deleteSmstemplate
===
delete from td_directed_cptosms
 where smstype=#smstype# and cpid=#cpid#
 
findSmsTemplateBySmstype
===
select smstype, cpid, content 
  from td_directed_cptosms
 where smstype=#smstype#  