Commit 5b1f41fc authored by tianbj's avatar tianbj
Browse files

分类文章结构

parent d46aff17
package net.mingsoft.cms.action;
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 net.mingsoft.basic.constant.e.BusinessTypeEnum;
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("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 = "categoryManagerId", value = "发布用户id", required =false,paramType="query"),
@ApiImplicitParam(name = "appId", 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){
if(category.getId()!=null){
BaseEntity categoryEntity = categoryBiz.getEntity(Integer.parseInt(category.getId()));
model.addAttribute("categoryEntity",categoryEntity);
}
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.getEntity(Integer.parseInt(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 = "categoryManagerId", value = "发布用户id", required =false,paramType="query"),
@ApiImplicitParam(name = "appId", 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.getCategoryFlag()+"", 1, 100)){
return ResultData.build().error(getResString("err.length", this.getResString("category.flag"), "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.getCategoryParentId()+"", 1, 100)){
return ResultData.build().error(getResString("err.length", this.getResString("category.parent.id"), "1", "100"));
}
categoryBiz.saveEntity(category);
return ResultData.build().success(category);
}
/**
* @param category 分类实体
*/
@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) {
int[] ids = new int[categorys.size()];
for(int i = 0;i<categorys.size();i++){
ids[i] =Integer.parseInt(categorys.get(i).getId()) ;
}
categoryBiz.delete(ids);
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 = "categoryManagerId", value = "发布用户id", required =false,paramType="query"),
@ApiImplicitParam(name = "appId", 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.getCategoryFlag()+"", 1, 100)){
return ResultData.build().error(getResString("err.length", this.getResString("category.flag"), "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.getCategoryParentId()+"", 1, 100)){
return ResultData.build().error(getResString("err.length", this.getResString("category.parent.id"), "1", "100"));
}
categoryBiz.updateEntity(category);
return ResultData.build().success(category);
}
}
\ No newline at end of file
package net.mingsoft.cms.action;
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.IContentBiz;
import net.mingsoft.cms.entity.ContentEntity;
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 net.mingsoft.basic.constant.e.BusinessTypeEnum;
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("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 = "contentCategoryId", 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){
if(content.getId()!=null){
BaseEntity contentEntity = contentBiz.getEntity(Integer.parseInt(content.getId()));
model.addAttribute("contentEntity",contentEntity);
}
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 = (ContentEntity)contentBiz.getEntity(Integer.parseInt(content.getId()));
return ResultData.build().success(_content);
}
@ApiOperation(value = "保存文章列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "contentTitle", value = "文章标题", required =true,paramType="query"),
@ApiImplicitParam(name = "contentCategoryId", 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.saveEntity(content);
return ResultData.build().success(content);
}
/**
* @param content 文章实体
*/
@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) {
int[] ids = new int[contents.size()];
for(int i = 0;i<contents.size();i++){
ids[i] =Integer.parseInt(contents.get(i).getId()) ;
}
contentBiz.delete(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 = "contentCategoryId", 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
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;
/**
* 返回主界面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 = "categoryManagerId", value = "发布用户id", required =false,paramType="query"),
@ApiImplicitParam(name = "appId", 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){
if(category.getId()!=null){
BaseEntity categoryEntity = categoryBiz.getEntity(Integer.parseInt(category.getId()));
model.addAttribute("categoryEntity",categoryEntity);
}
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.getEntity(Integer.parseInt(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 = "categoryManagerId", value = "发布用户id", required =false,paramType="query"),
@ApiImplicitParam(name = "appId", 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
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.getCategoryFlag()+"", 1, 100)){
return ResultData.build().error(getResString("err.length", this.getResString("category.flag"), "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.getCategoryParentId()+"", 1, 100)){
return ResultData.build().error(getResString("err.length", this.getResString("category.parent.id"), "1", "100"));
}
categoryBiz.saveEntity(category);
return ResultData.build().success(category);
}
/**
* @param category 分类实体
*/
@ApiOperation(value = "批量删除分类列表接口")
@PostMapping("/delete")
@ResponseBody
public ResultData delete(@RequestBody List<CategoryEntity> categorys,HttpServletResponse response, HttpServletRequest request) {
int[] ids = new int[categorys.size()];
for(int i = 0;i<categorys.size();i++){
ids[i] =Integer.parseInt(categorys.get(i).getId()) ;
}
categoryBiz.delete(ids);
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 = "categoryManagerId", value = "发布用户id", required =false,paramType="query"),
@ApiImplicitParam(name = "appId", 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
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.getCategoryFlag()+"", 1, 100)){
return ResultData.build().error(getResString("err.length", this.getResString("category.flag"), "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.getCategoryParentId()+"", 1, 100)){
return ResultData.build().error(getResString("err.length", this.getResString("category.parent.id"), "1", "100"));
}
categoryBiz.updateEntity(category);
return ResultData.build().success(category);
}
}
\ No newline at end of file
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.IContentBiz;
import net.mingsoft.cms.entity.ContentEntity;
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("WebcmsContentAction")
@RequestMapping("/cms/content")
public class ContentAction extends net.mingsoft.cms.action.BaseAction{
/**
* 注入文章业务层
*/
@Autowired
private IContentBiz contentBiz;
/**
* 返回主界面index
*/
@GetMapping("/index")
public String index(HttpServletResponse response,HttpServletRequest request){
return "/cms/content/index";
}
/**
* 查询文章列表
* @param content 文章实体
*/
@ApiOperation(value = "查询文章列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "contentTitle", value = "文章标题", required =false,paramType="query"),
@ApiImplicitParam(name = "contentCategoryId", 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){
if(content.getId()!=null){
BaseEntity contentEntity = contentBiz.getEntity(Integer.parseInt(content.getId()));
model.addAttribute("contentEntity",contentEntity);
}
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 = (ContentEntity)contentBiz.getEntity(Integer.parseInt(content.getId()));
return ResultData.build().success(_content);
}
@ApiOperation(value = "保存文章列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "contentTitle", value = "文章标题", required =true,paramType="query"),
@ApiImplicitParam(name = "contentCategoryId", 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
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.saveEntity(content);
return ResultData.build().success(content);
}
/**
* @param content 文章实体
*/
@ApiOperation(value = "批量删除文章列表接口")
@PostMapping("/delete")
@ResponseBody
public ResultData delete(@RequestBody List<ContentEntity> contents,HttpServletResponse response, HttpServletRequest request) {
int[] ids = new int[contents.size()];
for(int i = 0;i<contents.size();i++){
ids[i] =Integer.parseInt(contents.get(i).getId()) ;
}
contentBiz.delete(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 = "contentCategoryId", 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
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
package net.mingsoft.cms.biz;
import net.mingsoft.base.biz.IBaseBiz;
/**
* 分类业务
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
public interface ICategoryBiz extends IBaseBiz {
}
\ No newline at end of file
package net.mingsoft.cms.biz;
import net.mingsoft.base.biz.IBaseBiz;
/**
* 文章业务
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
public interface IContentBiz 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 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 java.util.*;
import net.mingsoft.cms.entity.CategoryEntity;
import net.mingsoft.cms.biz.ICategoryBiz;
import net.mingsoft.cms.dao.ICategoryDao;
/**
* 分类管理持久化层
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
@Service("cmscategoryBizImpl")
public class CategoryBizImpl extends BaseBizImpl implements ICategoryBiz {
@Autowired
private ICategoryDao categoryDao;
@Override
protected IBaseDao getDao() {
// TODO Auto-generated method stub
return categoryDao;
}
}
\ 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 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 java.util.*;
import net.mingsoft.cms.entity.ContentEntity;
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 implements IContentBiz {
@Autowired
private IContentDao contentDao;
@Override
protected IBaseDao getDao() {
// TODO Auto-generated method stub
return contentDao;
}
}
\ No newline at end of file
package net.mingsoft.cms.dao;
import net.mingsoft.base.dao.IBaseDao;
import java.util.*;
import net.mingsoft.cms.entity.CategoryEntity;
import org.springframework.stereotype.Component;
/**
* 分类持久层
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
@Component("cmsCategoryDao")
public interface ICategoryDao extends IBaseDao {
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="net.mingsoft.cms.dao.ICategoryDao">
<resultMap id="resultMap" type="net.mingsoft.cms.entity.CategoryEntity">
<id column="id" property="id" /><!--编号 -->
<result column="category_title" property="categoryTitle" /><!--栏目管理名称 -->
<result column="category_id" property="categoryId" /><!--所属栏目 -->
<result column="category_type" property="categoryType" /><!--栏目管理属性 -->
<result column="category_sort" property="categorySort" /><!--自定义顺序 -->
<result column="category_list_url" property="categoryListUrl" /><!--列表模板 -->
<result column="category_url" property="categoryUrl" /><!--内容模板 -->
<result column="category_keyword" property="categoryKeyword" /><!--栏目管理关键字 -->
<result column="category_descrip" property="categoryDescrip" /><!--栏目管理描述 -->
<result column="category_img" property="categoryImg" /><!--缩略图 -->
<result column="category_diy_url" property="categoryDiyUrl" /><!--自定义链接 -->
<result column="mdiy_model_id" property="mdiyModelId" /><!--栏目管理的内容模型id -->
<result column="category_datetime" property="categoryDatetime" /><!--类别发布时间 -->
<result column="category_manager_id" property="categoryManagerId" /><!--发布用户id -->
<result column="app_id" property="appId" /><!--应用编号 -->
<result column="dict_id" property="dictId" /><!--字典对应编号 -->
<result column="category_flag" property="categoryFlag" /><!--栏目属性 -->
<result column="category_path" property="categoryPath" /><!--栏目路径 -->
<result column="category_parent_id" property="categoryParentId" /><!--父类型编号 -->
<result column="create_by" property="createBy" /><!--创建人 -->
<result column="create_date" property="createDate" /><!--创建时间 -->
<result column="update_by" property="updateBy" /><!--修改人 -->
<result column="update_date" property="updateDate" /><!--修改时间 -->
<result column="del" property="del" /><!--删除标记 -->
</resultMap>
<!--保存-->
<insert id="saveEntity" useGeneratedKeys="true" keyProperty="id"
parameterType="net.mingsoft.cms.entity.CategoryEntity" >
insert into cms_category
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="categoryTitle != null and categoryTitle != ''">category_title,</if>
<if test="categoryId != null and categoryId != ''">category_id,</if>
<if test="categoryType != null and categoryType != ''">category_type,</if>
<if test="categorySort != null">category_sort,</if>
<if test="categoryListUrl != null and categoryListUrl != ''">category_list_url,</if>
<if test="categoryUrl != null and categoryUrl != ''">category_url,</if>
<if test="categoryKeyword != null and categoryKeyword != ''">category_keyword,</if>
<if test="categoryDescrip != null and categoryDescrip != ''">category_descrip,</if>
<if test="categoryImg != null and categoryImg != ''">category_img,</if>
<if test="categoryDiyUrl != null and categoryDiyUrl != ''">category_diy_url,</if>
<if test="mdiyModelId != null and mdiyModelId != ''">mdiy_model_id,</if>
<if test="categoryDatetime != null">category_datetime,</if>
<if test="categoryManagerId != null">category_manager_id,</if>
<if test="appId != null">app_id,</if>
<if test="dictId != null">dict_id,</if>
<if test="categoryFlag != null and categoryFlag != ''">category_flag,</if>
<if test="categoryPath != null and categoryPath != ''">category_path,</if>
<if test="categoryParentId != null and categoryParentId != ''">category_parent_id,</if>
<if test="createBy &gt; 0">create_by,</if>
<if test="createDate != null">create_date,</if>
<if test="updateBy &gt; 0">update_by,</if>
<if test="updateDate != null">update_date,</if>
<if test="del != null">del,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="categoryTitle != null and categoryTitle != ''">#{categoryTitle},</if>
<if test="categoryId != null and categoryId != ''">#{categoryId},</if>
<if test="categoryType != null and categoryType != ''">#{categoryType},</if>
<if test="categorySort != null">#{categorySort},</if>
<if test="categoryListUrl != null and categoryListUrl != ''">#{categoryListUrl},</if>
<if test="categoryUrl != null and categoryUrl != ''">#{categoryUrl},</if>
<if test="categoryKeyword != null and categoryKeyword != ''">#{categoryKeyword},</if>
<if test="categoryDescrip != null and categoryDescrip != ''">#{categoryDescrip},</if>
<if test="categoryImg != null and categoryImg != ''">#{categoryImg},</if>
<if test="categoryDiyUrl != null and categoryDiyUrl != ''">#{categoryDiyUrl},</if>
<if test="mdiyModelId != null and mdiyModelId != ''">#{mdiyModelId},</if>
<if test="categoryDatetime != null">#{categoryDatetime},</if>
<if test="categoryManagerId != null">#{categoryManagerId},</if>
<if test="appId != null">#{appId},</if>
<if test="dictId != null">#{dictId},</if>
<if test="categoryFlag != null and categoryFlag != ''">#{categoryFlag},</if>
<if test="categoryPath != null and categoryPath != ''">#{categoryPath},</if>
<if test="categoryParentId != null and categoryParentId != ''">#{categoryParentId},</if>
<if test="createBy &gt; 0">#{createBy},</if>
<if test="createDate != null">#{createDate},</if>
<if test="updateBy &gt; 0">#{updateBy},</if>
<if test="updateDate != null">#{updateDate},</if>
<if test="del != null">#{del},</if>
</trim>
</insert>
<!--更新-->
<update id="updateEntity" parameterType="net.mingsoft.cms.entity.CategoryEntity">
update cms_category
<set>
<if test="categoryTitle != null and categoryTitle != ''">category_title=#{categoryTitle},</if>
<if test="categoryId != null and categoryId != ''">category_id=#{categoryId},</if>
<if test="categoryType != null and categoryType != ''">category_type=#{categoryType},</if>
<if test="categorySort != null">category_sort=#{categorySort},</if>
<if test="categoryListUrl != null and categoryListUrl != ''">category_list_url=#{categoryListUrl},</if>
<if test="categoryUrl != null and categoryUrl != ''">category_url=#{categoryUrl},</if>
<if test="categoryKeyword != null and categoryKeyword != ''">category_keyword=#{categoryKeyword},</if>
<if test="categoryDescrip != null and categoryDescrip != ''">category_descrip=#{categoryDescrip},</if>
<if test="categoryImg != null and categoryImg != ''">category_img=#{categoryImg},</if>
<if test="categoryDiyUrl != null and categoryDiyUrl != ''">category_diy_url=#{categoryDiyUrl},</if>
<if test="mdiyModelId != null and mdiyModelId != ''">mdiy_model_id=#{mdiyModelId},</if>
<if test="categoryDatetime != null">category_datetime=#{categoryDatetime},</if>
<if test="categoryManagerId != null">category_manager_id=#{categoryManagerId},</if>
<if test="appId != null">app_id=#{appId},</if>
<if test="dictId != null">dict_id=#{dictId},</if>
<if test="categoryFlag != null and categoryFlag != ''">category_flag=#{categoryFlag},</if>
<if test="categoryPath != null and categoryPath != ''">category_path=#{categoryPath},</if>
<if test="categoryParentId != null and categoryParentId != ''">category_parent_id=#{categoryParentId},</if>
<if test="createBy &gt; 0">create_by=#{createBy},</if>
<if test="createDate != null">create_date=#{createDate},</if>
<if test="updateBy &gt; 0">update_by=#{updateBy},</if>
<if test="updateDate != null">update_date=#{updateDate},</if>
<if test="del != null">del=#{del},</if>
</set>
where id = #{id}
</update>
<!--根据id获取-->
<select id="getEntity" resultMap="resultMap" parameterType="int">
select * from cms_category where id=#{id}
</select>
<!--根据实体获取-->
<select id="getByEntity" resultMap="resultMap" parameterType="net.mingsoft.cms.entity.CategoryEntity">
select * from cms_category
<where>
<if test="categoryTitle != null and categoryTitle != ''">and category_title=#{categoryTitle}</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="categorySort != null"> and category_sort=#{categorySort} </if>
<if test="categoryListUrl != null and categoryListUrl != ''">and category_list_url=#{categoryListUrl}</if>
<if test="categoryUrl != null and categoryUrl != ''">and category_url=#{categoryUrl}</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="categoryImg != null and categoryImg != ''">and category_img=#{categoryImg}</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="categoryDatetime != null"> and category_datetime=#{categoryDatetime} </if>
<if test="categoryManagerId != null"> and category_manager_id=#{categoryManagerId} </if>
<if test="appId != null"> and app_id=#{appId} </if>
<if test="dictId != null"> and dict_id=#{dictId} </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="categoryParentId != null and categoryParentId != ''">and category_parent_id=#{categoryParentId}</if>
<if test="createBy &gt; 0"> and create_by=#{createBy} </if>
<if test="createDate != null"> and create_date=#{createDate} </if>
<if test="updateBy &gt; 0"> and update_by=#{updateBy} </if>
<if test="updateDate != null"> and update_date=#{updateDate} </if>
<if test="del != null"> and del=#{del} </if>
</where>
limit 0,1
</select>
<!--删除-->
<delete id="deleteEntity" parameterType="int">
delete from cms_category where id=#{id}
</delete>
<!--批量删除-->
<delete id="delete" >
delete from cms_category
<where>
id in <foreach collection="ids" item="item" index="index"
open="(" separator="," close=")">#{item}</foreach>
</where>
</delete>
<!--查询全部-->
<select id="queryAll" resultMap="resultMap">
select * from cms_category order by id desc
</select>
<!--条件查询-->
<select id="query" resultMap="resultMap">
select * from cms_category
<where>
<if test="categoryTitle != null and categoryTitle != ''"> and category_title=#{categoryTitle}</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="categorySort != null"> and category_sort=#{categorySort} </if>
<if test="categoryListUrl != null and categoryListUrl != ''"> and category_list_url=#{categoryListUrl}</if>
<if test="categoryUrl != null and categoryUrl != ''"> and category_url=#{categoryUrl}</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="categoryImg != null and categoryImg != ''"> and category_img=#{categoryImg}</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="categoryDatetime != null"> and category_datetime=#{categoryDatetime} </if>
<if test="categoryManagerId != null"> and category_manager_id=#{categoryManagerId} </if>
<if test="appId != null"> and app_id=#{appId} </if>
<if test="dictId != null"> and dict_id=#{dictId} </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="categoryParentId != null and categoryParentId != ''"> and category_parent_id=#{categoryParentId}</if>
<if test="createBy &gt; 0"> and create_by=#{createBy} </if>
<if test="createDate != null"> and create_date=#{createDate} </if>
<if test="updateBy &gt; 0"> and update_by=#{updateBy} </if>
<if test="updateDate != null"> and update_date=#{updateDate} </if>
<if test="del != null"> and del=#{del} </if>
<include refid="net.mingsoft.base.dao.IBaseDao.sqlWhere"></include>
</where>
order by id desc
</select>
</mapper>
\ No newline at end of file
package net.mingsoft.cms.dao;
import net.mingsoft.base.dao.IBaseDao;
import java.util.*;
import net.mingsoft.cms.entity.ContentEntity;
/**
* 文章持久层
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
public interface IContentDao extends IBaseDao {
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="net.mingsoft.cms.dao.IContentDao">
<resultMap id="resultMap" type="net.mingsoft.cms.entity.ContentEntity">
<id column="id" property="id" /><!--编号 -->
<result column="content_title" property="contentTitle" /><!--文章标题 -->
<result column="content_category_id" property="contentCategoryId" /><!--所属栏目 -->
<result column="content_type" property="contentType" /><!--文章类型 -->
<result column="content_display" property="contentDisplay" /><!--是否显示 -->
<result column="content_author" property="contentAuthor" /><!--文章作者 -->
<result column="content_source" property="contentSource" /><!--文章来源 -->
<result column="content_datetime" property="contentDatetime" /><!--发布时间 -->
<result column="content_sort" property="contentSort" /><!--自定义顺序 -->
<result column="content_img" property="contentImg" /><!--文章缩略图 -->
<result column="content_description" property="contentDescription" /><!--描述 -->
<result column="content_keyword" property="contentKeyword" /><!--关键字 -->
<result column="content_details" property="contentDetails" /><!--文章内容 -->
<result column="content_url" property="contentUrl" /><!--文章跳转链接地址 -->
<result column="appid" property="appid" /><!--文章管理的应用id -->
<result column="create_by" property="createBy" /><!--创建人 -->
<result column="create_date" property="createDate" /><!--创建时间 -->
<result column="update_by" property="updateBy" /><!--修改人 -->
<result column="update_date" property="updateDate" /><!--修改时间 -->
<result column="del" property="del" /><!--删除标记 -->
</resultMap>
<!--保存-->
<insert id="saveEntity" useGeneratedKeys="true" keyProperty="id"
parameterType="net.mingsoft.cms.entity.ContentEntity" >
insert into cms_content
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="contentTitle != null and contentTitle != ''">content_title,</if>
<if test="contentCategoryId != null and contentCategoryId != ''">content_category_id,</if>
<if test="contentType != null and contentType != ''">content_type,</if>
<if test="contentDisplay != null and contentDisplay != ''">content_display,</if>
<if test="contentAuthor != null and contentAuthor != ''">content_author,</if>
<if test="contentSource != null and contentSource != ''">content_source,</if>
<if test="contentDatetime != null">content_datetime,</if>
<if test="contentSort != null">content_sort,</if>
<if test="contentImg != null and contentImg != ''">content_img,</if>
<if test="contentDescription != null and contentDescription != ''">content_description,</if>
<if test="contentKeyword != null and contentKeyword != ''">content_keyword,</if>
<if test="contentDetails != null and contentDetails != ''">content_details,</if>
<if test="contentUrl != null and contentUrl != ''">content_url,</if>
<if test="appid != null">appid,</if>
<if test="createBy &gt; 0">create_by,</if>
<if test="createDate != null">create_date,</if>
<if test="updateBy &gt; 0">update_by,</if>
<if test="updateDate != null">update_date,</if>
<if test="del != null">del,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="contentTitle != null and contentTitle != ''">#{contentTitle},</if>
<if test="contentCategoryId != null and contentCategoryId != ''">#{contentCategoryId},</if>
<if test="contentType != null and contentType != ''">#{contentType},</if>
<if test="contentDisplay != null and contentDisplay != ''">#{contentDisplay},</if>
<if test="contentAuthor != null and contentAuthor != ''">#{contentAuthor},</if>
<if test="contentSource != null and contentSource != ''">#{contentSource},</if>
<if test="contentDatetime != null">#{contentDatetime},</if>
<if test="contentSort != null">#{contentSort},</if>
<if test="contentImg != null and contentImg != ''">#{contentImg},</if>
<if test="contentDescription != null and contentDescription != ''">#{contentDescription},</if>
<if test="contentKeyword != null and contentKeyword != ''">#{contentKeyword},</if>
<if test="contentDetails != null and contentDetails != ''">#{contentDetails},</if>
<if test="contentUrl != null and contentUrl != ''">#{contentUrl},</if>
<if test="appid != null">#{appid},</if>
<if test="createBy &gt; 0">#{createBy},</if>
<if test="createDate != null">#{createDate},</if>
<if test="updateBy &gt; 0">#{updateBy},</if>
<if test="updateDate != null">#{updateDate},</if>
<if test="del != null">#{del},</if>
</trim>
</insert>
<!--更新-->
<update id="updateEntity" parameterType="net.mingsoft.cms.entity.ContentEntity">
update cms_content
<set>
<if test="contentTitle != null and contentTitle != ''">content_title=#{contentTitle},</if>
<if test="contentCategoryId != null and contentCategoryId != ''">content_category_id=#{contentCategoryId},</if>
<if test="contentType != null and contentType != ''">content_type=#{contentType},</if>
<if test="contentDisplay != null and contentDisplay != ''">content_display=#{contentDisplay},</if>
<if test="contentAuthor != null and contentAuthor != ''">content_author=#{contentAuthor},</if>
<if test="contentSource != null and contentSource != ''">content_source=#{contentSource},</if>
<if test="contentDatetime != null">content_datetime=#{contentDatetime},</if>
<if test="contentSort != null">content_sort=#{contentSort},</if>
<if test="contentImg != null and contentImg != ''">content_img=#{contentImg},</if>
<if test="contentDescription != null and contentDescription != ''">content_description=#{contentDescription},</if>
<if test="contentKeyword != null and contentKeyword != ''">content_keyword=#{contentKeyword},</if>
<if test="contentDetails != null and contentDetails != ''">content_details=#{contentDetails},</if>
<if test="contentUrl != null and contentUrl != ''">content_url=#{contentUrl},</if>
<if test="appid != null">appid=#{appid},</if>
<if test="createBy &gt; 0">create_by=#{createBy},</if>
<if test="createDate != null">create_date=#{createDate},</if>
<if test="updateBy &gt; 0">update_by=#{updateBy},</if>
<if test="updateDate != null">update_date=#{updateDate},</if>
<if test="del != null">del=#{del},</if>
</set>
where id = #{id}
</update>
<!--根据id获取-->
<select id="getEntity" resultMap="resultMap" parameterType="int">
select * from cms_content where id=#{id}
</select>
<!--根据实体获取-->
<select id="getByEntity" resultMap="resultMap" parameterType="net.mingsoft.cms.entity.ContentEntity">
select * from cms_content
<where>
<if test="contentTitle != null and contentTitle != ''">and content_title like CONCAT('%',#{contentTitle},'%')</if>
<if test="contentCategoryId != null and contentCategoryId != ''">and content_category_id=#{contentCategoryId}</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="contentAuthor != null and contentAuthor != ''">and content_author=#{contentAuthor}</if>
<if test="contentSource != null and contentSource != ''">and content_source=#{contentSource}</if>
<if test="contentDatetime != null"> and content_datetime=#{contentDatetime} </if>
<if test="contentSort != null"> and content_sort=#{contentSort} </if>
<if test="contentImg != null and contentImg != ''">and content_img=#{contentImg}</if>
<if test="contentDescription != null and contentDescription != ''">and content_description=#{contentDescription}</if>
<if test="contentKeyword != null and contentKeyword != ''">and content_keyword=#{contentKeyword}</if>
<if test="contentDetails != null and contentDetails != ''">and content_details=#{contentDetails}</if>
<if test="contentUrl != null and contentUrl != ''">and content_url=#{contentUrl}</if>
<if test="appid != null"> and appid=#{appid} </if>
<if test="createBy &gt; 0"> and create_by=#{createBy} </if>
<if test="createDate != null"> and create_date=#{createDate} </if>
<if test="updateBy &gt; 0"> and update_by=#{updateBy} </if>
<if test="updateDate != null"> and update_date=#{updateDate} </if>
<if test="del != null"> and del=#{del} </if>
</where>
limit 0,1
</select>
<!--删除-->
<delete id="deleteEntity" parameterType="int">
delete from cms_content where id=#{id}
</delete>
<!--批量删除-->
<delete id="delete" >
delete from cms_content
<where>
id in <foreach collection="ids" item="item" index="index"
open="(" separator="," close=")">#{item}</foreach>
</where>
</delete>
<!--查询全部-->
<select id="queryAll" resultMap="resultMap">
select * from cms_content order by id desc
</select>
<!--条件查询-->
<select id="query" resultMap="resultMap">
select * from cms_content
<where>
<if test="contentTitle != null and contentTitle != ''"> and content_title like CONCAT('%',#{contentTitle},'%')</if>
<if test="contentCategoryId != null and contentCategoryId != ''"> and content_category_id=#{contentCategoryId}</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="contentAuthor != null and contentAuthor != ''"> and content_author=#{contentAuthor}</if>
<if test="contentSource != null and contentSource != ''"> and content_source=#{contentSource}</if>
<if test="contentDatetime != null"> and content_datetime=#{contentDatetime} </if>
<if test="contentSort != null"> and content_sort=#{contentSort} </if>
<if test="contentImg != null and contentImg != ''"> and content_img=#{contentImg}</if>
<if test="contentDescription != null and contentDescription != ''"> and content_description=#{contentDescription}</if>
<if test="contentKeyword != null and contentKeyword != ''"> and content_keyword=#{contentKeyword}</if>
<if test="contentDetails != null and contentDetails != ''"> and content_details=#{contentDetails}</if>
<if test="contentUrl != null and contentUrl != ''"> and content_url=#{contentUrl}</if>
<if test="appid != null"> and appid=#{appid} </if>
<if test="createBy &gt; 0"> and create_by=#{createBy} </if>
<if test="createDate != null"> and create_date=#{createDate} </if>
<if test="updateBy &gt; 0"> and update_by=#{updateBy} </if>
<if test="updateDate != null"> and update_date=#{updateDate} </if>
<if test="del != null"> and del=#{del} </if>
<include refid="net.mingsoft.base.dao.IBaseDao.sqlWhere"></include>
</where>
order by id desc
</select>
</mapper>
\ No newline at end of file
package net.mingsoft.cms.entity;
import com.alibaba.fastjson.annotation.JSONField;
import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import net.mingsoft.base.entity.BaseEntity;
import java.util.Date;
/**
* 分类实体
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
public class CategoryEntity extends BaseEntity {
private static final long serialVersionUID = 1574925152750L;
/**
* 栏目管理名称
*/
private String categoryTitle;
/**
* 所属栏目
*/
private String categoryId;
/**
* 栏目管理属性
*/
private String categoryType;
/**
* 自定义顺序
*/
private Integer categorySort;
/**
* 列表模板
*/
private String categoryListUrl;
/**
* 内容模板
*/
private String categoryUrl;
/**
* 栏目管理关键字
*/
private String categoryKeyword;
/**
* 栏目管理描述
*/
private String categoryDescrip;
/**
* 缩略图
*/
private String categoryImg;
/**
* 自定义链接
*/
private String categoryDiyUrl;
/**
* 栏目管理的内容模型id
*/
private String mdiyModelId;
/**
* 类别发布时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
private Date categoryDatetime;
/**
* 发布用户id
*/
private Integer categoryManagerId;
/**
* 应用编号
*/
private Integer appId;
/**
* 字典对应编号
*/
private Integer dictId;
/**
* 栏目属性
*/
private String categoryFlag;
/**
* 栏目路径
*/
private String categoryPath;
/**
* 父类型编号
*/
private String categoryParentId;
/**
* 设置栏目管理名称
*/
public void setCategoryTitle(String categoryTitle) {
this.categoryTitle = categoryTitle;
}
/**
* 获取栏目管理名称
*/
public String getCategoryTitle() {
return this.categoryTitle;
}
/**
* 设置所属栏目
*/
public void setCategoryId(String categoryId) {
this.categoryId = categoryId;
}
/**
* 获取所属栏目
*/
public String getCategoryId() {
return this.categoryId;
}
/**
* 设置栏目管理属性
*/
public void setCategoryType(String categoryType) {
this.categoryType = categoryType;
}
/**
* 获取栏目管理属性
*/
public String getCategoryType() {
return this.categoryType;
}
/**
* 设置自定义顺序
*/
public void setCategorySort(Integer categorySort) {
this.categorySort = categorySort;
}
/**
* 获取自定义顺序
*/
public Integer getCategorySort() {
return this.categorySort;
}
/**
* 设置列表模板
*/
public void setCategoryListUrl(String categoryListUrl) {
this.categoryListUrl = categoryListUrl;
}
/**
* 获取列表模板
*/
public String getCategoryListUrl() {
return this.categoryListUrl;
}
/**
* 设置内容模板
*/
public void setCategoryUrl(String categoryUrl) {
this.categoryUrl = categoryUrl;
}
/**
* 获取内容模板
*/
public String getCategoryUrl() {
return this.categoryUrl;
}
/**
* 设置栏目管理关键字
*/
public void setCategoryKeyword(String categoryKeyword) {
this.categoryKeyword = categoryKeyword;
}
/**
* 获取栏目管理关键字
*/
public String getCategoryKeyword() {
return this.categoryKeyword;
}
/**
* 设置栏目管理描述
*/
public void setCategoryDescrip(String categoryDescrip) {
this.categoryDescrip = categoryDescrip;
}
/**
* 获取栏目管理描述
*/
public String getCategoryDescrip() {
return this.categoryDescrip;
}
/**
* 设置缩略图
*/
public void setCategoryImg(String categoryImg) {
this.categoryImg = categoryImg;
}
/**
* 获取缩略图
*/
public String getCategoryImg() {
return this.categoryImg;
}
/**
* 设置自定义链接
*/
public void setCategoryDiyUrl(String categoryDiyUrl) {
this.categoryDiyUrl = categoryDiyUrl;
}
/**
* 获取自定义链接
*/
public String getCategoryDiyUrl() {
return this.categoryDiyUrl;
}
/**
* 设置栏目管理的内容模型id
*/
public void setMdiyModelId(String mdiyModelId) {
this.mdiyModelId = mdiyModelId;
}
/**
* 获取栏目管理的内容模型id
*/
public String getMdiyModelId() {
return this.mdiyModelId;
}
/**
* 设置类别发布时间
*/
public void setCategoryDatetime(Date categoryDatetime) {
this.categoryDatetime = categoryDatetime;
}
/**
* 获取类别发布时间
*/
public Date getCategoryDatetime() {
return this.categoryDatetime;
}
/**
* 设置发布用户id
*/
public void setCategoryManagerId(Integer categoryManagerId) {
this.categoryManagerId = categoryManagerId;
}
/**
* 获取发布用户id
*/
public Integer getCategoryManagerId() {
return this.categoryManagerId;
}
/**
* 设置应用编号
*/
public void setAppId(Integer appId) {
this.appId = appId;
}
/**
* 获取应用编号
*/
public Integer getAppId() {
return this.appId;
}
/**
* 设置字典对应编号
*/
public void setDictId(Integer dictId) {
this.dictId = dictId;
}
/**
* 获取字典对应编号
*/
public Integer getDictId() {
return this.dictId;
}
/**
* 设置栏目属性
*/
public void setCategoryFlag(String categoryFlag) {
this.categoryFlag = categoryFlag;
}
/**
* 获取栏目属性
*/
public String getCategoryFlag() {
return this.categoryFlag;
}
/**
* 设置栏目路径
*/
public void setCategoryPath(String categoryPath) {
this.categoryPath = categoryPath;
}
/**
* 获取栏目路径
*/
public String getCategoryPath() {
return this.categoryPath;
}
/**
* 设置父类型编号
*/
public void setCategoryParentId(String categoryParentId) {
this.categoryParentId = categoryParentId;
}
/**
* 获取父类型编号
*/
public String getCategoryParentId() {
return this.categoryParentId;
}
}
\ No newline at end of file
package net.mingsoft.cms.entity;
import com.alibaba.fastjson.annotation.JSONField;
import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import net.mingsoft.base.entity.BaseEntity;
import java.util.Date;
/**
* 文章实体
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
public class ContentEntity extends BaseEntity {
private static final long serialVersionUID = 1574925152617L;
/**
* 文章标题
*/
private String contentTitle;
/**
* 所属栏目
*/
private String contentCategoryId;
/**
* 文章类型
*/
private String contentType;
/**
* 是否显示
*/
private String contentDisplay;
/**
* 文章作者
*/
private String contentAuthor;
/**
* 文章来源
*/
private String contentSource;
/**
* 发布时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
private Date contentDatetime;
/**
* 自定义顺序
*/
private Integer contentSort;
/**
* 文章缩略图
*/
private String contentImg;
/**
* 描述
*/
private String contentDescription;
/**
* 关键字
*/
private String contentKeyword;
/**
* 文章内容
*/
private String contentDetails;
/**
* 文章跳转链接地址
*/
private String contentUrl;
/**
* 文章管理的应用id
*/
private Integer appid;
/**
* 设置文章标题
*/
public void setContentTitle(String contentTitle) {
this.contentTitle = contentTitle;
}
/**
* 获取文章标题
*/
public String getContentTitle() {
return this.contentTitle;
}
/**
* 设置所属栏目
*/
public void setContentCategoryId(String contentCategoryId) {
this.contentCategoryId = contentCategoryId;
}
/**
* 获取所属栏目
*/
public String getContentCategoryId() {
return this.contentCategoryId;
}
/**
* 设置文章类型
*/
public void setContentType(String contentType) {
this.contentType = contentType;
}
/**
* 获取文章类型
*/
public String getContentType() {
return this.contentType;
}
/**
* 设置是否显示
*/
public void setContentDisplay(String contentDisplay) {
this.contentDisplay = contentDisplay;
}
/**
* 获取是否显示
*/
public String getContentDisplay() {
return this.contentDisplay;
}
/**
* 设置文章作者
*/
public void setContentAuthor(String contentAuthor) {
this.contentAuthor = contentAuthor;
}
/**
* 获取文章作者
*/
public String getContentAuthor() {
return this.contentAuthor;
}
/**
* 设置文章来源
*/
public void setContentSource(String contentSource) {
this.contentSource = contentSource;
}
/**
* 获取文章来源
*/
public String getContentSource() {
return this.contentSource;
}
/**
* 设置发布时间
*/
public void setContentDatetime(Date contentDatetime) {
this.contentDatetime = contentDatetime;
}
/**
* 获取发布时间
*/
public Date getContentDatetime() {
return this.contentDatetime;
}
/**
* 设置自定义顺序
*/
public void setContentSort(Integer contentSort) {
this.contentSort = contentSort;
}
/**
* 获取自定义顺序
*/
public Integer getContentSort() {
return this.contentSort;
}
/**
* 设置文章缩略图
*/
public void setContentImg(String contentImg) {
this.contentImg = contentImg;
}
/**
* 获取文章缩略图
*/
public String getContentImg() {
return this.contentImg;
}
/**
* 设置描述
*/
public void setContentDescription(String contentDescription) {
this.contentDescription = contentDescription;
}
/**
* 获取描述
*/
public String getContentDescription() {
return this.contentDescription;
}
/**
* 设置关键字
*/
public void setContentKeyword(String contentKeyword) {
this.contentKeyword = contentKeyword;
}
/**
* 获取关键字
*/
public String getContentKeyword() {
return this.contentKeyword;
}
/**
* 设置文章内容
*/
public void setContentDetails(String contentDetails) {
this.contentDetails = contentDetails;
}
/**
* 获取文章内容
*/
public String getContentDetails() {
return this.contentDetails;
}
/**
* 设置文章跳转链接地址
*/
public void setContentUrl(String contentUrl) {
this.contentUrl = contentUrl;
}
/**
* 获取文章跳转链接地址
*/
public String getContentUrl() {
return this.contentUrl;
}
/**
* 设置文章管理的应用id
*/
public void setAppid(Integer appid) {
this.appid = appid;
}
/**
* 获取文章管理的应用id
*/
public Integer getAppid() {
return this.appid;
}
}
\ No newline at end of file
#mcms\u7248\u672C #
version=d3a98fefcb242db78da5fc31608ff247 #Thu Nov 28 15:12:32 CST 2019
templet.file=\u6A21\u677F\u6587\u4EF6\u4E0D\u5B58\u5728 category.img=\u7F29\u7565\u56FE
id=\u6587\u7AE0\u7F16\u53F7 appid=\u6587\u7AE0\u7BA1\u7406\u7684\u5E94\u7528id
typeid=\u680F\u76EE\u7F16\u53F7 content.datetime=\u53D1\u5E03\u65F6\u95F4
order=\u6392\u5E8F category.manager.id=\u53D1\u5E03\u7528\u6237id
category.title=\u680F\u76EE\u7BA1\u7406\u540D\u79F0
category.keyword=\u680F\u76EE\u7BA1\u7406\u5173\u952E\u5B57
content.img=\u6587\u7AE0\u7F29\u7565\u56FE
category.path=\u680F\u76EE\u8DEF\u5F84
content.type=\u6587\u7AE0\u7C7B\u578B
category.url=\u5185\u5BB9\u6A21\u677F
dict.id=\u5B57\u5178\u5BF9\u5E94\u7F16\u53F7
content.author=\u6587\u7AE0\u4F5C\u8005
category.parent.id=\u7236\u7C7B\u578B\u7F16\u53F7
category.datetime=\u7C7B\u522B\u53D1\u5E03\u65F6\u95F4
category.flag=\u680F\u76EE\u5C5E\u6027
content.description=\u63CF\u8FF0
content.url=\u6587\u7AE0\u8DF3\u8F6C\u94FE\u63A5\u5730\u5740
category.sort=\u81EA\u5B9A\u4E49\u987A\u5E8F
content.title=\u6587\u7AE0\u6807\u9898
content.category.id=\u6240\u5C5E\u680F\u76EE
id=\u7F16\u53F7
app.id=\u5E94\u7528\u7F16\u53F7
category.list.url=\u5217\u8868\u6A21\u677F
mdiy.model.id=\u680F\u76EE\u7BA1\u7406\u7684\u5185\u5BB9\u6A21\u578Bid
content.source=\u6587\u7AE0\u6765\u6E90
content.display=\u662F\u5426\u663E\u793A
category.type=\u680F\u76EE\u7BA1\u7406\u5C5E\u6027
category.descrip=\u680F\u76EE\u7BA1\u7406\u63CF\u8FF0
content.details=\u6587\u7AE0\u5185\u5BB9
category.id=\u6240\u5C5E\u680F\u76EE
content.sort=\u81EA\u5B9A\u4E49\u987A\u5E8F
category.diy.url=\u81EA\u5B9A\u4E49\u94FE\u63A5
content.keyword=\u5173\u952E\u5B57
<!DOCTYPE html>
<html>
<head>
<title>分类</title>
<#include "../../include/head-file.ftl">
</head>
<body>
<div id="form" v-cloak>
<el-header class="ms-header ms-tr" height="50px">
<el-button type="primary" icon="iconfont icon-baocun" size="mini" @click="save()" :loading="saveDisabled">保存</el-button>
<el-button size="mini" icon="iconfont icon-fanhui" plain onclick="javascript:history.go(-1)">返回</el-button>
</el-header>
<el-main class="ms-container">
<el-form ref="form" :model="form" :rules="rules" label-width="120px" size="mini">
<el-row
gutter="0"
justify="start" align="top">
<el-col span="12">
<el-form-item label="栏目管理名称" prop="categoryTitle">
<el-input v-model="form.categoryTitle"
:disabled="false"
:style="{width: '100%'}"
:clearable="true"
placeholder="请输入栏目管理名称">
</el-input>
</el-form-item>
</el-col>
<el-col span="12">
<el-form-item label="所属栏目" prop="categoryId">
<tree-select :props="{value: 'id',label: 'categoryTitle',children: 'children'}"
:options="treeList" :style="{width:'100%'}"
v-model="form.categoryId"></tree-select>
</el-form-item>
</el-col>
</el-row>
<el-row
gutter="0"
justify="start" align="top">
<el-col span="12">
<el-form-item label="栏目管理属性" prop="categoryType">
<el-radio-group v-model="form.categoryType"
:style="{width: ''}"
:disabled="false">
<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>
</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="categoryListUrl">
<el-select v-model="form.categoryListUrl"
:style="{width: '100%'}"
:filterable="false"
:disabled="false"
:multiple="false" :clearable="true"
placeholder="请选择列表模板">
<el-option v-for='item in categoryListUrlOptions' :key="item.id" :value="item.id"
:label="false?item.name:item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col span="12">
<el-form-item label="内容模板" prop="categoryUrl">
<el-select v-model="form.categoryUrl"
:style="{width: '100%'}"
:filterable="false"
:disabled="false"
:multiple="false" :clearable="true"
placeholder="请选择内容模板">
<el-option v-for='item in categoryUrlOptions' :key="item.id" :value="item.id"
:label="false?item.name:item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="栏目管理关键字" prop="categoryKeyword">
<el-input
type="textarea" :rows="5"
:disabled="false"
v-model="form.categoryKeyword"
:style="{width: '100%'}"
placeholder="栏目管理关键字,有助于搜索">
</el-input>
</el-form-item>
<el-form-item label="栏目管理描述" prop="categoryDescrip">
<el-input
type="textarea" :rows="5"
:disabled="false"
v-model="form.categoryDescrip"
:style="{width: '100%'}"
placeholder="栏目管理描述,对栏目管理关键字的扩展">
</el-input>
</el-form-item>
<el-form-item label="" prop="categoryImg">
<template slot='label'>缩略图
<el-popover slot="label" placement="top-start" title="提示" width="200" trigger="hover" content="提示:栏目缩略图,最多可上传1张">
<i class="el-icon-question" slot="reference"></i>
</el-popover>
</template>
<el-upload
:file-list="form.categoryImg"
:action="ms.base+'/file/upload.do'"
:on-remove="categoryImghandleRemove"
:style="{width:''}"
:limit="1"
:on-exceed="categoryImghandleExceed"
:disabled="false"
:data="{uploadPath:'/cms/category','isRename':true}"
:on-success="categoryImgSuccess"
accept="image/*"
list-type="picture-card">
<i class="el-icon-plus"></i>
<div slot="tip" class="el-upload__tip">最多上传1张图片</div>
</el-upload>
</el-form-item>
<el-form-item label="自定义链接" prop="categoryDiyUrl">
<el-input
type="textarea" :rows="5"
:disabled="false"
v-model="form.categoryDiyUrl"
:style="{width: '100%'}"
placeholder="请输入自定义链接">
</el-input>
</el-form-item>
<el-form-item label="栏目管理的内容模型id" prop="mdiyModelId">
<el-select v-model="form.mdiyModelId"
:style="{width: '100%'}"
:filterable="false"
:disabled="false"
:multiple="false" :clearable="true"
placeholder="请选择栏目管理的内容模型id">
<el-option v-for='item in mdiyModelIdOptions' :key="item.value" :value="item.value"
:label="false?item.label:item.value"></el-option>
</el-select>
</el-form-item>
</el-form>
</el-main>
</div>
</body>
</html>
<script>
var form = new Vue({
el: '#form',
data() {
return {
treeList:[],
saveDisabled: false,
//表单数据
form: {
// 栏目管理名称
categoryTitle:'',
// 所属栏目
categoryId:'',
// 栏目管理属性
categoryType:'2',
// 自定义顺序
categorySort:0,
// 列表模板
categoryListUrl:'',
// 内容模板
categoryUrl:'',
// 栏目管理关键字
categoryKeyword:'',
// 栏目管理描述
categoryDescrip:'',
// 缩略图
categoryImg: [],
// 自定义链接
categoryDiyUrl:'',
// 栏目管理的内容模型id
mdiyModelId:'',
},
categoryTypeOptions:[{"value":"1","label":"列表"},{"value":"2","label":"封面"}],
categoryListUrlOptions:[],
categoryUrlOptions:[],
mdiyModelIdOptions:[],
rules:{
// 栏目管理名称
categoryTitle: [{"required":true,"message":"请选择栏目管理名称"},{"pattern":/^[^[!@#$%^&*()_+-/~?!@#¥%…&*()——+—?》《:“‘’]+$/,"message":"栏目管理名称格式不匹配"}],
},
}
},
watch:{
},
computed:{
},
methods: {
getTree(){
var that = this;
ms.http.get(ms.manager+"/cms/category/list.do",{pageSize:9999}).then(function(res){
if(res.result){
that.treeList = ms.util.treeData(res.data.rows,'id','categoryId','children');
}
}).catch(function(err){
console.log(err);
});
},
save() {
var that = this;
var url = ms.manager + "/cms/category/save.do"
if (that.form.id > 0) {
url = ms.manager + "/cms/category/update.do";
}
this.$refs.form.validate((valid) => {
if (valid) {
that.saveDisabled = true;
var data = JSON.parse(JSON.stringify(that.form));
if(data.id&&data.id==data.categoryId){
that.$message.error('所属栏目不能为自身')
that.saveDisabled = false;
return
}
data.categoryImg = JSON.stringify(data.categoryImg);
ms.http.post(url, data).then(function (data) {
if (data.result) {
that.$notify({
title: '成功',
message: '保存成功',
type: 'success'
});
location.href = ms.manager + "/cms/category/index.do";
} else {
that.$notify({
title: '失败',
message: data.msg,
type: 'warning'
});
}
that.saveDisabled = false;
});
} else {
return false;
}
})
},
//获取当前分类
get(id) {
var that = this;
ms.http.get(ms.manager + "/cms/category/get.do", {"id":id}).then(function (res) {
if(res.result&&res.data){
if(res.data.categoryImg){
res.data.categoryImg = JSON.parse(res.data.categoryImg);
res.data.categoryImg.forEach(function(value){
value.url= ms.base + value.path
})
}else{
res.data.categoryImg=[]
}
that.form = res.data;
}
}).catch(function (err) {
console.log(err);
});
},
//获取categoryListUrl数据源
categoryListUrlOptionsGet() {
var that = this;
ms.http.get(ms.manager+"/template/queryTemplateFileForColumn.do", {}).then(function (data) {
that.categoryListUrlOptions = data.rows;
}).catch(function (err) {
console.log(err);
});
},
//获取categoryUrl数据源
categoryUrlOptionsGet() {
var that = this;
ms.http.get(ms.manager+"/template/queryTemplateFileForColumn.do", {}).then(function (data) {
that.categoryUrlOptions = data.rows;
}).catch(function (err) {
console.log(err);
});
},
//categoryImg文件上传完成回调
categoryImgSuccess:function(response, file, fileList) {
this.form.categoryImg.push({url:file.url,name:file.name,path:response,uid:file.uid});
},
categoryImghandleRemove:function(file, files) {
var index = -1;
index = this.form.categoryImg.findIndex(text => text == file);
if (index != -1) {
this.form.categoryImg.splice(index, 1);
}
},
//categoryImg文件上传完成回调
categoryImgSuccess:function(response, file, fileList) {
this.form.categoryImg.push({url:file.url,name:file.name,path:response,uid:file.uid});
},
//上传超过限制
categoryImghandleExceed:function(files, fileList) {
this.$notify({ title: '当前最多上传1个文件', type: 'warning' });
},
categoryImghandleRemove:function(file, files) {
var index = -1;
index = this.form.categoryImg.findIndex(text => text == file);
if (index != -1) {
this.form.categoryImg.splice(index, 1);
}
},
},
created() {
this.getTree()
this.categoryListUrlOptionsGet();
this.categoryUrlOptionsGet();
this.form.id = ms.util.getParameter("id");
if (this.form.id) {
this.get(this.form.id);
}
}
});
</script>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<title>分类</title>
<#include "../../include/head-file.ftl">
</head>
<body>
<div id="index" class="ms-index" v-cloak>
<el-header class="ms-header" height="50px">
<el-col :span="12">
<@shiro.hasPermission name="cms:category:save">
<el-button type="primary" icon="el-icon-plus" size="mini" @click="save()">新增</el-button>
</@shiro.hasPermission>
<@shiro.hasPermission name="cms:category:del">
<el-button type="danger" icon="el-icon-delete" size="mini" @click="del(selectionList)" :disabled="!selectionList.length">删除</el-button>
</@shiro.hasPermission>
</el-col>
</el-header>
<el-main class="ms-container">
<el-table ref="multipleTable"
height="calc(100vh - 20px)"
border :data="dataList"
row-key="id"
v-loading="loading"
default-expand-all='true'
:tree-props="{children: 'children'}"
tooltip-effect="dark"
@selection-change="handleSelectionChange">
<template slot="empty">
{{emptyText}}
</template>
<el-table-column type="selection" width="40"></el-table-column>
<el-table-column label="栏目管理名称" align="left" prop="categoryTitle">
</el-table-column>
<el-table-column label="栏目管理属性" align="left" prop="categoryType" :formatter="categoryTypeFormat">
</el-table-column>
<el-table-column label="栏目路径" align="left" prop="categoryPath">
</el-table-column>
<el-table-column label="自定义顺序" width="100" align="right" prop="categorySort">
</el-table-column>
<el-table-column label="列表模板" align="left" prop="categoryListUrl">
</el-table-column>
<el-table-column label="内容模板" align="left" prop="categoryUrl">
</el-table-column>
<el-table-column label="操作" width="180" align="center">
<template slot-scope="scope">
<@shiro.hasPermission name="cms:category:update">
<el-link type="primary" :underline="false" @click="save(scope.row.id)">编辑</el-link>
</@shiro.hasPermission>
<@shiro.hasPermission name="cms:category:del">
<el-link type="primary" :underline="false" @click="del([scope.row])">删除</el-link>
</@shiro.hasPermission>
</template>
</el-table-column>
</el-table>
</el-main>
</div>
</body>
</html>
<script>
var indexVue = new Vue({
el: '#index',
data:{
dataList: [], //分类列表
selectionList:[],//分类列表选中
loading: true,//加载状态
emptyText:'',//提示文字
manager: ms.manager,
loadState:false,
categoryTypeOptions:[{"value":"1","label":"列表"},{"value":"2","label":"封面"}],
//搜索表单
form:{
// 栏目管理名称
categoryTitle:'',
// 所属栏目
categoryId:'',
// 栏目管理属性
categoryType:'2',
// 自定义顺序
categorySort:0,
// 列表模板
categoryListUrl:'',
// 内容模板
categoryUrl:'',
// 栏目管理关键字
categoryKeyword:'',
// 栏目管理描述
categoryDescrip:'',
// 缩略图
categoryImg: [],
// 自定义链接
categoryDiyUrl:'',
// 栏目管理的内容模型id
mdiyModelId:'',
},
},
methods:{
//查询列表
list: function() {
var that = this;
this.loadState = false;
this.loading = true;
ms.http.get(ms.manager+"/cms/category/list.do",that.form).then(
function(res) {
if(that.loadState){
that.loading = false;
}else {
that.loadState = true
}
if (!res.result||res.data.total <= 0) {
that.emptyText = '暂无数据'
that.dataList = [];
} else {
that.emptyText = '';
that.dataList = ms.util.treeData(res.data.rows,'id','mdiyModelId','children');
}
}).catch(function(err) {
console.log(err);
});
setTimeout(()=>{
if(that.loadState){
that.loading = false;
}else {
that.loadState = true
}
}, 500);
},
//分类列表选中
handleSelectionChange:function(val){
this.selectionList = val;
},
//删除
del: function(row){
var that = this;
that.$confirm('此操作将永久删除所选内容, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
ms.http.post(ms.manager+"/cms/category/delete.do", row.length?row:[row],{
headers: {
'Content-Type': 'application/json'
}
}).then(
function(res){
if (res.result) {
that.$notify({
type: 'success',
message: '删除成功!'
});
//删除成功,刷新列表
that.list();
}
});
}).catch(() => {
that.$notify({
type: 'info',
message: '已取消删除'
});
});
},
//表格数据转换
categoryTypeFormat(row, column, cellValue, index){
var value="";
if(cellValue){
var data = this.categoryTypeOptions.find(function(value){
return value.value==cellValue;
})
if(data&&data.label){
value = data.label;
}
}
return value;
},
//新增
save:function(id){
if(id){
location.href=this.manager+"/cms/category/form.do?id="+id;
}else {
location.href=this.manager+"/cms/category/form.do";
}
},
//重置表单
rest(){
this.$refs.searchForm.resetFields();
},
},
created(){
/* this.categoryListUrlOptionsGet();
this.categoryUrlOptionsGet();*/
this.list();
},
})
</script>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<title>文章</title>
<#include "../../include/head-file.ftl">
</head>
<body>
<div id="form" v-cloak>
<el-header class="ms-header ms-tr" height="50px">
<el-button type="primary" icon="iconfont icon-baocun" size="mini" @click="save()" :loading="saveDisabled">保存</el-button>
<el-button size="mini" icon="iconfont icon-fanhui" plain onclick="javascript:history.go(-1)">返回</el-button>
</el-header>
<el-main class="ms-container">
<el-form ref="form" :model="form" :rules="rules" label-width="120px" size="mini">
<el-row
gutter="0"
justify="start" align="top">
<el-col span="12">
<el-form-item label="文章标题" prop="contentTitle">
<el-input v-model="form.contentTitle"
:disabled="false"
:style="{width: '100%'}"
:clearable="true"
placeholder="请输入文章标题">
</el-input>
</el-form-item>
</el-col>
<el-col span="12">
<el-form-item label="所属栏目" prop="contentCategoryId">
<el-cascader v-model="form.contentCategoryId"
:disabled="false"
:clearable="true"
placeholder="请选择所属栏目"
:style="{width:'100%'}"
:options="contentCategoryIdTreeDatas"
:props="contentCategoryIdProps">
</el-cascader>
</el-form-item>
</el-col>
</el-row>
<el-row
gutter="0"
justify="start" align="top">
<el-col span="12">
<el-form-item label="文章类型" prop="contentType">
<el-select v-model="form.contentType"
:style="{width: '100%'}"
:filterable="false"
:disabled="false"
:multiple="true" :clearable="true"
placeholder="请选择文章类型">
<el-option v-for='item in contentTypeOptions' :key="item.dictValue" :value="item.dictValue"
:label="item.dictLabel"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col span="12">
<el-form-item label="发布时间" prop="contentDatetime">
<el-date-picker
v-model="form.contentDatetime"
placeholder="请选择发布时间"
start-placeholder=""
end-placeholder=""
:readonly="false"
:disabled="false"
:editable="true"
:clearable="true"
format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss"
:style="{width:'100%'}"
type="datetime">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row
gutter="0"
justify="start" align="top">
<el-col span="12">
<el-form-item label="文章作者" prop="contentAuthor">
<el-input v-model="form.contentAuthor"
:disabled="false"
:style="{width: '100%'}"
:clearable="true"
placeholder="请输入文章作者">
</el-input>
</el-form-item>
</el-col>
<el-col span="12">
<el-form-item label="文章来源" prop="contentSource">
<el-input v-model="form.contentSource"
:disabled="false"
:style="{width: '100%'}"
:clearable="true"
placeholder="请输入文章来源">
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row
gutter="0"
justify="start" align="top">
<el-col span="12">
<el-form-item label="" prop="contentDisplay">
<template slot='label'>是否显示
<el-popover slot="label" placement="top-start" title="提示" width="200" trigger="hover" content="选择否后前端将不显示,需要重新生成才有效果">
<i class="el-icon-question" slot="reference"></i>
</el-popover>
</template>
<el-radio-group v-model="form.contentDisplay"
:style="{width: ''}"
:disabled="false">
<el-radio :style="{display: true ? 'inline-block' : 'block'}" :label="item.value"
v-for='(item, index) in contentDisplayOptions' :key="item.value + index">
{{true? item.label : item.value}}
</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col span="12">
<el-form-item label="自定义顺序" prop="contentSort">
<el-input-number
v-model="form.contentSort"
:disabled="false"
controls-position="">
</el-input-number>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="" prop="contentImg">
<template slot='label'>文章缩略图
<el-popover slot="label" placement="top-start" title="提示" width="200" trigger="hover" content="文章缩略图,支持jpg格式">
<i class="el-icon-question" slot="reference"></i>
</el-popover>
</template>
<el-upload
:file-list="form.contentImg"
:action="ms.base+'/file/upload.do'"
:on-remove="contentImghandleRemove"
:style="{width:''}"
:limit="1"
:on-exceed="contentImghandleExceed"
:disabled="false"
:data="{uploadPath:'/cms/content','isRename':true}"
:on-success="contentImgSuccess"
accept="image/*"
list-type="picture-card">
<i class="el-icon-plus"></i>
<div slot="tip" class="el-upload__tip">最多上传1张图片</div>
</el-upload>
</el-form-item>
<el-form-item label="描述" prop="contentDescription">
<el-input
type="textarea" :rows="5"
:disabled="false"
v-model="form.contentDescription"
:style="{width: '100%'}"
placeholder="请输入对该文章的简短描述,以便用户查看文章简略">
</el-input>
</el-form-item>
<el-form-item label="关键字" prop="contentKeyword">
<el-input
type="textarea" :rows="5"
:disabled="false"
v-model="form.contentKeyword"
:style="{width: '100%'}"
placeholder="请输入文章关键字">
</el-input>
</el-form-item>
<el-form-item label="文章内容" prop="contentDetails">
<vue-ueditor-wrap style="line-height: 0px" v-model="form.contentDetails" :config="editorConfig"></vue-ueditor-wrap>
</el-form-item>
</el-form>
</el-main>
</div>
</body>
</html>
<script>
var form = new Vue({
el: '#form',
data() {
return {
date1574910623000_52656:null,
saveDisabled: false,
editorConfig:{
imageScaleEnabled :true,
autoHeightEnabled: true,
autoFloatEnabled: false,
scaleEnabled: true,
compressSide:0,
maxImageSideLength:1000,
maximumWords: 2000,
initialFrameWidth: '100%',
initialFrameHeight: 400,
serverUrl: ms.base+"/static/plugins/ueditor/1.4.3.1/jsp/editor.do?jsonConfig=%7BvideoUrlPrefix:\'"+ms.base+"\',fileUrlPrefix:\'"+ms.base+"\',imageUrlPrefix:\'"+ms.base+"\',imagePathFormat:\'/upload/cms/content/editor/%7Btime%7D\',filePathFormat:\'/upload/cms/content/editor/%7Btime%7D\',videoPathFormat:\'/upload/cms/content/editor/%7Btime%7D\'%7D",
UEDITOR_HOME_URL: ms.base+'/static/plugins/ueditor/1.4.3.1/'
},
contentCategoryIdOptions:[],
contentCategoryIdProps:{
checkStrictly :false,emitPath: false,
label: 'categoryTitle',
value:'id'
},
//表单数据
form: {
// 文章标题
contentTitle:'',
// 所属栏目
contentCategoryId: [],
// 文章类型
contentType: [],
// 是否显示
contentDisplay:'0',
// 文章作者
contentAuthor:'',
// 文章来源
contentSource:'',
// 自定义顺序
contentSort:0,
// 文章缩略图
contentImg: [],
// 描述
contentDescription:'',
// 关键字
contentKeyword:'',
// 文章内容
contentDetails:'',
},
contentTypeOptions:[],
contentDisplayOptions:[{"value":"0","label":"是"},{"value":"1","label":"否"}],
rules:{
// 文章标题
contentTitle: [{"required":true,"message":"请选择文章标题"}],
// 发布时间
contentDatetime: [{"required":true,"message":"发布时间不能为空"}],
},
}
},
watch:{
},
computed:{
contentCategoryIdTreeDatas(){
let cloneData = JSON.parse(JSON.stringify(this.contentCategoryIdOptions)) // 对源数据深度克隆
return cloneData.filter(father=>{
let branchArr = cloneData.filter(child=>father.categoryId == child.categoryCategoryId) //返回每一项的子级数组
branchArr.length>0 ? father.children = branchArr : '' //如果存在子级,则给父级添加一个children属性,并赋值
return father.categoryCategoryId==0; //返回第一层
});
},
},
methods: {
save() {
var that = this;
var url = ms.manager + "/cms/content/save.do"
if (that.form.id > 0) {
url = ms.manager + "/cms/content/update.do";
}
this.$refs.form.validate((valid) => {
if (valid) {
that.saveDisabled = true;
var data = JSON.parse(JSON.stringify(that.form));
data.contentCategoryId = data.contentCategoryId.join(',');
data.contentType = data.contentType.join(',');
data.contentImg = JSON.stringify(data.contentImg);
ms.http.post(url, data).then(function (data) {
if (data.result) {
that.$notify({
title: '成功',
message: '保存成功',
type: 'success'
});
location.href = ms.manager + "/cms/content/index.do";
} else {
that.$notify({
title: '失败',
message: data.msg,
type: 'warning'
});
}
that.saveDisabled = false;
});
} else {
return false;
}
})
},
//获取当前文章
get(id) {
var that = this;
ms.http.get(ms.manager + "/cms/content/get.do", {"id":id}).then(function (res) {
if(res.result&&res.data){
res.data.contentCategoryId = res.data.contentCategoryId.split(',');
res.data.contentType = res.data.contentType.split(',');
if(res.data.contentImg){
res.data.contentImg = JSON.parse(res.data.contentImg);
res.data.contentImg.forEach(function(value){
value.url= ms.base + value.path
})
}else{
res.data.contentImg=[]
}
that.form = res.data;
}
}).catch(function (err) {
console.log(err);
});
},
//获取contentCategoryId数据源
contentCategoryIdOptionsGet() {
var that = this;
ms.http.get(ms.manager+'/mdiy/dict/list.do', {}).then(function (data) {
that.contentCategoryIdOptions = data.rows;
}).catch(function (err) {
console.log(err);
});
},
//获取contentType数据源
contentTypeOptionsGet() {
var that = this;
ms.http.get(ms.base+'/mdiy/dict/list.do', {dictType:'文章属性',pageSize:99999}).then(function (data) {
that.contentTypeOptions = data.rows;
}).catch(function (err) {
console.log(err);
});
},
//contentImg文件上传完成回调
contentImgSuccess:function(response, file, fileList) {
this.form.contentImg.push({url:file.url,name:file.name,path:response,uid:file.uid});
},
contentImghandleRemove:function(file, files) {
var index = -1;
index = this.form.contentImg.findIndex(text => text == file);
if (index != -1) {
this.form.contentImg.splice(index, 1);
}
},
//contentImg文件上传完成回调
contentImgSuccess:function(response, file, fileList) {
this.form.contentImg.push({url:file.url,name:file.name,path:response,uid:file.uid});
},
//上传超过限制
contentImghandleExceed:function(files, fileList) {
this.$notify({ title: '当前最多上传1个文件', type: 'warning' });
},
contentImghandleRemove:function(file, files) {
var index = -1;
index = this.form.contentImg.findIndex(text => text == file);
if (index != -1) {
this.form.contentImg.splice(index, 1);
}
},
},
created() {
this.contentCategoryIdOptionsGet();
this.contentTypeOptionsGet();
this.form.id = ms.util.getParameter("id");
if (this.form.id) {
this.get(this.form.id);
}
}
});
</script>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>文章</title>
<#include "../../include/head-file.ftl">
<#include "../../include/increase-search.ftl">
</head>
<body style="overflow: hidden">
<div id="index" v-cloak>
<!--左侧-->
<el-container class="index-menu">
<div class="left-tree"></div>
<iframe :src="action" class="ms-iframe-style">
</iframe>
</el-container>
</div>
</body>
</html>
<script>
var indexVue = new Vue({
el: "#index",
data: {
action:"", //跳转页面
},
methods:{
},
mounted(){
this.action = ms.manager +"/cms/content/main.do";
}
})
</script>
<style>
#index .index-menu {
min-height: 100vh;
min-width: 140px;
}
#index .ms-iframe-style {
width: 100%;
border: 0;
}
#index .index-menu .el-main {
padding: 0;
}
#index .left-tree{
min-height: 100vh;
background: #fff;
width: 180px;
border-right: solid 1px #e6e6e6;
}
#index .index-menu .el-main .index-menu-menu .el-menu-item {
min-width: 140px;
width: 100%;
}
#index .index-menu .el-main .index-material-item {
min-width: 100% !important
}
#index .index-menu-menu-item , .el-submenu__title {
height: 40px !important;
line-height: 46px !important;
}
</style>
<!DOCTYPE html>
<html>
<head>
<title>文章主体</title>
<#include "../../include/head-file.ftl">
<#include "../../include/increase-search.ftl">
</head>
<body>
<div id="main" class="ms-index" v-cloak>
<ms-search ref="search" @search="search" :condition-data="conditionList" :conditions="conditions"></ms-search>
<el-header class="ms-header" height="50px">
<el-col :span="12">
<@shiro.hasPermission name="cms:content:save">
<el-button type="primary" icon="el-icon-plus" size="mini" @click="save()">新增</el-button>
</@shiro.hasPermission>
<@shiro.hasPermission name="cms:content:del">
<el-button type="danger" icon="el-icon-delete" size="mini" @click="del(selectionList)" :disabled="!selectionList.length">删除</el-button>
</@shiro.hasPermission>
</el-col>
</el-header>
<div class="ms-search">
<el-row>
<el-form :model="form" ref="searchForm" label-width="120px" size="mini">
<el-row>
<el-col :span="8">
<el-form-item label="文章标题" prop="contentTitle">
<el-input v-model="form.contentTitle"
:disabled="false"
:style="{width: '100%'}"
:clearable="true"
placeholder="请输入文章标题">
</el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="文章类型" prop="contentType">
<el-select v-model="form.contentType"
:style="{width: '100%'}"
:filterable="false"
:disabled="false"
:multiple="true" :clearable="true"
placeholder="请选择文章类型">
<el-option v-for='item in contentTypeOptions' :key="item.dictValue" :value="item.dictValue"
:label="item.dictLabel"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8" style="text-align: right;padding-right: 10px;">
<el-button type="primary" icon="el-icon-search" size="mini" @click="form.sqlWhere=null;currentPage=1;list()">查询</el-button>
<el-button type="primary" icon="el-icon-search" size="mini" @click="$refs.search.open()">筛选</el-button>
<el-button @click="rest" icon="el-icon-refresh" size="mini">重置</el-button>
</el-col>
</el-row>
</el-form>
</el-row>
</div>
<el-main class="ms-container">
<el-table height="calc(100vh - 68px)" v-loading="loading" ref="multipleTable" border :data="dataList" tooltip-effect="dark" @selection-change="handleSelectionChange">
<template slot="empty">
{{emptyText}}
</template>
<el-table-column type="selection" width="40"></el-table-column>
<el-table-column label="所属栏目" align="left" prop="contentCategoryId" :formatter="contentCategoryIdFormat">
</el-table-column>
<el-table-column label="文章标题" align="left" prop="contentTitle">
</el-table-column>
<el-table-column label="文章作者" align="left" prop="contentAuthor">
</el-table-column>
<el-table-column label="自定义顺序" width="100" align="right" prop="contentSort">
</el-table-column>
<el-table-column label="发布时间" width="180" align="center" prop="contentDatetime">
</el-table-column>
<el-table-column label="操作" width="180" align="center">
<template slot-scope="scope">
<@shiro.hasPermission name="cms:content:update">
<el-link type="primary" :underline="false" @click="save(scope.row.id)">编辑</el-link>
</@shiro.hasPermission>
<@shiro.hasPermission name="cms:content:del">
<el-link type="primary" :underline="false" @click="del([scope.row])">删除</el-link>
</@shiro.hasPermission>
</template>
</el-table-column>
</el-table>
<el-pagination
background
:page-sizes="[10,20,30,40,50,100]"
layout="total, sizes, prev, pager, next, jumper"
:current-page="currentPage"
:page-size="pageSize"
:total="total"
class="ms-pagination"
@current-change='currentChange'
@size-change="sizeChange">
</el-pagination>
</el-main>
</div>
</body>
</html>
<script>
var mainVue = new Vue({
el: '#main',
data:{
conditionList:[
{action:'and', field: 'content_title', el: 'eq', model: 'contentTitle', name: '文章标题', type: 'input'},
{action:'and', field: 'content_category_id', el: 'eq', model: 'contentCategoryId', name: '所属栏目', type: 'cascader', multiple: false},
{action:'and', field: 'content_type', el: 'eq', model: 'contentType', name: '文章类型', type: 'checkbox', label: false, multiple: true},
{action:'and', field: 'content_display', el: 'eq', model: 'contentDisplay', name: '是否显示', type: 'radio', label: true, multiple: false},
{action:'and', field: 'content_author', el: 'eq', model: 'contentAuthor', name: '文章作者', type: 'input'},
{action:'and', field: 'content_source', el: 'eq', model: 'contentSource', name: '文章来源', type: 'input'},
{action:'and', field: 'content_datetime', model: 'contentDatetime', el: 'gt', name: '发布时间', type: 'date'},
{action:'and', field: 'content_sort', el: 'eq', model: 'contentSort', name: '自定义顺序', type: 'number'},
{action:'and', field: 'content_description', el: 'eq', model: 'contentDescription', name: '描述', type: 'textarea'},
{action:'and', field: 'content_keyword', el: 'eq', model: 'contentKeyword', name: '关键字', type: 'textarea'},
{action:'and', field: 'content_details', el: 'like', model: 'contentDetails', name: '文章内容', type: 'input'},
{action:'and', field: 'content_url', el: 'eq', model: 'contentUrl', name: '文章跳转链接地址', type: 'input'},
{action:'and', field: 'appid', el: 'eq', model: 'appid', name: '文章管理的应用id', type: 'number'},
{action:'and', field: 'create_date', el: 'eq', model: 'createDate', name: '创建时间', type: 'date'},
{action:'and', field: 'update_date', el: 'eq', model: 'updateDate', name: '修改时间', type: 'date'},
],
conditions:[],
dataList: [], //文章列表
selectionList:[],//文章列表选中
total: 0, //总记录数量
pageSize: 10, //页面数量
currentPage:1, //初始页
manager: ms.manager,
loadState:false,
loading: true,//加载状态
emptyText:'',//提示文字
contentTypeOptions:[],
contentDisplayOptions:[{"value":"0","label":"是"},{"value":"1","label":"否"}],
//搜索表单
form:{
sqlWhere:null,
// 文章标题
contentTitle:null,
// 文章类型
contentType:null,
},
},
methods:{
//查询列表
list: function() {
var that = this;
that.loading = true;
that.loadState = false;
var page={
pageNo: that.currentPage,
pageSize : that.pageSize
}
var form = JSON.parse(JSON.stringify(that.form))
for (key in form){
if(!form[key]){
delete form[key]
}
}
history.replaceState({form:form,page:page},"");
ms.http.post(ms.manager+"/cms/content/list.do",form.sqlWhere?{
sqlWhere:form.sqlWhere,
...page
}:{...form,
...page
}).then(
function(res) {
if(that.loadState){
that.loading = false;
}else {
that.loadState = true
}
if (!res.result||res.data.total <= 0) {
that.emptyText = '暂无数据'
that.dataList = [];
} else {
that.emptyText = '';
that.total = res.data.total;
that.dataList = res.data.rows;
}
}).catch(function(err) {
that.loading = false;
console.log(err);
});
setTimeout(()=>{
if(that.loadState){
that.loading = false;
}else {
that.loadState = true
}
}, 500);
},
//文章列表选中
handleSelectionChange:function(val){
this.selectionList = val;
},
//删除
del: function(row){
var that = this;
that.$confirm('此操作将永久删除所选内容, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
ms.http.post(ms.manager+"/cms/content/delete.do", row.length?row:[row],{
headers: {
'Content-Type': 'application/json'
}
}).then(
function(res){
if (res.result) {
that.$notify({
type: 'success',
message: '删除成功!'
});
//删除成功,刷新列表
that.list();
}
});
}).catch(() => {
that.$notify({
type: 'info',
message: '已取消删除'
});
});
},
//新增
save:function(id){
if(id){
location.href=this.manager+"/cms/content/form.do?id="+id;
}else {
location.href=this.manager+"/cms/content/form.do";
}
},
//表格数据转换
contentCategoryIdFormat(row, column, cellValue, index){
var value="";
if(cellValue){
var data = this.contentCategoryIdOptions.find(function(value){
return value.id==cellValue;
})
if(data&&data.categoryTitle){
value = data.categoryTitle;
}
}
return value;
},
contentDisplayFormat(row, column, cellValue, index){
var value="";
if(cellValue){
var data = this.contentDisplayOptions.find(function(value){
return value.value==cellValue;
})
if(data&&data.label){
value = data.label;
}
}
return value;
},
//pageSize改变时会触发
sizeChange:function(pagesize) {
this.loading = true;
this.pageSize = pagesize;
this.list();
},
//currentPage改变时会触发
currentChange:function(currentPage) {
this.loading = true;
this.currentPage = currentPage;
this.list();
},
search(data){
this.form.sqlWhere = JSON.stringify(data);
this.list();
},
//重置表单
rest(){
this.form.sqlWhere = null;
this.$refs.searchForm.resetFields();
this.list();
},
//获取contentCategoryId数据源
contentCategoryIdOptionsGet() {
var that = this;
ms.http.get(ms.manager+'/mdiy/dict/list.do', {}).then(function (data) {
that.contentCategoryIdOptions = data.rows;
}).catch(function (err) {
console.log(err);
});
},
//获取contentType数据源
contentTypeOptionsGet() {
var that = this;
ms.http.get(ms.base+'/mdiy/dict/list.do', {dictType:'文章属性',pageSize:99999}).then(function (data) {
that.contentTypeOptions = data.rows;
}).catch(function (err) {
console.log(err);
});
},
},
mounted(){
this.contentCategoryIdOptionsGet();
this.contentTypeOptionsGet();
if(history.state){
this.form = history.state.form;
this.currentPage = history.state.page.pageNo;
this.pageSize = history.state.page.pageSize;
}
this.list();
},
})
</script>
<style>
#main .ms-search {
padding: 20px 0 0;
}
#main .ms-container {
height: calc(100vh - 141px);
}
</style>
\ 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