package com.bonus.material.work.service.impl;

import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.work.domain.SysWorkflowType;
import com.bonus.material.work.mapper.SysWorkflowTypeMapper;
import com.bonus.material.work.service.SysWorkflowTypeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SysWorkflowTypeServiceImpl implements SysWorkflowTypeService {

    @Resource
    private SysWorkflowTypeMapper sysWorkflowTypeMapper;
    /**
     * 审批类型列表
     */
    @Override
    public List<SysWorkflowType> selectSysWorkflowTypeList(SysWorkflowType sysWorkflowType) {

        return sysWorkflowTypeMapper.selectSysWorkflowTypeList(sysWorkflowType);
    }

    /**
     * 新增审批类型
     */
    @Override
    public int addSysWorkflowType(SysWorkflowType sysWorkflowType) {
        //保存创建人信息
        sysWorkflowType.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString());
        //保存创建时间
        sysWorkflowType.setCreateTime(DateUtils.getNowDate());
        return sysWorkflowTypeMapper.addSysWorkflowType(sysWorkflowType);
    }

    /**
     * 删除审批类型
     */
    @Override
    public int deleteSysWorkflowType(SysWorkflowType sysWorkflowType) {
        return sysWorkflowTypeMapper.deleteSysWorkflowType(sysWorkflowType);
    }


    /**
     * 修改审批类型
     */
    @Override
    public int updateSysWorkflowType(SysWorkflowType sysWorkflowType) {
        return sysWorkflowTypeMapper.updateSysWorkflowType(sysWorkflowType);
    }
}
