创建一个扩展类ShopCustom, (这样命名可以和Shop在项目树里面排列在一起)
package io.github.coinsjack.pojo; |
创建一个mapper接口 ShopMapperCustom
package io.github.coinsjack.dao; |
创建对应的映射文件
<?xml version="1.0" encoding="UTF-8" ?> <resultMap id="shopResultMap" type="ShopCustom"> |
@Test |
结果
2018-12-29 11:33:32,656 [main] DEBUG [io.github.coinsjack.dao.ShopMapperCustom] - Cache Hit Ratio [io.github.coinsjack.dao.ShopMapperCustom]: 0.0 2018-12-29 11:33:33,128 [main] DEBUG [io.github.coinsjack.dao.ShopMapperCustom.getShopById] - ==> Preparing: select `shop_id`, `shop_name`, `shop_desc` from tb_shop where `shop_id` = ? 2018-12-29 11:33:33,237 [main] DEBUG [io.github.coinsjack.dao.ShopMapperCustom.getShopById] - ==> Parameters: 29(Integer) 2018-12-29 11:33:33,309 [main] DEBUG [io.github.coinsjack.dao.ShopMapperCustom.getShopById] - <== Total: 1 ShopCustom{shopName='暴漫奶茶店', shopDesc='过来喝喝就知道啦,你是我的奶茶'} |
Java知识点 如果父类实现了某接口,子类也会继承接口的实现
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。