<?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.McPlainMapper">

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id,
        pt_id,
        status,
        create_time,
        update_time,
        mc_id,
        amount,
        city_id
    </sql>

    <select id="getMcPlainById" resultType="com.jumeirah.common.vo.McPlainQueryVo">
        select
        <include refid="Base_Column_List"/>
        from mc_plain where id = #{id}
    </select>

    <select id="getMcPlainPageList" parameterType="com.jumeirah.common.param.McPlainPageParam"
            resultType="com.jumeirah.common.vo.McPlainQueryVo">
        select
            pt.name as pt_name,
            pt.img_url,
            ctc.city_name_cn as city_name,
            mp.*
        from mc_plain mp
        left join plain_type pt on pt.id = mp.pt_id
        left join city_three_code ctc on ctc.id = mp.city_id
        where mp.mc_id = #{mcId}
    </select>

</mapper>
