package com.pj.project.tb_notices;

import java.util.Date;
import java.util.List;

import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pj.utils.so.SoMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import com.pj.utils.sg.*;
import org.springframework.transaction.annotation.Transactional;

/**
 * Service: tb_notices -- 消息表
 * @author lzm 
 */
@Service
@Transactional
public class TbNoticesService extends ServiceImpl<TbNoticesMapper, TbNotices> implements IService<TbNotices> {

	/** 底层 Mapper 对象 */
	@Autowired
	TbNoticesMapper tbNoticesMapper;

	/** 增 */
	int add(TbNotices t){
		return tbNoticesMapper.add(t);
	}

	/** 删 */
	int delete(Long id){
		return tbNoticesMapper.delete(id);
	}

	/** 改 */
	int update(TbNotices t){
		return tbNoticesMapper.update(t);
	}

	/** 查 */
	TbNotices getById(Long id){
		return tbNoticesMapper.getById(id);
	}

	/** 查集合 - 根据条件（参数为空时代表忽略指定条件） */  
	List<TbNotices> getList(SoMap so) {
		return tbNoticesMapper.getList(so);	
	}

	/** 发送业务消息
     * @param text
     * */

	public void sendNotice(String businessId,String businessNo, String customerId, String text){
        TbNotices notice = new TbNotices();
        notice.setBusinessId(businessId).setBusinessNo(businessNo).setCustomerIds(customerId).setText(text).setSendTime(new Date()).setType(1);
        add(notice);
    }

	

}
