package com.ruoyi.web.controller.manager;

import cn.hutool.core.convert.Convert;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.TdMeeting;
import com.ruoyi.system.service.TdMeetingService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

/**
 * packageName com.ruoyi.web.controller.manager
 *
 * @author wangxy
 * @version JDK 8
 * @className TdMeetingManager
 * @date 2024/8/6
 * @description 会议
 */
@Component
public class TdMeetingManager {

    @Resource
    private TdMeetingService meetingService;


    public List<TdMeeting> selectTdMeetingList(TdMeeting tdMeeting) {
        return meetingService.selectTdMeetingList(tdMeeting);
    }


    public boolean saveOrUpdate(TdMeeting tdMeeting) {
        if (StringUtils.isNotBlank(tdMeeting.getId())) {
            tdMeeting.setUpdateBy(ShiroUtils.getSysUser().getLoginName());
            tdMeeting.setUpdateTime(new Date());
        } else {
            tdMeeting.setCreateBy(ShiroUtils.getSysUser().getLoginName());
            tdMeeting.setCreateTime(new Date());
        }
        return meetingService.saveOrUpdate(tdMeeting);
    }


    public TdMeeting selectTdMeeting(String id) {
        return meetingService.getById(id);
    }

    public boolean deleteTdMeetingByids(String ids) {
        List<String> list = Arrays.asList(Convert.toStrArray(ids));
        return meetingService.removeByIds(list);
    }


}
