package com.dsk.system.service.impl;

import java.util.List;

import com.dsk.common.core.domain.entity.BusinessLabel;
import com.dsk.common.utils.DateUtils;
import com.dsk.system.domain.business.dto.BusinessIdDto;
import com.dsk.system.mapper.BusinessLabelMapper;
import com.dsk.system.service.IBusinessLabelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 项目标签Service业务层处理
 *
 * @author ruoyi
 * @date 2023-05-17
 */
@Service
public class BusinessLabelServiceImpl implements IBusinessLabelService
{
    @Autowired
    private BusinessLabelMapper businessLabelMapper;

    /**
     * 查询项目标签
     *
     * @param id 项目标签主键
     * @return 项目标签
     */
    @Override
    public BusinessLabel selectBusinessLabelById(Long id)
    {
        return businessLabelMapper.selectBusinessLabelById(id);
    }

    /**
     * 查询项目标签列表
     *
     * @param businessLabel 项目标签
     * @return 项目标签
     */
    @Override
    public List<BusinessLabel> selectBusinessLabelList(BusinessLabel businessLabel)
    {
        return businessLabelMapper.selectBusinessLabelList(businessLabel);
    }

    /**
     * 新增项目标签
     *
     * @param businessLabel 项目标签
     * @return 结果
     */
    @Override
    @Transactional
    public int insertBusinessLabel(BusinessLabel businessLabel)
    {
        businessLabel.setCreateTime(DateUtils.getNowDate());
        return businessLabelMapper.insertBusinessLabel(businessLabel);
    }

    /**
     * 修改项目标签
     *
     * @param businessLabel 项目标签
     * @return 结果
     */
    @Override
    public int updateBusinessLabel(BusinessLabel businessLabel)
    {
        businessLabel.setUpdateTime(DateUtils.getNowDate());
        return businessLabelMapper.updateBusinessLabel(businessLabel);
    }

    /**
     * 批量删除项目标签
     *
     * @param ids 需要删除的项目标签主键
     * @return 结果
     */
    @Override
    public int deleteBusinessLabelByIds(Long[] ids)
    {
        return businessLabelMapper.deleteBusinessLabelByIds(ids);
    }

    /**
     * 删除项目标签信息
     *
     * @param dto 项目主键
     * @return 结果
     */
    @Override
    @Transactional
    public int deleteBusinessLabelById(BusinessIdDto dto)
    {
        return businessLabelMapper.deleteBusinessLabelById(dto);
    }
}
