2022年5月23日
摘要: 在使用MyBatisPlus的service进行增删改查的时候,出现了空指针异常,原因是 @Autowired UserService userService; 自动注入失败 经过排查,@Service注解没有忘写。 最后在启动类上面加个全盘扫描,@ComponentScan(“”)里面写扫描路径 阅读全文
posted @ 2022-05-23 23:10 西凉# 阅读(53) 评论(0) 推荐(0) 编辑
摘要: 增加和更新以save为前缀 UserService接口: public interface UserService extends IService<User> { } UserServiceImpl: @Service public class UserServiceImpl extends Se 阅读全文
posted @ 2022-05-23 18:26 西凉# 阅读(214) 评论(0) 推荐(0) 编辑
摘要: MyBatisPlus对MyBatis只做增强,并不改变原有的功能。 仍然可以采用自定义查询: 第一步:配置映射文件的位置 映射文件格式: <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org/ 阅读全文
posted @ 2022-05-23 15:54 西凉# 阅读(327) 评论(0) 推荐(0) 编辑
摘要: package com.zhy.mybatisplus_project; import com.zhy.mapper.UserMapper; import com.zhy.pojo.User; import org.junit.jupiter.api.Test; import org.springf 阅读全文
posted @ 2022-05-23 13:49 西凉# 阅读(55) 评论(0) 推荐(0) 编辑