一段sql代码报错:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE>
and aac.is_delete != 1
and aac.is_down != 1
<if test="type != n' at line 6
我实在是看不出哪里有问题,只知道是在 where 里面出的问题,望解答!
SELECT
aa.*
FROM
`ap_article` aa
LEFT JOIN `ap_article_config` aac ON aa.id = aac.article_id
<WHERE>
and aac.is_delete != 1
and aac.is_down != 1
<if test="type != null and type == 1">
and aa.publish_time <![CDATA[<]]> '2020-09-07 14:56:18'
</if>
<if test="type != null and type == 2">
and aa.publish_time <![CDATA[>]]> '2021-04-19 00:08:05'
</if>
<if test="dto.tag != '__all__'">
and aa.channel_id = 1
</if>
</WHERE>
order by aa.publish_time desc
limit 10