Commit 0542acde authored by guwd's avatar guwd
Browse files

5.2.0

parent d91c0e4a
......@@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.mingsoft</groupId>
<artifactId>ms-mcms</artifactId>
<version>5.2-SNAPSHOT</version>
<version>5.2.0-SNAPSHOT</version>
<name>ms-mcms</name>
<!-- 打包jar包 -->
<packaging>jar</packaging>
......
package net.mingsoft.cms.action;
import java.util.MissingResourceException;
/**
* @Author: 铭飞开源团队--huise
* @Date: 2019/8/9 20:47
*/
public class BaseAction extends net.mingsoft.mdiy.action.BaseAction{
@Override
protected String getResString(String key) {
// TODO Auto-generated method stub
String str = "";
try {
str = super.getResString(key);
} catch (MissingResourceException e) {
str = getLocaleString(key,net.mingsoft.cms.constant.Const.RESOURCES);
}
return str;
}
}
package net.mingsoft.cms.action;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import net.mingsoft.base.entity.BaseEntity;
import net.mingsoft.base.entity.ResultData;
import net.mingsoft.basic.annotation.LogAnn;
import net.mingsoft.basic.bean.EUListBean;
import net.mingsoft.basic.constant.e.BusinessTypeEnum;
import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.basic.util.PinYinUtil;
import net.mingsoft.basic.util.StringUtil;
import net.mingsoft.cms.biz.ICategoryBiz;
import net.mingsoft.cms.entity.CategoryEntity;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 分类管理控制层
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
@Api(value = "分类接口")
@Controller("cmsCategoryAction")
@RequestMapping("/${ms.manager.path}/cms/category")
public class CategoryAction extends BaseAction {
/**
* 注入分类业务层
*/
@Autowired
private ICategoryBiz categoryBiz;
/**
* 返回主界面index
*/
@GetMapping("/index")
public String index(HttpServletResponse response,HttpServletRequest request){
return "/cms/category/index";
}
/**
* 查询分类列表
* @param category 分类实体
*/
@ApiOperation(value = "查询分类列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "categoryTitle", value = "栏目管理名称", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryId", value = "所属栏目", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryType", value = "栏目管理属性", required =false,paramType="query"),
@ApiImplicitParam(name = "categorySort", value = "自定义顺序", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryListUrl", value = "列表模板", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryUrl", value = "内容模板", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryKeyword", value = "栏目管理关键字", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryDescrip", value = "栏目管理描述", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryImg", value = "缩略图", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryDiyUrl", value = "自定义链接", required =false,paramType="query"),
@ApiImplicitParam(name = "mdiyModelId", value = "栏目管理的内容模型id", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryDatetime", value = "类别发布时间", required =false,paramType="query"),
@ApiImplicitParam(name = "dictId", value = "字典对应编号", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryFlag", value = "栏目属性", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryPath", value = "栏目路径", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryParentId", value = "父类型编号", required =false,paramType="query"),
@ApiImplicitParam(name = "createBy", value = "创建人", required =false,paramType="query"),
@ApiImplicitParam(name = "createDate", value = "创建时间", required =false,paramType="query"),
@ApiImplicitParam(name = "updateBy", value = "修改人", required =false,paramType="query"),
@ApiImplicitParam(name = "updateDate", value = "修改时间", required =false,paramType="query"),
@ApiImplicitParam(name = "del", value = "删除标记", required =false,paramType="query"),
@ApiImplicitParam(name = "id", value = "编号", required =false,paramType="query"),
})
@RequestMapping("/list")
@ResponseBody
public ResultData list(@ModelAttribute @ApiIgnore CategoryEntity category, HttpServletResponse response, HttpServletRequest request, @ApiIgnore ModelMap model, BindingResult result) {
BasicUtil.startPage();
List categoryList = categoryBiz.query(category);
return ResultData.build().success(new EUListBean(categoryList,(int) BasicUtil.endPage(categoryList).getTotal()));
}
/**
* 返回编辑界面category_form
*/
@GetMapping("/form")
public String form(@ModelAttribute CategoryEntity category, HttpServletResponse response, HttpServletRequest request, ModelMap model){
model.addAttribute("appId", BasicUtil.getApp().getAppId());
return "/cms/category/form";
}
/**
* 获取分类
* @param category 分类实体
*/
@ApiOperation(value = "获取分类列表接口")
@ApiImplicitParam(name = "id", value = "编号", required =true,paramType="query")
@GetMapping("/get")
@ResponseBody
public ResultData get(@ModelAttribute @ApiIgnore CategoryEntity category, HttpServletResponse response, HttpServletRequest request, @ApiIgnore ModelMap model){
if(category.getId()==null) {
return ResultData.build().error();
}
CategoryEntity _category = (CategoryEntity)categoryBiz.getById(category.getId());
return ResultData.build().success(_category);
}
@ApiOperation(value = "保存分类列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "categoryTitle", value = "栏目管理名称", required =true,paramType="query"),
@ApiImplicitParam(name = "categoryId", value = "所属栏目", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryType", value = "栏目管理属性", required =false,paramType="query"),
@ApiImplicitParam(name = "categorySort", value = "自定义顺序", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryListUrl", value = "列表模板", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryUrl", value = "内容模板", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryKeyword", value = "栏目管理关键字", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryDescrip", value = "栏目管理描述", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryImg", value = "缩略图", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryDiyUrl", value = "自定义链接", required =false,paramType="query"),
@ApiImplicitParam(name = "mdiyModelId", value = "栏目管理的内容模型id", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryDatetime", value = "类别发布时间", required =false,paramType="query"),
@ApiImplicitParam(name = "dictId", value = "字典对应编号", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryFlag", value = "栏目属性", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryPath", value = "栏目路径", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryParentId", value = "父类型编号", required =false,paramType="query"),
@ApiImplicitParam(name = "createBy", value = "创建人", required =false,paramType="query"),
@ApiImplicitParam(name = "createDate", value = "创建时间", required =false,paramType="query"),
@ApiImplicitParam(name = "updateBy", value = "修改人", required =false,paramType="query"),
@ApiImplicitParam(name = "updateDate", value = "修改时间", required =false,paramType="query"),
@ApiImplicitParam(name = "del", value = "删除标记", required =false,paramType="query"),
@ApiImplicitParam(name = "id", value = "编号", required =false,paramType="query"),
})
/**
* 保存分类
* @param category 分类实体
*/
@PostMapping("/save")
@ResponseBody
@LogAnn(title = "保存分类", businessType = BusinessTypeEnum.INSERT)
@RequiresPermissions("cms:category:save")
public ResultData save(@ModelAttribute @ApiIgnore CategoryEntity category, HttpServletResponse response, HttpServletRequest request) {
//验证栏目管理名称的值是否合法
if(StringUtil.isBlank(category.getCategoryTitle())){
return ResultData.build().error(getResString("err.empty", this.getResString("category.title")));
}
if(!StringUtil.checkLength(category.getCategoryTitle()+"", 1, 100)){
return ResultData.build().error(getResString("err.length", this.getResString("category.title"), "1", "100"));
}
if(!StringUtil.checkLength(category.getCategoryPath()+"", 1, 100)){
return ResultData.build().error(getResString("err.length", this.getResString("category.path"), "1", "100"));
}
if(!StringUtil.checkLength(category.getCategoryParentIds()+"", 1, 100)){
return ResultData.build().error(getResString("err.length", this.getResString("category.parent.id"), "1", "100"));
}
//判断拼音是否重复
if(StrUtil.isNotBlank(category.getCategoryPinyin())) {
CategoryEntity _category = new CategoryEntity();
_category.setCategoryPinyin(category.getCategoryPinyin());
List<CategoryEntity> query = categoryBiz.query(_category);
if (query.size() > 0) {
return ResultData.build().error(getResString("err.exist", this.getResString("category.pinyin")));
}
}
categoryBiz.saveEntity(category);
return ResultData.build().success(category);
}
/**
* @param categorys 分类实体
*/
@ApiOperation(value = "批量删除分类列表接口")
@PostMapping("/delete")
@ResponseBody
@LogAnn(title = "删除分类", businessType = BusinessTypeEnum.DELETE)
@RequiresPermissions("cms:category:del")
public ResultData delete(@RequestBody List<CategoryEntity> categorys, HttpServletResponse response, HttpServletRequest request) {
for(int i = 0;i<categorys.size();i++){
categoryBiz.delete(categorys.get(i).getId());
}
return ResultData.build().success();
}
/**
* 更新分类列表
* @param category 分类实体
*/
@ApiOperation(value = "更新分类列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "编号", required =true,paramType="query"),
@ApiImplicitParam(name = "categoryTitle", value = "栏目管理名称", required =true,paramType="query"),
@ApiImplicitParam(name = "categoryId", value = "所属栏目", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryType", value = "栏目管理属性", required =false,paramType="query"),
@ApiImplicitParam(name = "categorySort", value = "自定义顺序", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryListUrl", value = "列表模板", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryUrl", value = "内容模板", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryKeyword", value = "栏目管理关键字", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryDescrip", value = "栏目管理描述", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryImg", value = "缩略图", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryDiyUrl", value = "自定义链接", required =false,paramType="query"),
@ApiImplicitParam(name = "mdiyModelId", value = "栏目管理的内容模型id", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryDatetime", value = "类别发布时间", required =false,paramType="query"),
@ApiImplicitParam(name = "dictId", value = "字典对应编号", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryFlag", value = "栏目属性", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryPath", value = "栏目路径", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryParentId", value = "父类型编号", required =false,paramType="query"),
@ApiImplicitParam(name = "createBy", value = "创建人", required =false,paramType="query"),
@ApiImplicitParam(name = "createDate", value = "创建时间", required =false,paramType="query"),
@ApiImplicitParam(name = "updateBy", value = "修改人", required =false,paramType="query"),
@ApiImplicitParam(name = "updateDate", value = "修改时间", required =false,paramType="query"),
@ApiImplicitParam(name = "del", value = "删除标记", required =false,paramType="query"),
@ApiImplicitParam(name = "id", value = "编号", required =false,paramType="query"),
})
@PostMapping("/update")
@ResponseBody
@LogAnn(title = "更新分类", businessType = BusinessTypeEnum.UPDATE)
@RequiresPermissions("cms:category:update")
public ResultData update(@ModelAttribute @ApiIgnore CategoryEntity category, HttpServletResponse response,
HttpServletRequest request) {
//验证栏目管理名称的值是否合法
if(StringUtil.isBlank(category.getCategoryTitle())){
return ResultData.build().error(getResString("err.empty", this.getResString("category.title")));
}
if(!StringUtil.checkLength(category.getCategoryTitle()+"", 1, 100)){
return ResultData.build().error(getResString("err.length", this.getResString("category.title"), "1", "100"));
}
if(!StringUtil.checkLength(category.getCategoryPath()+"", 0, 100)){
return ResultData.build().error(getResString("err.length", this.getResString("category.path"), "1", "100"));
}
if(!StringUtil.checkLength(category.getCategoryParentIds()+"", 0, 100)){
return ResultData.build().error(getResString("err.length", this.getResString("category.parent.id"), "1", "100"));
}
//判断拼音是否重复并且是否和原拼音相同
if(StrUtil.isNotBlank(category.getCategoryPinyin()) && !categoryBiz.getById(category.getId()).getCategoryPinyin().equals(category.getCategoryPinyin())) {
CategoryEntity _category = new CategoryEntity();
_category.setCategoryPinyin(category.getCategoryPinyin());
List<CategoryEntity> query = categoryBiz.query(_category);
if (query.size() > 0) {
return ResultData.build().error(getResString("err.exist", this.getResString("category.pinyin")));
}
}
String pingYin = PinYinUtil.getPingYin(category.getCategoryTitle());
//如果用户填写了拼音则使用用户填写的
if (StrUtil.isNotBlank(category.getCategoryPinyin())) {
pingYin = category.getCategoryPinyin();
}
CategoryEntity categoryEntity=new CategoryEntity();
categoryEntity.setCategoryPinyin(pingYin);
CategoryEntity categoryBizEntity = (CategoryEntity)categoryBiz.getEntity(categoryEntity);
category.setCategoryPinyin(pingYin);
//如果存在此拼音栏目则拼接上id
if(categoryBizEntity!=null&&!categoryBizEntity.getId().equals(category.getId())){
category.setCategoryPinyin(pingYin+category.getId());
}
//判断是否选择子级为所属栏目
CategoryEntity _category = new CategoryEntity();
_category.setCategoryParentIds(category.getId());
List<CategoryEntity> categoryList = categoryBiz.queryChilds(_category);
for(CategoryEntity item:categoryList){
if(item.getId().equals(category.getCategoryId())){
return ResultData.build().error(getResString("cannot.select.child"));
}
}
categoryBiz.updateEntity(category);
return ResultData.build().success(category);
}
@ApiOperation(value = "验证拼音")
@GetMapping("/verifyPingYin")
@ResponseBody
public ResultData verifyPingYin(@ModelAttribute @ApiIgnore CategoryEntity category, HttpServletResponse response, HttpServletRequest request, @ApiIgnore ModelMap model){
int count = categoryBiz.count(Wrappers.<CategoryEntity>lambdaQuery()
.ne(StrUtil.isNotBlank(category.getId()), CategoryEntity::getId, category.getId())
.eq(CategoryEntity::getCategoryPinyin, category.getCategoryPinyin()));
if(count>0){
return ResultData.build().error("存在相同拼音的栏目");
}
return ResultData.build().success();
}
@ApiOperation(value = "批量更新模版")
@GetMapping("/updateTemplate")
@ResponseBody
@RequiresPermissions("cms:category:update")
public ResultData updateTemplate(@ModelAttribute @ApiIgnore CategoryEntity category){
if (category ==null || StringUtils.isEmpty(category.getId())) {
return ResultData.build().error(getResString("err.error", this.getResString("id")));
}
category = categoryBiz.getById(category.getId());
category.setCategoryParentIds(null);
List<CategoryEntity> childs = categoryBiz.queryChilds(category);
//更新与父节点相同类型的子栏目的模板内容
for (int i =0; i < childs.size(); i++) {
if (childs.get(i).getCategoryType().equals(category.getCategoryType())) {
childs.get(i).setCategoryUrl(category.getCategoryUrl());
childs.get(i).setCategoryListUrl(category.getCategoryListUrl());
categoryBiz.updateEntity(childs.get(i));
}
}
return ResultData.build().success();
}
@ApiOperation(value = "复制栏目")
@GetMapping("/copyCategory")
@ResponseBody
@RequiresPermissions("cms:category:save")
public ResultData copyCategory(@ModelAttribute @ApiIgnore CategoryEntity category){
if (category == null || StringUtils.isEmpty(category.getId())) {
return ResultData.build().error(getResString("err.error", this.getResString("id")));
}
categoryBiz.copyCategory(category);
return ResultData.build().success();
}
}
package net.mingsoft.cms.action;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import net.mingsoft.base.entity.ResultData;
import net.mingsoft.basic.annotation.LogAnn;
import net.mingsoft.basic.bean.EUListBean;
import net.mingsoft.basic.constant.e.BusinessTypeEnum;
import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.basic.util.StringUtil;
import net.mingsoft.cms.biz.IContentBiz;
import net.mingsoft.cms.entity.ContentEntity;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
/**
* 文章管理控制层
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
@Api(value = "文章接口")
@Controller("cmsContentAction")
@RequestMapping("/${ms.manager.path}/cms/content")
public class ContentAction extends BaseAction {
/**
* 注入文章业务层
*/
@Autowired
private IContentBiz contentBiz;
/**
* 返回主界面index
*/
@GetMapping("/index")
public String index(HttpServletResponse response,HttpServletRequest request){
return "/cms/content/index";
}
/**
* 返回主界面main
*/
@GetMapping("/main")
public String main(HttpServletResponse response,HttpServletRequest request){
return "/cms/content/main";
}
/**
* 查询文章列表
* @param content 文章实体
*/
@ApiOperation(value = "查询文章列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "contentTitle", value = "文章标题", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryId", value = "所属栏目", required =false,paramType="query"),
@ApiImplicitParam(name = "contentType", value = "文章类型", required =false,paramType="query"),
@ApiImplicitParam(name = "contentDisplay", value = "是否显示", required =false,paramType="query"),
@ApiImplicitParam(name = "contentAuthor", value = "文章作者", required =false,paramType="query"),
@ApiImplicitParam(name = "contentSource", value = "文章来源", required =false,paramType="query"),
@ApiImplicitParam(name = "contentDatetime", value = "发布时间", required =false,paramType="query"),
@ApiImplicitParam(name = "contentSort", value = "自定义顺序", required =false,paramType="query"),
@ApiImplicitParam(name = "contentImg", value = "文章缩略图", required =false,paramType="query"),
@ApiImplicitParam(name = "contentDescription", value = "描述", required =false,paramType="query"),
@ApiImplicitParam(name = "contentKeyword", value = "关键字", required =false,paramType="query"),
@ApiImplicitParam(name = "contentDetails", value = "文章内容", required =false,paramType="query"),
@ApiImplicitParam(name = "contentUrl", value = "文章跳转链接地址", required =false,paramType="query"),
@ApiImplicitParam(name = "appid", value = "文章管理的应用id", required =false,paramType="query"),
@ApiImplicitParam(name = "createBy", value = "创建人", required =false,paramType="query"),
@ApiImplicitParam(name = "createDate", value = "创建时间", required =false,paramType="query"),
@ApiImplicitParam(name = "updateBy", value = "修改人", required =false,paramType="query"),
@ApiImplicitParam(name = "updateDate", value = "修改时间", required =false,paramType="query"),
@ApiImplicitParam(name = "del", value = "删除标记", required =false,paramType="query"),
@ApiImplicitParam(name = "id", value = "编号", required =false,paramType="query"),
})
@RequestMapping("/list")
@ResponseBody
public ResultData list(@ModelAttribute @ApiIgnore ContentEntity content, HttpServletResponse response, HttpServletRequest request, @ApiIgnore ModelMap model, BindingResult result) {
BasicUtil.startPage();
List contentList = contentBiz.query(content);
return ResultData.build().success(new EUListBean(contentList,(int) BasicUtil.endPage(contentList).getTotal()));
}
/**
* 返回编辑界面content_form
*/
@GetMapping("/form")
public String form(@ModelAttribute ContentEntity content, HttpServletResponse response, HttpServletRequest request, ModelMap model){
model.addAttribute("appId", BasicUtil.getApp().getAppId());
return "/cms/content/form";
}
/**
* 获取文章
* @param content 文章实体
*/
@ApiOperation(value = "获取文章列表接口")
@ApiImplicitParam(name = "id", value = "编号", required =true,paramType="query")
@GetMapping("/get")
@ResponseBody
public ResultData get(@ModelAttribute @ApiIgnore ContentEntity content, HttpServletResponse response, HttpServletRequest request, @ApiIgnore ModelMap model){
if(content.getId()==null) {
return ResultData.build().error();
}
ContentEntity _content = contentBiz.getById(content.getId());
return ResultData.build().success(_content);
}
/**
* 获取文章
* @param content 文章实体
*/
@ApiOperation(value = "根据封面获取文章列表接口")
@ApiImplicitParam(name = "categoryId", value = "分类编号", required =true,paramType="query")
@GetMapping("/getFromFengMian")
@ResponseBody
public ResultData getFromFengMian(@ModelAttribute @ApiIgnore ContentEntity content){
if(content.getCategoryId() == null) {
return ResultData.build().error();
}
List<ContentEntity> list = contentBiz.lambdaQuery().eq(ContentEntity::getCategoryId, content.getCategoryId()).list();
if (list.size() > 1) {
LOG.error("获取封面文章异常");
}
return ResultData.build().success(list.size() > 0 ? list.get(0) : null);
}
@ApiOperation(value = "保存文章列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "contentTitle", value = "文章标题", required =true,paramType="query"),
@ApiImplicitParam(name = "categoryId", value = "所属栏目", required =false,paramType="query"),
@ApiImplicitParam(name = "contentType", value = "文章类型", required =false,paramType="query"),
@ApiImplicitParam(name = "contentDisplay", value = "是否显示", required =false,paramType="query"),
@ApiImplicitParam(name = "contentAuthor", value = "文章作者", required =false,paramType="query"),
@ApiImplicitParam(name = "contentSource", value = "文章来源", required =false,paramType="query"),
@ApiImplicitParam(name = "contentDatetime", value = "发布时间", required =true,paramType="query"),
@ApiImplicitParam(name = "contentSort", value = "自定义顺序", required =false,paramType="query"),
@ApiImplicitParam(name = "contentImg", value = "文章缩略图", required =false,paramType="query"),
@ApiImplicitParam(name = "contentDescription", value = "描述", required =false,paramType="query"),
@ApiImplicitParam(name = "contentKeyword", value = "关键字", required =false,paramType="query"),
@ApiImplicitParam(name = "contentDetails", value = "文章内容", required =false,paramType="query"),
@ApiImplicitParam(name = "contentUrl", value = "文章跳转链接地址", required =false,paramType="query"),
@ApiImplicitParam(name = "appid", value = "文章管理的应用id", required =false,paramType="query"),
@ApiImplicitParam(name = "createBy", value = "创建人", required =false,paramType="query"),
@ApiImplicitParam(name = "createDate", value = "创建时间", required =false,paramType="query"),
@ApiImplicitParam(name = "updateBy", value = "修改人", required =false,paramType="query"),
@ApiImplicitParam(name = "updateDate", value = "修改时间", required =false,paramType="query"),
@ApiImplicitParam(name = "del", value = "删除标记", required =false,paramType="query"),
@ApiImplicitParam(name = "id", value = "编号", required =false,paramType="query"),
})
/**
* 保存文章
* @param content 文章实体
*/
@PostMapping("/save")
@ResponseBody
@LogAnn(title = "保存文章", businessType = BusinessTypeEnum.INSERT)
@RequiresPermissions("cms:content:save")
public ResultData save(@ModelAttribute @ApiIgnore ContentEntity content, HttpServletResponse response, HttpServletRequest request) {
//验证文章标题的值是否合法
if(StringUtil.isBlank(content.getContentTitle())){
return ResultData.build().error(getResString("err.empty", this.getResString("content.title")));
}
if(!StringUtil.checkLength(content.getContentTitle()+"", 0, 200)){
return ResultData.build().error(getResString("err.length", this.getResString("content.title"), "0", "200"));
}
if(!StringUtil.checkLength(content.getContentAuthor()+"", 0, 200)){
return ResultData.build().error(getResString("err.length", this.getResString("content.author"), "0", "200"));
}
if(!StringUtil.checkLength(content.getContentSource()+"", 0, 200)){
return ResultData.build().error(getResString("err.length", this.getResString("content.source"), "0", "200"));
}
//验证发布时间的值是否合法
if(StringUtil.isBlank(content.getContentDatetime())){
return ResultData.build().error(getResString("err.empty", this.getResString("content.datetime")));
}
if(!StringUtil.checkLength(content.getContentUrl()+"", 0, 200)){
return ResultData.build().error(getResString("err.length", this.getResString("content.url"), "0", "200"));
}
contentBiz.save(content);
return ResultData.build().success(content);
}
/**
* @param contents 文章实体
*/
@ApiOperation(value = "批量删除文章列表接口")
@PostMapping("/delete")
@ResponseBody
@LogAnn(title = "删除文章", businessType = BusinessTypeEnum.DELETE)
@RequiresPermissions("cms:content:del")
public ResultData delete(@RequestBody List<ContentEntity> contents, HttpServletResponse response, HttpServletRequest request) {
List<String> ids = new ArrayList<>();
for(int i = 0;i<contents.size();i++){
ids.add(contents.get(i).getId());
}
contentBiz.removeByIds(ids);
return ResultData.build().success();
}
/**
* 更新文章列表
* @param content 文章实体
*/
@ApiOperation(value = "更新文章列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "编号", required =true,paramType="query"),
@ApiImplicitParam(name = "contentTitle", value = "文章标题", required =true,paramType="query"),
@ApiImplicitParam(name = "categoryId", value = "所属栏目", required =false,paramType="query"),
@ApiImplicitParam(name = "contentType", value = "文章类型", required =false,paramType="query"),
@ApiImplicitParam(name = "contentDisplay", value = "是否显示", required =false,paramType="query"),
@ApiImplicitParam(name = "contentAuthor", value = "文章作者", required =false,paramType="query"),
@ApiImplicitParam(name = "contentSource", value = "文章来源", required =false,paramType="query"),
@ApiImplicitParam(name = "contentDatetime", value = "发布时间", required =true,paramType="query"),
@ApiImplicitParam(name = "contentSort", value = "自定义顺序", required =false,paramType="query"),
@ApiImplicitParam(name = "contentImg", value = "文章缩略图", required =false,paramType="query"),
@ApiImplicitParam(name = "contentDescription", value = "描述", required =false,paramType="query"),
@ApiImplicitParam(name = "contentKeyword", value = "关键字", required =false,paramType="query"),
@ApiImplicitParam(name = "contentDetails", value = "文章内容", required =false,paramType="query"),
@ApiImplicitParam(name = "contentUrl", value = "文章跳转链接地址", required =false,paramType="query"),
@ApiImplicitParam(name = "appid", value = "文章管理的应用id", required =false,paramType="query"),
@ApiImplicitParam(name = "createBy", value = "创建人", required =false,paramType="query"),
@ApiImplicitParam(name = "createDate", value = "创建时间", required =false,paramType="query"),
@ApiImplicitParam(name = "updateBy", value = "修改人", required =false,paramType="query"),
@ApiImplicitParam(name = "updateDate", value = "修改时间", required =false,paramType="query"),
@ApiImplicitParam(name = "del", value = "删除标记", required =false,paramType="query"),
@ApiImplicitParam(name = "id", value = "编号", required =false,paramType="query"),
})
@PostMapping("/update")
@ResponseBody
@LogAnn(title = "更新文章", businessType = BusinessTypeEnum.UPDATE)
@RequiresPermissions("cms:content:update")
public ResultData update(@ModelAttribute @ApiIgnore ContentEntity content, HttpServletResponse response,
HttpServletRequest request) {
//验证文章标题的值是否合法
if(StringUtil.isBlank(content.getContentTitle())){
return ResultData.build().error(getResString("err.empty", this.getResString("content.title")));
}
if(!StringUtil.checkLength(content.getContentTitle()+"", 0, 200)){
return ResultData.build().error(getResString("err.length", this.getResString("content.title"), "0", "200"));
}
if(!StringUtil.checkLength(content.getContentAuthor()+"", 0, 200)){
return ResultData.build().error(getResString("err.length", this.getResString("content.author"), "0", "200"));
}
if(!StringUtil.checkLength(content.getContentSource()+"", 0, 200)){
return ResultData.build().error(getResString("err.length", this.getResString("content.source"), "0", "200"));
}
//验证发布时间的值是否合法
if(StringUtil.isBlank(content.getContentDatetime())){
return ResultData.build().error(getResString("err.empty", this.getResString("content.datetime")));
}
if(!StringUtil.checkLength(content.getContentUrl()+"", 0, 200)){
return ResultData.build().error(getResString("err.length", this.getResString("content.url"), "0", "200"));
}
contentBiz.updateEntity(content);
return ResultData.build().success(content);
}
}
\ No newline at end of file
/**
* The MIT License (MIT) * Copyright (c) 2016 铭飞科技(mingsoft.net)
* <p>
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* 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
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.mingsoft.cms.action;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import net.mingsoft.base.entity.ResultData;
import net.mingsoft.basic.annotation.LogAnn;
import net.mingsoft.basic.biz.IModelBiz;
import net.mingsoft.basic.constant.e.BusinessTypeEnum;
import net.mingsoft.basic.entity.AppEntity;
import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.cms.bean.CategoryBean;
import net.mingsoft.cms.bean.ContentBean;
import net.mingsoft.cms.biz.ICategoryBiz;
import net.mingsoft.cms.biz.IContentBiz;
import net.mingsoft.cms.constant.e.CategoryTypeEnum;
import net.mingsoft.cms.entity.CategoryEntity;
import net.mingsoft.cms.util.CmsParserUtil;
import net.mingsoft.mdiy.bean.PageBean;
import net.mingsoft.mdiy.util.ParserUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @ClassName: GeneraterAction
* @Description:TODO 生成器
* @author: 铭飞开发团队
* @date: 2018年1月31日 下午2:52:07
* @Copyright: 2018 www.mingsoft.net Inc. All rights reserved.
*/
@Controller("cmsGenerater")
@RequestMapping("/${ms.manager.path}/cms/generate")
@Scope("request")
public class GeneraterAction extends BaseAction {
/*
* log4j日志记录
*/
protected final Logger LOG = LoggerFactory.getLogger(this.getClass());
/**
* 文章管理业务层
*/
@Autowired
private IContentBiz contentBiz;
/**
* 栏目管理业务层
*/
@Autowired
private ICategoryBiz categoryBiz;
/**
* 模块管理业务层
*/
@Autowired
private IModelBiz modelBiz;
@Value("${ms.manager.path}")
private String managerPath;
@Value("${ms.diy.html-dir:html}")
private String htmlDir;
/**
* /**
* 更新主页
*
* @return
*/
@RequestMapping("/index")
public String index(HttpServletRequest request, ModelMap model) {
return "/cms/generate/index";
}
/**
* 生成主页
*
* @param request
* @param response
*/
@RequestMapping("/generateIndex")
@RequiresPermissions("cms:generate:index")
@LogAnn(title = "生成主页", businessType = BusinessTypeEnum.UPDATE)
@ResponseBody
public ResultData generateIndex(HttpServletRequest request, HttpServletResponse response) throws IOException {
// 模版文件名称
String tmpFileName = request.getParameter("url");
// 生成后的文件名称
String generateFileName = request.getParameter("position");
// 获取文件所在路径 首先判断用户输入的模版文件是否存在
if (!FileUtil.exist(ParserUtil.buildTempletPath())) {
return ResultData.build().error(getResString("templet.file"));
} else {
CmsParserUtil.generate(tmpFileName, generateFileName,htmlDir);
return ResultData.build().success();
}
}
/**
* 生成列表的静态页面
*
* @param request
* @param response
* @param categoryId
*/
@RequestMapping("/{categoryId}/genernateColumn")
@LogAnn(title = "生成栏目", businessType = BusinessTypeEnum.UPDATE)
@RequiresPermissions("cms:generate:column")
@ResponseBody
public ResultData genernateColumn(HttpServletRequest request, HttpServletResponse response, @PathVariable String categoryId) throws IOException {
// 获取站点id
AppEntity app = BasicUtil.getApp();
//栏目列表
List<CategoryEntity> columns = new ArrayList<CategoryEntity>();
if ("0".equals(categoryId)) {// 0更新所有栏目
CategoryEntity categoryEntity = new CategoryEntity();
columns = categoryBiz.query(categoryEntity);
} else { //选择栏目更新
CategoryEntity categoryEntity = new CategoryEntity();
categoryEntity.setId(categoryId);
columns = categoryBiz.queryChilds(categoryEntity);
}
//文章列表
List<CategoryBean> articleIdList = null;
// 获取栏目列表模版
for (CategoryEntity column : columns) {
ContentBean contentBean = new ContentBean();
contentBean.setCategoryId(column.getId());
articleIdList = contentBiz.queryIdsByCategoryIdForParser(contentBean);
// 判断列表类型
switch (CategoryTypeEnum.get(column.getCategoryType())) {
//TODO 暂时先用字符串代替
case LIST: // 列表
// 判断模板文件是否存在
if (!FileUtil.exist(ParserUtil.buildTempletPath(column.getCategoryListUrl()))) {
LOG.error("模板不存在:{}", column.getCategoryUrl());
continue;
}
CmsParserUtil.generateList(column, articleIdList.size(),htmlDir);
break;
case COVER:// 单页
if (articleIdList.size() == 0) {
CategoryBean columnArticleIdBean = new CategoryBean();
CopyOptions copyOptions = CopyOptions.create();
copyOptions.setIgnoreError(true);
BeanUtil.copyProperties(column, columnArticleIdBean, copyOptions);
articleIdList.add(columnArticleIdBean);
}
CmsParserUtil.generateBasic(articleIdList,htmlDir);
break;
}
}
return ResultData.build().success();
}
/**
* 根据栏目id更新所有的文章
*
* @param request
* @param response
* @param columnId
*/
@RequestMapping("/{columnId}/generateArticle")
@RequiresPermissions("cms:generate:article")
@LogAnn(title = "生成文章", businessType = BusinessTypeEnum.UPDATE)
@ResponseBody
public ResultData generateArticle(HttpServletRequest request, HttpServletResponse response, @PathVariable String columnId) throws IOException {
String dateTime = request.getParameter("dateTime");
// 网站风格物理路径
List<CategoryBean> articleIdList = null;
List<CategoryEntity> categoryList = new ArrayList<CategoryEntity>();
ContentBean contentBean = new ContentBean();
contentBean.setBeginTime(dateTime);
// 生成所有栏目的文章
if ("0".equals(columnId)) {
categoryList = categoryBiz.list(Wrappers.<CategoryEntity>lambdaQuery()
.isNull(CategoryEntity::getCategoryParentIds));
} else {
CategoryEntity category = (CategoryEntity) categoryBiz.getById(columnId);
categoryList.add(category);
}
for (CategoryEntity category : categoryList) {
contentBean.setCategoryId(category.getId());
//将文章列表标签中的中的参数
articleIdList = contentBiz.queryIdsByCategoryIdForParser(contentBean);
// 分类是列表
if (category.getCategoryType().equals(CategoryTypeEnum.LIST.toString())) {
// 判断模板文件是否存在
if (!FileUtil.exist(ParserUtil.buildTempletPath(category.getCategoryListUrl())) || StringUtils.isEmpty(category.getCategoryListUrl())) {
LOG.error("模板不存在:{}", category.getCategoryUrl());
continue;
}
} else if (category.getCategoryType().equals(CategoryTypeEnum.COVER.toString())) {
CategoryBean columnArticleIdBean = new CategoryBean();
CopyOptions copyOptions = CopyOptions.create();
copyOptions.setIgnoreError(true);
BeanUtil.copyProperties(category, columnArticleIdBean, copyOptions);
articleIdList.add(columnArticleIdBean);
}
// 有符合条件的就更新
if (articleIdList.size() > 0) {
CmsParserUtil.generateBasic(articleIdList,htmlDir);
}
}
return ResultData.build().success();
}
/**
* 用户预览主页
*
* @param request
* @return
*/
@RequestMapping("/{position}/viewIndex")
public String viewIndex(HttpServletRequest request, @PathVariable String position, HttpServletResponse response) {
AppEntity app = BasicUtil.getApp();
// 组织主页预览地址
String indexPosition = app.getAppHostUrl() + File.separator + htmlDir+ File.separator + app.getAppDir()
+ File.separator + position + ParserUtil.HTML_SUFFIX;
return "redirect:" + indexPosition;
}
}
package net.mingsoft.cms.action.web;
import java.util.List;
import java.io.File;
import java.util.ArrayList;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSON;
import net.mingsoft.base.entity.ResultData;
import org.apache.commons.lang3.StringUtils;
import org.springframework.validation.BindingResult;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.ui.ModelMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import net.mingsoft.cms.biz.ICategoryBiz;
import net.mingsoft.cms.entity.CategoryEntity;
import net.mingsoft.base.util.JSONObject;
import net.mingsoft.base.entity.BaseEntity;
import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.basic.util.StringUtil;
import net.mingsoft.base.filter.DateValueFilter;
import net.mingsoft.base.filter.DoubleValueFilter;
import net.mingsoft.basic.bean.EUListBean;
import net.mingsoft.basic.annotation.LogAnn;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import springfox.documentation.annotations.ApiIgnore;
/**
* 分类管理控制层
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
@Api(value = "分类接口")
@Controller("WebcmsCategoryAction")
@RequestMapping("/cms/category")
public class CategoryAction extends net.mingsoft.cms.action.BaseAction{
/**
* 注入分类业务层
*/
@Autowired
private ICategoryBiz categoryBiz;
/**
* 查询分类列表
* @param category 分类实体
*/
@ApiOperation(value = "查询分类列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "categoryTitle", value = "栏目管理名称", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryId", value = "所属栏目", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryType", value = "栏目管理属性", required =false,paramType="query"),
@ApiImplicitParam(name = "categorySort", value = "自定义顺序", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryListUrl", value = "列表模板", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryUrl", value = "内容模板", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryKeyword", value = "栏目管理关键字", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryDescrip", value = "栏目管理描述", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryImg", value = "缩略图", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryDiyUrl", value = "自定义链接", required =false,paramType="query"),
@ApiImplicitParam(name = "mdiyModelId", value = "栏目管理的内容模型id", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryDatetime", value = "类别发布时间", required =false,paramType="query"),
@ApiImplicitParam(name = "dictId", value = "字典对应编号", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryFlag", value = "栏目属性", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryPath", value = "栏目路径", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryParentId", value = "父类型编号", required =false,paramType="query"),
@ApiImplicitParam(name = "createBy", value = "创建人", required =false,paramType="query"),
@ApiImplicitParam(name = "createDate", value = "创建时间", required =false,paramType="query"),
@ApiImplicitParam(name = "updateBy", value = "修改人", required =false,paramType="query"),
@ApiImplicitParam(name = "updateDate", value = "修改时间", required =false,paramType="query"),
@ApiImplicitParam(name = "del", value = "删除标记", required =false,paramType="query"),
@ApiImplicitParam(name = "id", value = "编号", required =false,paramType="query"),
})
@RequestMapping("/list")
@ResponseBody
public ResultData list(@ModelAttribute @ApiIgnore CategoryEntity category,HttpServletResponse response, HttpServletRequest request,@ApiIgnore ModelMap model,BindingResult result) {
BasicUtil.startPage();
List categoryList = categoryBiz.query(category);
return ResultData.build().success(new EUListBean(categoryList,(int)BasicUtil.endPage(categoryList).getTotal()));
}
/**
* 获取分类
* @param category 分类实体
*/
@ApiOperation(value = "获取分类列表接口")
@ApiImplicitParam(name = "id", value = "编号", required =true,paramType="query")
@GetMapping("/get")
@ResponseBody
public ResultData get(@ModelAttribute @ApiIgnore CategoryEntity category,HttpServletResponse response, HttpServletRequest request,@ApiIgnore ModelMap model){
if(category.getId()==null) {
return ResultData.build().error();
}
CategoryEntity _category = (CategoryEntity)categoryBiz.getEntity(Integer.parseInt(category.getId()));
return ResultData.build().success(_category);
}
}
\ No newline at end of file
package net.mingsoft.cms.action.web;
import cn.hutool.core.util.ObjectUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import net.mingsoft.base.entity.ResultData;
import net.mingsoft.basic.bean.EUListBean;
import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.cms.biz.IContentBiz;
import net.mingsoft.cms.biz.IHistoryLogBiz;
import net.mingsoft.cms.entity.ContentEntity;
import net.mingsoft.cms.entity.HistoryLogEntity;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;
/**
* 文章管理控制层
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
@Api(value = "文章接口")
@Controller("WebcmsContentAction")
@RequestMapping("/cms/content")
public class ContentAction extends net.mingsoft.cms.action.BaseAction{
/**
* 注入文章业务层
*/
@Autowired
private IContentBiz contentBiz;
@Autowired
private IHistoryLogBiz historyLogBiz;
/**
* 查询文章列表
* @param content 文章实体
*/
@ApiOperation(value = "查询文章列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "contentTitle", value = "文章标题", required =false,paramType="query"),
@ApiImplicitParam(name = "categoryId", value = "所属栏目", required =false,paramType="query"),
@ApiImplicitParam(name = "contentType", value = "文章类型", required =false,paramType="query"),
@ApiImplicitParam(name = "contentDisplay", value = "是否显示", required =false,paramType="query"),
@ApiImplicitParam(name = "contentAuthor", value = "文章作者", required =false,paramType="query"),
@ApiImplicitParam(name = "contentSource", value = "文章来源", required =false,paramType="query"),
@ApiImplicitParam(name = "contentDatetime", value = "发布时间", required =false,paramType="query"),
@ApiImplicitParam(name = "contentSort", value = "自定义顺序", required =false,paramType="query"),
@ApiImplicitParam(name = "contentImg", value = "文章缩略图", required =false,paramType="query"),
@ApiImplicitParam(name = "contentDescription", value = "描述", required =false,paramType="query"),
@ApiImplicitParam(name = "contentKeyword", value = "关键字", required =false,paramType="query"),
@ApiImplicitParam(name = "contentDetails", value = "文章内容", required =false,paramType="query"),
@ApiImplicitParam(name = "contentUrl", value = "文章跳转链接地址", required =false,paramType="query"),
@ApiImplicitParam(name = "appid", value = "文章管理的应用id", required =false,paramType="query"),
@ApiImplicitParam(name = "createBy", value = "创建人", required =false,paramType="query"),
@ApiImplicitParam(name = "createDate", value = "创建时间", required =false,paramType="query"),
@ApiImplicitParam(name = "updateBy", value = "修改人", required =false,paramType="query"),
@ApiImplicitParam(name = "updateDate", value = "修改时间", required =false,paramType="query"),
@ApiImplicitParam(name = "del", value = "删除标记", required =false,paramType="query"),
@ApiImplicitParam(name = "id", value = "编号", required =false,paramType="query"),
})
@RequestMapping("/list")
@ResponseBody
public ResultData list(@ModelAttribute @ApiIgnore ContentEntity content,HttpServletResponse response, HttpServletRequest request,@ApiIgnore ModelMap model,BindingResult result) {
BasicUtil.startPage();
List contentList = contentBiz.query(content);
return ResultData.build().success(new EUListBean(contentList,(int)BasicUtil.endPage(contentList).getTotal()));
}
/**
* 获取文章
* @param content 文章实体
*/
@ApiOperation(value = "获取文章列表接口")
@ApiImplicitParam(name = "id", value = "编号", required =true,paramType="query")
@GetMapping("/get")
@ResponseBody
public ResultData get(@ModelAttribute @ApiIgnore ContentEntity content,HttpServletResponse response, HttpServletRequest request,@ApiIgnore ModelMap model){
if(content.getId()==null) {
return ResultData.build().error();
}
ContentEntity _content = (ContentEntity)contentBiz.getEntity(Integer.parseInt(content.getId()));
return ResultData.build().success(_content);
}
@ApiOperation(value = "查看文章点击数")
@ApiImplicitParam(name = "contentId", value = "文章编号", required = true,paramType="path")
@GetMapping(value = "/{contentId}/hit")
@ResponseBody
public String hit(@PathVariable @ApiIgnore String contentId, HttpServletRequest request, HttpServletResponse response){
if(StringUtils.isEmpty(contentId)){
return "document.write(0)";
}
//获取ip
String ip = BasicUtil.getIp();
//获取端口(移动/web..)
boolean isMobileDevice = BasicUtil.isMobileDevice();
ContentEntity content = contentBiz.getById(contentId);
if(content == null){
return "document.write(0)";
}
//浏览数+1
if(ObjectUtil.isNotEmpty(content.getContentHit())){
content.setContentHit(content.getContentHit()+1);
}else {
content.setContentHit(1);
}
contentBiz.updateEntity(content);
// cms_history 增加相应记录
HistoryLogEntity entity = new HistoryLogEntity();
entity.setHlIsMobile(isMobileDevice);
entity.setHlIp(ip);
entity.setContentId(content.getId());
entity.setCreateDate(new Date());
historyLogBiz.saveEntity(entity);
return "document.write(" + content.getContentHit() + ")";
}
}
package net.mingsoft.cms.aop;
import net.mingsoft.basic.aop.BaseAop;
import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.cms.biz.IContentBiz;
import net.mingsoft.cms.biz.IHistoryLogBiz;
import net.mingsoft.cms.entity.ContentEntity;
import net.mingsoft.cms.entity.HistoryLogEntity;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
/**
* @author 铭飞开源团队
* @date 2019/12/23
*/
@Component
@Aspect
public class CotentAop extends BaseAop {
/**
* 注入文章业务
*/
@Autowired
private IContentBiz contentBiz;
/**
* 注入浏览记录业务
*/
@Autowired
private IHistoryLogBiz historyLogBiz;
/**
* 文章浏览记录,
* 如果该文章该ip已经记录过,则不在重复记录
* @param pjp
* @return
* @throws Throwable
*/
@Around("execution(* net.mingsoft.cms.action.web.ContentAction.get(..))")
public Object get(ProceedingJoinPoint pjp) throws Throwable{
// 获取方法参数
ContentEntity content = getType(pjp, ContentEntity.class);
// 如果id为空则直接发行
if(content.getId()==null) {
return pjp.proceed();
}
content = (ContentEntity)contentBiz.getEntity(Integer.parseInt(content.getId()));
//如果文章不存在则直接发行
if(content == null){
return pjp.proceed();
}
//查询判断该ip是否已经有浏览记录了
HistoryLogEntity historyLog = new HistoryLogEntity();
historyLog.setContentId(content.getId());
historyLog.setHlIp(BasicUtil.getIp());
historyLog.setHlIsMobile(BasicUtil.isMobileDevice());
HistoryLogEntity _historyLog = (HistoryLogEntity)historyLogBiz.getEntity(historyLog);
//如果该ip该文章没有浏览记录则保存浏览记录
//并且更新点击数
if(_historyLog == null || StringUtils.isBlank(_historyLog.getId())){
historyLog.setCreateDate(new Date());
historyLogBiz.saveEntity(historyLog);
//更新点击数
ContentEntity updateContent = new ContentEntity();
updateContent.setId(content.getId());
if(content.getContentHit() == null){
updateContent.setContentHit(1);
}else{
updateContent.setContentHit(content.getContentHit()+1);
}
contentBiz.updateEntity(updateContent);
}
return pjp.proceed();
}
}
package net.mingsoft.cms.bean;
import net.mingsoft.cms.entity.CategoryEntity;
/**
* 文章实体
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
public class CategoryBean extends CategoryEntity {
/**
* 文章编号
*/
private String articleId;
public String getArticleId() {
return articleId;
}
public void setArticleId(String articleId) {
this.articleId = articleId;
}
}
\ No newline at end of file
package net.mingsoft.cms.bean;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import net.mingsoft.cms.entity.ContentEntity;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 文章实体bean
*/
public class ContentBean extends ContentEntity {
// /**
// * 静态化地址
// */
// private String staticUrl;
/**
* 开始时间
*/
private String beginTime;
/**
* 结束时间
*/
private String endTime;
/**
* 属性标记
*/
private String flag;
/**
* 不包含属性标记
*/
private String noflag;
public String getBeginTime() {
return beginTime;
}
public void setBeginTime(String beginTime) {
this.beginTime = beginTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public String getFlag() {
return flag;
}
public void setFlag(String flag) {
this.flag = flag;
}
public String getNoflag() {
return noflag;
}
public void setNoflag(String noflag) {
this.noflag = noflag;
}
}
package net.mingsoft.cms.biz;
import net.mingsoft.base.biz.IBaseBiz;
import net.mingsoft.cms.entity.CategoryEntity;
import java.util.List;
/**
* 分类业务
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
public interface ICategoryBiz extends IBaseBiz<CategoryEntity> {
/**
* 查询当前分类下的所有子分类
* @param category
* @return
*/
List<CategoryEntity> queryChilds(CategoryEntity category);
void saveEntity(CategoryEntity entity);
/**更新父级及子集
* @param entity
*/
void updateEntity(CategoryEntity entity);
/**只更新自身
* @param entity
*/
void update(CategoryEntity entity);
void delete(String categoryId);
void copyCategory(CategoryEntity entity);
}
package net.mingsoft.cms.biz;
import net.mingsoft.base.biz.IBaseBiz;
import net.mingsoft.cms.bean.CategoryBean;
import net.mingsoft.cms.bean.ContentBean;
import net.mingsoft.cms.entity.ContentEntity;
import net.mingsoft.mdiy.entity.ModelEntity;
import java.util.List;
import java.util.Map;
/**
* 文章业务
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
public interface IContentBiz extends IBaseBiz<ContentEntity> {
/**
* 根据文章属性查询
* @param contentBean
* @return
*/
List<CategoryBean> queryIdsByCategoryIdForParser(ContentBean contentBean);
int getSearchCount(ModelEntity contentModel, List diyList, Map whereMap, int appId, String categoryIds);
}
\ No newline at end of file
package net.mingsoft.cms.biz;
import net.mingsoft.base.biz.IBaseBiz;
/**
* 文章浏览记录业务
* @author 铭飞开发团队
* 创建日期:2019-12-23 9:24:03<br/>
* 历史修订:<br/>
*/
public interface IHistoryLogBiz extends IBaseBiz {
}
\ No newline at end of file
/**
The MIT License (MIT) * Copyright (c) 2019 铭飞科技
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* 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:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* 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
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.mingsoft.cms.biz.impl;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import net.mingsoft.base.biz.impl.BaseBizImpl;
import net.mingsoft.base.dao.IBaseDao;
import net.mingsoft.basic.util.PinYinUtil;
import net.mingsoft.cms.biz.ICategoryBiz;
import net.mingsoft.cms.dao.ICategoryDao;
import net.mingsoft.cms.dao.IContentDao;
import net.mingsoft.cms.entity.CategoryEntity;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
* 分类管理持久化层
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
@Service("cmscategoryBizImpl")
@Transactional(rollbackFor = RuntimeException.class)
public class CategoryBizImpl extends BaseBizImpl<ICategoryDao, CategoryEntity> implements ICategoryBiz {
@Autowired
private ICategoryDao categoryDao;
@Autowired
private IContentDao contentDao;
@Override
protected IBaseDao getDao() {
// TODO Auto-generated method stub
return categoryDao;
}
@Override
public List<CategoryEntity> queryChilds(CategoryEntity category) {
// TODO Auto-generated method stub
return categoryDao.queryChildren(category);
}
@Override
public void saveEntity(CategoryEntity categoryEntity) {
// TODO Auto-generated method stub
String pingYin = PinYinUtil.getPingYin(categoryEntity.getCategoryTitle());
//如果用户自己填入了拼音则使用用户的
if (StrUtil.isNotBlank(categoryEntity.getCategoryPinyin())) {
pingYin = categoryEntity.getCategoryPinyin();
}
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())){
CategoryEntity parent = getById(categoryEntity.getCategoryId());
//如果之前是叶子节点就更新
if(parent.getLeaf()){
parent.setLeaf(false);
updateById(parent);
}
}
categoryEntity.setLeaf(false);
//如果是新增栏目一定是叶子节点
if (StrUtil.isEmpty(categoryEntity.getId())) {
categoryEntity.setLeaf(true);
}
super.save(categoryEntity);
//拼音存在则拼接id
if(categoryBizEntity!=null){
categoryEntity.setCategoryPinyin(pingYin+categoryEntity.getId());
}
CategoryEntity parentCategory = null;
if (StringUtils.isNotBlank(categoryEntity.getCategoryId())) {
parentCategory = (CategoryEntity)getById(categoryEntity.getCategoryId());
}
//保存链接地址
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());
path = category.getCategoryPath();
if(StringUtils.isEmpty(category.getCategoryParentIds())) {
categoryEntity.setCategoryParentIds(category.getId());
} else {
categoryEntity.setCategoryParentIds(category.getCategoryParentIds()+","+category.getId());
}
}else {
categoryEntity.setCategoryParentIds(null);
}
//保存时先保存再修改链接地址,修改时直接修改
if(StringUtils.isNotBlank(categoryEntity.getId())) {
categoryEntity.setCategoryPath(path+ "/" + categoryEntity.getCategoryPinyin());
}
}
private void setChildParentId(CategoryEntity categoryEntity) {
CategoryEntity category=new CategoryEntity();
category.setCategoryId(categoryEntity.getId());
List<CategoryEntity> list = categoryDao.query(category);
list.forEach(x->{
if(StringUtils.isEmpty(categoryEntity.getCategoryParentIds())) {
x.setCategoryParentIds(categoryEntity.getId());
} else {
x.setCategoryParentIds(categoryEntity.getCategoryParentIds()+","+categoryEntity.getId());
}
String path=categoryEntity.getCategoryPath();
//判断是否有parentIds
x.setCategoryPath(path+"/"+x.getCategoryPinyin());
//去除多余的/符号
super.updateEntity(x);
setChildParentId(x);
});
}
@Override
public void updateEntity(CategoryEntity entity) {
setParentId(entity);
String pingYin =entity.getCategoryPinyin();
if(StrUtil.isNotBlank(pingYin)){
CategoryEntity category=new CategoryEntity();
category.setCategoryPinyin(pingYin);
CategoryEntity categoryBizEntity = (CategoryEntity)getEntity(category);
//拼音存在则拼接id
if(categoryBizEntity!=null&&!categoryBizEntity.getId().equals(entity.getId())){
entity.setCategoryPinyin(pingYin+entity.getId());
}
}
setParentLeaf(entity);
setTopId(entity);
super.updateById(entity);
setChildParentId(entity);
}
@Override
public void update(CategoryEntity entity) {
super.updateEntity(entity);
}
@Override
public void delete(String categoryId) {
// TODO Auto-generated method stub
CategoryEntity category = (CategoryEntity) categoryDao.selectById(categoryId);
//删除父类
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++){
//删除子类
ids.add(childrenList.get(i).getId());
}
categoryDao.deleteBatchIds(ids);
// 删除文章
contentDao.deleteEntityByCategoryIds(ids.toArray(new String[ids.size()]));
}
}
/**
* 设置父级叶子节点
* @param entity
*/
private void setParentLeaf(CategoryEntity entity){
Assert.notNull(entity);
CategoryEntity categoryEntity = getById(entity.getId());
//如果父级不为空并且修改了父级则需要更新父级
if(entity.getCategoryId() != null && !entity.getCategoryId().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()){
updateById(parent);
}
}
//更新新的父级
if(StrUtil.isNotBlank(entity.getCategoryId())&&!"0".equals(entity.getCategoryId())){
CategoryEntity parent = getById(entity.getCategoryId());
//如果之前是叶子节点就更新
if(parent.getLeaf()){
parent.setLeaf(false);
updateById(parent);
}
}
}
}
/**
* 设置顶级id
* @param entity
*/
private void setTopId(CategoryEntity entity){
String categoryParentId = entity.getCategoryParentIds();
if(StrUtil.isNotBlank(categoryParentId)){
String[] ids = categoryParentId.split(",");
//如果有ParentId就取第一个
if(ids.length>0){
entity.setTopId(ids[0]);
return;
}
}
entity.setTopId("0");
}
@Override
public void copyCategory(CategoryEntity category) {
String oldId = category.getId();
//先保存被复制第一层栏目,因为第一层栏目不需要变更父级栏目
category = getById(oldId);
//id、拼音和路径按照原来的业务逻辑生成
category.setId(null);
category.setCategoryPinyin(null);
category.setCategoryPath(null);
saveEntity(category);
//传入简要被复制子栏目的id和复制后的生成的id,复制的子栏目全部使用
recursionCopyChilds(oldId, category.getId());
}
/*
* 递归复制子栏目
* @param oldParentId:被复制的父级栏目id(需要数据库原来存在该数据)
* @param newParentId:复制栏目后新父级的id(新插入数据的id)
* */
private void recursionCopyChilds(String oldParentId, String newParentId) {
CategoryEntity _category = new CategoryEntity();
_category.setCategoryId(oldParentId);
List<CategoryEntity> childs = query(_category);
for (CategoryEntity child : childs) {
String childId = child.getId();
//id、拼音和路径按照原来的业务逻辑生成
child.setId(null);
child.setCategoryPinyin(null);
child.setCategoryPath(null);
child.setCategoryId(newParentId);
saveEntity(child);
//如果该栏目下还有子栏目则继续复制该栏目里的子栏目
recursionCopyChilds(childId, child.getId());
}
}
}
/**
The MIT License (MIT) * Copyright (c) 2019 铭飞科技
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* 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:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* 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
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.mingsoft.cms.biz.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import net.mingsoft.basic.constant.Const;
import net.mingsoft.basic.holder.DataHolder;
import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.cms.bean.CategoryBean;
import net.mingsoft.cms.bean.ContentBean;
import net.mingsoft.cms.constant.e.CategoryTypeEnum;
import net.mingsoft.cms.dao.ICategoryDao;
import net.mingsoft.cms.entity.CategoryEntity;
import net.mingsoft.cms.entity.ContentEntity;
import net.mingsoft.cms.util.CmsParserUtil;
import net.mingsoft.mdiy.bean.PageBean;
import net.mingsoft.mdiy.entity.ModelEntity;
import net.mingsoft.mdiy.util.ParserUtil;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import net.mingsoft.base.biz.impl.BaseBizImpl;
import net.mingsoft.base.dao.IBaseDao;
import java.io.IOException;
import java.util.*;
import net.mingsoft.cms.biz.IContentBiz;
import net.mingsoft.cms.dao.IContentDao;
/**
* 文章管理持久化层
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
@Service("cmscontentBizImpl")
public class ContentBizImpl extends BaseBizImpl<IContentDao, ContentEntity> implements IContentBiz {
/*
* log4j日志记录
*/
protected final Logger LOG = LoggerFactory.getLogger(this.getClass());
@Autowired
private IContentDao contentDao;
/**
* 栏目管理业务层
*/
@Autowired
private ICategoryDao categoryDao;
@Value("${ms.diy.html-dir:html}")
private String htmlDir;
@Override
protected IBaseDao getDao() {
// TODO Auto-generated method stub
return contentDao;
}
@Override
public List<CategoryBean> queryIdsByCategoryIdForParser(ContentBean contentBean) {
return this.contentDao.queryIdsByCategoryIdForParser(contentBean);
}
@Override
public int getSearchCount(ModelEntity contentModel, List diyList, Map whereMap, int appId, String categoryIds) {
if (contentModel!=null) {
return contentDao.getSearchCount(contentModel.getModelTableName(),diyList,whereMap, appId,categoryIds);
}
return contentDao.getSearchCount(null,null,whereMap, appId,categoryIds);
}
}
\ No newline at end of file
/**
The MIT License (MIT) * Copyright (c) 2019 铭飞科技
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* 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:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* 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
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.mingsoft.cms.biz.impl;
import net.mingsoft.cms.biz.IHistoryLogBiz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import net.mingsoft.base.biz.impl.BaseBizImpl;
import net.mingsoft.base.dao.IBaseDao;
import net.mingsoft.cms.dao.ICmsHistoryLogDao;
/**
* 文章浏览记录管理持久化层
* @author 铭飞开发团队
* 创建日期:2019-12-23 9:24:03<br/>
* 历史修订:<br/>
*/
@Service("cmshistoryLogBizImpl")
public class HistoryLogBizImpl extends BaseBizImpl implements IHistoryLogBiz {
@Autowired
private ICmsHistoryLogDao historyLogDao;
@Override
protected IBaseDao getDao() {
// TODO Auto-generated method stub
return historyLogDao;
}
}
\ No newline at end of file
package net.mingsoft.cms.constant;
/**
* @Author: 铭飞开源团队--huise
* @Date: 2019/8/9 20:51
*/
public class Const {
/**
* 资源文件
*/
public final static String RESOURCES = "net.mingsoft.cms.resources.resources";
}
/**
* The MIT License (MIT) * Copyright (c) 2020 铭软科技(mingsoft.net)
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* 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:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* 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
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.mingsoft.cms.constant.e;
import net.mingsoft.base.constant.e.BaseEnum;
/**
* @Author: 铭飞团队
* @Description:
* @Date: Create in 2020/06/23 14:18
*/
public enum CategoryTypeEnum implements BaseEnum {
/**
* 列表
*/
LIST("1"),
/**
* 封面
*/
COVER("2"),
/**
* 链接
*/
LINK("3");
CategoryTypeEnum(String type) {
this.type = type;
}
private String type;
public static CategoryTypeEnum get(String type) {
for (CategoryTypeEnum e : CategoryTypeEnum.values()) {
if (e.type.equals(type)) {
return e;
}
}
return null;
}
@Override
public int toInt() {
return Integer.parseInt(type);
}
@Override
public String toString() {
return type;
}
}
package net.mingsoft.cms.dao;
import net.mingsoft.base.dao.IBaseDao;
import net.mingsoft.cms.entity.CategoryEntity;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* 分类持久层
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
@Component("cmsCategoryDao")
public interface ICategoryDao extends IBaseDao<CategoryEntity> {
/**
* 查询当前分类下面的所有子分类
* @param category 必须存在categoryId categoryParentId
* @return
*/
public List<CategoryEntity> queryChildren(CategoryEntity category);
}
\ No newline at end of file
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