摘要: 属性文件: resources - > db.properties driver=com.mysql.cj.jdbc.Driver url=jdbc:mysql://localhost:3306/mybatis?useSSL=true&useUnicode=true&characterEncodin 阅读全文
posted @ 2023-03-10 16:18 Rui2022 阅读(12) 评论(0) 推荐(0) 编辑
摘要: 接口类 //模糊查询 List <User> getUserLike(String value); 第二步:UserMapper.xml <!--模糊查询--> <select id="getUserLike" resultType="com.feijian.pojo.User"> select * 阅读全文
posted @ 2023-03-10 15:25 Rui2022 阅读(12) 评论(0) 推荐(0) 编辑
摘要: 如果实体类或数据库中太多参数,我们应该考虑用MAP int addUser2(Map<String, Object> map); Mapper.xml <insert id="addUser2" parameterType="map" > insert into mybatis.user(id,na 阅读全文
posted @ 2023-03-10 15:03 Rui2022 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 查,增,改,删 第一步:接口写入新方法 package com.feijian.dao; import com.feijian.pojo.User; import java.util.List; public interface UserMapper { //1.查询全部用户 List <User> 阅读全文
posted @ 2023-03-10 14:27 Rui2022 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 第一步:maven依赖搭建,同时把build内容加上。避免后期丢失的问题 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w 阅读全文
posted @ 2023-03-10 13:31 Rui2022 阅读(13) 评论(0) 推荐(0) 编辑