NewsMapper.xml 1.4 KB

12345678910111213141516171819202122232425262728293031
  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.yc.education.mapper.NewsMapper" >
  4. <resultMap id="BaseResultMap" type="com.yc.education.model.News" >
  5. <!--
  6. WARNING - @mbggenerated
  7. -->
  8. <id column="id" property="id" jdbcType="BIGINT" />
  9. <id column="sort" property="sort" jdbcType="INTEGER" />
  10. <result column="title" property="title" jdbcType="VARCHAR" />
  11. <result column="sketch" property="sketch" jdbcType="VARCHAR" />
  12. <result column="covermap" property="covermap" jdbcType="VARCHAR" />
  13. <result column="releasetime" property="releasetime" jdbcType="DATE" />
  14. <result column="label" property="label" jdbcType="VARCHAR" />
  15. <result column="banner" property="banner" jdbcType="VARCHAR" />
  16. <result column="details" property="details" jdbcType="VARCHAR" />
  17. <result column="recommend" property="recommend" jdbcType="INTEGER" />
  18. <result column="createtime" property="createtime" jdbcType="TIMESTAMP" />
  19. <result column="updatetime" property="updatetime" jdbcType="TIMESTAMP" />
  20. </resultMap>
  21. <!-- 后台新闻根据标题查询 -->
  22. <select id="listNewsTitle" resultMap="BaseResultMap">
  23. select * from news
  24. <where>
  25. <if test="title != null and title != '' ">
  26. and title like concat('%',#{title},'%')
  27. </if>
  28. </where>
  29. order by sort desc
  30. </select>
  31. </mapper>