<?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.jumeirah.common.mapper.CharterIntroductionMapper">

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, mc_id, status, create_time,update_time,type,text,img_url
    </sql>
    <sql id="Base_Column_ListForApp">
        title,text,img_url,m.head AS mcHead,m.name AS mcName
    </sql>

    <select id="getCharterIntroductionById" resultType="com.jumeirah.common.vo.CharterIntroductionQueryVo">
        select
        <include refid="Base_Column_List"/>
        from charter_introduction where id = #{id}
    </select>

    <select id="getCharterIntroductionPageList" parameterType="com.jumeirah.common.param.CharterIntroductionPageParam"
            resultType="com.jumeirah.common.vo.CharterIntroductionQueryVo">
        select
        <include refid="Base_Column_List"/>
        from charter_introduction
    </select>

    <select id="getCharterIntroductionForAppPageList"
            parameterType="com.jumeirah.common.param.CharterIntroductionPageParam"
            resultType="com.jumeirah.common.vo.CharterIntroductionQueryForAppVo">
        select
        <include refid="Base_Column_ListForApp"/>
        from charter_introduction ci
        INNER JOIN merchant m ON ci.mc_id=m.id
        where ci.type = #{param.type}

        AND m.state=1 and m.audit_register_status=1

    </select>


</mapper>
