lidaye2396

博客园 首页 新随笔 联系 订阅 管理
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 30 下一页

2021年4月6日 #

摘要: 7、分页 思考:为什么分页? 减少数据的处理量 7.1 使用Limit分页 SELECT * from user limit startIndex,pageSize 1 使用MyBatis实现分页,核心SQL 接口 //分页List<User> getUserByLimit(Map<String,I 阅读全文
posted @ 2021-04-06 11:11 lidaye2396 阅读(12) 评论(0) 推荐(0) 编辑

2021年4月5日 #

摘要: 6、日志 6.1 日志工厂 如果一个数据库操作,出现了异常,我们需要排错,日志就是最好的助手! 曾经:sout、debug 现在:日志工厂 SLF4J LOG4J 【掌握】 LOG4J2 JDK_LOGGING COMMONS_LOGGING STDOUT_LOGGING 【掌握】 NO_LOGGI 阅读全文
posted @ 2021-04-05 11:11 lidaye2396 阅读(40) 评论(0) 推荐(0) 编辑

2021年4月3日 #

摘要: 5、解决属性名和字段名不一致的问题 1. 问题 数据库中的字段 新建一个项目,拷贝之前的,测试实体类字段不一致的情况 测试出现问题 // select * from user where id = #{id}// 类型处理器// select id,name,pwd from user where 阅读全文
posted @ 2021-04-03 11:11 lidaye2396 阅读(34) 评论(0) 推荐(0) 编辑

2021年4月1日 #

摘要: 5. 设置 Settings 这是 MyBatis 中极为重要的调整设置,它们会改变 MyBatis 的运行时行为。 6. 其他配置 typeHandlers(类型处理器) objectFactory(对象工厂) plugins 插件 mybatis-generator-core mybatis-p 阅读全文
posted @ 2021-04-01 11:11 lidaye2396 阅读(41) 评论(0) 推荐(0) 编辑

2021年3月31日 #

摘要: 4、配置解析 1. 核心配置文件 mybatis-config.xml Mybatis的配置文件包含了会深深影响MyBatis行为的设置和属性信息。 configuration(配置) properties(属性) settings(设置) typeAliases(类型别名) typeHandler 阅读全文
posted @ 2021-03-31 11:11 lidaye2396 阅读(20) 评论(0) 推荐(0) 编辑

2021年3月30日 #

摘要: 6. 万能Map 假设,我们的实体类,或者数据库中的表,字段或者参数过多,我们应该考虑使用Map! UserMapper接口 //用万能Map插入用户public void addUser2(Map<String,Object> map); UserMapper.xml <!--对象中的属性可以直接 阅读全文
posted @ 2021-03-30 11:11 lidaye2396 阅读(35) 评论(0) 推荐(0) 编辑

2021年3月29日 #

摘要: 3. Insert 4. update 5. Delete 示例代码(依次) package com.alice.dao;import com.alice.pojo.User;import java.util.List;public interface UserMapper { List<User> 阅读全文
posted @ 2021-03-29 11:11 lidaye2396 阅读(84) 评论(0) 推荐(0) 编辑

2021年3月26日 #

摘要: 3、CURD(增删改查) 1. namespace namespace中的包名要和Dao/Mapper接口的包名一致 2. select 选择,查询语句; id:就是对应的namespace中的方法名; resultType : Sql语句执行的返回值; parameterType : 参数类型; 阅读全文
posted @ 2021-03-26 11:11 lidaye2396 阅读(9) 评论(0) 推荐(0) 编辑

2021年3月24日 #

摘要: 2.3 编写代码 实体类 Dao接口 public interface UserDao { public List<User> getUserList();} 接口实现类 (由原来的UserDaoImpl转变为一个Mapper配置文件) <?xml version="1.0" encoding="U 阅读全文
posted @ 2021-03-24 11:11 lidaye2396 阅读(14) 评论(0) 推荐(0) 编辑

2021年3月22日 #

摘要: 2.2 创建一个模块 右击刚刚创建的maven项目 选择module创建子项目 补充标记好的文件夹 1、编写mybatis的核心配置文件 在resources(标记为resources)中创建MyBatis-config.xml的文件 内容: <?xml version="1.0" encoding 阅读全文
posted @ 2021-03-22 11:11 lidaye2396 阅读(28) 评论(0) 推荐(0) 编辑

上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 30 下一页