SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- 菜单
update model set model_url=replace(model_url,"dictData","dict/data") where model_url like "%/dictData/%";
update model set model_url=replace(model_url,"configData","config/data") where model_url like "%/configData/%";
update model set model_url=replace(model_url,"formData","form/data") where model_url like "%/formData/%";
update model set MODEL_URL=REPLACE(MODEL_URL,'/app/-1/edit.do','/app/app.do') where model_url LIKE '%/app/-1/edit.do%';
-- 栏目
ALTER TABLE `cms_category`
    CHANGE COLUMN `MDIY_MODEL_ID` `mdiy_model_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文章管理的内容模型ID' AFTER `dict_id`,
    ADD COLUMN `mdiy_category_model_id` varchar(50) NULL COMMENT '栏目管理的内容模型ID' AFTER `MDIY_MODEL_ID`,
    ADD COLUMN `category_short_title` varchar(255) NULL COMMENT '栏目副标题' AFTER `category_title`,
    MODIFY COLUMN `category_img` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '栏目banner图' AFTER `category_title`,
    ADD COLUMN `category_ico` varchar(2000) NULL COMMENT '栏目小图' AFTER `category_img`,
    ADD COLUMN `category_display` varchar(50) NULL COMMENT '栏目是否显示' AFTER `category_flag`;
UPDATE cms_category set category_display = 'enable';
-- 自定义字典
INSERT INTO `mdiy_dict` (`dict_value`, `dict_label`, `dict_type`, `dict_description`, `is_child`, `dict_enable`, `dict_remarks`, `dict_sort`, `UPDATE_BY`, `UPDATE_DATE`, `CREATE_BY`, `CREATE_DATE`, `DEL`, `NOT_DEL`) VALUES ('category', '栏目', '自定义模型类型', NULL, NULL, '1', NULL, 0, '57', '2023-02-06 10:14:57', '57', '2023-02-06 09:39:26', 0, 0);
-- 文章
ALTER TABLE `cms_content`
    ADD COLUMN `content_short_title` varchar(255) NULL COMMENT '文章副标题' AFTER `CONTENT_TITLE`,
MODIFY COLUMN `content_img` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文章缩略图' AFTER `content_description`,
CHANGE COLUMN `HAS_DETAIL_HTML` `has_detail_html` int(1) NULL DEFAULT 0 COMMENT '文章静态化标识 0表示未被自动静态化,1反之' AFTER `content_out_link`,
CHANGE COLUMN `HAS_LIST_HTML` `has_list_html` int(1) NULL DEFAULT 0 COMMENT '栏目静态化标识 0表示未被自动静态化,1反之' AFTER `update_date`;
-- ----------------------------
-- Table structure for mdiy_tag
-- ----------------------------
DROP TABLE IF EXISTS `mdiy_tag`;
CREATE TABLE `mdiy_tag`  (
                             `id` int(11) NOT NULL AUTO_INCREMENT,
                             `tag_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '标签名称',
                             `tag_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '标签类型',
                             `tag_sql` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '标签sql',
                             `tag_class` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '标签类',
                             `tag_description` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '描述',
                             `UPDATE_BY` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新人',
                             `UPDATE_DATE` datetime NULL DEFAULT NULL COMMENT '更新时间',
                             `CREATE_BY` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人',
                             `CREATE_DATE` datetime NULL DEFAULT NULL COMMENT '创建时间',
                             `DEL` int(1) NULL DEFAULT 0 COMMENT '删除标记',
                             `NOT_DEL` int(1) NULL DEFAULT 0 COMMENT '1为不能删除，主要用于系统默认数据,0为一般数据，主要是前端控制',
                             PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '标签' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of mdiy_tag
-- ----------------------------
INSERT INTO `mdiy_tag` VALUES (3, 'arclist', 'list', '<#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 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<#if orderby?? >\r\n  <#if orderby==\'date\'>\r\n    <#assign  _orderby=\'content_datetime\'>\r\n  <#elseif orderby==\'updatedate\'>\r\n    <#assign  _orderby=\'cms_content.update_date\'>\r\n  <#elseif orderby==\'hit\'>\r\n    <#assign  _orderby=\'content_hit\'>\r\n  <#elseif orderby==\'sort\'>\r\n    <#assign  _orderby=\'content_sort\'>\r\n  <#else>\r\n    <#assign  _orderby=\'cms_content.content_datetime\'>\r\n  </#if>\r\n<#else>\r\n    <#assign  _orderby=\'cms_content.content_datetime\'>\r\n</#if>\r\n\r\nSELECT\r\n  cms_content.id AS \"id\",\r\n  content_title AS \"title\",\r\n  content_short_title AS \"shorttitle\",\r\n  content_author AS \"author\",\r\n  content_source AS \"source\",\r\n  content_out_link AS \"outlink\",\r\n\r\n  category_title AS \"typetitle\",\r\n  category_short_title AS \"typeshorttitle\",\r\n  category.id AS \"typeid\",\r\n  category.category_path AS \"typepath\",\r\n  category.category_img AS \"typelitpic\",\r\n  category.category_ico AS \"typeico\",\r\n  category.category_keyword as \"typekeyword\",\r\n  category.top_id as \"topId\",\r\n  category.category_id as \"parentid\",\r\n  category.category_parent_ids as \"parentids\",\r\n  category.category_type AS \"type\",\r\n  <#--列表页动态链接-->\r\n  <#if isDo?? && isDo>\r\n    CONCAT(\'${modelName}/list.do?style=${appTemplate!\"\"}&typeid=\', category.category_id) as \"typelink\",\r\n  <#else>\r\n  <#--栏目类型为链接-->\r\n    <#if shortSwitch?? && shortSwitch>\r\n      CONCAT(\'/\',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\n  content_description AS \"descrip\",\r\n  content_hit AS \"hit\",\r\n  content_type AS \"flag\",\r\n  cms_content.content_keyword AS \"keyword\",\r\n  content_img AS \"litpic\",\r\n  <#--内容页动态链接-->\r\n  <#if isDo?? && isDo>\r\n    CONCAT(\'${modelName}/view.do?style=${appTemplate!\"\"}&id=\', cms_content.id) as \"link\",\r\n  <#else>\r\n    <#if shortSwitch?? && shortSwitch>\r\n      CONCAT(\'/\',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>\r\n  <#if tableName??>${tableName}.*,</#if>\r\n  content_datetime AS \"date\"\r\nFROM\r\n  cms_content\r\nLEFT JOIN\r\n  cms_category as category\r\nON cms_content.category_id = category.id\r\n<#--判断是否有自定义模型表-->\r\n<#if tableName??>\r\n  LEFT JOIN ${tableName} ON ${tableName}.link_id=cms_content.id\r\n</#if>\r\nWHERE\r\n  content_display=0\r\n  and category_display=\'enable\'\r\n  and cms_content.del=0\r\n\r\n\r\n<#--根据站点编号查询-->\r\n<#if appId?? >\r\n  and cms_content.app_id=${appId}\r\n  and cms_content.id>0\r\n</#if>\r\n<#--判断是否有搜索分类集合，暂时移除 _typeid=\"\" 条件-->\r\n<#if search??>\r\n  <#if search.categoryIds?has_content>and FIND_IN_SET(category.id,\'${search.categoryIds}\') > 0</#if>\r\n  <#--标题-->\r\n  <#if search.content_title??> and content_title like CONCAT(CONCAT(\'%\',\'${search.content_title}\'),\'%\')</#if>\r\n  <#--作者-->\r\n  <#if search.content_author??> and content_author like CONCAT(CONCAT(\'%\',\'${search.content_author}\'),\'%\')</#if>\r\n  <#--来源-->\r\n  <#if search.content_source??> and content_source like CONCAT(CONCAT(\'%\',\'${search.content_source}\'),\'%\')</#if>\r\n  <#--属性-->\r\n  <#if search.content_type??>\r\n    and(<#list search.content_type?split(\',\') as item>\r\n    <#if item?index gt 0> or</#if>\r\n      FIND_IN_SET(\'${item}\',cms_content.content_type) > 0\r\n    </#list>)\r\n  </#if>\r\n  <#--描述-->\r\n  <#if search.content_description??>\r\n    and content_description like CONCAT(CONCAT(\'%\',\'${search.content_description}\'),\'%\')\r\n  </#if>\r\n  <#--关键字-->\r\n  <#if search.content_keyword??> and content_keyword like CONCAT(CONCAT(\'%\',\'${search.content_keyword}\'),\'%\')</#if>\r\n  <#--内容-->\r\n  <#if search.content_details??> and content_details like CONCAT(CONCAT(\'%\',\'${search.content_details}\'),\'%\')</#if>\r\n  <#--自定义顺序-->\r\n  <#if search.content_sort??> and content_sort=${search.content_sort}</#if>\r\n  <#--时间范围-->\r\n  <#if search.content_datetime_start??&&search.content_datetime_end??>\r\n    and content_datetime between \'${search.content_datetime_start}\' and \'${search.content_datetime_end}\'\r\n  </#if>\r\n<#else>\r\n  <#--查询栏目-->\r\n  <#if _typeid?has_content>\r\n  and (cms_content.category_id=${_typeid}\r\n  or cms_content.category_id in (select id FROM cms_category where cms_category.del=0\r\n    <#if _typetitle?has_content>\r\n      and cms_category.category_title=\'${_typetitle}\'\r\n    </#if>\r\n  and FIND_IN_SET(${_typeid},CATEGORY_PARENT_IDS) > 0))\r\n  </#if>\r\n</#if>\r\n<#--判断搜索分类结束-->\r\n<#--标题-->\r\n<#if content_title??> and content_title like CONCAT(CONCAT(\'%\',\'${content_title}\'),\'%\')</#if>\r\n<#--作者-->\r\n<#if content_author??> and content_author like CONCAT(CONCAT(\'%\',\'${content_author}\'),\'%\')</#if>\r\n<#--来源-->\r\n<#if content_source??> and content_source like CONCAT(CONCAT(\'%\',\'${content_source}\'),\'%\')</#if>\r\n<#--属性-->\r\n<#if content_type??> and content_type like CONCAT(CONCAT(\'%\',\'${content_type}\'),\'%\')</#if>\r\n<#--描述-->\r\n<#if content_description??> and content_description like CONCAT(CONCAT(\'%\',\'${content_description}\'),\'%\')</#if>\r\n<#--关键字-->\r\n<#if content_keyword??> and content_keyword like CONCAT(CONCAT(\'%\',\'${content_keyword}\'),\'%\')</#if>\r\n<#--内容-->\r\n<#if content_details??> and content_details like CONCAT(CONCAT(\'%\',\'${content_details}\'),\'%\')</#if>\r\n<#--自定义顺序-->\r\n<#if content_sort??> and content_sort=${content_sort}</#if>\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(CONCAT(\'%\',\'${json.value}\'),\'%\')\r\n  </#list>\r\n</#if>\r\n<#--文章属性-->\r\n<#if flag?? >\r\n  and(<#list flag?split(\',\') as item>\r\n  <#if item?index gt 0> or</#if>\r\n  FIND_IN_SET(\'${item}\',cms_content.content_type) > 0\r\n  </#list>)\r\n</#if>\r\n<#if noflag??>\r\n  and(<#list noflag?split(\',\') as item>\r\n  <#if item?index gt 0> and</#if>\r\n  FIND_IN_SET(\'${item}\',cms_content.content_type)=0\r\n  </#list> or cms_content.content_type is null)\r\n</#if>\r\n\r\n  <#--字段排序-->\r\n  <#if orderby?? >\r\n    ORDER BY\r\n      <#if orderby==\'date\'> content_datetime\r\n      <#elseif orderby==\'updatedate\'> cms_content.update_date\r\n      <#elseif orderby==\'hit\'> content_hit\r\n      <#elseif orderby==\'sort\'> content_sort\r\n      <#else>\r\n        cms_content.content_datetime\r\n      </#if>\r\n  <#else>\r\n    ORDER BY\r\n        cms_content.content_datetime\r\n  </#if>\r\n\r\n  <#if order?? >\r\n    <#if order==\'desc\'> desc</#if>\r\n    <#if order==\'asc\'> asc</#if>\r\n  <#else>\r\n    desc\r\n  </#if>\r\n  LIMIT\r\n  <#--判断是否分页-->\r\n  <#if ispaging?? && (pageTag.pageNo)??>\r\n    ${((pageTag.pageNo-1)*_size?eval)?c},${_size?default(20)}\r\n  <#else>\r\n    ${_size?default(20)}\r\n  </#if>\r\n', NULL, '文章列表', NULL, NULL, NULL, NULL, 0, 1);
INSERT INTO `mdiy_tag` VALUES (4, 'channel', 'list', '<#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 size??>\r\n  <#assign  _size=\'${size}\'>\r\n</#if>\r\n\r\nselect\r\n  cms_category.id as \"id\",\r\n  cms_category.id as \"typeid\",\r\n  cms_category.category_title as \"typetitle\",\r\n  cms_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=${appTemplate!\"\"}&typeid=\', cms_category.id),CONCAT(\'${modelName}/list.do?style=${appTemplate!\"\"}&typeid=\', cms_category.id)) as \"typelink\",\r\n  <#else>\r\n    <#--栏目类型为链接-->\r\n    <#if shortSwitch?? && shortSwitch>\r\n      CONCAT(\'/\',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\n  cms_category.category_keyword as \"typekeyword\",\r\n  cms_category.category_diy_url as \"typeurl\",\r\n  cms_category.category_flag as \"flag\",\r\n  cms_category.category_id as \"parentid\",\r\n  cms_category.category_parent_ids as \"parentids\",\r\n  cms_category.category_descrip as \"typedescrip\",\r\n  cms_category.category_type as \"type\",\r\n  cms_category.category_path as \"typepath\",\r\n  cms_category.leaf as \"typeleaf\",\r\n  cms_category.category_img as \"typelitpic\" ,\r\n  cms_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\n  cms_category\r\n  <#--判断是否有自定义模型表-->\r\n  <#if tableName??>LEFT JOIN ${tableName} ON ${tableName}.link_id=cms_category.id</#if>\r\nwhere\r\n  cms_category.del=0\r\n  and  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)\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  <#if 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 cms_category.id in\r\n        (<#if column?? && column.categoryParentIds??>${column.categoryParentIds},</#if>${_typeid})\r\n      </#if>\r\n\r\n    <#--子栏目（多个）-->\r\n    <#elseif type==\'son\'>\r\n      <#if _typeid != \'0\'>\r\n        and cms_category.category_id=${_typeid}\r\n      </#if>\r\n\r\n    <#--上一级栏目没有则取当前栏目（单个）-->\r\n    <#elseif type==\'parent\'>\r\n      <#if _typeid != \'0\'>\r\n        and\r\n          <#if column?? && column.categoryId??>\r\n            cms_category.id=${column.categoryId}\r\n          <#else>\r\n            cms_category.id=${_typeid}\r\n          </#if>\r\n      </#if>\r\n    </#if>\r\n\r\n  <#else> <#--默认顶级栏目-->\r\n    and\r\n      <#if _typeid != \'0\'>\r\n        cms_category.id=${_typeid}\r\n      <#else>\r\n        (cms_category.category_id=0 or cms_category.category_id is null)\r\n      </#if>\r\n  </#if>\r\n\r\n   <#--字段排序-->\r\n  <#if type == \'path\'>\r\n    ORDER BY cms_category.category_path asc\r\n  <#else>\r\n    <#if orderby?? >\r\n      ORDER BY\r\n        <#if orderby==\'date\'> cms_category.create_date\r\n        <#elseif orderby==\'sort\'> cms_category.category_sort\r\n        <#else>cms_category.id\r\n        </#if>\r\n    </#if>\r\n\r\n    <#if order?? >\r\n      <#if order==\'desc\'> desc</#if>\r\n      <#if order==\'asc\'> asc</#if>\r\n    </#if>\r\n  </#if>\r\n  LIMIT\r\n    ${_size?default(9999)}', NULL, '通用栏目', NULL, NULL, NULL, NULL, 0, 1);
INSERT INTO `mdiy_tag` VALUES (5, 'global', 'single', 'select\r\n  APP_NAME as \"name\",\r\n  app_logo as \"logo\",\r\n  app_keyword as \"keyword\",\r\n  app_description as \"descrip\",\r\n  app_copyright as \"copyright\",\r\n  \'${contextPath}\' as \"contextpath\",\r\n  <#--动态解析 -->\r\n  <#if isDo?? && isDo>\r\n    \'${url}\' as \"url\",\r\n    \'${url}\' as \"host\",\r\n    \'\' as \"html\",\r\n  <#--使用地址栏的域名 -->\r\n  <#else>\r\n    CONCAT(\'${url}\',\'${html}\',\'<#if appDir?has_content>/</#if>${appDir}/\',\'${appTemplate!\"\"}\') as \"url\",\r\n    \'${url}\' as \"host\",\r\n    CONCAT(\'/${html}\',\'/\',app_dir) as html,\r\n  </#if>\r\n    CONCAT(\'template/\',id,\'/\',app_style) as \"style\"\r\nfrom app\r\n  <#--根据站点编号查询-->\r\n  <#if appId?? >\r\n    where id = ${appId}\r\n  </#if>', NULL, '全局', NULL, NULL, NULL, NULL, 0, 1);
INSERT INTO `mdiy_tag` VALUES (7, 'field', 'single', 'SELECT\r\n    cms_content.id as \"id\",\r\n        <#--这里会存在id覆盖的情况,所以需要在cms_content.id下面-->\r\n        <#if tableName??>${tableName}.*,</#if>\r\n        <#--查询站点编号-->\r\n        <#if appId??>\r\n    cms_content.app_id as \"appId\",\r\n        </#if>\r\n    content_title as \"title\",\r\n    content_short_title AS \"shorttitle\",\r\n    content_author as \"author\",\r\n    content_source as \"source\",\r\n    content_details as \"content\",\r\n    content_datetime as \"date\",\r\n    content_description as \"descrip\",\r\n    content_keyword as \"keyword\",\r\n        <#if contextPath?? && contextPath != \"/\">\r\n    CONCAT(CONCAT( \'<script type=\"text/javascript\" src=\"${contextPath}/cms/content/\', cms_content.id),\'/hit.do\"></script>\') as \"hit\",\r\n        <#else>\r\n    CONCAT(CONCAT( \'<script type=\"text/javascript\" src=\"/cms/content/\', cms_content.id),\'/hit.do\"></script>\') as \"hit\",\r\n        </#if>\r\n    content_type as \"flag\",\r\n    category_title as \"typetitle\",\r\n    cms_content.content_img as \"litpic\",\r\n        <#--内容页动态链接-->\r\n        <#if isDo?? && isDo>\r\n    CONCAT(\'/mcms/view.do?id=\', cms_content.id) as \"link\",\r\n        <#else>\r\n        <#if shortSwitch?? && shortSwitch>\r\n    CONCAT(\'/\', CONCAT(cms_content.id, \'.html\' )) as \"link\",\r\n        <#else>\r\n    CONCAT(CONCAT( cms_category.category_path, \'/\' ), CONCAT(cms_content.id, \'.html\' )) as \"link\",\r\n        </#if>\r\n        </#if>\r\n    cms_category.id as \"typeid\",\r\n    cms_category.leaf as \"typeleaf\",\r\n    cms_category.category_title as \"typetitle\",\r\n    cms_category.category_short_title AS \"typeshorttitle\",\r\n    cms_category.category_img as \"typelitpic\",\r\n    cms_category.category_ico as \"typeico\",\r\n    cms_category.category_path as \"typepath\",\r\n    cms_category.top_id as \"topId\",\r\n    cms_category.category_flag as \"typeflag\",\r\n    cms_category.category_id as \"parentid\",\r\n    cms_category.category_parent_ids as \"parentids\",\r\n    cms_category.category_keyword as \"typekeyword\",\r\n    cms_category.category_descrip as \"typedescrip\",\r\n        <#--动态链接-->\r\n        <#if isDo?? && isDo>\r\n    CONCAT(\'/${modelName}/list.do?typeid=\', cms_category.id) as \"typelink\"\r\n        <#else>\r\n        <#if shortSwitch?? && shortSwitch>\r\n    CONCAT(CONCAT(\'/\',category_pinyin),\'.html\') AS \"typelink\"\r\n        <#else>\r\n    CONCAT(category_path,\'/index.html\') AS \"typelink\"\r\n        </#if>\r\n        </#if>\r\n\r\nFROM cms_content\r\n    LEFT JOIN cms_category  ON\r\n    cms_category.id = cms_content.category_id\r\n    <#--判断是否有自定义模型表-->\r\n    <#if tableName??>left join ${tableName} on ${tableName}.link_id=cms_content.id</#if>\r\nWHERE\r\n    <#--如果是栏目列表页没有文章id所以只取栏目id-->\r\n    <#if column??&&column.id??&&!id??>\r\n    cms_category.id=${column.id} and\r\n    </#if>\r\n    <#--根据站点编号查询-->\r\n    <#if appId??>\r\n    cms_content.app_id = ${appId} and\r\n    </#if>\r\n    cms_content.del=0\r\n    <#if id??> and cms_content.id=${id}</#if>\r\n', NULL, '文章内容', NULL, NULL, NULL, NULL, 0, 1);
INSERT INTO `mdiy_tag` VALUES (8, 'pre', 'single', '<#assign select=\"\'\'\"/>\r\n<#if orderby?? >\r\n	<#if orderby==\"date\">\r\n	  <#assign  _orderby=\"content_datetime\">\r\n	<#elseif orderby==\"updatedate\">\r\n	  <#assign  _orderby=\"cms_content.update_date\">\r\n	<#elseif orderby==\"hit\">\r\n	  <#assign  _orderby=\"content_hit\">\r\n	<#elseif orderby==\"sort\">\r\n	  <#assign  _orderby=\"content_sort\">\r\n	<#else><#assign  _orderby=\"cms_content.id\"></#if>\r\n<#else>\r\n	<#assign  _orderby=\"cms_content.id\">\r\n</#if>\r\n<#--上一页-->\r\n<#if pageTag.preId??>\r\n	SELECT\r\n    cms_content.id as \"id\",\r\n    content_title as \"title\",\r\n    content_author as \"author\",\r\n    content_source as \"source\",\r\n    content_details as \"content\",\r\n    category.category_title as \"typename\",\r\n    category.category_id as \"typeid\",\r\n    <#if isDo?? && isDo>\r\n      CONCAT(\'/${modelName}/list.do?typeid=\', cms_category.id) as \"typelink\",\r\n    <#else>\r\n    	<#if shortSwitch?? && shortSwitch>\r\n    		CONCAT(\'/\',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\n    content_img as \"litpic\",\r\n    <#--内容页动态链接-->\r\n    <#if isDo?? && isDo>\r\n    	CONCAT(\'${modelName}/view.do?id=\', cms_content.id,\'&orderby=${_orderby}\',\'&order=${order!\'ASC\'}\',\'&typeid=${typeid}\') as \"link\",\r\n    <#else>\r\n    	<#if shortSwitch?? && shortSwitch>\r\n        CONCAT(CONCAT(\'/\',cms_content.id),\'.html\') AS \"link\",\r\n      <#else>\r\n    		CONCAT(CONCAT(category_path,\'/\'),CONCAT(cms_content.id,\'.html\')) AS \"link\",\r\n      </#if>\r\n    </#if>\r\n    content_description as \"descrip\",\r\n    content_hit as \"hit\",\r\n    content_type as \"flag\",\r\n    content_keyword as \"keyword\"\r\n	FROM cms_content\r\n    LEFT JOIN cms_category category ON cms_content.category_id=category.id\r\n	WHERE cms_content.id=${pageTag.preId}\r\n<#else>\r\n	SELECT\r\n    ${select} as \"id\",\r\n    \'没有了\' as \"title\",\r\n    ${select} as \"author\",\r\n    ${select} as \"source\",\r\n    ${select} as \"content\",\r\n    ${select} as \"typename\",\r\n    ${select} as \"typeid\",\r\n    ${select} as \"typelink\",\r\n    ${select} as \"litpic\",\r\n    ${select} as \"typelink\",\r\n    ${select} as \"date\",\r\n    ${select} as \"descrip\",\r\n    ${select} as \"hit\",\r\n    ${select} as \"flag\",\r\n    ${select} as \"keyword\"\r\n    FROM dual\r\n</#if>\r\n', NULL, '文章上一篇', NULL, NULL, NULL, NULL, 0, 1);
INSERT INTO `mdiy_tag` VALUES (9, 'page', 'single', '<#if pageTag??>\r\nselect\r\n  <#--是否开启短链接-->\r\n    <#if shortSwitch?? && shortSwitch>\r\n	    \'${shortSwitch?string(\'true\',\'false\')}\' as \"shortSwitch\",\r\n    </#if>\r\n	<#if !(pageTag.indexUrl??)>\r\n		<#--判断是否有栏目对象，用于搜索不传栏目-->\r\n		<#if column??>\r\n			<#if shortSwitch?? && shortSwitch>\r\n				<#assign path=column.categoryPinyin/>\r\n			<#else>\r\n				<#assign path=column.categoryPath/>\r\n			</#if>\r\n		<#else>\r\n			<#assign path=\'\' />\r\n		</#if>\r\n		<#--总记录数、总页数-->\r\n		\'${pageTag.total}\' as \"total\",\r\n		\'${pageTag.size}\' as \"size\",\r\n\r\n		<#--记录总数-->\r\n		\'${pageTag.rcount}\' as \"rcount\",\r\n		<#--当前页码-->\r\n		\'${pageTag.pageNo}\' as \"cur\",\r\n		<#--首页-->\r\n		<#if shortSwitch?? && shortSwitch>\r\n			CONCAT(\'${path}\', \'.html\') as \"index\",\r\n		<#else>\r\n			CONCAT(\'${path}\', \'/index.html\') as \"index\",\r\n		</#if>\r\n		<#--上一页-->\r\n		<#if (pageTag.pageNo?eval-1) gt 1>\r\n			<#if shortSwitch?? && shortSwitch>\r\n				CONCAT(\'${path}\',\'-${pageTag.pageNo?eval-1}.html\') as \"pre\",\r\n			<#else>\r\n				CONCAT(\'${path}\',\'/list-${pageTag.pageNo?eval-1}.html\') as \"pre\",\r\n			</#if>\r\n		<#else>\r\n			<#if shortSwitch?? && shortSwitch>\r\n				CONCAT(\'${path}\',\'.html\') as \"pre\",\r\n			<#else>\r\n				CONCAT(\'${path}\',\'/index.html\') as \"pre\",\r\n			</#if>\r\n		</#if>\r\n		<#--下一页-->\r\n		<#if pageTag.total==0>\r\n			<#if shortSwitch?? && shortSwitch>\r\n				CONCAT(\'${path}\', \'.html\') as \"next\",\r\n				CONCAT(\'${path}\', \'.html\') as \"last\"\r\n			<#else>\r\n				CONCAT(\'${path}\', \'/index.html\') as \"next\",\r\n				CONCAT(\'${path}\', \'/index.html\') as \"last\"\r\n			</#if>\r\n		<#else>\r\n			<#if pageTag.pageNo?eval gte pageTag.total>\r\n				<#if shortSwitch?? && shortSwitch>\r\n					CONCAT(\'${path}\',\'-${pageTag.total}.html\') as \"next\",\r\n				<#else>\r\n					CONCAT(\'${path}\',\'/list-${pageTag.total}.html\') as \"next\",\r\n				</#if>\r\n			<#else>\r\n				<#if shortSwitch?? && shortSwitch>\r\n					CONCAT(\'${path}\',\'-${pageTag.pageNo?eval+1}.html\') as \"next\",\r\n				<#else>\r\n					CONCAT(\'${path}\',\'/list-${pageTag.pageNo?eval+1}.html\') as \"next\",\r\n				</#if>\r\n			</#if>\r\n			<#--最后一页-->\r\n			<#if shortSwitch?? && shortSwitch>\r\n				CONCAT(\'${path}\',\'-${pageTag.total}.html\') as \"last\"\r\n			<#else>\r\n				CONCAT(\'${path}\',\'/list-${pageTag.total}.html\') as \"last\"\r\n			</#if>\r\n		</#if>\r\n	<#else>\r\n		<#--判断是否是搜索页面-->\r\n		\'${pageTag.indexUrl}\' as \"index\",\r\n		\'${pageTag.lastUrl}\' as \"last\",\r\n		\'${pageTag.preUrl}\' as \"pre\",\r\n		\'${pageTag.nextUrl}\' as \"next\",\r\n		\'${pageTag.total}\' as \"total\",\r\n		\'${pageTag.size}\' as \"size\",\r\n		\'${pageTag.rcount}\' as \"rcount\",\r\n		\'${pageTag.pageNo}\' as \"cur\"\r\n	</#if>\r\n    from dual\r\n</#if>', NULL, '通用分页', NULL, NULL, NULL, NULL, 0, 1);
INSERT INTO `mdiy_tag` VALUES (10, 'next', 'single', '<#assign select=\"\'\'\"/>\r\n<#if orderby?? >\r\n	<#if orderby==\"date\">\r\n		<#assign  _orderby=\"content_datetime\">\r\n	<#elseif orderby==\"updatedate\">\r\n		<#assign  _orderby=\"cms_content.update_date\">\r\n	<#elseif orderby==\"hit\">\r\n		<#assign  _orderby=\"content_hit\">\r\n	<#elseif orderby==\"sort\">\r\n		<#assign  _orderby=\"content_sort\">\r\n	<#else>\r\n		<#assign  _orderby=\"cms_content.id\"></#if>\r\n	<#else>\r\n		<#assign  _orderby=\"cms_content.id\">\r\n	</#if>\r\n<#--开始-->\r\n<#if pageTag.nextId??>\r\n	SELECT\r\n    cms_content.id as \"id\",\r\n    content_title as \"title\",\r\n    content_author as \"author\",\r\n    content_source as \"source\",\r\n    content_details as \"content\",\r\n    category.category_title as \"typename\",\r\n    category.category_id as \"typeid\",\r\n    <#if isDo?? && isDo>\r\n        CONCAT(\'/${modelName}/list.do?typeid=\', cms_category.id) as \"typelink\",\r\n    <#else>\r\n        <#if shortSwitch?? && shortSwitch>\r\n            CONCAT(\'/\',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\n    content_img as \"litpic\",\r\n    <#--内容页动态链接-->\r\n    <#if isDo?? && isDo>\r\n        CONCAT(\'${modelName}/view.do?id=\', cms_content.id,\'&orderby=${_orderby}\',\'&order=${order!\'ASC\'}\',\'&typeid=${typeid}\') as \"link\",\r\n    <#else>\r\n        <#if shortSwitch?? && shortSwitch>\r\n            CONCAT(CONCAT(\'/\',cms_content.id),\'.html\') AS \"link\",\r\n        <#else>\r\n            CONCAT(CONCAT(category_path,\'/\'),CONCAT(cms_content.id,\'.html\')) AS \"link\",\r\n        </#if>\r\n    </#if>\r\n    content_description as \"descrip\",\r\n    content_hit as \"hit\",\r\n    content_type as \"flag\",\r\n    content_keyword as \"keyword\"\r\n	FROM cms_content\r\n    LEFT JOIN cms_category category ON cms_content.category_id=category.id\r\n	WHERE cms_content.id=${pageTag.nextId}\r\n<#else>\r\n  SELECT\r\n    ${select} as \"id\",\r\n    \'没有了\' as \"title\",\r\n    ${select} as \"author\",\r\n    ${select} as \"source\",\r\n    ${select} as \"content\",\r\n    ${select} as \"typename\",\r\n    ${select} as \"typeid\",\r\n    ${select} as \"typelink\",\r\n    ${select} as \"litpic\",\r\n    ${select} as \"link\",\r\n    ${select} as \"date\",\r\n    ${select} as \"descrip\",\r\n    ${select} as \"hit\",\r\n    ${select} as \"flag\",\r\n    ${select} as \"keyword\"\r\n  FROM dual\r\n</#if>\r\n', NULL, '文章下一篇', NULL, NULL, NULL, NULL, 0, 1);
INSERT INTO `mdiy_tag` VALUES (11, 'diyform', 'macro', '<#macro ms_diyform formName>\r\n<div id=\"form\" v-cloak style=\"width: 30%; margin: 5% auto\">\r\n  <div id=\"formModel\">\r\n    <!--会自动渲染代码生成器的表单-->\r\n  </div>\r\n  <!--必须包含验证码-->\r\n  <el-form ref=\"form\" :model=\"form\" :rules=\"rules\" label-position=\"right\" size=\"large\" label-width=\"120px\">\r\n    <el-row :gutter=\"0\" justify=\"start\" align=\"top\">\r\n      <el-col :span=\"12\">\r\n        <el-form-item label=\"验证码\" prop=\"rand_code\">\r\n          <el-input\r\n                  v-model=\"form.rand_code\"\r\n                  :disabled=\"false\"\r\n                  :readonly=\"false\"\r\n                  :clearable=\"true\"\r\n                  placeholder=\"请输入验证码\">\r\n          </el-input>\r\n        </el-form-item>\r\n      </el-col>\r\n      <el-col :span=\"12\">\r\n        <div style=\"display: flex; height: 38px;margin-left: 1em; align-items: center; cursor: pointer\">\r\n          <img :src=\"verifCode\" class=\"code-img\" @click=\"code\"/>\r\n          <div @click=\"code\" style=\"margin-left: 10px\">\r\n            看不清？换一张\r\n          </div>\r\n        </div>\r\n      </el-col>\r\n    </el-row>\r\n    <el-form-item label=\"  \">\r\n      <el-button @click=\"save\" type=\"primary\" :loading=\"isLoading\" style=\"width: 200px\">\r\n        {{isLoading ? \'保存中\' : \'保存\'}}\r\n      </el-button>\r\n    </el-form-item>\r\n  </el-form>\r\n</div>\r\n<script>\r\n  //vue的实例名称必须为 from\r\n  var form = new Vue({\r\n    el: \'#form\',\r\n    data: {\r\n      formModel: undefined, //自定义业务的vue对象\r\n      verifCode:  \"/code.do?t=\" + new Date().getTime(),\r\n      isLoading: false,\r\n      form: {\r\n        rand_code: \'\'\r\n      },\r\n      rules: {\r\n        rand_code: [\r\n          {required: true, message: \'请输入验证码\', trigger: \'blur\'},\r\n          {min: 1, max: 4, message: \'长度不能超过4个字符\', trigger: \'change\'}\r\n        ],\r\n      },\r\n    },\r\n    methods: {\r\n      save: function () {\r\n        var that = this;\r\n        that.isLoading = true;\r\n        //将验证码值复制到自定义模型\r\n        form.formModel.form.rand_code = this.form.rand_code;\r\n        //调用自定义模型的保存\r\n        that.formModel.save(function (res) {\r\n          if (res.result) {\r\n            that.$notify({\r\n              title: \'成功\',\r\n              type: \'success\',\r\n              message: \'保存成功!\'\r\n            });\r\n\r\n          } else {\r\n            that.$notify({\r\n              title: \'失败\',\r\n              message: res.msg,\r\n              type: \'warning\'\r\n            });\r\n          }\r\n          that.isLoading = false;\r\n        });\r\n      },\r\n      code: function () {\r\n        this.verifCode = \"/code.do?t=\" + (new Date).getTime();\r\n      }\r\n    },\r\n    created: function () {\r\n      var that = this;\r\n      ms.mdiy.model.form(\"formModel\", { \"modelName\": \"${formName}\" }).then(function(obj) {\r\n        that.formModel = obj;\r\n      });\r\n    }\r\n  });\r\n</script>\r\n</#macro>', NULL, '智能表单', '57', '2022-11-15 16:10:49', NULL, NULL, 0, 1);
INSERT INTO `mdiy_tag` VALUES (12, 'data', 'list', 'SELECT\r\n	cms_content.id AS \"id\",\r\n	content_title AS \"title\",\r\n	content_author AS \"author\",\r\n	content_source AS \"source\",\r\n	content_details AS \"content\",\r\n	content_out_link AS outlink,\r\n	content_short_title AS shorttitle,\r\n	category.category_title AS \"typetitle\",\r\n	category.category_short_title AS \"typeshorttitle\",\r\n	category.id AS \"typeid\",\r\n	category.category_path AS \"typepath\",\r\n	category.category_img AS \"typelitpic\",\r\n	category.category_ico AS \"typeico\",\r\n	category.category_keyword AS \"typekeyword\",\r\n	category.top_id AS \"topId\",\r\n	category.category_parent_ids AS \"parentids\",\r\n	category.category_type AS \"type\",\r\n	<#--列表页动态链接-->\r\n	<#if isDo?? && isDo>\r\n	    CONCAT(\'/${modelName}/list.do?style=${appTemplate!\"\"}&typeid=\', category.category_id) AS \"typelink\",\r\n	<#else>\r\n	<#if shortSwitch?? && shortSwitch>\r\n		CONCAT(\'/\',CONCAT(category_pinyin,\'.html\')) AS \"typelink\",\r\n	<#else>\r\n		CONCAT(category_path,\'/index.html\') AS \"typelink\",\r\n	</#if>\r\n	</#if>\r\n	content_description AS \"descrip\",\r\n	content_hit AS \"hit\",\r\n	content_type AS \"flag\",\r\n	cms_content.content_keyword AS \"keyword\",\r\n	content_img AS \"litpic\",\r\n	<#--内容页动态链接-->\r\n	<#if isDo?? && isDo>\r\n		CONCAT(\'/${modelName}/view.do?style=${appTemplate!\"\"}&id=\', cms_content.id) AS \"link\",\r\n	<#else>\r\n		<#if shortSwitch?? && shortSwitch>\r\n			CONCAT(\'/\',CONCAT(cms_content.id,\'.html\')) AS \"link\",\r\n		<#else>\r\n			CONCAT(CONCAT(CONCAT(category.category_path,\'/\'),cms_content.id),\'.html\') AS \"link\",\r\n		</#if>\r\n	</#if>\r\n 	<#if tableName??>${tableName}.*,</#if>\r\n	content_datetime AS \"date\"\r\nFROM\r\n	cms_content LEFT JOIN cms_category category ON cms_content.category_id = category.id\r\n	<#--判断是否有自定义模型表-->\r\n	<#if tableName??>\r\n		LEFT JOIN ${tableName} ON ${tableName}.link_id=cms_content.id\r\n	</#if>\r\nWHERE\r\n  content_display=0\r\n  and cms_content.del=0\r\n	<#--根据站点编号查询-->\r\n	<#if appId?? >\r\n		and cms_content.app_id=${appId}\r\n	</#if>\r\n	and cms_content.id=${dataid}\r\n\r\n', NULL, '单篇', '57', '2022-11-15 16:10:49', NULL, NULL, 0, 1);

SET FOREIGN_KEY_CHECKS = 1;
