package com.gkhy.safePlatform.specialWork.service.baseService.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gkhy.safePlatform.commons.enums.ResultCodes; import com.gkhy.safePlatform.commons.exception.BusinessException; import com.gkhy.safePlatform.specialWork.entity.WorkAtHeightInfo; import com.gkhy.safePlatform.specialWork.entity.WorkBlindPlatePluggingInfo; import com.gkhy.safePlatform.specialWork.enums.WorkAtHeightStatusEnum; import com.gkhy.safePlatform.specialWork.enums.WorkBlindPlatePluggingStatusEnum; import com.gkhy.safePlatform.specialWork.model.query.WorkAtHeightQuery; import com.gkhy.safePlatform.specialWork.model.query.WorkBlindPlatePluggingQuery; import com.gkhy.safePlatform.specialWork.repository.WorkAtHeightInfoRepository; import com.gkhy.safePlatform.specialWork.repository.WorkBlindPlatePluggingInfoRepository; import com.gkhy.safePlatform.specialWork.service.baseService.WorkAtHeightInfoService; import com.gkhy.safePlatform.specialWork.service.baseService.WorkBlindPlatePluggingInfoService; import org.springframework.stereotype.Service; import java.time.LocalDateTime; import java.util.List; @Service("WorkBlindPlatePluggingInfoService") public class WorkBlindPlatePluggingInfoServiceImpl extends ServiceImpl implements WorkBlindPlatePluggingInfoService { /** * 新增 * @param workBlindPlatePluggingInfo * @return */ @Override public int saveOne(WorkBlindPlatePluggingInfo workBlindPlatePluggingInfo) { workBlindPlatePluggingInfo.setGmtCreate(LocalDateTime.now()); workBlindPlatePluggingInfo.setStatus(WorkBlindPlatePluggingStatusEnum.VALID.getCode()); return baseMapper.insert(workBlindPlatePluggingInfo); } /** * 修改 * @param workBlindPlatePluggingInfo * @return */ @Override public int updateOne(WorkBlindPlatePluggingInfo workBlindPlatePluggingInfo) { if(null == workBlindPlatePluggingInfo.getId()){ throw new BusinessException(ResultCodes.CLIENT_PARAM_NULL); } workBlindPlatePluggingInfo.setGmtModified(LocalDateTime.now()); return baseMapper.updateById(workBlindPlatePluggingInfo); } /** * 删除-单条 * * @param id * @return */ @Override public int updateStatusById(Long id) { if(null == id){ throw new BusinessException(ResultCodes.CLIENT_PARAM_NULL); } WorkBlindPlatePluggingInfo workBlindPlatePluggingInfo = new WorkBlindPlatePluggingInfo(); workBlindPlatePluggingInfo.setId(id); workBlindPlatePluggingInfo.setStatus(WorkBlindPlatePluggingStatusEnum.ABANDONED.getCode()); return baseMapper.updateById(workBlindPlatePluggingInfo); } /** * 批量删除 * @param idList * @return */ @Override public int updateStatutsByIds(List idList) { if(null == idList || idList.size() == 0){ throw new BusinessException(ResultCodes.CLIENT_PARAM_NULL); } return baseMapper.updateStatutsByIds(idList, WorkBlindPlatePluggingStatusEnum.ABANDONED.getCode()); } /** * 根据id获取单条数据 * @param id * @return */ // @Override // public WorkBlindPlatePluggingInfo getById(Long id) { // if(null == id){ // throw new BusinessException(ResultCodes.CLIENT_PARAM_NULL); // } // return baseMapper.selectOne(new LambdaQueryWrapper() // .eq(WorkBlindPlatePluggingInfo::getId,id) // .eq(WorkBlindPlatePluggingInfo::getStatus,WorkBlindPlatePluggingStatusEnum.VALID.getCode()) // ); // } /** * 条件查询 * @param query * @return */ @Override public List getListByConditions(WorkBlindPlatePluggingQuery query) { query.setStatus(WorkBlindPlatePluggingStatusEnum.VALID.getCode()); return baseMapper.listByConditions(query); } }