Mybatis choose when用法實例代碼
更新時間:2017年06月23日 11:46:49 作者:shannon8
本文通過實例代碼給大家介紹了Mybatis choose when用法,需要的的朋友參考下吧
mybatis choose when的用法實現(xiàn)代碼如下所示:
mapper.xml:
<select id="query" resultType="map" parameterType="map"> select <choose> <when test="cityId == '00' "> a.city_id as CITYID, </when> <otherwise> <choose> <when test="cityId == '0001' and statsDimension==1"> a.level1_maintain_unit_id as CITYID, </when> <otherwise> a.county_id as CITYID, </otherwise> </choose> </otherwise> </choose> sum(ONUNUM) as ONUNUM, sum(ONTNUM) as ONTNUM from new_olt_upopt_sp_month_${tableDate} a where 1 = 1 <if test="cityId == '0001' and statsDimension==1"> and a.city_id = '0001' </if> <![CDATA[and a.gather_time >= ${startDate}]]> <![CDATA[and a.gather_time <= ${endDate}]]> group by <choose> <when test="cityId == '00' "> a.city_id </when> <otherwise> <choose> <when test="cityId == '0001' and statsDimension==1"> a.level1_maintain_unit_id </when> <otherwise> a.county_id having a.county_id in (select city_id from tab_city where city_id= #{cityId} or parent_id=#{cityId}) </otherwise> </choose> </otherwise> </choose> </select>
以上所述是小編給大家介紹的Mybatis choose when用法實例代碼,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
相關文章
Java實戰(zhàn)寵物醫(yī)院預約掛號系統(tǒng)的實現(xiàn)流程
只學書上的理論是遠遠不夠的,只有在實戰(zhàn)中才能獲得能力的提升,本篇文章手把手帶你用java+JSP+Spring+SpringBoot+MyBatis+html+layui+maven+Mysql實現(xiàn)一個寵物醫(yī)院預約掛號系統(tǒng),大家可以在過程中查缺補漏,提升水平2022-01-01Lock、Condition實現(xiàn)簡單的生產(chǎn)者消費者模式示例
這篇文章主要介紹了Lock、Condition實現(xiàn)簡單的生產(chǎn)者消費者模式示例,需要的朋友可以參考下2014-04-04