111
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
package com.xinda.scada.controller;
|
||||
|
||||
import com.xinda.common.annotation.Anonymous;
|
||||
import com.xinda.common.annotation.Log;
|
||||
import com.xinda.common.core.controller.BaseController;
|
||||
import com.xinda.common.core.domain.AjaxResult;
|
||||
import com.xinda.common.core.page.TableDataInfo;
|
||||
import com.xinda.common.enums.BusinessType;
|
||||
import com.xinda.common.utils.poi.ExcelUtil;
|
||||
import com.xinda.scada.domain.ScadaComponent;
|
||||
import com.xinda.scada.service.IScadaComponentService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 组件管理Controller
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-10
|
||||
*/
|
||||
@Api(tags = "组态组件管理")
|
||||
@RestController
|
||||
@RequestMapping("/scada/component")
|
||||
public class ScadaComponentController extends BaseController
|
||||
{
|
||||
@Resource
|
||||
private IScadaComponentService scadaComponentService;
|
||||
|
||||
/**
|
||||
* 查询组件管理列表
|
||||
*/
|
||||
@ApiOperation("查询组件管理列表")
|
||||
@PreAuthorize("@ss.hasPermi('scada:component:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ScadaComponent scadaComponent)
|
||||
{
|
||||
startPage();
|
||||
List<ScadaComponent> list = scadaComponentService.selectScadaComponentList(scadaComponent);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出组件管理列表
|
||||
*/
|
||||
@ApiOperation("导出组件管理列表")
|
||||
@PreAuthorize("@ss.hasPermi('scada:component:export')")
|
||||
@Log(title = "组件管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ScadaComponent scadaComponent)
|
||||
{
|
||||
List<ScadaComponent> list = scadaComponentService.selectScadaComponentList(scadaComponent);
|
||||
ExcelUtil<ScadaComponent> util = new ExcelUtil<ScadaComponent>(ScadaComponent.class);
|
||||
util.exportExcel(response, list, "组件管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取组件管理详细信息
|
||||
*/
|
||||
@ApiOperation("获取组件管理详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('scada:component:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(scadaComponentService.selectScadaComponentById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增组件管理
|
||||
*/
|
||||
@ApiOperation("新增组件")
|
||||
@PreAuthorize("@ss.hasPermi('scada:component:add')")
|
||||
@Log(title = "组件管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ScadaComponent scadaComponent)
|
||||
{
|
||||
return toAjax(scadaComponentService.insertScadaComponent(scadaComponent));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改组件管理
|
||||
*/
|
||||
@ApiOperation("修改组件")
|
||||
@PreAuthorize("@ss.hasPermi('scada:component:edit')")
|
||||
@Log(title = "组件管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ScadaComponent scadaComponent)
|
||||
{
|
||||
return toAjax(scadaComponentService.updateScadaComponent(scadaComponent));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除组件管理
|
||||
*/
|
||||
@ApiOperation("删除组件")
|
||||
@PreAuthorize("@ss.hasPermi('scada:component:remove')")
|
||||
@Log(title = "组件管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(scadaComponentService.deleteScadaComponentByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,490 @@
|
||||
package com.xinda.scada.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.xinda.common.annotation.Anonymous;
|
||||
import com.xinda.common.annotation.Log;
|
||||
import com.xinda.common.config.RuoYiConfig;
|
||||
import com.xinda.common.constant.HttpStatus;
|
||||
import com.xinda.common.core.controller.BaseController;
|
||||
import com.xinda.common.core.domain.AjaxResult;
|
||||
import com.xinda.common.core.page.TableDataInfo;
|
||||
import com.xinda.common.enums.BusinessType;
|
||||
import com.xinda.common.exception.ServiceException;
|
||||
import com.xinda.common.exception.file.InvalidExtensionException;
|
||||
import com.xinda.common.utils.StringUtils;
|
||||
import com.xinda.common.utils.file.MimeTypeUtils;
|
||||
import com.xinda.common.utils.poi.ExcelUtil;
|
||||
import com.xinda.iot.domain.Device;
|
||||
import com.xinda.iot.model.DeviceShortOutput;
|
||||
import com.xinda.iot.model.ThingsModelItem.Datatype;
|
||||
import com.xinda.iot.model.ThingsModelItem.ThingsModel;
|
||||
import com.xinda.iot.model.ThingsModels.ThingsModelValueItem;
|
||||
import com.xinda.iot.service.IDeviceService;
|
||||
import com.xinda.scada.domain.Scada;
|
||||
import com.xinda.scada.domain.ScadaDeviceBind;
|
||||
import com.xinda.scada.domain.ScadaGallery;
|
||||
import com.xinda.scada.service.IScadaDeviceBindService;
|
||||
import com.xinda.scada.service.IScadaService;
|
||||
import com.xinda.scada.utils.ScadaCollectionUtils;
|
||||
import com.xinda.scada.utils.ScadaFileUploadUtils;
|
||||
import com.xinda.scada.utils.ScadaFileUtils;
|
||||
import com.xinda.scada.vo.DeviceRealDataVO;
|
||||
import com.xinda.scada.vo.FavoritesVO;
|
||||
import com.xinda.scada.vo.ScadaDeviceBindDTO;
|
||||
import com.xinda.scada.vo.ThingsModelHistoryParam;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 组态中心Controller
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-10
|
||||
*/
|
||||
@Anonymous
|
||||
@Api(tags = "组态中心")
|
||||
@RestController
|
||||
@RequestMapping("/scada/center")
|
||||
public class ScadaController extends BaseController
|
||||
{
|
||||
@Resource
|
||||
private IScadaService scadaService;
|
||||
|
||||
@Resource
|
||||
private IScadaDeviceBindService scadaDeviceBindService;
|
||||
|
||||
@Resource
|
||||
private IDeviceService deviceService;
|
||||
|
||||
/**
|
||||
* 查询组态中心列表
|
||||
*/
|
||||
@ApiOperation("查询组态中心列表")
|
||||
@PreAuthorize("@ss.hasPermi('scada:center:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Scada scada)
|
||||
{
|
||||
startPage();
|
||||
List<Scada> list = scadaService.selectScadaList(scada);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出组态中心列表
|
||||
*/
|
||||
@ApiOperation("导出组态中心列表")
|
||||
@PreAuthorize("@ss.hasPermi('scada:center:export')")
|
||||
@Log(title = "组态中心", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Scada scada)
|
||||
{
|
||||
List<Scada> list = scadaService.selectScadaList(scada);
|
||||
ExcelUtil<Scada> util = new ExcelUtil<Scada>(Scada.class);
|
||||
util.exportExcel(response, list, "组态中心数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取组态中心详细信息
|
||||
*/
|
||||
@ApiOperation("查询组态详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('scada:center:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(scadaService.selectScadaById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增组态中心
|
||||
*/
|
||||
@ApiOperation("新增组态中心")
|
||||
@PreAuthorize("@ss.hasPermi('scada:center:add')")
|
||||
@Log(title = "组态中心", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Scada scada)
|
||||
{
|
||||
return scadaService.insertScada(scada);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改组态中心
|
||||
*/
|
||||
@ApiOperation("修改组态中心")
|
||||
@PreAuthorize("@ss.hasPermi('scada:center:edit')")
|
||||
@Log(title = "组态中心", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Scada scada)
|
||||
{
|
||||
return toAjax(scadaService.updateScada(scada));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除组态中心
|
||||
*/
|
||||
@ApiOperation("批量删除组态中心")
|
||||
@PreAuthorize("@ss.hasPermi('scada:center:remove')")
|
||||
@Log(title = "组态中心", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(scadaService.deleteScadaByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据guid获取组态详情
|
||||
* @param guid 组态id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("根据guid获取组态详情")
|
||||
@PreAuthorize("@ss.hasPermi('scada:center:query')")
|
||||
@GetMapping(value = "/getByGuid")
|
||||
public AjaxResult getByGuid(String guid) {
|
||||
Scada scada = scadaService.selectScadaByGuid(guid);
|
||||
return AjaxResult.success(scada);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存组态信息
|
||||
*/
|
||||
@ApiOperation("保存组态信息")
|
||||
@Log(title = "组态中心", businessType = BusinessType.INSERT)
|
||||
@PreAuthorize("@ss.hasPermi('scada:center:edit')")
|
||||
@PostMapping("/save")
|
||||
public AjaxResult save(@RequestBody Scada scada)
|
||||
{
|
||||
if (StringUtils.isEmpty(scada.getGuid())) {
|
||||
return AjaxResult.error("guid不能为空");
|
||||
}
|
||||
Scada scadaQuery = new Scada();
|
||||
scadaQuery.setGuid(scada.getGuid());
|
||||
List<Scada> scadaList = scadaService.selectScadaList(scadaQuery);
|
||||
if (StringUtils.isNotEmpty(scada.getBase64())) {
|
||||
MultipartFile multipartFile = ScadaFileUtils.base64toMultipartFile(scada.getBase64());
|
||||
String url;
|
||||
try {
|
||||
url = ScadaFileUploadUtils.upload(RuoYiConfig.getUploadPath(), multipartFile, MimeTypeUtils.IMAGE_EXTENSION);
|
||||
} catch (IOException | InvalidExtensionException e) {
|
||||
throw new ServiceException("修改组态base64转图片异常" + e.getMessage());
|
||||
}
|
||||
scada.setPageImage(url);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(scadaList)) {
|
||||
Scada updateScada = scadaList.get(0);
|
||||
updateScada.setScadaData(scada.getScadaData());
|
||||
updateScada.setPageImage(scada.getPageImage());
|
||||
scadaService.updateScada(updateScada);
|
||||
} else {
|
||||
scadaService.insertScada(scada);
|
||||
// scadaDeviceBindService.insertScadaDeviceBind()
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取组态绑定的设备数,一个组态可以绑定多个设备,用于多个设备的参数绑定
|
||||
* @param scadaDeviceBind 组态guid
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("获取组态绑定的设备列表")
|
||||
@PreAuthorize("@ss.hasPermi('scada:center:query')")
|
||||
@GetMapping(value = "/listDeviceBind")
|
||||
public TableDataInfo listDeviceBind(ScadaDeviceBind scadaDeviceBind) {
|
||||
startPage();
|
||||
List<ScadaDeviceBind> list = scadaDeviceBindService.selectScadaDeviceBindList(scadaDeviceBind);
|
||||
// List<DeviceAllShortOutput> deviceAllShortOutputs = deviceService.selectAllDeviceShortList();
|
||||
// Map<String, String> collect = deviceAllShortOutputs.stream().collect(Collectors.toMap(DeviceAllShortOutput::getSerialNumber, DeviceAllShortOutput::getDeviceName));
|
||||
for (ScadaDeviceBind deviceZtBind : list) {
|
||||
Device device = deviceService.selectShortDeviceBySerialNumber(deviceZtBind.getSerialNumber());
|
||||
if (device != null) {
|
||||
deviceZtBind.setDeviceName(device.getDeviceName());
|
||||
deviceZtBind.setStatus(device.getStatus());
|
||||
}
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存组态关联设备
|
||||
* @param scadaDeviceBindDTO 组态关联设备
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("保存组态关联设备")
|
||||
@PreAuthorize("@ss.hasPermi('scada:center:edit')")
|
||||
@PostMapping("/saveDeviceBind")
|
||||
public AjaxResult saveDeviceBind(@RequestBody ScadaDeviceBindDTO scadaDeviceBindDTO)
|
||||
{
|
||||
if (StringUtils.isEmpty(scadaDeviceBindDTO.getScadaGuid()) || StringUtils.isEmpty(scadaDeviceBindDTO.getSerialNumbers())) {
|
||||
return error("请选择设备");
|
||||
}
|
||||
List<String> addSerialNumberList = StringUtils.str2List(scadaDeviceBindDTO.getSerialNumbers(), ",", true, true);
|
||||
List<ScadaDeviceBind> scadaDeviceBindList = scadaDeviceBindService.listByGuidAndSerialNumber(scadaDeviceBindDTO.getScadaGuid(), addSerialNumberList);
|
||||
List<String> oldSerialNumberList = scadaDeviceBindList.stream().map(ScadaDeviceBind::getSerialNumber).collect(Collectors.toList());
|
||||
for (String serialNumber : addSerialNumberList) {
|
||||
if (oldSerialNumberList.contains(serialNumber)) {
|
||||
continue;
|
||||
}
|
||||
ScadaDeviceBind scadaDeviceBind = new ScadaDeviceBind();
|
||||
scadaDeviceBind.setScadaGuid(scadaDeviceBindDTO.getScadaGuid());
|
||||
scadaDeviceBind.setSerialNumber(serialNumber);
|
||||
scadaDeviceBindService.insertScadaDeviceBind(scadaDeviceBind);
|
||||
}
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除组态设备关联
|
||||
*/
|
||||
@ApiOperation("删除组态设备关联")
|
||||
@PreAuthorize("@ss.hasPermi('scada:center:edit')")
|
||||
@DeleteMapping("/removeDeviceBind/{ids}")
|
||||
public AjaxResult removeDeviceBind(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(scadaDeviceBindService.deleteScadaDeviceBindByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取绑定设备物模型数据,用于绑定变量
|
||||
* @param scadaGuid 组态guid
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("获取绑定设备物模型列表")
|
||||
@PreAuthorize("@ss.hasPermi('scada:center:query')")
|
||||
@GetMapping("/listDeviceThingsModel")
|
||||
public TableDataInfo getBindDatalist(Integer pageNum, Integer pageSize, String scadaGuid, String serialNumber)
|
||||
{
|
||||
List<DeviceRealDataVO> list= new ArrayList<>();
|
||||
if(StringUtils.isEmpty(scadaGuid)){
|
||||
return getDataTable(list);
|
||||
}
|
||||
ScadaDeviceBind scadaDeviceBind = new ScadaDeviceBind();
|
||||
scadaDeviceBind.setScadaGuid(scadaGuid);
|
||||
scadaDeviceBind.setSerialNumber(serialNumber);
|
||||
// 查询到组态绑定的设备
|
||||
List<ScadaDeviceBind> deviceBindList = scadaDeviceBindService.selectScadaDeviceBindList(scadaDeviceBind);
|
||||
List<String> serialNumberList = deviceBindList.stream().map(ScadaDeviceBind::getSerialNumber).collect(Collectors.toList());
|
||||
// 查询设备信息
|
||||
for (String bindSerialNumber : serialNumberList) {
|
||||
Device device = deviceService.selectDeviceNoModel(bindSerialNumber);
|
||||
if (device == null) {
|
||||
continue;
|
||||
}
|
||||
DeviceShortOutput deviceShortOutput = deviceService.selectDeviceRunningStatusByDeviceId(device.getDeviceId());
|
||||
if (CollectionUtils.isEmpty(deviceShortOutput.getThingsModels())) {
|
||||
continue;
|
||||
}
|
||||
List<ThingsModelValueItem> thingsModelList = deviceShortOutput.getThingsModels();
|
||||
for (ThingsModelValueItem thingsModel : thingsModelList) {
|
||||
Datatype datatype = thingsModel.getDatatype();
|
||||
if ("array".equals(datatype.getType()) && "object".equals(datatype.getArrayType())) {
|
||||
List<ThingsModel>[] arrayParams = datatype.getArrayParams();
|
||||
for (int a = 0; a < arrayParams.length; a++) {
|
||||
for (int i = 0; i < arrayParams[a].size(); i++) {
|
||||
ThingsModel thingsModel1 = arrayParams[a].get(i);
|
||||
DeviceRealDataVO deviceRealDataVO = new DeviceRealDataVO();
|
||||
deviceRealDataVO.setProductId(device.getProductId());
|
||||
deviceRealDataVO.setSerialNumber(bindSerialNumber);
|
||||
deviceRealDataVO.setDeviceName(device.getDeviceName());
|
||||
deviceRealDataVO.setStatus(device.getStatus());
|
||||
if (i < 10) {
|
||||
deviceRealDataVO.setIdentifier("array_0" + a + "_" + thingsModel1.getId());
|
||||
} else {
|
||||
deviceRealDataVO.setIdentifier("array_" + a + "_" + thingsModel1.getId());
|
||||
}
|
||||
deviceRealDataVO.setModelName(thingsModel.getName() + (a + 1) + "_" + thingsModel1.getName());
|
||||
deviceRealDataVO.setUnit(thingsModel1.getDatatype().getUnit());
|
||||
deviceRealDataVO.setType(thingsModel1.getType());
|
||||
list.add(deviceRealDataVO);
|
||||
}
|
||||
}
|
||||
} else if ("array".equals(datatype.getType())) {
|
||||
for (int i = 0; i < datatype.getArrayCount(); i++) {
|
||||
DeviceRealDataVO deviceRealDataVO = new DeviceRealDataVO();
|
||||
deviceRealDataVO.setProductId(device.getProductId());
|
||||
deviceRealDataVO.setSerialNumber(bindSerialNumber);
|
||||
deviceRealDataVO.setDeviceName(device.getDeviceName());
|
||||
deviceRealDataVO.setStatus(device.getStatus());
|
||||
if (i < 10) {
|
||||
deviceRealDataVO.setIdentifier("array_0" + i + "_" + thingsModel.getId());
|
||||
} else {
|
||||
deviceRealDataVO.setIdentifier("array_" + i + "_" + thingsModel.getId());
|
||||
}
|
||||
deviceRealDataVO.setModelName(thingsModel.getName() + (i+1));
|
||||
deviceRealDataVO.setUnit(datatype.getUnit());
|
||||
deviceRealDataVO.setType(thingsModel.getType());
|
||||
list.add(deviceRealDataVO);
|
||||
}
|
||||
} else if ("object".equals(datatype.getType())) {
|
||||
for (ThingsModelValueItem objectThingsModel : datatype.getParams()) {
|
||||
DeviceRealDataVO deviceRealDataVO = new DeviceRealDataVO();
|
||||
deviceRealDataVO.setProductId(device.getProductId());
|
||||
deviceRealDataVO.setSerialNumber(bindSerialNumber);
|
||||
deviceRealDataVO.setDeviceName(device.getDeviceName());
|
||||
deviceRealDataVO.setStatus(device.getStatus());
|
||||
deviceRealDataVO.setIdentifier(objectThingsModel.getId());
|
||||
deviceRealDataVO.setModelName(thingsModel.getName() + "_" + objectThingsModel.getName());
|
||||
deviceRealDataVO.setUnit(objectThingsModel.getDatatype().getUnit());
|
||||
deviceRealDataVO.setType(thingsModel.getType());
|
||||
list.add(deviceRealDataVO);
|
||||
}
|
||||
} else {
|
||||
DeviceRealDataVO deviceRealDataVO = new DeviceRealDataVO();
|
||||
deviceRealDataVO.setProductId(device.getProductId());
|
||||
deviceRealDataVO.setSerialNumber(bindSerialNumber);
|
||||
deviceRealDataVO.setDeviceName(device.getDeviceName());
|
||||
deviceRealDataVO.setStatus(device.getStatus());
|
||||
deviceRealDataVO.setIdentifier(thingsModel.getId());
|
||||
deviceRealDataVO.setModelName(thingsModel.getName());
|
||||
deviceRealDataVO.setUnit(thingsModel.getDatatype().getUnit());
|
||||
deviceRealDataVO.setType(thingsModel.getType());
|
||||
list.add(deviceRealDataVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
List resultList = ScadaCollectionUtils.startPage(list, pageNum, pageSize);
|
||||
TableDataInfo rspData = new TableDataInfo();
|
||||
rspData.setCode(HttpStatus.SUCCESS);
|
||||
rspData.setMsg("查询成功");
|
||||
rspData.setRows(resultList);
|
||||
rspData.setTotal(new PageInfo(list).getTotal());
|
||||
return rspData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入json文件
|
||||
* @param file 文件
|
||||
* @param guid guid
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@ApiOperation("组态页面导入json文件")
|
||||
// @PreAuthorize("@ss.hasPermi('scada:center:add')")
|
||||
@PostMapping("/importJson")
|
||||
public AjaxResult importJson(MultipartFile file, String guid) throws IOException {
|
||||
InputStream inputStream = file.getInputStream();
|
||||
if(file.isEmpty()){
|
||||
return AjaxResult.error("无效的配置文件");
|
||||
}
|
||||
if(file.getOriginalFilename().indexOf("json")==-1){
|
||||
return AjaxResult.error("无效的配置文件");
|
||||
}
|
||||
Scada scada = new Scada();
|
||||
try {
|
||||
scada = JSON.parseObject(inputStream, Scada.class);
|
||||
}catch (Exception e){
|
||||
return AjaxResult.error("无效的配置文件");
|
||||
}finally {
|
||||
inputStream.close();
|
||||
}
|
||||
Scada oldScada = new Scada();
|
||||
if (StringUtils.isNotEmpty(guid)) {
|
||||
Scada queryScada = new Scada();
|
||||
queryScada.setGuid(guid);
|
||||
List<Scada> scadaList = scadaService.selectScadaList(queryScada);
|
||||
if (CollectionUtils.isNotEmpty(scadaList)) {
|
||||
oldScada = scadaList.get(0);
|
||||
}
|
||||
}
|
||||
if (oldScada == null) {
|
||||
guid= UUID.randomUUID().toString();
|
||||
scada.setGuid(guid);
|
||||
scadaService.insertScada(scada);
|
||||
} else {
|
||||
scada.setId(oldScada.getId());
|
||||
scadaService.updateScada(scada);
|
||||
}
|
||||
return AjaxResult.success("导入成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 收藏图库
|
||||
* @param favoritesVO 图库收藏传参类
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("个人收藏图库")
|
||||
@PostMapping("/saveGalleryFavorites")
|
||||
public AjaxResult saveGalleryFavorites(@RequestBody FavoritesVO favoritesVO) {
|
||||
return scadaService.saveGalleryFavorites(favoritesVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询收藏图库列表
|
||||
* @param scadaGallery 图库类
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("查询个人收藏图库列表")
|
||||
@GetMapping("/listGalleryFavorites")
|
||||
public TableDataInfo listGalleryFavorites(ScadaGallery scadaGallery)
|
||||
{
|
||||
startPage();
|
||||
List<ScadaGallery> list = scadaService.listGalleryFavorites(scadaGallery);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除收藏图库
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("删除个人收藏图库")
|
||||
@DeleteMapping("/deleteGalleryFavorites/{ids}")
|
||||
public AjaxResult deleteGalleryFavorites(@PathVariable Long[] ids) {
|
||||
return scadaService.deleteGalleryFavorites(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 收藏上传图库
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("个人收藏上传图库")
|
||||
@PostMapping("/uploadGalleryFavorites")
|
||||
public AjaxResult uploadGalleryFavorites(MultipartFile file, String categoryName) {
|
||||
return scadaService.uploadGalleryFavorites(file, categoryName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询变量历史数据
|
||||
* @param param 查询条件
|
||||
* @return com.xinda.common.core.domain.AjaxResult
|
||||
*/
|
||||
@ApiOperation("查询变量历史数据")
|
||||
@PostMapping("/listThingsModelHistory")
|
||||
public AjaxResult listThingsModelHistory(@RequestBody ThingsModelHistoryParam param) {
|
||||
return success(scadaService.listThingsModelHistory(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备运行状态
|
||||
* @param serialNumber 设备编号
|
||||
* @return com.xinda.common.core.domain.AjaxResult
|
||||
*/
|
||||
@ApiOperation("获取设备运行状态")
|
||||
@GetMapping("/getDeviceStatus")
|
||||
public AjaxResult getDeviceStatus(String serialNumber) {
|
||||
return AjaxResult.success(scadaService.getStatusBySerialNumber(serialNumber));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取系统相关统计信息
|
||||
* @return com.xinda.common.core.domain.AjaxResult
|
||||
*/
|
||||
@GetMapping(value = "/statistic")
|
||||
@ApiOperation("获取系统相关统计信息")
|
||||
public AjaxResult getDeviceStatistic()
|
||||
{
|
||||
return AjaxResult.success(scadaService.selectStatistic());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.xinda.scada.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.xinda.common.annotation.Log;
|
||||
import com.xinda.common.core.controller.BaseController;
|
||||
import com.xinda.common.core.domain.AjaxResult;
|
||||
import com.xinda.common.enums.BusinessType;
|
||||
import com.xinda.scada.domain.ScadaEchart;
|
||||
import com.xinda.scada.service.IScadaEchartService;
|
||||
import com.xinda.common.utils.poi.ExcelUtil;
|
||||
import com.xinda.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 图表管理Controller
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-10
|
||||
*/
|
||||
@Api(tags = "图表管理")
|
||||
@RestController
|
||||
@RequestMapping("/scada/echart")
|
||||
public class ScadaEchartController extends BaseController
|
||||
{
|
||||
@Resource
|
||||
private IScadaEchartService scadaEchartService;
|
||||
|
||||
/**
|
||||
* 查询图表管理列表
|
||||
*/
|
||||
@ApiOperation("查询图表管理列表")
|
||||
@PreAuthorize("@ss.hasPermi('scada:echart:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ScadaEchart scadaEchart)
|
||||
{
|
||||
startPage();
|
||||
List<ScadaEchart> list = scadaEchartService.selectScadaEchartList(scadaEchart);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出图表管理列表
|
||||
*/
|
||||
@ApiOperation("导出图表管理列表")
|
||||
@PreAuthorize("@ss.hasPermi('scada:echart:export')")
|
||||
@Log(title = "图表管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ScadaEchart scadaEchart)
|
||||
{
|
||||
List<ScadaEchart> list = scadaEchartService.selectScadaEchartList(scadaEchart);
|
||||
ExcelUtil<ScadaEchart> util = new ExcelUtil<ScadaEchart>(ScadaEchart.class);
|
||||
util.exportExcel(response, list, "图表管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取图表管理详细信息
|
||||
*/
|
||||
@ApiOperation("获取图表管理详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('scada:echart:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(scadaEchartService.selectScadaEchartById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增图表管理
|
||||
*/
|
||||
@ApiOperation("新增图表")
|
||||
@PreAuthorize("@ss.hasPermi('scada:echart:add')")
|
||||
@Log(title = "图表管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ScadaEchart scadaEchart)
|
||||
{
|
||||
return toAjax(scadaEchartService.insertScadaEchart(scadaEchart));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改图表管理
|
||||
*/
|
||||
@ApiOperation("修改图表")
|
||||
@PreAuthorize("@ss.hasPermi('scada:echart:edit')")
|
||||
@Log(title = "图表管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ScadaEchart scadaEchart)
|
||||
{
|
||||
return toAjax(scadaEchartService.updateScadaEchart(scadaEchart));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除图表管理
|
||||
*/
|
||||
@ApiOperation("删除图表")
|
||||
@PreAuthorize("@ss.hasPermi('scada:echart:remove')")
|
||||
@Log(title = "图表管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(scadaEchartService.deleteScadaEchartByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
package com.xinda.scada.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.xinda.common.annotation.Anonymous;
|
||||
import com.xinda.common.utils.StringUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.xinda.common.annotation.Log;
|
||||
import com.xinda.common.core.controller.BaseController;
|
||||
import com.xinda.common.core.domain.AjaxResult;
|
||||
import com.xinda.common.enums.BusinessType;
|
||||
import com.xinda.scada.domain.ScadaGallery;
|
||||
import com.xinda.scada.service.IScadaGalleryService;
|
||||
import com.xinda.common.utils.poi.ExcelUtil;
|
||||
import com.xinda.common.core.page.TableDataInfo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 图库管理Controller
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-10
|
||||
*/
|
||||
@Api(tags = "图库管理")
|
||||
@RestController
|
||||
@RequestMapping("/scada/gallery")
|
||||
public class ScadaGalleryController extends BaseController
|
||||
{
|
||||
@Resource
|
||||
private IScadaGalleryService scadaGalleryService;
|
||||
|
||||
/**
|
||||
* 查询图库管理列表
|
||||
*/
|
||||
@ApiOperation("查询图库管理")
|
||||
@PreAuthorize("@ss.hasPermi('scada:gallery:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ScadaGallery scadaGallery)
|
||||
{
|
||||
startPage();
|
||||
List<ScadaGallery> list = scadaGalleryService.selectScadaGalleryList(scadaGallery);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出图库管理列表
|
||||
*/
|
||||
@ApiOperation("导出图库管理列表")
|
||||
@PreAuthorize("@ss.hasPermi('scada:gallery:export')")
|
||||
@Log(title = "图库管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ScadaGallery scadaGallery)
|
||||
{
|
||||
List<ScadaGallery> list = scadaGalleryService.selectScadaGalleryList(scadaGallery);
|
||||
ExcelUtil<ScadaGallery> util = new ExcelUtil<ScadaGallery>(ScadaGallery.class);
|
||||
util.exportExcel(response, list, "图库管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取图库管理详细信息
|
||||
*/
|
||||
@ApiOperation("获取图库详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('scada:gallery:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(scadaGalleryService.selectScadaGalleryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增图库管理
|
||||
*/
|
||||
@ApiOperation("新增图库")
|
||||
@PreAuthorize("@ss.hasPermi('scada:gallery:add')")
|
||||
@Log(title = "图库管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ScadaGallery scadaGallery)
|
||||
{
|
||||
return toAjax(scadaGalleryService.insertScadaGallery(scadaGallery));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改图库管理
|
||||
*/
|
||||
@ApiOperation("修改图库")
|
||||
@PreAuthorize("@ss.hasPermi('scada:gallery:edit')")
|
||||
@Log(title = "图库管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ScadaGallery scadaGallery)
|
||||
{
|
||||
return toAjax(scadaGalleryService.updateScadaGallery(scadaGallery));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除图库管理
|
||||
*/
|
||||
@ApiOperation("删除图库")
|
||||
@PreAuthorize("@ss.hasPermi('scada:gallery:remove')")
|
||||
@Log(title = "图库管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(scadaGalleryService.deleteScadaGalleryByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
* @param file 文件
|
||||
* @param categoryName 分类名称
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("上传文件")
|
||||
@PreAuthorize("@ss.hasPermi('scada:gallery:add')")
|
||||
@PostMapping("/uploadFile")
|
||||
public AjaxResult uploadFile(MultipartFile file, String categoryName) {
|
||||
if (file == null) {
|
||||
return error("上传文件为空");
|
||||
}
|
||||
if (StringUtils.isEmpty(categoryName)) {
|
||||
return error("上传文件分类为空");
|
||||
}
|
||||
return scadaGalleryService.uploadFile(file, categoryName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.xinda.scada.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.xinda.common.annotation.Log;
|
||||
import com.xinda.common.core.controller.BaseController;
|
||||
import com.xinda.common.core.domain.AjaxResult;
|
||||
import com.xinda.common.enums.BusinessType;
|
||||
import com.xinda.scada.domain.ScadaModel;
|
||||
import com.xinda.scada.service.IScadaModelService;
|
||||
import com.xinda.common.utils.poi.ExcelUtil;
|
||||
import com.xinda.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 模型管理Controller
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/scada/model")
|
||||
public class ScadaModelController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IScadaModelService scadaModelService;
|
||||
|
||||
/**
|
||||
* 查询模型管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('scada:model:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ScadaModel scadaModel)
|
||||
{
|
||||
startPage();
|
||||
List<ScadaModel> list = scadaModelService.selectScadaModelList(scadaModel);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出模型管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('scada:model:export')")
|
||||
@Log(title = "模型管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ScadaModel scadaModel)
|
||||
{
|
||||
List<ScadaModel> list = scadaModelService.selectScadaModelList(scadaModel);
|
||||
ExcelUtil<ScadaModel> util = new ExcelUtil<ScadaModel>(ScadaModel.class);
|
||||
util.exportExcel(response, list, "模型管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取模型管理详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('scada:model:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(scadaModelService.selectScadaModelById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增模型管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('scada:model:add')")
|
||||
@Log(title = "模型管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ScadaModel scadaModel)
|
||||
{
|
||||
return toAjax(scadaModelService.insertScadaModel(scadaModel));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改模型管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('scada:model:edit')")
|
||||
@Log(title = "模型管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ScadaModel scadaModel)
|
||||
{
|
||||
return toAjax(scadaModelService.updateScadaModel(scadaModel));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除模型管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('scada:model:remove')")
|
||||
@Log(title = "模型管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(scadaModelService.deleteScadaModelByIds(ids));
|
||||
}
|
||||
}
|
||||
88
xinda-scada/src/main/java/com/xinda/scada/domain/Scada.java
Normal file
88
xinda-scada/src/main/java/com/xinda/scada/domain/Scada.java
Normal file
@@ -0,0 +1,88 @@
|
||||
package com.xinda.scada.domain;
|
||||
|
||||
import com.xinda.common.annotation.Excel;
|
||||
import com.xinda.common.core.domain.BaseEntity;
|
||||
import com.xinda.scada.vo.ScadaBindDeviceSimVO;
|
||||
import com.xinda.scada.vo.ScadaDeviceBindVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 组态中心对象 scada
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-10
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class Scada extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id唯一标识 */
|
||||
private Long id;
|
||||
|
||||
/** 组态id */
|
||||
@Excel(name = "组态id")
|
||||
private String guid;
|
||||
|
||||
/** 组态信息 */
|
||||
@Excel(name = "组态信息")
|
||||
private String scadaData;
|
||||
|
||||
/** 设备编号 */
|
||||
@Excel(name = "设备编号")
|
||||
private String serialNumbers;
|
||||
|
||||
/** 设备名称 */
|
||||
@Excel(name = "设备名称")
|
||||
private String deviceName;
|
||||
|
||||
/** 是否主界面 */
|
||||
@Excel(name = "是否主界面")
|
||||
private Integer isMainPage;
|
||||
|
||||
/** 页面名称 */
|
||||
@Excel(name = "页面名称")
|
||||
private String pageName;
|
||||
|
||||
/** 页面大小 */
|
||||
@Excel(name = "页面大小")
|
||||
private String pageResolution;
|
||||
|
||||
/** 是否分享 */
|
||||
@Excel(name = "是否分享")
|
||||
private Integer isShare;
|
||||
|
||||
/** 分享链接 */
|
||||
@Excel(name = "分享链接")
|
||||
private String shareUrl;
|
||||
|
||||
/** 分享密码 */
|
||||
@Excel(name = "分享密码")
|
||||
private String sharePass;
|
||||
|
||||
/** 页面图片 */
|
||||
@Excel(name = "页面图片")
|
||||
private String pageImage;
|
||||
|
||||
/** 租户id */
|
||||
@Excel(name = "租户id")
|
||||
private Long tenantId;
|
||||
|
||||
/** 租户名称 */
|
||||
@Excel(name = "租户名称")
|
||||
private String tenantName;
|
||||
|
||||
/** 逻辑删除标识 */
|
||||
private Integer delFlag;
|
||||
|
||||
private String base64;
|
||||
|
||||
private List<ScadaBindDeviceSimVO> bindDeviceList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
package com.xinda.scada.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.xinda.common.annotation.Excel;
|
||||
import com.xinda.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 组件管理对象 scada_component
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-10
|
||||
*/
|
||||
public class ScadaComponent extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键id */
|
||||
private Long id;
|
||||
|
||||
/** 组件名称 */
|
||||
@Excel(name = "组件名称")
|
||||
private String componentName;
|
||||
|
||||
/** 组件模版 */
|
||||
@Excel(name = "组件模版")
|
||||
private String componentTemplate;
|
||||
|
||||
/** 组件风格 */
|
||||
@Excel(name = "组件风格")
|
||||
private String componentStyle;
|
||||
|
||||
/** 组件脚本 */
|
||||
@Excel(name = "组件脚本")
|
||||
private String componentScript;
|
||||
|
||||
/** 组件缩略图 */
|
||||
@Excel(name = "组件缩略图")
|
||||
private String componentImage;
|
||||
|
||||
/** 租户id */
|
||||
@Excel(name = "租户id")
|
||||
private Long tenantId;
|
||||
|
||||
/** 租户名称 */
|
||||
@Excel(name = "租户名称")
|
||||
private String tenantName;
|
||||
|
||||
/** 逻辑删除标识 */
|
||||
private Integer delFlag;
|
||||
|
||||
/** 转图片参数 */
|
||||
private String base64;
|
||||
|
||||
/** 拥有类型 0-私有;1-公有 */
|
||||
private Integer isShare;
|
||||
|
||||
/** 用户id */
|
||||
private Long userId;
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Integer getIsShare() {
|
||||
return isShare;
|
||||
}
|
||||
|
||||
public void setIsShare(Integer isShare) {
|
||||
this.isShare = isShare;
|
||||
}
|
||||
|
||||
public String getBase64() {
|
||||
return base64;
|
||||
}
|
||||
|
||||
public void setBase64(String base64) {
|
||||
this.base64 = base64;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setComponentName(String componentName)
|
||||
{
|
||||
this.componentName = componentName;
|
||||
}
|
||||
|
||||
public String getComponentName()
|
||||
{
|
||||
return componentName;
|
||||
}
|
||||
public void setComponentTemplate(String componentTemplate)
|
||||
{
|
||||
this.componentTemplate = componentTemplate;
|
||||
}
|
||||
|
||||
public String getComponentTemplate()
|
||||
{
|
||||
return componentTemplate;
|
||||
}
|
||||
public void setComponentStyle(String componentStyle)
|
||||
{
|
||||
this.componentStyle = componentStyle;
|
||||
}
|
||||
|
||||
public String getComponentStyle()
|
||||
{
|
||||
return componentStyle;
|
||||
}
|
||||
public void setComponentScript(String componentScript)
|
||||
{
|
||||
this.componentScript = componentScript;
|
||||
}
|
||||
|
||||
public String getComponentScript()
|
||||
{
|
||||
return componentScript;
|
||||
}
|
||||
public void setComponentImage(String componentImage)
|
||||
{
|
||||
this.componentImage = componentImage;
|
||||
}
|
||||
|
||||
public String getComponentImage()
|
||||
{
|
||||
return componentImage;
|
||||
}
|
||||
public void setTenantId(Long tenantId)
|
||||
{
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public Long getTenantId()
|
||||
{
|
||||
return tenantId;
|
||||
}
|
||||
public void setTenantName(String tenantName)
|
||||
{
|
||||
this.tenantName = tenantName;
|
||||
}
|
||||
|
||||
public String getTenantName()
|
||||
{
|
||||
return tenantName;
|
||||
}
|
||||
public void setDelFlag(Integer delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public Integer getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("componentName", getComponentName())
|
||||
.append("componentTemplate", getComponentTemplate())
|
||||
.append("componentStyle", getComponentStyle())
|
||||
.append("componentScript", getComponentScript())
|
||||
.append("componentImage", getComponentImage())
|
||||
.append("tenantId", getTenantId())
|
||||
.append("tenantName", getTenantName())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("delFlag", getDelFlag())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.xinda.scada.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.xinda.common.annotation.Excel;
|
||||
import com.xinda.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 组态设备关联对象 scada_device_bind
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-13
|
||||
*/
|
||||
@Data
|
||||
public class ScadaDeviceBind {
|
||||
|
||||
/** id唯一标识 */
|
||||
private Long id;
|
||||
|
||||
/** 设备编号 */
|
||||
@Excel(name = "设备编号")
|
||||
private String serialNumber;
|
||||
|
||||
/** 组态guid */
|
||||
@Excel(name = "组态guid")
|
||||
private String scadaGuid;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@Excel(name = "设备名称")
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 设备状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
package com.xinda.scada.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.xinda.common.annotation.Excel;
|
||||
import com.xinda.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 图表管理对象 scada_echart
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-10
|
||||
*/
|
||||
public class ScadaEchart extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id */
|
||||
private Long id;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private String guid;
|
||||
|
||||
/** 图表名称 */
|
||||
@Excel(name = "图表名称")
|
||||
private String echartName;
|
||||
|
||||
/** 图表类别 */
|
||||
@Excel(name = "图表类别")
|
||||
private String echartType;
|
||||
|
||||
/** 图表内容 */
|
||||
@Excel(name = "图表内容")
|
||||
private String echartData;
|
||||
|
||||
/** 图表图片 */
|
||||
@Excel(name = "图表图片")
|
||||
private String echartImgae;
|
||||
|
||||
/** 租户id */
|
||||
@Excel(name = "租户id")
|
||||
private Long tenantId;
|
||||
|
||||
/** 租户名称 */
|
||||
@Excel(name = "租户名称")
|
||||
private String tenantName;
|
||||
|
||||
/** 逻辑删除标识 */
|
||||
private Integer delFlag;
|
||||
|
||||
private String base64;
|
||||
|
||||
public String getBase64() {
|
||||
return base64;
|
||||
}
|
||||
|
||||
public void setBase64(String base64) {
|
||||
this.base64 = base64;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setGuid(String guid)
|
||||
{
|
||||
this.guid = guid;
|
||||
}
|
||||
|
||||
public String getGuid()
|
||||
{
|
||||
return guid;
|
||||
}
|
||||
public void setEchartName(String echartName)
|
||||
{
|
||||
this.echartName = echartName;
|
||||
}
|
||||
|
||||
public String getEchartName()
|
||||
{
|
||||
return echartName;
|
||||
}
|
||||
public void setEchartType(String echartType)
|
||||
{
|
||||
this.echartType = echartType;
|
||||
}
|
||||
|
||||
public String getEchartType()
|
||||
{
|
||||
return echartType;
|
||||
}
|
||||
public void setEchartData(String echartData)
|
||||
{
|
||||
this.echartData = echartData;
|
||||
}
|
||||
|
||||
public String getEchartData()
|
||||
{
|
||||
return echartData;
|
||||
}
|
||||
public void setEchartImgae(String echartImgae)
|
||||
{
|
||||
this.echartImgae = echartImgae;
|
||||
}
|
||||
|
||||
public String getEchartImgae()
|
||||
{
|
||||
return echartImgae;
|
||||
}
|
||||
public void setTenantId(Long tenantId)
|
||||
{
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public Long getTenantId()
|
||||
{
|
||||
return tenantId;
|
||||
}
|
||||
public void setTenantName(String tenantName)
|
||||
{
|
||||
this.tenantName = tenantName;
|
||||
}
|
||||
|
||||
public String getTenantName()
|
||||
{
|
||||
return tenantName;
|
||||
}
|
||||
public void setDelFlag(Integer delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public Integer getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("guid", getGuid())
|
||||
.append("echartName", getEchartName())
|
||||
.append("echartType", getEchartType())
|
||||
.append("echartData", getEchartData())
|
||||
.append("echartImgae", getEchartImgae())
|
||||
.append("tenantId", getTenantId())
|
||||
.append("tenantName", getTenantName())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("delFlag", getDelFlag())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package com.xinda.scada.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.xinda.common.annotation.Excel;
|
||||
import com.xinda.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 图库管理对象 scada_gallery
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-10
|
||||
*/
|
||||
public class ScadaGallery extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id唯一标识 */
|
||||
private Long id;
|
||||
|
||||
/** 文件名称 */
|
||||
@Excel(name = "文件名称")
|
||||
private String fileName;
|
||||
|
||||
/** 分类名称 */
|
||||
@Excel(name = "分类名称")
|
||||
private String categoryName;
|
||||
|
||||
/** 资源请求路径 */
|
||||
@Excel(name = "资源请求路径")
|
||||
private String resourceUrl;
|
||||
|
||||
/** 租户id */
|
||||
@Excel(name = "租户id")
|
||||
private Long tenantId;
|
||||
|
||||
/** 租户名称 */
|
||||
@Excel(name = "租户名称")
|
||||
private String tenantName;
|
||||
|
||||
/** 逻辑删除标识 */
|
||||
private Integer delFlag;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setFileName(String fileName)
|
||||
{
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public String getFileName()
|
||||
{
|
||||
return fileName;
|
||||
}
|
||||
public void setCategoryName(String categoryName)
|
||||
{
|
||||
this.categoryName = categoryName;
|
||||
}
|
||||
|
||||
public String getCategoryName()
|
||||
{
|
||||
return categoryName;
|
||||
}
|
||||
public void setResourceUrl(String resourceUrl)
|
||||
{
|
||||
this.resourceUrl = resourceUrl;
|
||||
}
|
||||
|
||||
public String getResourceUrl()
|
||||
{
|
||||
return resourceUrl;
|
||||
}
|
||||
public void setTenantId(Long tenantId)
|
||||
{
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public Long getTenantId()
|
||||
{
|
||||
return tenantId;
|
||||
}
|
||||
public void setTenantName(String tenantName)
|
||||
{
|
||||
this.tenantName = tenantName;
|
||||
}
|
||||
|
||||
public String getTenantName()
|
||||
{
|
||||
return tenantName;
|
||||
}
|
||||
public void setDelFlag(Integer delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public Integer getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("fileName", getFileName())
|
||||
.append("categoryName", getCategoryName())
|
||||
.append("resourceUrl", getResourceUrl())
|
||||
.append("tenantId", getTenantId())
|
||||
.append("tenantName", getTenantName())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("delFlag", getDelFlag())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
138
xinda-scada/src/main/java/com/xinda/scada/domain/ScadaModel.java
Normal file
138
xinda-scada/src/main/java/com/xinda/scada/domain/ScadaModel.java
Normal file
@@ -0,0 +1,138 @@
|
||||
package com.xinda.scada.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.xinda.common.annotation.Excel;
|
||||
import com.xinda.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 模型管理对象 scada_model
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-10
|
||||
*/
|
||||
public class ScadaModel extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
|
||||
/** 模型名称 */
|
||||
@Excel(name = "模型名称")
|
||||
private String modelName;
|
||||
|
||||
/** 模型地址 */
|
||||
@Excel(name = "模型地址")
|
||||
private String modelUrl;
|
||||
|
||||
/** 是否弃用 */
|
||||
@Excel(name = "是否弃用")
|
||||
private Integer status;
|
||||
|
||||
/** 缩略图url */
|
||||
@Excel(name = "缩略图url")
|
||||
private String imageUrl;
|
||||
|
||||
/** 租户id */
|
||||
@Excel(name = "租户id")
|
||||
private Long tenantId;
|
||||
|
||||
/** 租户名称 */
|
||||
@Excel(name = "租户名称")
|
||||
private String tenantName;
|
||||
|
||||
/** 逻辑删除标识 */
|
||||
private Integer delFlag;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setModelName(String modelName)
|
||||
{
|
||||
this.modelName = modelName;
|
||||
}
|
||||
|
||||
public String getModelName()
|
||||
{
|
||||
return modelName;
|
||||
}
|
||||
public void setModelUrl(String modelUrl)
|
||||
{
|
||||
this.modelUrl = modelUrl;
|
||||
}
|
||||
|
||||
public String getModelUrl()
|
||||
{
|
||||
return modelUrl;
|
||||
}
|
||||
public void setStatus(Integer status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Integer getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
public void setImageUrl(String imageUrl)
|
||||
{
|
||||
this.imageUrl = imageUrl;
|
||||
}
|
||||
|
||||
public String getImageUrl()
|
||||
{
|
||||
return imageUrl;
|
||||
}
|
||||
public void setTenantId(Long tenantId)
|
||||
{
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public Long getTenantId()
|
||||
{
|
||||
return tenantId;
|
||||
}
|
||||
public void setTenantName(String tenantName)
|
||||
{
|
||||
this.tenantName = tenantName;
|
||||
}
|
||||
|
||||
public String getTenantName()
|
||||
{
|
||||
return tenantName;
|
||||
}
|
||||
public void setDelFlag(Integer delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public Integer getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("modelName", getModelName())
|
||||
.append("modelUrl", getModelUrl())
|
||||
.append("status", getStatus())
|
||||
.append("imageUrl", getImageUrl())
|
||||
.append("tenantId", getTenantId())
|
||||
.append("tenantName", getTenantName())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("delFlag", getDelFlag())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.xinda.scada.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.xinda.scada.domain.ScadaComponent;
|
||||
|
||||
/**
|
||||
* 组件管理Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-10
|
||||
*/
|
||||
public interface ScadaComponentMapper
|
||||
{
|
||||
/**
|
||||
* 查询组件管理
|
||||
*
|
||||
* @param id 组件管理主键
|
||||
* @return 组件管理
|
||||
*/
|
||||
public ScadaComponent selectScadaComponentById(Long id);
|
||||
|
||||
/**
|
||||
* 查询组件管理列表
|
||||
*
|
||||
* @param scadaComponent 组件管理
|
||||
* @return 组件管理集合
|
||||
*/
|
||||
public List<ScadaComponent> selectScadaComponentList(ScadaComponent scadaComponent);
|
||||
|
||||
/**
|
||||
* 新增组件管理
|
||||
*
|
||||
* @param scadaComponent 组件管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertScadaComponent(ScadaComponent scadaComponent);
|
||||
|
||||
/**
|
||||
* 修改组件管理
|
||||
*
|
||||
* @param scadaComponent 组件管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateScadaComponent(ScadaComponent scadaComponent);
|
||||
|
||||
/**
|
||||
* 删除组件管理
|
||||
*
|
||||
* @param id 组件管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScadaComponentById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除组件管理
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScadaComponentByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.xinda.scada.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.xinda.scada.domain.ScadaDeviceBind;
|
||||
import com.xinda.scada.vo.ScadaBindDeviceSimVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 组态设备关联Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-13
|
||||
*/
|
||||
public interface ScadaDeviceBindMapper
|
||||
{
|
||||
/**
|
||||
* 查询组态设备关联
|
||||
*
|
||||
* @param id 组态设备关联主键
|
||||
* @return 组态设备关联
|
||||
*/
|
||||
public ScadaDeviceBind selectScadaDeviceBindById(Long id);
|
||||
|
||||
/**
|
||||
* 查询组态设备关联列表
|
||||
*
|
||||
* @param scadaDeviceBind 组态设备关联
|
||||
* @return 组态设备关联集合
|
||||
*/
|
||||
public List<ScadaDeviceBind> selectScadaDeviceBindList(ScadaDeviceBind scadaDeviceBind);
|
||||
|
||||
/**
|
||||
* 新增组态设备关联
|
||||
*
|
||||
* @param scadaDeviceBind 组态设备关联
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertScadaDeviceBind(ScadaDeviceBind scadaDeviceBind);
|
||||
|
||||
/**
|
||||
* 修改组态设备关联
|
||||
*
|
||||
* @param scadaDeviceBind 组态设备关联
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateScadaDeviceBind(ScadaDeviceBind scadaDeviceBind);
|
||||
|
||||
/**
|
||||
* 删除组态设备关联
|
||||
*
|
||||
* @param id 组态设备关联主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScadaDeviceBindById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除组态设备关联
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScadaDeviceBindByIds(Long[] ids);
|
||||
|
||||
List<ScadaDeviceBind> listByGuidAndSerialNumber(@Param("scadaGuid") String scadaGuid, @Param("serialNumberList") List<String> serialNumberList);
|
||||
|
||||
/**
|
||||
* 查询组态绑定设备
|
||||
* @param guid 组态guid
|
||||
* @return java.util.List<com.xinda.scada.vo.ScadaBindDeviceSimVO>
|
||||
*/
|
||||
List<ScadaBindDeviceSimVO> listDeviceSimByGuid(String guid);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.xinda.scada.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.xinda.scada.domain.ScadaEchart;
|
||||
|
||||
/**
|
||||
* 图表管理Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-10
|
||||
*/
|
||||
public interface ScadaEchartMapper
|
||||
{
|
||||
/**
|
||||
* 查询图表管理
|
||||
*
|
||||
* @param id 图表管理主键
|
||||
* @return 图表管理
|
||||
*/
|
||||
public ScadaEchart selectScadaEchartById(Long id);
|
||||
|
||||
/**
|
||||
* 查询图表管理列表
|
||||
*
|
||||
* @param scadaEchart 图表管理
|
||||
* @return 图表管理集合
|
||||
*/
|
||||
public List<ScadaEchart> selectScadaEchartList(ScadaEchart scadaEchart);
|
||||
|
||||
/**
|
||||
* 新增图表管理
|
||||
*
|
||||
* @param scadaEchart 图表管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertScadaEchart(ScadaEchart scadaEchart);
|
||||
|
||||
/**
|
||||
* 修改图表管理
|
||||
*
|
||||
* @param scadaEchart 图表管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateScadaEchart(ScadaEchart scadaEchart);
|
||||
|
||||
/**
|
||||
* 删除图表管理
|
||||
*
|
||||
* @param id 图表管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScadaEchartById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除图表管理
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScadaEchartByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.xinda.scada.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.xinda.scada.domain.ScadaGallery;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 图库管理Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-10
|
||||
*/
|
||||
public interface ScadaGalleryMapper
|
||||
{
|
||||
/**
|
||||
* 查询图库管理
|
||||
*
|
||||
* @param id 图库管理主键
|
||||
* @return 图库管理
|
||||
*/
|
||||
public ScadaGallery selectScadaGalleryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询图库管理列表
|
||||
*
|
||||
* @param scadaGallery 图库管理
|
||||
* @return 图库管理集合
|
||||
*/
|
||||
public List<ScadaGallery> selectScadaGalleryList(ScadaGallery scadaGallery);
|
||||
|
||||
/**
|
||||
* 新增图库管理
|
||||
*
|
||||
* @param scadaGallery 图库管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertScadaGallery(ScadaGallery scadaGallery);
|
||||
|
||||
/**
|
||||
* 修改图库管理
|
||||
*
|
||||
* @param scadaGallery 图库管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateScadaGallery(ScadaGallery scadaGallery);
|
||||
|
||||
/**
|
||||
* 删除图库管理
|
||||
*
|
||||
* @param id 图库管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScadaGalleryById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除图库管理
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScadaGalleryByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 查询图库
|
||||
* @param idSet 主键集合
|
||||
* @return java.util.List<com.xinda.scada.domain.ScadaGallery>
|
||||
*/
|
||||
List<ScadaGallery> selectScadaGalleryByIdSet(Set<Long> idSet);
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.xinda.scada.mapper;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import com.xinda.iot.domain.EventLog;
|
||||
import com.xinda.iot.domain.FunctionLog;
|
||||
import com.xinda.iot.model.DeviceStatistic;
|
||||
import com.xinda.scada.domain.Scada;
|
||||
import com.xinda.scada.vo.ScadaHistoryModelVO;
|
||||
import com.xinda.scada.vo.ScadaStatisticVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 组态中心Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-10
|
||||
*/
|
||||
public interface ScadaMapper
|
||||
{
|
||||
/**
|
||||
* 查询组态中心
|
||||
*
|
||||
* @param id 组态中心主键
|
||||
* @return 组态中心
|
||||
*/
|
||||
public Scada selectScadaById(Long id);
|
||||
|
||||
/**
|
||||
* 查询组态中心列表
|
||||
*
|
||||
* @param scada 组态中心
|
||||
* @return 组态中心集合
|
||||
*/
|
||||
public List<Scada> selectScadaList(Scada scada);
|
||||
|
||||
/**
|
||||
* 新增组态中心
|
||||
*
|
||||
* @param scada 组态中心
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertScada(Scada scada);
|
||||
|
||||
/**
|
||||
* 修改组态中心
|
||||
*
|
||||
* @param scada 组态中心
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateScada(Scada scada);
|
||||
|
||||
/**
|
||||
* 删除组态中心
|
||||
*
|
||||
* @param id 组态中心主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScadaById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除组态中心
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScadaByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 根据guid获取组态详情
|
||||
* @param guid 组态id
|
||||
* @return
|
||||
*/
|
||||
Scada selectScadaByGuid(String guid);
|
||||
|
||||
/**
|
||||
* 查询设备运行状态
|
||||
* @param serialNumber 设备编号
|
||||
* @return java.lang.String
|
||||
*/
|
||||
Integer getStatusBySerialNumber(String serialNumber);
|
||||
|
||||
ScadaStatisticVO selectDeviceProductAlertCount(@Param("tenantId") Long tenantId, @Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 查询功能物模型历史数据
|
||||
* @param functionLog 功能物模型日志
|
||||
* @return java.util.List<com.xinda.scada.vo.ScadaHistoryModelVO>
|
||||
*/
|
||||
List<ScadaHistoryModelVO> listFunctionLogHistory(FunctionLog functionLog);
|
||||
|
||||
/**
|
||||
* 查询时间物模型历史数据
|
||||
* @param eventLog 事件物模型日志
|
||||
* @return java.util.List<com.xinda.scada.vo.ScadaHistoryModelVO>
|
||||
*/
|
||||
List<ScadaHistoryModelVO> listEventLogHistory(EventLog eventLog);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.xinda.scada.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.xinda.scada.domain.ScadaModel;
|
||||
|
||||
/**
|
||||
* 模型管理Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-10
|
||||
*/
|
||||
public interface ScadaModelMapper
|
||||
{
|
||||
/**
|
||||
* 查询模型管理
|
||||
*
|
||||
* @param id 模型管理主键
|
||||
* @return 模型管理
|
||||
*/
|
||||
public ScadaModel selectScadaModelById(Long id);
|
||||
|
||||
/**
|
||||
* 查询模型管理列表
|
||||
*
|
||||
* @param scadaModel 模型管理
|
||||
* @return 模型管理集合
|
||||
*/
|
||||
public List<ScadaModel> selectScadaModelList(ScadaModel scadaModel);
|
||||
|
||||
/**
|
||||
* 新增模型管理
|
||||
*
|
||||
* @param scadaModel 模型管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertScadaModel(ScadaModel scadaModel);
|
||||
|
||||
/**
|
||||
* 修改模型管理
|
||||
*
|
||||
* @param scadaModel 模型管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateScadaModel(ScadaModel scadaModel);
|
||||
|
||||
/**
|
||||
* 删除模型管理
|
||||
*
|
||||
* @param id 模型管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScadaModelById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除模型管理
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScadaModelByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.xinda.scada.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.xinda.scada.domain.ScadaComponent;
|
||||
|
||||
/**
|
||||
* 组件管理Service接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-10
|
||||
*/
|
||||
public interface IScadaComponentService
|
||||
{
|
||||
/**
|
||||
* 查询组件管理
|
||||
*
|
||||
* @param id 组件管理主键
|
||||
* @return 组件管理
|
||||
*/
|
||||
public ScadaComponent selectScadaComponentById(Long id);
|
||||
|
||||
/**
|
||||
* 查询组件管理列表
|
||||
*
|
||||
* @param scadaComponent 组件管理
|
||||
* @return 组件管理集合
|
||||
*/
|
||||
public List<ScadaComponent> selectScadaComponentList(ScadaComponent scadaComponent);
|
||||
|
||||
/**
|
||||
* 新增组件管理
|
||||
*
|
||||
* @param scadaComponent 组件管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertScadaComponent(ScadaComponent scadaComponent);
|
||||
|
||||
/**
|
||||
* 修改组件管理
|
||||
*
|
||||
* @param scadaComponent 组件管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateScadaComponent(ScadaComponent scadaComponent);
|
||||
|
||||
/**
|
||||
* 批量删除组件管理
|
||||
*
|
||||
* @param ids 需要删除的组件管理主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScadaComponentByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除组件管理信息
|
||||
*
|
||||
* @param id 组件管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScadaComponentById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.xinda.scada.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.xinda.scada.domain.ScadaDeviceBind;
|
||||
|
||||
/**
|
||||
* 组态设备关联Service接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-13
|
||||
*/
|
||||
public interface IScadaDeviceBindService
|
||||
{
|
||||
/**
|
||||
* 查询组态设备关联
|
||||
*
|
||||
* @param id 组态设备关联主键
|
||||
* @return 组态设备关联
|
||||
*/
|
||||
public ScadaDeviceBind selectScadaDeviceBindById(Long id);
|
||||
|
||||
/**
|
||||
* 查询组态设备关联列表
|
||||
*
|
||||
* @param scadaDeviceBind 组态设备关联
|
||||
* @return 组态设备关联集合
|
||||
*/
|
||||
public List<ScadaDeviceBind> selectScadaDeviceBindList(ScadaDeviceBind scadaDeviceBind);
|
||||
|
||||
/**
|
||||
* 新增组态设备关联
|
||||
*
|
||||
* @param scadaDeviceBind 组态设备关联
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertScadaDeviceBind(ScadaDeviceBind scadaDeviceBind);
|
||||
|
||||
/**
|
||||
* 修改组态设备关联
|
||||
*
|
||||
* @param scadaDeviceBind 组态设备关联
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateScadaDeviceBind(ScadaDeviceBind scadaDeviceBind);
|
||||
|
||||
/**
|
||||
* 批量删除组态设备关联
|
||||
*
|
||||
* @param ids 需要删除的组态设备关联主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScadaDeviceBindByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除组态设备关联信息
|
||||
*
|
||||
* @param id 组态设备关联主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScadaDeviceBindById(Long id);
|
||||
|
||||
/**
|
||||
* 查询组态关联设备
|
||||
* @param scadaGuid 组态guid
|
||||
* @param serialNumberList 设备编号集合
|
||||
* @return 绑定设备
|
||||
*/
|
||||
List<ScadaDeviceBind> listByGuidAndSerialNumber(String scadaGuid, List<String> serialNumberList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.xinda.scada.service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import com.xinda.common.exception.file.InvalidExtensionException;
|
||||
import com.xinda.scada.domain.ScadaEchart;
|
||||
|
||||
/**
|
||||
* 图表管理Service接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-10
|
||||
*/
|
||||
public interface IScadaEchartService
|
||||
{
|
||||
/**
|
||||
* 查询图表管理
|
||||
*
|
||||
* @param id 图表管理主键
|
||||
* @return 图表管理
|
||||
*/
|
||||
public ScadaEchart selectScadaEchartById(Long id);
|
||||
|
||||
/**
|
||||
* 查询图表管理列表
|
||||
*
|
||||
* @param scadaEchart 图表管理
|
||||
* @return 图表管理集合
|
||||
*/
|
||||
public List<ScadaEchart> selectScadaEchartList(ScadaEchart scadaEchart);
|
||||
|
||||
/**
|
||||
* 新增图表管理
|
||||
*
|
||||
* @param scadaEchart 图表管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertScadaEchart(ScadaEchart scadaEchart);
|
||||
|
||||
/**
|
||||
* 修改图表管理
|
||||
*
|
||||
* @param scadaEchart 图表管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateScadaEchart(ScadaEchart scadaEchart);
|
||||
|
||||
/**
|
||||
* 批量删除图表管理
|
||||
*
|
||||
* @param ids 需要删除的图表管理主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScadaEchartByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除图表管理信息
|
||||
*
|
||||
* @param id 图表管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScadaEchartById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.xinda.scada.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.xinda.common.core.domain.AjaxResult;
|
||||
import com.xinda.scada.domain.ScadaGallery;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 图库管理Service接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-10
|
||||
*/
|
||||
public interface IScadaGalleryService
|
||||
{
|
||||
/**
|
||||
* 查询图库管理
|
||||
*
|
||||
* @param id 图库管理主键
|
||||
* @return 图库管理
|
||||
*/
|
||||
public ScadaGallery selectScadaGalleryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询图库管理列表
|
||||
*
|
||||
* @param scadaGallery 图库管理
|
||||
* @return 图库管理集合
|
||||
*/
|
||||
public List<ScadaGallery> selectScadaGalleryList(ScadaGallery scadaGallery);
|
||||
|
||||
/**
|
||||
* 新增图库管理
|
||||
*
|
||||
* @param scadaGallery 图库管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertScadaGallery(ScadaGallery scadaGallery);
|
||||
|
||||
/**
|
||||
* 修改图库管理
|
||||
*
|
||||
* @param scadaGallery 图库管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateScadaGallery(ScadaGallery scadaGallery);
|
||||
|
||||
/**
|
||||
* 批量删除图库管理
|
||||
*
|
||||
* @param ids 需要删除的图库管理主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScadaGalleryByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除图库管理信息
|
||||
*
|
||||
* @param id 图库管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScadaGalleryById(Long id);
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
* @param file 文件
|
||||
* @param categoryName 分类名称
|
||||
* @return
|
||||
*/
|
||||
AjaxResult uploadFile(MultipartFile file, String categoryName);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.xinda.scada.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.xinda.scada.domain.ScadaModel;
|
||||
|
||||
/**
|
||||
* 模型管理Service接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-10
|
||||
*/
|
||||
public interface IScadaModelService
|
||||
{
|
||||
/**
|
||||
* 查询模型管理
|
||||
*
|
||||
* @param id 模型管理主键
|
||||
* @return 模型管理
|
||||
*/
|
||||
public ScadaModel selectScadaModelById(Long id);
|
||||
|
||||
/**
|
||||
* 查询模型管理列表
|
||||
*
|
||||
* @param scadaModel 模型管理
|
||||
* @return 模型管理集合
|
||||
*/
|
||||
public List<ScadaModel> selectScadaModelList(ScadaModel scadaModel);
|
||||
|
||||
/**
|
||||
* 新增模型管理
|
||||
*
|
||||
* @param scadaModel 模型管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertScadaModel(ScadaModel scadaModel);
|
||||
|
||||
/**
|
||||
* 修改模型管理
|
||||
*
|
||||
* @param scadaModel 模型管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateScadaModel(ScadaModel scadaModel);
|
||||
|
||||
/**
|
||||
* 批量删除模型管理
|
||||
*
|
||||
* @param ids 需要删除的模型管理主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScadaModelByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除模型管理信息
|
||||
*
|
||||
* @param id 模型管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScadaModelById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package com.xinda.scada.service;
|
||||
|
||||
import com.xinda.common.core.domain.AjaxResult;
|
||||
import com.xinda.scada.domain.Scada;
|
||||
import com.xinda.scada.domain.ScadaGallery;
|
||||
import com.xinda.scada.vo.FavoritesVO;
|
||||
import com.xinda.scada.vo.ScadaHistoryModelVO;
|
||||
import com.xinda.scada.vo.ScadaStatisticVO;
|
||||
import com.xinda.scada.vo.ThingsModelHistoryParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 组态中心Service接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-10
|
||||
*/
|
||||
public interface IScadaService
|
||||
{
|
||||
/**
|
||||
* 查询组态中心
|
||||
*
|
||||
* @param id 组态中心主键
|
||||
* @return 组态中心
|
||||
*/
|
||||
public Scada selectScadaById(Long id);
|
||||
|
||||
/**
|
||||
* 查询组态中心列表
|
||||
*
|
||||
* @param scada 组态中心
|
||||
* @return 组态中心集合
|
||||
*/
|
||||
public List<Scada> selectScadaList(Scada scada);
|
||||
|
||||
/**
|
||||
* 新增组态中心
|
||||
*
|
||||
* @param scada 组态中心
|
||||
* @return 结果
|
||||
*/
|
||||
public AjaxResult insertScada(Scada scada);
|
||||
|
||||
/**
|
||||
* 修改组态中心
|
||||
*
|
||||
* @param scada 组态中心
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateScada(Scada scada);
|
||||
|
||||
/**
|
||||
* 批量删除组态中心
|
||||
*
|
||||
* @param ids 需要删除的组态中心主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScadaByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除组态中心信息
|
||||
*
|
||||
* @param id 组态中心主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScadaById(Long id);
|
||||
|
||||
/**
|
||||
* 根据guid获取组态详情
|
||||
* @param guid 组态id
|
||||
* @return
|
||||
*/
|
||||
Scada selectScadaByGuid(String guid);
|
||||
|
||||
/**
|
||||
* 图库收藏上传
|
||||
* @return com.xinda.common.core.domain.AjaxResult
|
||||
*/
|
||||
AjaxResult uploadGalleryFavorites(MultipartFile file, String categoryName);
|
||||
|
||||
/**
|
||||
* 个人图库收藏
|
||||
* @param favoritesVO 收藏vo类
|
||||
* @return com.xinda.common.core.domain.AjaxResult
|
||||
*/
|
||||
AjaxResult saveGalleryFavorites(FavoritesVO favoritesVO);
|
||||
|
||||
/**
|
||||
* 个人删除收藏图库
|
||||
* @return com.xinda.common.core.domain.AjaxResult
|
||||
*/
|
||||
AjaxResult deleteGalleryFavorites(Long[] ids);
|
||||
|
||||
/**
|
||||
* 查询个人收藏图库
|
||||
* @param scadaGallery 图库类
|
||||
* @return java.util.List<com.xinda.scada.domain.ScadaGallery>
|
||||
*/
|
||||
List<ScadaGallery> listGalleryFavorites(ScadaGallery scadaGallery);
|
||||
|
||||
/**
|
||||
* 查询变量历史数据
|
||||
* @param param 查询条件
|
||||
* @return com.xinda.common.core.domain.AjaxResult
|
||||
*/
|
||||
Map<String, List<ScadaHistoryModelVO>> listThingsModelHistory(ThingsModelHistoryParam param);
|
||||
|
||||
/**
|
||||
* 查询设备运行状态
|
||||
* @param serialNumber 设备编号
|
||||
* @return java.lang.String
|
||||
*/
|
||||
Integer getStatusBySerialNumber(String serialNumber);
|
||||
|
||||
/**
|
||||
* 获取系统相关统计信息
|
||||
* @return com.xinda.common.core.domain.AjaxResult
|
||||
*/
|
||||
ScadaStatisticVO selectStatistic();
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package com.xinda.scada.service.impl;
|
||||
|
||||
import com.xinda.common.config.RuoYiConfig;
|
||||
import com.xinda.common.core.domain.model.LoginUser;
|
||||
import com.xinda.common.exception.ServiceException;
|
||||
import com.xinda.common.exception.file.InvalidExtensionException;
|
||||
import com.xinda.common.utils.DateUtils;
|
||||
import com.xinda.common.utils.StringUtils;
|
||||
import com.xinda.common.utils.file.MimeTypeUtils;
|
||||
import com.xinda.scada.domain.ScadaComponent;
|
||||
import com.xinda.scada.mapper.ScadaComponentMapper;
|
||||
import com.xinda.scada.service.IScadaComponentService;
|
||||
import com.xinda.scada.utils.ScadaConstant;
|
||||
import com.xinda.scada.utils.ScadaFileUploadUtils;
|
||||
import com.xinda.scada.utils.ScadaFileUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static com.xinda.common.utils.SecurityUtils.getLoginUser;
|
||||
|
||||
/**
|
||||
* 组件管理Service业务层处理
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-10
|
||||
*/
|
||||
@Service
|
||||
public class ScadaComponentServiceImpl implements IScadaComponentService
|
||||
{
|
||||
@Resource
|
||||
private ScadaComponentMapper scadaComponentMapper;
|
||||
|
||||
/**
|
||||
* 查询组件管理
|
||||
*
|
||||
* @param id 组件管理主键
|
||||
* @return 组件管理
|
||||
*/
|
||||
@Override
|
||||
public ScadaComponent selectScadaComponentById(Long id)
|
||||
{
|
||||
return scadaComponentMapper.selectScadaComponentById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询组件管理列表
|
||||
*
|
||||
* @param scadaComponent 组件管理
|
||||
* @return 组件管理
|
||||
*/
|
||||
@Override
|
||||
public List<ScadaComponent> selectScadaComponentList(ScadaComponent scadaComponent)
|
||||
{
|
||||
return scadaComponentMapper.selectScadaComponentList(scadaComponent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增组件管理
|
||||
*
|
||||
* @param scadaComponent 组件管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertScadaComponent(ScadaComponent scadaComponent)
|
||||
{
|
||||
LoginUser loginUser = getLoginUser();
|
||||
scadaComponent.setUserId(loginUser.getUserId());
|
||||
if (StringUtils.isEmpty(scadaComponent.getComponentTemplate())) {
|
||||
scadaComponent.setComponentTemplate(ScadaConstant.COMPONENT_TEMPLATE_DEFAULT);
|
||||
}
|
||||
if (StringUtils.isEmpty(scadaComponent.getComponentStyle())) {
|
||||
scadaComponent.setComponentStyle(ScadaConstant.COMPONENT_STYLE_DEFAULT);
|
||||
}
|
||||
if (StringUtils.isEmpty(scadaComponent.getComponentScript())) {
|
||||
scadaComponent.setComponentScript(ScadaConstant.COMPONENT_SCRIPT_DEFAULT);
|
||||
}
|
||||
return scadaComponentMapper.insertScadaComponent(scadaComponent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改组件管理
|
||||
*
|
||||
* @param scadaComponent 组件管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateScadaComponent(ScadaComponent scadaComponent)
|
||||
{
|
||||
scadaComponent.setUpdateTime(DateUtils.getNowDate());
|
||||
if (StringUtils.isNotEmpty(scadaComponent.getBase64())) {
|
||||
MultipartFile multipartFile = ScadaFileUtils.base64toMultipartFile(scadaComponent.getBase64());
|
||||
String url;
|
||||
try {
|
||||
url = ScadaFileUploadUtils.upload(RuoYiConfig.getUploadPath(), multipartFile, MimeTypeUtils.IMAGE_EXTENSION);
|
||||
} catch (IOException | InvalidExtensionException e) {
|
||||
throw new ServiceException("修改组件base64转图片异常" + e.getMessage());
|
||||
}
|
||||
scadaComponent.setComponentImage(url);
|
||||
}
|
||||
return scadaComponentMapper.updateScadaComponent(scadaComponent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除组件管理
|
||||
*
|
||||
* @param ids 需要删除的组件管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteScadaComponentByIds(Long[] ids)
|
||||
{
|
||||
return scadaComponentMapper.deleteScadaComponentByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除组件管理信息
|
||||
*
|
||||
* @param id 组件管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteScadaComponentById(Long id)
|
||||
{
|
||||
return scadaComponentMapper.deleteScadaComponentById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.xinda.scada.service.impl;
|
||||
|
||||
import com.xinda.scada.domain.ScadaDeviceBind;
|
||||
import com.xinda.scada.mapper.ScadaDeviceBindMapper;
|
||||
import com.xinda.scada.service.IScadaDeviceBindService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 组态设备关联Service业务层处理
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-13
|
||||
*/
|
||||
@Service
|
||||
public class ScadaDeviceBindServiceImpl implements IScadaDeviceBindService
|
||||
{
|
||||
@Resource
|
||||
private ScadaDeviceBindMapper scadaDeviceBindMapper;
|
||||
|
||||
/**
|
||||
* 查询组态设备关联
|
||||
*
|
||||
* @param id 组态设备关联主键
|
||||
* @return 组态设备关联
|
||||
*/
|
||||
@Override
|
||||
public ScadaDeviceBind selectScadaDeviceBindById(Long id)
|
||||
{
|
||||
return scadaDeviceBindMapper.selectScadaDeviceBindById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询组态设备关联列表
|
||||
*
|
||||
* @param scadaDeviceBind 组态设备关联
|
||||
* @return 组态设备关联
|
||||
*/
|
||||
@Override
|
||||
public List<ScadaDeviceBind> selectScadaDeviceBindList(ScadaDeviceBind scadaDeviceBind)
|
||||
{
|
||||
return scadaDeviceBindMapper.selectScadaDeviceBindList(scadaDeviceBind);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增组态设备关联
|
||||
*
|
||||
* @param scadaDeviceBind 组态设备关联
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertScadaDeviceBind(ScadaDeviceBind scadaDeviceBind)
|
||||
{
|
||||
return scadaDeviceBindMapper.insertScadaDeviceBind(scadaDeviceBind);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改组态设备关联
|
||||
*
|
||||
* @param scadaDeviceBind 组态设备关联
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateScadaDeviceBind(ScadaDeviceBind scadaDeviceBind)
|
||||
{
|
||||
return scadaDeviceBindMapper.updateScadaDeviceBind(scadaDeviceBind);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除组态设备关联
|
||||
*
|
||||
* @param ids 需要删除的组态设备关联主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteScadaDeviceBindByIds(Long[] ids)
|
||||
{
|
||||
return scadaDeviceBindMapper.deleteScadaDeviceBindByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除组态设备关联信息
|
||||
*
|
||||
* @param id 组态设备关联主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteScadaDeviceBindById(Long id)
|
||||
{
|
||||
return scadaDeviceBindMapper.deleteScadaDeviceBindById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ScadaDeviceBind> listByGuidAndSerialNumber(String scadaGuid, List<String> serialNumberList) {
|
||||
return scadaDeviceBindMapper.listByGuidAndSerialNumber(scadaGuid, serialNumberList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.xinda.scada.service.impl;
|
||||
|
||||
import com.xinda.common.config.RuoYiConfig;
|
||||
import com.xinda.common.exception.ServerException;
|
||||
import com.xinda.common.exception.ServiceException;
|
||||
import com.xinda.common.exception.file.InvalidExtensionException;
|
||||
import com.xinda.common.utils.DateUtils;
|
||||
import com.xinda.common.utils.EncodeUtils;
|
||||
import com.xinda.common.utils.StringUtils;
|
||||
import com.xinda.common.utils.file.FileUploadUtils;
|
||||
import com.xinda.common.utils.file.MimeTypeUtils;
|
||||
import com.xinda.scada.domain.ScadaEchart;
|
||||
import com.xinda.scada.mapper.ScadaEchartMapper;
|
||||
import com.xinda.scada.service.IScadaEchartService;
|
||||
import com.xinda.scada.utils.ScadaFileUploadUtils;
|
||||
import com.xinda.scada.utils.ScadaFileUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 图表管理Service业务层处理
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-10
|
||||
*/
|
||||
@Service
|
||||
public class ScadaEchartServiceImpl implements IScadaEchartService
|
||||
{
|
||||
@Resource
|
||||
private ScadaEchartMapper scadaEchartMapper;
|
||||
|
||||
/**
|
||||
* 查询图表管理
|
||||
*
|
||||
* @param id 图表管理主键
|
||||
* @return 图表管理
|
||||
*/
|
||||
@Override
|
||||
public ScadaEchart selectScadaEchartById(Long id)
|
||||
{
|
||||
return scadaEchartMapper.selectScadaEchartById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询图表管理列表
|
||||
*
|
||||
* @param scadaEchart 图表管理
|
||||
* @return 图表管理
|
||||
*/
|
||||
@Override
|
||||
public List<ScadaEchart> selectScadaEchartList(ScadaEchart scadaEchart)
|
||||
{
|
||||
return scadaEchartMapper.selectScadaEchartList(scadaEchart);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增图表管理
|
||||
*
|
||||
* @param scadaEchart 图表管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertScadaEchart(ScadaEchart scadaEchart) {
|
||||
scadaEchart.setCreateTime(DateUtils.getNowDate());
|
||||
if (StringUtils.isNotEmpty(scadaEchart.getBase64())) {
|
||||
MultipartFile multipartFile = ScadaFileUtils.base64toMultipartFile(scadaEchart.getBase64());
|
||||
String url;
|
||||
try {
|
||||
url = ScadaFileUploadUtils.upload(RuoYiConfig.getUploadPath(), multipartFile, MimeTypeUtils.IMAGE_EXTENSION);
|
||||
} catch (IOException | InvalidExtensionException e) {
|
||||
throw new ServiceException("新增图表base64转图片异常" + e.getMessage());
|
||||
}
|
||||
scadaEchart.setEchartImgae(url);
|
||||
}
|
||||
return scadaEchartMapper.insertScadaEchart(scadaEchart);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改图表管理
|
||||
*
|
||||
* @param scadaEchart 图表管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateScadaEchart(ScadaEchart scadaEchart) {
|
||||
scadaEchart.setUpdateTime(DateUtils.getNowDate());
|
||||
if (StringUtils.isNotEmpty(scadaEchart.getBase64())) {
|
||||
MultipartFile multipartFile = ScadaFileUtils.base64toMultipartFile(scadaEchart.getBase64());
|
||||
String url;
|
||||
try {
|
||||
url = ScadaFileUploadUtils.upload(RuoYiConfig.getUploadPath(), multipartFile, MimeTypeUtils.IMAGE_EXTENSION);
|
||||
} catch (IOException | InvalidExtensionException e) {
|
||||
throw new ServiceException("新增图表base64转图片异常" + e.getMessage());
|
||||
}
|
||||
scadaEchart.setEchartImgae(url);
|
||||
}
|
||||
return scadaEchartMapper.updateScadaEchart(scadaEchart);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除图表管理
|
||||
*
|
||||
* @param ids 需要删除的图表管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteScadaEchartByIds(Long[] ids)
|
||||
{
|
||||
return scadaEchartMapper.deleteScadaEchartByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除图表管理信息
|
||||
*
|
||||
* @param id 图表管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteScadaEchartById(Long id)
|
||||
{
|
||||
return scadaEchartMapper.deleteScadaEchartById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.xinda.scada.service.impl;
|
||||
|
||||
import com.xinda.common.config.RuoYiConfig;
|
||||
import com.xinda.common.core.domain.AjaxResult;
|
||||
import com.xinda.common.core.domain.model.LoginUser;
|
||||
import com.xinda.common.utils.DateUtils;
|
||||
import com.xinda.common.utils.file.FileUploadUtils;
|
||||
import com.xinda.common.utils.file.FileUtils;
|
||||
import com.xinda.scada.domain.ScadaGallery;
|
||||
import com.xinda.scada.mapper.ScadaGalleryMapper;
|
||||
import com.xinda.scada.service.IScadaGalleryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static com.xinda.common.utils.SecurityUtils.getLoginUser;
|
||||
|
||||
/**
|
||||
* 图库管理Service业务层处理
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-10
|
||||
*/
|
||||
@Service
|
||||
public class ScadaGalleryServiceImpl implements IScadaGalleryService
|
||||
{
|
||||
@Resource
|
||||
private ScadaGalleryMapper scadaGalleryMapper;
|
||||
|
||||
/**
|
||||
* 查询图库管理
|
||||
*
|
||||
* @param id 图库管理主键
|
||||
* @return 图库管理
|
||||
*/
|
||||
@Override
|
||||
public ScadaGallery selectScadaGalleryById(Long id)
|
||||
{
|
||||
return scadaGalleryMapper.selectScadaGalleryById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询图库管理列表
|
||||
*
|
||||
* @param scadaGallery 图库管理
|
||||
* @return 图库管理
|
||||
*/
|
||||
@Override
|
||||
public List<ScadaGallery> selectScadaGalleryList(ScadaGallery scadaGallery)
|
||||
{
|
||||
return scadaGalleryMapper.selectScadaGalleryList(scadaGallery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增图库管理
|
||||
*
|
||||
* @param scadaGallery 图库管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertScadaGallery(ScadaGallery scadaGallery)
|
||||
{
|
||||
scadaGallery.setCreateTime(DateUtils.getNowDate());
|
||||
return scadaGalleryMapper.insertScadaGallery(scadaGallery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改图库管理
|
||||
*
|
||||
* @param scadaGallery 图库管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateScadaGallery(ScadaGallery scadaGallery)
|
||||
{
|
||||
scadaGallery.setUpdateTime(DateUtils.getNowDate());
|
||||
return scadaGalleryMapper.updateScadaGallery(scadaGallery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除图库管理
|
||||
*
|
||||
* @param ids 需要删除的图库管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteScadaGalleryByIds(Long[] ids)
|
||||
{
|
||||
return scadaGalleryMapper.deleteScadaGalleryByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除图库管理信息
|
||||
*
|
||||
* @param id 图库管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteScadaGalleryById(Long id)
|
||||
{
|
||||
return scadaGalleryMapper.deleteScadaGalleryById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult uploadFile(MultipartFile file, String categoryName) {
|
||||
LoginUser loginUser = getLoginUser();
|
||||
if (loginUser == null) {
|
||||
return AjaxResult.error("请重新登录");
|
||||
}
|
||||
// 上传文件路径
|
||||
String filePath = "";
|
||||
// 上传并返回新文件名称
|
||||
try{
|
||||
filePath = FileUploadUtils.upload(RuoYiConfig.getUploadPath(), file);
|
||||
}catch (Exception e){
|
||||
return AjaxResult.error(500,"上传图库文件异常,"+ e);
|
||||
}
|
||||
String fileName = file.getOriginalFilename();
|
||||
ScadaGallery scadaGallery = new ScadaGallery();
|
||||
scadaGallery.setFileName(fileName);
|
||||
scadaGallery.setCategoryName(categoryName);
|
||||
scadaGallery.setResourceUrl(filePath);
|
||||
return scadaGalleryMapper.insertScadaGallery(scadaGallery) > 0 ? AjaxResult.success("上传成功") : AjaxResult.error("上传失败");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.xinda.scada.service.impl;
|
||||
|
||||
import com.xinda.common.utils.DateUtils;
|
||||
import com.xinda.scada.domain.ScadaModel;
|
||||
import com.xinda.scada.mapper.ScadaModelMapper;
|
||||
import com.xinda.scada.service.IScadaModelService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 模型管理Service业务层处理
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-10
|
||||
*/
|
||||
@Service
|
||||
public class ScadaModelServiceImpl implements IScadaModelService
|
||||
{
|
||||
@Resource
|
||||
private ScadaModelMapper scadaModelMapper;
|
||||
|
||||
/**
|
||||
* 查询模型管理
|
||||
*
|
||||
* @param id 模型管理主键
|
||||
* @return 模型管理
|
||||
*/
|
||||
@Override
|
||||
public ScadaModel selectScadaModelById(Long id)
|
||||
{
|
||||
return scadaModelMapper.selectScadaModelById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询模型管理列表
|
||||
*
|
||||
* @param scadaModel 模型管理
|
||||
* @return 模型管理
|
||||
*/
|
||||
@Override
|
||||
public List<ScadaModel> selectScadaModelList(ScadaModel scadaModel)
|
||||
{
|
||||
return scadaModelMapper.selectScadaModelList(scadaModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增模型管理
|
||||
*
|
||||
* @param scadaModel 模型管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertScadaModel(ScadaModel scadaModel)
|
||||
{
|
||||
scadaModel.setCreateTime(DateUtils.getNowDate());
|
||||
return scadaModelMapper.insertScadaModel(scadaModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改模型管理
|
||||
*
|
||||
* @param scadaModel 模型管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateScadaModel(ScadaModel scadaModel)
|
||||
{
|
||||
scadaModel.setUpdateTime(DateUtils.getNowDate());
|
||||
return scadaModelMapper.updateScadaModel(scadaModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除模型管理
|
||||
*
|
||||
* @param ids 需要删除的模型管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteScadaModelByIds(Long[] ids)
|
||||
{
|
||||
return scadaModelMapper.deleteScadaModelByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除模型管理信息
|
||||
*
|
||||
* @param id 模型管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteScadaModelById(Long id)
|
||||
{
|
||||
return scadaModelMapper.deleteScadaModelById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,304 @@
|
||||
package com.xinda.scada.service.impl;
|
||||
|
||||
import com.xinda.common.config.RuoYiConfig;
|
||||
import com.xinda.common.core.domain.AjaxResult;
|
||||
import com.xinda.common.core.domain.entity.SysRole;
|
||||
import com.xinda.common.core.domain.entity.SysUser;
|
||||
import com.xinda.common.core.domain.model.LoginUser;
|
||||
import com.xinda.common.core.redis.RedisCache;
|
||||
import com.xinda.common.utils.DateUtils;
|
||||
import com.xinda.common.utils.StringUtils;
|
||||
import com.xinda.common.utils.bean.BeanUtils;
|
||||
import com.xinda.common.utils.file.FileUploadUtils;
|
||||
import com.xinda.iot.domain.DeviceLog;
|
||||
import com.xinda.iot.domain.EventLog;
|
||||
import com.xinda.iot.domain.FunctionLog;
|
||||
import com.xinda.iot.model.HistoryModel;
|
||||
import com.xinda.iot.service.IDeviceLogService;
|
||||
import com.xinda.scada.domain.Scada;
|
||||
import com.xinda.scada.domain.ScadaGallery;
|
||||
import com.xinda.scada.mapper.ScadaDeviceBindMapper;
|
||||
import com.xinda.scada.mapper.ScadaGalleryMapper;
|
||||
import com.xinda.scada.mapper.ScadaMapper;
|
||||
import com.xinda.scada.service.IScadaService;
|
||||
import com.xinda.scada.vo.*;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.xinda.common.utils.SecurityUtils.getLoginUser;
|
||||
|
||||
/**
|
||||
* 组态中心Service业务层处理
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2023-11-10
|
||||
*/
|
||||
@Service
|
||||
public class ScadaServiceImpl implements IScadaService
|
||||
{
|
||||
@Resource
|
||||
private ScadaMapper scadaMapper;
|
||||
@Resource
|
||||
private ScadaGalleryMapper scadaGalleryMapper;
|
||||
@Resource
|
||||
private RedisCache redisCache;
|
||||
@Resource
|
||||
private ScadaDeviceBindMapper scadaDeviceBindMapper;
|
||||
@Resource
|
||||
private IDeviceLogService deviceLogService;
|
||||
|
||||
/**
|
||||
* 查询组态中心
|
||||
*
|
||||
* @param id 组态中心主键
|
||||
* @return 组态中心
|
||||
*/
|
||||
@Override
|
||||
public Scada selectScadaById(Long id)
|
||||
{
|
||||
return scadaMapper.selectScadaById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询组态中心列表
|
||||
*
|
||||
* @param scada 组态中心
|
||||
* @return 组态中心
|
||||
*/
|
||||
@Override
|
||||
public List<Scada> selectScadaList(Scada scada)
|
||||
{
|
||||
return scadaMapper.selectScadaList(scada);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增组态中心
|
||||
*
|
||||
* @param scada 组态中心
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult insertScada(Scada scada)
|
||||
{
|
||||
LoginUser loginUser = getLoginUser();
|
||||
if (loginUser == null) {
|
||||
return AjaxResult.error("请登录后重试!");
|
||||
}
|
||||
scada.setCreateBy(loginUser.getUserId().toString());
|
||||
UUID uuid = UUID.randomUUID();
|
||||
scada.setGuid(uuid.toString());
|
||||
return scadaMapper.insertScada(scada) > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改组态中心
|
||||
*
|
||||
* @param scada 组态中心
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateScada(Scada scada)
|
||||
{
|
||||
scada.setUpdateTime(DateUtils.getNowDate());
|
||||
return scadaMapper.updateScada(scada);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除组态中心
|
||||
*
|
||||
* @param ids 需要删除的组态中心主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteScadaByIds(Long[] ids)
|
||||
{
|
||||
return scadaMapper.deleteScadaByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除组态中心信息
|
||||
*
|
||||
* @param id 组态中心主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteScadaById(Long id)
|
||||
{
|
||||
return scadaMapper.deleteScadaById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据guid获取组态详情
|
||||
* @param guid 组态id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Scada selectScadaByGuid(String guid) {
|
||||
Scada scada = scadaMapper.selectScadaByGuid(guid);
|
||||
// 查询绑定设备
|
||||
List<ScadaBindDeviceSimVO> simVOList = scadaDeviceBindMapper.listDeviceSimByGuid(scada.getGuid());
|
||||
scada.setBindDeviceList(simVOList);
|
||||
return scada;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult uploadGalleryFavorites(MultipartFile file, String categoryName) {
|
||||
LoginUser loginUser = getLoginUser();
|
||||
if (Objects.isNull(loginUser)) {
|
||||
return AjaxResult.error("请登录后重试!");
|
||||
}
|
||||
// 上传文件路径
|
||||
String filePath;
|
||||
// 上传并返回新文件名称
|
||||
try{
|
||||
filePath = FileUploadUtils.upload(RuoYiConfig.getUploadPath(), file);
|
||||
}catch (Exception e){
|
||||
return AjaxResult.error(500,"上传图库文件异常,"+ e);
|
||||
}
|
||||
String fileName = file.getOriginalFilename();
|
||||
ScadaGallery scadaGallery = new ScadaGallery();
|
||||
scadaGallery.setFileName(fileName);
|
||||
scadaGallery.setCategoryName(categoryName);
|
||||
scadaGallery.setResourceUrl(filePath);
|
||||
Long userId = loginUser.getUserId();
|
||||
scadaGallery.setTenantId(userId);
|
||||
scadaGallery.setTenantName(loginUser.getUsername());
|
||||
int i = scadaGalleryMapper.insertScadaGallery(scadaGallery);
|
||||
if (i <= 0) {
|
||||
return AjaxResult.error("上传失败,请重试!");
|
||||
}
|
||||
String key = this.getGalleryFavoritesRedisKey(userId);
|
||||
redisCache.sAdd(key, scadaGallery.getId());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
private String getGalleryFavoritesRedisKey(Long userId) {
|
||||
return "scada:gallery_favorites_userId_" + userId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult saveGalleryFavorites(FavoritesVO favoritesVO) {
|
||||
LoginUser loginUser = getLoginUser();
|
||||
if (Objects.isNull(loginUser)) {
|
||||
return AjaxResult.error("请登录后重试!");
|
||||
}
|
||||
Long userId = loginUser.getUserId();
|
||||
List<String> idList = StringUtils.str2List(favoritesVO.getIdStr(), ",", true, true);
|
||||
String key = this.getGalleryFavoritesRedisKey(userId);
|
||||
for (String id : idList) {
|
||||
redisCache.sAdd(key, id);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult deleteGalleryFavorites(Long[] ids) {
|
||||
LoginUser loginUser = getLoginUser();
|
||||
if (Objects.isNull(loginUser)) {
|
||||
return AjaxResult.error("请登录后重试!");
|
||||
}
|
||||
Long userId = loginUser.getUserId();
|
||||
String key = this.getGalleryFavoritesRedisKey(userId);
|
||||
for (Long id : ids) {
|
||||
redisCache.setRemove(key, id);
|
||||
}
|
||||
// 删除图库
|
||||
scadaGalleryMapper.deleteScadaGalleryByIds(ids);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ScadaGallery> listGalleryFavorites(ScadaGallery scadaGallery) {
|
||||
LoginUser loginUser = getLoginUser();
|
||||
if (Objects.isNull(loginUser)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
Long userId = loginUser.getUserId();
|
||||
String key = this.getGalleryFavoritesRedisKey(userId);
|
||||
Set<Long> cacheSet = redisCache.getCacheSet(key);
|
||||
if (CollectionUtils.isEmpty(cacheSet)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return scadaGalleryMapper.selectScadaGalleryByIdSet(cacheSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<ScadaHistoryModelVO>> listThingsModelHistory(ThingsModelHistoryParam param) {
|
||||
String serialNumber = param.getSerialNumber();
|
||||
List<ThingsModelHistoryParam.ThingsModelSim> thingsModelList = param.getThingsModelList();
|
||||
if (CollectionUtils.isEmpty(thingsModelList)) {
|
||||
return new HashMap<>(2);
|
||||
}
|
||||
List<ScadaHistoryModelVO> historyModelList = new ArrayList<>();
|
||||
List<String> propertyIdentifierList = thingsModelList.stream().filter(t -> 1 == t.getType()).map(ThingsModelHistoryParam.ThingsModelSim::getIdentifier).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(propertyIdentifierList)) {
|
||||
DeviceLog deviceLog = new DeviceLog();
|
||||
deviceLog.setIdentityList(propertyIdentifierList);
|
||||
deviceLog.setSerialNumber(serialNumber);
|
||||
deviceLog.setBeginTime(param.getBeginTime());
|
||||
deviceLog.setEndTime(param.getEndTime());
|
||||
List<HistoryModel> historyModelList1 = deviceLogService.listHistory(deviceLog);
|
||||
for (HistoryModel historyModel : historyModelList1) {
|
||||
ScadaHistoryModelVO scadaHistoryModelVO = new ScadaHistoryModelVO();
|
||||
BeanUtils.copyProperties(historyModel, scadaHistoryModelVO);
|
||||
historyModelList.add(scadaHistoryModelVO);
|
||||
}
|
||||
}
|
||||
List<String> functionIdentifierList = thingsModelList.stream().filter(t -> 2 == t.getType()).map(ThingsModelHistoryParam.ThingsModelSim::getIdentifier).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(functionIdentifierList)) {
|
||||
FunctionLog functionLog = new FunctionLog();
|
||||
functionLog.setIdentifyList(functionIdentifierList);
|
||||
functionLog.setSerialNumber(serialNumber);
|
||||
functionLog.setBeginTime(DateUtils.dateTime(DateUtils.YY_MM_DD_HH_MM_SS, param.getBeginTime()));
|
||||
functionLog.setEndTime(DateUtils.dateTime(DateUtils.YY_MM_DD_HH_MM_SS, param.getEndTime()));
|
||||
historyModelList.addAll(scadaMapper.listFunctionLogHistory(functionLog));
|
||||
}
|
||||
List<String> eventIdentifierList = thingsModelList.stream().filter(t -> 3 == t.getType()).map(ThingsModelHistoryParam.ThingsModelSim::getIdentifier).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(eventIdentifierList)) {
|
||||
EventLog eventLog = new EventLog();
|
||||
eventLog.setIdentityList(eventIdentifierList);
|
||||
eventLog.setSerialNumber(serialNumber);
|
||||
Map<String, Object> params = new HashMap<>(2);
|
||||
params.put("beginTime", param.getBeginTime());
|
||||
params.put("endTime",param.getEndTime());
|
||||
eventLog.setParams(params);
|
||||
historyModelList.addAll(scadaMapper.listEventLogHistory(eventLog));
|
||||
}
|
||||
// 分组
|
||||
return historyModelList.stream().collect(Collectors.groupingBy(ScadaHistoryModelVO::getIdentity));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getStatusBySerialNumber(String serialNumber) {
|
||||
return scadaMapper.getStatusBySerialNumber(serialNumber);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScadaStatisticVO selectStatistic() {
|
||||
Long tenantId = null;
|
||||
Long userId = null;
|
||||
SysUser user = getLoginUser().getUser();
|
||||
List<SysRole> roles = user.getRoles();
|
||||
for (int i = 0; i < roles.size(); i++) {
|
||||
if (roles.get(i).getRoleKey().equals("tenant")) {
|
||||
// 租户查看产品下所有设备
|
||||
tenantId = user.getUserId();
|
||||
} else if (roles.get(i).getRoleKey().equals("general")) {
|
||||
// 用户查看自己设备
|
||||
userId = user.getUserId();
|
||||
}
|
||||
}
|
||||
// 获取设备、产品和告警数量
|
||||
ScadaStatisticVO statistic = scadaMapper.selectDeviceProductAlertCount(tenantId, userId);
|
||||
if (statistic == null) {
|
||||
statistic = new ScadaStatisticVO();
|
||||
return statistic;
|
||||
}
|
||||
return statistic;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.xinda.scada.utils;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
|
||||
/**
|
||||
* @author fastb
|
||||
* @version 1.0
|
||||
* @description: TODO
|
||||
* @date 2023-12-26 9:27
|
||||
*/
|
||||
public class ScadaBase64ToMultipartFile implements MultipartFile {
|
||||
private final byte[] fileContent;
|
||||
|
||||
private final String extension;
|
||||
private final String contentType;
|
||||
|
||||
|
||||
/**
|
||||
* @param base64
|
||||
* @param dataUri 格式类似于: data:image/png;base64
|
||||
*/
|
||||
public ScadaBase64ToMultipartFile(String base64, String dataUri) {
|
||||
this.fileContent = Base64.getDecoder().decode(base64.getBytes(StandardCharsets.UTF_8));
|
||||
this.extension = dataUri.split(";")[0].split("/")[1];
|
||||
this.contentType = dataUri.split(";")[0].split(":")[1];
|
||||
}
|
||||
|
||||
public ScadaBase64ToMultipartFile(String base64, String extension, String contentType) {
|
||||
this.fileContent = Base64.getDecoder().decode(base64.getBytes(StandardCharsets.UTF_8));
|
||||
this.extension = extension;
|
||||
this.contentType = contentType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "param_" + System.currentTimeMillis();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOriginalFilename() {
|
||||
return "file_" + System.currentTimeMillis() + "." + extension;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContentType() {
|
||||
return contentType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return fileContent == null || fileContent.length == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSize() {
|
||||
return fileContent.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getBytes() throws IOException {
|
||||
return fileContent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getInputStream() throws IOException {
|
||||
return new ByteArrayInputStream(fileContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transferTo(File file) throws IOException, IllegalStateException {
|
||||
try (FileOutputStream fos = new FileOutputStream(file)) {
|
||||
fos.write(fileContent);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.xinda.scada.utils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fastb
|
||||
* @version 1.0
|
||||
* @description: 组态集合工具类
|
||||
* @date 2024-03-29 15:01
|
||||
*/
|
||||
public class ScadaCollectionUtils {
|
||||
|
||||
/**
|
||||
* 开始分页
|
||||
*
|
||||
* @param list 传入的list集合
|
||||
* @param pageNum 页码
|
||||
* @param pageSize 每页多少条数据
|
||||
* @return
|
||||
*/
|
||||
public static List startPage(List list, Integer pageNum,
|
||||
Integer pageSize) {
|
||||
if (list == null) {
|
||||
return null;
|
||||
}
|
||||
if (list.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
Integer count = list.size(); // 记录总数
|
||||
Integer pageCount = 0; // 页数
|
||||
if (count % pageSize == 0) {
|
||||
pageCount = count / pageSize;
|
||||
} else {
|
||||
pageCount = count / pageSize + 1;
|
||||
}
|
||||
int fromIndex = 0; // 开始索引
|
||||
int toIndex = 0; // 结束索引
|
||||
if (!pageNum.equals(pageCount)) {
|
||||
fromIndex = (pageNum - 1) * pageSize;
|
||||
toIndex = fromIndex + pageSize;
|
||||
} else {
|
||||
fromIndex = (pageNum - 1) * pageSize;
|
||||
toIndex = count;
|
||||
}
|
||||
List pageList = list.subList(fromIndex, toIndex);
|
||||
return pageList;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.xinda.scada.utils;
|
||||
|
||||
/**
|
||||
* @author fastb
|
||||
* @version 1.0
|
||||
* @description: 组态常量类
|
||||
* @date 2024-01-02 14:40
|
||||
*/
|
||||
public class ScadaConstant {
|
||||
|
||||
public static final String COMPONENT_TEMPLATE_DEFAULT = "<div id=\"app\" class=\"h2-text\">\n <h2>自定义组件案例</h2>\n <h4>支持element ui、样式自定义、vue的语法等</h4>\n <el-button type=\"primary\" @click=\"handleClick\">点击按钮</el-button>\n</div>";
|
||||
public static final String COMPONENT_SCRIPT_DEFAULT = "export default {\n data() {\n return {}\n },\n created() {\n\n },\n mounted(){\n\n },\n methods:{\n handleClick(){\n this.$message('这是一条消息提示');\n }\n }\n}";
|
||||
public static final String COMPONENT_STYLE_DEFAULT = "h2 {\n color:#409EFF\n}\n\nh4 {\n color:#F56C6C\n}";
|
||||
}
|
||||
@@ -0,0 +1,234 @@
|
||||
package com.xinda.scada.utils;
|
||||
|
||||
import com.xinda.common.config.RuoYiConfig;
|
||||
import com.xinda.common.constant.Constants;
|
||||
import com.xinda.common.exception.file.FileNameLengthLimitExceededException;
|
||||
import com.xinda.common.exception.file.FileSizeLimitExceededException;
|
||||
import com.xinda.common.exception.file.InvalidExtensionException;
|
||||
import com.xinda.common.utils.DateUtils;
|
||||
import com.xinda.common.utils.StringUtils;
|
||||
import com.xinda.common.utils.file.MimeTypeUtils;
|
||||
import com.xinda.common.utils.uuid.Seq;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 文件上传工具类
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class ScadaFileUploadUtils
|
||||
{
|
||||
/**
|
||||
* 默认大小 50M
|
||||
*/
|
||||
public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024;
|
||||
|
||||
/**
|
||||
* 默认的文件名最大长度 100
|
||||
*/
|
||||
public static final int DEFAULT_FILE_NAME_LENGTH = 100;
|
||||
|
||||
/**
|
||||
* 默认上传的地址
|
||||
*/
|
||||
private static String defaultBaseDir = RuoYiConfig.getProfile();
|
||||
|
||||
public static void setDefaultBaseDir(String defaultBaseDir)
|
||||
{
|
||||
ScadaFileUploadUtils.defaultBaseDir = defaultBaseDir;
|
||||
}
|
||||
|
||||
public static String getDefaultBaseDir()
|
||||
{
|
||||
return defaultBaseDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* 以默认配置进行文件上传
|
||||
*
|
||||
* @param file 上传的文件
|
||||
* @return 文件名称
|
||||
* @throws Exception
|
||||
*/
|
||||
public static final String upload(MultipartFile file) throws IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
return upload(getDefaultBaseDir(), file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new IOException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据文件路径上传
|
||||
*
|
||||
* @param baseDir 相对应用的基目录
|
||||
* @param file 上传的文件
|
||||
* @return 文件名称
|
||||
* @throws IOException
|
||||
*/
|
||||
public static final String upload(String baseDir, MultipartFile file) throws IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
return upload(baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new IOException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
*
|
||||
* @param baseDir 相对应用的基目录
|
||||
* @param file 上传的文件
|
||||
* @param allowedExtension 上传文件类型
|
||||
* @return 返回上传成功的文件名
|
||||
* @throws FileSizeLimitExceededException 如果超出最大大小
|
||||
* @throws FileNameLengthLimitExceededException 文件名太长
|
||||
* @throws IOException 比如读写文件出错时
|
||||
* @throws InvalidExtensionException 文件校验异常
|
||||
*/
|
||||
public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension)
|
||||
throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException,
|
||||
InvalidExtensionException
|
||||
{
|
||||
int fileNamelength = Objects.requireNonNull(file.getOriginalFilename()).length();
|
||||
if (fileNamelength > ScadaFileUploadUtils.DEFAULT_FILE_NAME_LENGTH)
|
||||
{
|
||||
throw new FileNameLengthLimitExceededException(ScadaFileUploadUtils.DEFAULT_FILE_NAME_LENGTH);
|
||||
}
|
||||
|
||||
assertAllowed(file, allowedExtension);
|
||||
|
||||
String fileName = extractFilename(file);
|
||||
|
||||
String absPath = getAbsoluteFile(baseDir, fileName).getAbsolutePath();
|
||||
file.transferTo(Paths.get(absPath));
|
||||
return getPathFileName(baseDir, fileName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编码文件名
|
||||
*/
|
||||
public static final String extractFilename(MultipartFile file)
|
||||
{
|
||||
return StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(),
|
||||
FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), getExtension(file));
|
||||
}
|
||||
|
||||
public static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException
|
||||
{
|
||||
File desc = new File(uploadDir + File.separator + fileName);
|
||||
|
||||
if (!desc.exists())
|
||||
{
|
||||
if (!desc.getParentFile().exists())
|
||||
{
|
||||
desc.getParentFile().mkdirs();
|
||||
}
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
|
||||
public static final String getPathFileName(String uploadDir, String fileName) throws IOException
|
||||
{
|
||||
int dirLastIndex = RuoYiConfig.getProfile().length() + 1;
|
||||
String currentDir = StringUtils.substring(uploadDir, dirLastIndex);
|
||||
return Constants.RESOURCE_PREFIX + "/" + currentDir + "/" + fileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件大小校验
|
||||
*
|
||||
* @param file 上传的文件
|
||||
* @return
|
||||
* @throws FileSizeLimitExceededException 如果超出最大大小
|
||||
* @throws InvalidExtensionException
|
||||
*/
|
||||
public static final void assertAllowed(MultipartFile file, String[] allowedExtension)
|
||||
throws FileSizeLimitExceededException, InvalidExtensionException
|
||||
{
|
||||
long size = file.getSize();
|
||||
if (size > DEFAULT_MAX_SIZE)
|
||||
{
|
||||
throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024);
|
||||
}
|
||||
|
||||
String fileName = file.getOriginalFilename();
|
||||
String extension = getExtension(file);
|
||||
if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension))
|
||||
{
|
||||
if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION)
|
||||
{
|
||||
throw new InvalidExtensionException.InvalidImageExtensionException(allowedExtension, extension,
|
||||
fileName);
|
||||
}
|
||||
else if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION)
|
||||
{
|
||||
throw new InvalidExtensionException.InvalidFlashExtensionException(allowedExtension, extension,
|
||||
fileName);
|
||||
}
|
||||
else if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION)
|
||||
{
|
||||
throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension,
|
||||
fileName);
|
||||
}
|
||||
else if (allowedExtension == MimeTypeUtils.VIDEO_EXTENSION)
|
||||
{
|
||||
throw new InvalidExtensionException.InvalidVideoExtensionException(allowedExtension, extension,
|
||||
fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidExtensionException(allowedExtension, extension, fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断MIME类型是否是允许的MIME类型
|
||||
*
|
||||
* @param extension
|
||||
* @param allowedExtension
|
||||
* @return
|
||||
*/
|
||||
public static final boolean isAllowedExtension(String extension, String[] allowedExtension)
|
||||
{
|
||||
for (String str : allowedExtension)
|
||||
{
|
||||
if (str.equalsIgnoreCase(extension))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件名的后缀
|
||||
*
|
||||
* @param file 表单文件
|
||||
* @return 后缀名
|
||||
*/
|
||||
public static final String getExtension(MultipartFile file)
|
||||
{
|
||||
String extension = FilenameUtils.getExtension(file.getOriginalFilename());
|
||||
if (StringUtils.isEmpty(extension))
|
||||
{
|
||||
extension = MimeTypeUtils.getExtension(Objects.requireNonNull(file.getContentType()));
|
||||
}
|
||||
return extension;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.xinda.scada.utils;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* @author fastb
|
||||
* @version 1.0
|
||||
* @description: 组态文件工具类
|
||||
* @date 2024-03-29 14:55
|
||||
*/
|
||||
public class ScadaFileUtils {
|
||||
|
||||
public static MultipartFile base64toMultipartFile(String base64) {
|
||||
final String[] base64Array = base64.split(",");
|
||||
String dataUir, data;
|
||||
if (base64Array.length > 1) {
|
||||
dataUir = base64Array[0];
|
||||
data = base64Array[1];
|
||||
} else {
|
||||
//根据你base64代表的具体文件构建
|
||||
dataUir = "data:image/png;base64";
|
||||
data = base64Array[0];
|
||||
}
|
||||
return new ScadaBase64ToMultipartFile(data, dataUir);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.xinda.scada.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 设备关联物模型VO
|
||||
* @author fastb
|
||||
* @date 2023-11-14 10:46
|
||||
*/
|
||||
@Data
|
||||
public class DeviceRealDataVO {
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
private String serialNumber;
|
||||
|
||||
/**
|
||||
* 模型名称
|
||||
*/
|
||||
private String modelName;
|
||||
|
||||
/**
|
||||
* 物模型标识
|
||||
*/
|
||||
private String identifier;
|
||||
|
||||
/**
|
||||
* 产品id
|
||||
*/
|
||||
private Long productId;
|
||||
|
||||
/**
|
||||
* 设备在线状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 物模型单位
|
||||
*/
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 物模型类别
|
||||
*/
|
||||
private Integer type;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.xinda.scada.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author fastb
|
||||
* @version 1.0
|
||||
* @description: 收藏传参类
|
||||
* @date 2024-01-17 17:02
|
||||
*/
|
||||
@Data
|
||||
public class FavoritesVO {
|
||||
|
||||
private String idStr;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.xinda.scada.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author fastb
|
||||
* @date 2023-11-13 16:44
|
||||
*/
|
||||
@Data
|
||||
public class ScadaBindDeviceSimVO {
|
||||
|
||||
|
||||
/** 设备编号 */
|
||||
private String serialNumber;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 产品id
|
||||
*/
|
||||
private Long productId;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.xinda.scada.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author fastb
|
||||
* @date 2023-11-13 17:39
|
||||
*/
|
||||
@Data
|
||||
public class ScadaDeviceBindDTO {
|
||||
|
||||
private String scadaGuid;
|
||||
|
||||
private String serialNumbers;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.xinda.scada.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author fastb
|
||||
* @date 2023-11-13 16:44
|
||||
*/
|
||||
@Data
|
||||
public class ScadaDeviceBindVO {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/** 设备编号 */
|
||||
private String serialNumber;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
private String deviceName;
|
||||
|
||||
/** 组态guid */
|
||||
private String scadaGuid;
|
||||
|
||||
/**
|
||||
* 产品id
|
||||
*/
|
||||
private Long productId;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.xinda.scada.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author bill
|
||||
*/
|
||||
@Data
|
||||
public class ScadaHistoryModelVO {
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date time;
|
||||
|
||||
private String value;
|
||||
|
||||
private String identity;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.xinda.scada.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* id和name
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
@Data
|
||||
public class ScadaStatisticVO
|
||||
{
|
||||
/** 设备数量 **/
|
||||
private Integer deviceCount;
|
||||
|
||||
/** 设备数量 **/
|
||||
private Integer deviceOnlineCount;
|
||||
|
||||
/** 产品数量 **/
|
||||
private Integer productCount;
|
||||
|
||||
/** 告警 **/
|
||||
private Long alertCount;
|
||||
|
||||
/** 属性上报 **/
|
||||
private Long propertyCount;
|
||||
|
||||
/** 功能上报 **/
|
||||
private Long functionCount;
|
||||
|
||||
/** 事件上报 **/
|
||||
private Long eventCount;
|
||||
|
||||
/** 监测数据上报 **/
|
||||
private Long monitorCount;
|
||||
|
||||
/** 告警设备数量 **/
|
||||
private Long alertDeviceCount;
|
||||
|
||||
/** 设备离线数量 **/
|
||||
private Integer deviceOfflineCount;
|
||||
|
||||
/** 告警未处理数量 **/
|
||||
private Long alertNotProcessedCount;
|
||||
|
||||
/** 告警已处理数量 **/
|
||||
private Long alertProcessedCount;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.xinda.scada.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fastb
|
||||
* @version 1.0
|
||||
* @description: TODO
|
||||
* @date 2024-02-23 16:47
|
||||
*/
|
||||
@Data
|
||||
public class ThingsModelHistoryParam {
|
||||
|
||||
private String serialNumber;
|
||||
|
||||
/** 创建时间 */
|
||||
private String beginTime;
|
||||
/** 创建时间 */
|
||||
private String endTime;
|
||||
|
||||
private List<ThingsModelSim> thingsModelList;
|
||||
|
||||
@Data
|
||||
public static class ThingsModelSim{
|
||||
|
||||
private String identifier;
|
||||
|
||||
private Integer type;
|
||||
}
|
||||
|
||||
}
|
||||
116
xinda-scada/src/main/resources/mapper/ScadaComponentMapper.xml
Normal file
116
xinda-scada/src/main/resources/mapper/ScadaComponentMapper.xml
Normal file
@@ -0,0 +1,116 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xinda.scada.mapper.ScadaComponentMapper">
|
||||
|
||||
<resultMap type="ScadaComponent" id="ScadaComponentResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="componentName" column="component_name" />
|
||||
<result property="componentTemplate" column="component_template" />
|
||||
<result property="componentStyle" column="component_style" />
|
||||
<result property="componentScript" column="component_script" />
|
||||
<result property="componentImage" column="component_image" />
|
||||
<result property="tenantId" column="tenant_id" />
|
||||
<result property="tenantName" column="tenant_name" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="isShare" column="is_share" />
|
||||
<result property="userId" column="user_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScadaComponentVo">
|
||||
select id, component_name, component_template, component_style, component_script, component_image, tenant_id, tenant_name, create_by, create_time, update_by, update_time, del_flag, is_share, user_id from scada_component
|
||||
</sql>
|
||||
|
||||
<select id="selectScadaComponentList" parameterType="ScadaComponent" resultMap="ScadaComponentResult">
|
||||
<include refid="selectScadaComponentVo"/>
|
||||
<where>
|
||||
<if test="componentName != null and componentName != ''"> and component_name like concat('%', #{componentName}, '%')</if>
|
||||
<if test="componentTemplate != null and componentTemplate != ''"> and component_template = #{componentTemplate}</if>
|
||||
<if test="componentStyle != null and componentStyle != ''"> and component_style = #{componentStyle}</if>
|
||||
<if test="componentScript != null and componentScript != ''"> and component_script = #{componentScript}</if>
|
||||
<if test="componentImage != null and componentImage != ''"> and component_image = #{componentImage}</if>
|
||||
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
|
||||
<if test="tenantName != null and tenantName != ''"> and tenant_name like concat('%', #{tenantName}, '%')</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectScadaComponentById" parameterType="Long" resultMap="ScadaComponentResult">
|
||||
<include refid="selectScadaComponentVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertScadaComponent" parameterType="ScadaComponent">
|
||||
insert into scada_component
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="componentName != null">component_name,</if>
|
||||
<if test="componentTemplate != null">component_template,</if>
|
||||
<if test="componentStyle != null">component_style,</if>
|
||||
<if test="componentScript != null">component_script,</if>
|
||||
<if test="componentImage != null">component_image,</if>
|
||||
<if test="tenantId != null">tenant_id,</if>
|
||||
<if test="tenantName != null">tenant_name,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
<if test="isShare != null">is_share,</if>
|
||||
<if test="userId != null">user_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="componentName != null">#{componentName},</if>
|
||||
<if test="componentTemplate != null">#{componentTemplate},</if>
|
||||
<if test="componentStyle != null">#{componentStyle},</if>
|
||||
<if test="componentScript != null">#{componentScript},</if>
|
||||
<if test="componentImage != null">#{componentImage},</if>
|
||||
<if test="tenantId != null">#{tenantId},</if>
|
||||
<if test="tenantName != null">#{tenantName},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
<if test="isShare != null">#{isShare},</if>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateScadaComponent" parameterType="ScadaComponent">
|
||||
update scada_component
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="componentName != null">component_name = #{componentName},</if>
|
||||
<if test="componentTemplate != null">component_template = #{componentTemplate},</if>
|
||||
<if test="componentStyle != null">component_style = #{componentStyle},</if>
|
||||
<if test="componentScript != null">component_script = #{componentScript},</if>
|
||||
<if test="componentImage != null">component_image = #{componentImage},</if>
|
||||
<if test="tenantId != null">tenant_id = #{tenantId},</if>
|
||||
<if test="tenantName != null">tenant_name = #{tenantName},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
<if test="isShare != null">is_share = #{isShare},</if>
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteScadaComponentById" parameterType="Long">
|
||||
delete from scada_component where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteScadaComponentByIds" parameterType="String">
|
||||
delete from scada_component where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xinda.scada.mapper.ScadaDeviceBindMapper">
|
||||
|
||||
<resultMap type="ScadaDeviceBind" id="ScadaDeviceBindResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="serialNumber" column="serial_number" />
|
||||
<result property="scadaGuid" column="scada_guid" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScadaDeviceBindVo">
|
||||
select id, serial_number, scada_guid from scada_device_bind
|
||||
</sql>
|
||||
|
||||
<select id="selectScadaDeviceBindList" parameterType="ScadaDeviceBind" resultMap="ScadaDeviceBindResult">
|
||||
<include refid="selectScadaDeviceBindVo"/>
|
||||
<where>
|
||||
<if test="serialNumber != null and serialNumber != ''"> and serial_number = #{serialNumber}</if>
|
||||
<if test="scadaGuid != null and scadaGuid != ''"> and scada_guid = #{scadaGuid}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectScadaDeviceBindById" parameterType="Long" resultMap="ScadaDeviceBindResult">
|
||||
<include refid="selectScadaDeviceBindVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="listByGuidAndSerialNumber" resultType="com.xinda.scada.domain.ScadaDeviceBind">
|
||||
<include refid="selectScadaDeviceBindVo"/>
|
||||
where scada_guid = #{scadaGuid}
|
||||
and serial_number in
|
||||
<foreach collection="serialNumberList" separator="," open="(" close=")" item="serialNumber">
|
||||
#{serialNumber}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="listDeviceSimByGuid" resultType="com.xinda.scada.vo.ScadaBindDeviceSimVO">
|
||||
select s.serial_number, d.device_name, d.product_id
|
||||
from scada_device_bind s left join iot_device d on s.serial_number = d.serial_number
|
||||
where s.scada_guid = #{guid}
|
||||
</select>
|
||||
|
||||
<insert id="insertScadaDeviceBind" parameterType="ScadaDeviceBind" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into scada_device_bind
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="serialNumber != null">serial_number,</if>
|
||||
<if test="scadaGuid != null">scada_guid,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="serialNumber != null">#{serialNumber},</if>
|
||||
<if test="scadaGuid != null">#{scadaGuid},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateScadaDeviceBind" parameterType="ScadaDeviceBind">
|
||||
update scada_device_bind
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="serialNumber != null">serial_number = #{serialNumber},</if>
|
||||
<if test="scadaGuid != null">scada_guid = #{scadaGuid},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteScadaDeviceBindById" parameterType="Long">
|
||||
delete from scada_device_bind where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteScadaDeviceBindByIds" parameterType="String">
|
||||
delete from scada_device_bind where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
106
xinda-scada/src/main/resources/mapper/ScadaEchartMapper.xml
Normal file
106
xinda-scada/src/main/resources/mapper/ScadaEchartMapper.xml
Normal file
@@ -0,0 +1,106 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xinda.scada.mapper.ScadaEchartMapper">
|
||||
|
||||
<resultMap type="ScadaEchart" id="ScadaEchartResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="guid" column="guid" />
|
||||
<result property="echartName" column="echart_name" />
|
||||
<result property="echartType" column="echart_type" />
|
||||
<result property="echartData" column="echart_data" />
|
||||
<result property="echartImgae" column="echart_imgae" />
|
||||
<result property="tenantId" column="tenant_id" />
|
||||
<result property="tenantName" column="tenant_name" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScadaEchartVo">
|
||||
select id, guid, echart_name, echart_type, echart_data, echart_imgae, tenant_id, tenant_name, create_by, create_time, update_by, update_time, del_flag from scada_echart
|
||||
</sql>
|
||||
|
||||
<select id="selectScadaEchartList" parameterType="ScadaEchart" resultMap="ScadaEchartResult">
|
||||
<include refid="selectScadaEchartVo"/>
|
||||
<where>
|
||||
<if test="guid != null and guid != ''"> and guid = #{guid}</if>
|
||||
<if test="echartName != null and echartName != ''"> and echart_name like concat('%', #{echartName}, '%')</if>
|
||||
<if test="echartType != null and echartType != ''"> and echart_type = #{echartType}</if>
|
||||
<if test="echartData != null and echartData != ''"> and echart_data = #{echartData}</if>
|
||||
<if test="echartImgae != null and echartImgae != ''"> and echart_imgae = #{echartImgae}</if>
|
||||
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
|
||||
<if test="tenantName != null and tenantName != ''"> and tenant_name like concat('%', #{tenantName}, '%')</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectScadaEchartById" parameterType="Long" resultMap="ScadaEchartResult">
|
||||
<include refid="selectScadaEchartVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertScadaEchart" parameterType="ScadaEchart" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into scada_echart
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="guid != null">guid,</if>
|
||||
<if test="echartName != null">echart_name,</if>
|
||||
<if test="echartType != null">echart_type,</if>
|
||||
<if test="echartData != null">echart_data,</if>
|
||||
<if test="echartImgae != null">echart_imgae,</if>
|
||||
<if test="tenantId != null">tenant_id,</if>
|
||||
<if test="tenantName != null">tenant_name,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="guid != null">#{guid},</if>
|
||||
<if test="echartName != null">#{echartName},</if>
|
||||
<if test="echartType != null">#{echartType},</if>
|
||||
<if test="echartData != null">#{echartData},</if>
|
||||
<if test="echartImgae != null">#{echartImgae},</if>
|
||||
<if test="tenantId != null">#{tenantId},</if>
|
||||
<if test="tenantName != null">#{tenantName},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateScadaEchart" parameterType="ScadaEchart">
|
||||
update scada_echart
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="guid != null">guid = #{guid},</if>
|
||||
<if test="echartName != null">echart_name = #{echartName},</if>
|
||||
<if test="echartType != null">echart_type = #{echartType},</if>
|
||||
<if test="echartData != null">echart_data = #{echartData},</if>
|
||||
<if test="echartImgae != null">echart_imgae = #{echartImgae},</if>
|
||||
<if test="tenantId != null">tenant_id = #{tenantId},</if>
|
||||
<if test="tenantName != null">tenant_name = #{tenantName},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteScadaEchartById" parameterType="Long">
|
||||
delete from scada_echart where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteScadaEchartByIds" parameterType="String">
|
||||
delete from scada_echart where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
106
xinda-scada/src/main/resources/mapper/ScadaGalleryMapper.xml
Normal file
106
xinda-scada/src/main/resources/mapper/ScadaGalleryMapper.xml
Normal file
@@ -0,0 +1,106 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xinda.scada.mapper.ScadaGalleryMapper">
|
||||
|
||||
<resultMap type="ScadaGallery" id="ScadaGalleryResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="fileName" column="file_name" />
|
||||
<result property="categoryName" column="category_name" />
|
||||
<result property="resourceUrl" column="resource_url" />
|
||||
<result property="tenantId" column="tenant_id" />
|
||||
<result property="tenantName" column="tenant_name" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScadaGalleryVo">
|
||||
select id, file_name, category_name, resource_url, tenant_id, tenant_name, create_by, create_time, update_by, update_time, del_flag from scada_gallery
|
||||
</sql>
|
||||
|
||||
<select id="selectScadaGalleryList" parameterType="ScadaGallery" resultMap="ScadaGalleryResult">
|
||||
<include refid="selectScadaGalleryVo"/>
|
||||
<where>
|
||||
<if test="fileName != null and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
|
||||
<if test="categoryName != null and categoryName != ''"> and category_name like concat('%', #{categoryName}, '%')</if>
|
||||
<if test="resourceUrl != null and resourceUrl != ''"> and resource_url = #{resourceUrl}</if>
|
||||
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
|
||||
<if test="tenantName != null and tenantName != ''"> and tenant_name like concat('%', #{tenantName}, '%')</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectScadaGalleryById" parameterType="Long" resultMap="ScadaGalleryResult">
|
||||
<include refid="selectScadaGalleryVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectScadaGalleryByIdSet" parameterType="java.util.Set" resultMap="ScadaGalleryResult">
|
||||
<include refid="selectScadaGalleryVo"/>
|
||||
<where>
|
||||
id in
|
||||
<foreach collection="collection" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertScadaGallery" parameterType="ScadaGallery" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into scada_gallery
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="fileName != null">file_name,</if>
|
||||
<if test="categoryName != null">category_name,</if>
|
||||
<if test="resourceUrl != null">resource_url,</if>
|
||||
<if test="tenantId != null">tenant_id,</if>
|
||||
<if test="tenantName != null">tenant_name,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="fileName != null">#{fileName},</if>
|
||||
<if test="categoryName != null">#{categoryName},</if>
|
||||
<if test="resourceUrl != null">#{resourceUrl},</if>
|
||||
<if test="tenantId != null">#{tenantId},</if>
|
||||
<if test="tenantName != null">#{tenantName},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateScadaGallery" parameterType="ScadaGallery">
|
||||
update scada_gallery
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="fileName != null">file_name = #{fileName},</if>
|
||||
<if test="categoryName != null">category_name = #{categoryName},</if>
|
||||
<if test="resourceUrl != null">resource_url = #{resourceUrl},</if>
|
||||
<if test="tenantId != null">tenant_id = #{tenantId},</if>
|
||||
<if test="tenantName != null">tenant_name = #{tenantName},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteScadaGalleryById" parameterType="Long">
|
||||
delete from scada_gallery where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteScadaGalleryByIds" parameterType="String">
|
||||
delete from scada_gallery where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
287
xinda-scada/src/main/resources/mapper/ScadaMapper.xml
Normal file
287
xinda-scada/src/main/resources/mapper/ScadaMapper.xml
Normal file
@@ -0,0 +1,287 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xinda.scada.mapper.ScadaMapper">
|
||||
|
||||
<resultMap type="Scada" id="ScadaResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="guid" column="guid" />
|
||||
<result property="scadaData" column="scada_data" />
|
||||
<result property="serialNumbers" column="serial_numbers" />
|
||||
<result property="deviceName" column="device_name" />
|
||||
<result property="isMainPage" column="is_main_page" />
|
||||
<result property="pageName" column="page_name" />
|
||||
<result property="pageResolution" column="page_resolution" />
|
||||
<result property="isShare" column="is_share" />
|
||||
<result property="shareUrl" column="share_url" />
|
||||
<result property="sharePass" column="share_pass" />
|
||||
<result property="pageImage" column="page_image" />
|
||||
<result property="tenantId" column="tenant_id" />
|
||||
<result property="tenantName" column="tenant_name" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScadaVo">
|
||||
select id, guid, scada_data, serial_numbers, device_name, is_main_page, page_name, page_resolution, is_share, share_url, share_pass, page_image, tenant_id, tenant_name, create_by, create_time, update_by, update_time, del_flag from scada
|
||||
</sql>
|
||||
|
||||
<select id="selectScadaList" parameterType="Scada" resultMap="ScadaResult">
|
||||
<include refid="selectScadaVo"/>
|
||||
<where>
|
||||
<if test="guid != null and guid != ''"> and guid = #{guid}</if>
|
||||
<if test="scadaData != null and scadaData != ''"> and scada_data = #{scadaData}</if>
|
||||
<if test="serialNumbers != null and serialNumbers != ''"> and serial_numbers = #{serialNumbers}</if>
|
||||
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
|
||||
<if test="isMainPage != null "> and is_main_page = #{isMainPage}</if>
|
||||
<if test="pageName != null and pageName != ''"> and page_name like concat('%', #{pageName}, '%')</if>
|
||||
<if test="pageResolution != null and pageResolution != ''"> and page_resolution = #{pageResolution}</if>
|
||||
<if test="isShare != null "> and is_share = #{isShare}</if>
|
||||
<if test="shareUrl != null and shareUrl != ''"> and share_url = #{shareUrl}</if>
|
||||
<if test="sharePass != null and sharePass != ''"> and share_pass = #{sharePass}</if>
|
||||
<if test="pageImage != null and pageImage != ''"> and page_image = #{pageImage}</if>
|
||||
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
|
||||
<if test="tenantName != null and tenantName != ''"> and tenant_name like concat('%', #{tenantName}, '%')</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectScadaById" parameterType="Long" resultMap="ScadaResult">
|
||||
<include refid="selectScadaVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectScadaByGuid" resultType="com.xinda.scada.domain.Scada">
|
||||
<include refid="selectScadaVo"/>
|
||||
where guid = #{guid}
|
||||
</select>
|
||||
|
||||
<select id="getStatusBySerialNumber" resultType="java.lang.Integer">
|
||||
select status
|
||||
from iot_device
|
||||
where serial_number = #{serialNumber}
|
||||
</select>
|
||||
|
||||
<select id="selectDeviceProductAlertCount" resultType="com.xinda.scada.vo.ScadaStatisticVO">
|
||||
select
|
||||
<!--设备数量-->
|
||||
(select count(distinct d.device_id,d.user_id)
|
||||
from iot_device d
|
||||
inner join iot_device_user u on u.device_id = d.device_id
|
||||
<where>
|
||||
<if test="userId != null and userId != 0"> and u.user_id = #{userId}</if>
|
||||
<if test="tenantId != null and tenantId != 0"> and d.tenant_id = #{tenantId}</if>
|
||||
</where>
|
||||
) as deviceCount,
|
||||
|
||||
<!--在线设备数量-->
|
||||
(select count(distinct d.device_id,d.user_id)
|
||||
from iot_device d
|
||||
inner join iot_device_user u on u.device_id = d.device_id
|
||||
<where>
|
||||
d.status=3
|
||||
<if test="userId != null and userId != 0"> and u.user_id = #{userId}</if>
|
||||
<if test="tenantId != null and tenantId != 0"> and d.tenant_id = #{tenantId}</if>
|
||||
</where>
|
||||
) as deviceOnlineCount,
|
||||
|
||||
(
|
||||
<!--普通用户查询设备中的产品数量-->
|
||||
<if test="userId != null and userId != 0">
|
||||
select count(distinct product_id)
|
||||
from iot_device
|
||||
where user_id = #{userId}
|
||||
</if>
|
||||
<!--管理员和租户直接查询产品的数量-->
|
||||
<if test="userId == null || userId == 0">
|
||||
select count(product_id)
|
||||
from iot_product
|
||||
<where>
|
||||
<if test="tenantId != null and tenantId != 0"> and tenant_id = #{tenantId} </if>
|
||||
</where>
|
||||
</if>
|
||||
) as productCount,
|
||||
|
||||
<!--告警设备数量-->
|
||||
(select count(distinct l.serial_number)
|
||||
from iot_alert_log l
|
||||
left join iot_device d on l.serial_number=d.serial_number
|
||||
left join iot_device_user u on d.device_id=u.device_id
|
||||
<where>
|
||||
<if test="userId != null and userId != 0"> and u.user_id = #{userId}</if>
|
||||
<if test="tenantId != null and tenantId != 0"> and d.tenant_id = #{tenantId}</if>
|
||||
</where>
|
||||
) as alertDeviceCount,
|
||||
|
||||
<!--离线设备数量-->
|
||||
(select count(distinct d.device_id,d.user_id)
|
||||
from iot_device d
|
||||
inner join iot_device_user u on u.device_id = d.device_id
|
||||
<where>
|
||||
d.status=4
|
||||
<if test="userId != null and userId != 0"> and u.user_id = #{userId}</if>
|
||||
<if test="tenantId != null and tenantId != 0"> and d.tenant_id = #{tenantId}</if>
|
||||
</where>
|
||||
) as deviceOfflineCount,
|
||||
|
||||
<!--告警未处理数量-->
|
||||
(select count(distinct l.serial_number)
|
||||
from iot_alert_log l
|
||||
left join iot_device d on l.serial_number=d.serial_number
|
||||
left join iot_device_user u on d.device_id=u.device_id
|
||||
where l.status = 2
|
||||
<if test="userId != null and userId != 0"> and u.user_id = #{userId}</if>
|
||||
<if test="tenantId != null and tenantId != 0"> and d.tenant_id = #{tenantId}</if>
|
||||
) as alertNotProcessedCount,
|
||||
|
||||
<!--告警已处理数量-->
|
||||
(select count(distinct l.serial_number)
|
||||
from iot_alert_log l
|
||||
left join iot_device d on l.serial_number=d.serial_number
|
||||
left join iot_device_user u on d.device_id=u.device_id
|
||||
where l.status = 3
|
||||
<if test="userId != null and userId != 0"> and u.user_id = #{userId}</if>
|
||||
<if test="tenantId != null and tenantId != 0"> and d.tenant_id = #{tenantId}</if>
|
||||
) as alertProcessedCount,
|
||||
|
||||
(select count(distinct alert_log_id)
|
||||
from iot_alert_log l
|
||||
left join iot_device d on l.serial_number=d.serial_number
|
||||
left join iot_device_user u on d.device_id=u.device_id
|
||||
<where>
|
||||
<if test="userId != null and userId != 0"> and u.user_id = #{userId}</if>
|
||||
<if test="tenantId != null and tenantId != 0"> and d.tenant_id = #{tenantId}</if>
|
||||
</where>
|
||||
) as alertCount
|
||||
</select>
|
||||
|
||||
<select id="listFunctionLogHistory" resultType="com.xinda.scada.vo.ScadaHistoryModelVO">
|
||||
select fun_value as value,
|
||||
create_time as time,
|
||||
identify as identity
|
||||
from iot_function_log
|
||||
<where>
|
||||
<if test="serialNumber != null and serialNumber != ''">
|
||||
and serial_number = #{serialNumber}
|
||||
</if>
|
||||
<if test="beginTime != null and endTime != null">
|
||||
and create_time between #{beginTime} and #{endTime}
|
||||
</if>
|
||||
<if test="identifyList != null and identifyList != ''">
|
||||
and identify in
|
||||
<foreach collection="identifyList" item="identify" open="(" separator="," close=")">
|
||||
#{identify}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="listEventLogHistory" resultType="com.xinda.scada.vo.ScadaHistoryModelVO">
|
||||
select log_value as value,
|
||||
create_time as time,
|
||||
identity as identity
|
||||
from iot_event_log
|
||||
<where>
|
||||
<if test="serialNumber != null and serialNumber != ''">
|
||||
and serial_number = #{serialNumber}
|
||||
</if>
|
||||
<if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''">
|
||||
and create_time between #{params.beginTime} and #{params.endTime}
|
||||
</if>
|
||||
<if test="identityList != null and identityList != ''">
|
||||
and identity in
|
||||
<foreach collection="identityList" item="identity" open="(" separator="," close=")">
|
||||
#{identity}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<insert id="insertScada" parameterType="Scada" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into scada
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="guid != null">guid,</if>
|
||||
<if test="scadaData != null">scada_data,</if>
|
||||
<if test="serialNumbers != null">serial_numbers,</if>
|
||||
<if test="deviceName != null">device_name,</if>
|
||||
<if test="isMainPage != null">is_main_page,</if>
|
||||
<if test="pageName != null">page_name,</if>
|
||||
<if test="pageResolution != null">page_resolution,</if>
|
||||
<if test="isShare != null">is_share,</if>
|
||||
<if test="shareUrl != null">share_url,</if>
|
||||
<if test="sharePass != null">share_pass,</if>
|
||||
<if test="pageImage != null">page_image,</if>
|
||||
<if test="tenantId != null">tenant_id,</if>
|
||||
<if test="tenantName != null">tenant_name,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="guid != null">#{guid},</if>
|
||||
<if test="scadaData != null">#{scadaData},</if>
|
||||
<if test="serialNumbers != null">#{serialNumbers},</if>
|
||||
<if test="deviceName != null">#{deviceName},</if>
|
||||
<if test="isMainPage != null">#{isMainPage},</if>
|
||||
<if test="pageName != null">#{pageName},</if>
|
||||
<if test="pageResolution != null">#{pageResolution},</if>
|
||||
<if test="isShare != null">#{isShare},</if>
|
||||
<if test="shareUrl != null">#{shareUrl},</if>
|
||||
<if test="sharePass != null">#{sharePass},</if>
|
||||
<if test="pageImage != null">#{pageImage},</if>
|
||||
<if test="tenantId != null">#{tenantId},</if>
|
||||
<if test="tenantName != null">#{tenantName},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateScada" parameterType="Scada">
|
||||
update scada
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="guid != null">guid = #{guid},</if>
|
||||
<if test="scadaData != null">scada_data = #{scadaData},</if>
|
||||
<if test="serialNumbers != null">serial_numbers = #{serialNumbers},</if>
|
||||
<if test="deviceName != null">device_name = #{deviceName},</if>
|
||||
<if test="isMainPage != null">is_main_page = #{isMainPage},</if>
|
||||
<if test="pageName != null">page_name = #{pageName},</if>
|
||||
<if test="pageResolution != null">page_resolution = #{pageResolution},</if>
|
||||
<if test="isShare != null">is_share = #{isShare},</if>
|
||||
<if test="shareUrl != null">share_url = #{shareUrl},</if>
|
||||
<if test="sharePass != null">share_pass = #{sharePass},</if>
|
||||
<if test="pageImage != null">page_image = #{pageImage},</if>
|
||||
<if test="tenantId != null">tenant_id = #{tenantId},</if>
|
||||
<if test="tenantName != null">tenant_name = #{tenantName},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteScadaById" parameterType="Long">
|
||||
delete from scada where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteScadaByIds" parameterType="String">
|
||||
delete from scada where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
101
xinda-scada/src/main/resources/mapper/ScadaModelMapper.xml
Normal file
101
xinda-scada/src/main/resources/mapper/ScadaModelMapper.xml
Normal file
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xinda.scada.mapper.ScadaModelMapper">
|
||||
|
||||
<resultMap type="ScadaModel" id="ScadaModelResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="modelName" column="model_name" />
|
||||
<result property="modelUrl" column="model_url" />
|
||||
<result property="status" column="status" />
|
||||
<result property="imageUrl" column="image_url" />
|
||||
<result property="tenantId" column="tenant_id" />
|
||||
<result property="tenantName" column="tenant_name" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScadaModelVo">
|
||||
select id, model_name, model_url, status, image_url, tenant_id, tenant_name, create_by, create_time, update_by, update_time, del_flag from scada_model
|
||||
</sql>
|
||||
|
||||
<select id="selectScadaModelList" parameterType="ScadaModel" resultMap="ScadaModelResult">
|
||||
<include refid="selectScadaModelVo"/>
|
||||
<where>
|
||||
<if test="modelName != null and modelName != ''"> and model_name like concat('%', #{modelName}, '%')</if>
|
||||
<if test="modelUrl != null and modelUrl != ''"> and model_url = #{modelUrl}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
<if test="imageUrl != null and imageUrl != ''"> and image_url = #{imageUrl}</if>
|
||||
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
|
||||
<if test="tenantName != null and tenantName != ''"> and tenant_name like concat('%', #{tenantName}, '%')</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectScadaModelById" parameterType="Long" resultMap="ScadaModelResult">
|
||||
<include refid="selectScadaModelVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertScadaModel" parameterType="ScadaModel" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into scada_model
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="modelName != null">model_name,</if>
|
||||
<if test="modelUrl != null">model_url,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="imageUrl != null">image_url,</if>
|
||||
<if test="tenantId != null">tenant_id,</if>
|
||||
<if test="tenantName != null">tenant_name,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="modelName != null">#{modelName},</if>
|
||||
<if test="modelUrl != null">#{modelUrl},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="imageUrl != null">#{imageUrl},</if>
|
||||
<if test="tenantId != null">#{tenantId},</if>
|
||||
<if test="tenantName != null">#{tenantName},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateScadaModel" parameterType="ScadaModel">
|
||||
update scada_model
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="modelName != null">model_name = #{modelName},</if>
|
||||
<if test="modelUrl != null">model_url = #{modelUrl},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="imageUrl != null">image_url = #{imageUrl},</if>
|
||||
<if test="tenantId != null">tenant_id = #{tenantId},</if>
|
||||
<if test="tenantName != null">tenant_name = #{tenantName},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteScadaModelById" parameterType="Long">
|
||||
delete from scada_model where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteScadaModelByIds" parameterType="String">
|
||||
delete from scada_model where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user