更新notice

This commit is contained in:
sjm 2023-12-28 00:35:23 +08:00
parent b9320ecd9c
commit 4ee3765cf4
3 changed files with 10 additions and 1 deletions

View File

@ -21,7 +21,7 @@ public class CommentController {
// 评论功能 // 评论功能
@RequestMapping("/comment/comment") @RequestMapping("/comment/comment")
public String Reply1(Comment comment){ public String Reply1(Comment comment){
return commentService.Reply1(comment); return commentService.Reply1(comment);
} }
// 回复功能 // 回复功能

View File

@ -12,6 +12,9 @@ import com.lovenav.service.CommentService;
import io.swagger.models.auth.In; import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalTime;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -24,6 +27,9 @@ public class CommentServiceImpl implements CommentService {
// 评论功能 // 评论功能
@Override @Override
public String Reply1(Comment comment){ public String Reply1(Comment comment){
Date date = new Date(System.currentTimeMillis());
comment.setCommentTime(date);
comment.setUpdateTime(date);
int result = commentDao.insert(comment); int result = commentDao.insert(comment);
HashMap<String, Object> hashMap = new HashMap<>(); HashMap<String, Object> hashMap = new HashMap<>();
if(result > 0){ if(result > 0){

View File

@ -7,6 +7,7 @@ import com.lovenav.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
@Service @Service
@ -15,6 +16,8 @@ public class NoticeServiceImpl implements NoticeService {
private NoticeDao noticeDao; private NoticeDao noticeDao;
public String add(Notice notice){ public String add(Notice notice){
HashMap<String,Object> hashMap = new HashMap<>(); HashMap<String,Object> hashMap = new HashMap<>();
Date date = new Date(System.currentTimeMillis());
notice.setCreatetime(date);
int result = noticeDao.insert(notice); int result = noticeDao.insert(notice);
if(result>0){ if(result>0){
hashMap.put("code",200); hashMap.put("code",200);