choose与case对比

一个是动态标签,一个是sql原生语句

 

<where>
<if test="resType != null and resType != '' "> and c_type = #{resType} </if>
<if test="resName != null and resName != '' "> and c_key_name like "%${resName}%" </if>
<if test="priceType != null and priceType != '' ">
<choose>
<when test="priceType == 1 ">
and c_price = 0
</when>
<otherwise>
and c_price &gt; 0
</otherwise>
</choose>
</if>

<if test="list != null and list.size > 0">
and c_key_id in
<foreach item="cKeyId" index="index" collection="list" open="(" separator="," close=")">
#{cKeyId}
</foreach>
</if>
and c_del_flag = '0'
and n_r_state = '0'
and top_bottom_frame = '1'
</where>

 

 

 

CASE
WHEN TIMESTAMPDIFF( SECOND, a.t_update_time, NOW()) > 946080000 THEN CONCAT( TIMESTAMPDIFF( YEAR, a.t_update_time, NOW()) ,'年前')
WHEN TIMESTAMPDIFF( SECOND, a.t_update_time, NOW()) > 2592000 THEN CONCAT( TIMESTAMPDIFF( MONTH, a.t_update_time, NOW()) ,'个月前')
WHEN TIMESTAMPDIFF( SECOND, a.t_update_time, NOW()) > 86400 THEN CONCAT( TIMESTAMPDIFF( DAY, a.t_update_time, NOW()) ,'天前')
WHEN TIMESTAMPDIFF( SECOND, a.t_update_time, NOW()) > 3600 THEN CONCAT(TIMESTAMPDIFF(HOUR,a.t_update_time,NOW()), '小时前')
WHEN TIMESTAMPDIFF( SECOND, a.t_update_time, NOW()) > 60 THEN CONCAT(TIMESTAMPDIFF(MINUTE,a.t_update_time,NOW()), '分钟前')
ELSE CONCAT(TIMESTAMPDIFF(SECOND,a.t_update_time,NOW()), '刚刚')
END AS "interval",

jar包部署
nohup java -Xms64m -Xmx128m -jar educate-statistical-0.0.1.jar > statistical.txt 2>&1 &

posted @   liftsail  阅读(72)  评论(0编辑  收藏  举报
(评论功能已被禁用)
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· 什么是nginx的强缓存和协商缓存
· 一文读懂知识蒸馏
· Manus爆火,是硬核还是营销?
点击右上角即可分享
微信分享提示