package com.ruoyi.system.service.impl;

import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.IdWorker;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.domain.SysScreenLocation;
import com.ruoyi.system.domain.dto.SysScreenLocationDto;
import com.ruoyi.system.domain.vo.SysScreenLocationVo;
import com.ruoyi.system.domain.vo.SysScreenModuleVo;
import com.ruoyi.system.mapper.SysScreenLocationMapper;
import com.ruoyi.system.service.ISysScreenLocationService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 大屏模块位置Service业务层处理
 *
 * @author tianyongbao
 * @date 2023-12-22
 */
@Service
public class SysScreenLocationServiceImpl implements ISysScreenLocationService
{
    @Resource
    private SysScreenLocationMapper sysScreenLocationMapper;

    /**
     * 查询大屏可视化配置模块列表
     *
     * @return 大屏可视化配置模块
     */
    @Override
    public List<SysScreenModuleVo> selectSysScreenModuleList() {
        return sysScreenLocationMapper.selectSysScreenModuleList();
    }

    /**
     * 查询大屏模块位置
     *
     * @param id 大屏模块位置主键
     * @return 大屏模块位置
     */
    @Override
    public SysScreenLocationVo selectSysScreenLocationById(Long id)
    {
        return sysScreenLocationMapper.selectSysScreenLocationById(id);
    }

    /**
     * 查询大屏模块位置列表
     *
     * @param sysScreenLocationDto 大屏模块位置
     * @return 大屏模块位置
     */
    @Override
    public List<SysScreenLocationVo> selectSysScreenLocationList(SysScreenLocationDto sysScreenLocationDto)
    {
        return sysScreenLocationMapper.selectSysScreenLocationList(sysScreenLocationDto);
    }

    /**
     * 新增大屏模块位置
     *
     * @param sysScreenLocation 大屏模块位置
     * @return 结果
     */
    @Override
    public int insertSysScreenLocation(SysScreenLocation sysScreenLocation)
    {
        sysScreenLocation.setCreateBy(SecurityUtils.getUsername());
        sysScreenLocation.setCreateTime(DateUtils.getNowDate());
        sysScreenLocation.setId(IdWorker.getId());
        return sysScreenLocationMapper.insertSysScreenLocation(sysScreenLocation);
    }

    /**
     * 修改大屏模块位置
     *
     * @param sysScreenLocation 大屏模块位置
     * @return 结果
     */
    @Override
    public int updateSysScreenLocation(SysScreenLocation sysScreenLocation)
    {
        sysScreenLocation.setUpdateBy(SecurityUtils.getUsername());
        sysScreenLocation.setUpdateTime(DateUtils.getNowDate());
        return sysScreenLocationMapper.updateSysScreenLocation(sysScreenLocation);
    }

    /**
     * 批量删除大屏模块位置
     *
     * @param ids 需要删除的大屏模块位置主键
     * @return 结果
     */
    @Override
    public int deleteSysScreenLocationByIds(Long[] ids)
    {
        return sysScreenLocationMapper.removeSysScreenLocationByIds(ids);
    }

    /**
     * 删除大屏模块位置信息
     *
     * @param id 大屏模块位置主键
     * @return 结果
     */
    @Override
    public int deleteSysScreenLocationById(Long id)
    {
        return sysScreenLocationMapper.removeSysScreenLocationById(id);
    }
}
