<?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="cn.freemud.manager.dao.WxappMessageTemplateDao">

    <sql id="all_column">
        id,
        parent_id AS  partnerId,
        iapp_id    AS iappId,
        appid   AS appid,
        template_id AS templateId,
        title_id  AS titleId,
        title_name AS titleName,
        keyword_list AS keywordList,
        status AS status,
        gmt_created AS gmtCreated,
        gmt_modified AS gmtModified

    </sql>

    <select id="selectByAppid" resultType="WxappMessageTemplate" >
        SELECT
        <include refid="all_column"/>
        FROM
        open_platform_iapp_wxapp_message_template
        WHERE
         appid = #{appid}  AND parent_id = #{parentId}
        AND status = 1
    </select>

    <select id="selectParentIdAndAppid" resultType="WxappMessageTemplate" >
        SELECT
        <include refid="all_column"/>
        FROM
        open_platform_iapp_wxapp_message_template
        WHERE
        appid = #{appid}  AND parent_id = #{parentId}
        AND status = 1
    </select>

</mapper>