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

import org.springframework.stereotype.Service;
import java.util.Arrays;
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.MeetingDao;
import io.renren.modules.admin.entity.MeetingEntity;
import io.renren.modules.admin.service.MeetingService;


@Service("meetingService")
public class MeetingServiceImpl extends ServiceImpl<MeetingDao, MeetingEntity> implements MeetingService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<MeetingEntity> page = this.page(
                new Query<MeetingEntity>().getPage(params),
                new QueryWrapper<MeetingEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public PageUtils queryList(int page, int limit, String key) {
        // System.out.println(page);
        // System.out.println(limit);
        // System.out.println(key);
        List<Map<String, Object>> mList=baseMapper.queryCN(page, limit, key, key);
        Integer mc = baseMapper.queryCNCOUNTS(key, key);

        return new PageUtils(mList, mc, limit, page);
    }

    // 删除用户(逻辑删除)
    @Override
    public void delete(Long[] ids) {
        baseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    @Override
    public int updateStatus(Long id, Integer isCheck) {
        int itemp = baseMapper.updateStatus(id, isCheck);
        return itemp;
        // @Update("update member set is_check=#{is_check}  where id = #{id}")
    }
}
