InformationMapper.xml 1.1 KB

12345678910111213141516171819202122232425262728
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.cyksj.mapper.InformationMapper">
  4. <select id="getInformation" resultType="com.cyksj.model.views.InformationListView">
  5. select id,title,thumbnail,created_time,content,sub_title,logo,is_black_font from information where status is true and deleted is true
  6. <choose>
  7. <when test="categoryId != null">
  8. and JSON_CONTAINS(category_ids,'"${categoryId}"') = 1
  9. </when>
  10. <otherwise>
  11. and recommend is true
  12. </otherwise>
  13. </choose>
  14. order by sorted, case when top is true then 1 else 2 end,created_time desc
  15. </select>
  16. <select id="getInformationByTitle" resultType="com.cyksj.model.views.InformationListView">
  17. select id,title,thumbnail,created_time,content,sub_title,logo,is_black_font
  18. from information
  19. where title like '%${title}%'
  20. and status is true
  21. and deleted is true
  22. order by created_time desc
  23. </select>
  24. </mapper>