package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.SnowFlakeUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.domain.vo.UrYearValidDataDisVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.mapper.UrYearValidDataDisMapper;
import com.ruoyi.system.domain.UrYearValidDataDis;
import com.ruoyi.system.service.IUrYearValidDataDisService;

/**
 * 专利有效按年统计结果(区县)Service业务层处理
 * 
 * @author dm
 * @date 2023-02-13
 */
@Service
@Transactional
public class UrYearValidDataDisServiceImpl implements IUrYearValidDataDisService 
{
    @Autowired
    private UrYearValidDataDisMapper urYearValidDataDisMapper;

    /**
     * 查询专利有效按年统计结果(区县)
     * 
     * @param id 专利有效按年统计结果(区县)主键
     * @return 专利有效按年统计结果(区县)
     */
    @Override
    public UrYearValidDataDis selectUrYearValidDataDisById(Long id)
    {
        return urYearValidDataDisMapper.selectUrYearValidDataDisById(id);
    }

    /**
     * 查询专利有效按年统计结果(区县)列表
     * 
     * @param urYearValidDataDis 专利有效按年统计结果(区县)
     * @return 专利有效按年统计结果(区县)
     */
    @Override
    public List<UrYearValidDataDis> selectUrYearValidDataDisList(UrYearValidDataDisVo urYearValidDataDis)
    {
        return urYearValidDataDisMapper.selectUrYearValidDataDisList(urYearValidDataDis);
    }

    /**
     * 新增专利有效按年统计结果(区县)
     * 
     * @param urYearValidDataDis 专利有效按年统计结果(区县)
     * @return 结果
     */
    @Override
    public int insertUrYearValidDataDis(UrYearValidDataDis urYearValidDataDis)
    {
        if(urYearValidDataDis.getId()==null){
        urYearValidDataDis.setId(SnowFlakeUtils.snowFlakeId());
    }
        return urYearValidDataDisMapper.insertUrYearValidDataDis(urYearValidDataDis);
    }

    /**
     * 修改专利有效按年统计结果(区县)
     * 
     * @param urYearValidDataDis 专利有效按年统计结果(区县)
     * @return 结果
     */
    @Override
    public int updateUrYearValidDataDis(UrYearValidDataDis urYearValidDataDis)
    {
        return urYearValidDataDisMapper.updateUrYearValidDataDis(urYearValidDataDis);
    }

    /**
     * 批量删除专利有效按年统计结果(区县)
     * 
     * @param ids 需要删除的专利有效按年统计结果(区县)主键
     * @return 结果
     */
    @Override
    public int deleteUrYearValidDataDisByIds(Long[] ids)
    {
        return urYearValidDataDisMapper.deleteUrYearValidDataDisByIds(ids);
    }

    /**
     * 删除专利有效按年统计结果(区县)信息
     * 
     * @param id 专利有效按年统计结果(区县)主键
     * @return 结果
     */
    @Override
    public int deleteUrYearValidDataDisById(Long id)
    {
        return urYearValidDataDisMapper.deleteUrYearValidDataDisById(id);
    }

    /**
     * 批量---逻辑删除
     *
     * @param ids 需要删除的专利有效按年统计结果(区县)ID
     * @return 结果
     */
    @Override
    public int setDeleteByIds(Long[] ids)
    {
        Long userId = SecurityUtils.getUserId();
        String userNickName = SecurityUtils.getUserNickName();
        return urYearValidDataDisMapper.setDeleteByIds(ids,userId,userNickName);
    }

    /**
     * 删除---逻辑删除
     *
     * @param id 专利有效按年统计结果(区县)ID
     * @return 结果
     */
    @Override
    public int setDeleteById(Long id)
    {
        Long userId = SecurityUtils.getUserId();
        String userNickName = SecurityUtils.getUserNickName();
        return urYearValidDataDisMapper.setDeleteById(id,userId,userNickName);
    }

    /**
     * 获取有效概览左侧表头列表
     * @return
     */
    @Override
    public List<UrYearValidDataDis> selectUrLeftList(String code) {
        return urYearValidDataDisMapper.selectUrLeftList(code);
    }

    /**
     * 查询市专利有效按年统计结果列表
     *
     * @param urYearValidDataDis 专利有效按年统计结果
     * @return 市专利有效按年统计结果集合
     */
    public List<UrYearValidDataDis> selectUrYearValidDataDisCityList(UrYearValidDataDisVo urYearValidDataDis) {
        return urYearValidDataDisMapper.selectUrYearValidDataDisCityList(urYearValidDataDis);
    }

}
