package com.ruoyi.branch.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.branch.mapper.TBranchDemocraticMapper;
import com.ruoyi.branch.domain.TBranchDemocratic;
import com.ruoyi.branch.service.ITBranchDemocraticService;

/**
 * 民主生活会Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-07-20
 */
@Service
public class TBranchDemocraticServiceImpl implements ITBranchDemocraticService 
{
    @Autowired
    private TBranchDemocraticMapper tBranchDemocraticMapper;

    /**
     * 查询民主生活会
     * 
     * @param democraticId 民主生活会主键
     * @return 民主生活会
     */
    @Override
    public TBranchDemocratic selectTBranchDemocraticByDemocraticId(Long democraticId)
    {
        return tBranchDemocraticMapper.selectTBranchDemocraticByDemocraticId(democraticId);
    }

    /**
     * 查询民主生活会列表
     * 
     * @param tBranchDemocratic 民主生活会
     * @return 民主生活会
     */
    @Override
    @DataScope(deptAlias = "d", userAlias = "u")
    public List<TBranchDemocratic> selectTBranchDemocraticList(TBranchDemocratic tBranchDemocratic)
    {
        return tBranchDemocraticMapper.selectTBranchDemocraticList(tBranchDemocratic);
    }

    /**
     * 新增民主生活会
     * 
     * @param tBranchDemocratic 民主生活会
     * @return 结果
     */
    @Override
    public int insertTBranchDemocratic(TBranchDemocratic tBranchDemocratic)
    {
        tBranchDemocratic.setCreateTime(DateUtils.getNowDate());
        return tBranchDemocraticMapper.insertTBranchDemocratic(tBranchDemocratic);
    }

    /**
     * 修改民主生活会
     * 
     * @param tBranchDemocratic 民主生活会
     * @return 结果
     */
    @Override
    public int updateTBranchDemocratic(TBranchDemocratic tBranchDemocratic)
    {
        tBranchDemocratic.setUpdateTime(DateUtils.getNowDate());
        return tBranchDemocraticMapper.updateTBranchDemocratic(tBranchDemocratic);
    }

    /**
     * 批量删除民主生活会
     * 
     * @param democraticIds 需要删除的民主生活会主键
     * @return 结果
     */
    @Override
    public int deleteTBranchDemocraticByDemocraticIds(Long[] democraticIds)
    {
        return tBranchDemocraticMapper.deleteTBranchDemocraticByDemocraticIds(democraticIds);
    }

    /**
     * 删除民主生活会信息
     * 
     * @param democraticId 民主生活会主键
     * @return 结果
     */
    @Override
    public int deleteTBranchDemocraticByDemocraticId(Long democraticId)
    {
        return tBranchDemocraticMapper.deleteTBranchDemocraticByDemocraticId(democraticId);
    }
}
