You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

6 lines
16 KiB
MySQL

4 months ago
ALTER TABLE `model` DROP FOREIGN KEY `fk_model_id`;
ALTER TABLE `role_model` DROP FOREIGN KEY `fk_rm_model_id`;
ALTER TABLE `role_model` DROP FOREIGN KEY `fk_rm_role_id`;
ALTER TABLE `cms_content` DROP FOREIGN KEY `fk_category_id`;
UPDATE `mdiy_tag` SET `tag_name` = 'arclist', `tag_type` = 'list', `tag_sql` = '<#assign _typeid=\'\'/>\r\n<#assign _typetitle=\'\'/>\r\n<#-- 分页数默认返回20条数据 -->\r\n<#assign _size=\'20\'/>\r\n<#if column?? && column.id?? && column.id?number gt 0>\r\n <#assign _typeid=\'${column.id}\'>\r\n</#if>\r\n<#if typeid??>\r\n <#assign _typeid=\'${typeid}\'>\r\n</#if>\r\n<#if typeids??>\r\n <#assign _typeids=\'${typeids}\'>\r\n</#if>\r\n<#if typetitle??>\r\n <#assign _typetitle=\'${typetitle}\'>\r\n</#if>\r\n<#if size??>\r\n <#assign _size=\'${size}\'>\r\n</#if>\r\n\r\n<#assign _order=\'desc\'>\r\n\r\n<#if order?? >\r\n <#if order==\'desc\'>\r\n <#assign _order=\'desc\'>\r\n </#if>\r\n <#if order==\'asc\'>\r\n <#assign _order=\'asc\'>\r\n </#if>\r\n</#if>\r\n\r\n<#if orderby?? >\r\n <#assign _orderby = \'\'>\r\n <#list orderby?split(\',\') as order>\r\n <#-- 防止传空值拼接, -->\r\n <#if !order?has_content>\r\n <#continue >\r\n </#if>\r\n <#if _orderby?has_content>\r\n <#assign _orderby += \',\'>\r\n </#if>\r\n <#if order==\'date\'>\r\n <#assign _orderby += \'cms_content.content_datetime\'>\r\n <#elseif order==\'updatedate\'>\r\n <#assign _orderby += \'cms_content.cms_content.update_date\'>\r\n <#elseif order==\'hit\'>\r\n <#assign _orderby += \'cms_content.content_hit\'>\r\n <#elseif order==\'sort\'>\r\n <#assign _orderby += \'cms_content.content_sort\'>\r\n </#if>\r\n <#-- 去除_orderby末尾的逗号如果存在 -->\r\n <#if _orderby?has_content && _orderby?last_index_of(\',\') == _orderby?length - 1>\r\n <#assign _orderby = _orderby?substring(0, _orderby?length - 1)>\r\n </#if>\r\n <#if _orderby?has_content>\r\n <#assign _orderby += \' \' + _order>\r\n </#if>\r\n </#list>\r\n <#-- 容错处理,如果什么都没有匹配到,则默认按文章时间排序 -->\r\n <#if !_orderby?has_content>\r\n <#assign _orderby = \'cms_content.content_datetime \' + _order>\r\n </#if>\r\n<#else>\r\n <#assign _orderby = \'cms_content.content_datetime \' + _order>\r\n</#if>\r\n\r\n\r\nSELECT\r\ncms_content.id AS \"id\",\r\ncontent_title AS \"title\",\r\ncontent_short_title AS \"shorttitle\",\r\ncontent_author AS \"author\",\r\ncontent_source AS \"source\",\r\ncontent_out_link AS \"outlink\",\r\ncontent_tags AS \"tags\",\r\n\r\ncategory.category_title AS \"typetitle\",\r\ncategory.category_short_title AS \"typeshorttitle\",\r\ncategory.id AS \"typeid\",\r\ncategory.category_path AS \"typepath\",\r\ncategory.category_img AS \"typelitpic\",\r\ncategory.category_ico AS \"typeico\",\r\ncategory.category_keyword as \"typekeyword\",\r\ncategory.top_id as \"topid\",\r\ncategory.category_id as \"parentid\",\r\ncategory.category_parent_ids as \"parentids\",\r\ncategory.category_type AS \"type\",\r\n<#--列表页动态链接-->\r\n<#if isDo?? && isDo>\r\n CONCAT(\'${modelName}/list.do?style=${templateName!\"\"}&typeid=\', category.category_id) as \"typelink\",\r\n<#else>\r\n<#--栏目类型为链接-->\r\n <#if shortSwitch?? && shortSwitch>\r\n CONCAT(category.category_pinyin,\'.html\') AS \"typelink\",\r\n <#else>\r\n CONCAT(category.category_path,\'/index.html\') AS \"typelink\",\r\n </#if>\r\n</#if>\r\ncontent_description AS \"descrip\",\r\ncontent_hit AS \"hit\",\r\ncontent_type AS \"flag\",\r\ncms_content.content_keyword AS \"keyword\",\r\ncontent_img AS \"litpic\",\r\n<#--内容页动态链接-->\r\n<#if isDo?? && isDo>\r\n CONCAT(\'${modelName}/view.do?style=${templateName!\"\"}&id=\', cms_content.id) as \"link\",\r\n<#else>\r\n <#if shortSwitch?? && shortSwitch>\r\n CONCAT(cms_content.id,\'.html\') AS \"link\",\r\n <#else>\r\n CONCAT(CONCAT( category.category_path, \'/\' ), CONCAT(CASE category_type WHEN \'2\' THEN \'index\' ELSE cms_content.id END , \'.html\' )) as \"link\",\r\n </#if>\r\n</#if>\
UPDATE `mdiy_tag` SET `tag_name` = 'channel', `tag_type` = 'list', `tag_sql` = '<#assign _typeid=\'0\'/>\r\n<#assign _size=\'9999\'/>\r\n<#if column?? && column.id?? && column.id?number gt 0>\r\n <#assign _typeid=\'${column.id}\'>\r\n <#assign selfid=\'${column.id}\'>\r\n</#if>\r\n\r\n<#if typeid??>\r\n <#assign _typeid=\'${typeid}\'>\r\n</#if>\r\n<#if typeids??>\r\n <#assign _typeids=\'${typeids}\'>\r\n</#if>\r\n<#if size??>\r\n <#assign _size=\'${size}\'>\r\n</#if>\r\n\r\nselect\r\ncms_category.id as \"id\",\r\ncms_category.id as \"typeid\",\r\ncms_category.category_title as \"typetitle\",\r\ncms_category.category_short_title as \"typeshorttitle\",\r\n<#--动态链接-->\r\n<#if isDo?? && isDo>\r\n IF(cms_category.category_type=2,CONCAT(\'${modelName}/view.do?style=${templateName!\"\"}&typeid=\', cms_category.id),CONCAT(\'${modelName}/list.do?style=${templateName!\"\"}&typeid=\', cms_category.id)) as \"typelink\",\r\n<#else>\r\n<#--栏目类型为链接-->\r\n <#if shortSwitch?? && shortSwitch>\r\n CONCAT(cms_category.category_pinyin,\'.html\') AS \"typelink\",\r\n <#else>\r\n CONCAT(cms_category.category_path,\'/index.html\') as \"typelink\",\r\n </#if>\r\n</#if>\r\ncms_category.category_keyword as \"typekeyword\",\r\ncms_category.category_diy_url as \"typeurl\",\r\ncms_category.category_flag as \"flag\",\r\ncms_category.category_id as \"parentid\",\r\ncms_category.category_parent_ids as \"parentids\",\r\ncms_category.category_descrip as \"typedescrip\",\r\ncms_category.category_type as \"type\",\r\ncms_category.category_path as \"typepath\",\r\ncms_category.leaf as \"typeleaf\",\r\ncms_category.category_img as \"typelitpic\" ,\r\ncms_category.category_ico as \"typeico\" ,\r\n<#if tableName??>${tableName}.*,</#if>\r\n( SELECT count(*) FROM cms_category cc WHERE cc.category_id = cms_category.id AND cc.del = 0 ) AS \"childsize\"\r\nfrom\r\ncms_category\r\n<#--判断是否有自定义模型表-->\r\n<#if tableName??>LEFT JOIN ${tableName} ON ${tableName}.link_id=cms_category.id</#if>\r\nwhere\r\ncms_category.del= 0\r\nand cms_category.category_display = \'enable\'\r\n<#--自定义模型-->\r\n<#if diyModel??>\r\n <#list diyModel as dm>\r\n <#assign json=\"${dm}\"?eval />\r\n and ${tableName}.${json.key} like CONCAT(\'%\',\'${json.value}\',\'%\')\r\n </#list>\r\n</#if>\r\n<#--根据站点编号查询-->\r\n<#if appId?? >\r\n and cms_category.app_id=${appId}\r\n</#if>\r\n\r\n<#--栏目属性-->\r\n<#if flag?? >\r\n and\r\n (<#list flag?split(\',\') as item>\r\n <#if item?index gt 0> or</#if>\r\n FIND_IN_SET(\'${item}\',cms_category.category_flag) > 0\r\n</#list>)\r\n</#if>\r\n\r\n<#if noflag?? >\r\n and\r\n (<#list noflag?split(\',\') as item>\r\n <#if item?index gt 0> and</#if>\r\n FIND_IN_SET(\'${item}\',cms_category.category_flag)=0\r\n</#list> or cms_category.category_flag is null)\r\n</#if>\r\n\r\n<#--type默认son-->\r\n<#if !type??||!type?has_content>\r\n <#assign type=\'son\'/>\r\n</#if>\r\n\r\n<#-- 如果有typeids参数则只查询typeids参数指定的栏目 -->\r\n<#if _typeids?has_content>\r\n and cms_category.id in (${_typeids})\r\n<#elseif type?has_content>\r\n <#--顶级栏目(单个)-->\r\n <#if type==\'top\'>\r\n <#if _typeid != \'0\'>\r\n and (cms_category.id = cms_category.top_id or cms_category.top_id = 0)\r\n </#if>\r\n\r\n <#elseif type==\'nav\'>\r\n and(cms_category.category_id=0 or cms_category.category_id is null)\r\n\r\n <#--同级栏目(多个)-->\r\n <#elseif type==\'level\'>\r\n <#if _typeid != \'0\'>\r\n and cms_category.category_id=(select category_id from cms_category where id=${_typeid})\r\n </#if>\r\n\r\n <#--当前栏目(单个)-->\r\n <#elseif type==\'self\'>\r\n <#if _typeid != \'0\'>\r\n and cms_category.id=${_typeid}\r\n </#if>\r\n\r\n <#--当前栏目的所属栏目(多个)-->\r\n <#elseif type==\'path\'>\r\n <#if _typeid != \'0\'>\r\n and