/**
 * Copyright (c) 2016-2019 人人开源 All rights reserved.
 *
 * https://www.renren.io
 *
 * 版权所有，侵权必究！
 */

package io.renren.modules.app.dao;

import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.renren.modules.app.entity.UserEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * 用户
 *
 * @author Mark sunlightcs@gmail.com
 */
@Mapper
public interface UserDao extends BaseMapper<UserEntity> {
    @Select("select p.order_id, p.attenders_id as attendersId, (select a.name from attenders as a where a.id=p.attenders_id) as attendersName,  (select a.organization from attenders as a where a.id=p.attenders_id) as organization, (select tf.name from types_of_fee as tf where tf.id=p.pay_type) as typeName, p.pay_time, (select m.name_cn from meeting as m where m.id=p.meeting_id) as meetingName from payment as p where p.attenders_id in  (select a.id from attenders as a where a.member_id=#{member_id});")
    List<Map<String, Object>> queryOrderList(Long memberId);

    @Select("select a.name as attendersName,a.meeting_id as meetingId,a.position_id as position,(select m.name_cn from meeting as m where m.id=a.meeting_id) as meetingName ,(select m.start_time from meeting as m where m.id=a.meeting_id) as startTime,(select m.end_time from meeting as m where m.id=a.meeting_id) as endTime,(select p.is_pay from payment as p where p.attenders_id = a.id) as isCheck from attenders as a where a.id = #{attendersId};")
    Map<String, Object> queryOrderInfoByAttendersId(Long attendersId);
}
