package com.shzg.project.worn.service.impl;

import java.util.List;
import com.shzg.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.shzg.project.worn.mapper.WornMaterialUnitMapper;
import com.shzg.project.worn.domain.WornMaterialUnit;
import com.shzg.project.worn.service.IWornMaterialUnitService;

/**
 * 物料单位Service业务层处理
 * 
 * @author shzg
 * @date 2026-03-11
 */
@Service
public class WornMaterialUnitServiceImpl implements IWornMaterialUnitService 
{
    @Autowired
    private WornMaterialUnitMapper wornMaterialUnitMapper;

    /**
     * 查询物料单位
     * 
     * @param id 物料单位主键
     * @return 物料单位
     */
    @Override
    public WornMaterialUnit selectWornMaterialUnitById(Long id)
    {
        return wornMaterialUnitMapper.selectWornMaterialUnitById(id);
    }

    /**
     * 查询物料单位列表
     * 
     * @param wornMaterialUnit 物料单位
     * @return 物料单位
     */
    @Override
    public List<WornMaterialUnit> selectWornMaterialUnitList(WornMaterialUnit wornMaterialUnit)
    {
        return wornMaterialUnitMapper.selectWornMaterialUnitList(wornMaterialUnit);
    }

    /**
     * 新增物料单位
     * 
     * @param wornMaterialUnit 物料单位
     * @return 结果
     */
    @Override
    public int insertWornMaterialUnit(WornMaterialUnit wornMaterialUnit)
    {
        wornMaterialUnit.setCreateTime(DateUtils.getNowDate());
        return wornMaterialUnitMapper.insertWornMaterialUnit(wornMaterialUnit);
    }

    /**
     * 修改物料单位
     * 
     * @param wornMaterialUnit 物料单位
     * @return 结果
     */
    @Override
    public int updateWornMaterialUnit(WornMaterialUnit wornMaterialUnit)
    {
        wornMaterialUnit.setUpdateTime(DateUtils.getNowDate());
        return wornMaterialUnitMapper.updateWornMaterialUnit(wornMaterialUnit);
    }

    /**
     * 批量删除物料单位
     * 
     * @param ids 需要删除的物料单位主键
     * @return 结果
     */
    @Override
    public int deleteWornMaterialUnitByIds(Long[] ids)
    {
        return wornMaterialUnitMapper.deleteWornMaterialUnitByIds(ids);
    }

    /**
     * 删除物料单位信息
     * 
     * @param id 物料单位主键
     * @return 结果
     */
    @Override
    public int deleteWornMaterialUnitById(Long id)
    {
        return wornMaterialUnitMapper.deleteWornMaterialUnitById(id);
    }
}
