package com.gkhy.safePlatform.doublePrevention.service.baseService.impl;
|
|
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.doublePrevention.entity.PreventDangerCheckContent;
|
import com.gkhy.safePlatform.doublePrevention.repository.PreventDangerCheckContentRepository;
|
import com.gkhy.safePlatform.doublePrevention.service.baseService.PreventDangerCheckContentService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
@Service("PreventDangerCheckContentService")
|
public class PreventDangerCheckContentServiceImpl
|
extends ServiceImpl<PreventDangerCheckContentRepository, PreventDangerCheckContent> implements PreventDangerCheckContentService {
|
|
@Autowired
|
private PreventDangerCheckContentRepository preventDangerCheckContentRepository;
|
|
/**
|
* 插入管控措施,同时插入措施对应的隐患排查内容
|
* */
|
@Override
|
public int saveDangerCheckContent(PreventDangerCheckContent checkContent) {
|
int insertResult = preventDangerCheckContentRepository.insert(checkContent);
|
if (insertResult == 0){
|
throw new BusinessException(ResultCodes.SERVER_ADD_ERROR);
|
}
|
return insertResult;
|
}
|
|
/**
|
* 查询管控措施-通过关联的措施id
|
* */
|
@Override
|
public PreventDangerCheckContent getCheckContentByMeasureId(Long measureId) {
|
return preventDangerCheckContentRepository.getCheckContentByMeasureId(measureId);
|
}
|
|
/**
|
* 修改隐患排查内容-通过关联的措施id
|
* */
|
@Override
|
public void updateDangerCheckContent(Long measureId, String checkContent) {
|
|
int result = preventDangerCheckContentRepository.updateDangerCheckContent(measureId, checkContent);
|
if (result == 0){
|
throw new BusinessException(ResultCodes.SERVER_ADD_ERROR);
|
}
|
}
|
|
/**
|
* 查询任隐患排查内容-根据务关联的检查内容taskId
|
* */
|
@Override
|
public PreventDangerCheckContent getCheckContentByTaskId(Long taskId) {
|
return preventDangerCheckContentRepository.getCheckContentByTaskId(taskId);
|
}
|
}
|