package io.renren.modules.admin.dao;

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

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.Update;
import org.apache.ibatis.annotations.Select;

/**
 * 会议表
 * 
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2020-02-20 14:59:39
 */
@Mapper
public interface MeetingDao extends BaseMapper<MeetingEntity> {
	@Update("update meeting set is_check=#{isCheck} where id=#{id}")
    int updateStatus(Long id, Integer isCheck);

    @Select("select m.id,c.companyname,m.name_cn,m.address,m.start_time from meeting as m left JOIN company as c on m.company_id = c.id where m.is_del = 0 and (m.name_cn LIKE '%${key}%' or m.name_en LIKE '%${key2}%') limit #{page},#{limit} ")
    List<Map<String, Object>> getPageList(int page, int limit, String key, String key2);

    @Select("select count(*) from meeting  where is_del = 0 and (name_cn LIKE '%${key}%' or name_en LIKE '%${key2}%')")
    Integer getCounts(String key, String key2);
}
