package com.hw.ems.base.service.impl;

import com.hw.common.core.text.Convert;
import com.hw.common.datascope.annotation.DataScope;
import com.hw.ems.base.domain.BaseMeterInfo;
import com.hw.ems.base.mapper.BaseMeterInfoMapper;
import com.hw.ems.base.service.IBaseMeterInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.util.List;

/**
 * 计量仪表信息Service业务层处理
 *
 * @author YinQ
 * @date 2023-03-31
 */
@Service
public class BaseMeterInfoServiceImpl implements IBaseMeterInfoService {
    @Autowired
    private BaseMeterInfoMapper baseMeterInfoMapper;

    /**
     * 查询计量仪表信息
     *
     * @param objid 计量仪表信息主键
     * @return 计量仪表信息
     */
    @Override
    //@DS("#header.poolName")
    public BaseMeterInfo selectBaseMeterInfoByObjid(Long objid) {
        return baseMeterInfoMapper.selectBaseMeterInfoByObjid(objid);
    }

    /**
     * 查询计量仪表信息列表
     *
     * @param baseMeterInfo 计量仪表信息
     * @return 计量仪表信息
     */
    @Override
    @DataScope(deptAlias = "null")
    //@DS("#header.poolName")
    public List<BaseMeterInfo> selectBaseMeterInfoList(BaseMeterInfo baseMeterInfo) {
        return baseMeterInfoMapper.selectBaseMeterInfoList(baseMeterInfo);
    }

    /**
     * 新增计量仪表信息
     *
     * @param baseMeterInfo 计量仪表信息
     * @return 结果
     */
    @Override
    //@DS("#header.poolName")
    public int insertBaseMeterInfo(BaseMeterInfo baseMeterInfo) {
        return baseMeterInfoMapper.insertBaseMeterInfo(baseMeterInfo);
    }

    /**
     * 修改计量仪表信息
     *
     * @param baseMeterInfo 计量仪表信息
     * @return 结果
     */
    @Override
    //@DS("#header.poolName")
    public int updateBaseMeterInfo(BaseMeterInfo baseMeterInfo) {
        return baseMeterInfoMapper.updateBaseMeterInfo(baseMeterInfo);
    }

    /**
     * 批量删除计量仪表信息
     *
     * @param objids 需要删除的计量仪表信息主键
     * @return 结果
     */
    @Override
    //@DS("#header.poolName")
    public int deleteBaseMeterInfoByObjids(String objids) {
        return baseMeterInfoMapper.deleteBaseMeterInfoByObjids(Convert.toStrArray(objids));
    }

    /**
     * 删除计量仪表信息信息
     *
     * @param objid 计量仪表信息主键
     * @return 结果
     */
    @Override
    //@DS("#header.poolName")
    public int deleteBaseMeterInfoByObjid(Long objid) {
        return baseMeterInfoMapper.deleteBaseMeterInfoByObjid(objid);
    }
}
