代码提交
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.yaoyuan.jiscuss.controller;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -55,7 +56,10 @@ public class UserPostController extends BaseController {
|
||||
logger.info(">>> getDiscussionsById{}",id);
|
||||
|
||||
Discussions discussions = discussionsService.findOne(id);
|
||||
|
||||
List<Posts> posts = postsService.findOneBy(id);
|
||||
map.put("discussions", discussions);
|
||||
map.put("posts", posts);
|
||||
UserInfo user = getUserInfo(request);
|
||||
if(user != null){
|
||||
map.put("username", user.getUsername());
|
||||
|
||||
@@ -40,6 +40,9 @@ public class Posts implements Serializable{
|
||||
@Column(name="content")
|
||||
private String content;
|
||||
|
||||
@Column(name="parent_id")
|
||||
private Integer parent_id;
|
||||
|
||||
@Column(name="edit_time")
|
||||
private Date edit_time;
|
||||
|
||||
|
||||
@@ -1,9 +1,23 @@
|
||||
package com.yaoyuan.jiscuss.repository;
|
||||
|
||||
import com.yaoyuan.jiscuss.entity.Posts;
|
||||
import com.yaoyuan.jiscuss.entity.Users;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface PostsRepository extends JpaRepository<Posts,Integer> {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param dId
|
||||
* @return
|
||||
*/
|
||||
@Query("from Posts where discussion_id = :dId")
|
||||
List<Posts> findOneBy(@Param("dId")Integer dId);
|
||||
|
||||
}
|
||||
|
||||
@@ -8,4 +8,6 @@ public interface IPostsService {
|
||||
List<Posts> getAllList();
|
||||
|
||||
Posts insert(Posts posts);
|
||||
|
||||
List<Posts> findOneBy(Integer id);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.yaoyuan.jiscuss.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -23,6 +24,14 @@ public class PostsServiceImpl implements IPostsService {
|
||||
return postsRepository.findAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Posts> findOneBy(Integer id) {
|
||||
|
||||
List<Posts> ss = postsRepository.findOneBy(id);
|
||||
return ss;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Posts insert(Posts posts) {
|
||||
return postsRepository.save(posts);
|
||||
|
||||
@@ -56,6 +56,7 @@ type varchar(20),
|
||||
content text,
|
||||
edit_time datetime,
|
||||
edit_user_id INTEGER,
|
||||
parent_id INTEGER,
|
||||
ip_address varchar(200),
|
||||
copyright varchar(200),
|
||||
is_approved INTEGER,
|
||||
|
||||
@@ -15,8 +15,8 @@ $("#addPost").click(function () {
|
||||
var header = $("meta[name='_csrf_header']").attr("content");
|
||||
console.warn(header)
|
||||
console.warn(token)
|
||||
var title = $("#postcontent").val();
|
||||
console.log(title);
|
||||
var content = $("#postcontent").val();
|
||||
console.log(content);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/newpost",
|
||||
@@ -32,11 +32,10 @@ $("#addPost").click(function () {
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
if(data.flag){
|
||||
window.alert(title+',添加成功!');
|
||||
$('.ui.modal.createNewDiccuss').modal('hide');
|
||||
massage(title+',添加成功!','');
|
||||
location.reload();
|
||||
}else{
|
||||
window.alert(data.msg);
|
||||
massage(data.msg,'');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,11 +83,11 @@ $("#newdiscussions").click(function(){
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
if(data.flag){
|
||||
window.alert(title+',添加成功!');
|
||||
massage(title+',添加成功!','');
|
||||
$('.ui.modal.createNewDiccuss').modal('hide');
|
||||
location.reload();
|
||||
}else{
|
||||
window.alert(data.msg);
|
||||
massage(data.msg,'');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -123,10 +123,10 @@ $("#commitnewtags").click(function(){
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
if(data.flag){
|
||||
window.alert(name+',添加成功!');
|
||||
massage(name+',添加成功!','');
|
||||
return false;
|
||||
}else{
|
||||
window.alert(name+',添加失败!');
|
||||
massage(name+',添加失败!','');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -148,7 +148,6 @@ $('#context2 .menu .item')
|
||||
context: 'parent'
|
||||
})
|
||||
;
|
||||
;
|
||||
|
||||
$('.ui.dropdown')
|
||||
.dropdown()
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<#--jquery-->
|
||||
<script crossorigin="anonymous" integrity="sha384-vk5WoKIaW/vJyUAd9n/wmopsmNhiy+L2Z+SBxGYnUkunIxVxAv/UtMOhba/xskxh"
|
||||
src="https://lib.baomitu.com/jquery/3.4.1/jquery.min.js"></script>
|
||||
|
||||
<#--semantic-ui-->
|
||||
<link crossorigin="anonymous" integrity="sha384-ATvSpJEmy1egycrmomcFxVn4Z0A6rfjwlzDQrts/1QRerQhR9EEpEYtdysLpQPuQ"
|
||||
href="https://lib.baomitu.com/semantic-ui/2.4.1/semantic.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" type="text/css" href="/static/semanticui/my.css">
|
||||
<script crossorigin="anonymous" integrity="sha384-6urqf2sgCGDfIXcoxTUOVIoQV+jFr/Zuc4O2wCRS6Rnd8w0OJ17C4Oo3PuXu8ZtF"
|
||||
src="https://lib.baomitu.com/semantic-ui/2.4.1/semantic.min.js"></script>
|
||||
|
||||
<#--tinymce-->
|
||||
<script crossorigin="anonymous" integrity="sha384-CpsBIlOAWHuSRRN235sCBzEeKN6hLT6SpOGRkGadKpYj0gDP7+s3Q8pC38z8uGHH"
|
||||
src="https://lib.baomitu.com/tinymce/5.1.1/tinymce.min.js"></script>
|
||||
|
||||
<#--toastr-->
|
||||
<link crossorigin="anonymous" integrity="sha384-YzEqZ2pBV0i9OmlTyoz75PqwTR8If8GsXBv7HLQclEVqIC3VxIt98/U94ES6CJTR"
|
||||
href="https://lib.baomitu.com/toastr.js/2.1.4/toastr.min.css" rel="stylesheet">
|
||||
|
||||
<script crossorigin="anonymous" integrity="sha384-VDls8ImYGI8SwVxpmjX2Bn27U2TcNodzTNROTusVEWO55+lmL+H9NczoQJk6mwZR"
|
||||
src="https://lib.baomitu.com/toastr.js/2.1.4/toastr.min.js"></script>
|
||||
|
||||
|
||||
+3
-1
@@ -46,6 +46,8 @@
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
function massage(msg,type){
|
||||
window.alert(msg);
|
||||
// window.alert(msg);
|
||||
toastr.info(msg)
|
||||
|
||||
}
|
||||
</script>
|
||||
@@ -10,26 +10,17 @@
|
||||
<meta name="_csrf" content="${_csrf.token}"/>
|
||||
<meta name="_csrf_header" content="${_csrf.headerName}"/>
|
||||
|
||||
<link crossorigin="anonymous" integrity="sha384-ATvSpJEmy1egycrmomcFxVn4Z0A6rfjwlzDQrts/1QRerQhR9EEpEYtdysLpQPuQ"
|
||||
href="https://lib.baomitu.com/semantic-ui/2.4.1/semantic.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" type="text/css" href="/static/semanticui/my.css">
|
||||
|
||||
<script crossorigin="anonymous" integrity="sha384-vk5WoKIaW/vJyUAd9n/wmopsmNhiy+L2Z+SBxGYnUkunIxVxAv/UtMOhba/xskxh"
|
||||
src="https://lib.baomitu.com/jquery/3.4.1/jquery.min.js"></script>
|
||||
<script crossorigin="anonymous" integrity="sha384-6urqf2sgCGDfIXcoxTUOVIoQV+jFr/Zuc4O2wCRS6Rnd8w0OJ17C4Oo3PuXu8ZtF"
|
||||
src="https://lib.baomitu.com/semantic-ui/2.4.1/semantic.min.js"></script>
|
||||
|
||||
|
||||
<#include "comm/commjs.ftl"/>
|
||||
</head>
|
||||
<body>
|
||||
<#include "header.ftl"/>
|
||||
<#include "comm/header.ftl"/>
|
||||
|
||||
<div class="ui container" id="container">
|
||||
<div class="ui info message">
|
||||
<i class="close icon"></i>
|
||||
<div class="header">欢迎来到这里</div>
|
||||
<ul class="list">
|
||||
<li>JAVA + DISCUSS = JISCUSS 。</li>
|
||||
<li>JAVA + DISCUSS = JISCUSS 。${posts?size}</li>
|
||||
<li>简单的,易用的JAVA论坛。</li>
|
||||
<li>请享受发帖回帖带来的乐趣吧!</li>
|
||||
</ul>
|
||||
@@ -151,6 +142,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui section divider"></div>
|
||||
|
||||
<form class="ui reply form">
|
||||
<div class="field">
|
||||
<textarea id="postcontent"></textarea>
|
||||
@@ -168,7 +162,6 @@
|
||||
<div
|
||||
class="widescreen large screen computer tablet only four wide column">
|
||||
|
||||
|
||||
<div class="ui fluid action input">
|
||||
<input type="text" placeholder="搜索...">
|
||||
<div class="ui button">搜索</div>
|
||||
@@ -176,6 +169,35 @@
|
||||
|
||||
<div class="ui section divider"></div>
|
||||
|
||||
<div class="ui card">
|
||||
<div class="content">
|
||||
<div class="header">作者</div>
|
||||
</div>
|
||||
<div class="content">
|
||||
<h4 class="ui sub header">测试人员1</h4>
|
||||
<div class="ui small feed">
|
||||
<div class="event">
|
||||
<div class="content">
|
||||
<div class="summary">
|
||||
<a>Jiscuss</a> 一直, <a>Jiscuss</a> 一感谢支持!
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="event">
|
||||
<div class="content">
|
||||
<div class="summary">
|
||||
<a>2019</a> 测试内容
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="extra content">
|
||||
<button class="ui button">预留按钮</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui card">
|
||||
<div class="content">
|
||||
<div class="header">预留功能</div>
|
||||
@@ -269,7 +291,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<#include "footer.ftl"/>
|
||||
<#include "comm/footer.ftl"/>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
@@ -10,24 +10,11 @@
|
||||
<meta name="_csrf" content="${_csrf.token}"/>
|
||||
<meta name="_csrf_header" content="${_csrf.headerName}"/>
|
||||
|
||||
<script crossorigin="anonymous" integrity="sha384-vk5WoKIaW/vJyUAd9n/wmopsmNhiy+L2Z+SBxGYnUkunIxVxAv/UtMOhba/xskxh"
|
||||
src="https://lib.baomitu.com/jquery/3.4.1/jquery.min.js"></script>
|
||||
<#--semantic-->
|
||||
<link crossorigin="anonymous" integrity="sha384-ATvSpJEmy1egycrmomcFxVn4Z0A6rfjwlzDQrts/1QRerQhR9EEpEYtdysLpQPuQ"
|
||||
href="https://lib.baomitu.com/semantic-ui/2.4.1/semantic.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" type="text/css" href="/static/semanticui/my.css">
|
||||
<script crossorigin="anonymous" integrity="sha384-6urqf2sgCGDfIXcoxTUOVIoQV+jFr/Zuc4O2wCRS6Rnd8w0OJ17C4Oo3PuXu8ZtF"
|
||||
src="https://lib.baomitu.com/semantic-ui/2.4.1/semantic.min.js"></script>
|
||||
|
||||
<#--tinymce-->
|
||||
<script crossorigin="anonymous" integrity="sha384-CpsBIlOAWHuSRRN235sCBzEeKN6hLT6SpOGRkGadKpYj0gDP7+s3Q8pC38z8uGHH"
|
||||
src="https://lib.baomitu.com/tinymce/5.1.1/tinymce.min.js"></script>
|
||||
<#--jquery-cookie-->
|
||||
<script src="https://cdn.bootcdn.net/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.js"></script>
|
||||
<#include "comm/commjs.ftl"/>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<#include "header.ftl"/>
|
||||
<#include "comm/header.ftl"/>
|
||||
|
||||
<div class="ui container" id="container">
|
||||
<div class="ui info message">
|
||||
@@ -433,7 +420,7 @@
|
||||
预留
|
||||
</div>
|
||||
|
||||
<#include "footer.ftl"/>
|
||||
<#include "comm/footer.ftl"/>
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
Reference in New Issue
Block a user