package com.srs.dormitory.service.impl;

import java.util.List;

import com.srs.common.utils.DateUtils;
import com.srs.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.srs.dormitory.mapper.DmsOutsideAccommodationApplyMapper;
import com.srs.dormitory.domain.DmsOutsideAccommodationApply;
import com.srs.dormitory.service.IDmsOutsideAccommodationApplyService;

/**
 * 外宿申请Service业务层处理
 *
 * @author srs
 * @date 2025-12-05
 */
@Service
public class DmsOutsideAccommodationApplyServiceImpl extends ServiceImpl<DmsOutsideAccommodationApplyMapper, DmsOutsideAccommodationApply> implements IDmsOutsideAccommodationApplyService {
    @Autowired
    private DmsOutsideAccommodationApplyMapper dmsOutsideAccommodationApplyMapper;

    /**
     * 查询外宿申请
     *
     * @param id 外宿申请主键
     * @return 外宿申请
     */
    @Override
    public DmsOutsideAccommodationApply selectDmsOutsideAccommodationApplyById(Long id) {
        return dmsOutsideAccommodationApplyMapper.selectDmsOutsideAccommodationApplyById(id);
    }

    @Override
    public DmsOutsideAccommodationApply selectDmsOutsideAccommodationApplyByProcessInstanceId(String processInstanceId) {
        return dmsOutsideAccommodationApplyMapper.selectDmsOutsideAccommodationApplyByProcessInstanceId(processInstanceId);
    }

    /**
     * 查询外宿申请列表
     *
     * @param dmsOutsideAccommodationApply 外宿申请
     * @return 外宿申请
     */
    @Override
    public List<DmsOutsideAccommodationApply> selectDmsOutsideAccommodationApplyList(DmsOutsideAccommodationApply dmsOutsideAccommodationApply) {
        return dmsOutsideAccommodationApplyMapper.selectDmsOutsideAccommodationApplyList(dmsOutsideAccommodationApply);
    }

    /**
     * 新增外宿申请
     *
     * @param dmsOutsideAccommodationApply 外宿申请
     * @return 结果
     */
    @Override
    public int insertDmsOutsideAccommodationApply(DmsOutsideAccommodationApply dmsOutsideAccommodationApply) {
        dmsOutsideAccommodationApply.setCreateTime(DateUtils.getNowDate());
        dmsOutsideAccommodationApply.setCreateBy(SecurityUtils.getUsername());
        return dmsOutsideAccommodationApplyMapper.insertDmsOutsideAccommodationApply(dmsOutsideAccommodationApply);
    }

    /**
     * 修改外宿申请
     *
     * @param dmsOutsideAccommodationApply 外宿申请
     * @return 结果
     */
    @Override
    public int updateDmsOutsideAccommodationApply(DmsOutsideAccommodationApply dmsOutsideAccommodationApply) {
        dmsOutsideAccommodationApply.setUpdateTime(DateUtils.getNowDate());
        return dmsOutsideAccommodationApplyMapper.updateDmsOutsideAccommodationApply(dmsOutsideAccommodationApply);
    }

    /**
     * 批量删除外宿申请
     *
     * @param ids 需要删除的外宿申请主键
     * @return 结果
     */
    @Override
    public int deleteDmsOutsideAccommodationApplyByIds(Long[] ids) {
        return dmsOutsideAccommodationApplyMapper.deleteDmsOutsideAccommodationApplyByIds(ids);
    }

    /**
     * 删除外宿申请信息
     *
     * @param id 外宿申请主键
     * @return 结果
     */
    @Override
    public int deleteDmsOutsideAccommodationApplyById(Long id) {
        return dmsOutsideAccommodationApplyMapper.deleteDmsOutsideAccommodationApplyById(id);
    }
}
