Merge remote-tracking branch 'origin/master'

This commit is contained in:
不期而遇 2021-05-22 11:11:52 +08:00
commit 3865ba6cfb
8 changed files with 267 additions and 278 deletions

View File

@ -25,7 +25,7 @@
<p align="center">
<a href="https://www.mingsoft.net" target="_blank">铭飞平台</a>
<a href="http://cms.demo.mingsoft.net/ms/login.do" target="_blank">在线演示</a>
<a href="http://doc.mingsoft.net/plugs-cms/" target="_blank">在线使用手册</a>
<a href="http://doc.mingsoft.net/mcms/" target="_blank">在线使用手册</a>
<a href="https://mingsoft.ke.qq.com/?tuin=383187f3#tab=1&category=-1" target="_blank">腾讯课堂在线视频</a><br/>
<a href="https://ke.qq.com/course/3026403" target="_blank">代码生成器视频教程</a><br/>
<a href="https://cloud.189.cn/t/I3maM3uURjmm" target="_blank">Windows一键运行版本\Linux一键运行版本</a>
@ -90,7 +90,7 @@ git clone https://gitee.com/mingSoft/MCMS.git<br/>
5、创建数据库db-mcms-open数据库使用utf-8编码导入doc/mcms-版本号.sql如果升级现有系统请使用-up-*.sql升级如果导入了系统对应的完整版SQLsql升级补丁不需要重复导入<br/>
6、修改src\main\resources\application-dev.yml文件中的数据库设置参数<br/>
7、运行MSApplication.java main方法<br/>
8、首先先访问后台地址http://ip|域名/项目发布名/ms/login.do管理员账号用户名msopen 密码msopen进入后台点击内容管理->静态化菜单,进行"生成主页""生成栏目","生成文章"操作一遍 (注意!!!是后台登录界面,不是会员中心登录界面)
8、首先先访问后台地址http://localhost:8080/ms/login.do管理员账号用户名msopen 密码msopen进入后台点击内容管理->静态化菜单,进行"生成主页""生成栏目","生成文章"操作一遍 (注意!!!是后台登录界面,不是会员中心登录界面)
# 技术选型
@ -152,7 +152,7 @@ git clone https://gitee.com/mingSoft/MCMS.git<br/>
# 文档
* 使用手册 http://doc.mingsoft.net/plugs-cms/
* 使用手册 http://doc.mingsoft.net/mcms/
# 软件截图

View File

@ -33,3 +33,5 @@ UPDATE `mdiy_tag_sql` SET `tag_id` = 7, `tag_sql` = 'SELECT\ncms_content.id as i
UPDATE `mdiy_tag_sql` SET `tag_id` = 8, `tag_sql` = '<#assign select=\"(SELECT \'\')\"/>\n<#if orderby?? >\n <#if orderby==\"date\">\n <#assign _orderby=\"content_datetime\">\n <#elseif orderby==\"updatedate\">\n <#assign _orderby=\"content_updatetime\">\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\ncms_content.id as id,\nleft(content_title,${titlelen?default(40)}) as title,\ncontent_title as fulltitle,\ncontent_author as author, \ncontent_source as source, \ncontent_details as content,\ncategory.category_title as typename,\ncategory.category_id as typeid,\n(SELECT \'index.html\') as typelink,\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 CONCAT(category_path,\'/\',cms_content.id,\'.html\') AS \"link\",\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\nLEFT 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 FROM cms_content\n</#if>', `sort` = NULL, `UPDATE_BY` = NULL, `UPDATE_DATE` = NULL, `CREATE_BY` = NULL, `CREATE_DATE` = NULL, `DEL` = 0 WHERE `id` = 9;
UPDATE `mdiy_tag_sql` SET `tag_id` = 9, `tag_sql` = 'select\n<#if !(pageTag.indexUrl??)>\n <#--判断是否有栏目对象,用于搜索不传栏目-->\n <#if column??>\n <#assign path=column.categoryPath/>\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 CONCAT(\'${path}\', \'/index.html\') as \"index\",\n <#--上一页-->\n <#if (pageTag.pageNo?eval-1) gt 1>\n CONCAT(\'${path}\',\'/list-${pageTag.pageNo?eval-1}.html\') as \"pre\",\n <#else>\n CONCAT(\'${path}\',\'/index.html\') as \"pre\",\n </#if>\n\n <#--下一页-->\n <#if pageTag.total==1>\n CONCAT(\'${path}\', \'/index.html\') as \"next\",\n CONCAT(\'${path}\', \'/index.html\') as \"last\"\n <#else>\n <#if pageTag.pageNo?eval gte pageTag.total>\n CONCAT(\'${path}\',\'/list-${pageTag.total}.html\') as \"next\",\n <#else>\n CONCAT(\'${path}\',\'/list-${pageTag.pageNo?eval+1}.html\') as \"next\",\n </#if>\n <#--最后一页-->\n CONCAT(\'${path}\',\'/list-${pageTag.total}.html\') as \"last\"\n </#if>\n\n<#else>\n <#--判断是否是搜索页面-->\n \'${pageTag.indexUrl}\' as \"index\",\n \'${pageTag.lastUrl}\' as \"last\",\n \'${pageTag.preUrl}\' as \"pre\",\n \'${pageTag.nextUrl}\' as \"next\",\n \'${pageTag.total}\' as \"total\",\n \'${pageTag.size}\' as \"size\",\n \'${pageTag.rcount}\' as \"rcount\",\n \'${pageTag.pageNo}\' as \"cur\"\n</#if>', `sort` = NULL, `UPDATE_BY` = NULL, `UPDATE_DATE` = NULL, `CREATE_BY` = NULL, `CREATE_DATE` = NULL, `DEL` = 0 WHERE `id` = 10;
UPDATE `mdiy_tag_sql` SET `tag_id` = 10, `tag_sql` = '<#assign select=\"(SELECT \'\')\"/>\n<#if orderby?? >\n <#if orderby==\"date\">\n <#assign _orderby=\"content_datetime\">\n <#elseif orderby==\"updatedate\">\n <#assign _orderby=\"content_updatetime\">\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,\nleft(content_title,${titlelen?default(40)}) as title,\ncontent_title as fulltitle,\ncontent_author as author, \ncontent_source as source, \ncontent_details as content,\ncategory.category_title as typename,\ncategory.category_id as typeid,\n(SELECT \'index.html\') as typelink,\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 CONCAT(category_path,\'/\',cms_content.id,\'.html\') AS \"link\",\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\nLEFT 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 FROM cms_content\n</#if>', `sort` = NULL, `UPDATE_BY` = NULL, `UPDATE_DATE` = NULL, `CREATE_BY` = NULL, `CREATE_DATE` = NULL, `DEL` = 0 WHERE `id` = 11;
ALTER TABLE `cms_content` MODIFY COLUMN `content_display` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '是否显示0显示 1不显示';

File diff suppressed because one or more lines are too long

View File

@ -44,7 +44,6 @@
<groupId>net.mingsoft</groupId>
<artifactId>ms-base</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>net.mingsoft</groupId>
@ -60,6 +59,7 @@
<groupId>net.mingsoft</groupId>
<artifactId>store-client</artifactId>
<version>2.1.0</version>
</dependency>
</dependencies>

View File

@ -1,22 +0,0 @@
package net.mingsoft.cms.action.web;
import net.mingsoft.base.action.BaseAction;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Controller()
@RequestMapping("/")
public class ServerAction extends BaseAction {
@ResponseBody
@GetMapping("/server.do")
public String list(HttpServletRequest req, HttpServletResponse resp) {
LOG.debug("心跳");
return "";
}
}

View File

@ -7,10 +7,10 @@
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* <p>
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* <p>
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
@ -48,8 +48,8 @@ import java.util.List;
* 创建日期2019-11-28 15:12:32<br/>
* 历史修订<br/>
*/
@Service("cmscategoryBizImpl")
@Transactional(rollbackFor = RuntimeException.class)
@Service("cmscategoryBizImpl")
@Transactional(rollbackFor = RuntimeException.class)
public class CategoryBizImpl extends BaseBizImpl<ICategoryDao, CategoryEntity> implements ICategoryBiz {
@ -71,6 +71,7 @@ public class CategoryBizImpl extends BaseBizImpl<ICategoryDao, CategoryEntity> i
// TODO Auto-generated method stub
return categoryDao.queryChildren(category);
}
@Override
public void saveEntity(CategoryEntity categoryEntity) {
// TODO Auto-generated method stub
@ -79,16 +80,16 @@ public class CategoryBizImpl extends BaseBizImpl<ICategoryDao, CategoryEntity> i
if (StrUtil.isNotBlank(categoryEntity.getCategoryPinyin())) {
pingYin = categoryEntity.getCategoryPinyin();
}
CategoryEntity category=new CategoryEntity();
CategoryEntity category = new CategoryEntity();
category.setCategoryPinyin(pingYin);
Object categoryBizEntity = getEntity(category);
setParentId(categoryEntity);
categoryEntity.setCategoryPinyin(pingYin);
//更新新的父级
if(StrUtil.isNotBlank(categoryEntity.getCategoryId())&&!"0".equals(categoryEntity.getCategoryId())){
if (StrUtil.isNotBlank(categoryEntity.getCategoryId()) && !"0".equals(categoryEntity.getCategoryId())) {
CategoryEntity parent = getById(categoryEntity.getCategoryId());
//如果之前是叶子节点就更新
if(parent.getLeaf()){
if (parent.getLeaf()) {
parent.setLeaf(false);
updateById(parent);
}
@ -100,54 +101,55 @@ public class CategoryBizImpl extends BaseBizImpl<ICategoryDao, CategoryEntity> i
}
super.save(categoryEntity);
//拼音存在则拼接id
if(categoryBizEntity!=null){
categoryEntity.setCategoryPinyin(pingYin+categoryEntity.getId());
if (categoryBizEntity != null) {
categoryEntity.setCategoryPinyin(pingYin + categoryEntity.getId());
}
CategoryEntity parentCategory = null;
if (StringUtils.isNotBlank(categoryEntity.getCategoryId())) {
parentCategory = (CategoryEntity)getById(categoryEntity.getCategoryId());
parentCategory = (CategoryEntity) getById(categoryEntity.getCategoryId());
}
//保存链接地址
String path=ObjectUtil.isNotNull(parentCategory)?parentCategory.getCategoryPath():"";
categoryEntity.setCategoryPath( path+"/" + categoryEntity.getCategoryPinyin());
String path = ObjectUtil.isNotNull(parentCategory) ? parentCategory.getCategoryPath() : "";
categoryEntity.setCategoryPath(path + "/" + categoryEntity.getCategoryPinyin());
setTopId(categoryEntity);
super.updateById(categoryEntity);
}
private void setParentId(CategoryEntity categoryEntity) {
String path = "";
if(StringUtils.isNotEmpty(categoryEntity.getCategoryId())&&Long.parseLong(categoryEntity.getCategoryId())>0) {
CategoryEntity category = (CategoryEntity)getById(categoryEntity.getCategoryId());
if (StringUtils.isNotEmpty(categoryEntity.getCategoryId()) && Long.parseLong(categoryEntity.getCategoryId()) > 0) {
CategoryEntity category = (CategoryEntity) getById(categoryEntity.getCategoryId());
path = category.getCategoryPath();
if(StringUtils.isEmpty(category.getCategoryParentIds())) {
if (StringUtils.isEmpty(category.getCategoryParentIds())) {
categoryEntity.setCategoryParentIds(category.getId());
} else {
categoryEntity.setCategoryParentIds(category.getCategoryParentIds()+","+category.getId());
categoryEntity.setCategoryParentIds(category.getCategoryParentIds() + "," + category.getId());
}
}else {
} else {
categoryEntity.setCategoryParentIds(null);
}
//保存时先保存再修改链接地址修改时直接修改
if(StringUtils.isNotBlank(categoryEntity.getId())) {
categoryEntity.setCategoryPath(path+ "/" + categoryEntity.getCategoryPinyin());
if (StringUtils.isNotBlank(categoryEntity.getId())) {
categoryEntity.setCategoryPath(path + "/" + categoryEntity.getCategoryPinyin());
}
}
private void setChildParentId(CategoryEntity categoryEntity, String topId) {
CategoryEntity category=new CategoryEntity();
CategoryEntity category = new CategoryEntity();
category.setCategoryId(categoryEntity.getId());
List<CategoryEntity> list = categoryDao.query(category);
list.forEach(x->{
if(StringUtils.isEmpty(categoryEntity.getCategoryParentIds())) {
list.forEach(x -> {
if (StringUtils.isEmpty(categoryEntity.getCategoryParentIds())) {
x.setCategoryParentIds(categoryEntity.getId());
} else {
x.setCategoryParentIds(categoryEntity.getCategoryParentIds()+","+categoryEntity.getId());
x.setCategoryParentIds(categoryEntity.getCategoryParentIds() + "," + categoryEntity.getId());
}
//更新topid
x.setTopId(topId);
String path=categoryEntity.getCategoryPath();
String path = categoryEntity.getCategoryPath();
//判断是否有parentIds
x.setCategoryPath(path+"/"+x.getCategoryPinyin());
x.setCategoryPath(path + "/" + x.getCategoryPinyin());
//去除多余的/符号
super.updateEntity(x);
setChildParentId(x, topId);
@ -157,14 +159,14 @@ public class CategoryBizImpl extends BaseBizImpl<ICategoryDao, CategoryEntity> i
@Override
public void updateEntity(CategoryEntity entity) {
setParentId(entity);
String pingYin =entity.getCategoryPinyin();
if(StrUtil.isNotBlank(pingYin)){
CategoryEntity category=new CategoryEntity();
String pingYin = entity.getCategoryPinyin();
if (StrUtil.isNotBlank(pingYin)) {
CategoryEntity category = new CategoryEntity();
category.setCategoryPinyin(pingYin);
CategoryEntity categoryBizEntity = (CategoryEntity)getEntity(category);
CategoryEntity categoryBizEntity = (CategoryEntity) getEntity(category);
//拼音存在则拼接id
if(categoryBizEntity!=null&&!categoryBizEntity.getId().equals(entity.getId())){
entity.setCategoryPinyin(pingYin+entity.getId());
if (categoryBizEntity != null && !categoryBizEntity.getId().equals(entity.getId())) {
entity.setCategoryPinyin(pingYin + entity.getId());
}
}
setParentLeaf(entity);
@ -197,11 +199,11 @@ public class CategoryBizImpl extends BaseBizImpl<ICategoryDao, CategoryEntity> i
// TODO Auto-generated method stub
CategoryEntity category = (CategoryEntity) categoryDao.selectById(categoryId);
//删除父类
if(category != null){
if (category != null) {
category.setCategoryParentIds(null);
List<CategoryEntity> childrenList = categoryDao.queryChildren(category);
List<String> ids = new ArrayList<>();
for(int i = 0; i < childrenList.size(); i++){
for (int i = 0; i < childrenList.size(); i++) {
//删除子类
ids.add(childrenList.get(i).getId());
}
@ -215,46 +217,46 @@ public class CategoryBizImpl extends BaseBizImpl<ICategoryDao, CategoryEntity> i
List<CategoryEntity> childNode = categoryDao.queryChildren(parentNode);
//判断删除的是否为主节点
if (parentNode != null) {
//清空CategoryParentIds,避免查找不必要的数据只需要当前的父级栏目
parentNode.setCategoryParentIds(null);
UpdateWrapper<CategoryEntity> updateWrapper = new UpdateWrapper<>();
//是否还有子节点
if (childNode.size() > 1)
updateWrapper.eq("id", parentNode.getId()).set("leaf", 0);
else
//如果没有子节点进行更新代码
if (childNode.size() == 1) {
updateWrapper.eq("id", parentNode.getId()).set("leaf", 1);
categoryDao.update(null, updateWrapper);
}
}
}
}
/**
* 设置父级叶子节点
* @param entity
*/
private void setParentLeaf(CategoryEntity entity){
private void setParentLeaf(CategoryEntity entity) {
CategoryEntity categoryEntity = getById(entity.getId());
//如果父级不为空并且修改了父级则需要更新父级
if(entity.getCategoryId() != null && !entity.getCategoryId().equals(categoryEntity.getCategoryId())){
if (entity.getCategoryId() != null && !entity.getCategoryId().equals(categoryEntity.getCategoryId())) {
//更新旧的父级
if(StrUtil.isNotBlank(categoryEntity.getCategoryId())&&!"0".equals(categoryEntity.getCategoryId())){
if (StrUtil.isNotBlank(categoryEntity.getCategoryId()) && !"0".equals(categoryEntity.getCategoryId())) {
CategoryEntity parent = getById(categoryEntity.getCategoryId());
//如果修改了父级则需要判断父级是否还有子节点
boolean leaf = parent.getLeaf();
//查找不等于当前更新的分类子集有则不是叶子节点
QueryWrapper<CategoryEntity> queryWrapper = new QueryWrapper<>();
parent.setLeaf(count(queryWrapper.eq("category_id",parent.getId()).ne("id",entity.getId()))==0);
if(leaf!=parent.getLeaf()){
parent.setLeaf(count(queryWrapper.eq("category_id", parent.getId()).ne("id", entity.getId())) == 0);
if (leaf != parent.getLeaf()) {
updateById(parent);
}
}
//更新新的父级
if(StrUtil.isNotBlank(entity.getCategoryId())&&!"0".equals(entity.getCategoryId())){
if (StrUtil.isNotBlank(entity.getCategoryId()) && !"0".equals(entity.getCategoryId())) {
CategoryEntity parent = getById(entity.getCategoryId());
//如果之前是叶子节点就更新
if(parent.getLeaf()){
if (parent.getLeaf()) {
parent.setLeaf(false);
updateById(parent);
}
@ -266,12 +268,12 @@ public class CategoryBizImpl extends BaseBizImpl<ICategoryDao, CategoryEntity> i
* 设置顶级id
* @param entity
*/
private void setTopId(CategoryEntity entity){
private void setTopId(CategoryEntity entity) {
String categoryParentId = entity.getCategoryParentIds();
if(StrUtil.isNotBlank(categoryParentId)){
if (StrUtil.isNotBlank(categoryParentId)) {
String[] ids = categoryParentId.split(",");
//如果有ParentId就取第一个
if(ids.length>0){
if (ids.length > 0) {
entity.setTopId(ids[0]);
return;
}

View File

@ -98,6 +98,8 @@ public class CategoryEntity extends BaseEntity {
* 缩略图
*/
private String categoryImg;
/**
* 自定义链接
*/
@ -452,4 +454,5 @@ public class CategoryEntity extends BaseEntity {
public String getTypelitpic() {
return categoryImg;
}
}

View File

@ -12,6 +12,8 @@ logging:
name: mcms.log #会在项目的根目录下生成对应的mcms.log文件也可以根据实际情况写绝对路径例如d:/mcms.log
path: log #会在项目的根目录下生成log目录里面会生成对应的日期目录日期目录下面生成日志压缩包备份文件,默认按每10M分割一个日志文件例如log/2020-01/app-2020-01-03-18.1.log.gz表示2020年1月3号下午六点的第一个备份也可以根据实际情况写绝对路径例如d:/log
ms:
mstore-url: http://store.i.mingsoft.net
mstore-host: store.i.mingsoft.net
diy:
html-dir: html
# scheme: https #解决使用代理服务器代理应用时标签解析域名依旧为http的问题