parent
d84d78a4aa
commit
c340987577
@ -0,0 +1,21 @@
|
||||
package com.ssf.mysqloracletest.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ssf.mysqloracletest.domain.DevopsVideoStatus;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* 视频监控状态表(DevopsVideoStatus)Mapper
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-11-29 09:33:21
|
||||
*/
|
||||
@Mapper
|
||||
public interface DevopsVideoStatusMapper extends BaseMapper<DevopsVideoStatus> {
|
||||
|
||||
|
||||
@Select("select count(1) from devops_video_status where device_name like '%执法记录仪%' and is_online = '1' ")
|
||||
public int getGbsListOnline();
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package com.ssf.mysqloracletest.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ssf.mysqloracletest.domain.DevopsVideoStatus;
|
||||
import com.ssf.mysqloracletest.exception.ServiceException;
|
||||
import com.ssf.mysqloracletest.mapper.DevopsVideoStatusMapper;
|
||||
import com.ssf.mysqloracletest.service.DevopsVideoStatusService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 视频监控状态表(DevopsVideoStatus)ServiceImpl
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-11-29 09:33:21
|
||||
*/
|
||||
@Service
|
||||
@DS("mysql")
|
||||
@RequiredArgsConstructor
|
||||
public class DevopsVideoStatusServiceImpl extends ServiceImpl<DevopsVideoStatusMapper, DevopsVideoStatus> implements DevopsVideoStatusService {
|
||||
|
||||
private final DevopsVideoStatusMapper videoStatusMapper;
|
||||
|
||||
@Override
|
||||
public boolean insertOrUpdate(DevopsVideoStatus devopsVideoStatus) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object importData(List<DevopsVideoStatus> list) {
|
||||
int successNum = 0;
|
||||
int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
|
||||
for (DevopsVideoStatus devopsVideoStatus : list) {
|
||||
try {
|
||||
insertOrUpdate(devopsVideoStatus);
|
||||
successNum++;
|
||||
successMsg.append(StrUtil.format("<br/>{}、待替换 {} 导入成功", successNum, "待替换"));
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
failureMsg.append(StrUtil.format("<br/>{}、待替换 {} 导入失败:{}", failureNum, "待替换", e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
if (failureNum > 0) {
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
} else {
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||
return successMsg.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getGbsListOnline(){
|
||||
return videoStatusMapper.getGbsListOnline();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue