am.ik.blog.entry.CategoryMapper.xml Maven / Gradle / Ivy
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="am.ik.blog.entry.CategoryMapper"> <select id="findConcatenatedCategoryLikeCategoryName" resultType="string"> <bind name="condition" value="categoryName.concat('%')"/> SELECT DISTINCT GROUP_CONCAT(DISTINCT category_name ORDER BY category_order ASC SEPARATOR ',') category FROM category GROUP BY entry_id HAVING category LIKE #{condition} ORDER BY category </select> </mapper>