package com.fs.hospital.service.impl;

import java.util.List;
import com.fs.common.utils.DateUtils;
import com.fs.company.domain.CompanyPost;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fs.hospital.mapper.HospitalPostMapper;
import com.fs.hospital.domain.HospitalPost;
import com.fs.hospital.service.IHospitalPostService;

/**
 * 岗位信息Service业务层处理
 *
 * @author fs
 * @date 2024-02-26
 */
@Service
public class HospitalPostServiceImpl implements IHospitalPostService
{
    @Autowired
    private HospitalPostMapper hospitalPostMapper;

    /**
     * 查询岗位信息
     *
     * @param postId 岗位信息主键
     * @return 岗位信息
     */
    @Override
    public HospitalPost selectHospitalPostByPostId(Long postId)
    {
        return hospitalPostMapper.selectHospitalPostByPostId(postId);
    }

    /**
     * 查询岗位信息列表
     *
     * @param hospitalPost 岗位信息
     * @return 岗位信息
     */
    @Override
    public List<HospitalPost> selectHospitalPostList(HospitalPost hospitalPost)
    {
        return hospitalPostMapper.selectHospitalPostList(hospitalPost);
    }

    /**
     * 新增岗位信息
     *
     * @param hospitalPost 岗位信息
     * @return 结果
     */
    @Override
    public int insertHospitalPost(HospitalPost hospitalPost)
    {
        hospitalPost.setCreateTime(DateUtils.getNowDate());
        return hospitalPostMapper.insertHospitalPost(hospitalPost);
    }

    /**
     * 修改岗位信息
     *
     * @param hospitalPost 岗位信息
     * @return 结果
     */
    @Override
    public int updateHospitalPost(HospitalPost hospitalPost)
    {
        hospitalPost.setUpdateTime(DateUtils.getNowDate());
        return hospitalPostMapper.updateHospitalPost(hospitalPost);
    }

    /**
     * 批量删除岗位信息
     *
     * @param postIds 需要删除的岗位信息主键
     * @return 结果
     */
    @Override
    public int deleteHospitalPostByPostIds(Long[] postIds)
    {
        return hospitalPostMapper.deleteHospitalPostByPostIds(postIds);
    }

    /**
     * 删除岗位信息信息
     *
     * @param postId 岗位信息主键
     * @return 结果
     */
    @Override
    public int deleteHospitalPostByPostId(Long postId)
    {
        return hospitalPostMapper.deleteHospitalPostByPostId(postId);
    }

    @Override
    public int checkPostCodeUnique(HospitalPost post) {
        return hospitalPostMapper.checkPostCodeUnique(post.getHospitalId(),post.getPostCode());
    }

    @Override
    public List<Integer> selectPostListByUserId(Long userId) {
        return hospitalPostMapper.selectPostListByUserId(userId);
    }
}
