国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術(shù)文章
文章詳情頁

JavaEE Spring MyBatis如何一步一步實(shí)現(xiàn)數(shù)據(jù)庫查詢功能

瀏覽:95日期:2023-08-20 09:32:52

配置好一個SptingBoot項(xiàng)目配置好MyBatis

JavaEE Spring~MyBatis是什么? 它和Hibernate的區(qū)別有哪些?如何配置MyBatis?

SpringBoot配置文件application.properties簡單介紹

JavaEE Spring MyBatis如何一步一步實(shí)現(xiàn)數(shù)據(jù)庫查詢功能JavaEE Spring MyBatis如何一步一步實(shí)現(xiàn)數(shù)據(jù)庫查詢功能JavaEE Spring MyBatis如何一步一步實(shí)現(xiàn)數(shù)據(jù)庫查詢功能JavaEE Spring MyBatis如何一步一步實(shí)現(xiàn)數(shù)據(jù)庫查詢功能

確保MyBatis配置正確

JavaEE Spring MyBatis如何一步一步實(shí)現(xiàn)數(shù)據(jù)庫查詢功能JavaEE Spring MyBatis如何一步一步實(shí)現(xiàn)數(shù)據(jù)庫查詢功能

手動實(shí)現(xiàn)一個xml文件

上面我是用的是一個自定義的接口 此時沒有它對應(yīng)的xml文件 此時我們需要

JavaEE Spring MyBatis如何一步一步實(shí)現(xiàn)數(shù)據(jù)庫查詢功能

下圖中column表示查詢列, property表示返回類型中的屬性

JavaEE Spring MyBatis如何一步一步實(shí)現(xiàn)數(shù)據(jù)庫查詢功能JavaEE Spring MyBatis如何一步一步實(shí)現(xiàn)數(shù)據(jù)庫查詢功能

在Controller中進(jìn)行測試

package listen.controller;import listen.mapper.TestMapper;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RestController;/** * Created with IntelliJ IDEA. * Description: If you don’t work hard, you will a loser. * User: Listen-Y. * Date: 2020-08-21 * Time: 23:14 */@RestController@RequestMapping(value = 'user')public class MyselfTest { @Autowired private TestMapper testMapper; @RequestMapping(value = 'test') public Object test() { return testMapper.query(1); }}

JavaEE Spring MyBatis如何一步一步實(shí)現(xiàn)數(shù)據(jù)庫查詢功能

總結(jié)

到此這篇關(guān)于JavaEE Spring MyBatis如何一步一步實(shí)現(xiàn)數(shù)據(jù)庫查詢功能的文章就介紹到這了,更多相關(guān)JavaEE Spring MyBatis數(shù)據(jù)庫查詢內(nèi)容請搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!

標(biāo)簽: Java
相關(guān)文章:
主站蜘蛛池模板: 云浮市| 博湖县| 邢台县| 横山县| 修文县| 寻乌县| 桂平市| 霍城县| 昌江| 辽阳市| 金昌市| 呼图壁县| 六枝特区| 卓尼县| 那坡县| 新巴尔虎左旗| 敖汉旗| 湟中县| 扬州市| 衡山县| 杭锦旗| 承德市| 靖江市| 嵊州市| 陆良县| 灵川县| 吕梁市| 云和县| 武平县| 新化县| 尤溪县| 当雄县| 桦川县| 盐山县| 从化市| 河东区| 郸城县| 托克托县| 文化| 新宾| 凤翔县|