package com.ruoyi.postCheck.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.postCheck.mapper.PostTeamDeptMapper;
import com.ruoyi.postCheck.domain.PostTeamDept;
import com.ruoyi.postCheck.service.IPostTeamDeptService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * 岗检工作组关联部门Service业务层处理
 *
 * @author csg
 * @date 2023-12-19
 */
@Service
public class PostTeamDeptServiceImpl extends ServiceImpl<PostTeamDeptMapper, PostTeamDept> implements IPostTeamDeptService
{
    @Autowired
    private PostTeamDeptMapper postTeamDeptMapper;

    /**
     * 查询岗检工作组关联部门
     *
     * @param id 岗检工作组关联部门主键
     * @return 岗检工作组关联部门
     */
    @Override
    public PostTeamDept selectPostTeamDeptById(Long id)
    {
        return postTeamDeptMapper.selectPostTeamDeptById(id);
    }

    /**
     * 查询岗检工作组关联部门列表
     *
     * @param postTeamDept 岗检工作组关联部门
     * @return 岗检工作组关联部门
     */
    @Override
    public List<PostTeamDept> selectPostTeamDeptList(PostTeamDept postTeamDept)
    {
        return postTeamDeptMapper.selectPostTeamDeptList(postTeamDept);
    }

    /**
     * 新增岗检工作组关联部门
     *
     * @param postTeamDept 岗检工作组关联部门
     * @return 结果
     */
    @Override
    public int insertPostTeamDept(PostTeamDept postTeamDept)
    {
        //TODO 自增主键修改为-MyBatis-Plus雪花算法(截取5位解决VUE精度丢失BUG)-系统登录日志
        if (postTeamDept.getId() == null)
            postTeamDept.setId(Long.parseLong(IdWorker.getIdStr().substring(4)));
        postTeamDept.setCreateDefault();
        return postTeamDeptMapper.insertPostTeamDept(postTeamDept);
    }

    /**
     * 修改岗检工作组关联部门
     *
     * @param postTeamDept 岗检工作组关联部门
     * @return 结果
     */
    @Override
    public int updatePostTeamDept(PostTeamDept postTeamDept)
    {
        postTeamDept.setUpdateDefault();
        return postTeamDeptMapper.updatePostTeamDept(postTeamDept);
    }

    /**
     * 批量删除岗检工作组关联部门
     *
     * @param ids 需要删除的岗检工作组关联部门主键
     * @return 结果
     */
    @Override
    public int deletePostTeamDeptByIds(Long[] ids)
    {
        return postTeamDeptMapper.deletePostTeamDeptByIds(ids);
    }

    /**
     * 删除岗检工作组关联部门信息
     *
     * @param id 岗检工作组关联部门主键
     * @return 结果
     */
    @Override
    public int deletePostTeamDeptById(Long id)
    {
        return postTeamDeptMapper.deletePostTeamDeptById(id);
    }
}
