package com.tarena.test;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.tarena.dao.NoteBookMapper;
import com.tarena.dao.NoteMapper;
import com.tarena.dao.ShareMapper;
import com.tarena.dao.UserMapper;
import com.tarena.entity.Note;
import com.tarena.entity.NoteBook;
import com.tarena.entity.Share;
import com.tarena.entity.User;
public class TestMapper {
private ApplicationContext ctx =
new ClassPathXmlApplicationContext(
"config/applicationContext.xml");
/**
* ShareMapper.findByPage
*/
@Test
public void test13() {
ShareMapper mapper =
ctx.getBean(ShareMapper.class);
Map<String, Object> param =
new HashMap<String, Object>();
param.put("searchKey", "1");
param.put("begin", 10);
param.put("pageSize", 5);
List<Share> list =
mapper.findByPage(param);
for(Share s : list) {
System.out.println(
s.getCn_share_title()
);
}
}
/**
* ShareMapper.findByNoteId
* ShareMapper.update
*/
@Test
public void test12() {
ShareMapper mapper =
ctx.getBean(ShareMapper.class);
List<Share> list =
mapper.findByNoteId("53d1b3ed-59a1-4715-a7b2-9027b0d551e0");
for(Share s : list) {
System.out.println(
s.getCn_share_title() + " " +
s.getCn_share_body()
);
s.setCn_share_title("jsd1410");
s.setCn_share_body("JSD1410");
mapper.update(s);
}
}
/**
* ShareMapper.save
*/
@Test
public void test11() {
ShareMapper mapper =
ctx.getBean(ShareMapper.class);
Share s = new Share();
s.setCn_share_id(UUID.randomUUID().toString());
s.setCn_share_title("jsd1410");
s.setCn_share_body("JSD1410");
s.setCn_note_id("y1");
mapper.save(s);
}
@Test
public void test10() {
NoteMapper mapper =
ctx.getBean(NoteMapper.class);
//模拟要修改的数据
Note note = new Note();
note.setCn_note_id("2bc5b4f4-cf0b-48e9-aec5-37c43288409a");
note.setCn_notebook_id("a3");
note.setCn_user_id("0b765ac0-408b-4ad3-9ee5-5453b7217b1a");
note.setCn_note_title("yyy");
note.setCn_note_create_time(new Long("1423553720468"));
note.setCn_note_last_modify_time(new Long("1423553720468"));
//模拟修改
note.setCn_notebook_id("9581b6b8-4a73-477f-84d6-6c986ddb7edd");
note.setCn_note_body("YYY");
mapper.update(note);
}
/**
* NoteMapper.save
*/
@Test
public void test9() {
NoteMapper mapper =
ctx.getBean(NoteMapper.class);
Note n = new Note();
n.setCn_note_id(UUID.randomUUID().toString());
n.setCn_notebook_id("9581b6b8-4a73-477f-84d6-6c986ddb7edd");
n.setCn_user_id("0b765ac0-408b-4ad3-9ee5-5453b7217b1a");
n.setCn_note_title("SpringMVC");
n.setCn_note_create_time(
System.currentTimeMillis());
n.setCn_note_last_modify_time(
System.currentTimeMillis());
mapper.save(n);
}
/**
* NoteMapper.findByNoteBookId
*/
@Test
public void test8() {
NoteMapper mapper =
ctx.getBean(NoteMapper.class);
List<Note> list =
mapper.findByNoteBookId(
"9581b6b8-4a73-477f-84d6-6c986ddb7edd");
for(Note n : list) {
System.out.println(
n.getCn_note_id() + " " +
n.getCn_note_title() + " " +
n.getCn_note_body()
);
}
}
/**
* NoteBookMapper.update
*/
@Test
public void test7() {
NoteBookMapper mapper =
ctx.getBean(NoteBookMapper.class);
//假设该数据是查出来的
NoteBook n = new NoteBook();
n.setCn_notebook_id(
"deee5903-9481-4e0b-87bb-31983a9bad13");
n.setCn_notebook_name("云笔记项目");
n.setCn_notebook_type_id("5");
n.setCn_user_id(
"0b765ac0-408b-4ad3-9ee5-5453b7217b1a");
//模拟修改行为
n.setCn_notebook_name("cloud note");
mapper.update(n);
}
/**
* NoteBookMapper.findSpecial
*/
@Test
public void test6() {
NoteBookMapper mapper =
ctx.getBean(NoteBookMapper.class);
List<NoteBook> list =
mapper.findSpecial(
"0b765ac0-408b-4ad3-9ee5-5453b7217b1a");
for(NoteBook n : list) {
System.out.println(
n.getCn_notebook_id() + " " +
n.getCn_notebook_name()
);
}
}
/**
* NoteBookMapper.findNormal
*/
@Test
public void test5() {
NoteBookMapper mapper =
ctx.getBean(NoteBookMapper.class);
List<NoteBook> list = mapper.findNormal(
"0b765ac0-408b-4ad3-9ee5-5453b7217b1a");
for(NoteBook n : list) {
System.out.println(
n.getCn_notebook_id() + " " +
n.getCn_notebook_name()
);
}
}
/**
* UserMapper.update
*/
@Test
public void test4() {
UserMapper mapper =
ctx.getBean(UserMapper.class);
User user =
mapper.findByName("zhangsan");
user.setCn_user_password("abc");
user.setCn_user_desc("张小三");
mapper.update(user);
}
/**
* NoteBookMapper.save()
*/
@Test
public void test3() {
NoteBookMapper mapper =
ctx.getBean(NoteBookMapper.class);
NoteBook n = new NoteBook();
n.setCn_notebook_id(
UUID.randomUUID().toString());
n.setCn_user_id(
"52f9b276-38ee-447f-a3aa-0d54e7a736e4");
n.setCn_notebook_type_id("5");
n.setCn_notebook_name("云笔记项目开发");
n.setCn_notebook_createtime(
new Timestamp(System.currentTimeMillis()));
mapper.save(n);
}
/**
* UserMapper.save()
*/
@Test
public void test2() {
UserMapper mapper =
ctx.getBean(UserMapper.class);
User u = new User();
u.setCn_user_id(UUID.randomUUID().toString());
u.setCn_user_name("zhangsan");
u.setCn_user_password("123");
u.setCn_user_desc("张三");
mapper.save(u);
}
/**
* UserMapper.findByName()
*/
@Test
public void test1() {
UserMapper mapper =
ctx.getBean(UserMapper.class);
User user = mapper.findByName("demo");
// Integer.valueOf("abc");
System.out.println(user.getCn_user_id());
System.out.println(user.getCn_user_name());
System.out.println(user.getCn_user_password());
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
YUNBIJI.zip_spring ajax_云笔记_云笔记 项目_云笔记项目
共631个文件
svn-base:292个
png:69个
class:28个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 142 浏览量
2022-09-20
22:26:55
上传
评论 2
收藏 15.57MB ZIP 举报
温馨提示
云笔记项目主要用于客户在线学习时记录笔记,在该功能基础上又扩展了分享,收藏,活动等功能,该项目采用MVC设计模式,Spring+MyBatis,Ajax,jQuery框架开发,在此技术上实现项目的登录模块,笔记本模块,笔记模块,共享笔记查询模块,回收站模块,活动模块。
资源详情
资源评论
资源推荐
收起资源包目录
YUNBIJI.zip_spring ajax_云笔记_云笔记 项目_云笔记项目 (631个子文件)
all-wcprops 8KB
all-wcprops 3KB
all-wcprops 2KB
all-wcprops 2KB
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
TestMapper.class 7KB
LoginService.class 4KB
TestService.class 4KB
NoteBookController.class 4KB
ExceptionLogger.class 3KB
ShareService.class 3KB
NoteService.class 3KB
LoginController.class 3KB
NoteBookService.class 3KB
Note.class 3KB
NoteController.class 2KB
Md5Util.class 2KB
CheckLoginInterceptor.class 2KB
NoteBook.class 2KB
ShareController.class 2KB
User.class 2KB
Result.class 1KB
TestAop.class 1KB
Share.class 1KB
TimestampEditor.class 963B
TestLog4j.class 846B
SystemConstant.class 749B
BusinessException.class 620B
ShareMapper.class 574B
NoteBookMapper.class 489B
NoteMapper.class 474B
UserMapper.class 325B
MyBatisRepository.class 169B
.classpath 607B
org.eclipse.wst.common.component 465B
org.eclipse.wst.jsdt.ui.superType.container 49B
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 8KB
entries 3KB
entries 3KB
entries 2KB
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
fontawesome-webfont.eot 37KB
glyphicons-halflings-regular.eot 20KB
glyphicons-halflings-regular.eot 20KB
wface.gif 49KB
jxface2.gif 40KB
yface.gif 28KB
bface.gif 27KB
tface.gif 19KB
共 631 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
alvarocfc
- 粉丝: 131
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0