package com.ruoyi.mall.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mall.mapper.MallAppGoodsUnitMapper;
import com.ruoyi.mall.domain.MallAppGoodsUnit;
import com.ruoyi.mall.service.IMallAppGoodsUnitService;

import javax.annotation.Resource;

/**
 * app商品单位Service业务层处理
 *
 * @author ruoyi
 * @date 2024-07-02
 */
@Service
public class MallAppGoodsUnitServiceImpl implements IMallAppGoodsUnitService
{
    @Resource
    private MallAppGoodsUnitMapper mallAppGoodsUnitMapper;

    /**
     * 查询app商品单位
     *
     * @param goodsUnitId app商品单位主键
     * @return app商品单位
     */
    @Override
    public MallAppGoodsUnit selectMallAppGoodsUnitByGoodsUnitId(Long goodsUnitId)
    {
        return mallAppGoodsUnitMapper.selectMallAppGoodsUnitByGoodsUnitId(goodsUnitId);
    }

    /**
     * 查询app商品单位列表
     *
     * @param mallAppGoodsUnit app商品单位
     * @return app商品单位
     */
    @Override
    public List<MallAppGoodsUnit> selectMallAppGoodsUnitList(MallAppGoodsUnit mallAppGoodsUnit)
    {
        return mallAppGoodsUnitMapper.selectMallAppGoodsUnitList(mallAppGoodsUnit);
    }

    /**
     * 新增app商品单位
     *
     * @param mallAppGoodsUnit app商品单位
     * @return 结果
     */
    @Override
    public int insertMallAppGoodsUnit(MallAppGoodsUnit mallAppGoodsUnit)
    {
        mallAppGoodsUnit.setCreateAt(DateUtils.getTime());
        mallAppGoodsUnit.setDelFlag("0");
        return mallAppGoodsUnitMapper.insertMallAppGoodsUnit(mallAppGoodsUnit);
    }

    /**
     * 修改app商品单位
     *
     * @param mallAppGoodsUnit app商品单位
     * @return 结果
     */
    @Override
    public int updateMallAppGoodsUnit(MallAppGoodsUnit mallAppGoodsUnit)
    {
        mallAppGoodsUnit.setUpdateAt(DateUtils.getTime());
        return mallAppGoodsUnitMapper.updateMallAppGoodsUnit(mallAppGoodsUnit);
    }

    /**
     * 批量删除app商品单位
     *
     * @param goodsUnitIds 需要删除的app商品单位主键
     * @return 结果
     */
    @Override
    public int deleteMallAppGoodsUnitByGoodsUnitIds(Long[] goodsUnitIds)
    {
        return mallAppGoodsUnitMapper.deleteMallAppGoodsUnitByGoodsUnitIds(goodsUnitIds);
    }

    /**
     * 删除app商品单位信息
     *
     * @param goodsUnitId app商品单位主键
     * @return 结果
     */
    @Override
    public int deleteMallAppGoodsUnitByGoodsUnitId(Long goodsUnitId)
    {
        return mallAppGoodsUnitMapper.deleteMallAppGoodsUnitByGoodsUnitId(goodsUnitId);
    }
}
