package io.renren.modules.admin.dao;

import io.renren.modules.admin.entity.PaperEntity;

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

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * 
 * 
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2020-02-12 10:52:23
 */
@Mapper
public interface PaperDao extends BaseMapper<PaperEntity> {
    @Select("select p.id,p.title,a.id a_id,m.truename,m.phone,m.email,p.paperurl,p.create_time from attenders a join paper p on a.id=p.attenders_id join member m on m.id=a.member_id where a.meeting_id=#{meetingId} and a.is_del =0 and p.is_del = 0 and (p.title like '%${key1}%' or m.truename LIKE '%${key2}%') limit #{page},#{limit};")
    List<Map<String, Object>> getPageList(Long meetingId, int page, int limit, String key1, String key2);

    @Select("select count(p.id) from attenders a join paper p on a.id=p.attenders_id join member m on m.id=a.member_id where a.meeting_id=#{meetingId} and a.is_del =0 and p.is_del = 0 and (p.title like '%${key1}%' or m.truename LIKE '%${key2}%');")
    int getCounts(Long meetingId, String key1, String key2);
}
