package com.dsk.system.service.impl;

import com.dsk.common.core.domain.entity.BusinessBacklog;
import com.dsk.common.utils.DateUtils;
import com.dsk.system.mapper.BusinessBacklogMapper;
import com.dsk.system.service.IBusinessBacklogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 项目工作待办Service业务层处理
 *
 * @author lxl
 * @date 2023-05-17
 */
@Service
public class BusinessBacklogServiceImpl implements IBusinessBacklogService
{
    @Autowired
    private BusinessBacklogMapper businessBacklogMapper;

    /**
     * 查询项目工作待办
     *
     * @param id 项目工作待办主键
     * @return 项目工作待办
     */
    @Override
    public BusinessBacklog selectBusinessBacklogById(Long id)
    {
        return businessBacklogMapper.selectBusinessBacklogById(id);
    }

    /**
     * 查询项目工作待办列表
     *
     * @param businessBacklog 项目工作待办
     * @return 项目工作待办
     */
    @Override
    public List<BusinessBacklog> selectBusinessBacklogList(BusinessBacklog businessBacklog)
    {
        return businessBacklogMapper.selectBusinessBacklogList(businessBacklog);
    }

    /**
     * 新增项目工作待办
     *
     * @param businessBacklog 项目工作待办
     * @return 结果
     */
    @Override
    public int insertBusinessBacklog(BusinessBacklog businessBacklog)
    {
        businessBacklog.setCreateTime(DateUtils.getNowDate());
        //新增记录，默认未完成
        businessBacklog.setState(0);
        return businessBacklogMapper.insertBusinessBacklog(businessBacklog);
    }

    /**
     * 修改项目工作待办
     *
     * @param businessBacklog 项目工作待办
     * @return 结果
     */
    @Override
    public int updateBusinessBacklog(BusinessBacklog businessBacklog)
    {
        businessBacklog.setUpdateTime(DateUtils.getNowDate());
        return businessBacklogMapper.updateBusinessBacklog(businessBacklog);
    }

    /**
     * 批量删除项目工作待办
     *
     * @param ids 需要删除的项目工作待办主键
     * @return 结果
     */
    @Override
    public int deleteBusinessBacklogByIds(Long[] ids)
    {
        return businessBacklogMapper.deleteBusinessBacklogByIds(ids);
    }

    /**
     * 删除项目工作待办信息
     *
     * @param id 项目工作待办主键
     * @return 结果
     */
    @Override
    public int deleteBusinessBacklogById(Long id)
    {
        return businessBacklogMapper.deleteBusinessBacklogById(id);
    }
}
