select方法怎么在Mybatis中使用

select方法怎么在Mybatis中使用?相信很多沒(méi)有經(jīng)驗(yàn)的人對(duì)此束手無(wú)策,為此本文總結(jié)了問(wèn)題出現(xiàn)的原因和解決方法,通過(guò)這篇文章希望你能解決這個(gè)問(wèn)題。

創(chuàng)新互聯(lián)公司是一家集網(wǎng)站建設(shè),新民企業(yè)網(wǎng)站建設(shè),新民品牌網(wǎng)站建設(shè),網(wǎng)站定制,新民網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營(yíng)銷(xiāo),網(wǎng)絡(luò)優(yōu)化,新民網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競(jìng)爭(zhēng)力??沙浞譂M(mǎn)足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專(zhuān)業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶(hù)成長(zhǎng)自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。

selectById方法

根據(jù)id,查詢(xún)記錄

public void updateRecycleAssayBusinessItemCharge(String Id) {
  AssayBusinessItemCharge assayBusinessItemCharge = assayBusinessItemChargeService.selectById(Id);
  assayBusinessItemCharge.setRecordStatus(RecordStatusEnum.VALID.getValue());
  assayBusinessItemChargeService.update(assayBusinessItemCharge);
}

selectByExample方法

根據(jù)實(shí)體字段,查詢(xún)記錄

public Account findByAccountName(String accountName) {
  AccountExample accountExample = new AccountExample();
  AccountExample.Criteria criteria = accountExample.createCriteria();
  criteria.andAccountNameEqualTo(accountName);
  List<Account> accountList = accountService.selectByExample(accountExample);
  if (accountList == null || accountList.size() != 1)
    return null;
  else
    return accountList.get(0);
}

查詢(xún)所有l(wèi)ist

傳一個(gè)空的實(shí)體,不要給賦字段值

public Account findByAccountName(String accountName) {
  AccountExample accountExample = new AccountExample();
  AccountExample.Criteria criteria = accountExample.createCriteria();
  List<Account> accountList = accountService.selectByExample(accountExample);
  if (accountList == null || accountList.size() != 1)
    return null;
  else
    return accountList.get(0);
}

看完上述內(nèi)容,你們掌握select方法怎么在Mybatis中使用的方法了嗎?如果還想學(xué)到更多技能或想了解更多相關(guān)內(nèi)容,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝各位的閱讀!

文章題目:select方法怎么在Mybatis中使用
文章來(lái)源:http://www.muchs.cn/article24/jidoce.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供手機(jī)網(wǎng)站建設(shè)、微信公眾號(hào)、軟件開(kāi)發(fā)、電子商務(wù)、網(wǎng)站排名自適應(yīng)網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站網(wǎng)頁(yè)設(shè)計(jì)