当前位置:Gxlcms > 数据库问题 > MySQL与mabits大小比较、日期比较示例

MySQL与mabits大小比较、日期比较示例

时间:2021-07-01 10:21:17 帮助过:2人阅读

select id="queryFreeHouseCalender" resultType="com.cn.front.entity.detail.FreeHouseCalender" parameterType="com.cn.front.entity.input.QueryFreeHouse"> SELECT count(*) AS num, b1.record_date FROM nk_house_use_record AS b1, ( SELECT a.theme_id, a.theme_name, b.house_id, b.house_name FROM nk_house_theme AS a, nk_house AS b WHERE a.theme_id = #{themeID} AND a.theme_id = b.theme_id AND a.state = ‘1‘ AND b.state = ‘1‘ ) AS a1 WHERE a1.house_id = b1.house_id <if test="timeKey == ‘1‘ ">and time1 = ‘0‘</if> <if test="timeKey == ‘2‘ ">and time2 = ‘0‘</if> <if test="timeKey == ‘3‘ ">and time3 = ‘0‘</if> <if test="timeKey == ‘4‘ ">and time4 = ‘0‘ and time5=‘0‘</if> <if test="startDate != null">AND record_date &gt;= #{startDate}</if> <if test="endDate != null">AND record_date &lt;= #{endDate}</if> <if test="startDate == null">AND Date(record_date) &gt;= CURDATE() </if> <if test="endDate == null">AND Date(record_date) &lt; DATE_SUB(CURDATE(), INTERVAL - 60 DAY) </if> GROUP BY b1.record_date </select>

 

xml特殊符号转义写法

&lt; <

&gt; >

&lt;&gt; <>

&amp; &

&apos; ‘

&quot; "

 

MySQL与mabits大小比较、日期比较示例

标签:

人气教程排行