package io.renren.modules.admin.service.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.admin.dao.AttendersDao;
import io.renren.modules.admin.entity.AttendersEntity;
import io.renren.modules.admin.service.AttendersService;

@Service("attendersService")
public class AttendersServiceImpl extends ServiceImpl<AttendersDao, AttendersEntity> implements AttendersService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String name = (String) params.get("name");
        IPage<AttendersEntity> page = this.page(
                new Query<AttendersEntity>().getPage(params),
                new QueryWrapper<AttendersEntity>()
                .like(StringUtils.isNotBlank(name),"name",name)
        );

        List<AttendersEntity> theList = page.getRecords();
        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
        for (AttendersEntity attenders : theList) {
            Map<String, Object> map = new HashMap<String, Object>();
            Long aid = attenders.getId();
            map.put("id", aid);
            map.put("id", aid);
            map.put("id", aid);
            map.put("id", aid);
            map.put("id", aid);
            map.put("id", aid);
            map.put("id", aid);
        }


        return new PageUtils(page);
    }

    // @Override
    // public PageUtils myQueryPage(Map<String, Object> params) {
        
    //     List<Map<String, Object>> list = baseMapper.getMapList();



    //     return new PageUtils();
    // }

    @Override
    public List<Map<String, Object>> getMeetingListByMemberId(Long memberId){
        return baseMapper.getMeetingListByMemberId(memberId);
    }

    @Override
    public Map<String, Object> getNameById(Long aid) {
        return baseMapper.getNameById(aid);
    }

    @Override
    public Map<String, Object> getMapById(Long aid) {
        return baseMapper.getMapById(aid);
    }

    @Override
    public List<Map<String, Object>> getMapList(Long meetingId) {
        return baseMapper.getMapList(meetingId);
    }

    @Override
    public int changeColumnValue(String column, Integer value, Long id) {
        return baseMapper.changeColumnValue(column, value,id);
    }
}