package com.ruoyi.device.camera.service.impl; import java.util.List; import com.ruoyi.common.utils.uuid.IdUtils; import com.ruoyi.device.camera.domain.ArdCameras; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.device.camera.mapper.ArdCameraUserPostionMapper; import com.ruoyi.device.camera.domain.ArdCameraUserPostion; import com.ruoyi.device.camera.service.IArdCameraUserPostionService; /** * 用户预览位置Service业务层处理 * * @author 刘苏义 * @date 2024-05-08 */ @Service public class ArdCameraUserPostionServiceImpl implements IArdCameraUserPostionService { @Autowired private ArdCameraUserPostionMapper ardCameraUserPostionMapper; /** * 查询用户预览位置 * * @param id 用户预览位置主键 * @return 用户预览位置 */ @Override public ArdCameraUserPostion selectArdCameraUserPostionById(String id) { return ardCameraUserPostionMapper.selectArdCameraUserPostionById(id); } @Override public ArdCameras selectArdCameraUserPostionByPosition(String position) { ArdCameraUserPostion ardCameraUserPostion = new ArdCameraUserPostion(); ardCameraUserPostion.setUserId(SecurityUtils.getUserId()); ardCameraUserPostion.setPosition(position); ArdCameras ardCameras = ardCameraUserPostionMapper.selectArdCameraUserPostionByPosition(ardCameraUserPostion); return ardCameras; } /** * 查询用户预览位置列表 * * @param ardCameraUserPostion 用户预览位置 * @return 用户预览位置 */ @Override public List selectArdCameraUserPostionList(ArdCameraUserPostion ardCameraUserPostion) { return ardCameraUserPostionMapper.selectArdCameraUserPostionList(ardCameraUserPostion); } /** * 新增用户预览位置 * * @param ardCameraUserPostion 用户预览位置 * @return 结果 */ @Override public int insertArdCameraUserPostion(ArdCameraUserPostion ardCameraUserPostion) { ardCameraUserPostion.setUserId(SecurityUtils.getUserId()); List ardCameraUserPostions = ardCameraUserPostionMapper.selectArdCameraUserPostionList(ardCameraUserPostion); if (ardCameraUserPostions.size() > 0) { return ardCameraUserPostionMapper.updateArdCameraUserPostion(ardCameraUserPostion); } else { ardCameraUserPostion.setId(IdUtils.simpleUUID()); return ardCameraUserPostionMapper.insertArdCameraUserPostion(ardCameraUserPostion); } } /** * 修改用户预览位置 * * @param ardCameraUserPostion 用户预览位置 * @return 结果 */ @Override public int updateArdCameraUserPostion(ArdCameraUserPostion ardCameraUserPostion) { return ardCameraUserPostionMapper.updateArdCameraUserPostion(ardCameraUserPostion); } /** * 批量删除用户预览位置 * * @param ids 需要删除的用户预览位置主键 * @return 结果 */ @Override public int deleteArdCameraUserPostionByIds(String[] ids) { return ardCameraUserPostionMapper.deleteArdCameraUserPostionByIds(ids); } /** * 删除用户预览位置信息 * * @param id 用户预览位置主键 * @return 结果 */ @Override public int deleteArdCameraUserPostionById(String id) { return ardCameraUserPostionMapper.deleteArdCameraUserPostionById(id); } }