<?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="com.hc.business.mapper.ZccmNewsMapper">

    <resultMap type="zccmnews" id="NewsMap">
        <result property="newsId" column="news_id" jdbcType="INTEGER"/>
        <result property="newsTitle" column="news_title" jdbcType="VARCHAR"/>
        <result property="newsLogo" column="news_logo" jdbcType="VARCHAR"/>
        <result property="newsContent" column="news_content" jdbcType="BLOB"/>
        <result property="createTime" column="create_time" jdbcType="INTEGER"/>
        <result property="tagId" column="tag_id" jdbcType="INTEGER"/>
    </resultMap>

    <sql id="Base_Column_List">
        news_id,
           news_title,
           news_logo,
           news_content,
           create_time,
           tag_id
    </sql>

    <select id="queryByTagId" resultMap="NewsMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM zccm_news
        WHERE tag_id = #{tagId}
        ORDER BY news_id DESC
    </select>

</mapper>