Commit 6a59a6d7 authored by msgroup's avatar msgroup Committed by mingsoft
Browse files

fix: 5.3

parent 672d5545
ALTER TABLE `role_model` ADD COLUMN `id` int(11) NOT NULL AUTO_INCREMENT ,ADD PRIMARY KEY (`id`);
UPDATE `model` SET `model_id` = 84, `model_parent_ids` = '84', `model_code` = '12010000', `model_title` = '应用设置', `model_url` = 'basic/app/-1/edit.do', `model_icon` = '', `model_sort` = 2, `model_ismenu` = 1, `IS_CHILD` = NULL, `model_datetime` = '2014-12-19 22:31:59', `UPDATE_BY` = '57', `UPDATE_DATE` = '2023-01-03 13:51:29', `CREATE_BY` = NULL, `CREATE_DATE` = NULL, `DEL` = 0 WHERE `id` = 86;
UPDATE `model` SET `model_id` = 86, `model_parent_ids` = '84,86', `model_code` = '12010004', `model_title` = '修改', `model_url` = 'basic:app:update', `model_icon` = '', `model_sort` = 0, `model_ismenu` = 0, `IS_CHILD` = NULL, `model_datetime` = '2017-09-05 16:14:42', `UPDATE_BY` = NULL, `UPDATE_DATE` = NULL, `CREATE_BY` = NULL, `CREATE_DATE` = NULL, `DEL` = 0 WHERE `id` = 182;
UPDATE `model` SET `model_id` = 86, `model_parent_ids` = '84,86', `model_code` = '12010004', `model_title` = '查看', `model_url` = 'basic:app:view', `model_icon` = '', `model_sort` = 0, `model_ismenu` = 0, `IS_CHILD` = NULL, `model_datetime` = '2022-05-07 14:13:36', `UPDATE_BY` = '57', `UPDATE_DATE` = '2023-01-03 13:51:03', `CREATE_BY` = NULL, `CREATE_DATE` = NULL, `DEL` = 0 WHERE `id` = 1765;
UPDATE `model` SET `model_id` = 411, `model_parent_ids` = '23,411', `model_code` = '412', `model_title` = '查看', `model_url` = 'basic:manager:view', `model_icon` = '', `model_sort` = 0, `model_ismenu` = 0, `IS_CHILD` = NULL, `model_datetime` = '2019-08-04 12:56:13', `UPDATE_BY` = '57', `UPDATE_DATE` = '2023-01-03 11:57:03', `CREATE_BY` = NULL, `CREATE_DATE` = NULL, `DEL` = 0 WHERE `id` = 412;
UPDATE `model` SET `model_id` = 411, `model_parent_ids` = '23,411', `model_code` = '15737980803547570', `model_title` = '删除', `model_url` = 'basic:manager:del', `model_icon` = '', `model_sort` = 0, `model_ismenu` = 0, `IS_CHILD` = NULL, `model_datetime` = '2019-11-19 18:19:35', `UPDATE_BY` = '57', `UPDATE_DATE` = '2023-01-06 14:33:09', `CREATE_BY` = NULL, `CREATE_DATE` = NULL, `DEL` = 0 WHERE `id` = 663;
UPDATE `model` SET `model_id` = 411, `model_parent_ids` = '23,411', `model_code` = '15737980853527702', `model_title` = '更新', `model_url` = 'basic:manager:update', `model_icon` = '', `model_sort` = 0, `model_ismenu` = 0, `IS_CHILD` = NULL, `model_datetime` = '2019-11-19 18:21:08', `UPDATE_BY` = '57', `UPDATE_DATE` = '2023-01-06 14:33:32', `CREATE_BY` = NULL, `CREATE_DATE` = NULL, `DEL` = 0 WHERE `id` = 664;
UPDATE `model` SET `model_id` = 411, `model_parent_ids` = '23,411', `model_code` = '15735981803267702', `model_title` = '新增', `model_url` = 'basic:manager:save', `model_icon` = '', `model_sort` = 0, `model_ismenu` = 0, `IS_CHILD` = NULL, `model_datetime` = '2019-11-19 18:21:42', `UPDATE_BY` = '57', `UPDATE_DATE` = '2023-01-07 15:06:12', `CREATE_BY` = NULL, `CREATE_DATE` = NULL, `DEL` = 0 WHERE `id` = 665;
UPDATE `model` SET `model_id` = 23, `model_parent_ids` = '23', `model_code` = '01030000', `model_title` = '菜单管理', `model_url` = 'basic/model/index.do', `model_icon` = '', `model_sort` = 0, `model_ismenu` = 1, `IS_CHILD` = NULL, `model_datetime` = '2017-09-05 13:09:26', `UPDATE_BY` = '57', `UPDATE_DATE` = '2023-01-03 10:46:19', `CREATE_BY` = NULL, `CREATE_DATE` = NULL, `DEL` = 0 WHERE `id` = 183;
UPDATE `model` SET `model_id` = 183, `model_parent_ids` = '23,183', `model_code` = '01030001', `model_title` = '查看', `model_url` = 'basic:model:view', `model_icon` = '', `model_sort` = 0, `model_ismenu` = 0, `IS_CHILD` = NULL, `model_datetime` = '2017-09-05 13:10:43', `UPDATE_BY` = NULL, `UPDATE_DATE` = NULL, `CREATE_BY` = NULL, `CREATE_DATE` = NULL, `DEL` = 0 WHERE `id` = 184;
UPDATE `model` SET `model_id` = 183, `model_parent_ids` = '23,183', `model_code` = '01030002', `model_title` = '新增', `model_url` = 'basic:model:save', `model_icon` = NULL, `model_sort` = 0, `model_ismenu` = 0, `IS_CHILD` = NULL, `model_datetime` = '2019-12-28 14:26:29', `UPDATE_BY` = NULL, `UPDATE_DATE` = NULL, `CREATE_BY` = NULL, `CREATE_DATE` = NULL, `DEL` = 0 WHERE `id` = 201;
UPDATE `model` SET `model_id` = 183, `model_parent_ids` = '23,183', `model_code` = '01030004', `model_title` = '修改', `model_url` = 'basic:model:update', `model_icon` = '', `model_sort` = 0, `model_ismenu` = 0, `IS_CHILD` = NULL, `model_datetime` = '2019-12-28 14:26:33', `UPDATE_BY` = '57', `UPDATE_DATE` = '2023-01-06 15:10:56', `CREATE_BY` = NULL, `CREATE_DATE` = NULL, `DEL` = 0 WHERE `id` = 202;
UPDATE `model` SET `model_id` = 183, `model_parent_ids` = '23,183', `model_code` = '668', `model_title` = '删除', `model_url` = 'basic:model:del', `model_icon` = '', `model_sort` = 0, `model_ismenu` = 0, `IS_CHILD` = NULL, `model_datetime` = '2019-11-19 18:35:49', `UPDATE_BY` = '57', `UPDATE_DATE` = '2023-01-06 15:09:37', `CREATE_BY` = NULL, `CREATE_DATE` = NULL, `DEL` = 0 WHERE `id` = 668;
UPDATE `model` SET `model_id` = 406, `model_parent_ids` = '23,406', `model_code` = '407', `model_title` = '新增', `model_url` = 'basic:role:save', `model_icon` = '', `model_sort` = 0, `model_ismenu` = 0, `IS_CHILD` = NULL, `model_datetime` = '2019-08-03 19:19:10', `UPDATE_BY` = '57', `UPDATE_DATE` = '2023-01-07 14:58:52', `CREATE_BY` = NULL, `CREATE_DATE` = NULL, `DEL` = 0 WHERE `id` = 407;
UPDATE `model` SET `model_id` = 406, `model_parent_ids` = '23,406', `model_code` = '408', `model_title` = '修改', `model_url` = 'basic:role:update', `model_icon` = '', `model_sort` = 0, `model_ismenu` = 0, `IS_CHILD` = NULL, `model_datetime` = '2019-08-03 19:19:34', `UPDATE_BY` = '57', `UPDATE_DATE` = '2023-01-06 09:59:49', `CREATE_BY` = NULL, `CREATE_DATE` = NULL, `DEL` = 0 WHERE `id` = 408;
UPDATE `model` SET `model_id` = 406, `model_parent_ids` = '23,406', `model_code` = '409', `model_title` = '删除', `model_url` = 'basic:role:del', `model_icon` = '', `model_sort` = 0, `model_ismenu` = 0, `IS_CHILD` = NULL, `model_datetime` = '2019-08-03 19:19:59', `UPDATE_BY` = '57', `UPDATE_DATE` = '2023-01-03 11:42:47', `CREATE_BY` = NULL, `CREATE_DATE` = NULL, `DEL` = 0 WHERE `id` = 409;
UPDATE `model` SET `model_id` = 406, `model_parent_ids` = '23,406', `model_code` = '409', `model_title` = '查看', `model_url` = 'basic:role:view', `model_icon` = '', `model_sort` = 0, `model_ismenu` = 0, `IS_CHILD` = NULL, `model_datetime` = '2022-05-07 14:12:58', `UPDATE_BY` = '57', `UPDATE_DATE` = '2023-01-03 11:42:51', `CREATE_BY` = NULL, `CREATE_DATE` = NULL, `DEL` = 0 WHERE `id` = 1764;
UPDATE `model` SET `model_id` = 84, `model_parent_ids` = '84', `model_code` = '12020000', `model_title` = '模版管理', `model_url` = 'basic/template/index.do', `model_icon` = '', `model_sort` = 1, `model_ismenu` = 1, `IS_CHILD` = NULL, `model_datetime` = '2014-12-19 22:32:50', `UPDATE_BY` = NULL, `UPDATE_DATE` = NULL, `CREATE_BY` = NULL, `CREATE_DATE` = NULL, `DEL` = 0 WHERE `id` = 87;
UPDATE `model` SET `model_id` = 87, `model_parent_ids` = '84,87', `model_code` = '12020002', `model_title` = '上传', `model_url` = 'basic:template:upload', `model_icon` = '', `model_sort` = 0, `model_ismenu` = 0, `IS_CHILD` = '', `model_datetime` = '2019-12-28 14:26:37', `UPDATE_BY` = '', `UPDATE_DATE` = NULL, `CREATE_BY` = '', `CREATE_DATE` = NULL, `DEL` = 0 WHERE `id` = 204;
UPDATE `model` SET `model_id` = 87, `model_parent_ids` = '84,87', `model_code` = '5434345', `model_title` = '删除', `model_url` = 'basic:template:del', `model_icon` = '', `model_sort` = 0, `model_ismenu` = 0, `IS_CHILD` = '', `model_datetime` = '2019-11-19 19:05:09', `UPDATE_BY` = '', `UPDATE_DATE` = NULL, `CREATE_BY` = '', `CREATE_DATE` = NULL, `DEL` = 0 WHERE `id` = 672;
UPDATE `model` SET `model_id` = 87, `model_parent_ids` = '84,87', `model_code` = '12010004', `model_title` = '查看', `model_url` = 'basic:template:view', `model_icon` = '', `model_sort` = 0, `model_ismenu` = 0, `IS_CHILD` = '', `model_datetime` = '2022-05-07 14:17:03', `UPDATE_BY` = '57', `UPDATE_DATE` = '2022-05-07 14:17:18', `CREATE_BY` = '', `CREATE_DATE` = NULL, `DEL` = 0 WHERE `id` = 1767;
UPDATE `model` SET `model_id` = 87, `model_parent_ids` = '84,87', `model_code` = '452435345', `model_title` = '更新', `model_url` = 'basic:template:update', `model_icon` = '', `model_sort` = 0, `model_ismenu` = 0, `IS_CHILD` = '', `model_datetime` = '2019-11-19 19:05:35', `UPDATE_BY` = '', `UPDATE_DATE` = NULL, `CREATE_BY` = '', `CREATE_DATE` = NULL, `DEL` = 0 WHERE `id` = 673;
CREATE TABLE `mdiy_tag` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tag_name` varchar(255) DEFAULT NULL COMMENT '标签名称',
`tag_type` varchar(255) DEFAULT NULL COMMENT '标签类型',
`tag_sql` text COMMENT '标签sql',
`tag_class` varchar(255) DEFAULT NULL COMMENT '标签类',
`tag_description` varchar(255) DEFAULT NULL COMMENT '描述',
`UPDATE_BY` varchar(11) DEFAULT NULL COMMENT '更新人',
`UPDATE_DATE` datetime DEFAULT NULL COMMENT '更新时间',
`CREATE_BY` varchar(11) DEFAULT NULL COMMENT '创建人',
`CREATE_DATE` datetime DEFAULT NULL COMMENT '创建时间',
`DEL` int(1) DEFAULT '0' COMMENT '删除标记',
`NOT_DEL` int(1) DEFAULT '0' COMMENT '1为不能删除,主要用于系统默认数据,0为一般数据,主要是前端控制',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='标签';
UPDATE `model` SET `model_url` = 'basic/app/app.do' WHERE `model_url` = 'basic/app/-1/edit.do';
INSERT INTO `mdiy_tag` (`id`, `tag_name`, `tag_type`, `tag_sql`, `tag_class`, `tag_description`, `UPDATE_BY`, `UPDATE_DATE`, `CREATE_BY`, `CREATE_DATE`, `DEL`, `NOT_DEL`) VALUES (3, 'arclist', 'list', '<#assign _typeid=\'\'/>\n<#assign _typetitle=\'\'/>\n<#assign _size=\'20\'/>\n\n<#if column?? && column.id?? && column.id?number gt 0>\n <#assign _typeid=\'${column.id}\'>\n</#if>\n\n<#if typeid??>\n <#assign _typeid=\'${typeid}\'>\n</#if>\n\n<#if typetitle??>\n <#assign _typetitle=\'${typetitle}\'>\n</#if>\n\n<#if size??>\n <#assign _size=\'${size}\'>\n</#if>\n\n<#if orderby?? >\n <#if orderby==\'date\'>\n <#assign _orderby=\'content_datetime\'>\n <#elseif orderby==\'updatedate\'>\n <#assign _orderby=\'cms_content.update_date\'>\n <#elseif orderby==\'hit\'>\n <#assign _orderby=\'content_hit\'>\n <#elseif orderby==\'sort\'>\n <#assign _orderby=\'content_sort\'>\n <#else>\n <#assign _orderby=\'cms_content.content_datetime\'>\n </#if>\n<#else>\n <#assign _orderby=\'cms_content.content_datetime\'>\n</#if>\n\nSELECT\n cms_content.id AS id,\n content_title AS title,\n content_title AS fulltitle,\n content_author AS author,\n content_source AS source,\n content_out_link AS outlink,\n category.category_title AS typetitle,\n category.id AS typeid,\n category.category_path AS typepath,\n category.category_img AS typelitpic,\n category.category_keyword as typekeyword,\n category.top_id as topId,\n category.category_parent_ids as parentids,\n category.category_type AS \"type\",\n\n <#--列表页动态链接-->\n <#if isDo?? && isDo>\n CONCAT(\'${modelName}/list.do?style=${appTemplate!\"\"}&typeid=\', category.category_id) as typelink,\n <#else>\n <#if shortSwitch?? && shortSwitch>\n\n (SELECT CONCAT(\'/\',category.category_pinyin,\'.html\')) AS typelink,\n <#else>\n\n (SELECT CONCAT(category_path,\'/index.html\')) AS typelink,\n </#if>\n </#if>\n content_description AS descrip,\n content_hit AS hit,\n content_type AS flag,\n cms_content.content_keyword AS keyword,\n content_img AS litpic,\n\n <#--内容页动态链接-->\n <#if isDo?? && isDo>\n CONCAT(\'/${modelName}/view.do?style=${appTemplate!\"\"}&id=\', cms_content.id) as \"link\",\n <#else>\n <#if shortSwitch?? && shortSwitch>\n CONCAT(\'/\',cms_content.id,\'.html\') AS \"link\",\n <#else>\n CONCAT(category.category_path,\'/\',if(category_type=2,\"index\",cms_content.id),\'.html\') AS \"link\",\n </#if>\n </#if>\n\n <#if tableName??>${tableName}.*,</#if>\n content_datetime AS \"date\"\nFROM\n cms_content LEFT JOIN cms_category as category\nON cms_content.category_id = category.id\n\n <#--判断是否有自定义模型表-->\n <#if tableName??>\n LEFT JOIN ${tableName} ON ${tableName}.link_id=cms_content.id\n </#if>\nWHERE\n content_display=0\n and cms_content.del=0\n <#--根据站点编号查询-->\n <#if appId?? >\n and cms_content.app_id=${appId}\n and cms_content.id>0\n </#if>\n <#--判断是否有搜索分类集合-->\n <#if search?? >\n <#if search.categoryIds?has_content>and FIND_IN_SET(category.id,\'${search.categoryIds}\')</#if>\n <#--标题-->\n <#if search.content_title??> and content_title like CONCAT(\'%\',\'${search.content_title}\',\'%\')</#if>\n <#--作者-->\n <#if search.content_author??> and content_author like CONCAT(\'%\',\'${search.content_author}\',\'%\')</#if>\n <#--来源-->\n <#if search.content_source??> and content_source like CONCAT(\'%\',\'${search.content_source}\',\'%\')</#if>\n <#--属性-->\n <#if search.content_type??> and (\n <#list search.content_type?split(\',\') as item>\n <#if item?index gt 0> or</#if>\n FIND_IN_SET(\'${item}\',cms_content.content_type)\n </#list>)\n </#if>\n\n <#--描述-->\n <#if search.content_description??>\n and content_description like CONCAT(\'%\',\'${search.content_description}\',\'%\')\n </#if>\n\n <#--关键字-->\n <#if search.content_keyword??> and content_keyword like CONCAT(\'%\',\'${search.content_keyword}\',\'%\')</#if>\n\n <#--内容-->\n <#if search.content_details??> and content_details like CONCAT(\'%\',\'${search.content_details}\',\'%\')</#if>\n\n <#--自定义顺序-->\n <#if search.content_sort??> and content_sort=${search.content_sort}</#if>\n <#--时间范围-->\n <#if search.content_datetime_start??&&search.content_datetime_end??>\n and content_datetime between \'${search.content_datetime_start}\' and \'${search.content_datetime_end}\'\n </#if>\n <#else>\n <#--查询栏目-->\n <#if _typeid?has_content>\n and (cms_content.category_id=${_typeid} or cms_content.category_id in (select id FROM cms_category where cms_category.del=0\n <#if _typetitle?has_content>\n and cms_category.category_title=\'${_typetitle}\'</#if> and FIND_IN_SET(${_typeid},CATEGORY_PARENT_IDS)))\n </#if>\n </#if>\n <#--标题-->\n <#if content_title??> and content_title like CONCAT(\'%\',\'${content_title}\',\'%\')</#if>\n <#--作者-->\n <#if content_author??> and content_author like CONCAT(\'%\',\'${content_author}\',\'%\')</#if>\n <#--来源-->\n <#if content_source??> and content_source like CONCAT(\'%\',\'${content_source}\',\'%\')</#if>\n <#--属性-->\n <#if content_type??> and content_type like CONCAT(\'%\',\'${content_type}\',\'%\')</#if>\n <#--描述-->\n <#if content_description??> and content_description like CONCAT(\'%\',\'${content_description}\',\'%\')</#if>\n <#--关键字-->\n <#if content_keyword??> and content_keyword like CONCAT(\'%\',\'${content_keyword}\',\'%\')</#if>\n <#--内容-->\n <#if content_details??> and content_details like CONCAT(\'%\',\'${content_details}\',\'%\')</#if>\n <#--自定义顺序-->\n <#if content_sort??> and content_sort=${content_sort}</#if>\n <#--自定义模型-->\n <#if diyModel??>\n <#list diyModel as dm>\n <#assign json=\"${dm}\"?eval />\n and ${tableName}.${json.key} like CONCAT(\'%\',\'${json.value}\',\'%\')\n </#list>\n </#if>\n <#--文章属性-->\n <#if flag?? >\n and(\n <#list flag?split(\',\') as item>\n <#if item?index gt 0> or</#if>\n FIND_IN_SET(\'${item}\',cms_content.content_type)\n </#list>)\n </#if>\n <#if noflag??>\n and(\n <#list noflag?split(\',\') as item>\n <#if item?index gt 0> and</#if>\n FIND_IN_SET(\'${item}\',cms_content.content_type)=0\n </#list> or cms_content.content_type is null)\n </#if>\n\n <#--字段排序-->\n <#if orderby?? >\nORDER BY\n <#if orderby==\'date\'> content_datetime\n <#elseif orderby==\'updatedate\'> cms_content.update_date\n <#elseif orderby==\'hit\'> content_hit\n <#elseif orderby==\'sort\'> content_sort\n <#else>\n cms_content.content_datetime\n </#if>\n <#else>\nORDER BY cms_content.content_datetime\n </#if>\n\n <#if order?? >\n <#if order==\'desc\'> desc</#if>\n <#if order==\'asc\'> asc</#if>\n <#else>\n desc\n </#if>\n LIMIT\n <#--判断是否分页-->\n <#if ispaging?? && (pageTag.pageNo)??>\n ${((pageTag.pageNo-1)*_size?eval)?c},${_size?default(20)}\n <#else>\n ${_size?default(20)}\n </#if>\n', NULL, '文章列表', NULL, NULL, NULL, NULL, 0, 1);
INSERT INTO `mdiy_tag` (`id`, `tag_name`, `tag_type`, `tag_sql`, `tag_class`, `tag_description`, `UPDATE_BY`, `UPDATE_DATE`, `CREATE_BY`, `CREATE_DATE`, `DEL`, `NOT_DEL`) VALUES (4, 'channel', 'list', '<#assign _typeid=\'0\'/>\n<#if column?? && column.id?? && column.id?number gt 0>\n <#assign _typeid=\'${column.id}\'>\n <#assign selfid=\'${column.id}\'>\n</#if>\n\n<#if typeid??>\n <#assign _typeid=\'${typeid}\'>\n</#if>\n\nselect\n id,\n id as typeid,\n category_title as typetitle,\n <#--动态链接-->\n <#if isDo?? && isDo>\n CONCAT(\'/${modelName}/list.do?typeid=\', id) as typelink,\n <#else>\n <#--栏目类型为链接-->\n <#if shortSwitch?? && shortSwitch>\n CONCAT(category_pinyin,\'.html\') as typelink,\n <#else>\n CONCAT(category_path,\'/index.html\') as typelink,\n </#if>\n </#if>\n category_keyword as typekeyword,\n category_diy_url as typeurl,\n category_flag as flag,\n category_parent_ids as parentids,\n category_descrip as typedescrip,\n category_type as type,\n category_path as typepath,\n leaf as typeleaf,\n category_img as typelitpic ,\n ( SELECT count(*) FROM cms_category cc WHERE cc.category_id = cms_category.id AND cc.del = 0 ) AS childsize\n from cms_category\n where\n cms_category.del=0\n <#--根据站点编号查询-->\n <#if appId?? >\n and cms_category.app_id=${appId}\n </#if>\n\n <#--栏目属性-->\n <#if flag?? >\n and\n (<#list flag?split(\',\') as item>\n <#if item?index gt 0> or</#if>\n FIND_IN_SET(\'${item}\',category_flag)\n </#list>)\n </#if>\n\n <#if noflag?? >\n and\n (<#list noflag?split(\',\') as item>\n <#if item?index gt 0> and</#if>\n FIND_IN_SET(\'${item}\',category_flag)=0\n </#list> or category_flag is null)\n </#if>\n\n <#--type默认son-->\n <#if !type??||!type?has_content>\n <#assign type=\'son\'/>\n </#if>\n\n <#if type?has_content>\n <#--顶级栏目(单个)-->\n <#if type==\'top\'>\n <#if _typeid != \'0\'>\n and (id = top_id or top_id = 0)\n </#if>\n\n <#elseif type==\'nav\'>\n and(category_id=0 or category_id is null)\n\n <#--同级栏目(多个)-->\n <#elseif type==\'level\'>\n\n <#if _typeid != \'0\'>\n and category_id=(select category_id from cms_category where id=${_typeid})\n\n </#if>\n\n <#--当前栏目(单个)-->\n <#elseif type==\'self\'>\n\n <#if _typeid != \'0\'>\n and id=${_typeid}\n </#if>\n\n <#--当前栏目的所属栏目(多个)-->\n <#elseif type==\'path\'>\n\n <#if _typeid != \'0\'>\n and id in (<#if column?? && column.categoryParentIds??>${column.categoryParentIds},</#if>${_typeid})\n </#if>\n <#--子栏目(多个)-->\n\n <#elseif type==\'son\'>\n\n <#if _typeid != \'0\'>\n and category_id=${_typeid}\n </#if>\n\n <#--上一级栏目没有则取当前栏目(单个)-->\n <#elseif type==\'parent\'>\n <#if _typeid != \'0\'>\n and\n <#if column?? && column.categoryId??>\n id=${column.categoryId}\n <#else>\n id=${_typeid}\n </#if>\n </#if>\n </#if>\n\n<#else> <#--默认顶级栏目-->\n and\n <#if _typeid != \'0\'>\n id=${_typeid}\n <#else>\n (category_id=0 or category_id is null)\n </#if>\n\n</#if>\n\n<#--字段排序-->\n<#if type == \'path\'>\n ORDER BY category_path asc\n<#else>\n <#if orderby?? >\n ORDER BY\n <#if orderby==\'date\'> category_datetime\n <#elseif orderby==\'sort\'> category_sort\n <#else>id</#if>\n </#if>\n\n <#if order?? >\n <#if order==\'desc\'> desc</#if>\n <#if order==\'asc\'> asc</#if>\n </#if>\n</#if>', NULL, '通用栏目', NULL, NULL, NULL, NULL, 0, 1);
INSERT INTO `mdiy_tag` (`id`, `tag_name`, `tag_type`, `tag_sql`, `tag_class`, `tag_description`, `UPDATE_BY`, `UPDATE_DATE`, `CREATE_BY`, `CREATE_DATE`, `DEL`, `NOT_DEL`) VALUES (5, 'global', 'single', 'select\n APP_NAME as name,\n app_logo as logo,\n app_keyword as keyword,\n app_description as descrip,\n app_copyright as copyright,\n <#if contextPath??>\n \'${contextPath}\' as contextpath,\n <#else>\n \'\' as contextpath,\n </#if>\n <#--动态解析 -->\n <#if isDo?? && isDo>\n CONCAT(\'${url}\',\'${html}/\',app_dir) as url,\n \'${url}\' as host,\n <#--使用地址栏的域名 -->\n <#elseif url??>\n <#if shortSwitch?? && shortSwitch>\n <#if appId?? >\n CONCAT(\'${url}\',\'${html}/\',app_dir,\'/\') as url,\n <#else>\n\n CONCAT(\'${url}\',\'${html}/\') as url,\n </#if>\n <#else>\n CONCAT(\'${url}\',\'${html}/\',app_dir,\'/\') as url,\n </#if>\n \'${url}\' as host,\n <#else>\n CONCAT(REPLACE(REPLACE(TRIM(substring_index(app_url,\'\\n\',1)), CHAR(10),\'\'), CHAR(13),\'\'),\'/html/\',app_dir) as url,\n REPLACE(REPLACE(TRIM(substring_index(app_url,\'\\n\',1)), CHAR(10),\'\'), CHAR(13),\'\') as host,\n </#if>\n CONCAT(\'template/\',id,\'/\',app_style) as \"style\" <#-- 判断是否为手机端 -->\nfrom app\n <#--根据站点编号查询-->\n <#if appId?? >\nwhere id = ${appId}\n </#if>', NULL, '全局', NULL, NULL, NULL, NULL, 0, 1);
INSERT INTO `mdiy_tag` (`id`, `tag_name`, `tag_type`, `tag_sql`, `tag_class`, `tag_description`, `UPDATE_BY`, `UPDATE_DATE`, `CREATE_BY`, `CREATE_DATE`, `DEL`, `NOT_DEL`) VALUES (7, 'field', 'single', 'SELECT\n cms_content.id as id,\n content_title as title,\n content_author as author,\n content_source as source,\n content_details as content,\n cms_category.id as typeid,\n cms_category.leaf as typeleaf,\n cms_category.category_title as typetitle,\n cms_category.category_img AS typelitpic,\n cms_category.top_id as topId,\n cms_category.category_flag as typeflag,\n cms_category.category_parent_ids as parentids,\n cms_category.category_keyword as typekeyword,\n cms_category.category_descrip as typedescrip,\n cms_category.category_diy_url as typeurl,\n <#--动态链接-->\n <#if isDo?? && isDo>\n CONCAT(\'/${modelName}/list.do?typeid=\', cms_category.id) as typelink,\n <#else>\n <#--栏目类型为链接-->\n <#if shortSwitch?? && shortSwitch>\n\n CONCAT(cms_category.category_pinyin,\'.html\') as typelink,\n\n <#else>\n CONCAT(cms_category.category_path,\'/index.html\') as typelink,\n </#if>\n </#if>\n cms_content.content_img AS litpic,\n <#--内容页动态链接-->\n <#if isDo?? && isDo>\n CONCAT(\'/mcms/view.do?id=\', cms_content.id) as \"link\",\n <#else>\n <#if shortSwitch?? && shortSwitch>\n\n CONCAT(cms_content.id,\'.html\') AS \"link\",\n <#else>\n CONCAT(cms_category.category_path,\'/\',cms_content.id,\'.html\') AS \"link\",\n </#if>\n </#if>\n content_datetime as \"date\",\n content_description as descrip,\n CONCAT(\'<script type=\"text/javascript\" src=\"${url}/cms/content/\',cms_content.id,\'/hit.do\"></script>\') as hit,\n content_type as flag,\n category_title as typetitle,\n <#if tableName??>${tableName}.*,</#if>\n content_keyword as keyword\nFROM cms_content\n LEFT JOIN cms_category ON\n cms_category.id = cms_content.category_id\n <#--判断是否有自定义模型表-->\n <#if tableName??>left join ${tableName} on ${tableName}.link_id=cms_content.id</#if>\nWHERE\n <#--如果是栏目列表页没有文章id所以只取栏目id-->\n <#if column??&&column.id??&&!id??>\n cms_category.id=${column.id} and\n </#if>\n cms_content.del=0\n <#if id??> and cms_content.id=${id}</#if>', NULL, '文章内容', NULL, NULL, NULL, NULL, 0, 1);
INSERT INTO `mdiy_tag` (`id`, `tag_name`, `tag_type`, `tag_sql`, `tag_class`, `tag_description`, `UPDATE_BY`, `UPDATE_DATE`, `CREATE_BY`, `CREATE_DATE`, `DEL`, `NOT_DEL`) VALUES (8, 'pre', 'single', '<#assign select=\"(SELECT \'\')\"/>\n <#if orderby?? >\n <#if orderby==\"date\">\n <#assign _orderby=\"content_datetime\">\n <#elseif orderby==\"updatedate\">\n <#assign _orderby=\"cms_content.update_date\">\n <#elseif orderby==\"hit\">\n <#assign _orderby=\"content_hit\">\n <#elseif orderby==\"sort\">\n <#assign _orderby=\"content_sort\">\n <#else><#assign _orderby=\"cms_content.id\"></#if>\n <#else>\n <#assign _orderby=\"cms_content.id\">\n </#if>\n <#if pageTag.preId??>\nSELECT\n cms_content.id as id,\n content_title as title,\n content_author as author,\n content_source as source,\n content_details as content,\n category.category_title as typename,\n category.category_id as typeid,\n <#if shortSwitch?? && shortSwitch>\n (SELECT CONCAT(category.category_pinyin,\'.html\')) AS typelink,\n <#else>\n (SELECT \'index.html\') as typelink,\n </#if>\n content_img as litpic,\n <#--内容页动态链接-->\n <#if isDo?? && isDo>\n CONCAT(\'/${modelName}/view.do?id=\', cms_content.id,\'&orderby=${_orderby}\',\'&order=${order!\'ASC\'}\',\'&typeid=${typeid}\') as \"link\",\n <#else>\n <#if shortSwitch?? && shortSwitch>\n CONCAT(cms_content.id,\'.html\') AS \"link\",\n <#else>\n CONCAT(category_path,\'/\',cms_content.id,\'.html\') AS \"link\",\n </#if>\n </#if>\n content_datetime as \"date\",\n content_description as descrip,\n content_hit as hit,\n content_type as flag,\n content_keyword as keyword\nFROM cms_content\n LEFT JOIN cms_category as category ON cms_content.category_id=category.id\nWHERE cms_content.id=${pageTag.preId}\n <#else>\nSELECT\n ${select} as id,\n ${select} as title,\n ${select} as fulltitle,\n ${select} as author,\n ${select} as source,\n ${select} as content,\n ${select} as typename,\n ${select} as typeid,\n ${select} as typelink,\n ${select} as litpic,\n ${select} as \"link\",\n ${select} as \"date\",\n ${select} as descrip,\n ${select} as hit,\n ${select} as flag,\n ${select} as keyword\n </#if>', NULL, '文章上一篇', NULL, NULL, NULL, NULL, 0, 1);
INSERT INTO `mdiy_tag` (`id`, `tag_name`, `tag_type`, `tag_sql`, `tag_class`, `tag_description`, `UPDATE_BY`, `UPDATE_DATE`, `CREATE_BY`, `CREATE_DATE`, `DEL`, `NOT_DEL`) VALUES (9, 'page', 'single', 'select\n <#--是否开启短链接-->\n <#if shortSwitch?? && shortSwitch>\n (SELECT \'${shortSwitch}\') as \"shortSwitch\",\n <#else>\n \"false\" as \"shortSwitch\",\n </#if>\n\n <#if !(pageTag.indexUrl??)>\n <#--判断是否有栏目对象,用于搜索不传栏目-->\n <#if column??>\n <#if shortSwitch?? && shortSwitch>\n <#assign path=column.categoryPinyin/>\n <#else>\n <#assign path=column.categoryPath/>\n </#if>\n <#else>\n <#assign path=\"\"/>\n </#if>\n <#--总记录数、总页数-->\n (SELECT ${pageTag.total}) as \"total\",\n (SELECT ${pageTag.size}) as \"size\",\n\n <#--记录总数-->\n (SELECT ${pageTag.rcount}) as \"rcount\",\n <#--当前页码-->\n (SELECT ${pageTag.pageNo}) as \"cur\",\n\n <#--首页-->\n <#if shortSwitch?? && shortSwitch>\n CONCAT(\'${path}\', \'.html\') as \"index\",\n <#else>\n CONCAT(\'${path}\', \'/index.html\') as \"index\",\n </#if>\n\n <#--上一页-->\n <#if (pageTag.pageNo?eval-1) gt 1>\n <#if shortSwitch?? && shortSwitch>\n CONCAT(\'${path}\',\'-${pageTag.pageNo?eval-1}.html\') as \"pre\",\n <#else>\n CONCAT(\'${path}\',\'/list-${pageTag.pageNo?eval-1}.html\') as \"pre\",\n </#if>\n <#else>\n <#if shortSwitch?? && shortSwitch>\n CONCAT(\'${path}\',\'.html\') as \"pre\",\n <#else>\n CONCAT(\'${path}\',\'/index.html\') as \"pre\",\n </#if>\n </#if>\n\n <#--下一页-->\n <#if pageTag.total==1>\n <#if shortSwitch?? && shortSwitch>\n CONCAT(\'${path}\', \'.html\') as \"next\",\n CONCAT(\'${path}\', \'.html\') as \"last\"\n <#else>\n CONCAT(\'${path}\', \'/index.html\') as \"next\",\n CONCAT(\'${path}\', \'/index.html\') as \"last\"\n </#if>\n <#else>\n <#if pageTag.pageNo?eval gte pageTag.total>\n <#if shortSwitch?? && shortSwitch>\n CONCAT(\'${path}\',\'-${pageTag.total}.html\') as \"next\",\n <#else>\n CONCAT(\'${path}\',\'/list-${pageTag.total}.html\') as \"next\",\n </#if>\n <#else>\n <#if shortSwitch?? && shortSwitch>\n CONCAT(\'${path}\',\'-${pageTag.pageNo?eval+1}.html\') as \"next\",\n <#else>\n CONCAT(\'${path}\',\'/list-${pageTag.pageNo?eval+1}.html\') as \"next\",\n </#if>\n </#if>\n\n <#--最后一页-->\n <#if shortSwitch?? && shortSwitch>\n CONCAT(\'${path}\',\'-${pageTag.total}.html\') as \"last\"\n <#else>\n CONCAT(\'${path}\',\'/list-${pageTag.total}.html\') as \"last\"\n </#if>\n </#if>\n <#else>\n <#--判断是否是搜索页面-->\n \'${pageTag.indexUrl}\' as \"index\",\n \'${pageTag.lastUrl}\' as \"last\",\n \'${pageTag.preUrl}\' as \"pre\",\n \'${pageTag.nextUrl}\' as \"next\",\n (select ${pageTag.total}) as \"total\",\n (select ${pageTag.size}) as \"size\",\n (select ${pageTag.rcount}) as \"rcount\",\n (select ${pageTag.pageNo}) as \"cur\"\n </#if>', NULL, '通用分页', NULL, NULL, NULL, NULL, 0, 1);
INSERT INTO `mdiy_tag` (`id`, `tag_name`, `tag_type`, `tag_sql`, `tag_class`, `tag_description`, `UPDATE_BY`, `UPDATE_DATE`, `CREATE_BY`, `CREATE_DATE`, `DEL`, `NOT_DEL`) VALUES (10, 'next', 'single', '<#assign select=\"(SELECT \'\')\"/>\n <#if orderby?? >\n <#if orderby==\"date\">\n <#assign _orderby=\"content_datetime\">\n <#elseif orderby==\"updatedate\">\n <#assign _orderby=\"cms_content.update_date\">\n <#elseif orderby==\"hit\">\n <#assign _orderby=\"content_hit\">\n <#elseif orderby==\"sort\">\n <#assign _orderby=\"content_sort\">\n <#else><#assign _orderby=\"cms_content.id\"></#if>\n <#else>\n <#assign _orderby=\"cms_content.id\">\n </#if>\n <#if pageTag.nextId??>\nSELECT\ncms_content.id as id,\ncontent_title as title,\ncontent_author as author,\ncontent_source as source,\ncontent_details as content,\ncategory.category_title as typename,\ncategory.category_id as typeid,\n<#if shortSwitch?? && shortSwitch>\n\n (SELECT CONCAT(category.category_pinyin,\'.html\')) AS typelink,\n <#else>\n\n(SELECT \'index.html\') as typelink,\n </#if>\ncontent_img as litpic,\n<#--内容页动态链接-->\n <#if isDo?? && isDo>\n CONCAT(\'/${modelName}/view.do?id=\', cms_content.id,\'&orderby=${_orderby}\',\'&order=${order!\'ASC\'}\',\'&typeid=${typeid}\') as \"link\",\n <#else>\n<#if shortSwitch?? && shortSwitch>\n\n CONCAT(cms_content.id,\'.html\') AS \"link\",\n <#else>\n\n CONCAT(category_path,\'/\',cms_content.id,\'.html\') AS \"link\",\n </#if>\n </#if>\ncontent_datetime as \"date\",\ncontent_description as descrip,\ncontent_hit as hit,\ncontent_type as flag,\ncontent_keyword as keyword\nFROM cms_content\n LEFT JOIN cms_category as category ON cms_content.category_id=category.id\nWHERE cms_content.id=${pageTag.nextId}\n <#else>\nSELECT\n ${select} as id,\n ${select} as title,\n ${select} as fulltitle,\n ${select} as author,\n ${select} as source,\n ${select} as content,\n ${select} as typename,\n ${select} as typeid,\n ${select} as typelink,\n ${select} as litpic,\n ${select} as \"link\",\n ${select} as \"date\",\n ${select} as descrip,\n ${select} as hit,\n ${select} as flag,\n ${select} as keyword\n </#if>\n', NULL, '文章下一篇', NULL, NULL, NULL, NULL, 0, 1);
INSERT INTO `mdiy_tag` (`id`, `tag_name`, `tag_type`, `tag_sql`, `tag_class`, `tag_description`, `UPDATE_BY`, `UPDATE_DATE`, `CREATE_BY`, `CREATE_DATE`, `DEL`, `NOT_DEL`) VALUES (11, 'diyform', 'macro', '<#macro ms_diyform formName>\n<div id=\"form\" v-cloak style=\"width: 30%; margin: 5% auto\">\n <div id=\"formModel\">\n <!--会自动渲染代码生成器的表单-->\n </div>\n <!--必须包含验证码-->\n <el-form ref=\"form\" :model=\"form\" :rules=\"rules\" label-position=\"right\" size=\"large\" label-width=\"120px\">\n <el-row :gutter=\"0\" justify=\"start\" align=\"top\">\n <el-col :span=\"12\">\n <el-form-item label=\"验证码\" prop=\"rand_code\">\n <el-input\n v-model=\"form.rand_code\"\n :disabled=\"false\"\n :readonly=\"false\"\n :clearable=\"true\"\n placeholder=\"请输入验证码\">\n </el-input>\n </el-form-item>\n </el-col>\n <el-col :span=\"12\">\n <div style=\"display: flex; height: 38px;margin-left: 1em; align-items: center; cursor: pointer\">\n <img :src=\"verifCode\" class=\"code-img\" @click=\"code\"/>\n <div @click=\"code\" style=\"margin-left: 10px\">\n 看不清?换一张\n </div>\n </div>\n </el-col>\n </el-row>\n <el-form-item label=\" \">\n <el-button @click=\"save\" type=\"primary\" :loading=\"isLoading\" style=\"width: 200px\">\n {{isLoading ? \'保存中\' : \'保存\'}}\n </el-button>\n </el-form-item>\n </el-form>\n</div>\n<script>\n //vue的实例名称必须为 from\n var form = new Vue({\n el: \'#form\',\n data: {\n formModel: undefined, //自定义业务的vue对象\n verifCode: \"/code?t=\" + new Date().getTime(),\n isLoading: false,\n form: {\n rand_code: \'\'\n },\n rules: {\n rand_code: [\n {required: true, message: \'请输入验证码\', trigger: \'blur\'},\n {min: 1, max: 4, message: \'长度不能超过4个字符\', trigger: \'change\'}\n ],\n },\n },\n methods: {\n save: function () {\n var that = this;\n that.isLoading = true;\n //将验证码值复制到自定义模型\n form.formModel.form.rand_code = this.form.rand_code;\n //调用自定义模型的保存\n that.formModel.save(function (res) {\n if (res.result) {\n that.$notify({\n title: \'成功\',\n type: \'success\',\n message: \'保存成功!\'\n });\n\n } else {\n that.$notify({\n title: \'失败\',\n message: res.msg,\n type: \'warning\'\n });\n }\n that.isLoading = false;\n });\n },\n code: function () {\n this.verifCode = \"/code?t=\" + (new Date).getTime();\n }\n },\n created: function () {\n var that = this;\n ms.mdiy.model.form(\"formModel\", { \"modelName\": \"${formName}\" }).then(function(obj) {\n that.formModel = obj;\n });\n }\n });\n</script>\n</#macro>', NULL, '智能表单', '57', '2022-11-15 16:10:49', NULL, NULL, 0, 1);
\ No newline at end of file
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;
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<properties> <properties>
<java.version>1.8</java.version> <java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<log4j.version>2.19.0</log4j.version> <log4j.version>2.20.0</log4j.version>
</properties> </properties>
<repositories> <repositories>
<repository> <repository>
...@@ -44,24 +44,24 @@ ...@@ -44,24 +44,24 @@
<dependency> <dependency>
<groupId>net.mingsoft</groupId> <groupId>net.mingsoft</groupId>
<artifactId>ms-base</artifactId> <artifactId>ms-base</artifactId>
<version>2.1.18.3</version> <version>2.1.19</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.mingsoft</groupId> <groupId>net.mingsoft</groupId>
<artifactId>ms-basic</artifactId> <artifactId>ms-basic</artifactId>
<version>2.1.18.3</version> <version>2.1.19</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.mingsoft</groupId> <groupId>net.mingsoft</groupId>
<artifactId>ms-mdiy</artifactId> <artifactId>ms-mdiy</artifactId>
<version>2.1.18</version> <version>2.1.19</version>
</dependency> </dependency>
<!--store入口依赖(源码不开发),如果不需要MStore可以直接去掉依赖--> <!--store入口依赖(源码不开发),如果不需要MStore可以直接去掉依赖-->
<dependency> <dependency>
<groupId>net.mingsoft</groupId> <groupId>net.mingsoft</groupId>
<artifactId>store-client</artifactId> <artifactId>store-client</artifactId>
<version>2.1.18</version> <version>2.1.19</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.oshi</groupId> <groupId>com.github.oshi</groupId>
......
...@@ -323,11 +323,11 @@ public class CategoryAction extends BaseAction { ...@@ -323,11 +323,11 @@ public class CategoryAction extends BaseAction {
} }
/** /**
* 批量更新模 * 批量更新模
* @param category 栏目实体 * @param category 栏目实体
* @return * @return
*/ */
@ApiOperation(value = "批量更新模") @ApiOperation(value = "批量更新模")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "编号", required = true, paramType = "query"), @ApiImplicitParam(name = "id", value = "编号", required = true, paramType = "query"),
@ApiImplicitParam(name = "dictId", value = "字典", required = true, paramType = "query") @ApiImplicitParam(name = "dictId", value = "字典", required = true, paramType = "query")
......
...@@ -26,9 +26,15 @@ package net.mingsoft.cms.action; ...@@ -26,9 +26,15 @@ package net.mingsoft.cms.action;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateException; import cn.hutool.core.date.DateException;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ZipUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.ApiOperation;
import net.mingsoft.base.entity.ResultData; import net.mingsoft.base.entity.ResultData;
import net.mingsoft.basic.annotation.LogAnn; import net.mingsoft.basic.annotation.LogAnn;
import net.mingsoft.basic.biz.IModelBiz; import net.mingsoft.basic.biz.IModelBiz;
...@@ -39,8 +45,10 @@ import net.mingsoft.cms.bean.CategoryBean; ...@@ -39,8 +45,10 @@ import net.mingsoft.cms.bean.CategoryBean;
import net.mingsoft.cms.bean.ContentBean; import net.mingsoft.cms.bean.ContentBean;
import net.mingsoft.cms.biz.ICategoryBiz; import net.mingsoft.cms.biz.ICategoryBiz;
import net.mingsoft.cms.biz.IContentBiz; import net.mingsoft.cms.biz.IContentBiz;
import net.mingsoft.cms.constant.e.CategoryDisplayEnum;
import net.mingsoft.cms.constant.e.CategoryTypeEnum; import net.mingsoft.cms.constant.e.CategoryTypeEnum;
import net.mingsoft.cms.entity.CategoryEntity; import net.mingsoft.cms.entity.CategoryEntity;
import net.mingsoft.cms.entity.ContentEntity;
import net.mingsoft.cms.util.CmsParserUtil; import net.mingsoft.cms.util.CmsParserUtil;
import net.mingsoft.mdiy.util.ParserUtil; import net.mingsoft.mdiy.util.ParserUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -53,15 +61,16 @@ import org.springframework.context.annotation.Scope; ...@@ -53,15 +61,16 @@ import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.File; import java.io.*;
import java.io.IOException; import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* @ClassName: GeneraterAction * @ClassName: GeneraterAction
...@@ -70,7 +79,7 @@ import java.util.List; ...@@ -70,7 +79,7 @@ import java.util.List;
* @date: 2018年1月31日 下午2:52:07 * @date: 2018年1月31日 下午2:52:07
* @Copyright: 2018 www.mingsoft.net Inc. All rights reserved. * @Copyright: 2018 www.mingsoft.net Inc. All rights reserved.
*/ */
@ApiIgnore @ApiOperation("静态化")
@Controller("cmsGenerater") @Controller("cmsGenerater")
@RequestMapping("/${ms.manager.path}/cms/generate") @RequestMapping("/${ms.manager.path}/cms/generate")
@Scope("request") @Scope("request")
...@@ -127,12 +136,12 @@ public class GeneraterAction extends BaseAction { ...@@ -127,12 +136,12 @@ public class GeneraterAction extends BaseAction {
@LogAnn(title = "生成主页", businessType = BusinessTypeEnum.UPDATE) @LogAnn(title = "生成主页", businessType = BusinessTypeEnum.UPDATE)
@ResponseBody @ResponseBody
public ResultData generateIndex(HttpServletRequest request, HttpServletResponse response) throws IOException { public ResultData generateIndex(HttpServletRequest request, HttpServletResponse response) throws IOException {
// 模文件名称 // 模文件名称
String tmpFileName = request.getParameter("url"); String tmpFileName = request.getParameter("url");
// 生成后的文件名称 // 生成后的文件名称
String generateFileName = request.getParameter("position"); String generateFileName = request.getParameter("position");
// 获取文件所在路径 首先判断用户输入的模文件是否存在 // 获取文件所在路径 首先判断用户输入的模文件是否存在
if (!FileUtil.exist(ParserUtil.buildTemplatePath())) { if (!FileUtil.exist(ParserUtil.buildTemplatePath())) {
return ResultData.build().error(getResString("template.file")); return ResultData.build().error(getResString("template.file"));
} else { } else {
...@@ -173,8 +182,12 @@ public class GeneraterAction extends BaseAction { ...@@ -173,8 +182,12 @@ public class GeneraterAction extends BaseAction {
//文章列表 //文章列表
List<CategoryBean> articleIdList = null; List<CategoryBean> articleIdList = null;
// 获取栏目列表模 // 获取栏目列表模
for (CategoryEntity column : columns) { for (CategoryEntity column : columns) {
// 如果栏目被禁用则跳过
if (CategoryDisplayEnum.DISABLE.toString().equalsIgnoreCase(column.getCategoryDisplay())){
continue;
}
//如果是链接就跳过生成 //如果是链接就跳过生成
if (column.getCategoryType().equals(CategoryTypeEnum.LINK.toString())) { if (column.getCategoryType().equals(CategoryTypeEnum.LINK.toString())) {
continue; continue;
...@@ -255,6 +268,10 @@ public class GeneraterAction extends BaseAction { ...@@ -255,6 +268,10 @@ public class GeneraterAction extends BaseAction {
} }
for (CategoryEntity category : categoryList) { for (CategoryEntity category : categoryList) {
// 如果栏目被禁用则跳过
if (CategoryDisplayEnum.DISABLE.toString().equalsIgnoreCase(category.getCategoryDisplay())){
continue;
}
//如果是链接就跳过生成 //如果是链接就跳过生成
if (category.getCategoryType().equals(CategoryTypeEnum.LINK.toString())) { if (category.getCategoryType().equals(CategoryTypeEnum.LINK.toString())) {
continue; continue;
...@@ -299,4 +316,6 @@ public class GeneraterAction extends BaseAction { ...@@ -299,4 +316,6 @@ public class GeneraterAction extends BaseAction {
+ File.separator + position + ParserUtil.HTML_SUFFIX; + File.separator + position + ParserUtil.HTML_SUFFIX;
return "redirect:" + indexPosition; return "redirect:" + indexPosition;
} }
} }
...@@ -252,6 +252,12 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction { ...@@ -252,6 +252,12 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
params.put(ParserUtil.URL, BasicUtil.getUrl()); params.put(ParserUtil.URL, BasicUtil.getUrl());
params.put(ParserUtil.APP_DIR, BasicUtil.getApp().getAppDir()); params.put(ParserUtil.APP_DIR, BasicUtil.getApp().getAppDir());
} }
//对项目名预处理
String contextPath = BasicUtil.getContextPath();
if (StringUtils.isNotBlank(contextPath) && "/".equalsIgnoreCase(contextPath) ){
contextPath = "";
}
params.putIfAbsent(ParserUtil.CONTEXT_PATH, contextPath);
searchMap.put("pageNo", 0); searchMap.put("pageNo", 0);
// ParserUtil.read(search, map, page); // ParserUtil.read(search, map, page);
...@@ -268,8 +274,7 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction { ...@@ -268,8 +274,7 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
page.setPageNo(pageNo); page.setPageNo(pageNo);
//设置分页的统一链接 //设置分页的统一链接
String url = params.get(ParserUtil.URL).toString(); String url = request.getServletPath() + "?" + urlParams;
url = url + request.getServletPath() + "?" + urlParams;
String pageNoStr = "size=" + page.getSize() + "&pageNo="; String pageNoStr = "size=" + page.getSize() + "&pageNo=";
//下一页 //下一页
String nextUrl = url + pageNoStr + ((pageNo + 1 > total) ? total : pageNo + 1); String nextUrl = url + pageNoStr + ((pageNo + 1 > total) ? total : pageNo + 1);
......
...@@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; ...@@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import net.mingsoft.base.entity.ResultData; import net.mingsoft.base.entity.ResultData;
import net.mingsoft.basic.exception.BusinessException; import net.mingsoft.basic.exception.BusinessException;
import net.mingsoft.basic.util.BasicUtil; import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.cms.constant.e.CategoryDisplayEnum;
import net.mingsoft.cms.constant.e.CategoryTypeEnum; import net.mingsoft.cms.constant.e.CategoryTypeEnum;
import net.mingsoft.cms.dao.ICategoryDao; import net.mingsoft.cms.dao.ICategoryDao;
import net.mingsoft.cms.dao.IContentDao; import net.mingsoft.cms.dao.IContentDao;
...@@ -31,6 +32,7 @@ import org.springframework.stereotype.Component; ...@@ -31,6 +32,7 @@ import org.springframework.stereotype.Component;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
...@@ -76,6 +78,15 @@ public class CategoryAop extends net.mingsoft.basic.aop.BaseAop { ...@@ -76,6 +78,15 @@ public class CategoryAop extends net.mingsoft.basic.aop.BaseAop {
throw new BusinessException("栏目不存在!"); throw new BusinessException("栏目不存在!");
} }
// 如果栏目被设置为不显示,将栏目下所有子栏目也设置为不显示
if (CategoryDisplayEnum.DISABLE.toString().equalsIgnoreCase(category.getCategoryDisplay())){
List<String> ids = categoryDao.queryChildren(category).stream().map(CategoryEntity::getId).collect(Collectors.toList());
LambdaUpdateWrapper<CategoryEntity> wrapper = new UpdateWrapper<CategoryEntity>().lambda();
wrapper.set(CategoryEntity::getCategoryDisplay,CategoryDisplayEnum.DISABLE.toString());
wrapper.in(CategoryEntity::getId,ids);
categoryDao.update(new CategoryEntity(),wrapper);
}
// 获取返回值 // 获取返回值
Object obj = pjp.proceed(pjp.getArgs()); Object obj = pjp.proceed(pjp.getArgs());
ResultData resultData = JSONUtil.toBean(JSONUtil.toJsonStr(obj), ResultData.class); ResultData resultData = JSONUtil.toBean(JSONUtil.toJsonStr(obj), ResultData.class);
...@@ -83,6 +94,7 @@ public class CategoryAop extends net.mingsoft.basic.aop.BaseAop { ...@@ -83,6 +94,7 @@ public class CategoryAop extends net.mingsoft.basic.aop.BaseAop {
if (parent == null) { if (parent == null) {
return resultData; return resultData;
} }
// 用于判断父级栏目之前是否是子栏目 // 用于判断父级栏目之前是否是子栏目
// 只有父节点之前为子节点 && 父栏目类型为列表 && 子栏目为列表 // 只有父节点之前为子节点 && 父栏目类型为列表 && 子栏目为列表
boolean flag = parent.getLeaf() && StringUtils.equals(parent.getCategoryType(), CategoryTypeEnum.LIST.toString()); boolean flag = parent.getLeaf() && StringUtils.equals(parent.getCategoryType(), CategoryTypeEnum.LIST.toString());
......
...@@ -99,28 +99,20 @@ public class ContentAop extends BaseAop { ...@@ -99,28 +99,20 @@ public class ContentAop extends BaseAop {
return pjp.proceed(); return pjp.proceed();
} }
//查询判断该ip是否已经有浏览记录了
HistoryLogEntity historyLog = new HistoryLogEntity(); HistoryLogEntity historyLog = new HistoryLogEntity();
historyLog.setContentId(content.getId()); historyLog.setContentId(content.getId());
historyLog.setHlIp(BasicUtil.getIp()); historyLog.setHlIp(BasicUtil.getIp());
historyLog.setHlIsMobile(BasicUtil.isMobileDevice()); historyLog.setHlIsMobile(BasicUtil.isMobileDevice());
HistoryLogEntity _historyLog = (HistoryLogEntity) historyLogBiz.getEntity(historyLog); historyLog.setCreateDate(new Date());
//如果该ip该文章没有浏览记录则保存浏览记录 //保存浏览记录
//并且更新点击数 historyLogBiz.saveEntity(historyLog);
if (_historyLog == null || StringUtils.isBlank(_historyLog.getId())) { //更新点击数
historyLog.setCreateDate(new Date()); if (content.getContentHit() == null) {
historyLogBiz.saveEntity(historyLog); content.setContentHit(1);
//更新点击数 } else {
ContentEntity updateContent = new ContentEntity(); content.setContentHit(content.getContentHit() + 1);
updateContent.setId(content.getId());
if (content.getContentHit() == null) {
updateContent.setContentHit(1);
} else {
updateContent.setContentHit(content.getContentHit() + 1);
}
contentBiz.updateEntity(updateContent);
} }
contentBiz.updateById(content);
return pjp.proceed(); return pjp.proceed();
} }
...@@ -131,6 +123,7 @@ public class ContentAop extends BaseAop { ...@@ -131,6 +123,7 @@ public class ContentAop extends BaseAop {
/** /**
* 删除文章后并删除文章对应的静态化文件 * 删除文章后并删除文章对应的静态化文件
*
* @param jp * @param jp
*/ */
@After("delete()") @After("delete()")
...@@ -157,8 +150,8 @@ public class ContentAop extends BaseAop { ...@@ -157,8 +150,8 @@ public class ContentAop extends BaseAop {
/** /**
* @param categoryPath 栏目目录 * @param categoryPath 栏目目录
* @param contentId 文章ID * @param contentId 文章ID
* 根据文章实体删除静态文件 * 根据文章实体删除静态文件
*/ */
private void deleteHtml(String categoryPath, String contentId) { private void deleteHtml(String categoryPath, String contentId) {
// html真实路径 // html真实路径
......
/**
* Copyright (c) 2012-present 铭软科技(mingsoft.net)
* 本软件及相关文档文件(以下简称“软件”)的版权归 铭软科技 所有
* 遵循铭软科技《保密协议》
*/
package net.mingsoft.cms.constant.e;
import net.mingsoft.base.constant.e.BaseEnum;
/**
* @Author: 铭飞团队
* @Description: 栏目是否显示枚举类
* @Date: Create in 2023/03/24 14:18
*/
public enum CategoryDisplayEnum implements BaseEnum {
/**
* 启用
*/
ENABLE("enable"),
/**
* 禁用
*/
DISABLE("disable");
CategoryDisplayEnum(String status) {
this.status = status;
}
private String status;
@Override
public int toInt() {
return 0;
}
@Override
public String toString() {
return status;
}
}
...@@ -3,98 +3,110 @@ ...@@ -3,98 +3,110 @@
<mapper namespace="net.mingsoft.cms.dao.ICategoryDao"> <mapper namespace="net.mingsoft.cms.dao.ICategoryDao">
<resultMap id="resultMap" type="net.mingsoft.cms.entity.CategoryEntity"> <resultMap id="resultMap" type="net.mingsoft.cms.entity.CategoryEntity">
<id column="id" property="id" /><!--编号 --> <id column="id" property="id" /><!--编号 -->
<result column="category_title" property="categoryTitle" /><!--栏目管理名称 --> <result column="category_title" property="categoryTitle" /><!--栏目管理名称 -->
<result column="category_pinyin" property="categoryPinyin" /><!--栏目管理名称 --> <result column="category_short_title" property="categoryShortTitle" /><!--副标题 -->
<result column="category_id" property="categoryId" /><!--所属栏目 --> <result column="category_pinyin" property="categoryPinyin" /><!--栏目管理名称 -->
<result column="category_type" property="categoryType" /><!--栏目管理属性 --> <result column="category_id" property="categoryId" /><!--所属栏目 -->
<result column="category_sort" property="categorySort" /><!--自定义顺序 --> <result column="category_type" property="categoryType" /><!--栏目管理属性 -->
<result column="category_list_url" property="categoryListUrl" /><!--列表模板 --> <result column="category_sort" property="categorySort" /><!--自定义顺序 -->
<result column="category_url" property="categoryUrl" /><!--内容模板 --> <result column="category_list_url" property="categoryListUrl" /><!--列表模板 -->
<result column="category_keyword" property="categoryKeyword" /><!--栏目管理关键字 --> <result column="category_url" property="categoryUrl" /><!--内容模板 -->
<result column="category_descrip" property="categoryDescrip" /><!--栏目管理描述 --> <result column="category_keyword" property="categoryKeyword" /><!--栏目管理关键字 -->
<result column="category_img" property="categoryImg" /><!--缩略图 --> <result column="category_descrip" property="categoryDescrip" /><!--栏目管理描述 -->
<result column="category_diy_url" property="categoryDiyUrl" /><!--自定义链接 --> <result column="category_display" property="categoryDisplay" /><!--栏目是否显示 -->
<result column="mdiy_model_id" property="mdiyModelId" /><!--栏目管理的内容模型id --> <result column="category_img" property="categoryImg" /><!--栏目banner图 -->
<result column="dict_id" property="dictId" /><!--字典对应编号 --> <result column="category_ico" property="categoryIco" /><!--栏目小图 -->
<result column="category_flag" property="categoryFlag" /><!--栏目属性 --> <result column="category_diy_url" property="categoryDiyUrl" /><!--自定义链接 -->
<result column="category_path" property="categoryPath" /><!--栏目路径 --> <result column="mdiy_model_id" property="mdiyModelId" /><!--文章管理的内容模型id -->
<result column="category_parent_ids" property="categoryParentIds" /><!--父类型编号 --> <result column="mdiy_category_model_id" property="mdiyCategoryModelId" /><!--栏目管理的内容模型id -->
<result column="create_by" property="createBy" /><!--创建人 --> <result column="dict_id" property="dictId" /><!--字典对应编号 -->
<result column="create_date" property="createDate" /><!--创建时间 --> <result column="category_flag" property="categoryFlag" /><!--栏目属性 -->
<result column="update_by" property="updateBy" /><!--修改人 --> <result column="category_path" property="categoryPath" /><!--栏目路径 -->
<result column="update_date" property="updateDate" /><!--修改时间 --> <result column="category_parent_ids" property="categoryParentIds" /><!--父类型编号 -->
<result column="del" property="del" /><!--删除标记 --> <result column="create_by" property="createBy" /><!--创建人 -->
<result column="top_id" property="topId" /><!--删除标记 --> <result column="create_date" property="createDate" /><!--创建时间 -->
<result column="leaf" property="leaf" /><!--删除标记 --> <result column="update_by" property="updateBy" /><!--修改人 -->
<result column="update_date" property="updateDate" /><!--修改时间 -->
<result column="del" property="del" /><!--删除标记 -->
<result column="top_id" property="topId" /><!--删除标记 -->
<result column="leaf" property="leaf" /><!--删除标记 -->
</resultMap> </resultMap>
<!--更新--> <!--更新-->
<update id="updateEntity" parameterType="net.mingsoft.cms.entity.CategoryEntity"> <update id="updateEntity" parameterType="net.mingsoft.cms.entity.CategoryEntity">
update cms_category update cms_category
<set> <set>
<if test="categoryTitle != null and categoryTitle != ''">category_title=#{categoryTitle},</if> <if test="categoryTitle != null and categoryTitle != ''">category_title=#{categoryTitle},</if>
<if test="categoryPinyin != null and categoryPinyin != ''">category_pinyin=#{categoryPinyin},</if> <if test="categoryShortTitle != null and categoryShortTitle != ''">category_short_title=#{categoryShortTitle},</if>
<if test="topId != null and topId != ''">top_id=#{topId},</if> <if test="categoryPinyin != null and categoryPinyin != ''">category_pinyin=#{categoryPinyin},</if>
<if test="leaf != null">leaf=#{leaf},</if> <if test="topId != null and topId != ''">top_id=#{topId},</if>
category_id=#{categoryId}, <if test="leaf != null">leaf=#{leaf},</if>
category_parent_ids=#{categoryParentIds}, category_id=#{categoryId},
mdiy_model_id=#{mdiyModelId}, category_parent_ids=#{categoryParentIds},
<if test="categoryType != null and categoryType != ''">category_type=#{categoryType},</if> mdiy_model_id=#{mdiyModelId},
<if test="categorySort != null">category_sort=#{categorySort},</if> mdiy_category_model_id=#{mdiyCategoryModelId},
category_list_url=#{categoryListUrl}, <if test="categoryType != null and categoryType != ''">category_type=#{categoryType},</if>
category_url=#{categoryUrl}, <if test="categorySort != null">category_sort=#{categorySort},</if>
<if test="categoryKeyword != null ">category_keyword=#{categoryKeyword},</if> category_list_url=#{categoryListUrl},
<if test="categoryDescrip != null ">category_descrip=#{categoryDescrip},</if> category_url=#{categoryUrl},
<if test="categoryImg != null and categoryImg != ''">category_img=#{categoryImg},</if> <if test="categoryKeyword != null ">category_keyword=#{categoryKeyword},</if>
<if test="categoryDiyUrl != null">category_diy_url=#{categoryDiyUrl},</if> <if test="categoryDescrip != null ">category_descrip=#{categoryDescrip},</if>
<if test="dictId != null">dict_id=#{dictId},</if> <if test="categoryImg != null and categoryImg != ''">category_img=#{categoryImg},</if>
<if test="categoryFlag != null ">category_flag=#{categoryFlag},</if> <if test="categoryDisplay != null and categoryDisplay != ''">category_display=#{categoryDisplay},</if>
<if test="categoryPath != null and categoryPath != ''">category_path=#{categoryPath},</if> <if test="categoryIco != null and categoryIco != ''">category_ico=#{categoryIco},</if>
<if test="createBy &gt; 0">create_by=#{createBy},</if> <if test="categoryDiyUrl != null">category_diy_url=#{categoryDiyUrl},</if>
<if test="createDate != null">create_date=#{createDate},</if> <if test="dictId != null">dict_id=#{dictId},</if>
<if test="updateBy &gt; 0">update_by=#{updateBy},</if> <if test="categoryFlag != null ">category_flag=#{categoryFlag},</if>
<if test="updateDate != null">update_date=#{updateDate},</if> <if test="categoryPath != null and categoryPath != ''">category_path=#{categoryPath},</if>
<if test="del != null">del=#{del},</if> <if test="createBy &gt; 0">create_by=#{createBy},</if>
</set> <if test="createDate != null">create_date=#{createDate},</if>
where id = #{id} <if test="updateBy &gt; 0">update_by=#{updateBy},</if>
</update> <if test="updateDate != null">update_date=#{updateDate},</if>
<if test="del != null">del=#{del},</if>
</set>
where id = #{id}
</update>
<!--根据id获取--> <!--根据id获取-->
<select id="getEntity" resultMap="resultMap" parameterType="int"> <select id="getEntity" resultMap="resultMap" parameterType="int">
select * from cms_category where id=#{id} select * from cms_category where id=#{id}
</select> </select>
<!--根据实体获取--> <!--根据实体获取-->
<select id="getByEntity" resultMap="resultMap" parameterType="net.mingsoft.cms.entity.CategoryEntity"> <select id="getByEntity" resultMap="resultMap" parameterType="net.mingsoft.cms.entity.CategoryEntity">
select * from cms_category select * from cms_category
<where> <where>
<if test="categoryTitle != null and categoryTitle != ''">and category_title=#{categoryTitle}</if> <if test="categoryTitle != null and categoryTitle != ''">and category_title=#{categoryTitle}</if>
<if test="categoryPinyin != null and categoryPinyin != ''">and category_pinyin=#{categoryPinyin}</if> <if test="categoryShortTitle != null and categoryShortTitle != ''">and category_short_title=#{categoryShortTitle}</if>
<if test="categoryId != null and categoryId != ''">and category_id=#{categoryId}</if> <if test="categoryPinyin != null and categoryPinyin != ''">and category_pinyin=#{categoryPinyin}</if>
<if test="categoryType != null and categoryType != ''">and category_type=#{categoryType}</if> <if test="categoryId != null and categoryId != ''">and category_id=#{categoryId}</if>
<if test="categorySort != null"> and category_sort=#{categorySort} </if> <if test="categoryType != null and categoryType != ''">and category_type=#{categoryType}</if>
<if test="categoryListUrl != null and categoryListUrl != ''">and category_list_url=#{categoryListUrl}</if> <if test="categorySort != null"> and category_sort=#{categorySort} </if>
<if test="categoryUrl != null and categoryUrl != ''">and category_url=#{categoryUrl}</if> <if test="categoryListUrl != null and categoryListUrl != ''">and category_list_url=#{categoryListUrl}</if>
<if test="categoryKeyword != null and categoryKeyword != ''">and category_keyword=#{categoryKeyword}</if> <if test="categoryUrl != null and categoryUrl != ''">and category_url=#{categoryUrl}</if>
<if test="categoryDescrip != null and categoryDescrip != ''">and category_descrip=#{categoryDescrip}</if> <if test="categoryKeyword != null and categoryKeyword != ''">and category_keyword=#{categoryKeyword}</if>
<if test="categoryImg != null and categoryImg != ''">and category_img=#{categoryImg}</if> <if test="categoryDescrip != null and categoryDescrip != ''">and category_descrip=#{categoryDescrip}</if>
<if test="categoryDiyUrl != null and categoryDiyUrl != ''">and category_diy_url=#{categoryDiyUrl}</if> <if test="categoryImg != null and categoryImg != ''">and category_img=#{categoryImg}</if>
<if test="mdiyModelId != null and mdiyModelId != ''">and mdiy_model_id=#{mdiyModelId}</if> <if test="categoryDisplay != null and categoryDisplay != ''">and category_display=#{categoryDisplay}</if>
<if test="dictId != null"> and dict_id=#{dictId} </if> <if test="categoryIco != null and categoryIco != ''">and category_ico=#{categoryIco}</if>
<if test="categoryFlag != null and categoryFlag != ''">and category_flag=#{categoryFlag}</if> <if test="categoryDiyUrl != null and categoryDiyUrl != ''">and category_diy_url=#{categoryDiyUrl}</if>
<if test="categoryPath != null and categoryPath != ''">and category_path=#{categoryPath}</if> <if test="mdiyModelId != null and mdiyModelId != ''">and mdiy_model_id=#{mdiyModelId}</if>
<if test="categoryParentIds != null and categoryParentIds != ''">and category_parent_ids=#{categoryParentIds}</if> <if test="mdiyCategoryModelId != null and mdiyCategoryModelId != ''">and mdiy_category_model_id=#{mdiyCategoryModelId}</if>
<if test="createBy &gt; 0"> and create_by=#{createBy} </if> <if test="dictId != null"> and dict_id=#{dictId} </if>
<if test="createDate != null"> and create_date=#{createDate} </if> <if test="categoryFlag != null and categoryFlag != ''">and category_flag=#{categoryFlag}</if>
<if test="updateBy &gt; 0"> and update_by=#{updateBy} </if> <if test="categoryPath != null and categoryPath != ''">and category_path=#{categoryPath}</if>
<if test="updateDate != null"> and update_date=#{updateDate} </if> <if test="categoryParentIds != null and categoryParentIds != ''">and category_parent_ids=#{categoryParentIds}</if>
<if test="del != null"> and del=#{del} </if> <if test="createBy &gt; 0"> and create_by=#{createBy} </if>
<if test="topId != null and topId != ''"> and top_id=#{topId}</if> <if test="createDate != null"> and create_date=#{createDate} </if>
<if test="leaf != null"> and leaf=#{leaf}</if> <if test="updateBy &gt; 0"> and update_by=#{updateBy} </if>
</where> <if test="updateDate != null"> and update_date=#{updateDate} </if>
</select> <if test="del != null"> and del=#{del} </if>
<if test="topId != null and topId != ''"> and top_id=#{topId}</if>
<if test="leaf != null"> and leaf=#{leaf}</if>
</where>
</select>
<!-- 模糊查询开始 --> <!-- 模糊查询开始 -->
<select id="queryChildren" resultMap="resultMap"> <select id="queryChildren" resultMap="resultMap">
...@@ -116,28 +128,29 @@ ...@@ -116,28 +128,29 @@
</select> </select>
<!--删除--> <!--删除-->
<delete id="deleteEntity" parameterType="int"> <delete id="deleteEntity" parameterType="int">
delete from cms_category where id=#{id} delete from cms_category where id=#{id}
</delete> </delete>
<!--批量删除--> <!--批量删除-->
<delete id="delete" > <delete id="delete" >
delete from cms_category delete from cms_category
<where> <where>
id in <foreach collection="ids" item="item" index="index" id in <foreach collection="ids" item="item" index="index"
open="(" separator="," close=")">#{item}</foreach> open="(" separator="," close=")">#{item}</foreach>
</where> </where>
</delete> </delete>
<!--查询全部--> <!--查询全部-->
<select id="queryAll" resultMap="resultMap"> <select id="queryAll" resultMap="resultMap">
select * from cms_category order by id desc select * from cms_category order by id desc
</select> </select>
<!--条件查询--> <!--条件查询-->
<select id="query" resultMap="resultMap"> <select id="query" resultMap="resultMap">
select * from cms_category select * from cms_category
<where> <where>
<if test="categoryTitle != null and categoryTitle != ''"> and category_title=#{categoryTitle}</if> <if test="categoryTitle != null and categoryTitle != ''"> and category_title=#{categoryTitle}</if>
<if test="categoryShortTitle != null and categoryShortTitle != ''">and category_short_title=#{categoryShortTitle}</if>
<if test="categoryPinyin != null and categoryPinyin != ''">and category_pinyin=#{categoryPinyin}</if> <if test="categoryPinyin != null and categoryPinyin != ''">and category_pinyin=#{categoryPinyin}</if>
<if test="categoryId != null and categoryId != ''"> and category_id=#{categoryId}</if> <if test="categoryId != null and categoryId != ''"> and category_id=#{categoryId}</if>
<if test="categoryType != null and categoryType != ''"> and category_type=#{categoryType}</if> <if test="categoryType != null and categoryType != ''"> and category_type=#{categoryType}</if>
...@@ -147,8 +160,11 @@ ...@@ -147,8 +160,11 @@
<if test="categoryKeyword != null and categoryKeyword != ''"> and category_keyword=#{categoryKeyword}</if> <if test="categoryKeyword != null and categoryKeyword != ''"> and category_keyword=#{categoryKeyword}</if>
<if test="categoryDescrip != null and categoryDescrip != ''"> and category_descrip=#{categoryDescrip}</if> <if test="categoryDescrip != null and categoryDescrip != ''"> and category_descrip=#{categoryDescrip}</if>
<if test="categoryImg != null and categoryImg != ''"> and category_img=#{categoryImg}</if> <if test="categoryImg != null and categoryImg != ''"> and category_img=#{categoryImg}</if>
<if test="categoryDisplay != null and categoryDisplay != ''">and category_display=#{categoryDisplay}</if>
<if test="categoryIco != null and categoryIco != ''">and category_ico=#{categoryIco}</if>
<if test="categoryDiyUrl != null and categoryDiyUrl != ''"> and category_diy_url=#{categoryDiyUrl}</if> <if test="categoryDiyUrl != null and categoryDiyUrl != ''"> and category_diy_url=#{categoryDiyUrl}</if>
<if test="mdiyModelId != null and mdiyModelId != ''"> and mdiy_model_id=#{mdiyModelId}</if> <if test="mdiyModelId != null and mdiyModelId != ''"> and mdiy_model_id=#{mdiyModelId}</if>
<if test="mdiyCategoryModelId != null and mdiyCategoryModelId != ''"> and mdiy_category_model_id=#{mdiyCategoryModelId}</if>
<if test="dictId != null"> and dict_id=#{dictId} </if> <if test="dictId != null"> and dict_id=#{dictId} </if>
<if test="categoryFlag != null and categoryFlag != ''"> and category_flag=#{categoryFlag}</if> <if test="categoryFlag != null and categoryFlag != ''"> and category_flag=#{categoryFlag}</if>
<if test="categoryPath != null and categoryPath != ''"> and category_path=#{categoryPath}</if> <if test="categoryPath != null and categoryPath != ''"> and category_path=#{categoryPath}</if>
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<resultMap id="resultMap" type="net.mingsoft.cms.entity.ContentEntity"> <resultMap id="resultMap" type="net.mingsoft.cms.entity.ContentEntity">
<id column="id" property="id" /><!--编号 --> <id column="id" property="id" /><!--编号 -->
<result column="content_title" property="contentTitle" /><!--文章标题 --> <result column="content_title" property="contentTitle" /><!--文章标题 -->
<result column="content_short_title" property="contentShortTitle" /><!--文章副标题 -->
<result column="category_id" property="categoryId" /><!--所属栏目 --> <result column="category_id" property="categoryId" /><!--所属栏目 -->
<result column="content_type" property="contentType" /><!--文章类型 --> <result column="content_type" property="contentType" /><!--文章类型 -->
<result column="content_display" property="contentDisplay" /><!--是否显示 --> <result column="content_display" property="contentDisplay" /><!--是否显示 -->
...@@ -28,6 +29,7 @@ ...@@ -28,6 +29,7 @@
<resultMap id="resultContentMap" type="net.mingsoft.cms.bean.ContentBean"> <resultMap id="resultContentMap" type="net.mingsoft.cms.bean.ContentBean">
<id column="id" property="id" /><!--编号 --> <id column="id" property="id" /><!--编号 -->
<result column="content_title" property="contentTitle" /><!--文章标题 --> <result column="content_title" property="contentTitle" /><!--文章标题 -->
<result column="content_short_title" property="contentShortTitle" /><!--文章副标题 -->
<result column="category_id" property="categoryId" /><!--所属栏目 --> <result column="category_id" property="categoryId" /><!--所属栏目 -->
<result column="content_type" property="contentType" /><!--文章类型 --> <result column="content_type" property="contentType" /><!--文章类型 -->
<result column="content_display" property="contentDisplay" /><!--是否显示 --> <result column="content_display" property="contentDisplay" /><!--是否显示 -->
...@@ -54,6 +56,7 @@ ...@@ -54,6 +56,7 @@
<id column="article_Id" property="articleId" /><!--编号 --> <id column="article_Id" property="articleId" /><!--编号 -->
<result column="content_update_date" property="contentUpdateDate" /><!--文章更新时间--> <result column="content_update_date" property="contentUpdateDate" /><!--文章更新时间-->
<result column="category_title" property="categoryTitle" /><!--栏目管理名称 --> <result column="category_title" property="categoryTitle" /><!--栏目管理名称 -->
<result column="content_short_title" property="contentShortTitle" /><!--文章副标题 -->
<result column="category_id" property="categoryId" /><!--所属栏目 --> <result column="category_id" property="categoryId" /><!--所属栏目 -->
<result column="category_type" property="categoryType" /><!--栏目管理属性 --> <result column="category_type" property="categoryType" /><!--栏目管理属性 -->
<result column="category_sort" property="categorySort" /><!--自定义顺序 --> <result column="category_sort" property="categorySort" /><!--自定义顺序 -->
...@@ -81,6 +84,7 @@ ...@@ -81,6 +84,7 @@
insert into cms_content insert into cms_content
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="contentTitle != null and contentTitle != ''">content_title,</if> <if test="contentTitle != null and contentTitle != ''">content_title,</if>
<if test="contentShortTitle != null and contentShortTitle != ''">content_short_title,</if>
<if test="categoryId != null and categoryId != ''">category_id,</if> <if test="categoryId != null and categoryId != ''">category_id,</if>
<if test="contentType != null ">content_type,</if> <if test="contentType != null ">content_type,</if>
<if test="contentDisplay != null and contentDisplay != ''">content_display,</if> <if test="contentDisplay != null and contentDisplay != ''">content_display,</if>
...@@ -102,6 +106,7 @@ ...@@ -102,6 +106,7 @@
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="contentTitle != null and contentTitle != ''">#{contentTitle},</if> <if test="contentTitle != null and contentTitle != ''">#{contentTitle},</if>
<if test="contentShortTitle != null and contentShortTitle != ''">#{contentShortTitle},</if>
<if test="categoryId != null and categoryId != ''">#{categoryId},</if> <if test="categoryId != null and categoryId != ''">#{categoryId},</if>
<if test="contentType != null ">#{contentType},</if> <if test="contentType != null ">#{contentType},</if>
<if test="contentDisplay != null and contentDisplay != ''">#{contentDisplay},</if> <if test="contentDisplay != null and contentDisplay != ''">#{contentDisplay},</if>
...@@ -128,6 +133,7 @@ ...@@ -128,6 +133,7 @@
update cms_content update cms_content
<set> <set>
<if test="contentTitle != null and contentTitle != ''">content_title=#{contentTitle},</if> <if test="contentTitle != null and contentTitle != ''">content_title=#{contentTitle},</if>
<if test="contentShortTitle != null and contentShortTitle != ''">content_short_title=#{contentShortTitle},</if>
<if test="categoryId != null and categoryId != ''">category_id=#{categoryId},</if> <if test="categoryId != null and categoryId != ''">category_id=#{categoryId},</if>
<if test="contentType != null ">content_type=#{contentType},</if> <if test="contentType != null ">content_type=#{contentType},</if>
<if test="contentDisplay != null and contentDisplay != ''">content_display=#{contentDisplay},</if> <if test="contentDisplay != null and contentDisplay != ''">content_display=#{contentDisplay},</if>
...@@ -161,6 +167,7 @@ ...@@ -161,6 +167,7 @@
<where> <where>
del=0 del=0
<if test="contentTitle != null and contentTitle != ''">and content_title like CONCAT(CONCAT('%',#{contentTitle}),'%')</if> <if test="contentTitle != null and contentTitle != ''">and content_title like CONCAT(CONCAT('%',#{contentTitle}),'%')</if>
<if test="contentShortTitle != null and contentShortTitle != ''">and content_short_title like CONCAT(CONCAT('%',#{contentShortTitle}),'%')</if>
<if test="categoryId != null and categoryId != ''">and category_id=#{categoryId}</if> <if test="categoryId != null and categoryId != ''">and category_id=#{categoryId}</if>
<if test="contentType != null and contentType != ''">and content_type=#{contentType}</if> <if test="contentType != null and contentType != ''">and content_type=#{contentType}</if>
<if test="contentDisplay != null and contentDisplay != ''">and content_display=#{contentDisplay}</if> <if test="contentDisplay != null and contentDisplay != ''">and content_display=#{contentDisplay}</if>
...@@ -219,6 +226,7 @@ ...@@ -219,6 +226,7 @@
<where> <where>
ct.del=0 ct.del=0
<if test="contentTitle != null and contentTitle != ''"> and content_title like CONCAT(CONCAT('%',#{contentTitle}),'%')</if> <if test="contentTitle != null and contentTitle != ''"> and content_title like CONCAT(CONCAT('%',#{contentTitle}),'%')</if>
<if test="contentShortTitle != null and contentShortTitle != ''"> and content_short_title like CONCAT(CONCAT('%',#{contentShortTitle}),'%')</if>
<if test="categoryId != null and categoryId != ''"> and (ct.category_id=#{categoryId} or ct.category_id in <if test="categoryId != null and categoryId != ''"> and (ct.category_id=#{categoryId} or ct.category_id in
(select id FROM cms_category where find_in_set(#{categoryId},CATEGORY_PARENT_IDS)>0 and cms_category.category_type != 2))</if> (select id FROM cms_category where find_in_set(#{categoryId},CATEGORY_PARENT_IDS)>0 and cms_category.category_type != 2))</if>
<if test="contentType != null and contentType != ''"> <if test="contentType != null and contentType != ''">
...@@ -256,6 +264,7 @@ ...@@ -256,6 +264,7 @@
<where> <where>
ct.del=0 ct.del=0
<if test="contentTitle != null and contentTitle != ''"> and content_title like CONCAT(CONCAT('%',#{contentTitle}),'%')</if> <if test="contentTitle != null and contentTitle != ''"> and content_title like CONCAT(CONCAT('%',#{contentTitle}),'%')</if>
<if test="contentShortTitle != null and contentShortTitle != ''"> and content_short_title like CONCAT(CONCAT('%',#{contentShortTitle}),'%')</if>
<if test="categoryId != null and categoryId != ''"> and (ct.category_id=#{categoryId} or ct.category_id in <if test="categoryId != null and categoryId != ''"> and (ct.category_id=#{categoryId} or ct.category_id in
(select id FROM cms_category where find_in_set(#{categoryId},CATEGORY_PARENT_IDS)>0))</if> (select id FROM cms_category where find_in_set(#{categoryId},CATEGORY_PARENT_IDS)>0))</if>
<if test="contentType != null and contentType != ''"> <if test="contentType != null and contentType != ''">
...@@ -291,7 +300,7 @@ ...@@ -291,7 +300,7 @@
ct.id article_id,ct.content_img litpic,c.*,ct.update_date as content_update_date ct.id article_id,ct.content_img litpic,c.*,ct.update_date as content_update_date
FROM cms_content ct FROM cms_content ct
LEFT JOIN cms_category c ON ct.category_id = c.id LEFT JOIN cms_category c ON ct.category_id = c.id
where ct.del=0 and ct.content_display=0 where ct.del=0 and ct.content_display=0 and c.category_display='enable'
<!-- 查询子栏目数据 --> <!-- 查询子栏目数据 -->
<if test="categoryId!=null and categoryId!='' and categoryType==1"> <if test="categoryId!=null and categoryId!='' and categoryType==1">
...@@ -342,7 +351,7 @@ ...@@ -342,7 +351,7 @@
ct.id article_id,ct.content_img litpic,c.* ct.id article_id,ct.content_img litpic,c.*
FROM cms_content ct FROM cms_content ct
LEFT JOIN cms_category c ON ct.category_id = c.id LEFT JOIN cms_category c ON ct.category_id = c.id
where ct.del=0 where ct.del=0 and ct.content_display=0 and c.category_display='enable'
<!-- 查询子栏目数据 --> <!-- 查询子栏目数据 -->
<if test="categoryId!=null and categoryId!='' and categoryType==1"> <if test="categoryId!=null and categoryId!='' and categoryType==1">
......
...@@ -28,6 +28,8 @@ import net.mingsoft.basic.util.BasicUtil; ...@@ -28,6 +28,8 @@ import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.config.MSProperties; import net.mingsoft.config.MSProperties;
import net.mingsoft.mdiy.util.ConfigUtil; import net.mingsoft.mdiy.util.ConfigUtil;
import java.io.File;
/** /**
* 分类实体 * 分类实体
* *
...@@ -59,6 +61,10 @@ public class CategoryEntity extends BaseEntity { ...@@ -59,6 +61,10 @@ public class CategoryEntity extends BaseEntity {
* 栏目管理名称 * 栏目管理名称
*/ */
private String categoryTitle; private String categoryTitle;
/**
* 栏目副标题
*/
private String categoryShortTitle;
/** /**
* 栏目别名 * 栏目别名
*/ */
...@@ -93,20 +99,34 @@ public class CategoryEntity extends BaseEntity { ...@@ -93,20 +99,34 @@ public class CategoryEntity extends BaseEntity {
*/ */
private String categoryDescrip; private String categoryDescrip;
/** /**
* 缩略 * banner
*/ */
private String categoryImg; private String categoryImg;
/**
* 栏目小图
*/
private String categoryIco;
/**
* 是否显示
*/
private String categoryDisplay;
/** /**
* 自定义链接 * 自定义链接
*/ */
private String categoryDiyUrl; private String categoryDiyUrl;
/** /**
* 栏目管理的内容模型id * 文章管理的内容模型id
*/ */
private String mdiyModelId; private String mdiyModelId;
/**
* 栏目管理的内容模型id
*/
private String mdiyCategoryModelId;
/** /**
* 字典对应编号 * 字典对应编号
*/ */
...@@ -287,19 +307,55 @@ public class CategoryEntity extends BaseEntity { ...@@ -287,19 +307,55 @@ public class CategoryEntity extends BaseEntity {
} }
/** /**
* 设置缩略 * 设置banner
*/ */
public void setCategoryImg(String categoryImg) { public void setCategoryImg(String categoryImg) {
this.categoryImg = categoryImg; this.categoryImg = categoryImg;
} }
/** /**
* 获取缩略 * 获取banner
*/ */
public String getCategoryImg() { public String getCategoryImg() {
return this.categoryImg; return this.categoryImg;
} }
/**
* 获取副标题
*/
public String getCategoryShortTitle() {
return categoryShortTitle;
}
/**
* 设置副标题
*/
public void setCategoryShortTitle(String categoryShortTitle) {
this.categoryShortTitle = categoryShortTitle;
}
/**
* 获取栏目小图
*/
public String getCategoryIco() {
return categoryIco;
}
/**
* 设置栏目小图
*/
public void setCategoryIco(String categoryIco) {
this.categoryIco = categoryIco;
}
public String getCategoryDisplay() {
return categoryDisplay;
}
public void setCategoryDisplay(String categoryDisplay) {
this.categoryDisplay = categoryDisplay;
}
/** /**
* 设置自定义链接 * 设置自定义链接
*/ */
...@@ -413,6 +469,12 @@ public class CategoryEntity extends BaseEntity { ...@@ -413,6 +469,12 @@ public class CategoryEntity extends BaseEntity {
return this.categoryFlag; return this.categoryFlag;
} }
/**
* 获取父栏目id
*/
public String getParentid(){
return this.categoryId;
}
/** /**
* 获取栏目父级Id (标签使用) * 获取栏目父级Id (标签使用)
*/ */
...@@ -483,6 +545,14 @@ public class CategoryEntity extends BaseEntity { ...@@ -483,6 +545,14 @@ public class CategoryEntity extends BaseEntity {
this.childsize = childsize; this.childsize = childsize;
} }
public String getMdiyCategoryModelId() {
return mdiyCategoryModelId;
}
public void setMdiyCategoryModelId(String mdiyCategoryModelId) {
this.mdiyCategoryModelId = mdiyCategoryModelId;
}
/** /**
* 获取url路径 * 获取url路径
* *
......
...@@ -58,6 +58,11 @@ private static final long serialVersionUID = 1574925152617L; ...@@ -58,6 +58,11 @@ private static final long serialVersionUID = 1574925152617L;
* 文章标题 * 文章标题
*/ */
private String contentTitle; private String contentTitle;
/**
* 文章副标题
*/
private String contentShortTitle;
/** /**
* 所属栏目 * 所属栏目
*/ */
...@@ -135,6 +140,14 @@ private static final long serialVersionUID = 1574925152617L; ...@@ -135,6 +140,14 @@ private static final long serialVersionUID = 1574925152617L;
return this.contentTitle; return this.contentTitle;
} }
public String getContentShortTitle() {
return contentShortTitle;
}
public void setContentShortTitle(String contentShortTitle) {
this.contentShortTitle = contentShortTitle;
}
public String getCategoryId() { public String getCategoryId() {
return categoryId; return categoryId;
} }
......
package net.mingsoft.cms.upgrade;
import net.mingsoft.basic.util.SpringUtil;
import net.mingsoft.cms.biz.ICategoryBiz;
import net.mingsoft.cms.entity.CategoryEntity;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author by 铭飞开源团队
* @Description
* @date 2020/6/19 15:58
*/
public class UpgradeCategory {
/**
* 更新栏目分类的顶级节点和叶子节点
*/
public void UpgradeCategory(){
ICategoryBiz categoryBiz = SpringUtil.getBean(ICategoryBiz.class);
List<CategoryEntity> list = categoryBiz.queryAll();
list.forEach(x->{
//将parentId第一行设为顶级节点
String topId = "0";
String parentId = x.getParentids();
if (parentId != null) {
topId = parentId.split(",")[0];
}
x.setTopId(topId);
String id = x.getId();
boolean leaf = true;
//判断是否叶子,循环查找,如果有节点的父节点中包含该节点的id则判断为否跳出循环
for (int i = 0; i< list.size(); i++) {
String pId = list.get(i).getParentids();
if (pId == null) {
continue;
}
leaf = !pId.contains(id);
//如果不是叶子就跳出循环,不需要再判断了
if (!leaf) {
break;
}
}
x.setLeaf(leaf);
//更新
Map<String, String> fields = new HashMap<>();
fields.put("leaf", x.getLeaf()?"1":"0");
fields.put("top_id", x.getTopId());
Map<String, String> where = new HashMap<>();
where.put("id", x.getId());
categoryBiz.updateBySQL("cms_category", fields, where);
});
}
}
...@@ -38,6 +38,7 @@ import net.mingsoft.mdiy.bean.PageBean; ...@@ -38,6 +38,7 @@ import net.mingsoft.mdiy.bean.PageBean;
import net.mingsoft.mdiy.biz.IModelBiz; import net.mingsoft.mdiy.biz.IModelBiz;
import net.mingsoft.mdiy.biz.impl.ModelBizImpl; import net.mingsoft.mdiy.biz.impl.ModelBizImpl;
import net.mingsoft.mdiy.entity.ModelEntity; import net.mingsoft.mdiy.entity.ModelEntity;
import net.mingsoft.mdiy.util.ConfigUtil;
import net.mingsoft.mdiy.util.ParserUtil; import net.mingsoft.mdiy.util.ParserUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -82,6 +83,13 @@ public class CmsParserUtil { ...@@ -82,6 +83,13 @@ public class CmsParserUtil {
map.put(ParserUtil.APP_DIR, BasicUtil.getApp().getAppDir()); map.put(ParserUtil.APP_DIR, BasicUtil.getApp().getAppDir());
} }
//对项目名预处理
String contextPath = BasicUtil.getContextPath();
if (StringUtils.isNotBlank(contextPath) && "/".equalsIgnoreCase(contextPath) ){
contextPath = "";
}
map.putIfAbsent(ParserUtil.CONTEXT_PATH, contextPath);
String content = ParserUtil.rendering(templatePath, map); String content = ParserUtil.rendering(templatePath, map);
FileUtil.writeString(content, ParserUtil.buildHtmlPath(targetPath, htmlDir, map.get(ParserUtil.APP_DIR).toString()), Const.UTF8); FileUtil.writeString(content, ParserUtil.buildHtmlPath(targetPath, htmlDir, map.get(ParserUtil.APP_DIR).toString()), Const.UTF8);
} }
...@@ -130,6 +138,13 @@ public class CmsParserUtil { ...@@ -130,6 +138,13 @@ public class CmsParserUtil {
parserParams.put(ParserUtil.FIELD, column); parserParams.put(ParserUtil.FIELD, column);
//对项目名预处理
String contextPath = BasicUtil.getContextPath();
if (StringUtils.isNotBlank(contextPath) && "/".equalsIgnoreCase(contextPath) ){
contextPath = "";
}
parserParams.putIfAbsent(ParserUtil.CONTEXT_PATH, contextPath);
String columnListPath; String columnListPath;
ModelEntity contentModel = null; ModelEntity contentModel = null;
// 判断当前栏目是否有自定义模型 // 判断当前栏目是否有自定义模型
...@@ -204,6 +219,13 @@ public class CmsParserUtil { ...@@ -204,6 +219,13 @@ public class CmsParserUtil {
parserParams.put(ParserUtil.HTML, htmlDir); parserParams.put(ParserUtil.HTML, htmlDir);
//对项目名预处理
String contextPath = BasicUtil.getContextPath();
if (StringUtils.isNotBlank(contextPath) && "/".equalsIgnoreCase(contextPath) ){
contextPath = "";
}
parserParams.putIfAbsent(ParserUtil.CONTEXT_PATH, contextPath);
Map<Object, Object> contentModelMap = new HashMap<Object, Object>(); Map<Object, Object> contentModelMap = new HashMap<Object, Object>();
ModelEntity contentModel = null; ModelEntity contentModel = null;
......
spring: spring:
datasource: datasource:
url: jdbc:mysql://localhost:3306/mcms?useUnicode=true&serverTimezone=Asia/Shanghai&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&allowMultiQueries=true&useSSL=true url: jdbc:mysql://192.168.0.6:3306/mcms?useUnicode=true&serverTimezone=Asia/Shanghai&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&allowMultiQueries=true&useSSL=true
username: root username: root
password: root password: root
filters: wall,mergeStat filters: wall,mergeStat
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
ms:
mwebsite:
tables: cms_category,cms_content,mdiy_dict,mdiy_model,mdiy_page,role
\ No newline at end of file
...@@ -49,11 +49,11 @@ ms: ...@@ -49,11 +49,11 @@ ms:
back-up: /upload_back back-up: /upload_back
multipart: multipart:
#最大上传文件大小 单位:KB #最大上传文件大小 单位:KB
max-file-size: 1024 max-file-size: 10240
#文件暂存临时目录 #文件暂存临时目录
upload-temp-dir: temp upload-temp-dir: temp
#临时文件大小 #临时文件大小
max-in-memory-size: 102400 max-in-memory-size: 10240
#总上传最大大小 单位:KB -1禁用 #总上传最大大小 单位:KB -1禁用
max-request-size: -1 max-request-size: -1
...@@ -65,10 +65,6 @@ ms: ...@@ -65,10 +65,6 @@ ms:
circle: 10 #干扰线条数,值越大越不容易辨别 circle: 10 #干扰线条数,值越大越不容易辨别
spring: spring:
data:
elasticsearch:
repositories:
enabled: false
main: main:
allow-circular-references: true allow-circular-references: true
datasource: datasource:
...@@ -124,9 +120,11 @@ spring: ...@@ -124,9 +120,11 @@ spring:
number_format: 0.## number_format: 0.##
mybatis-plus: mybatis-plus:
#因为IBaseDao是一个抽象类,没有实体,所以自动注入的时候不会注入,需要手动映射
mapper-locations: classpath*:/net/mingsoft/base/dao/IBaseDao.xml
global-config: global-config:
db-config: db-config:
id-type: auto id-type: auto
where-strategy: not_empty where-strategy: not_empty #防止空串及null拼接条件
configuration: configuration:
database-id: mysql database-id: mysql
...@@ -16,219 +16,309 @@ ...@@ -16,219 +16,309 @@
<el-main class="ms-container"> <el-main class="ms-container">
<el-scrollbar class="ms-scrollbar" style="height: 100%;"> <el-scrollbar class="ms-scrollbar" style="height: 100%;">
<el-form ref="form" :model="form" :rules="rules" label-width="130px" size="mini"> <el-tabs v-model="activeName" style="height: calc(100% - 10px);">
<el-row <el-tab-pane style="position:relative;" v-for="(item, index) in editableTabs" :key="index"
gutter="0" :label="item.title" :name="item.name">
justify="start" align="top"> <el-form v-if="item.title=='栏目编辑'" ref="form" :model="form" :rules="rules" label-width="130px"
<el-col span="12"> size="mini">
<el-form-item label="栏目名称" prop="categoryTitle"> <el-row
<el-input v-model="form.categoryTitle" :gutter="0"
:disabled="false" justify="start" align="top">
:style="{width: '100%'}" <el-col span="12">
:clearable="true" <el-form-item label="栏目名称" prop="categoryTitle">
placeholder="请输入栏目名称"> <el-input v-model="form.categoryTitle"
</el-input> :disabled="false"
<div class="ms-form-tip"> :style="{width: '100%'}"
标签:<a href="http://doc.mingsoft.net/mcms/biao-qian/lan-mu-lie-biao-ms-channel.html" target="_blank">${'$'}{field.typetitle}</a> :clearable="true"
</div> placeholder="请输入栏目名称">
</el-form-item> </el-input>
</el-col> <div class="ms-form-tip">
<el-col span="12"> 标签:<a href="http://doc.mingsoft.net/mcms/biao-qian/lan-mu-lie-biao-ms-channel.html"
<el-form-item label="所属栏目" prop="categoryId"> target="_blank">${'$'}{field.typetitle}</a>
<tree-select ref="tree" :props="{value: 'id',label: 'categoryTitle',children: 'children'}" </div>
:options="treeList" :style="{width:'100%'}" </el-form-item>
v-model="form.categoryId"></tree-select> </el-col>
<div class="ms-form-tip"> <el-col span="12">
不能将父级别栏目移动到自身子级栏目 <el-form-item label="所属栏目" prop="categoryId">
</div> <ms-tree-select ref="tree"
</el-form-item> :props="{value: 'id',label: 'categoryTitle',children: 'children'}"
</el-col> :options="treeList" :style="{width:'100%'}"
</el-row> v-model="form.categoryId"></ms-tree-select>
<el-row <div class="ms-form-tip">
gutter="0" 不能将父级别栏目移动到自身子级栏目
justify="start" align="top"> </div>
<el-col span="12"> </el-form-item>
<el-form-item prop="categoryType" label="栏目类型"> </el-col>
<el-radio-group v-model="form.categoryType" </el-row>
:style="{width: ''}" <el-row
:disabled="categoryTypeDisabled"> :gutter="0"
<el-radio :style="{display: true ? 'inline-block' : 'block'}" :label="item.value" justify="start" align="top">
v-for='(item, index) in categoryTypeOptions' :key="item.value + index"> <el-col span="12">
{{true? item.label : item.value}} <el-form-item label="栏目副标题" prop="categoryShortTitle">
</el-radio> <el-input v-model="form.categoryShortTitle"
</el-radio-group> :disabled="false"
<div class="ms-form-tip"> :style="{width: '100%'}"
列表:<b>列表->详情</b> 的页面,例如:<i>新闻列表、图片列表</i>,可以多篇文章<br> :clearable="true"
单篇:<b>单篇文章</b>,例如:<i>关于我们、公司介绍</i>,只能发一篇文章<br> placeholder="请输入栏目副标题">
链接:外链接,需要配合逻辑判断<b>&lt;#if&gt;</b>和<b>自定义链接</b>标签使用使用,不能发文章<br> </el-input>
修改栏目时,如果该栏目下存在文章栏目类型则不能修改 <div class="ms-form-tip">
</div> 标签:<a href="http://doc.mingsoft.net/mcms/biao-qian/lan-mu-lie-biao-ms-channel.html"
</el-form-item> target="_blank">${'$'}{field.typeshorttitle}</a>
</el-col> </div>
<el-col span="12"> </el-form-item>
<el-form-item prop="mdiyModelId" label="自定义模型"> </el-col>
<el-select v-model="form.mdiyModelId" <el-col span="12">
:style="{width: '100%'}" <el-form-item label="是否显示" prop="categoryDisplay">
:filterable="false" <el-radio-group v-model="form.categoryDisplay"
:disabled="false" :style="{width: ''}"
:multiple="false" :clearable="true" :disabled="false">
placeholder="请选择自定义模型"> <el-radio :style="{display: true ? 'inline-block' : 'block'}"
<el-option v-for='item in mdiyModelIdOptions' :key="item.id" :value="item.id" :label="item.value"
:label="item.modelName"></el-option> v-for='(item, index) in categoryDisplayOptions'
</el-select> :key="item.value + index">
<div class="ms-form-tip"> {{true? item.label : item.value}}
文章字段不满足,使用<b>代码生成器</b>生成<b>自定义模型</b>来扩展,<br/> </el-radio>
大概步骤:<i>代码生成器->复制自定义模型->打开系统后台的自定义管理->选择自定义模型->导入->栏目 自定义模型 绑定</i> </el-radio-group>
</div> <div class="ms-form-tip">
</el-form-item> 选择否后需重新生成,与文章是否显示功能一致;若该栏目禁用,则所有子栏目也会被禁用,请谨慎操作;
</div>
</el-form-item>
</el-col>
</el-row>
<el-row
gutter="0"
justify="start" align="top">
<el-col span="12">
<el-form-item prop="categoryType" label="栏目类型">
<el-radio-group v-model="form.categoryType"
:style="{width: ''}"
:disabled="categoryTypeDisabled">
<el-radio :style="{display: true ? 'inline-block' : 'block'}"
:label="item.value"
v-for='(item, index) in categoryTypeOptions'
:key="item.value + index">
{{true? item.label : item.value}}
</el-radio>
</el-radio-group>
<div class="ms-form-tip">
列表:<b>列表->详情</b> 的页面,例如:<i>新闻列表、图片列表</i>,可以多篇文章<br>
单篇:<b>单篇文章</b>,例如:<i>关于我们、公司介绍</i>,只能发一篇文章<br>
链接:外链接,需要配合逻辑判断<b>&lt;#if&gt;</b>和<b>自定义链接</b>标签使用使用,不能发文章<br>
修改栏目时,如果该栏目下存在文章栏目类型则不能修改
</div>
</el-form-item>
</el-col>
<el-col span="12">
<el-form-item prop="mdiyModelId" label="文章自定义模型">
<el-select v-model="form.mdiyModelId"
:style="{width: '100%'}"
:filterable="false"
:disabled="false"
:multiple="false" :clearable="true"
placeholder="请选择文章自定义模型">
<el-option v-for='item in mdiyModelListOptions' :key="item.id" :value="item.id"
:label="item.modelName"></el-option>
</el-select>
<div class="ms-form-tip">
文章字段不满足,使用<b>代码生成器</b>生成<b>自定义模型</b>来扩展,<br/>
大概步骤:<i>代码生成器->复制自定义模型->打开系统后台的自定义管理->选择自定义模型->导入->文章 自定义模型 绑定</i>
</div>
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row gutter="0" justify="start" align="top" > <el-row gutter="0" justify="start" align="top">
<el-col span="12"> <el-col span="12">
<el-form-item prop="categoryListUrl" label="列表模板" v-if="form.categoryType == '1'"> <el-form-item prop="categoryListUrl" label="列表模板" v-if="form.categoryType == '1'">
<el-select v-model="form.categoryListUrl" <el-select v-model="form.categoryListUrl"
:style="{width: '100%'}" :style="{width: '100%'}"
:filterable="true" :filterable="true"
:disabled="false" :disabled="false"
:multiple="false" :clearable="true" :multiple="false" :clearable="true"
placeholder="请选择列表模板"> placeholder="请选择列表模板">
<el-option v-for='item in categoryListUrlOptions' :key="item" :value="item" <el-option v-for='item in categoryListUrlOptions' :key="item" :value="item"
:label="item"></el-option> :label="item"></el-option>
</el-select> </el-select>
<div class="ms-form-tip"> <div class="ms-form-tip">
当栏目类型为<b>列表</b>时有效,没有选择模版不会进行静态化(不会生成列表静态页) 当栏目类型为<b>列表</b>时有效,没有选择模板不会进行静态化(不会生成列表静态页)
</div> </div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col span="12">
<el-form-item prop="mdiyCategoryModelId" label="栏目自定义模型">
<el-select v-model="form.mdiyCategoryModelId"
:style="{width: '100%'}"
:filterable="false"
:disabled="false"
@change="setCategoryModel"
:multiple="false" :clearable="true"
placeholder="请选择栏目自定义模型">
<el-option v-for='item in mdiyCategoryModelListOptions' :key="item.id"
:value="item.id"
:label="item.modelName"></el-option>
</el-select>
<div class="ms-form-tip">
栏目字段不满足,使用<b>代码生成器</b>生成<b>自定义模型</b>来扩展,<br/>
大概步骤:<i>代码生成器->复制自定义模型->打开系统后台的自定义管理->选择自定义模型->导入->栏目 自定义模型 绑定</i>
</div>
</el-form-item>
</el-col>
</el-row>
<el-row
gutter="0"
justify="start" align="top">
<el-col span="12">
<el-form-item prop="categoryUrl" label="详情模板" v-if="form.categoryType != '3'">
<el-select v-model="form.categoryUrl"
:style="{width: '100%'}"
:filterable="true"
:disabled="false"
:multiple="false" :clearable="true"
placeholder="请选择详情模板">
<el-option v-for='item in categoryUrlOptions' :key="item" :value="item"
:label="item"></el-option>
</el-select>
<div class="ms-form-tip">
当栏目类型为<b>列表</b>时有效,没有选择模板不会进行静态化(不会生成内容静态页)
</div>
</el-form-item>
<el-form-item prop="categoryDiyUrl" label="自定义链接" v-if="form.categoryType == '3'">
<el-input
:disabled="false"
v-model="form.categoryDiyUrl"
:style="{width: '100%'}"
placeholder="请输入自定义链接">
</el-input>
<div class="ms-form-tip">
标签:<a href="http://doc.mingsoft.net/mcms/biao-qian/lan-mu-lie-biao-ms-channel.html"
target="_blank">${'$'}{field.typeurl}</a>,自定义链接不能包含标签
</div>
</el-form-item>
</el-col>
<el-col span="12">
<el-form-item label="自定义顺序" prop="categorySort">
<el-input-number
v-model="form.categorySort"
:disabled="false"
controls-position="">
</el-input-number>
</el-form-item>
</el-col>
</el-row>
<el-row
:gutter="0"
justify="start" align="top">
<el-col :span="12">
<el-form-item label="生成路径" prop="categoryPinyin">
<el-input
v-model="form.categoryPinyin"
:disabled="false"
:readonly="false"
:style="{width: '100%'}"
:clearable="true"
placeholder="请输入栏目生成路径,默认栏目名称拼音全拼">
</el-input>
<div class="ms-form-tip">
默认根据栏目名称的拼音全拼,如果栏目名称含有特殊字符请手动输入
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="栏目属性" prop="categoryFlag">
<el-select v-model="form.categoryFlag"
:style="{width: '100%'}"
:filterable="false"
:disabled="false"
:multiple="true" :clearable="true"
placeholder="请选择栏目属性">
<el-option v-for='item in categoryFlagOptions' :key="item.dictValue"
:value="item.dictValue"
:label="item.dictLabel"></el-option>
</el-select>
<div class="ms-form-tip">
可以在自定义字典中管理
</div>
</el-form-item>
</el-col>
</el-row>
<el-row
gutter="0"
justify="start" align="top" >
<el-col span="12" >
<el-form-item prop="categoryUrl" label="详情模板" v-if="form.categoryType != '3'">
<el-select v-model="form.categoryUrl"
:style="{width: '100%'}"
:filterable="true"
:disabled="false"
:multiple="false" :clearable="true"
placeholder="请选择详情模板">
<el-option v-for='item in categoryUrlOptions' :key="item" :value="item"
:label="item"></el-option>
</el-select>
<div class="ms-form-tip">
当栏目类型为<b>列表</b>时有效,没有选择模版不会进行静态化(不会生成内容静态页)
</div>
</el-form-item>
<el-form-item prop="categoryDiyUrl" label="自定义链接" v-if="form.categoryType == '3'"> </el-row>
<el-form-item label="关键字" prop="categoryKeyword">
<el-input <el-input
type="textarea" :rows="5"
:disabled="false" :disabled="false"
v-model="form.categoryDiyUrl" v-model="form.categoryKeyword"
:style="{width: '100%'}" :style="{width: '100%'}"
placeholder="请输入自定义链接"> placeholder="关键字,有助于搜索">
</el-input> </el-input>
<div class="ms-form-tip"> <div class="ms-form-tip">
标签:<a href="http://doc.mingsoft.net/mcms/biao-qian/lan-mu-lie-biao-ms-channel.html" target="_blank">${'$'}{field.typeurl}</a>,自定义链接不能包含标签 标签:<a href="http://doc.mingsoft.net/mcms/biao-qian/lan-mu-lie-biao-ms-channel.html"
target="_blank">${'$'}{field.typekeyword}</a>,
用于SEO优化
</div> </div>
</el-form-item> </el-form-item>
</el-col> <el-form-item label="描述" prop="categoryDescrip">
<el-col span="12">
<el-form-item label="自定义顺序" prop="categorySort">
<el-input-number
v-model="form.categorySort"
:disabled="false"
controls-position="">
</el-input-number>
</el-form-item>
</el-col>
</el-row>
<el-row
:gutter="0"
justify="start" align="top">
<el-col :span="12">
<el-form-item label="生成路径" prop="categoryPinyin">
<el-input <el-input
v-model="form.categoryPinyin" type="textarea" :rows="5"
:disabled="false" :disabled="false"
:readonly="false" v-model="form.categoryDescrip"
:style="{width: '100%'}" :style="{width: '100%'}"
:clearable="true" placeholder="栏目描述,有助于搜索">
placeholder="请输入栏目生成路径,默认栏目名称拼音全拼">
</el-input> </el-input>
<div class="ms-form-tip"> <div class="ms-form-tip">
默认根据栏目名称的拼音全拼,如果栏目名称含有特殊字符请手动输入 标签:<a href="http://doc.mingsoft.net/mcms/biao-qian/lan-mu-lie-biao-ms-channel.html"
target="_blank">${'$'}{field.typedescrip}</a>
用于SEO优化
</div> </div>
</el-form-item> </el-form-item>
</el-col> <el-form-item label="banner图" prop="categoryImg">
<el-col :span="12"> <el-upload
<el-form-item label="栏目属性" prop="categoryFlag"> :file-list="form.categoryImg"
<el-select v-model="form.categoryFlag" :action="ms.manager+'/file/upload.do'"
:style="{width: '100%'}" :on-remove="categoryImghandleRemove"
:filterable="false" :style="{width:''}"
:disabled="false" :limit="1"
:multiple="true" :clearable="true" :on-exceed="categoryImghandleExceed"
placeholder="请选择栏目属性"> :disabled="false"
<el-option v-for='item in categoryFlagOptions' :key="item.dictValue" :value="item.dictValue" :data="{uploadPath:'/cms/category','isRename':true,'appId':true}"
:label="item.dictLabel"></el-option> :on-success="categoryImgSuccess"
</el-select> accept="image/*"
<div class="ms-form-tip"> list-type="picture-card">
可以在自定义字典中管理 <i class="el-icon-plus"></i>
</div> <div slot="tip" class="ms-form-tip">
只能上传1张图片
标签:<a href="http://doc.mingsoft.net/mcms/biao-qian/lan-mu-lie-biao-ms-channel.html"
target="_blank"><#noparse>{@ms:file field.typelitpic/}</#noparse></a><br/>
</div>
</el-upload>
</el-form-item> </el-form-item>
</el-col> <el-form-item label="栏目小图" prop="categoryIco">
<el-upload
:file-list="form.categoryIco"
</el-row> :action="ms.manager+'/file/upload.do'"
<el-form-item label="关键字" prop="categoryKeyword" > :on-remove="categoryIcohandleRemove"
<el-input :style="{width:''}"
type="textarea" :rows="5" :limit="1"
:disabled="false" :on-exceed="categoryIcohandleExceed"
v-model="form.categoryKeyword" :disabled="false"
:style="{width: '100%'}" :data="{uploadPath:'/cms/category','isRename':true,'appId':true}"
placeholder="关键字,有助于搜索"> :on-success="categoryIcoSuccess"
</el-input> accept="image/*"
<div class="ms-form-tip"> list-type="picture-card">
标签:<a href="http://doc.mingsoft.net/mcms/biao-qian/lan-mu-lie-biao-ms-channel.html" target="_blank">${'$'}{field.typekeyword}</a>, <i class="el-icon-plus"></i>
用于SEO优化 <div slot="tip" class="ms-form-tip">
</div> 只能上传1张图片
</el-form-item> 标签:<a href="http://doc.mingsoft.net/mcms/biao-qian/lan-mu-lie-biao-ms-channel.html"
<el-form-item label="描述" prop="categoryDescrip"> target="_blank"><#noparse>{@ms:file field.typeico/}</#noparse></a><br/>
<el-input </div>
type="textarea" :rows="5" </el-upload>
:disabled="false" </el-form-item>
v-model="form.categoryDescrip" </el-form>
:style="{width: '100%'}" <div :id="'model'+index" v-else></div>
placeholder="栏目描述,有助于搜索"> </el-tab-pane>
</el-input> </el-tabs>
<div class="ms-form-tip">
标签:<a href="http://doc.mingsoft.net/mcms/biao-qian/lan-mu-lie-biao-ms-channel.html" target="_blank">${'$'}{field.typedescrip}</a>
用于SEO优化
</div>
</el-form-item>
<el-form-item label="缩略图" prop="categoryImg" >
<el-upload
:file-list="form.categoryImg"
:action="ms.manager+'/file/upload.do'"
:on-remove="categoryImghandleRemove"
:style="{width:''}"
:limit="1"
:on-exceed="categoryImghandleExceed"
:disabled="false"
:data="{uploadPath:'/cms/category','isRename':true,'appId':true}"
:on-success="categoryImgSuccess"
accept="image/*"
list-type="picture-card">
<i class="el-icon-plus"></i>
<div slot="tip" class="ms-form-tip">
只能上传1张图片
标签:<a href="http://doc.mingsoft.net/mcms/biao-qian/lan-mu-lie-biao-ms-channel.html" target="_blank"><#noparse>{@ms:file field.typelitpic/}</#noparse></a><br/>
</div>
</el-upload>
</el-form-item>
</el-form>
</el-scrollbar> </el-scrollbar>
</el-main> </el-main>
</div> </div>
...@@ -254,6 +344,13 @@ ...@@ -254,6 +344,13 @@
}) })
} }
return { return {
activeName: 'form',
//自定义模型实例
model: undefined,
editableTabs: [{
title: '栏目编辑',
name: 'form'
}],
treeList: [{ treeList: [{
id: '0', id: '0',
categoryTitle: '顶级栏目', categoryTitle: '顶级栏目',
...@@ -262,10 +359,20 @@ ...@@ -262,10 +359,20 @@
categoryList: [], categoryList: [],
saveDisabled: false, saveDisabled: false,
categoryTypeDisabled: true, categoryTypeDisabled: true,
// 栏目是否显示
categoryDisplayOptions: [{
"value": "enable",
"label": "是"
}, {
"value": "disable",
"label": "否"
}],
//表单数据 //表单数据
form: { form: {
// 栏目管理名称 // 栏目管理名称
categoryTitle: '', categoryTitle: '',
// 栏目父标题
categoryShortTitle: '',
// 所属栏目 // 所属栏目
categoryId: undefined, categoryId: undefined,
// 栏目管理属性 // 栏目管理属性
...@@ -280,14 +387,20 @@ ...@@ -280,14 +387,20 @@
categoryPinyin: '', categoryPinyin: '',
// 栏目管理关键字 // 栏目管理关键字
categoryKeyword: '', categoryKeyword: '',
// 栏目是否显示
categoryDisplay: 'enable',
// 栏目管理描述 // 栏目管理描述
categoryDescrip: '', categoryDescrip: '',
// 缩略 // banner
categoryImg: [], categoryImg: [],
// 栏目小图
categoryIco: [],
// 自定义链接 // 自定义链接
categoryDiyUrl: '', categoryDiyUrl: '',
// 栏目管理的内容模型id // 文章管理的内容模型id
mdiyModelId: '', mdiyModelId: '',
// 栏目管理的内容模型id
mdiyCategoryModelId: '',
//栏目字典 //栏目字典
categoryFlag: [] categoryFlag: []
}, },
...@@ -297,13 +410,14 @@ ...@@ -297,13 +410,14 @@
}, { }, {
"value": "2", "value": "2",
"label": "单篇" "label": "单篇"
},{ }, {
"value": "3", "value": "3",
"label": "链接" "label": "链接"
}], }],
categoryListUrlOptions: [], categoryListUrlOptions: [],
categoryUrlOptions: [], categoryUrlOptions: [],
mdiyModelIdOptions: [], mdiyModelListOptions: [],
mdiyCategoryModelListOptions: [],
categoryFlagOptions: [], categoryFlagOptions: [],
rules: { rules: {
// 栏目管理名称 // 栏目管理名称
...@@ -315,7 +429,7 @@ ...@@ -315,7 +429,7 @@
"required": true, "required": true,
"message": "请选择列表模板" "message": "请选择列表模板"
}], }],
categoryPinyin:[{ categoryPinyin: [{
validator: validatorCategoryPinyin, trigger: 'blur' validator: validatorCategoryPinyin, trigger: 'blur'
}, { }, {
"pattern": /^[^[!@#$"'%^&*()_+-/~?!@#¥%…&*()——+—?》《:“‘’]+$/, "pattern": /^[^[!@#$"'%^&*()_+-/~?!@#¥%…&*()——+—?》《:“‘’]+$/,
...@@ -324,8 +438,8 @@ ...@@ -324,8 +438,8 @@
// 内容模板 // 内容模板
categoryUrl: [{ categoryUrl: [{
"required": true, "required": true,
"message": "请选择内容模板" "message": "请选择内容模板"
}] }]
} }
}; };
}, },
...@@ -335,13 +449,12 @@ ...@@ -335,13 +449,12 @@
if (n == this.form.id) { if (n == this.form.id) {
//获取当前节点的父栏目 //获取当前节点的父栏目
let parentids = _this.form.parentids; let parentids = _this.form.parentids;
if (parentids) { if (parentids) {
let parentNode = parentids.split(','); let parentNode = parentids.split(',');
//获取最近的父节点 //获取最近的父节点
_this.form.categoryId = parentNode[parentNode.length - 1]; _this.form.categoryId = parentNode[parentNode.length - 1];
} } else {
else{
//无父栏目就恢复顶级 //无父栏目就恢复顶级
_this.form.categoryId = '0'; _this.form.categoryId = '0';
} }
...@@ -371,7 +484,7 @@ ...@@ -371,7 +484,7 @@
}, },
'form.categoryTitle': function (n) { 'form.categoryTitle': function (n) {
var regu = "[[!@'\"#$%^&*()_+-/~?!@#¥%…&*()——+—?》《:“‘’]"; var regu = "[[!@'\"#$%^&*()_+-/~?!@#¥%…&*()——+—?》《:“‘’]";
this.rules.categoryPinyin = [{ this.rules.categoryPinyin = [{
"validator": this.validatorCategoryPinyin, trigger: 'blur' "validator": this.validatorCategoryPinyin, trigger: 'blur'
}, { }, {
"pattern": /^[^[!@#$"'%^&*()_+-/~?!\\、@#¥%…&*()——+—?》《:“‘’\s]+$/, "pattern": /^[^[!@#$"'%^&*()_+-/~?!\\、@#¥%…&*()——+—?》《:“‘’\s]+$/,
...@@ -410,23 +523,37 @@ ...@@ -410,23 +523,37 @@
}, },
save: function () { save: function () {
var that = this; var that = this;
var model = undefined;
if (that.form.mdiyCategoryModelId && String(that.form.mdiyCategoryModelId)!="0"){
model = ms.mdiy.model.modelForm();
}
if (model && !model.validate()) {
this.activeName = 'custom-name';
return;
}
var url = ms.manager + "/cms/category/save.do"; var url = ms.manager + "/cms/category/save.do";
if (that.form.id > 0) { if (that.form.id > 0) {
url = ms.manager + "/cms/category/update.do"; url = ms.manager + "/cms/category/update.do";
} }
//若缩略图为空则赋值为空串 // element-ui需要数组结构
if (that.form.categoryImg.length == 0){ if (that.form.categoryImg.length == 0) {
that.form.categoryImg = ""; that.form.categoryImg = [];
}
// element-ui需要数组结构
if (that.form.categoryIco.length == 0) {
that.form.categoryIco = [];
} }
this.$refs.form.validate(function (valid) { this.$refs.form[0].validate(function (valid) {
if (valid) { if (valid) {
//栏目属性为封面则不需要列表模板 //栏目属性为封面则不需要列表模板
if (that.form.categoryType == '2') { if (that.form.categoryType == '2') {
that.form.categoryListUrl = ''; that.form.categoryListUrl = '';
} }
//栏目属性为链接则不需要列表和详情模板 //栏目属性为链接则不需要列表和详情模板
if(that.form.categoryType == '3'){ if (that.form.categoryType == '3') {
that.form.categoryListUrl = ''; that.form.categoryListUrl = '';
that.form.categoryUrl = ''; that.form.categoryUrl = '';
} }
...@@ -452,15 +579,21 @@ ...@@ -452,15 +579,21 @@
} }
data.categoryImg = JSON.stringify(data.categoryImg); data.categoryImg = JSON.stringify(data.categoryImg);
data.categoryIco = JSON.stringify(data.categoryIco);
ms.http.post(url, data).then(function (data) { ms.http.post(url, data).then(function (data) {
if (data.result) { if (data.result) {
//保存时需要赋值关联ID
if (model) {
model.form.linkId = data.data.id;
model.save();
}
that.$notify({ that.$notify({
title: '成功', title: '成功',
message: '保存成功', message: '保存成功',
type: 'success', type: 'success',
duration: 1000, duration: 1000,
onClose:function (){ onClose:function (){
location.href = ms.manager + "/cms/category/index.do"; ms.util.openSystemUrl("/cms/category/index.do");
} }
}); });
} else { } else {
...@@ -479,16 +612,39 @@ ...@@ -479,16 +612,39 @@
}); });
}, },
//获取分类内容模型 //获取分类内容模型
getColumnContentModelId: function () { queryColumnContentModelList: function () {
var that = this; var that = this;
ms.http.get(ms.manager + "/mdiy/model/list.do", { ms.http.get(ms.manager + "/mdiy/model/list.do", {
modelType: 'cms' modelType: 'cms'
}).then(function (data) { }).then(function (res) {
if(data.result){ if (res.result) {
that.mdiyModelIdOptions = data.data.rows; that.mdiyModelListOptions = res.data.rows;
} }
}); });
}, },
//获取栏目内容模型
queryCategoryModelList: function () {
var that = this;
ms.http.get(ms.manager + "/mdiy/model/list.do", {
modelType: 'category'
}).then(function (res) {
if (res.result) {
that.mdiyCategoryModelListOptions = res.data.rows;
}
});
},
//设置栏目模型
setCategoryModel: function (mdiyCategoryModelId) {
var that = this;
if (mdiyCategoryModelId) {
mdiyCategoryModelId += "";
if (mdiyCategoryModelId == "0") {
mdiyCategoryModelId = null;
}
that.form.mdiyCategoryModelId = mdiyCategoryModelId;
}
that.changeModel();
},
//获取当前分类 //获取当前分类
get: function (id) { get: function (id) {
var that = this; var that = this;
...@@ -508,22 +664,31 @@ ...@@ -508,22 +664,31 @@
} else { } else {
res.data.categoryImg = []; res.data.categoryImg = [];
} }
if (res.data.categoryIco) {
res.data.categoryIco = JSON.parse(res.data.categoryIco);
res.data.categoryIco.forEach(function (value) {
value.url = ms.base + value.path;
});
} else {
res.data.categoryIco = [];
}
if (!res.data.categoryId) { if (!res.data.categoryId) {
res.data.categoryId = '0'; res.data.categoryId = '0';
} }
var mdiyModelId = res.data.mdiyModelId; var mdiyCategoryModelId = res.data.mdiyCategoryModelId;
if (mdiyModelId) { if (mdiyCategoryModelId) {
mdiyModelId += ""; mdiyCategoryModelId += "";
if (mdiyModelId == "0") { if (mdiyCategoryModelId == "0") {
mdiyModelId = null; mdiyCategoryModelId = null;
} }
res.data.mdiyModelId = mdiyModelId; res.data.mdiyCategoryModelId = mdiyCategoryModelId;
} }
that.form = res.data; //判断该分类是否存在文章,存在则不能修改栏目属性 that.form = res.data; //判断该分类是否存在文章,存在则不能修改栏目属性
that.contentList(that.form.id); that.contentList(that.form.id);
that.changeModel();
} }
}); });
}, },
...@@ -532,7 +697,7 @@ ...@@ -532,7 +697,7 @@
ms.http.post(ms.manager + "/cms/content/list.do", { ms.http.post(ms.manager + "/cms/content/list.do", {
categoryId: id categoryId: id
}).then(function (data) { }).then(function (data) {
if(data.result){ if (data.result) {
if (data.data.total > 0) { if (data.data.total > 0) {
that.categoryTypeDisabled = true; that.categoryTypeDisabled = true;
} else { } else {
...@@ -562,7 +727,7 @@ ...@@ -562,7 +727,7 @@
dictType: '栏目属性', dictType: '栏目属性',
pageSize: 99999 pageSize: 99999
}).then(function (res) { }).then(function (res) {
if(res.result){ if (res.result) {
res = res.data; res = res.data;
that.categoryFlagOptions = res.rows; that.categoryFlagOptions = res.rows;
} }
...@@ -570,14 +735,14 @@ ...@@ -570,14 +735,14 @@
}, },
//categoryImg文件上传完成回调 //categoryImg文件上传完成回调
categoryImgSuccess: function (response, file, fileList) { categoryImgSuccess: function (response, file, fileList) {
if(response.result){ if (response.result) {
this.form.categoryImg.push({ this.form.categoryImg.push({
url: file.url, url: file.url,
name: file.name, name: file.name,
path: response.data, path: response.data,
uid: file.uid uid: file.uid
}); });
}else { } else {
this.$notify({ this.$notify({
title: '失败', title: '失败',
message: response.msg, message: response.msg,
...@@ -603,10 +768,82 @@ ...@@ -603,10 +768,82 @@
if (index != -1) { if (index != -1) {
this.form.categoryImg.splice(index, 1); this.form.categoryImg.splice(index, 1);
} }
} },
//categoryIco文件上传完成回调
categoryIcoSuccess: function (response, file, fileList) {
if (response.result) {
this.form.categoryIco.push({
url: file.url,
name: file.name,
path: response.data,
uid: file.uid
});
} else {
this.$notify({
title: '失败',
message: response.msg,
type: 'warning'
});
}
},
//上传超过限制
categoryIcohandleExceed: function (files, fileList) {
this.$notify({
title: '失败',
message: '当前最多上传1个文件',
type: 'warning'
});
},
categoryIcohandleRemove: function (file, files) {
var index = -1;
index = this.form.categoryIco.findIndex(function (text) {
return text == file;
});
if (index != -1) {
this.form.categoryIco.splice(index, 1);
}
},
removeModel: function () {
var that = this;
var model = document.getElementById('model1');
var custom = document.getElementById('c_model');
if (custom) {
model.removeChild(custom);
}
that.model = undefined;
},
categoryChange: function () {
this.changeModel();
},
changeModel: function () {
var that = this;
that.editableTabs = [that.editableTabs[0]];
if (that.form) {
if (that.form.mdiyCategoryModelId) {
that.rederModel(that.form.mdiyCategoryModelId)
}
}
},
rederModel: function (modelId) {
var that = this;
that.editableTabs.push({
title: '',
name: 'custom-name'
});
ms.mdiy.model.extend("model1", {id: modelId}, {linkId: that.form.id}, true).then(function (obj) {
that.model = obj;
that.editableTabs[1].title = obj.modelName
});
},
}, },
created: function () { created: function () {
this.getColumnContentModelId(); this.queryColumnContentModelList();
this.queryCategoryModelList();
this.getTree(); this.getTree();
this.categoryListUrlOptionsGet(); this.categoryListUrlOptionsGet();
this.categoryUrlOptionsGet(); this.categoryUrlOptionsGet();
...@@ -616,7 +853,7 @@ ...@@ -616,7 +853,7 @@
this.form.categoryId = '0'; this.form.categoryId = '0';
// 判断三种状态,默认为新增状态 // 判断三种状态,默认为新增状态
this.categoryTypeDisabled = false;// 控制栏目分类是否可编辑 this.categoryTypeDisabled = false;// 控制栏目分类是否可编辑
if (this.form.id != undefined && (this.form.childId == undefined || this.form.childId == "undefined")) { if (this.form.id != undefined && (this.form.childId == undefined || this.form.childId == "undefined")) {
// 切换编辑状态,id不为空 childId 为空 // 切换编辑状态,id不为空 childId 为空
this.categoryTypeDisabled = true; this.categoryTypeDisabled = true;
this.get(this.form.id); this.get(this.form.id);
......
...@@ -333,9 +333,11 @@ ...@@ -333,9 +333,11 @@
//新增 //新增
save: function (id, childId) { save: function (id, childId) {
if (id) { if (id) {
location.href = this.manager + "/cms/category/form.do?id=" + id + "&childId=" + childId; // location.href = this.manager + "/cms/category/form.do?id=" + id + "&childId=" + childId;
ms.util.openSystemUrl("/cms/category/form.do?id=" + id + "&childId=" + childId);
} else { } else {
location.href = this.manager + "/cms/category/form.do"; // location.href = this.manager + "/cms/category/form.do";
ms.util.openSystemUrl("/cms/category/form.do");
} }
}, },
//重置表单 //重置表单
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment