package com.srs.dormitory.service.impl;

import java.util.List;

import com.srs.common.core.domain.AjaxResult;
import com.srs.dormitory.domain.DmsDormitoryRecords;
import com.srs.dormitory.mapper.DmsDormitoryRecordsMapper;
import com.srs.dormitory.service.IDmsDormitoryRecordsService;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 宿舍费用Service业务层处理
 *
 * @author srs
 * @date 2023-10-20
 */
@Service
public class DmsDormitoryRecordsServiceImpl extends ServiceImpl<DmsDormitoryRecordsMapper, DmsDormitoryRecords> implements IDmsDormitoryRecordsService {
    @Autowired
    private DmsDormitoryRecordsMapper dmsDormitoryRecordsMapper;

    /**
     * 查询宿舍费用
     *
     * @param id 宿舍费用主键
     * @return 宿舍费用
     */
    @Override
    public DmsDormitoryRecords selectDmsDormitoryRecordsById(Long id) {
        return dmsDormitoryRecordsMapper.selectDmsDormitoryRecordsById(id);
    }

    /**
     * 查询宿舍费用列表
     *
     * @param dmsDormitoryRecords 宿舍费用
     * @return 宿舍费用
     */
    @Override
    public List<DmsDormitoryRecords> selectDmsDormitoryRecordsList(DmsDormitoryRecords dmsDormitoryRecords) {
        return dmsDormitoryRecordsMapper.selectDmsDormitoryRecordsList(dmsDormitoryRecords);
    }

    /**
     * 新增宿舍费用
     *
     * @param dmsDormitoryRecords 宿舍费用
     * @return 结果
     */
    @Override
    public int insertDmsDormitoryRecords(DmsDormitoryRecords dmsDormitoryRecords) {
            return dmsDormitoryRecordsMapper.insertDmsDormitoryRecords(dmsDormitoryRecords);
    }

    /**
     * 修改宿舍费用
     *
     * @param dmsDormitoryRecords 宿舍费用
     * @return 结果
     */
    @Override
    public int updateDmsDormitoryRecords(DmsDormitoryRecords dmsDormitoryRecords) {
        return dmsDormitoryRecordsMapper.updateDmsDormitoryRecords(dmsDormitoryRecords);
    }

    /**
     * 批量删除宿舍费用
     *
     * @param ids 需要删除的宿舍费用主键
     * @return 结果
     */
    @Override
    public int deleteDmsDormitoryRecordsByIds(Long[] ids) {
        return dmsDormitoryRecordsMapper.deleteDmsDormitoryRecordsByIds(ids);
    }

    /**
     * 删除宿舍费用信息
     *
     * @param id 宿舍费用主键
     * @return 结果
     */
    @Override
    public int deleteDmsDormitoryRecordsById(Long id) {
        return dmsDormitoryRecordsMapper.deleteDmsDormitoryRecordsById(id);
    }

    @Override
    @Transactional
    public AjaxResult importData(List<DmsDormitoryRecords> dormitoryRecordsList) {
        saveBatch(dormitoryRecordsList);
        return AjaxResult.success();
    }
}
