package org.tedu.cloudnote.service;
import java.sql.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.tedu.cloudnote.dao.DynamicDao;
import org.tedu.cloudnote.dao.NoteDao;
import org.tedu.cloudnote.entity.Note;
import org.tedu.cloudnote.util.NoteResult;
import org.tedu.cloudnote.util.NoteUtil;
import org.tedu.cloudnote.vo.SearchNoteParams;
@Service("noteService")
@Transactional
public class NoteServiceImpl implements NoteService{
@Resource
private NoteDao noteDao;
public NoteResult loadBookNotes(String bookId) {
NoteResult result = new NoteResult();
List<Note> notes =
noteDao.findByBookId(bookId);
result.setStatus(0);
result.setMsg("加载笔记列表成功");
result.setData(notes);
return result;
}
public NoteResult loadNote(String noteId) {
NoteResult result = new NoteResult();
Note note = noteDao.findById(noteId);
result.setStatus(0);
result.setMsg("加载笔记内容成功");
result.setData(note);
return result;
}
public NoteResult addNote(
String bookId, String userId,
String noteTitle) {
Note note = new Note();
note.setCn_notebook_id(bookId);
note.setCn_user_id(userId);
note.setCn_note_title(noteTitle);
note.setCn_note_body("");
String noteId = NoteUtil.createId();
note.setCn_note_id(noteId);
note.setCn_note_status_id("1");//normal
note.setCn_note_type_id("1");//normal
long time = System.currentTimeMillis();
note.setCn_note_create_time(time);
note.setCn_note_last_modify_time(time);
noteDao.save(note);
//返回结果
NoteResult result = new NoteResult();
result.setStatus(0);
result.setMsg("创建笔记成功");
result.setData(noteId);//返回笔记ID
return result;
}
public NoteResult updateNote(
String noteId, String noteTitle,
String noteBody) {
Note note = new Note();
note.setCn_note_id(noteId);
note.setCn_note_title(noteTitle);
note.setCn_note_body(noteBody);
long time = System.currentTimeMillis();
note.setCn_note_last_modify_time(time);
// int rows = noteDao.updateContent(note);
int rows = dynamicDao.dynamicUpdateNote(note);
//更新cn_share表的笔记信息
NoteResult result = new NoteResult();
if(rows==0){
result.setStatus(1);
result.setMsg("保存笔记失败");
}else{
result.setStatus(0);
result.setMsg("保存笔记成功");
}
return result;
}
public NoteResult recycleNote(String noteId) {
// Map<String,Object> map =
// new HashMap<String,Object>();
// map.put("noteId", noteId);
// map.put("statusId", "2");
// noteDao.updateStatus(map);
Note note = new Note();
note.setCn_note_status_id("2");
note.setCn_note_id(noteId);
dynamicDao.dynamicUpdateNote(note);
NoteResult result = new NoteResult();
result.setStatus(0);
result.setMsg("删除笔记成功");
return result;
}
@Resource
private DynamicDao dynamicDao;
public NoteResult loadSearchNotes(
SearchNoteParams params) {
Map<String,Object> mapParams =
new HashMap<String, Object>();
//参数处理
if(!"".equals(params.getTitle())
&¶ms.getTitle() != null){
String title = "%"+params.getTitle()+"%";
mapParams.put("title", title);
}
if(!"0".equals(params.getStatus())
&& params.getStatus()!=null){
mapParams.put("status", params.getStatus());
}
if(!"".equals(params.getBeginDate())
&& params.getBeginDate()!=null){
Date begin = Date.valueOf(
params.getBeginDate());
mapParams.put("beginDate", begin.getTime());
}
if(!"".equals(params.getEndDate())
&& params.getEndDate() != null){
Date end = Date.valueOf(
params.getEndDate());
mapParams.put("endDate", end.getTime());
}
//执行查询
List<Note> list =
dynamicDao.dynamicFindNotes(mapParams);
NoteResult result = new NoteResult();
result.setStatus(0);
result.setMsg("搜索成功");
result.setData(list);
return result;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
达内云笔记项目完整代码+注释
共404个文件
svn-base:152个
java:50个
png:32个
3星 · 超过75%的资源 需积分: 5 118 下载量 45 浏览量
2018-07-15
13:51:31
上传
评论 14
收藏 13.07MB ZIP 举报
温馨提示
达内课程项目云笔记项目,采用SSM框架,完整实现云笔记功能,代码注释详细,结构清晰,方便学习模仿
资源推荐
资源详情
资源评论
收起资源包目录
达内云笔记项目完整代码+注释 (404个子文件)
all-wcprops 3KB
all-wcprops 2KB
all-wcprops 2KB
all-wcprops 2KB
all-wcprops 2KB
all-wcprops 1KB
all-wcprops 953B
all-wcprops 943B
all-wcprops 830B
all-wcprops 631B
all-wcprops 615B
all-wcprops 453B
all-wcprops 439B
all-wcprops 439B
all-wcprops 427B
all-wcprops 425B
all-wcprops 310B
all-wcprops 280B
all-wcprops 278B
all-wcprops 266B
all-wcprops 266B
all-wcprops 127B
.classpath 3KB
main.css 252KB
icon.css 241KB
umeditor.min.css 14KB
login.css 3KB
image.css 3KB
login_ghost.css 3KB
video.css 3KB
emotion.css 2KB
prettify.css 1KB
formula.css 869B
entries 3KB
entries 2KB
entries 2KB
entries 2KB
entries 2KB
entries 1KB
entries 1KB
entries 1KB
entries 909B
entries 727B
entries 710B
entries 570B
entries 560B
entries 554B
entries 554B
entries 536B
entries 413B
entries 403B
entries 401B
entries 395B
entries 389B
entries 310B
fontawesome-webfont.eot 37KB
glyphicons-halflings-regular.eot 20KB
wface.gif 49KB
jxface2.gif 40KB
yface.gif 28KB
bface.gif 27KB
tface.gif 19KB
fface.gif 18KB
cface.gif 8KB
0.gif 43B
edit.html 15KB
activity_detail.html 10KB
formula.html 7KB
map.html 6KB
activity.html 4KB
log_in.html 4KB
Change_password.html 4KB
note_manager.html 2KB
alert_replay.html 1KB
alert_note.html 1KB
alert_move.html 1KB
alert_notebook.html 1KB
alert_rename.html 1KB
alert_delete_note.html 921B
alert_like.html 914B
alert_delete_like.html 911B
alert_delete_rollback.html 901B
alert_delete_notebook.html 896B
alert_error.html 833B
favicon.ico 4KB
ojdbc6.jar 2.01MB
aspectjweaver.jar 1.47MB
jackson-databind-2.4.1.jar 1.02MB
spring-core-3.2.8.RELEASE.jar 853KB
spring-context-3.2.8.RELEASE.jar 846KB
mysql-connector-java-5.1.8-bin.jar 707KB
mybatis-3.2.5.jar 700KB
spring-webmvc-3.2.8.RELEASE.jar 623KB
spring-web-3.2.8.RELEASE.jar 614KB
spring-beans-3.2.8.RELEASE.jar 598KB
commons-collections-3.1.jar 546KB
spring-jdbc-3.2.8.RELEASE.jar 396KB
standard.jar 343KB
spring-aop-3.2.8.RELEASE.jar 330KB
commons-codec-1.9.jar 258KB
共 404 条
- 1
- 2
- 3
- 4
- 5
资源评论
- wyiqijuechen2019-03-04感觉还不错
- Mrseal丶2019-05-08不是想要的1分不值,想要的不差这些分
taikedadedaken
- 粉丝: 25
- 资源: 16
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功