package com.gkhy.safePlatform.doublePrevention.service.baseService.impl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.gkhy.safePlatform.commons.enums.E;
|
import com.gkhy.safePlatform.commons.exception.AusinessException;
|
import com.gkhy.safePlatform.doublePrevention.entity.PreventWorkAndMeasure;
|
import com.gkhy.safePlatform.doublePrevention.repository.PreventWorkAndMeasureRepository;
|
import com.gkhy.safePlatform.doublePrevention.service.baseService.PreventWorkAndMeasureService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
import java.util.List;
|
|
@Service("PreventWorkAndMeasureService")
|
public class PreventWorkAndMeasureServiceImpl extends ServiceImpl<PreventWorkAndMeasureRepository, PreventWorkAndMeasure> implements PreventWorkAndMeasureService {
|
|
@Autowired
|
private PreventWorkAndMeasureRepository preventWorkAndMeasureRepository;
|
|
/**
|
* 插入作业与措施的关联
|
* */
|
@Override
|
public int insertWorkAndMeasure(PreventWorkAndMeasure workAndMeasure) {
|
return preventWorkAndMeasureRepository.insert(workAndMeasure);
|
}
|
|
/**
|
* 重置作业与措施的关联
|
* */
|
@Override
|
public void updateWorkAndMeasure(String workUuid) {
|
int i = preventWorkAndMeasureRepository.updateWorkAndMeasure(workUuid);
|
if (i< 1){
|
throw new AusinessException(E.UPDATE_FAIL, "重置关联关系失败");
|
}
|
}
|
|
/**
|
* 查询作业与措施关联表
|
* */
|
@Override
|
public PreventWorkAndMeasure getWorkAndMeasure(String workUuid, String measureUuid) {
|
return preventWorkAndMeasureRepository.getWorkAndMeasure(workUuid, measureUuid);
|
}
|
/**
|
* 查询作业与措施关联表
|
* */
|
@Override
|
public List<PreventWorkAndMeasure> getWorkAndMeasureByWorkUuid(String workUuid) {
|
return preventWorkAndMeasureRepository.getWorkAndMeasureByWorkUuid(workUuid);
|
}
|
}
|