package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.system.domain.dto.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysSourceMapper;
import com.ruoyi.system.domain.SysSource;
import com.ruoyi.system.service.ISysSourceService;

/**
 * 资源位Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-11-08
 */
@Service
public class SysSourceServiceImpl implements ISysSourceService 
{
    @Autowired
    private SysSourceMapper sysSourceMapper;

    /**
     * 查询资源位
     * 
     * @param sourceId 资源位主键
     * @return 资源位
     */
    @Override
    public SysSource selectSysSourceBySourceId(Long sourceId)
    {
        return sysSourceMapper.selectSysSourceBySourceId(sourceId);
    }

    /**
     * 查询资源位列表
     * 
     * @param sysSource 资源位
     * @return 资源位
     */
    @Override
    public List<SysSource> selectSysSourceList(SysSource sysSource)
    {
        return sysSourceMapper.selectSysSourceList(sysSource);
    }

    /**
     * 新增资源位
     * 
     * @param sysSource 资源位
     * @return 结果
     */
    @Override
    public int insertSysSource(SysSource sysSource)
    {
        return sysSourceMapper.insertSysSource(sysSource);
    }

    /**
     * 修改资源位
     * 
     * @param sysSource 资源位
     * @return 结果
     */
    @Override
    public int updateSysSource(SysSource sysSource)
    {
        return sysSourceMapper.updateSysSource(sysSource);
    }

    @Override
    public int updateDefaultSourceWorkAddress(String city, String scenic, String part, String sourceStatus, String workAddress){
        return sysSourceMapper.updateDefaultSourceWorkAddress(city, scenic, part, sourceStatus, workAddress);

    }

    @Override
    public int updateDefaultSourcePrice(String city, String scenic, String part, String price){
        return sysSourceMapper.updateDefaultSourcePrice(city, scenic, part, price);

    }

    /**
     * 批量删除资源位
     * 
     * @param sourceIds 需要删除的资源位主键
     * @return 结果
     */
    @Override
    public int deleteSysSourceBySourceIds(Long[] sourceIds)
    {
        return sysSourceMapper.deleteSysSourceBySourceIds(sourceIds);
    }

    /**
     * 删除资源位信息
     * 
     * @param sourceId 资源位主键
     * @return 结果
     */
    @Override
    public int deleteSysSourceBySourceId(Long sourceId)
    {
        return sysSourceMapper.deleteSysSourceBySourceId(sourceId);
    }

    @Override
    public List<SourceListDto> getSysSourceList(SysSource sysSource){
        return sysSourceMapper.getSysSourceList(sysSource);
    }

    @Override
    public List<HotSourceDto> getHotSource(){
        return sysSourceMapper.getHotSource();
    };

    @Override
    public int updateSysSourceByCP(SysSource sysSource){
        return sysSourceMapper.updateSysSourceByCP(sysSource);
    }

    @Override
    /*
     * 查看我的发布资源位详情
     * */
    public List<UserPublishWorkSourceListDto> getUserPublishWorkSourceList(Long workId){
        return sysSourceMapper.getUserPublishWorkSourceList(workId);
    }

    /*
     * AR 获取资源位信息列表, 包括作品标题和介绍
     * */
    @Override
    public List<ShowSysSourceARListDto> getSysSourceARList(SysSource sysSource){
        return sysSourceMapper.getSysSourceARList(sysSource);
    }

    /**
     * 按xy坐标返回AR资源位图片
     * */
    @Override
    public List<ShowSysSourceARListDto> getARSource(String city,  String scenic, List<Coordinate> coordinates){
        return sysSourceMapper.getARSource(city, scenic, coordinates);
    }
}
