package com.railway.business.safetool.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.railway.business.safetool.mapper.SecScheduledToolMapper;
import com.railway.business.safetool.domain.SecScheduledTool;
import com.railway.business.safetool.service.ISecScheduledToolService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.railway.common.utils.SecurityUtils;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Date;
/**
* 安全计划和工具关系表
* @author lijie
* @date 2021/12/04
*/
@Service
@Transactional(readOnly = true)
public class SecScheduledToolServiceImpl implements ISecScheduledToolService{
@Autowired
private SecScheduledToolMapper secScheduledToolMapper;

	/**
	* 新增
	*/
	@Override
	@Transactional(rollbackFor = Exception.class)
	public int create(SecScheduledTool secScheduledTool) {
	    secScheduledTool.setCreateTime(new Date());
        secScheduledTool.setCreateBy(SecurityUtils.getUsername());
		return secScheduledToolMapper.insert(secScheduledTool);
	}

	/**
	* 删除
	*/
	@Override
	@Transactional(rollbackFor = Exception.class)
	public int delete(String[] ids) {
		int r =0;
		for (String id : ids) {
//需根据需求进行删除
//			int j= secScheduledToolMapper.delete(Long.parseLong(id));
//			r = r + j;
		}
		return	r;
	}

	/**
	* 更新
	*/
	@Override
	@Transactional(rollbackFor = Exception.class)
	public int update(SecScheduledTool secScheduledTool) {
		secScheduledTool.setUpdateTime(new Date());
    	secScheduledTool.setUpdateBy(SecurityUtils.getUsername());
		return secScheduledToolMapper.update(secScheduledTool);
	}

	/**
	* 获取单个
	*/
	@Override
	public SecScheduledTool getInfo(String id) {
		return secScheduledToolMapper.getInfo(id);
	}

	/**
	* 查询列表
	*/
	@Override
	public List<SecScheduledTool> getList(SecScheduledTool secScheduledTool) {
		return secScheduledToolMapper.getList(secScheduledTool);
	}
}
