package com.scm.contract.service.message;

import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.scm.contract.dao.message.MessageCenterDao;
import com.scm.contract.model.apply.DictionaryTagType;
import com.scm.contract.model.apply.LabelApplication;
import com.scm.contract.model.management.Materiel;
import com.scm.contract.model.message.MessageCenter;
import com.set.direwolf.core.mybatis.CrudService;
import com.set.direwolf.core.mybatis.Page;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.*;

/**
 * @author zuo
 * @date 2024/6/17 15:06
 */

@Service
@Transactional(readOnly = true, rollbackFor = Exception.class)
public class MessageCenterService extends CrudService<MessageCenterDao, MessageCenter, String> {

    public List<MessageCenter> findList(MessageCenter messageCenter) {
        return this.dao.findList(messageCenter);
    }

    public List<MessageCenter> listByIds(List<String> ids) {
        return this.dao.listByIds(ids);
    }

    /**
     * 分页查询
     * @param page
     * @param entity
     * @return
     */
    @Override
    public Page<MessageCenter> findPage(Page<MessageCenter> page, MessageCenter entity) {
        entity.setPage(page);
        page.setList(this.dao.findList(entity));
        return page;
    }

    @Transactional
    public synchronized int saveOrUpdateBash(List<MessageCenter> saveOrUpdateMessage) {
        return this.dao.saveOrUpdateBash(saveOrUpdateMessage);
    }
}
