<?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.ylx.massage.mapper.TCollectMapper">

    <resultMap id="getAllMap" type="com.ylx.massage.domain.TCollect">
        <id column="c_id" property="cId"/>
        <result column="c_wx_open_id" property="cWxOpenId"/>
        <result column="c_js_id" property="cJsId"/>
        <result column="dt_create_time" property="dtCreateTime"/>
        <association property="js" javaType="com.ylx.massage.domain.TJs">
            <id column="id" property="id"/>
            <result column="c_open_id" property="cOpenId"/>
            <result column="c_bh_list" property="cBhList"/>
            <result column="c_img_list" property="cImgList"
                    typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
            <result column="c_sfz_img" property="cSfzImg"
                    typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
            <result column="n_sex" property="nSex"/>
            <result column="c_nick_name" property="cNickName"/>
            <result column="c_portrait" property="cPortrait"/>
            <result column="c_name" property="cName"/>
            <result column="c_phone" property="cPhone"/>
            <result column="c_address" property="cAddress"/>
            <result column="c_jianjie" property="cJianjie"/>
            <result column="n_star" property="nStar"/>
            <result column="n_bili" property="nBili"/>
            <result column="n_num" property="nNum"/>
            <result column="n_num2" property="nNum2"/>
            <result column="n_status" property="nStatus"/>
            <result column="n_status2" property="nStatus2"/>
            <result column="n_tong" property="nTong"/>
            <result column="c_time" property="cTime"/>
            <result column="n_b1" property="nB1"/>
            <result column="n_b2" property="nB2"/>
            <result column="n_b3" property="nB3"/>
            <result column="jsCreateTime" property="dtCreateTime"/>
        </association>
    </resultMap>
    <select id="getAll" resultMap="getAllMap">
        select t_collect.c_id,
               t_collect.c_wx_open_id,
               t_collect.c_js_id,
               t_collect.dt_create_time,
               t_js.id,
               t_js.c_open_id,
               t_js.c_bh_list,
               t_js.c_img_list,
               t_js.c_sfz_img,
               t_js.n_sex,
               t_js.c_nick_name,
               t_js.c_portrait,
               t_js.c_name,
               t_js.c_phone,
               t_js.c_address,
               t_js.c_jianjie,
               t_js.n_star,
               t_js.n_bili,
               t_js.n_num,
               t_js.n_status,
               t_js.n_status2,
               t_js.n_tong,
               t_js.c_time,
               t_js.n_b1,
               t_js.n_b2,
               t_js.n_b3,
               t_js.dt_create_time as jsCreateTime
        from t_collect
        left join
            t_js
        on
            t_collect.c_js_id = t_js.id
        <where>
            t_collect.is_delete = 0 and t_js.is_delete = 0
            <if test="param.cWxOpenId != null and param.cWxOpenId != ''">
                and t_collect.c_wx_open_id = #{ param.cWxOpenId }
            </if>
            <if test="param.cJsId != null and param.cJsId != ''">
                and t_collect.c_js_id = #{ param.cJsId }
            </if>
        </where>
        order by
            t_collect.dt_create_time desc
    </select>

</mapper>
