Mybatis Select Count(*)的返回值類型介紹
更新時間:2021年12月20日 17:30:35 作者:Eddie-Wang
這篇文章主要介紹了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();
以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
利用線程實現(xiàn)動態(tài)顯示系統(tǒng)時間
編寫Applet小程序,通過在HTML文檔中接收參數(shù),顯示當(dāng)前的系統(tǒng)時間,需要的朋友可以參考下2015-10-10
SpringBoot項目中的多數(shù)據(jù)源支持的方法
本篇文章主要介紹了SpringBoot項目中的多數(shù)據(jù)源支持的方法,主要介紹在SpringBoot項目中利用SpringDataJpa技術(shù)如何支持多個數(shù)據(jù)庫的數(shù)據(jù)源,有興趣的可以了解一下2017-10-10
SpringBoot數(shù)據(jù)脫敏的實現(xiàn)示例
數(shù)據(jù)脫敏主要應(yīng)用在客戶安全數(shù)據(jù)或商業(yè)性敏感數(shù)據(jù)的情況,本文主要介紹了SpringBoot數(shù)據(jù)脫敏的實現(xiàn)示例,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2024-05-05
Java實現(xiàn)將PDF轉(zhuǎn)為PDF/A
通過將PDF格式轉(zhuǎn)換為PDF/A格式,可保護(hù)文檔布局、格式、字體、大小等不受更改,從而實現(xiàn)文檔安全保護(hù)的目的,同時又能保證文檔可讀、可訪問。本文將為大家介紹如何實現(xiàn)這一轉(zhuǎn)換,需要的可以參考一下2022-01-01
前端與RabbitMQ實時消息推送未讀消息小紅點實現(xiàn)示例
這篇文章主要為大家介紹了前端與RabbitMQ實時消息推送未讀消息小紅點實現(xiàn)示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-07-07

