package com.zcloud.service.notice.impl;

import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.notice.NoticeTemplateMapper;
import com.zcloud.service.notice.NoticeTemplateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 说明：通知模板
 * 作者：luoxiaobao
 * 时间：2022-05-24
 * 官网：www.zcloudchina.com
 */
@Service
@Transactional //开启事物
public class NoticeTemplateServiceImpl implements NoticeTemplateService {

	@Autowired
	private NoticeTemplateMapper noticetemplateMapper;

	/**新增
	 * @param pd
	 * @throws Exception
	 */
	public void save(PageData pd)throws Exception{
		noticetemplateMapper.save(pd);
	}

	/**删除
	 * @param pd
	 * @throws Exception
	 */
	public void delete(PageData pd)throws Exception{
		noticetemplateMapper.delete(pd);
	}

	/**修改
	 * @param pd
	 * @throws Exception
	 */
	public void edit(PageData pd)throws Exception{
		noticetemplateMapper.edit(pd);
	}

	/**列表
	 * @param page
	 * @throws Exception
	 */
	public List<PageData> list(Page page)throws Exception{
		return noticetemplateMapper.datalistPage(page);
	}

	/**列表(全部)
	 * @param pd
	 * @throws Exception
	 */
	public List<PageData> listAll(PageData pd)throws Exception{
		return noticetemplateMapper.listAll(pd);
	}

	/**通过id获取数据
	 * @param pd
	 * @throws Exception
	 */
	public PageData findById(PageData pd)throws Exception{
		return noticetemplateMapper.findById(pd);
	}

	/**通过code取数据
	 * @param pd
	 * @throws Exception
	 */
	public PageData findByCode(PageData pd)throws Exception{
		return noticetemplateMapper.findByCode(pd);
	}

	/**批量删除
	 * @param ArrayDATA_IDS
	 * @throws Exception
	 */
	public void deleteAll(String[] ArrayDATA_IDS)throws Exception{
		noticetemplateMapper.deleteAll(ArrayDATA_IDS);
	}

	@Override
	public PageData findByBianMa(PageData pd) {
		return noticetemplateMapper.findByBianMa(pd);
	}

	public PageData findByBianMa(String bianma) {
		PageData pd = new PageData();
		pd.put("BIANMA",bianma);
		return noticetemplateMapper.findByBianMa(pd);
	}
}

