Mybatis Select Count(*)的返回值類型介紹
Select Count(*)的返回值類型
<select id="queryAlarmStatisticalAnalysis4System" parameterType="AlarmMailSendLog"
resultType="java.lang.Integer">
select count(*) from mon_alarm_mail_send_log
where is_del = '0'
<if test="airport != null and airport != ''">
and airport = #{airport}
</if>
<if test="system != null and system != ''">
and system = #{system}
</if>
<if test="relateTable != null and relateTable != ''">
and relate_table = #{relateTable}
</if>
<if test="params.startTime != null and params.startTime != ''">
and send_time >= to_date(#{params.startTime},'yyyy-MM-dd HH24:mi:ss')
</if>
<if test="params.endTime != null and params.endTime != ''">
and send_time <= to_date(#{params.endTime},'yyyy-MM-dd HH24:mi:ss')
</if>
</select>
類似于select count(*)的語句的返回值為java.lang.Integer
返回Count(*)的整數(shù)值
1、mybatis中resultType定義為"java.lang.Integer"
<select id="selectNums" resultType="java.lang.Integer">
select count(*) from tableName
</select>
2、接口中返回值寫成int,即可
int selectNums();
以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
利用線程實(shí)現(xiàn)動態(tài)顯示系統(tǒng)時(shí)間
編寫Applet小程序,通過在HTML文檔中接收參數(shù),顯示當(dāng)前的系統(tǒng)時(shí)間,需要的朋友可以參考下2015-10-10
SpringBoot項(xiàng)目中的多數(shù)據(jù)源支持的方法
本篇文章主要介紹了SpringBoot項(xiàng)目中的多數(shù)據(jù)源支持的方法,主要介紹在SpringBoot項(xiàng)目中利用SpringDataJpa技術(shù)如何支持多個(gè)數(shù)據(jù)庫的數(shù)據(jù)源,有興趣的可以了解一下2017-10-10
SpringBoot數(shù)據(jù)脫敏的實(shí)現(xiàn)示例
數(shù)據(jù)脫敏主要應(yīng)用在客戶安全數(shù)據(jù)或商業(yè)性敏感數(shù)據(jù)的情況,本文主要介紹了SpringBoot數(shù)據(jù)脫敏的實(shí)現(xiàn)示例,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2024-05-05
JavaWeb項(xiàng)目中classpath路徑詳解
今天小編就為大家分享一篇關(guān)于JavaWeb項(xiàng)目中classpath路徑詳解,小編覺得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來看看吧2018-12-12
Java實(shí)現(xiàn)將PDF轉(zhuǎn)為PDF/A
通過將PDF格式轉(zhuǎn)換為PDF/A格式,可保護(hù)文檔布局、格式、字體、大小等不受更改,從而實(shí)現(xiàn)文檔安全保護(hù)的目的,同時(shí)又能保證文檔可讀、可訪問。本文將為大家介紹如何實(shí)現(xiàn)這一轉(zhuǎn)換,需要的可以參考一下2022-01-01
前端與RabbitMQ實(shí)時(shí)消息推送未讀消息小紅點(diǎn)實(shí)現(xiàn)示例
這篇文章主要為大家介紹了前端與RabbitMQ實(shí)時(shí)消息推送未讀消息小紅點(diǎn)實(shí)現(xiàn)示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-07-07

