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.WorkGroundBreakingInfo;
|
import com.gkhy.safePlatform.specialWork.enums.WorkGroundBreakingStatusEnum;
|
import com.gkhy.safePlatform.specialWork.model.query.WorkGroundBreakingQuery;
|
import com.gkhy.safePlatform.specialWork.repository.WorkGroundBreakingInfoRepository;
|
|
import com.gkhy.safePlatform.specialWork.service.baseService.WorkGroundBreakingInfoService;
|
import org.springframework.stereotype.Service;
|
|
import java.time.LocalDateTime;
|
import java.util.List;
|
|
@Service("WorkGroundBreakingInfoService")
|
public class WorkGroundBreakingInfoServiceImpl extends ServiceImpl<WorkGroundBreakingInfoRepository, WorkGroundBreakingInfo> implements WorkGroundBreakingInfoService {
|
|
/**
|
* 新增
|
* @param workGroundBreakingInfo
|
* @return
|
*/
|
@Override
|
public int saveOne(WorkGroundBreakingInfo workGroundBreakingInfo) {
|
workGroundBreakingInfo.setGmtCreate(LocalDateTime.now());
|
workGroundBreakingInfo.setStatus(WorkGroundBreakingStatusEnum.VALID.getCode());
|
return baseMapper.insert(workGroundBreakingInfo);
|
}
|
|
/**
|
* 修改
|
* @param workGroundBreakingInfo
|
* @return
|
*/
|
@Override
|
public int updateOne(WorkGroundBreakingInfo workGroundBreakingInfo) {
|
if(null == workGroundBreakingInfo.getId()){
|
throw new BusinessException(ResultCodes.CLIENT_PARAM_NULL);
|
}
|
workGroundBreakingInfo.setGmtModified(LocalDateTime.now());
|
return baseMapper.updateById(workGroundBreakingInfo);
|
}
|
|
/**
|
* 删除-单条
|
*
|
* @param id
|
* @return
|
*/
|
|
@Override
|
public int updateStatusById(Long id) {
|
if(null == id){
|
throw new BusinessException(ResultCodes.CLIENT_PARAM_NULL);
|
}
|
WorkGroundBreakingInfo workGroundBreakingInfo = new WorkGroundBreakingInfo();
|
workGroundBreakingInfo.setId(id);
|
workGroundBreakingInfo.setStatus(WorkGroundBreakingStatusEnum.ABANDONED.getCode());
|
return baseMapper.updateById(workGroundBreakingInfo);
|
}
|
|
/**
|
* 批量删除
|
* @param idList
|
* @return
|
*/
|
@Override
|
public int updateStatutsByIds(List<Long> idList) {
|
if(null == idList || idList.size() == 0){
|
throw new BusinessException(ResultCodes.CLIENT_PARAM_NULL);
|
}
|
return baseMapper.updateStatutsByIds(idList, WorkGroundBreakingStatusEnum.ABANDONED.getCode());
|
}
|
|
|
/**
|
* 根据id获取单条数据
|
* @param id
|
* @return
|
*/
|
// @Override
|
// public WorkGroundBreakingInfo getById(Long id) {
|
// if(null == id){
|
// throw new BusinessException(ResultCodes.CLIENT_PARAM_NULL);
|
// }
|
// return baseMapper.selectOne(new LambdaQueryWrapper<WorkGroundBreakingInfo>()
|
// .eq(WorkGroundBreakingInfo::getId,id)
|
// .eq(WorkGroundBreakingInfo::getStatus,WorkGroundBreakingStatusEnum.VALID.getCode())
|
// );
|
// }
|
|
/**
|
* 条件查询
|
* @param query
|
* @return
|
*/
|
@Override
|
public List<WorkGroundBreakingInfo> getListByConditions(WorkGroundBreakingQuery query) {
|
query.setStatus(WorkGroundBreakingStatusEnum.VALID.getCode());
|
return baseMapper.listByConditions(query);
|
}
|
}
|