上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 28 下一页
摘要: 1.if语句 BlogMapper: //查询 List<Blog> queryBlog(Map map); BlogMapper.xml: <select id="queryBlog" parameterType="map" resultType="com.kakafa.pojo.Blog"> s 阅读全文
posted @ 2021-12-24 10:50 卡卡发 阅读(29) 评论(0) 推荐(0)
摘要: 动态sql:就是根据不同的条件生成不同的sql语句 1.搭建环境: 数据库: CREATE TABLE `blog`( `id` VARCHAR(50) NOT NULL COMMENT '博客id', `title` VARCHAR(100) NOT NULL COMMENT '博客标题', `a 阅读全文
posted @ 2021-12-23 21:26 卡卡发 阅读(37) 评论(0) 推荐(0)
摘要: 1.环境搭建 Student.java: package com.kakafa.pojo; import lombok.Data; @Data public class Student { private int id; private String name; //学生需要关联一个老师 priva 阅读全文
posted @ 2021-12-23 16:41 卡卡发 阅读(80) 评论(0) 推荐(0)
摘要: lombok偷懒专用,最好少用,降低代码可读性 1.idea中安装Lombok 2.在项目中导入Lombok的jar包(到maven仓库里找) <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifact 阅读全文
posted @ 2021-12-23 10:54 卡卡发 阅读(28) 评论(0) 推荐(0)
摘要: 使用注解开发 UserMapper: public interface UserMapper{ @Select("select * from mybatistest.user") List<User> getUserList(); } MyBatis-config: <!--绑定接口--> <map 阅读全文
posted @ 2021-12-23 09:59 卡卡发 阅读(32) 评论(0) 推荐(0)
摘要: 为什么要分页? 减少数据的处理量 1.使用limit分页 select * from user where limit startindex,pagesize; 2.Mybatis里用limit List<User> getUserByLimit(Map<String,Integer> map); 阅读全文
posted @ 2021-12-18 15:36 卡卡发 阅读(36) 评论(0) 推荐(0)
摘要: log4j 阅读全文
posted @ 2021-12-17 19:52 卡卡发 阅读(30) 评论(0) 推荐(0)
摘要: 解决属性名和字段名不一致的问题 解决办法: 1.起别名 2.resultMap 结果集映射 一个例子: <!-- resultMap最终还是要将结果映射到pojo上,type就是指定映射到哪一个pojo --> <!-- id:设置ResultMap的id --> <resultMap type=" 阅读全文
posted @ 2021-12-17 17:01 卡卡发 阅读(29) 评论(0) 推荐(0)
摘要: ![](https://img2020.cnblogs.com/blog/2181692/202112/2181692-20211217160620030-362666689.png) ![](https://img2020.cnblogs.com/blog/2181692/202112/2181692-20211217160703642-1089726659.png) ![](https://i 阅读全文
posted @ 2021-12-17 16:08 卡卡发 阅读(33) 评论(0) 推荐(0)
摘要: 注册绑定mapper文件 1.方式一:推荐使用 <mappers> <mapper resource="com/kakafa/dao/UserMapper.xml"/> </mappers> 2.方式二:用class文件绑定注册 <mappers> <mapper class="com.kakafa 阅读全文
posted @ 2021-12-17 15:55 卡卡发 阅读(70) 评论(0) 推荐(0)
上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 28 下一页