Created
September 14, 2014 18:19
-
-
Save sasajib/231b7299a09f117dbfbf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<select id="findNewsCollection" parameterType="map" resultMap="newsSummary"> | |
SELECT | |
id, slug, summary, created_at, viewed, | |
image, CONCAT(gtype,',', cleague, event,',', other) as tags | |
FROM news | |
<choose> | |
<when test="OnlyWorldCup != null"> | |
WHERE is_worldcup=TRUE | |
</when> | |
<otherwise> | |
<if test="NewsType != null"> | |
WHERE news_type=#{NewsType} | |
</if> | |
<if test="IsWorldCup != null"> | |
AND WHERE is_worldcup=TRUE | |
</if> | |
</otherwise> | |
</choose> | |
ORDER BY id DESC | |
<choose> | |
<when test="From != null and To != null"> | |
LIMIT #{From}, #{To} ; | |
</when> | |
<otherwise> | |
<choose> | |
<when test="Limit != null"> | |
LIMIT #{Limit}; | |
</when> | |
<otherwise> | |
LIMIT 6; | |
</otherwise> | |
</choose> | |
</otherwise> | |
</choose> | |
</select> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment