package com.ruoyi.bd.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateTimeUtil;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.bd.mapper.BdDevcTrailUwbMapper;
import com.ruoyi.bd.domain.BdDevcTrailUwb;
import com.ruoyi.bd.service.IBdDevcTrailUwbService;

/**
 * 室内坐标定位Service业务层处理
 *
 * @author ruoyi
 * @date 2024-10-16
 */
@Service
public class BdDevcTrailUwbServiceImpl implements IBdDevcTrailUwbService {
    @Autowired
    private BdDevcTrailUwbMapper bdDevcTrailUwbMapper;

    /**
     * 查询室内坐标定位
     *
     * @param id 室内坐标定位主键
     * @return 室内坐标定位
     */
    @Override
    public BdDevcTrailUwb selectBdDevcTrailUwbById(Long id) {
        return bdDevcTrailUwbMapper.selectBdDevcTrailUwbById(id);
    }

    /**
     * 查询室内坐标定位列表
     *
     * @param bdDevcTrailUwb 室内坐标定位
     * @return 室内坐标定位
     */
    @Override
    public List<BdDevcTrailUwb> selectBdDevcTrailUwbList(BdDevcTrailUwb bdDevcTrailUwb) {
        return bdDevcTrailUwbMapper.selectBdDevcTrailUwbList(bdDevcTrailUwb);
    }

    /**
     * 新增室内坐标定位
     *
     * @param bdDevcTrailUwb 室内坐标定位
     * @return 结果
     */
    @Override
    public int insertBdDevcTrailUwb(BdDevcTrailUwb bdDevcTrailUwb) {
        bdDevcTrailUwb.setCreateTime(DateUtils.getNowDate());
        return bdDevcTrailUwbMapper.insertBdDevcTrailUwb(bdDevcTrailUwb);
    }

    /**
     * 修改室内坐标定位
     *
     * @param bdDevcTrailUwb 室内坐标定位
     * @return 结果
     */
    @Override
    public int updateBdDevcTrailUwb(BdDevcTrailUwb bdDevcTrailUwb) {
        bdDevcTrailUwb.setUpdateTime(DateUtils.getNowDate());
        return bdDevcTrailUwbMapper.updateBdDevcTrailUwb(bdDevcTrailUwb);
    }

    /**
     * 批量删除室内坐标定位
     *
     * @param ids 需要删除的室内坐标定位主键
     * @return 结果
     */
    @Override
    public int deleteBdDevcTrailUwbByIds(Long[] ids) {
        return bdDevcTrailUwbMapper.deleteBdDevcTrailUwbByIds(ids);
    }

    /**
     * 删除室内坐标定位信息
     *
     * @param id 室内坐标定位主键
     * @return 结果
     */
    @Override
    public int deleteBdDevcTrailUwbById(Long id) {
        return bdDevcTrailUwbMapper.deleteBdDevcTrailUwbById(id);
    }

    @Override
    public void saveUwbTrail() {
        String yesterday = DateTimeUtil.yesterday(DateTimeUtil.DateFormatter.yyyyMMdd);
        bdDevcTrailUwbMapper.saveObjTail(yesterday);
    }
}
