<?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.platform.yijia.dao.GzhNewsTemplateMapper">
  <!--公众号消息模板返回结果-->
  <resultMap id="BaseResultMap" type="com.platform.yijia.pojo.GzhNewsTemplate">
      <id     column="id"                      jdbcType="INTEGER" property="id" />
      <result column="template_name"           jdbcType="VARCHAR" property="templateName" />
      <result column="template_type"           jdbcType="VARCHAR" property="templateType" />
      <result column="temlate_id"              jdbcType="VARCHAR" property="templateId" />
      <result column="station_id"              jdbcType="INTEGER" property="stationId" />
      <result column="app_id"                  jdbcType="INTEGER" property="appId" />
  </resultMap>


  <!--查询公众号消息模板规则信息-->
  <select id="getGzhNewsTemplate" resultMap="BaseResultMap" parameterType="com.platform.yijia.pojo.GzhNewsTemplate">
    SELECT
        T1.id,
        T1.template_name,
        T1.template_type,
        T1.temlate_id,
        T1.station_id,
        T1.app_id
    FROM
        gzh_news_template AS T1
    <where>
          <if test="stationId !=null and stationId !=''">
             T1.station_id = #{stationId}
          </if>
        <if test="templateType !=null and templateType !=''">
            AND T1.template_type = #{templateType}
        </if>
    </where>
  </select>

</mapper>
