<?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.yami.shop.mp.comment.dao.WeixinSubscribeMapper">
  <resultMap id="BaseResultMap" type="com.yami.shop.mp.comment.model.WeixinSubscribe">
    <!--
      WARNING - @mbg.generated
    -->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="msg_type" jdbcType="VARCHAR" property="msgType" />
    <result column="seq" jdbcType="INTEGER" property="seq" />
    <result column="content" jdbcType="VARCHAR" property="content" />
    <result column="media_id" jdbcType="VARCHAR" property="mediaId" />
  </resultMap>
  
  <resultMap id="WeixinSubscribeAndMaterialMap" type="com.yami.shop.mp.comment.model.WeixinSubscribe">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="msg_type" jdbcType="VARCHAR" property="msgType" />
    <result column="seq" jdbcType="INTEGER" property="seq" />
    <result column="content" jdbcType="VARCHAR" property="content" />
    <result column="media_id" jdbcType="VARCHAR" property="mediaId" />
    <association property="weixinMaterial" javaType="com.yami.shop.mp.comment.model.WeixinMaterial">
    	<id column="media_id" jdbcType="VARCHAR" property="mediaId" />
	    <result column="media_type" jdbcType="VARCHAR" property="mediaType" />
	    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
	    <result column="media_name" jdbcType="VARCHAR" property="mediaName" />
    </association>
  </resultMap>
  
  <select id="listWeixinSubscribeAndMaterial" resultMap="WeixinSubscribeAndMaterialMap">
  	select * from tz_weixin_subscribe ws 
  	left join tz_weixin_material wm on ws.media_id = wm.media_id order by ws.seq
  </select>
  
</mapper>