mirror of
https://gitee.com/jamen/slife.git
synced 2026-11-01 06:43:39 +00:00
加入 博客 模块
This commit is contained in:
@@ -44,6 +44,7 @@
|
||||
<module>slife-activiti</module>
|
||||
<module>slife-log</module>
|
||||
<module>slife-test</module>
|
||||
<module>slife-blog</module>
|
||||
</modules>
|
||||
|
||||
<!--全局依赖-->
|
||||
@@ -211,6 +212,11 @@
|
||||
<version>${slife.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.slife</groupId>
|
||||
<artifactId>slife-blog</artifactId>
|
||||
<version>${slife.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.slife</groupId>
|
||||
<artifactId>slife-sys</artifactId>
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>slife</artifactId>
|
||||
<groupId>com.slife</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>slife-blog</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.slife</groupId>
|
||||
<artifactId>slife-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.slife.controller;
|
||||
|
||||
import com.slife.base.controller.BaseController;
|
||||
import com.slife.base.vo.DataTable;
|
||||
import com.slife.entity.BlogContent;
|
||||
import com.slife.service.IBlogContentService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @author chen
|
||||
* @date 2017/11/20
|
||||
* <p>
|
||||
* Email 122741482@qq.com
|
||||
* <p>
|
||||
* Describe:
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "/blog/content")
|
||||
public class BlogContentController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IBlogContentService blogContentService;
|
||||
|
||||
|
||||
@ApiOperation(value = "进入博客列表界面", notes = "进入博客列表界面")
|
||||
@GetMapping(value = "")
|
||||
public String list(Model model, HttpServletRequest request) {
|
||||
model.addAttribute("url", request.getContextPath() + "/blog/content/");
|
||||
return "blog/list";
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取列表列表数据", notes = "获取列表列表数据:使用约定的DataTable")
|
||||
@PostMapping(value = "/list")
|
||||
@ResponseBody
|
||||
public DataTable<BlogContent> list(@RequestBody DataTable dt, ServletRequest request) {
|
||||
return blogContentService.pageSearch(dt);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "进入博客编辑界面", notes = "进入博客编辑界面")
|
||||
@GetMapping(value = "")
|
||||
public String detail(Model model, HttpServletRequest request) {
|
||||
model.addAttribute("url", request.getContextPath() + "/blog/content/");
|
||||
return "blog/detail";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.slife.dao;
|
||||
|
||||
import com.slife.base.dao.CrudDao;
|
||||
import com.slife.entity.BlogContent;
|
||||
|
||||
/**
|
||||
* Created by chen on 2017/11/20.
|
||||
* <p>
|
||||
* Email 122741482@qq.com
|
||||
* <p>
|
||||
* Describe:
|
||||
*/
|
||||
public interface BlogContentDao extends CrudDao<BlogContent> {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.slife.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotations.TableField;
|
||||
import com.baomidou.mybatisplus.annotations.TableName;
|
||||
import com.slife.base.entity.BaseEntity;
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author chen
|
||||
* @date 2017/11/20
|
||||
* <p>
|
||||
* Email 122741482@qq.com
|
||||
* <p>
|
||||
* Describe: 博客
|
||||
*/
|
||||
@TableName("blog_content")
|
||||
public class BlogContent extends BaseEntity<BlogContent> {
|
||||
|
||||
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* varchar(255) NULL标题
|
||||
*/
|
||||
@NotBlank
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* text NULL内容
|
||||
*/
|
||||
@NotBlank
|
||||
private String content;
|
||||
/**
|
||||
* varchar(16) NULL类型
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* varchar(200) NULL标签
|
||||
*/
|
||||
private String tags;
|
||||
|
||||
/**
|
||||
* varchar(200)NULL分类
|
||||
*/
|
||||
private String categories;
|
||||
|
||||
/**
|
||||
* int(1)NULL开启评论
|
||||
*/
|
||||
@TableField(value = "allow_comment")
|
||||
private Integer allowComment;
|
||||
|
||||
/**
|
||||
* int(1)NULL状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* varchar(100)NULL作者
|
||||
*/
|
||||
private String author;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.slife.service;
|
||||
|
||||
import com.slife.base.service.IBaseService;
|
||||
import com.slife.entity.BlogContent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chen
|
||||
* @date 2017/11/20
|
||||
* <p>
|
||||
* Email 122741482@qq.com
|
||||
* <p>
|
||||
* Describe:
|
||||
*/
|
||||
public interface IBlogContentService extends IBaseService<BlogContent> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.slife.service.impl;
|
||||
|
||||
import com.slife.base.service.impl.BaseService;
|
||||
import com.slife.dao.BlogContentDao;
|
||||
import com.slife.entity.BlogContent;
|
||||
import com.slife.service.IBlogContentService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chen
|
||||
* @date 2017/11/20
|
||||
* <p>
|
||||
* Email 122741482@qq.com
|
||||
* <p>
|
||||
* Describe:
|
||||
*/
|
||||
@Service
|
||||
@Transactional(readOnly = true, rollbackFor = Exception.class)
|
||||
public class BlogContentService extends BaseService<BlogContentDao, BlogContent> implements IBlogContentService {
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>博客编辑</title>
|
||||
|
||||
<link href="${base}/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
|
||||
<link href="${base}/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
|
||||
<link href="${base}/css/animate.css" rel="stylesheet">
|
||||
<link href="${base}/css/style.css?v=4.1.0" rel="stylesheet">
|
||||
<link href="${base}/css/slife.css" rel="stylesheet">
|
||||
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="${base}/css/plugins/jsTree/style.min.css"/>
|
||||
<!-- 全局js -->
|
||||
<script src="${base}/js/jquery.min.js?v=2.1.4"></script>
|
||||
<script src="${base}/js/bootstrap.min.js?v=3.3.6"></script>
|
||||
<script src="${base}/js/plugins/validate/jquery.validate.min.js"></script>
|
||||
<script src="${base}/js/plugins/validate/messages_zh.min.js"></script>
|
||||
<script src="${base}/js/plugins/layer/layer.min.js"></script>
|
||||
<script src="${base}/js/jquery.form.js"></script>
|
||||
|
||||
|
||||
<script>
|
||||
var url = "${url}", action = "${action}";
|
||||
|
||||
</script>
|
||||
<script src="${base}/js/slife/slife.js"></script>
|
||||
<script src="${base}/js/slife/slifeform.js"></script>
|
||||
</head>
|
||||
|
||||
<body class="gray-bg">
|
||||
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-content">
|
||||
<div class="col-sm-12">
|
||||
<h4>发布文章</h4>
|
||||
</div>
|
||||
<form class="form-horizontal m-t" id="signupForm">
|
||||
<input id="cid" name="cid" type="hidden">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-1 control-label">标题:</label>
|
||||
<div class="col-sm-4">
|
||||
<input id="title" name="title" class="form-control" type="text">
|
||||
</div>
|
||||
<label class="col-sm-1 control-label">作者:</label>
|
||||
<div class="col-sm-4">
|
||||
<input id="author" name="author" class="form-control"
|
||||
type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input id="content" name="content" type="hidden"> <label
|
||||
class="col-sm-1 control-label">内容:</label>
|
||||
<div class="col-sm-11">
|
||||
<div class="ibox-content no-padding">
|
||||
<div id="content_sn" class="summernote"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-1 control-label">类型:</label>
|
||||
<div class="col-sm-11">
|
||||
<input id="categories" name="categories" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">开启评论:</label>
|
||||
<div class="switch onoffswitch col-sm-1">
|
||||
<div class="onoffswitch">
|
||||
<input id="allowComment" name="allowComment" checked=""
|
||||
type="checkbox" value="1" class="onoffswitch-checkbox"
|
||||
id="example1"> <label class="onoffswitch-label"
|
||||
for="example1"> <span class="onoffswitch-inner"></span>
|
||||
<span class="onoffswitch-switch"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="col-sm-2 control-label">允许订阅:</label>
|
||||
<div class="switch onoffswitch col-sm-2">
|
||||
<div class="onoffswitch">
|
||||
<input id="allowFeed" name="allowFeed" type="checkbox"
|
||||
value="1" class="onoffswitch-checkbox" id="example3">
|
||||
<label class="onoffswitch-label" for="example3"> <span
|
||||
class="onoffswitch-inner"></span> <span
|
||||
class="onoffswitch-switch"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<input id="status" name="status" type="hidden">
|
||||
</div>
|
||||
<div class="text-right form-group">
|
||||
<a class="btn btn-default waves-effect waves-light"
|
||||
onclick="returnList()">返回列表</a>
|
||||
<button type="button"
|
||||
class="btn btn-primary waves-effect waves-light" type="submit">保存文章
|
||||
</button>
|
||||
<button type="button"
|
||||
class="btn btn-warning waves-effect waves-light"
|
||||
onclick="save(0)">存为草稿
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,127 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>博客列表</title>
|
||||
<link href="${base}/css/font-awesome.css?v=4.4.0" rel="stylesheet">
|
||||
<link href="${base}/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
|
||||
<link href="${base}/css/animate.css" rel="stylesheet">
|
||||
<script>
|
||||
var url = "${url}";
|
||||
</script>
|
||||
</head>
|
||||
|
||||
|
||||
<body class="gray-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="col-sm-12">
|
||||
<div class="ibox">
|
||||
<div class="ibox-body">
|
||||
|
||||
<div id="exampleToolbar" role="group">
|
||||
|
||||
<label style="margin-left: 10px;">
|
||||
标题:
|
||||
<input type="text" class="form-filter input-sm _search" name="search_like_title">
|
||||
</label>
|
||||
<label style="margin-left: 10px;">
|
||||
内容:
|
||||
<input type="text" class="form-filter input-sm _search" name="search_like_content">
|
||||
</label>
|
||||
<label style="margin-left: 10px;">
|
||||
类型:
|
||||
<input type="text" class="form-filter input-sm _search" name="search_eq_type">
|
||||
</label>
|
||||
|
||||
<label style="margin-left: 10px;">
|
||||
<button class="btn btn-success" onclick="re_load()">
|
||||
<i class="fa fa-search" aria-hidden="true"></i>查询
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary" onclick="reset()">
|
||||
<i class="fa fa-circle-thin" aria-hidden="true"></i>重置
|
||||
</button>
|
||||
<button type="button" class="btn btn-danger" onclick="batch_remove()">
|
||||
<i class="fa fa-trash" aria-hidden="true"></i>删除
|
||||
</button>
|
||||
</label>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<table id="exampleTable" data-mobile-responsive="true">
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Bootstrap table -->
|
||||
<script src="${base}/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
|
||||
<script src="${base}/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
|
||||
<script src="${base}/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
|
||||
|
||||
<script src="${base}/js/slife/datatable.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
|
||||
function getcolumns() {
|
||||
var c = [
|
||||
{
|
||||
checkbox: true
|
||||
},
|
||||
{
|
||||
field: 'id', // 列字段名
|
||||
title: '序号' // 列标题
|
||||
},
|
||||
{
|
||||
field: 'updateDate',
|
||||
title: '修改时间'
|
||||
},
|
||||
{
|
||||
field: 'title',
|
||||
title: '标题'
|
||||
},
|
||||
{
|
||||
field: 'tags',
|
||||
title: '标签'
|
||||
},
|
||||
{
|
||||
field: 'type',
|
||||
title: '类型'
|
||||
},
|
||||
{
|
||||
field: 'categories',
|
||||
title: '分类'
|
||||
},
|
||||
{
|
||||
field: 'allowComment',
|
||||
title: '可评论'
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '状态'
|
||||
},
|
||||
{
|
||||
field: 'author',
|
||||
title: '作者'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
field: 'id',
|
||||
align: 'center',
|
||||
formatter: function (value, row, index) {
|
||||
return dt_delete_button(row);
|
||||
}
|
||||
}];
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
load_data( getcolumns(), {"update_date": "desc"});
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -38,7 +38,7 @@ public class BaseService<M extends BaseMapper<T>, T> extends ServiceImpl<M, T> i
|
||||
*/
|
||||
protected <F extends TreeEntity> List<JsTree> makeTree( List<F> ts){
|
||||
List<JsTree> res = new ArrayList();
|
||||
ts.stream().parallel().forEach(t->{
|
||||
ts.stream().forEach(t->{
|
||||
JsTree jt = new JsTree();
|
||||
jt.setId(t.getId().toString());
|
||||
jt.setParent(t.getParentId() == null ? "#" : (t.getParentId().compareTo(0L) > 0 ? t
|
||||
|
||||
@@ -34,10 +34,6 @@ public class SysDictController extends BaseController {
|
||||
*/
|
||||
@GetMapping(value = "")
|
||||
public String list(Model model) {
|
||||
System.out.println(sysDictService);
|
||||
System.out.println(AopUtils.isAopProxy(sysDictService));
|
||||
System.out.println(AopUtils.isCglibProxy(sysDictService));
|
||||
System.out.println(AopUtils.isJdkDynamicProxy(sysDictService));
|
||||
model.addAttribute("dictTrees", JSON.toJSON(sysDictService.getDictTree()).toString());
|
||||
return "dict/list";
|
||||
}
|
||||
|
||||
@@ -59,16 +59,6 @@ public class SysMenuController extends BaseController{
|
||||
|
||||
model.addAttribute("menuTree", JSON.toJSONString(sysMenuService.getMenuTree()));
|
||||
model.addAttribute("menuTypes", SysMenuType.values());
|
||||
|
||||
System.out.println(this);
|
||||
System.out.println(AopUtils.isAopProxy(this));
|
||||
System.out.println(AopUtils.isCglibProxy(this));
|
||||
System.out.println(AopUtils.isJdkDynamicProxy(this));
|
||||
|
||||
System.out.println(sysMenuService);
|
||||
System.out.println(AopUtils.isAopProxy(sysMenuService));
|
||||
System.out.println(AopUtils.isCglibProxy(sysMenuService));
|
||||
System.out.println(AopUtils.isJdkDynamicProxy(sysMenuService));
|
||||
return "menu/list";
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ import java.util.Map;
|
||||
@RequestMapping(value = "/sys/office")
|
||||
public class SysOfficeController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ISysOfficeService sysOfficeService;
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ public class SysMenuService extends BaseService<SysMenuDao, SysMenu> implements
|
||||
@Override
|
||||
public List<JsTree> getMenuTree() {
|
||||
|
||||
List<SysMenu> sysMenus = selectList(null);
|
||||
List<SysMenu> sysMenus = selectList(Condition.create().orderBy("sort", true));
|
||||
return makeTree(sysMenus);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.slife.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.mapper.Condition;
|
||||
import com.slife.base.service.impl.BaseService;
|
||||
import com.slife.base.vo.JsTree;
|
||||
import com.slife.constant.Global;
|
||||
@@ -32,7 +33,7 @@ public class SysOfficeService extends BaseService<SysOfficeDao, SysOffice> imple
|
||||
*/
|
||||
@Override
|
||||
public List<JsTree> getOfficeTree() {
|
||||
List<SysOffice> sysOffices = selectList(null);
|
||||
List<SysOffice> sysOffices = selectList(Condition.create().orderBy("sort", true));
|
||||
return makeTree(sysOffices);
|
||||
|
||||
}
|
||||
|
||||
+4
-1
@@ -36,7 +36,10 @@
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.slife</groupId>
|
||||
<artifactId>slife-blog</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.slife</groupId>
|
||||
<artifactId>slife-sys</artifactId>
|
||||
|
||||
@@ -14,7 +14,8 @@ public class WebSiteMeshFilter extends ConfigurableSiteMeshFilter {
|
||||
|
||||
/** 需要装饰的访问路径 */
|
||||
|
||||
private String contentPath="/sys/user,/sys/menu,/sys/dict,/sys/role,/sys/office,/sys/,/index,/monitor/*,/404";
|
||||
private String contentPath="/sys/user,/sys/menu,/sys/dict,/sys/role,/sys/office,/sys/,/index,/monitor/*," +
|
||||
"/blog/content,/404";
|
||||
|
||||
/** 装饰器页面路径 */
|
||||
|
||||
|
||||
@@ -28,9 +28,9 @@ spring:
|
||||
|
||||
datasource:
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
url: jdbc:mysql://xx-:3306/slife?useUnicode=true&characterEncoding=utf8&useSSL=false
|
||||
url: jdbc:mysql://127.0.0.1:3306/slife?useUnicode=true&characterEncoding=utf8&useSSL=false
|
||||
username: root
|
||||
password: chen@123
|
||||
password: root
|
||||
druid:
|
||||
validationQuery: SELECT 1
|
||||
initialSize: 10
|
||||
|
||||
Reference in New Issue
Block a user