首页 > 编程语言 > 详细

spring boot 整合mybatis

时间:2020-08-01 15:28:21      阅读:114      评论:0      收藏:0      [点我收藏+]

导入mybatis jar包
右键pom.xml
技术分享图片
技术分享图片

定义接口

@Mapper

public interface GoodsDao {
	/**
	 * 基于商品id删除商品
	 * @param id 商品id
	 * @return 删除行数
	 * 数据层方法对象的sql映射
	 */

         @Delete("delete from tb_goods where id=#{id}")

         int deleteById(Integer id);

}

测试

@SpringBootTest
public class TestGoods {

	@Autowired
	private GoodsDao gd;
	@Test
	void TestGoods() {
		int i =gd.deleteById(10);
		System.out.println(i);
	}
}

spring boot 整合mybatis

原文:https://www.cnblogs.com/syrgdm/p/13414448.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!