package com.ruoyi.postCheck.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.postCheck.mapper.PostPlanCheckUserMapper;
import com.ruoyi.postCheck.domain.PostPlanCheckUser;
import com.ruoyi.postCheck.service.IPostPlanCheckUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * 岗检计划明细检查人表Service业务层处理
 *
 * @author csg
 * @date 2023-12-19
 */
@Service
public class PostPlanCheckUserServiceImpl extends ServiceImpl<PostPlanCheckUserMapper, PostPlanCheckUser> implements IPostPlanCheckUserService
{
    @Autowired
    private PostPlanCheckUserMapper postPlanCheckUserMapper;

    /**
     * 查询岗检计划明细检查人表
     *
     * @param id 岗检计划明细检查人表主键
     * @return 岗检计划明细检查人表
     */
    @Override
    public PostPlanCheckUser selectPostPlanInfoUserById(Long id)
    {
        return postPlanCheckUserMapper.selectPostPlanInfoUserById(id);
    }

    /**
     * 查询岗检计划明细检查人表列表
     *
     * @param postPlanCheckUser 岗检计划明细检查人表
     * @return 岗检计划明细检查人表
     */
    @Override
    public List<PostPlanCheckUser> selectPostPlanInfoUserList(PostPlanCheckUser postPlanCheckUser)
    {
        return postPlanCheckUserMapper.selectPostPlanInfoUserList(postPlanCheckUser);
    }

    /**
     * 新增岗检计划明细检查人表
     *
     * @param postPlanCheckUser 岗检计划明细检查人表
     * @return 结果
     */
    @Override
    public int insertPostPlanInfoUser(PostPlanCheckUser postPlanCheckUser)
    {
        //TODO 自增主键修改为-MyBatis-Plus雪花算法(截取5位解决VUE精度丢失BUG)-系统登录日志
        if (postPlanCheckUser.getId() == null)
            postPlanCheckUser.setId(Long.parseLong(IdWorker.getIdStr().substring(4)));
        postPlanCheckUser.setCreateDefault();
        return postPlanCheckUserMapper.insertPostPlanInfoUser(postPlanCheckUser);
    }

    /**
     * 修改岗检计划明细检查人表
     *
     * @param postPlanCheckUser 岗检计划明细检查人表
     * @return 结果
     */
    @Override
    public int updatePostPlanInfoUser(PostPlanCheckUser postPlanCheckUser)
    {
        postPlanCheckUser.setUpdateDefault();
        return postPlanCheckUserMapper.updatePostPlanInfoUser(postPlanCheckUser);
    }

    /**
     * 批量删除岗检计划明细检查人表
     *
     * @param ids 需要删除的岗检计划明细检查人表主键
     * @return 结果
     */
    @Override
    public int deletePostPlanInfoUserByIds(Long[] ids)
    {
        return postPlanCheckUserMapper.deletePostPlanInfoUserByIds(ids);
    }

    /**
     * 删除岗检计划明细检查人表信息
     *
     * @param id 岗检计划明细检查人表主键
     * @return 结果
     */
    @Override
    public int deletePostPlanInfoUserById(Long id)
    {
        return postPlanCheckUserMapper.deletePostPlanInfoUserById(id);
    }
}
