Commit d9ad22de authored by Huang's avatar Huang
Browse files

no commit message

parent c235571d
/**
* Copyright &copy; 2012-2016 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpring</a>All rights reserved.
*/
package com.jeespring.modules.cms.web.front;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.google.common.collect.Lists;
import com.jeespring.common.config.Global;
import com.jeespring.common.persistence.Page;
import com.jeespring.common.servlet.ValidateCodeServlet;
import com.jeespring.common.utils.StringUtils;
import com.jeespring.common.web.AbstractBaseController;
import com.jeespring.modules.cms.entity.Article;
import com.jeespring.modules.cms.entity.Category;
import com.jeespring.modules.cms.entity.Comment;
import com.jeespring.modules.cms.entity.Link;
import com.jeespring.modules.cms.entity.Site;
import com.jeespring.modules.cms.service.ArticleDataService;
import com.jeespring.modules.cms.service.ArticleService;
import com.jeespring.modules.cms.service.CategoryService;
import com.jeespring.modules.cms.service.CommentService;
import com.jeespring.modules.cms.service.LinkService;
import com.jeespring.modules.cms.service.SiteService;
import com.jeespring.modules.cms.utils.CmsUtils;
/**
* 网站Controller
* @author JeeSpring
* @version 2013-5-29
*/
@Controller
@RequestMapping(value = "${frontPath}")
public class FrontController extends AbstractBaseController{
@Autowired
private ArticleService articleService;
@Autowired
private ArticleDataService articleDataService;
@Autowired
private LinkService linkService;
@Autowired
private CommentService commentService;
@Autowired
private CategoryService categoryService;
@Autowired
private SiteService siteService;
/**
* 网站首页
*/
@RequestMapping
public String index(Model model,HttpServletRequest request, HttpServletResponse response) {
Site site = CmsUtils.getSite(Site.defaultSiteId());
model.addAttribute("site", site);
model.addAttribute("isIndex", true);
if(request.getParameter("theme")!=null){
site.setTheme(request.getParameter("theme"));
}
return "modules/cms/front/themes/"+site.getTheme()+"/frontIndex";
}
@RequestMapping(value = "index2")
public String index2(Model model,HttpServletRequest request, HttpServletResponse response) {
Site site = CmsUtils.getSite(Site.defaultSiteId());
model.addAttribute("site", site);
model.addAttribute("isIndex", true);
if(request.getParameter("theme")!=null){
site.setTheme(request.getParameter("theme"));
}
return "modules/cms/front/themes/"+site.getTheme()+"/index";
}
/**
* 网站首页
*/
@RequestMapping(value = "index-{siteId}${urlSuffix}")
public String index(@PathVariable String siteId, Model model) {
if ("1".equals(siteId)){
return "redirect:"+Global.getFrontPath();
}
Site site = CmsUtils.getSite(siteId);
// 子站有独立页面,则显示独立页面
if (StringUtils.isNotBlank(site.getCustomIndexView())){
model.addAttribute("site", site);
model.addAttribute("isIndex", true);
return "modules/cms/front/themes/"+site.getTheme()+"/frontIndex"+site.getCustomIndexView();
}
// 否则显示子站第一个栏目
List<Category> mainNavList = CmsUtils.getMainNavList(siteId);
if (mainNavList.size() > 0){
String firstCategoryId = CmsUtils.getMainNavList(siteId).get(0).getId();
return "redirect:"+Global.getFrontPath()+"/list-"+firstCategoryId+Global.getUrlSuffix();
}else{
model.addAttribute("site", site);
return "modules/cms/front/themes/"+site.getTheme()+"/frontListCategory";
}
}
/**
* 内容列表
*/
@RequestMapping(value = "list-{categoryId}${urlSuffix}")
public String list(@PathVariable String categoryId, @RequestParam(required=false, defaultValue="1") Integer pageNo,
@RequestParam(required=false, defaultValue="15") Integer pageSize, Model model) {
Category category = categoryService.get(categoryId);
if (category==null){
Site site = CmsUtils.getSite(Site.defaultSiteId());
model.addAttribute("site", site);
return "error/404";
}
Site site = siteService.get(category.getSite().getId());
model.addAttribute("site", site);
// 2:简介类栏目,栏目第一条内容
if("2".equals(category.getShowModes()) && "article".equals(category.getModule())){
// 如果没有子栏目,并父节点为跟节点的,栏目列表为当前栏目。
List<Category> categoryList = Lists.newArrayList();
if ("1".equals(category.getParent().getId())){
categoryList.add(category);
}else{
categoryList = categoryService.findByParentId(category.getParent().getId(), category.getSite().getId());
}
model.addAttribute("category", category);
model.addAttribute("categoryList", categoryList);
// 获取文章内容
Page<Article> page = new Page<Article>(1, 1, -1);
Article article = new Article(category);
page = articleService.findPage(page, article, false);
if (page.getList().size()>0){
article = page.getList().get(0);
article.setArticleData(articleDataService.get(article.getId()));
articleService.updateHitsAddOne(article.getId());
}
model.addAttribute("article", article);
CmsUtils.addViewConfigAttribute(model, category);
CmsUtils.addViewConfigAttribute(model, article.getViewConfig());
return "modules/cms/front/themes/"+site.getTheme()+"/"+getTpl(article);
}else{
List<Category> categoryList = categoryService.findByParentId(category.getId(), category.getSite().getId());
// 展现方式为1 、无子栏目或公共模型,显示栏目内容列表
if("1".equals(category.getShowModes())||categoryList.size()==0){
// 有子栏目并展现方式为1,则获取第一个子栏目;无子栏目,则获取同级分类列表。
if(categoryList.size()>0){
category = categoryList.get(0);
}else{
// 如果没有子栏目,并父节点为跟节点的,栏目列表为当前栏目。
if ("1".equals(category.getParent().getId())){
categoryList.add(category);
}else{
categoryList = categoryService.findByParentId(category.getParent().getId(), category.getSite().getId());
}
}
model.addAttribute("category", category);
model.addAttribute("categoryList", categoryList);
// 获取内容列表
if ("article".equals(category.getModule())){
Page<Article> page = new Page<Article>(pageNo, pageSize);
//System.out.println(page.getPageNo());
page = articleService.findPage(page, new Article(category), false);
model.addAttribute("page", page);
// 如果第一个子栏目为简介类栏目,则获取该栏目第一篇文章
if ("2".equals(category.getShowModes())){
Article article = new Article(category);
if (page.getList().size()>0){
article = page.getList().get(0);
article.setArticleData(articleDataService.get(article.getId()));
articleService.updateHitsAddOne(article.getId());
}
model.addAttribute("article", article);
CmsUtils.addViewConfigAttribute(model, category);
CmsUtils.addViewConfigAttribute(model, article.getViewConfig());
return "modules/cms/front/themes/"+site.getTheme()+"/"+getTpl(article);
}
}else if ("link".equals(category.getModule())){
Page<Link> page = new Page<Link>(1, -1);
page = linkService.findPage(page, new Link(category), false);
model.addAttribute("page", page);
}
String view = "/frontList";
if (StringUtils.isNotBlank(category.getCustomListView())){
view = "/"+category.getCustomListView();
}
CmsUtils.addViewConfigAttribute(model, category);
site =siteService.get(category.getSite().getId());
//System.out.println("else 栏目第一条内容 _2 :"+category.getSite().getTheme()+","+site.getTheme());
return "modules/cms/front/themes/"+siteService.get(category.getSite().getId()).getTheme()+view;
//return "modules/cms/front/themes/"+category.getSite().getTheme()+view;
}
// 有子栏目:显示子栏目列表
else{
model.addAttribute("category", category);
model.addAttribute("categoryList", categoryList);
String view = "/frontListCategory";
if (StringUtils.isNotBlank(category.getCustomListView())){
view = "/"+category.getCustomListView();
}
CmsUtils.addViewConfigAttribute(model, category);
return "modules/cms/front/themes/"+site.getTheme()+view;
}
}
}
/**
* 内容列表(通过url自定义视图)
*/
@RequestMapping(value = "listc-{categoryId}-{customView}${urlSuffix}")
public String listCustom(@PathVariable String categoryId, @PathVariable String customView, @RequestParam(required=false, defaultValue="1") Integer pageNo,
@RequestParam(required=false, defaultValue="15") Integer pageSize, Model model) {
Category category = categoryService.get(categoryId);
if (category==null){
Site site = CmsUtils.getSite(Site.defaultSiteId());
model.addAttribute("site", site);
return "error/404";
}
Site site = siteService.get(category.getSite().getId());
model.addAttribute("site", site);
List<Category> categoryList = categoryService.findByParentId(category.getId(), category.getSite().getId());
model.addAttribute("category", category);
model.addAttribute("categoryList", categoryList);
CmsUtils.addViewConfigAttribute(model, category);
return "modules/cms/front/themes/"+site.getTheme()+"/frontListCategory"+customView;
}
/**
* 显示内容
*/
@RequestMapping(value = "view-{categoryId}-{contentId}${urlSuffix}")
public String view(@PathVariable String categoryId, @PathVariable String contentId, Model model) {
Category category = categoryService.get(categoryId);
if (category==null){
Site site = CmsUtils.getSite(Site.defaultSiteId());
model.addAttribute("site", site);
return "error/404";
}
model.addAttribute("site", category.getSite());
if ("article".equals(category.getModule())){
// 如果没有子栏目,并父节点为跟节点的,栏目列表为当前栏目。
List<Category> categoryList = Lists.newArrayList();
if ("1".equals(category.getParent().getId())){
categoryList.add(category);
}else{
categoryList = categoryService.findByParentId(category.getParent().getId(), category.getSite().getId());
}
// 获取文章内容
Article article = articleService.get(contentId);
if (article==null || !Article.DEL_FLAG_NORMAL.equals(article.getDelFlag())){
return "error/404";
}
// 文章阅读次数+1
articleService.updateHitsAddOne(contentId);
// 获取推荐文章列表
List<Object[]> relationList = articleService.findByIds(articleDataService.get(article.getId()).getRelation());
// 将数据传递到视图
model.addAttribute("category", categoryService.get(article.getCategory().getId()));
model.addAttribute("categoryList", categoryList);
article.setArticleData(articleDataService.get(article.getId()));
model.addAttribute("article", article);
model.addAttribute("relationList", relationList);
CmsUtils.addViewConfigAttribute(model, article.getCategory());
CmsUtils.addViewConfigAttribute(model, article.getViewConfig());
Site site = siteService.get(category.getSite().getId());
model.addAttribute("site", site);
// return "modules/cms/front/themes/"+category.getSite().getTheme()+"/"+getTpl(article);
return "modules/cms/front/themes/"+site.getTheme()+"/"+getTpl(article);
}
return "error/404";
}
/**
* 内容评论
*/
@RequestMapping(value = "comment", method=RequestMethod.GET)
public String comment(String theme, Comment comment, HttpServletRequest request, HttpServletResponse response, Model model) {
Page<Comment> page = new Page<Comment>(request, response);
Comment c = new Comment();
c.setCategory(comment.getCategory());
c.setContentId(comment.getContentId());
c.setDelFlag(Comment.DEL_FLAG_NORMAL);
page = commentService.findPage(page, c);
model.addAttribute("page", page);
model.addAttribute("comment", comment);
return "modules/cms/front/themes/"+theme+"/frontComment";
}
/**
* 内容评论保存
*/
@ResponseBody
@RequestMapping(value = "comment", method=RequestMethod.POST)
public String commentSave(Comment comment, String validateCode,@RequestParam(required=false) String replyId, HttpServletRequest request) {
if (StringUtils.isNotBlank(validateCode)){
if (ValidateCodeServlet.validate(request, validateCode)){
if (StringUtils.isNotBlank(replyId)){
Comment replyComment = commentService.get(replyId);
if (replyComment != null){
comment.setContent("<div class=\"reply\">"+replyComment.getName()+":<br/>"
+replyComment.getContent()+"</div>"+comment.getContent());
}
}
comment.setIp(request.getRemoteAddr());
comment.setCreateDate(new Date());
comment.setDelFlag(Comment.DEL_FLAG_AUDIT);
commentService.save(comment);
return "{result:1, message:'提交成功。'}";
}else{
return "{result:2, message:'验证码不正确。'}";
}
}else{
return "{result:2, message:'验证码不能为空。'}";
}
}
/**
* 站点地图
*/
@RequestMapping(value = "map-{siteId}${urlSuffix}")
public String map(@PathVariable String siteId, Model model) {
Site site = CmsUtils.getSite(siteId!=null?siteId:Site.defaultSiteId());
model.addAttribute("site", site);
return "modules/cms/front/themes/"+site.getTheme()+"/frontMap";
}
private String getTpl(Article article){
if(StringUtils.isBlank(article.getCustomContentView())){
String view = null;
Category c = article.getCategory();
boolean goon = true;
do{
if(StringUtils.isNotBlank(c.getCustomContentView())){
view = c.getCustomContentView();
goon = false;
}else if(c.getParent() == null || c.getParent().isRoot()){
goon = false;
}else{
c = c.getParent();
}
}while(goon);
return StringUtils.isBlank(view) ? Article.DEFAULT_TEMPLATE : view;
}else{
return article.getCustomContentView();
}
}
}
/**
* Copyright &copy; 2012-2016 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpring</a>All rights reserved.
*/
package com.jeespring.modules.cms.web.front;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.jeespring.common.config.Global;
import com.jeespring.common.persistence.Page;
import com.jeespring.common.web.AbstractBaseController;
import com.jeespring.modules.cms.entity.Guestbook;
import com.jeespring.modules.cms.entity.Site;
import com.jeespring.modules.cms.service.GuestbookService;
import com.jeespring.modules.cms.utils.CmsUtils;
/**
* 留言板Controller
* @author JeeSpring
* @version 2013-3-15
*/
@Controller
@RequestMapping(value = "${frontPath}/guestbook")
public class FrontGuestbookController extends AbstractBaseController {
@Autowired
private GuestbookService guestbookService;
/**
* 留言板
*/
@RequestMapping(value = "", method=RequestMethod.GET)
public String guestbook(@RequestParam(required=false, defaultValue="1") Integer pageNo,
@RequestParam(required=false, defaultValue="30") Integer pageSize, Model model) {
Site site = CmsUtils.getSite(Site.defaultSiteId());
model.addAttribute("site", site);
Page<Guestbook> page = new Page<Guestbook>(pageNo, pageSize);
Guestbook guestbook = new Guestbook();
guestbook.setDelFlag(Guestbook.DEL_FLAG_NORMAL);
page = guestbookService.findPage(page, guestbook);
model.addAttribute("page", page);
return "modules/cms/front/themes/"+site.getTheme()+"/frontGuestbook";
}
/**
* 留言板-保存留言信息
*/
@RequestMapping(value = "", method=RequestMethod.POST)
public String guestbookSave(Guestbook guestbook, String validateCode, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
// if (StringUtils.isNotBlank(validateCode)){
// if (ValidateCodeServlet.validate(request, validateCode)){
guestbook.setIp(request.getRemoteAddr());
guestbook.setCreateDate(new Date());
guestbook.setDelFlag(Guestbook.DEL_FLAG_AUDIT);
guestbookService.save(guestbook);
addMessage(redirectAttributes, "提交成功,谢谢!");
// }else{
// addMessage(redirectAttributes, "验证码不正确。");
// }
// }else{
// addMessage(redirectAttributes, "验证码不能为空。");
// }
return "redirect:"+Global.getFrontPath()+"/guestbook";
}
}
/**
* Copyright &copy; 2012-2016 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpring</a>All rights reserved.
*/
package com.jeespring.modules.cms.web.front;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.jeespring.common.persistence.Page;
import com.jeespring.common.utils.StringUtils;
import com.jeespring.common.web.AbstractBaseController;
import com.jeespring.modules.cms.entity.Article;
import com.jeespring.modules.cms.entity.Guestbook;
import com.jeespring.modules.cms.entity.Site;
import com.jeespring.modules.cms.service.ArticleService;
import com.jeespring.modules.cms.service.GuestbookService;
import com.jeespring.modules.cms.utils.CmsUtils;
import com.jeespring.modules.sys.utils.UserUtils;
/**
* 网站搜索Controller
* @author JeeSpring
* @version 2013-5-29
*/
@Controller
@RequestMapping(value = "${frontPath}/search")
public class FrontSearchController extends AbstractBaseController{
@Autowired
private ArticleService articleService;
@Autowired
private GuestbookService guestbookService;
/**
* 全站搜索
*/
@RequestMapping(value = "")
public String search(String t, @RequestParam(required=false) String q, @RequestParam(required=false) String qand, @RequestParam(required=false) String qnot,
@RequestParam(required=false) String a, @RequestParam(required=false) String cid, @RequestParam(required=false) String bd,
@RequestParam(required=false) String ed, HttpServletRequest request, HttpServletResponse response, Model model) {
long start = System.currentTimeMillis();
Site site = CmsUtils.getSite(Site.defaultSiteId());
model.addAttribute("site", site);
// 重建索引(需要超级管理员权限)
if ("cmd:reindex".equals(q)){
if (UserUtils.getUser().isAdmin()){
// 文章模型
if (StringUtils.isBlank(t) || "article".equals(t)){
articleService.createIndex();
}
// 留言模型
else if ("guestbook".equals(t)){
guestbookService.createIndex();
}
model.addAttribute("message", "重建索引成功,共耗时 " + (System.currentTimeMillis() - start) + "毫秒。");
}else{
model.addAttribute("message", "你没有执行权限。");
}
}
// 执行检索
else{
String qStr = StringUtils.replace(StringUtils.replace(q, ",", " "), ", ", " ");
// 如果是高级搜索
if ("1".equals(a)){
if (StringUtils.isNotBlank(qand)){
qStr += " +" + StringUtils.replace(StringUtils.replace(StringUtils.replace(qand, ",", " "), ", ", " "), " ", " +");
}
if (StringUtils.isNotBlank(qnot)){
qStr += " -" + StringUtils.replace(StringUtils.replace(StringUtils.replace(qnot, ",", " "), ", ", " "), " ", " -");
}
}
// 文章检索
if (StringUtils.isBlank(t) || "article".equals(t)){
Page<Article> page = articleService.search(new Page<Article>(request, response), qStr, cid, bd, ed);
page.setMessage("匹配结果,共耗时 " + (System.currentTimeMillis() - start) + "毫秒。");
model.addAttribute("page", page);
}
// 留言检索
else if ("guestbook".equals(t)){
Page<Guestbook> page = guestbookService.search(new Page<Guestbook>(request, response), qStr, bd, ed);
page.setMessage("匹配结果,共耗时 " + (System.currentTimeMillis() - start) + "毫秒。");
model.addAttribute("page", page);
}
}
model.addAttribute("t", t);// 搜索类型
model.addAttribute("q", q);// 搜索关键字
model.addAttribute("qand", qand);// 包含以下全部的关键词
model.addAttribute("qnot", qnot);// 不包含以下关键词
model.addAttribute("cid", cid);// 搜索类型
return "modules/cms/front/themes/"+site.getTheme()+"/frontSearch";
}
}
/**
* Copyright &copy; 2012-2016 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpring</a>All rights reserved.
*/
package com.jeespring.modules.cms.web.front;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.jeespring.common.web.AbstractBaseController;
import com.jeespring.modules.cms.utils.WiexinSignUtil;
/**
* 测试Controller
* @author JeeSpring
* @version 2014-02-28
*/
@Controller
@RequestMapping(value = "${frontPath}/weixin")
public class WeixinController extends AbstractBaseController {
/**
*
* @param signature 微信加密签名,signature结合了开发者填写的token参数和请求中的timestamp参数、nonce参数。
* @param timestamp 时间戳
* @param nonce 随机数
* @param echostr 随机数
* @return
*/
@RequestMapping(value = "", method = RequestMethod.GET)
@ResponseBody
public String get(String signature, String timestamp, String nonce, String echostr, HttpServletRequest request) {
System.out.println("=============================================== get start");
for (Object o : request.getParameterMap().keySet()){
System.out.println(o + " = " + request.getParameter((String)o));
}
System.out.println("=============================================== get end");
// 通过检验signature对请求进行校验,若校验成功则原样返回echostr,表示接入成功,否则接入失败
if (WiexinSignUtil.checkSignature(signature, timestamp, nonce)) {
return echostr;
}
return "";
}
@RequestMapping(value = "", method = RequestMethod.POST)
@ResponseBody
public String post(String signature, String timestamp, String nonce, String echostr, HttpServletRequest request) {
System.out.println("=============================================== post start");
for (Object o : request.getParameterMap().keySet()){
System.out.println(o + " = " + request.getParameter((String)o));
}
System.out.println("=============================================== post end");
StringBuilder result = new StringBuilder();
result.append("<xml>" +
"<ToUserName><![CDATA[toUser]]></ToUserName>" +
"<FromUserName><![CDATA[fromUser]]></FromUserName>" +
"<CreateTime>12345678</CreateTime>" +
"<MsgType><![CDATA[text]]></MsgType>" +
"<Content><![CDATA[你好]]></Content>" +
"</xml>");
return result.toString();
}
}
<?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="com.jeespring.modules.cms.dao.ArticleDao">
<sql id="cmsArticleColumns">
a.id AS "id",
a.category_id AS "category.id",
a.title AS "title",
a.link AS "link",
a.color AS "color",
a.image AS "image",
a.keywords AS "keywords",
a.description AS "description",
a.weight AS "weight",
a.weight_date AS "weightDate",
a.hits AS "hits",
a.posid AS "posid",
a.custom_content_view AS "customContentView",
a.view_config AS "viewConfig",
a.create_by AS "createBy.id",
a.create_date AS "createDate",
a.update_by AS "updateBy.id",
a.update_date AS "updateDate",
a.remarks AS "remarks",
a.del_flag AS "delFlag",
c.name AS "category.name",
u.name AS "user.name"
</sql>
<sql id="cmsArticleJoins">
JOIN cms_category c ON c.id = a.category_id
JOIN sys_office o ON o.id = c.office_id
JOIN sys_user u ON u.id = a.create_by
</sql>
<select id="get" resultType="Article">
SELECT
<include refid="cmsArticleColumns"/>
FROM cms_article a
<include refid="cmsArticleJoins"/>
WHERE a.id = #{id}
</select>
<select id="findList" resultType="Article">
SELECT
<include refid="cmsArticleColumns"/>
FROM cms_article a
<include refid="cmsArticleJoins"/>
<where>
a.del_flag = #{delFlag}
<if test="title != null and title != ''">
AND a.title LIKE
<if test="dbName == 'oracle'">'%'||#{title}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{title}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{title}, '%')</if>
</if>
<if test="posid != null and posid != ''">
AND a.posid LIKE
<if test="dbName == 'oracle'">'%'||#{posid}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{posid}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{posid}, '%')</if>
</if>
<if test="category.id != null and category.id != ''">
AND (a.category_id = #{category.id}
<if test="category.parentIds != null and category.parentIds != ''">
or c.parent_ids like
<if test="dbName == 'oracle'">'%'||#{category.id}||'%'</if>
<if test="dbName == 'mssql'">'%,'+#{category.id}+',%'</if>
<if test="dbName == 'mysql'">CONCAT('%,', #{category.id}, ',%')</if>
</if>)
</if>
<if test="image != null and image != ''">
AND a.image = #{image}
</if>
<if test="createBy != null and createBy.id != null and createBy.id != ''">
AND a.create_by = #{createBy.id}
</if>
<!-- ${sqlMap.dsf}-->
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.weight DESC, a.update_date DESC
</otherwise>
</choose>
</select>
<select id="findAllList" resultType="Article">
SELECT
<include refid="cmsArticleColumns"/>
FROM cms_article a
<include refid="cmsArticleJoins"/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.weight DESC, a.update_date DESC
</otherwise>
</choose>
</select>
<insert id="insert">
INSERT INTO cms_article(
id,
category_id,
title,
link,
color,
image,
keywords,
description,
weight,
weight_date,
hits,
posid,
custom_content_view,
view_config,
create_by,
create_date,
update_by,
update_date,
remarks,
del_flag
) VALUES (
#{id},
#{category.id},
#{title},
#{link},
#{color},
#{image},
#{keywords},
#{description},
#{weight},
#{weightDate},
#{hits},
#{posid},
#{customContentView},
#{viewConfig},
#{createBy.id},
#{createDate},
#{updateBy.id},
#{updateDate},
#{remarks},
#{delFlag}
)
</insert>
<update id="update">
UPDATE cms_article SET
category_id = #{category.id},
title = #{title},
link = #{link},
color = #{color},
image = #{image},
keywords = #{keywords},
description = #{description},
weight = #{weight},
weight_date = #{weightDate},
hits = #{hits},
posid = #{posid},
custom_content_view = #{customContentView},
view_config = #{viewConfig},
create_date = #{createDate},
update_by = #{updateBy.id},
update_date = #{updateDate},
remarks = #{remarks},
del_flag = #{delFlag}
WHERE id = #{id}
</update>
<update id="delete">
UPDATE cms_article SET
del_flag = #{DEL_FLAG_DELETE}
WHERE id = #{id}
</update>
<select id="findByIdIn" resultType="Article">
SELECT
<include refid="cmsArticleColumns"/>
from cms_article a where
<where>
id in (${id});
</where>
</select>
<update id="updateExpiredWeight">
update cms_article SET
weight = 0
WHERE weight &gt; 0 AND weight_date &lt;
<if test="dbName == 'oracle'">sysdate</if>
<if test="dbName == 'mssql'">FLOOR(CONVERT(FLOAT,GETDATE()))</if>
<if test="dbName == 'mysql'">CURDATE()</if>
</update>
<update id="updateHitsAddOne">
update cms_article set
hits = hits+1
WHERE id = #{id}
</update>
<select id="findStats" resultType="Category">
select max(c.id) AS "id",
max(c.name) AS "name",
max(cp.id) AS "parent.id",
max(cp.name) AS "parent.name",
count(*) AS "cnt",
sum(a.hits) AS "hits",
max(a.update_date) as "updateDate",
max(o.id) AS "office.id",
max(o.name) AS "office.name"
FROM cms_article a
RIGHT JOIN cms_category c ON c.id = a.category_id
JOIN cms_category cp ON c.parent_id = cp.id
JOIN sys_office o ON o.id = c.office_id
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
AND c.site_id = #{site.id}
<if test="office.id != null and office.id != ''">
AND (c.office_id = #{office.id} OR o.parent_ids like
<if test="dbName == 'oracle'">'%'||#{office.id}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{office.id}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{office.id}, '%')</if>)
</if>
<if test="id != null and id != ''">
AND (c.id = #{id} OR c.parent_ids LIKE
<if test="dbName == 'oracle'">'%'||#{id}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{id}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{id}, '%')</if>)
</if>
group by cp.sort, cp.id, c.sort, c.id
order by cp.sort, cp.id, c.sort, c.id
</where>
</select>
</mapper>
\ 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="com.jeespring.modules.cms.dao.ArticleDataDao">
<sql id="cmsArticleDataColumns">
a.id AS "id",
a.content AS "content",
a.copyfrom AS "copyfrom",
a.relation AS "relation",
a.allow_comment AS "allow_comment"
</sql>
<sql id="cmsArticleDataJoins">
</sql>
<select id="get" resultType="ArticleData">
SELECT
<include refid="cmsArticleDataColumns"/>
FROM cms_article_data a
<include refid="cmsArticleDataJoins"/>
WHERE a.id = #{id}
</select>
<insert id="insert">
INSERT INTO cms_article_data(
id,
content,
copyfrom,
relation,
allow_comment
) VALUES (
#{id},
#{content},
#{copyfrom},
#{relation},
#{allowComment}
)
</insert>
<update id="update">
UPDATE cms_article_data SET
content = #{content},
copyfrom = #{copyfrom},
relation = #{relation},
allow_comment = #{allowComment}
WHERE id = #{id}
</update>
</mapper>
\ 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="com.jeespring.modules.cms.dao.CategoryDao">
<sql id="cmsCategoryDaoColumns">
a.id AS "id",
a.parent_id AS "parent.id",
a.parent_ids AS "parentIds",
a.site_id AS "site.id",
a.office_id AS "office.id",
a.module AS "module",
a.name AS "name",
a.image AS "image",
a.href AS "href",
a.target AS "target",
a.description AS "description",
a.keywords AS "keywords",
a.sort AS "sort",
a.in_menu AS "inMenu",
a.in_list AS "inList",
a.show_modes AS "showModes",
a.allow_comment AS "allowComment",
a.is_audit AS "isAudit",
a.custom_list_view AS "customListView",
a.custom_content_view AS "customContentView",
a.view_config AS "viewConfig",
a.create_by AS "createBy.id",
a.create_date AS "createDate",
a.update_by AS "updateBy.id",
a.update_date AS "updateDate",
a.remarks AS "remarks",
a.del_flag AS "delFlag",
c.name AS "parent.name",
c.view_config AS "parent.viewConfig",
o.name AS "office.name",
s.theme AS "site.theme"
</sql>
<sql id="cmsCategoryDaoJoins">
LEFT JOIN cms_category c ON c.id = a.parent_id
JOIN sys_office o ON o.id = a.office_id
JOIN sys_user u ON u.id = a.create_by
JOIN cms_site s ON a.site_id = s.id
</sql>
<select id="get" resultType="Category">
SELECT
a.id AS "id",
a.parent_id AS "parent.id",
a.parent_ids AS "parentIds",
a.site_id AS "site.id",
a.office_id AS "office.id",
a.module AS "module",
a.name AS "name",
a.image AS "image",
a.href AS "href",
a.target AS "target",
a.description AS "description",
a.keywords AS "keywords",
a.sort AS "sort",
a.in_menu AS "inMenu",
a.in_menu AS "inList",
a.show_modes AS "showModes",
a.allow_comment AS "allowComment",
a.is_audit AS "isAudit",
a.custom_list_view AS "customListView",
a.custom_content_view AS "customContentView",
a.view_config AS "viewConfig",
a.create_by AS "createBy.id",
a.create_date AS "createDate",
a.update_by AS "updateBy.id",
a.update_date AS "updateDate",
a.remarks AS "remarks",
a.del_flag AS "delFlag",
o.name AS "office.name"
FROM cms_category a
JOIN sys_office o ON o.id = a.office_id
JOIN sys_user u ON u.id = a.create_by
WHERE a.id = #{id}
</select>
<select id="find" resultType="Category">
SELECT
<include refid="cmsCategoryDaoColumns"/>
FROM cms_category a
<include refid="cmsCategoryDaoJoins"/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.update_date DESC
</otherwise>
</choose>
</select>
<select id="findList" resultType="Category">
SELECT
<include refid="cmsCategoryDaoColumns"/>
FROM cms_category a
<include refid="cmsCategoryDaoJoins"/>
<where>
a.del_flag = #{delFlag}
<if test=" site.id != null and site.id != ''">
AND a.site_id = #{site.id}
</if>
<if test="parent.id != null and parent.id != ''">
AND a.parent_id = #{parent.id}
</if>
${sqlMap.dsf}
</where>
ORDER BY a.site_id,a.sort ASC
</select>
<select id="findModule" resultType="Category">
SELECT
<include refid="cmsCategoryDaoColumns"/>
FROM cms_category a
<include refid="cmsCategoryDaoJoins"/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
<if test=" site.id != null and site.id != ''">
AND a.site_id = #{site.id}
</if>
<if test="parent.id != null and parent.id != ''">
AND a.parent_id = #{parent.id}
</if>
<if test="inMenu != null and inMenu != '' ">
AND a.in_menu = #{inMenu}
</if>
${sqlMap.dsf}
</where>
ORDER BY a.site_id,a.sort ASC
</select>
<insert id="insert">
INSERT INTO cms_category(
id,
parent_id,
parent_ids,
site_id,
office_id,
module,
name,
image,
href,
target,
description,
keywords,
sort,
in_menu,
in_list,
show_modes,
allow_comment,
is_audit,
custom_list_view,
custom_content_view,
view_config,
create_by,
create_date,
update_by,
update_date,
remarks,
del_flag
) VALUES (
#{id},
#{parent.id},
#{parentIds},
#{site.id},
#{office.id},
#{module},
#{name},
#{image},
#{href},
#{target},
#{description},
#{keywords},
#{sort},
#{inMenu},
#{inList},
#{showModes},
#{allowComment},
#{isAudit},
#{customListView},
#{customContentView},
#{viewConfig},
#{createBy.id},
#{createDate},
#{updateBy.id},
#{updateDate},
#{remarks},
#{delFlag}
)
</insert>
<update id="update">
UPDATE cms_category SET
parent_id = #{parent.id},
parent_ids = #{parentIds},
site_id = #{site.id},
office_id = #{office.id},
module = #{module},
name = #{name},
image = #{image},
href = #{href},
target = #{target},
description = #{description},
keywords = #{keywords},
sort = #{sort},
in_menu = #{inMenu},
in_list = #{inList},
show_modes = #{showModes},
allow_comment = #{allowComment},
is_audit = #{isAudit},
custom_list_view = #{customListView},
custom_content_view = #{customContentView},
view_config = #{viewConfig},
update_by = #{updateBy.id},
update_date = #{updateDate},
remarks = #{remarks},
del_flag = #{delFlag}
WHERE id = #{id}
</update>
<update id="updateParentIds">
UPDATE cms_category SET
parent_id = #{parent.id},
parent_ids = #{parentIds}
WHERE id = #{id}
</update>
<update id="delete">
UPDATE cms_category SET
del_flag = #{DEL_FLAG_DELETE}
WHERE id = #{id} OR parent_ids LIKE
<if test="dbName == 'oracle'">'%,'||#{id}||',%'</if>
<if test="dbName == 'mssql'">'%,'+#{id}+',%'</if>
<if test="dbName == 'mysql'">CONCAT('%,', #{id}, ',%')</if>
</update>
<select id="findByParentIdAndSiteId" resultType="Category">
SELECT
<include refid="cmsCategoryDaoColumns"/>
FROM cms_category a
<include refid="cmsCategoryDaoJoins"/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
<if test=" site.id != null and site.id != ''">
AND a.site_id = #{site.id}
</if>
<if test="parent.id != null and parent.id != ''">
AND a.parent_id = #{parent.id}
</if>
</where>
order by a.site_id, a.sort
</select>
<select id="findByParentIdsLike" resultType="Category">
SELECT
<include refid="cmsCategoryDaoColumns"/>
FROM cms_category a
<include refid="cmsCategoryDaoJoins"/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
AND a.parent_id LIKE
<if test="dbName == 'oracle'">'%'||#{id}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{id}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{id}, '%')</if>
</where>
order by a.site_id, a.sort
</select>
<select id="findStats" resultType="java.util.Map" parameterType="java.util.Map">
select max(c.id) as categoryId,
max(c.name) as categoryName,
max(cp.id) as categoryParentId,
max(cp.name) as categoryParentName,
count(*) as cnt,
sum(a.hits) as hits,
max(a.updateDate) as updateDate,
max(o.id) as officeId,
max(o.name) as officeName,
from cms_article a
JOIN cms_category c ON c.id = a.category_id
JOIN cms_category cp ON c.parent_id = cp.id
JOIN sys_office o ON o.id = c.office_id
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
AND a.category_id
AND c.site_id =
AND c.id = :id or c.parent_ids LIKE
<if test="dbName == 'oracle'">'%'||#{parentIds}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{parentIds}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{parentIds}, '%')</if>
group by cp.sort, cp.id, c.sort, c.id
order by cp.sort, cp.id, c.sort, c.id
</where>
</select>
</mapper>
\ 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="com.jeespring.modules.cms.dao.CommentDao">
<sql id="cmsCommentDaoColumns">
a.id AS "id",
a.category_id AS "category.id",
a.content_id AS "contentId",
a.title AS "title",
a.content AS "content",
a.name AS "name",
a.ip AS "ip",
a.create_date AS "createDate",
a.audit_user_id AS "auditUser.id",
a.audit_date AS "auditDate",
a.del_flag AS "delFlag"
</sql>
<sql id="cmsCommentDaoJoins">
</sql>
<select id="get" resultType="Comment">
SELECT
<include refid="cmsCommentDaoColumns"/>
FROM cms_comment a
<include refid="cmsCommentDaoJoins"/>
WHERE a.id = #{id}
</select>
<select id="findList" resultType="Comment">
SELECT
<include refid="cmsCommentDaoColumns"/>
FROM cms_comment a
<include refid="cmsCommentDaoJoins"/>
<where>
a.del_flag = #{delFlag}
<if test="title != null and title != ''">
AND a.title LIKE
<if test="dbName == 'oracle'">'%'||#{title}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{title}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{title}, '%')</if>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.create_date DESC
</otherwise>
</choose>
</select>
<select id="findAllList" resultType="Comment">
SELECT
<include refid="cmsCommentDaoColumns"/>
FROM cms_comment a
<include refid="cmsCommentDaoJoins"/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.create_date DESC
</otherwise>
</choose>
</select>
<insert id="insert">
INSERT INTO cms_comment(
id,
category_id,
content_id,
title,
content,
name,
ip,
create_date,
audit_user_id,
audit_date,
del_flag
) VALUES (
#{id},
#{category.id},
#{contentId},
#{title},
#{content},
#{name},
#{ip},
#{createDate},
#{auditUser.id},
#{auditDate},
#{delFlag}
)
</insert>
<update id="update">
UPDATE cms_comment SET
category_id = #{category.id},
content_id = #{contentId},
title = #{title},
content = #{content},
name = #{name},
ip = #{ip},
create_date = #{createDate},
audit_user_id = #{auditUser.id},
audit_date = #{auditDate},
del_flag = #{delFlag}
WHERE id = #{id}
</update>
<update id="delete">
UPDATE cms_comment SET
del_flag = #{DEL_FLAG_DELETE}
WHERE id = #{id}
</update>
</mapper>
\ 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="com.jeespring.modules.cms.dao.GuestbookDao">
<sql id="cmsGuestbookColumns">
a.id AS "id",
a.type AS "type",
a.content AS "content",
a.name AS "name",
a.email AS "email",
a.phone AS "phone",
a.workunit AS "workunit",
a.ip AS "ip",
a.create_date AS "createDate",
a.re_user_id AS "reUser.id",
a.re_date AS "reDate",
a.re_content AS "reContent",
a.del_flag AS "delFlag",
u.name AS "reUser.name"
</sql>
<sql id="cmsGuestbookJoins">
LEFT JOIN sys_user u ON u.id = a.re_user_id
</sql>
<select id="get" resultType="Guestbook">
SELECT
<include refid="cmsGuestbookColumns"/>
FROM cms_guestbook a
<include refid="cmsGuestbookJoins"/>
WHERE a.id = #{id}
</select>
<select id="findList" resultType="Guestbook">
SELECT
<include refid="cmsGuestbookColumns"/>
FROM cms_guestbook a
<include refid="cmsGuestbookJoins"/>
<where>
a.del_flag = #{delFlag}
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.create_date DESC
</otherwise>
</choose>
</select>
<select id="findAllList" resultType="Guestbook">
SELECT
<include refid="cmsGuestbookColumns"/>
FROM cms_guestbook a
<include refid="cmsGuestbookJoins"/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.create_date DESC
</otherwise>
</choose>
</select>
<insert id="insert">
INSERT INTO cms_guestbook(
id,
type,
content,
name,
email,
phone,
workunit,
ip,
create_date,
re_user_id,
re_date,
re_content,
del_flag
) VALUES (
#{id},
#{type},
#{content},
#{name},
#{email},
#{phone},
#{workunit},
#{ip},
#{createDate},
#{reUser.id},
#{reDate},
#{reContent},
#{delFlag}
)
</insert>
<update id="update">
UPDATE cms_guestbook SET
type = #{type},
content = #{content},
name = #{name},
email = #{email},
phone = #{phone},
workunit = #{workunit},
ip = #{ip},
create_date = #{createDate},
re_user_id = #{reUser.id},
re_date = #{reDate},
re_content = #{reContent},
del_flag = #{delFlag}
WHERE id = #{id}
</update>
<update id="delete">
UPDATE cms_guestbook SET
del_flag = #{DEL_FLAG_DELETE}
WHERE id = #{id}
</update>
<select id="findByIdIn" resultType="Guestbook">
SELECT
<include refid="cmsGuestbookColumns"/>
from cms_guestbook a where
<where>
id in ();
</where>
</select>
</mapper>
\ 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="com.jeespring.modules.cms.dao.LinkDao">
<sql id="cmsLinkColumns">
a.id AS "id",
a.category_id AS "category.id",
a.title AS "title",
a.color AS "color",
a.image AS "image",
a.href AS "href",
a.weight AS "weight",
a.weight_date AS "weightDate",
a.create_by AS "createBy.id",
a.create_date AS "createDate",
a.update_by AS "updateBy.id",
a.update_date AS "updateDate",
a.remarks AS "remarks",
a.del_flag AS "delFlag",
c.name AS "category.name",
u.name AS "user.name"
</sql>
<sql id="cmsLinkJoins">
JOIN cms_category c ON c.id = a.category_id
JOIN sys_user u ON u.id = a.create_by
</sql>
<select id="get" resultType="Link">
SELECT
<include refid="cmsLinkColumns"/>
FROM cms_link a
<include refid="cmsLinkJoins"/>
WHERE a.id = #{id}
</select>
<select id="findList" resultType="Link">
SELECT
<include refid="cmsLinkColumns"/>
FROM cms_link a
<include refid="cmsLinkJoins"/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
<if test="title != null and title != ''">
AND a.title LIKE
<if test="dbName == 'oracle'">'%'||#{title}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{title}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{title}, '%')</if>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.update_date DESC
</otherwise>
</choose>
</select>
<select id="findAllList" resultType="Link">
SELECT
<include refid="cmsLinkColumns"/>
FROM cms_link a
<include refid="cmsLinkJoins"/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.update_date DESC
</otherwise>
</choose>
</select>
<insert id="insert">
INSERT INTO cms_link(
id,
category_id,
title,
color,
image,
href,
weight,
weight_date,
create_by,
create_date,
update_by,
update_date,
remarks,
del_flag
) VALUES (
#{id},
#{category.id},
#{title},
#{color},
#{image},
#{href},
#{weight},
#{weightDate},
#{createBy.id},
#{createDate},
#{updateBy.id},
#{updateDate},
#{remarks},
#{delFlag}
)
</insert>
<update id="update">
UPDATE cms_link SET
category_id = #{category.id},
title = #{title},
color = #{color},
image = #{image},
href = #{href},
weight = #{weight},
weight_date = #{weightDate},
update_by = #{updateBy.id},
update_date = #{updateDate},
remarks = #{remarks},
del_flag = #{delFlag}
WHERE id = #{id}
</update>
<update id="delete">
UPDATE cms_link SET
del_flag = #{delFlag}
WHERE id = #{id}
</update>
<select id="findByIdIn" resultType="Link">
SELECT
<include refid="cmsLinkColumns"/>
from cms_link a where
<where>
id in (${id});
</where>
</select>
<update id="updateExpiredWeight">
update cms_link SET
weight=0
WHERE weight &gt; 0 AND weight_date &lt;
<if test="dbName == 'oracle'">sysdate</if>
<if test="dbName == 'mssql'">FLOOR(CONVERT(FLOAT,GETDATE()))</if>
<if test="dbName == 'mysql'">CURDATE()</if>
</update>
</mapper>
\ 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="com.jeespring.modules.cms.dao.SiteDao">
<sql id="cmsSiteColumns">
a.id AS "id",
a.name AS "name",
a.title AS "title",
a.logo AS "logo",
a.domain AS "domain",
a.description AS "description",
a.keywords AS "keywords",
a.theme AS "theme",
a.copyright AS "copyright",
a.custom_index_view AS "customIndexView",
a.create_by AS "createBy.id",
a.create_date AS "createDate",
a.update_by AS "updateBy.id",
a.update_date AS "updateDate",
a.remarks AS "remarks",
a.del_flag AS "delFlag"
</sql>
<sql id="cmsSiteJoins">
</sql>
<select id="get" resultType="Site">
SELECT
<include refid="cmsSiteColumns"/>
FROM cms_site a
<include refid="cmsSiteJoins"/>
WHERE a.id = #{id}
</select>
<select id="findList" resultType="Site">
SELECT
<include refid="cmsSiteColumns"/>
FROM cms_site a
<include refid="cmsSiteJoins"/>
<where>
a.del_flag = #{delFlag}
<if test="name != null and name != ''">
AND a.name LIKE
<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{name}, '%')</if>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.update_date DESC
</otherwise>
</choose>
</select>
<select id="findAllList" resultType="Site">
SELECT
<include refid="cmsSiteColumns"/>
FROM cms_site a
<include refid="cmsSiteJoins"/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.update_date DESC
</otherwise>
</choose>
</select>
<insert id="insert">
INSERT INTO cms_site(
id,
name,
title,
logo,
domain,
description,
keywords,
theme,
copyright,
custom_index_view,
create_by,
create_date,
update_by,
update_date,
remarks,
del_flag
) VALUES (
#{id},
#{name},
#{title},
#{logo},
null,
#{description},
#{keywords},
#{theme},
#{copyright},
#{customIndexView},
#{createBy.id},
#{createDate},
#{updateBy.id},
#{updateDate},
#{remarks},
#{delFlag}
)
</insert>
<update id="update">
UPDATE cms_site SET
name = #{name},
title = #{title},
logo = #{logo},
domain = #{domain},
description = #{description},
keywords = #{keywords},
theme = #{theme},
copyright = #{copyright},
custom_index_view = #{customIndexView},
update_by = #{updateBy.id},
update_date = #{updateDate},
remarks = #{remarks},
del_flag = #{delFlag}
WHERE id = #{id}
</update>
<update id="delete">
UPDATE cms_site SET
del_flag = #{delFlag}
WHERE id = #{id}
</update>
</mapper>
\ No newline at end of file
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>文章管理</title>
<meta name="decorator" content="default"/>
<%@ include file="/WEB-INF/views/include/head.jsp"%>
<script type="text/javascript">
$(document).ready(function() {
if($("#link").val()){
$('#linkBody').show();
$('#url').attr("checked", true);
}
$("#title").focus();
$("#inputForm").validate({
submitHandler: function(form){
if ($("#categoryId").val()==""){
$("#categoryName").focus();
top.$.jBox.tip('请选择归属栏目','warning');
}else if (CKEDITOR.instances.content.getData()=="" && $("#link").val().trim()==""){
top.$.jBox.tip('请填写正文','warning');
}else{
loading('正在提交,请稍等...');
form.submit();
}
},
errorContainer: "#messageBox",
errorPlacement: function(error, element) {
$("#messageBox").text("输入有误,请先更正。");
if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
error.appendTo(element.parent().parent());
} else {
error.insertAfter(element);
}
}
});
});
</script>
</head>
<body>
<ul class="nav nav-tabs">
<li><a href="${ctx}/cms/article/?category.id=${article.category.id}">文章列表</a></li>
<li class="active"><a href="<c:url value='${fns:getAdminPath()}/cms/article/form?id=${article.id}&category.id=${article.category.id}'><c:param name='category.name' value='${article.category.name}'/></c:url>">文章<shiro:hasPermission name="cms:article:edit">${not empty article.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="cms:article:edit">查看</shiro:lacksPermission></a></li>
</ul><br/>
<form:form id="inputForm" modelAttribute="article" action="${ctx}/cms/article/save" method="post" class="form-horizontal">
<form:hidden path="id"/>
<sys:message content="${message}"/>
<div class="control-group">
<label class="control-label">归属栏目:</label>
<div class="controls">
<sys:treeselect id="category" name="category.id" value="${article.category.id}" labelName="category.name" labelValue="${article.category.name}"
title="栏目" url="/cms/category/treeData" module="article" selectScopeModule="true" notAllowSelectRoot="false" notAllowSelectParent="true" cssClass="required"/>&nbsp;
<span>
<input id="url" type="checkbox" onclick="if(this.checked){$('#linkBody').show()}else{$('#linkBody').hide()}$('#link').val()"><label for="url">外部链接</label>
</span>
</div>
</div>
<div class="control-group">
<label class="control-label">标题:</label>
<div class="controls">
<form:input path="title" htmlEscape="false" maxlength="200" class="input-xxlarge measure-input required"/>
&nbsp;<label>颜色:</label>
<form:select path="color" class="input-mini">
<form:option value="" label="默认"/>
<form:options items="${fns:getDictList('color')}" itemLabel="label" itemValue="value" htmlEscape="false" />
</form:select>
</div>
</div>
<div id="linkBody" class="control-group" style="display:none">
<label class="control-label">外部链接:</label>
<div class="controls">
<form:input path="link" htmlEscape="false" maxlength="200" class="input-xlarge"/>
<span class="help-inline">绝对或相对地址。</span>
</div>
</div>
<div class="control-group">
<label class="control-label">关键字:</label>
<div class="controls">
<form:input path="keywords" htmlEscape="false" maxlength="200" class="input-xlarge"/>
<span class="help-inline">多个关键字,用空格分隔。</span>
</div>
</div>
<div class="control-group">
<label class="control-label">权重:</label>
<div class="controls">
<form:input path="weight" htmlEscape="false" maxlength="200" class="input-mini required digits"/>&nbsp;
<span>
<input id="weightTop" type="checkbox" onclick="$('#weight').val(this.checked?'999':'0')"><label for="weightTop">置顶</label>
</span>
&nbsp;过期时间:
<input id="weightDate" name="weightDate" type="text" readonly="readonly" maxlength="20" class="input-small Wdate"
value="<fmt:formatDate value="${article.weightDate}" pattern="yyyy-MM-dd"/>"
onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"/>
<span class="help-inline">数值越大排序越靠前,过期时间可为空,过期后取消置顶。</span>
</div>
</div>
<div class="control-group">
<label class="control-label">摘要:</label>
<div class="controls">
<form:textarea path="description" htmlEscape="false" rows="4" maxlength="200" class="input-xxlarge"/>
</div>
</div>
<div class="control-group">
<label class="control-label">缩略图:</label>
<div class="controls">
<input type="hidden" id="image" name="image" value="${article.imageSrc}" />
<sys:ckfinder input="image" type="thumb" uploadPath="/cms/article" selectMultiple="false"/>
</div>
</div>
<div class="control-group">
<label class="control-label">正文:</label>
<div class="controls">
<form:textarea id="content" htmlEscape="true" path="articleData.content" rows="4" maxlength="200" class="input-xxlarge"/>
<sys:ckeditor replace="content" uploadPath="/cms/article" />
</div>
</div>
<div class="control-group">
<label class="control-label">来源:</label>
<div class="controls">
<form:input path="articleData.copyfrom" htmlEscape="false" maxlength="200" class="input-xlarge"/>
</div>
</div>
<div class="control-group">
<label class="control-label">相关文章:</label>
<div class="controls">
<form:hidden id="articleDataRelation" path="articleData.relation" htmlEscape="false" maxlength="200" class="input-xlarge"/>
<ol id="articleSelectList"></ol>
<a id="relationButton" href="javascript:" class="btn">添加相关</a>
<script type="text/javascript">
var articleSelect = [];
function articleSelectAddOrDel(id,title){
var isExtents = false, index = 0;
for (var i=0; i<articleSelect.length; i++){
if (articleSelect[i][0]==id){
isExtents = true;
index = i;
}
}
if(isExtents){
articleSelect.splice(index,1);
}else{
articleSelect.push([id,title]);
}
articleSelectRefresh();
}
function articleSelectRefresh(){
$("#articleDataRelation").val("");
$("#articleSelectList").children().remove();
for (var i=0; i<articleSelect.length; i++){
$("#articleSelectList").append("<li>"+articleSelect[i][1]+"&nbsp;&nbsp;<a href=\"javascript:\" onclick=\"articleSelectAddOrDel('"+articleSelect[i][0]+"','"+articleSelect[i][1]+"');\">×</a></li>");
$("#articleDataRelation").val($("#articleDataRelation").val()+articleSelect[i][0]+",");
}
}
$.getJSON("${ctx}/cms/article/findByIds",{ids:$("#articleDataRelation").val()},function(data){
for (var i=0; i<data.length; i++){
articleSelect.push([data[i][1],data[i][2]]);
}
articleSelectRefresh();
});
$("#relationButton").click(function(){
top.$.jBox.open("iframe:${ctx}/cms/article/selectList?pageSize=8", "添加相关",$(top.document).width()-220,$(top.document).height()-180,{
buttons:{"确定":true}, loaded:function(h){
$(".jbox-content", top.document).css("overflow-y","hidden");
}
});
});
</script>
</div>
</div>
<div class="control-group">
<label class="control-label">是否允许评论:</label>
<div class="controls">
<form:radiobuttons path="articleData.allowComment" items="${fns:getDictList('yes_no')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
</div>
</div>
<div class="control-group">
<label class="control-label">推荐位:</label>
<div class="controls">
<form:checkboxes path="posidList" items="${fns:getDictList('cms_posid')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
</div>
</div>
<div class="control-group">
<label class="control-label">发布时间:</label>
<div class="controls">
<input id="createDate" name="createDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
value="<fmt:formatDate value="${article.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
</div>
</div>
<shiro:hasPermission name="cms:article:audit">
<div class="control-group">
<label class="control-label">发布状态:</label>
<div class="controls">
<form:radiobuttons path="delFlag" items="${fns:getDictList('cms_del_flag')}" itemLabel="label" itemValue="value" htmlEscape="false" class="required"/>
<span class="help-inline"></span>
</div>
</div>
</shiro:hasPermission>
<shiro:hasPermission name="cms:category:edit">
<div class="control-group">
<label class="control-label">自定义内容视图:</label>
<div class="controls">
<form:select path="customContentView" class="input-medium">
<form:option value="" label="默认视图"/>
<form:options items="${contentViewList}" htmlEscape="false"/>
</form:select>
<span class="help-inline">自定义内容视图名称必须以"${article_DEFAULT_TEMPLATE}"开始</span>
</div>
</div>
<div class="control-group">
<label class="control-label">自定义视图参数:</label>
<div class="controls">
<form:input path="viewConfig" htmlEscape="true"/>
<span class="help-inline">视图参数例如: {count:2, title_show:"yes"}</span>
</div>
</div>
</shiro:hasPermission>
<c:if test="${not empty article.id}">
<div class="control-group">
<label class="control-label">查看评论:</label>
<div class="controls">
<input id="btnComment" class="btn" type="button" value="查看评论" onclick="viewComment('${ctx}/cms/comment/?module=article&contentId=${article.id}&status=0')"/>
<script type="text/javascript">
function viewComment(href){
top.$.jBox.open('iframe:'+href,'查看评论',$(top.document).width()-220,$(top.document).height()-180,{
buttons:{"关闭":true},
loaded:function(h){
$(".jbox-content", top.document).css("overflow-y","hidden");
$(".nav,.form-actions,[class=btn]", h.find("iframe").contents()).hide();
$("body", h.find("iframe").contents()).css("margin","10px");
}
});
return false;
}
</script>
</div>
</div>
</c:if>
<div class="form-actions">
<shiro:hasPermission name="cms:article:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
</div>
</form:form>
</body>
</html>
\ No newline at end of file
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
<title>文章管理</title>
<meta name="decorator" content="default"/>
<%@ include file="/WEB-INF/views/include/headMeta.jsp" %>
<%@ include file="/WEB-INF/views/include/headCss.jsp" %>
<%@ include file="/WEB-INF/views/include/headJs.jsp" %>
<script type="text/javascript">
function viewComment(href) {
top.$.jBox.open('iframe:' + href, '查看评论', $(top.document).width() - 220, $(top.document).height() - 120, {
buttons: {"关闭": true},
loaded: function (h) {
$(".jbox-content", top.document).css("overflow-y", "hidden");
$(".nav,.form-actions,[class=btn]", h.find("iframe").contents()).hide();
$("body", h.find("iframe").contents()).css("margin", "10px");
}
});
return false;
}
function page(n, s) {
$("#pageNo").val(n);
$("#pageSize").val(s);
$("#searchForm").submit();
return false;
}
</script>
</head>
<body>
<!-- 内容-->
<div class="wrapper">
<!-- 内容盒子-->
<div class="box box-main">
<!-- 内容盒子头部 -->
<div class="box-header">
<div class="box-title"><i class="fa fa-edit"></i>文章管理</div>
<div class="box-tools pull-right">
<a id="btnSearchView" href="#" class="btn btn-sm btn-default" title="查询"><i class="fa fa-filter"></i>查询</a>
<button id="btnRefresh" class="btn btn-default btn-sm" title="刷新"><i
class="glyphicon glyphicon-repeat"></i> 刷新
</button>
<a href="${ctx}/cms/article/?category.id=${article.category.id}" class="btn btn-sm btn-default">列表</a>
<shiro:hasPermission name="cms:article:edit">
<a href="<c:url value='${fns:getAdminPath()}/cms/article/form?id=${article.id}&category.id=${article.category.id}'>
<c:param name='category.name' value='${article.category.name}'/>
</c:url>" class="btn btn-sm btn-default">
增加</a>
</shiro:hasPermission>
</div>
</div>
<!-- 内容盒子身体 -->
<div class="box-body">
<form:form id="searchForm" modelAttribute="article" action="${ctx}/cms/article/" method="post"
class="form-inline">
<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
<div class="form-group">
<label class="control-label">栏目:</label>
<div class="control-inline">
<sys:treeselect id="category" name="category.id" value="${article.category.id}"
labelName="category.name"
labelValue="${article.category.name}"
title="栏目" url="/cms/category/treeData" module="article"
notAllowSelectRoot="false"
cssClass="form-control input-sm"/>
</div>
</div>
<div class="form-group">
<label class="control-label">标题:</label>
<form:input path="title" htmlEscape="false" maxlength="50" class="form-control"/>
</div>
<div class="form-group">
<label class="control-label">状态:</label>
<form:radiobuttons onclick="$('#searchForm').submit();" path="delFlag"
items="${fns:getDictList('cms_del_flag')}" itemLabel="label" itemValue="value"
htmlEscape="false"/>
</div>
<div class="form-group">
<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
</div>
</form:form>
<table id="contentTable" class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th>栏目</th>
<th>标题</th>
<th>权重</th>
<th>点击数</th>
<th>发布者</th>
<th>更新时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<c:forEach items="${page.list}" var="article">
<tr>
<td><a href="javascript:"
onclick="$('#categoryId').val('${article.category.id}');$('#categoryName').val('${article.category.name}');$('#searchForm').submit();return false;">${article.category.name}</a>
</td>
<td><a href="${ctx}/cms/article/form?id=${article.id}"
title="${article.title}">${fns:abbr(article.title,40)}</a></td>
<td>${article.weight}</td>
<td>${article.hits}</td>
<td>${article.user.name}</td>
<td><fmt:formatDate value="${article.updateDate}" type="both"/></td>
<td>
<a href="${pageContext.request.contextPath}${fns:getFrontPath()}/view-${article.category.id}-${article.id}${fns:getUrlSuffix()}"
target="_blank">访问</a>
<shiro:hasPermission name="cms:article:edit">
<c:if test="${article.category.allowComment eq '1'}"><shiro:hasPermission
name="cms:comment:view">
<a href="${ctx}/cms/comment/?module=article&contentId=${article.id}&delFlag=2"
onclick="return viewComment(this.href);">评论</a>
</shiro:hasPermission></c:if>
<a href="${ctx}/cms/article/form?id=${article.id}">修改</a>
<shiro:hasPermission name="cms:article:audit">
<a href="${ctx}/cms/article/delete?id=${article.id}${article.delFlag ne 0?'&isRe=true':''}&categoryId=${article.category.id}"
onclick="return confirmx('确认要${article.delFlag ne 0?'发布':'删除'}该文章吗?', this.href)">${article.delFlag ne 0?'发布':'删除'}</a>
</shiro:hasPermission>
</shiro:hasPermission>
</td>
</tr>
</c:forEach>
</tbody>
</table>
<!-- 分页代码 -->
${page.toStringPage()}
</div>
</div>
</div>
<!-- 信息-->
<div id="messageBox">${message}</div>
<%@ include file="/WEB-INF/views/include/footJs.jsp" %>
<script src="/staticViews/viewBase.js"></script>
</body>
</html>
\ No newline at end of file
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>选择文章</title>
<meta name="decorator" content="default"/>
<%@ include file="/WEB-INF/views/include/head.jsp"%>
<script type="text/javascript">
$(document).ready(function() {
$("input[name=id]").each(function(){
var articleSelect = null;
if (top.mainFrame.cmsMainFrame){
articleSelect = top.mainFrame.cmsMainFrame.articleSelect;
}else{
articleSelect = top.mainFrame.articleSelect;
}
for (var i=0; i<articleSelect.length; i++){
if (articleSelect[i][0]==$(this).val()){
this.checked = true;
}
}
$(this).click(function(){
var id = $(this).val(), title = $(this).attr("title");
if (top.mainFrame.cmsMainFrame){
top.mainFrame.cmsMainFrame.articleSelectAddOrDel(id, title);
}else{
top.mainFrame.articleSelectAddOrDel(id, title);
}
});
});
});
function view(href){
top.$.jBox.open('iframe:'+href,'查看文章',$(top.document).width()-220,$(top.document).height()-120,{
buttons:{"关闭":true},
loaded:function(h){
$(".jbox-content", top.document).css("overflow-y","hidden");
$(".nav,.form-actions,[class=btn]", h.find("iframe").contents()).hide();
}
});
return false;
}
function page(n,s){
$("#pageNo").val(n);
$("#pageSize").val(s);
$("#searchForm").submit();
return false;
}
</script>
</head>
<body>
<div style="margin:10px;">
<form:form id="searchForm" modelAttribute="article" action="${ctx}/cms/article/selectList" method="post" class="breadcrumb form-search">
<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
<label>栏目:</label><sys:treeselect id="category" name="category.id" value="${article.category.id}" labelName="category.name" labelValue="${article.category.name}"
title="栏目" url="/cms/category/treeData" module="article" cssClass="input-small"/>
<label>标题:</label><form:input path="title" htmlEscape="false" maxlength="50" class="input-small"/>&nbsp;
<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>&nbsp;&nbsp;
</form:form>
<table id="contentTable" class="table table-striped table-bordered table-condensed">
<thead><tr><th style="text-align:center;">选择</th><th>栏目</th><th>标题</th><th>权重</th><th>点击数</th><th>发布者</th><th>更新时间</th></tr></thead>
<tbody>
<c:forEach items="${page.list}" var="article">
<tr>
<td style="text-align:center;"><input type="checkbox" name="id" value="${article.id}" title="${fns:abbr(article.title,40)}" /></td>
<td><a href="javascript:" onclick="$('#categoryId').val('${article.category.id}');$('#categoryName').val('${article.category.name}');$('#searchForm').submit();return false;">${article.category.name}</a></td>
<td><a href="${ctx}/cms/article/form?id=${article.id}" title="${article.title}" onclick="return view(this.href);">${fns:abbr(article.title,40)}</a></td>
<td>${article.weight}</td>
<td>${article.hits}</td>
<td>${article.createBy.name}</td>
<td><fmt:formatDate value="${article.updateDate}" type="both"/></td>
</tr>
</c:forEach>
</tbody>
</table>
<div class="pagination">${page.getPageHtml()}</div>
</div>
</body>
</html>
\ No newline at end of file
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>栏目管理</title>
<meta name="decorator" content="default"/>
<%@ include file="/WEB-INF/views/include/head.jsp"%>
<script type="text/javascript">
$(document).ready(function() {
$("#name").focus();
$("#inputForm").validate({
submitHandler: function(form){
loading('正在提交,请稍等...');
form.submit();
},
errorContainer: "#messageBox",
errorPlacement: function(error, element) {
$("#messageBox").text("输入有误,请先更正。");
if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
error.appendTo(element.parent().parent());
} else {
error.insertAfter(element);
}
}
});
});
</script>
</head>
<body>
<ul class="nav nav-tabs">
<li><a href="${ctx}/cms/category/">栏目列表</a></li>
<li class="active"><a href="${ctx}/cms/category/form?id=${category.id}&parent.id=${category.parent.id}">栏目<shiro:hasPermission name="cms:category:edit">${not empty category.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="cms:category:edit">查看</shiro:lacksPermission></a></li>
</ul><br/>
<form:form id="inputForm" modelAttribute="category" action="${ctx}/cms/category/save" method="post" class="form-horizontal">
<form:hidden path="id"/>
<sys:message content="${message}"/>
<div class="control-group">
<label class="control-label">归属机构:</label>
<div class="controls">
<sys:treeselect id="office" name="office.id" value="${category.office.id}" labelName="office.name" labelValue="${category.office.name}"
title="机构" url="/sys/office/treeData" cssClass="required"/>
</div>
</div>
<div class="control-group">
<label class="control-label">上级栏目:</label>
<div class="controls">
<sys:treeselect id="category" name="parent.id" value="${category.parent.id}" labelName="parent.name" labelValue="${category.parent.name}"
title="栏目" url="/cms/category/treeData" extId="${category.id}" cssClass="required"/>
</div>
</div>
<div class="control-group">
<label class="control-label">栏目模型:</label>
<div class="controls">
<form:select path="module">
<form:option value="" label="公共模型"/>
<form:options items="${fns:getDictList('cms_module')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
</form:select>
</div>
</div>
<div class="control-group">
<label class="control-label">栏目名称:</label>
<div class="controls">
<form:input path="name" htmlEscape="false" maxlength="50" class="required"/>
</div>
</div>
<div class="control-group">
<label class="control-label">缩略图:</label>
<div class="controls">
<form:hidden path="image" htmlEscape="false" maxlength="255" class="input-xlarge"/>
<sys:ckfinder input="image" type="thumb" uploadPath="/cms/category"/>
</div>
</div>
<div class="control-group">
<label class="control-label">链接:</label>
<div class="controls">
<form:input path="href" htmlEscape="false" maxlength="200"/>
<span class="help-inline">栏目超链接地址,优先级“高”</span>
</div>
</div>
<div class="control-group">
<label class="control-label">目标:</label>
<div class="controls">
<form:input path="target" htmlEscape="false" maxlength="200"/>
<span class="help-inline">栏目超链接打开的目标窗口,新窗口打开,请填写:“_blank”</span>
</div>
</div>
<div class="control-group">
<label class="control-label">描述:</label>
<div class="controls">
<form:textarea path="description" htmlEscape="false" rows="4" maxlength="200" class="input-xxlarge"/>
</div>
</div>
<div class="control-group">
<label class="control-label">关键字:</label>
<div class="controls">
<form:input path="keywords" htmlEscape="false" maxlength="200"/>
<span class="help-inline">填写描述及关键字,有助于搜索引擎优化</span>
</div>
</div>
<div class="control-group">
<label class="control-label">排序:</label>
<div class="controls">
<form:input path="sort" htmlEscape="false" maxlength="11" class="required digits"/>
<span class="help-inline">栏目的排列次序</span>
</div>
</div>
<div class="control-group">
<label class="control-label">在导航中显示:</label>
<div class="controls">
<form:radiobuttons path="inMenu" items="${fns:getDictList('show_hide')}" itemLabel="label" itemValue="value" htmlEscape="false" class="required"/>
<span class="help-inline">是否在导航中显示该栏目</span>
</div>
</div>
<div class="control-group">
<label class="control-label">在分类页中显示列表:</label>
<div class="controls">
<form:radiobuttons path="inList" items="${fns:getDictList('show_hide')}" itemLabel="label" itemValue="value" htmlEscape="false" class="required"/>
<span class="help-inline">是否在分类页中显示该栏目的文章列表</span>
</div>
</div>
<div class="control-group">
<label class="control-label" title="默认展现方式:有子栏目显示栏目列表,无子栏目显示内容列表。">展现方式:</label>
<div class="controls">
<form:radiobuttons path="showModes" items="${fns:getDictList('cms_show_modes')}" itemLabel="label" itemValue="value" htmlEscape="false" class="required"/><%--
<form:select path="showModes" class="input-medium">
<form:option value="" label="默认"/>
<form:options items="${fns:getDictList('cms_show_modes')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
</form:select><span class="help-inline"></span> --%>
</div>
</div>
<div class="control-group">
<label class="control-label">是否允许评论:</label>
<div class="controls">
<form:radiobuttons path="allowComment" items="${fns:getDictList('yes_no')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
</div>
</div>
<div class="control-group">
<label class="control-label">是否需要审核:</label>
<div class="controls">
<form:radiobuttons path="isAudit" items="${fns:getDictList('yes_no')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
</div>
</div>
<div class="control-group">
<label class="control-label">自定义列表视图:</label>
<div class="controls">
<form:select path="customListView">
<form:option value="" label="默认视图"/>
<form:options items="${listViewList}" htmlEscape="false"/>
</form:select>
<span class="help-inline">自定义列表视图名称必须以"${category_DEFAULT_TEMPLATE}"开始</span>
</div>
</div>
<div class="control-group">
<label class="control-label">自定义内容视图:</label>
<div class="controls">
<form:select path="customContentView">
<form:option value="" label="默认视图"/>
<form:options items="${contentViewList}" htmlEscape="false"/>
</form:select>
<span class="help-inline">自定义内容视图名称必须以"${article_DEFAULT_TEMPLATE}"开始</span>
</div>
</div>
<div class="control-group">
<label class="control-label">自定义视图参数:</label>
<div class="controls">
<form:input path="viewConfig" htmlEscape="true"/>
<span class="help-inline">视图参数例如: {count:2, title_show:"yes"}</span>
</div>
</div>
<div class="form-actions">
<shiro:hasPermission name="cms:category:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
</div>
</form:form>
</body>
</html>
\ No newline at end of file
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
<title>栏目管理</title>
<%@ include file="/WEB-INF/views/include/headMeta.jsp" %>
<%@ include file="/WEB-INF/views/include/headCss.jsp" %>
<%@ include file="/WEB-INF/views/include/headJs.jsp" %>
<%@include file="/WEB-INF/views/include/treetable.jsp" %>
<script type="text/javascript">
$(document).ready(function () {
$("#treeTable").treeTable({expandLevel: 3});
});
function updateSort() {
//loading('正在提交,请稍等...');
$("#listForm").attr("action", "${ctx}/cms/category/updateSort");
$("#listForm").submit();
}
</script>
</head>
<body>
<!-- 内容-->
<div class="wrapper">
<!-- 内容盒子-->
<div class="box box-main">
<!-- 内容盒子头部 -->
<div class="box-header">
<div class="box-title"><i class="fa fa-edit"></i>栏目管理</div>
<div class="box-tools pull-right">
<a id="btnSearchView" href="#" class="btn btn-sm btn-default" title="查询"><i class="fa fa-filter"></i>查询</a>
<button id="btnRefresh" class="btn btn-default btn-sm" title="刷新"><i
class="glyphicon glyphicon-repeat"></i> 刷新
</button>
<shiro:hasPermission name="cms:category:edit">
<a class="btn btn-default btn-sm" href="${ctx}/cms/category/form">添加</a>
</shiro:hasPermission>
<shiro:hasPermission name="cms:category:edit">
<a class="btn btn-default btn-sm" onclick="updateSort();"/>保存排序</a>
</shiro:hasPermission>
</div>
</div>
<!-- 内容盒子身体 -->
<div class="box-body">
<!-- 查询条件 -->
<form id="listForm" method="post">
<table id="treeTable" class="table table-striped table-bordered table-condensed">
<tr>
<th>栏目名称</th>
<th>归属机构</th>
<th>栏目模型</th>
<th style="text-align:center;">排序</th>
<th title="是否在导航中显示该栏目">导航菜单</th>
<th title="是否在分类页中显示该栏目的文章列表">栏目列表</th>
<th>展现方式</th>
<th>操作</th>
</tr>
<c:forEach items="${list}" var="tpl">
<tr id="${tpl.id}" pId="${tpl.parent.id ne '1'?tpl.parent.id:'0'}">
<td><a href="${ctx}/cms/category/form?id=${tpl.id}">${tpl.name}</a></td>
<td>${tpl.office.name}</td>
<td>${fns:getDictLabel(tpl.module, 'cms_module', '公共模型')}</td>
<td style="text-align:center;">
<shiro:hasPermission name="cms:category:edit">
<input type="hidden" name="ids" value="${tpl.id}"/>
<input name="sorts" type="text" value="${tpl.sort}"
style="width:50px;margin:0;padding:0;text-align:center;">
</shiro:hasPermission><shiro:lacksPermission name="cms:category:edit">
${tpl.sort}
</shiro:lacksPermission>
</td>
<td>${fns:getDictLabel(tpl.inMenu, 'show_hide', '隐藏')}</td>
<td>${fns:getDictLabel(tpl.inList, 'show_hide', '隐藏')}</td>
<td>${fns:getDictLabel(tpl.showModes, 'cms_show_modes', '默认展现方式')}</td>
<td>
<a href="${pageContext.request.contextPath}${fns:getFrontPath()}/list-${tpl.id}${fns:getUrlSuffix()}"
target="_blank">访问</a>
<shiro:hasPermission name="cms:category:edit">
<a href="${ctx}/cms/category/form?id=${tpl.id}">修改</a>
<a href="${ctx}/cms/category/delete?id=${tpl.id}"
onclick="return confirmx('要删除该栏目及所有子栏目项吗?', this.href)">删除</a>
<a href="${ctx}/cms/category/form?parent.id=${tpl.id}">添加下级栏目</a>
</shiro:hasPermission>
</td>
</tr>
</c:forEach>
</table>
</form>
<!-- 分页代码 -->
${page.toStringPage()}
</div>
</div>
</div>
<!-- 信息-->
<div id="messageBox">${message}</div>
<%@ include file="/WEB-INF/views/include/footJs.jsp" %>
<script src="/staticViews/viewBase.js"></script></body>
</html>
\ No newline at end of file
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>内容管理</title>
<meta name="decorator" content="default"/>
<%@ include file="/WEB-INF/views/include/headMeta.jsp" %>
<%@ include file="/WEB-INF/views/include/headCss.jsp" %>
<%@ include file="/WEB-INF/views/include/headJs.jsp" %>
</head>
<body>
<div id="content" class="row-fluid row">
<div class="col-sm-2">
<iframe id="cmsMenuFrame" name="cmsMenuFrame" src="${ctx}/cms/tree" style="overflow:visible;"
scrolling="yes" frameborder="no" width="100%"></iframe>
</div>
<!--div id="openClose" class="close">&nbsp;</div-->
<div class="col-sm-10">
<iframe id="cmsMainFrame" name="cmsMainFrame" src="${ctx}/cms/article/?category.id=2" style="overflow:visible;"
scrolling="yes" frameborder="no" width="100%"></iframe>
</div>
</div>
<script type="text/javascript">
var leftWidth = "160"; // 左侧窗口大小
function wSize(){
var strs=getWindowSize().toString().split(",");
$("#cmsMenuFrame, #cmsMainFrame, #openClose").height(strs[0]-5);
$("#right").width($("body").width()-$("#left").width()-$("#openClose").width()-20);
}
// 鼠标移动到边界自动弹出左侧菜单
$("#openClose").mouseover(function(){
if($(this).hasClass("open")){
$(this).click();
}
});
</script>
<script src="${ctxStatic}/common/wsize.min.js" type="text/javascript"></script>
</body>
</html>
\ No newline at end of file
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<title>公共模型</title>
<meta name="decorator" content="default"/>
</head>
<body>
请在左侧“栏目列表”中选择(非公共模型)栏目。
</body>
</html>
\ No newline at end of file
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>栏目列表</title>
<meta name="decorator" content="default"/>
<%@ include file="/WEB-INF/views/include/head.jsp"%>
<%@include file="/WEB-INF/views/include/treeview.jsp" %>
<style type="text/css">
.ztree {overflow:auto;margin:0;_margin-top:10px;padding:10px 0 0 10px;}<%--
.ztree li span.button.level0, .ztree li a.level0 {display:none;height:0;}
.ztree li ul.level0 {padding:0;background:none;}--%>
.accordion-inner{padding:2px;}
</style>
<script type="text/javascript">
$(document).ready(function(){
var setting = {view:{selectedMulti:false},data:{simpleData:{enable:true}}};
var zNodes=[
<c:forEach items="${categoryList}" var="tpl">{id:'${tpl.id}', pId:'${not empty tpl.parent?tpl.parent.id:0}', name:"${tpl.name}", url:"${ctx}/cms/${not empty tpl.module?tpl.module:'none'}/?category.id=${tpl.id}", target:"cmsMainFrame"},
</c:forEach>];
for(var i=0; i<zNodes.length; i++) {
// 移除父节点
if (zNodes[i] && zNodes[i].id == 1){
zNodes.splice(i, 1);
}<%--
// 并将没有关联关系的父节点,改为父节点
var isExistParent = false;
for(var j=0; j<zNodes.length; j++) {
if (zNodes[i].pId == zNodes[j].id){
isExistParent = true;
break;
}
}
if (!isExistParent){
zNodes[i].pId = 1;
}--%>
}
// 初始化树结构
var tree = $.fn.zTree.init($("#tree"), setting, zNodes);
// 展开第一级节点
var nodes = tree.getNodesByParam("level", 0);
for(var i=0; i<nodes.length; i++) {
tree.expandNode(nodes[i], true, true, false);
}
// 展开第二级节点
nodes = tree.getNodesByParam("level", 1);
for(var i=0; i<nodes.length; i++) {
tree.expandNode(nodes[i], true, true, false);
}
wSize();
});
$(window).resize(function(){
wSize();
});
function wSize(){
$(".ztree").width($(window).width()-16).height($(window).height()-62);
$(".ztree").css({"overflow":"auto","overflow-x":"auto","overflow-y":"auto"});
$("html,body").css({"overflow":"hidden","overflow-x":"hidden","overflow-y":"hidden"});
}
</script>
</head>
<body>
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle">栏目列表</a>
</div>
<div class="accordion-body">
<div class="accordion-inner">
<div id="tree" class="ztree"></div>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
<title>评论管理</title>
<meta name="decorator" content="default"/>
<%@ include file="/WEB-INF/views/include/headMeta.jsp" %>
<%@ include file="/WEB-INF/views/include/headCss.jsp" %>
<%@ include file="/WEB-INF/views/include/headJs.jsp" %>
<script type="text/javascript">
function view(href) {
top.$.jBox.open('iframe:' + href, '查看文档', $(top.document).width() - 220, $(top.document).height() - 180, {
buttons: {"关闭": true},
loaded: function (h) {
//$(".jbox-content", top.document).css("overflow-y","hidden");
//$(".nav,.form-actions,[class=btn]", h.find("iframe").contents()).hide();
}
});
return false;
}
function page(n, s) {
$("#pageNo").val(n);
$("#pageSize").val(s);
$("#searchForm").submit();
return false;
}
</script>
</head>
<body>
<!-- 内容-->
<div class="wrapper">
<!-- 内容盒子-->
<div class="box box-main">
<!-- 内容盒子头部 -->
<div class="box-header">
<div class="box-title"><i class="fa fa-edit"></i>评论列表</div>
<div class="box-tools pull-right">
<a id="btnSearchView" href="#" class="btn btn-sm btn-default" title="查询"><i class="fa fa-filter"></i>查询</a>
<button id="btnRefresh" class="btn btn-default btn-sm" title="刷新"><i
class="glyphicon glyphicon-repeat"></i> 刷新
</button>
<!--shiro hasPermission name="cms:comment:edit">
<a href="${ctx}/cms/comment/form?id=${comment.id}" class="btn btn-default btn-sm">评论添加</a>
</shiro hasPermission-->
</div>
</div>
<!-- 内容盒子身体 -->
<div class="box-body">
<!-- 查询条件 -->
<form:form id="searchForm" modelAttribute="comment" action="${ctx}/cms/comment/" method="post"
class="form-inline">
<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
<div class="form-group">
<label class="control-label">文档标题:</label>
<form:input path="title" htmlEscape="false" maxlength="50" class=" form-control input-sm"/>
</div>
<div class="form-group">
<label class="control-label">状态:</label>
<form:radiobuttons onclick="$('#searchForm').submit();" path="delFlag"
items="${fns:getDictList('cms_del_flag')}" itemLabel="label" itemValue="value"
htmlEscape="false"/>
</div>
<div class="form-group"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></div>
</form:form>
<table id="contentTable" class="table table-bordered table-condensed">
<thead>
<tr>
<th>评论内容</th>
<th>文档标题</th>
<th>评论人</th>
<th>评论IP</th>
<th>评论时间</th>
<th nowrap="nowrap">操作</th>
</tr>
</thead>
<tbody>
<c:forEach items="${page.list}" var="comment">
<tr>
<td><a href="javascript:"
onclick="$('#c_${comment.id}').toggle()">${fns:abbr(fns:replaceHtml(comment.content),40)}</a>
</td>
<td>
<a href="${pageContext.request.contextPath}${fns:getFrontPath()}/view-${comment.category.id}-${comment.contentId}${fns:getUrlSuffix()}"
title="${comment.title}"
onclick="return view(this.href);">${fns:abbr(comment.title,40)}</a></td>
<td>${comment.name}</td>
<td>${comment.ip}</td>
<td><fmt:formatDate value="${comment.createDate}" type="both"/></td>
<td><shiro:hasPermission name="cms:comment:edit">
<c:if test="${comment.delFlag ne '2'}"><a
href="${ctx}/cms/comment/delete?id=${comment.id}${comment.delFlag ne 0?'&isRe=true':''}"
onclick="return confirmx('确认要${comment.delFlag ne 0?'恢复审核':'删除'}该审核吗?', this.href)">${comment.delFlag ne 0?'恢复审核':'删除'}</a></c:if>
<c:if test="${comment.delFlag eq '2'}"><a
href="${ctx}/cms/comment/save?id=${comment.id}">审核通过</a></c:if></shiro:hasPermission>
</td>
</tr>
<tr id="c_${comment.id}" style="background:#fdfdfd;display:none;">
<td colspan="6">${fns:replaceHtml(comment.content)}</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
</div>
<!-- 信息-->
<div id="messageBox">${message}</div>
<%@ include file="/WEB-INF/views/include/footJs.jsp" %>
<script src="/staticViews/viewBase.js"></script></body>
</html>
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