package com.zcloud.service.system.impl;

import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.service.system.OfficeService;
import com.zcloud.mapper.dsno2.system.OfficeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

/**
 * 说明：课程考试
 * 作者：luoxiaobao
 * 时间：2021-09-13
 * 官网：www.zcloudchina.com
 */
@Service
public class OfficeServiceImpl implements OfficeService {

	@Autowired
	private OfficeMapper officeMapper;

	/**新增
	 * @param pd
	 * @throws Exception
	 */
	@Transactional //开启事物
	public void save(PageData pd)throws Exception{
		officeMapper.save(pd);
	}

	/**删除
	 * @param pd
	 * @throws Exception
	 */
	@Transactional //开启事物
	public void delete(PageData pd)throws Exception{
		officeMapper.delete(pd);
	}

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

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

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

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

	/**
	 * 批量删除
	 *
	 * @param ArrayDATA_IDS
	 * @throws Exception
	 */
	@Transactional
	public void deleteAll(PageData ArrayDATA_IDS) throws Exception {
		officeMapper.deleteAll(ArrayDATA_IDS);
	}

	@Override
	public void saveBatch(ArrayList<PageData> officeList) {
		officeMapper.saveBatch(officeList);
	}
}

