package com.gk.hotwork.doublePrevention.service.baseService.impl;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.gk.hotwork.Domain.Enum.ResultCodes;
|
import com.gk.hotwork.Domain.Exception.BusinessException;
|
import com.gk.hotwork.doublePrevention.entity.PreventProduceDevice;
|
import com.gk.hotwork.doublePrevention.repository.PreventProduceDeviceRepository;
|
import com.gk.hotwork.doublePrevention.repository.param.PreventProduceDeviceDeleteParams;
|
import com.gk.hotwork.doublePrevention.repository.param.PreventProduceDeviceQueryParams;
|
import com.gk.hotwork.doublePrevention.repository.param.PreventProduceDeviceUpdateParams;
|
import com.gk.hotwork.doublePrevention.service.baseService.PreventProduceDeviceService;
|
import org.apache.ibatis.annotations.Param;
|
import org.springframework.stereotype.Service;
|
|
import javax.annotation.Resource;
|
import java.util.List;
|
import java.util.Map;
|
|
/**
|
* (PreventProduceDevice)表服务实现类
|
*
|
* @author makejava
|
* @since 2022-06-25 10:40:17
|
*/
|
@Service("preventProduceDeviceService")
|
public class PreventProduceDeviceServiceImpl extends ServiceImpl<PreventProduceDeviceRepository, PreventProduceDevice> implements PreventProduceDeviceService {
|
|
@Resource
|
private PreventProduceDeviceRepository preventProduceDeviceRepository;
|
|
/**
|
* 生产装置-分页查询
|
* */
|
@Override
|
public IPage<PreventProduceDevice> getDevicePage(Page<Object> page, @Param("queryParams") PreventProduceDeviceQueryParams queryParams) {
|
return preventProduceDeviceRepository.getDevicePage(page, queryParams);
|
}
|
|
/**
|
* 生产装置-根绝设备名称和所在位置查询
|
* */
|
@Override
|
public PreventProduceDevice selectByNameAndLocation(String produceDeviceName, String location) {
|
|
return selectByNameAndLocation(produceDeviceName, location);
|
}
|
|
/**
|
* 生产装置-新增
|
* */
|
@Override
|
public int saveDevice(PreventProduceDevice device) {
|
int result = preventProduceDeviceRepository.insert(device);
|
if (result == 0){
|
throw new BusinessException(ResultCodes.SERVER_ADD_ERROR);
|
}
|
return result;
|
}
|
|
/**
|
* 生产装置-删除
|
*/
|
@Override
|
public int deleteById(PreventProduceDeviceDeleteParams param) {
|
int result = preventProduceDeviceRepository.deleteOne(param);
|
if (result == 0){
|
throw new BusinessException(ResultCodes.SERVER_DEL_ERROR);
|
}
|
return result;
|
}
|
/**
|
* 生产装置-修改信息
|
*/
|
@Override
|
public int updateProduceDevice(PreventProduceDeviceUpdateParams updateParams) {
|
int result = preventProduceDeviceRepository.updateProduceDevice(updateParams);
|
if (result == 0){
|
throw new BusinessException(ResultCodes.SERVER_UPDATE_ERROR);
|
}
|
return result;
|
}
|
/**
|
* 生产装置-查询-通过设备名称
|
*/
|
@Override
|
public PreventProduceDevice getDeviceByName(String produceDeviceName) {
|
PreventProduceDevice device = preventProduceDeviceRepository.getByDeviceName(produceDeviceName);
|
return device;
|
}
|
|
|
/**
|
* 生产装置-查询-通过设备id
|
*/
|
@Override
|
public PreventProduceDevice getDeviceById(Long id) {
|
PreventProduceDevice device = preventProduceDeviceRepository.selectByDeviceId(id);
|
return device;
|
}
|
|
|
/**
|
* 生产装置-根绝风险等级查询
|
* */
|
@Override
|
public PreventProduceDevice getByLevel(Byte riskLevel) {
|
PreventProduceDevice byRiskLevel = preventProduceDeviceRepository.getByRiskLevel(riskLevel);
|
return byRiskLevel;
|
}
|
/**
|
* 生产装置- 查询生产装置列表
|
*/
|
@Override
|
public List<PreventProduceDevice> getListDevices() {
|
return preventProduceDeviceRepository.getListDevices();
|
}
|
/**
|
* 生产装置- 查询生产装置-通过名称与部门
|
*/
|
@Override
|
public PreventProduceDevice getDeviceByNameAndDep(String name, String dep) {
|
return preventProduceDeviceRepository.getDeviceByNameAndDep(name, dep);
|
}
|
|
@Override
|
public Map countDeviceEveryLevel() {
|
return preventProduceDeviceRepository.countDeviceEveryLevel();
|
}
|
}
|