发表于: 2018-03-12 21:28:03

1 513


今天完成的事情:(一定要写非常细致的内容,比如说学会了盒子模型,了解了Margin)

今天提交任务一,前天的日报已经对照验收标准做了总结。

今天把具体步骤的结果做了汇总。


主要是spring-mybatis的结果



插入11条数据(第十一条用于删除:


//插入11条数据
long startInsert = System.currentTimeMillis();
for (int i = 0; i < 11; i++) {
try {
logger.info("->Succeed adding a student whose id is " + studentService.addAStudent(studentInsert));
   } catch (DuplicateKeyException e) {
logger.info("-->WARNING" + e.getMessage());
       logger.debug("-->The number of this student   is " + studentInsert.getNumber() + ".");
   } catch (Exception ex) {
logger.error(ex.getClass().getSimpleName());
       logger.error("-->Error happens when adding.");
   }
}
long endInsert = System.currentTimeMillis();
logger.info("-->All inserts done ,it costs " + (endInsert - startInsert) + " ms.");




花费时间:


 


删除最后一条:


//删除指定id11的学员
try {
long deleteId = 11L;
   if (studentService.deleteAStudent(deleteId))
logger.info("-->Delete student successfully, the id is " + deleteId + ".");
   else
       logger.debug("-->Delete student whose id is " + deleteId + " failed, the student doesn't exist! ");
} catch (Exception e) {
logger.error(e.getClass().getSimpleName());
   logger.error("-->Error happens when deleting.");
}


根据主键查询:


//主键查询
try {
long selectID = 1L;
   List<Student> studentByID;
   studentByID = studentService.findByPrimeKey(selectID);
   if (studentByID != null) {
logger.info("-->Succeed finding a student(s) whose id is " + selectID + "\n" + studentByID + ".");
   } else
       logger.debug("-->Querying failed to find a student whose id is " + selectID + ".");
} catch (Exception e) {
logger.error(e.getClass().getSimpleName());
   logger.info("-->Error happens when querying student by id");
}


根据姓名模糊查找:


//姓名模糊查询
try {
String name = "刘伟";
   List<Student> studentByName;
   studentByName = studentService.findAStudentsByName(name);
   if (studentByName!=null){
logger.info("-->Succeed finding a student(s) whose name is " + name + "\n" + studentByName + ".");
   }else {
logger.debug("-->Querying failed to find a student whose name is " + name + ".");
   }
}catch (Exception e){
logger.error(e.getClass().getSimpleName());
   logger.info("-->Error happens when querying student by name");
}


查找结果没有排版



根据学号查找:


//使用学号精确查询
try {
String selectNum = "pm-1041";
   List<Student> studentByNum;
   studentByNum = studentService.findAStudentByNumber(selectNum);
   if (studentByNum != null) {
logger.info("-->Succeed finding the student whose id is " + selectNum + "\n" + studentByNum + ".");
   } else {
logger.debug("-->Querying failed to find a student whose id is " + selectNum + ".");
   }
} catch (Exception e) {
logger.error(e.getClass().getSimpleName());
   logger.error("-->Error happens when querying student bu number");
}


更新数据:


//逐条更新
long startUpdate = System.currentTimeMillis();
Student studentUpdate = studentInsert;
studentUpdate.setDeclaration("老大最帅");
for (long i = 1; i <= 11; i++) {
studentUpdate.setId(i);
   studentUpdate.setUpdateAt(System.currentTimeMillis());
   try {
if (studentService.updateInformation(studentUpdate)) {
logger.info("-->Succeed updating information of student whose id is " + i + "!");
       } else {
logger.debug("-->Failed updating information of student whose id is " + i + "!");
       }
} catch (Exception e) {
logger.error(e.getClass().getSimpleName());
       logger.error("-->Error happens when updating.");
   }
}
long endUpdate = System.currentTimeMillis();
logger.info("-->Updating complete ,it costs " + (endUpdate - startUpdate) + " ms.");



最后清空表格:


//清空表格,为下次测试做准备
try {
studentService.reset();
   logger.info("-->Table has been reset, ready for another test.");
} catch (Exception e) {
logger.error(e.getClass().getSimpleName());
   logger.error("-->Error happens when resetting the table.");
}


任务一做了一个月多,由于自己之前从未接触java,一开始的时候很多思想都没有建立,项目做的很慢,现在看来很简答的一些东西当时却是不知所措。而这段时间给我带来的最大的感受是,任何问题都要自己先去了解,无论查到的结果懂不懂,至少在脑海里有大概的范围,这东西应该是怎么样的,在实在找不到解决方法,或显然需要很多时间但重要都比较低的问题,我都选择去询问师兄。当然师兄也会经常关心我的项目进度,一个月可以说是挺慢的了,内容说多也不多,主要是春节过来那段时间一周多很懈怠,最近状态在回暖,争取能把进度赶一赶吧。


任务一最重要的是找到问题、归纳问题、搜索问题、解决问题的能力以及对自己学习状态的调整,对于日后必定层出不穷的问题,仅仅会做是根本不够的,谷歌是永远的老师。


接着主要就是:

代码规范

- 大小驼峰命名

- 数据库字段命名和Java中类的属性命名

- 这两者在数据传输中的转换映射


数据库基础

- mysql在本地和远程的安装配置,sql语句


spring框架的逐渐深入了解

- ioc和di,框架对数据源和mybatis的管理


mybatis的使用

- mybatis配置文件

- 动态sql

- 数据库字段和实体类属性的映射

- 与spring的整合(关键)


日志的使用

- 程序中需要用日志的位置

- 日志输出的级别,文件目录

- 定时拆分



明天计划的事情:(一定要写非常细致的内容) 

开始任务2

遇到的问题:(遇到什么困难,怎么解决的) 
github的是使用,通过idea share到github时,target文件夹会被忽略(ignore),用桌面github就可以全选。


收获:(通过今天的学习,学到了什么知识)

任务一总结,github的使用


返回列表 返回列表
评论

    分享到