<#assign select="(SELECT '')"/>
<#if orderby?? >
      <#if orderby=="date"> 
	   <#assign  _orderby="content_datetime">
      <#elseif orderby=="updatedate">
 <#assign  _orderby="content_updatetime">
      <#elseif orderby=="hit"> 
	  <#assign  _orderby="content_hit">
      <#elseif orderby=="sort">
	   <#assign  _orderby="content_sort">
      <#else><#assign  _orderby="cms_content.id"></#if>
   <#else>
   <#assign  _orderby="cms_content.id">
  </#if>
<#if (pageTag.preId) gt 0>
SELECT 
cms_content.id as id,
left(content_title,${titlelen?default(40)}) as title,
content_title as fulltitle,
content_author as author, 
content_source as source, 
content_details as content,
category.category_title as typename,
category.category_id as typeid,
(SELECT "index.html") as typelink,
content_img as litpic,
<#--内容页动态链接-->
  <#if isDo?? && isDo>
   CONCAT("/${modelName}/view.do?id=", cms_content.id,"&orderby=${_orderby}","&order=${order!'ASC'}","&typeid=${typeid}") as link,
  <#else>
  CONCAT(category_path,"/",cms_content.id,".html") AS link,
  </#if>
content_datetime as date,
content_description as descrip,
content_hit as hit,
content_type as flag,
content_keyword as keyword 
FROM cms_content 
LEFT JOIN cms_category as category ON content_category_id=category.id 
WHERE cms_content.id=${pageTag.preId}
<#else>
SELECT 
${select} as id,
${select} as title,
${select} as fulltitle,
${select} as author, 
${select} as source, 
${select} as content,
${select} as typename,
${select} as typeid,
${select} as typelink,
${select} as litpic,
${select} as link,
${select} as date,
${select} as descrip,
${select} as hit,
${select} as flag,
${select} as keyword FROM cms_content
</#if>