发表于: 2018-01-16 23:42:54
1 546
一。今天上午在传投稿视频,原想着半小时一小时就能搞定,结果一个是有些师兄没有上传小视频,还有一个是还往其他网站投了下,没想到只需要投B站就可以了。所以耽误了不少时间。
还有一个是把昨天的小课堂,简书投稿。小课堂讲完之后要做的事儿,有必要在这里说一下。
PPT上传到PPT-java文件夹。
更改javaIndex.html,更改自己的顺序,PPT地址,小课堂名字。保存。
然后点击PPT浏览地址,java小课堂汇总(旧地址),点击自己的。
一个PPT网站:https://ptteng.github.io/PPT/
更新两个页面,草船云的小课堂A组和知识点汇总
两个视频站要传:百度云和腾讯视频
一个简书。给简书的IT修真院投稿
二。今天看了一些大佬写的东西,说学习java,敲一万行代码算是入门了。所以找了java书,敲了不少代码,以后决定每天都要敲一些,保持一百行左右吧。
就是在以前的一个maven项目里面,新建了一些类敲击的。
三。继续做mybatis,做注解,做连接数据库。和Spring搭配。
教程里要求Gategory.xml放在pojo包里。运行出现错误。然后把Gategory.xml文件放入resources文件下,因为IDEA里默认配置文件从resources读取,运行,依然出现错误。
Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find resource com/how2java/pojo/Category.xml
提示码的意思是找不到配置文件
试了好多方法,最后感觉应该是路径错了
然后把com.how2java.pojo删掉,成功了。
四:今天只通过mybatis对mysql做了增加
public class TestMybatis {
public static void main(String[] args) throws IOException {
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new
SqlSessionFactoryBuilder().build(inputStream);
SqlSession session = sqlSessionFactory.openSession();
Category c = new Category();
c.setName("新增加的Category");
session.insert("addCategory", c);
listAll(session);
session.commit();
session.close();
}
private static void listAll(SqlSession session) {
List<Category> cs = session.selectList("listCategory");
for (Category c : cs) {
System.out.println(c.getName());
}
}
}
,同时Category.XMl要做相应修改
<mapper namespace="com.how2java.pojo">
<insert id="addCategory" parameterType="Category">
insert into category_ (name) values (#{name})
</insert>
<delete id="deleteCategory" parameterType="Category">
delete from category_ where id= #{id}
</delete>
<select id="getCategory" parameterType="_int" resultType="Category">
select * from category_ where id= #{id}
</select>
<update id="updateCategory" parameterType="Category" >
update category_ set name=#{name} where id=#{id}
</update>
<select id="listCategory" resultType="Category">
select * from category_
</select>
</mapper>
深绿色字体是对应增加的部分。
明天的计划:完成mybatis删,改,查和注解。
遇到的问题:已经解决
今天的收获:对mybatis有了更深的了解,
java任务一开始时间:2017.12.05
预计demo时间:2018.01-05
可能有延期风险,原因是:已经延期了,基础比较差,
禅道链接地址:http://task.ptteng.com/zentao/project-task-501.html
评论