package com.gkhy.safePlatform.safeCheck.service.baseService.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gkhy.safePlatform.commons.enums.E; import com.gkhy.safePlatform.commons.enums.ResultCodes; import com.gkhy.safePlatform.commons.exception.AusinessException; import com.gkhy.safePlatform.commons.exception.BusinessException; import com.gkhy.safePlatform.safeCheck.entity.SafeCheckPoint; import com.gkhy.safePlatform.safeCheck.entity.SafeCheckRegion; import com.gkhy.safePlatform.safeCheck.enums.DelectStatusEnum; import com.gkhy.safePlatform.safeCheck.model.query.ListPointByPageDBQuery; import com.gkhy.safePlatform.safeCheck.repository.SafeCheckPointRepository; import com.gkhy.safePlatform.safeCheck.service.baseService.SafeCheckPointService; import org.checkerframework.checker.units.qual.A; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.HashMap; import java.util.List; @Service("SafeCheckPointService") public class SafeCheckPointServiceImpl extends ServiceImpl implements SafeCheckPointService { @Autowired private SafeCheckPointRepository safeCheckPointRepository; /** * @description 根据巡检点名称查询巡检点(有效状态) */ @Override public SafeCheckPoint getPointByPointName(String pointName, int deleteStatus) { SafeCheckPoint safeCheckPoint = safeCheckPointRepository.getPointByPointName(pointName,deleteStatus); return safeCheckPoint; } /** * @description 新增巡检点 */ @Override public void savePoint(SafeCheckPoint safeCheckPoint) { int insertResult = safeCheckPointRepository.insert(safeCheckPoint); if (insertResult == 0){ throw new BusinessException(ResultCodes.SERVER_ADD_ERROR); } } /** * @description 根据巡检点id查询数据库中数据(有效状态) */ @Override public SafeCheckPoint getOnePoint(Long id, int status) { return safeCheckPointRepository.getOnePoint(id,status); } /** * @description 根据巡检点id删除巡检点 */ @Override public void deletePointById(SafeCheckPoint safeCheckPoint, int deleteStatus) { int deleteResult = safeCheckPointRepository.deletePointById(safeCheckPoint,deleteStatus); if (deleteResult == 0){ throw new BusinessException(ResultCodes.SERVER_DEL_ERROR); } } /** * @description 通过巡检点的id和uuid对巡检点进行更新 */ @Override public void updatePointById(SafeCheckPoint newPoint, int deleteStatus) { int updateResult = safeCheckPointRepository.updatePointById(newPoint,deleteStatus); if (updateResult == 0){ throw new AusinessException(E.DATA_STATUS_NOT_EXIST,"巡检点不存在,更新失败"); } } /** * @description 查询所有巡检点数据并进行分页展示 */ @Override public Page listPointByPage(Page pageInfo, ListPointByPageDBQuery pageDBQuery) { return safeCheckPointRepository.listPointByPage(pageInfo, pageDBQuery); } /** * @description 获取所有巡检点、巡检区域、巡检rfid的id值 */ @Override public List getPointRegionRfidId() { List points= safeCheckPointRepository.getPointRegionRfidId(); return points; } }