package com.ruoyi.manage.service.impl;

import java.util.List;


import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.manage.mapper.RecordWasteInMapper;
import com.ruoyi.manage.domain.RecordWasteIn;
import com.ruoyi.manage.service.IRecordWasteInService;
import com.ruoyi.common.core.text.Convert;

/**
 * 废品入库记录Service业务层处理
 *
 * @author wangh
 * @date 2024-01-29
 */
@Service
public class RecordWasteInServiceImpl implements IRecordWasteInService {
    @Autowired
    private RecordWasteInMapper recordWasteInMapper;

    /**
     * 查询废品入库记录
     *
     * @param objid 废品入库记录主键
     * @return 废品入库记录
     */
    @Override
    public RecordWasteIn selectRecordWasteInByObjid(Long objid) {
        return recordWasteInMapper.selectRecordWasteInByObjid(objid);
    }

    /**
     * 查询废品入库记录列表
     *
     * @param recordWasteIn 废品入库记录
     * @return 废品入库记录
     */
    @Override
    public List<RecordWasteIn> selectRecordWasteInList(RecordWasteIn recordWasteIn) {
        return recordWasteInMapper.selectRecordWasteInList(recordWasteIn);
    }

    /**
     * 新增废品入库记录
     *
     * @param recordWasteIn 废品入库记录
     * @return 结果
     */
    @Override
    public int insertRecordWasteIn(RecordWasteIn recordWasteIn) {
        recordWasteIn.setCreateBy(ShiroUtils.getLoginName());
        recordWasteIn.setCreateTime(DateUtils.getNowDate());
        return recordWasteInMapper.insertRecordWasteIn(recordWasteIn);
    }

    /**
     * 修改废品入库记录
     *
     * @param recordWasteIn 废品入库记录
     * @return 结果
     */
    @Override
    public int updateRecordWasteIn(RecordWasteIn recordWasteIn) {
        return recordWasteInMapper.updateRecordWasteIn(recordWasteIn);
    }

    /**
     * 批量删除废品入库记录
     *
     * @param objids 需要删除的废品入库记录主键
     * @return 结果
     */
    @Override
    public int deleteRecordWasteInByObjids(String objids) {
        return recordWasteInMapper.deleteRecordWasteInByObjids(Convert.toStrArray(objids));
    }

    /**
     * 删除废品入库记录信息
     *
     * @param objid 废品入库记录主键
     * @return 结果
     */
    @Override
    public int deleteRecordWasteInByObjid(Long objid) {
        return recordWasteInMapper.deleteRecordWasteInByObjid(objid);
    }
}
