package com.zd.chemical.service.impl;

import java.util.List;
import com.zd.common.core.utils.DateUtils;
import com.zd.common.core.utils.SecurityUtils;
import com.zd.common.security.utils.SaveUtil;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zd.chemical.mapper.HxpChemicalClassifyMapper;
import com.zd.chemical.domain.HxpChemicalClassify;
import com.zd.chemical.service.IHxpChemicalClassifyService;

/**
 * 化学品分类Service业务层处理
 *
 * @author zd
 * @date 2022-06-21
 */
@Service
public class HxpChemicalClassifyServiceImpl implements IHxpChemicalClassifyService
{
    @Autowired
    private HxpChemicalClassifyMapper hxpChemicalClassifyMapper;

    /**
     * 查询化学品分类
     *
     * @param id 化学品分类主键
     * @return 化学品分类
     */
    @Override
    public HxpChemicalClassify selectHxpChemicalClassifyById(Long id)
    {
        return hxpChemicalClassifyMapper.selectHxpChemicalClassifyById(id);
    }

    /**
     * 查询化学品分类列表
     *
     * @param hxpChemicalClassify 化学品分类
     * @return 化学品分类
     */
    @Override
    public List<HxpChemicalClassify> selectHxpChemicalClassifyList(HxpChemicalClassify hxpChemicalClassify)
    {
        return hxpChemicalClassifyMapper.selectHxpChemicalClassifyList(hxpChemicalClassify);
    }

    /**
     * 新增化学品分类
     *
     * @param hxpChemicalClassify 化学品分类
     * @return 结果
     */
    @Override
    public int insertHxpChemicalClassify(HxpChemicalClassify hxpChemicalClassify)
    {
        //设置其他公共字段
        SaveUtil.setCommonAttr(hxpChemicalClassify);
        return hxpChemicalClassifyMapper.insertHxpChemicalClassify(hxpChemicalClassify);
    }

    /**
     * 修改化学品分类
     *
     * @param hxpChemicalClassify 化学品分类
     * @return 结果
     */
    @Override
    public int updateHxpChemicalClassify(HxpChemicalClassify hxpChemicalClassify)
    {
        hxpChemicalClassify.setUpdateTime(DateUtils.getNowDate());
        hxpChemicalClassify.setUpdateBy(SecurityUtils.getUsername());
        return hxpChemicalClassifyMapper.updateHxpChemicalClassify(hxpChemicalClassify);
    }

    /**
     * 批量删除化学品分类
     *
     * @param ids 需要删除的化学品分类主键
     * @return 结果
     */
    @Override
    public int deleteHxpChemicalClassifyByIds(Long[] ids)
    {
        return hxpChemicalClassifyMapper.deleteHxpChemicalClassifyByIds(ids);
    }

    /**
     * 删除化学品分类信息
     *
     * @param id 化学品分类主键
     * @return 结果
     */
    @Override
    public int deleteHxpChemicalClassifyById(Long id)
    {
        return hxpChemicalClassifyMapper.deleteHxpChemicalClassifyById(id);
    }
}
