package com.djhk.uav.uav.service.impl;


import com.djhk.common.core.domain.entity.SysUser;
import com.djhk.common.utils.DateUtils;
import com.djhk.common.utils.SecurityUtils;
import com.djhk.uav.uav.domain.ThreedModelInfo;
import com.djhk.uav.uav.domain.ThreedModelInfoVo;
import com.djhk.uav.uav.mapper.ThreedModelInfoMapper;
import com.djhk.uav.uav.service.IThreedModelInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 模型Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-07-27
 */
@Service
public class ThreedModelInfoServiceImpl implements IThreedModelInfoService
{
    @Autowired
    private ThreedModelInfoMapper threedModelInfoMapper;

    /**
     * 查询模型
     * 
     * @param modelId 模型主键
     * @return 模型
     */
    @Override
    public ThreedModelInfo selectThreedModelInfoByModelId(Long modelId)
    {
        return threedModelInfoMapper.selectThreedModelInfoByModelId(modelId);
    }

    /**
     * 查询模型列表
     * 
     * @param threedModelInfoVo 模型
     * @return 模型
     */
    @Override
    public List<ThreedModelInfo> selectThreedModelInfoList(ThreedModelInfoVo threedModelInfoVo)
    {
        return threedModelInfoMapper.selectThreedModelInfoList(threedModelInfoVo);
    }

    /**
     * 新增模型
     * 
     * @param threedModelInfo 模型
     * @return 结果
     */
    @Override
    public int insertThreedModelInfo(ThreedModelInfo threedModelInfo)
    {
        threedModelInfo.setCreateTime(DateUtils.getNowDate());
        return threedModelInfoMapper.insertThreedModelInfo(threedModelInfo);
    }

    /**
     * 修改模型
     * 
     * @param threedModelInfo 模型
     * @return 结果
     */
    @Override
    public int updateThreedModelInfo(ThreedModelInfo threedModelInfo)
    {
        threedModelInfo.setUpdateTime(DateUtils.getNowDate());
        return threedModelInfoMapper.updateThreedModelInfo(threedModelInfo);
    }

    /**
     * 批量删除模型
     * 
     * @param modelIds 需要删除的模型主键
     * @return 结果
     */
    @Override
    public int deleteThreedModelInfoByModelIds(Long[] modelIds)
    {
        return threedModelInfoMapper.deleteThreedModelInfoByModelIds(modelIds);
    }

    /**
     * 删除模型信息
     * 
     * @param modelId 模型主键
     * @return 结果
     */
    @Override
    public int deleteThreedModelInfoByModelId(Long modelId)
    {
        return threedModelInfoMapper.deleteThreedModelInfoByModelId(modelId);
    }

    @Override
    public List<ThreedModelInfo> selectThreedModelInfoAllList() {
        Long deptId = SecurityUtils.getDeptId();
        if (deptId == 1){
            return threedModelInfoMapper.selectThreedModelInfoAllList() ;
        }else {
            return threedModelInfoMapper.selectThreedModelInfoLists(deptId);
        }
    }
}
