SELECT * FROM t_dws_base_statistics <where> <choose> <when test="statisticsName != null and statisticsName != ‘‘"> name = #{statisticsName} </when> <otherwise> name = ‘SCJG-GLY-SCXFHJ-XFHFMYL‘ </otherwise> </choose> <choose> <when test="statisticsPeriod != null and statisticsPeriod != ‘‘"> and year(date) = #{statisticsPeriod} </when> <otherwise> and year(date) = DATE_FORMAT(NOW(),"%Y") </otherwise> </choose> </where>
<choose>标签和<when>标签和<otherwise>标签
<choose>标签和<when>标签和<otherwise>标签
原文:https://www.cnblogs.com/Objecting/p/13223829.html