#修复模型模块接口-逻辑删除不生效问题
This commit is contained in:
@@ -7,6 +7,7 @@ import com.maibu.core.business.Device;
|
||||
import com.maibu.core.business.DeviceModel;import com.maibu.core.business.DeviceRunStatistics;
|
||||
import com.maibu.core.controller.BaseController;
|
||||
import com.maibu.core.domain.AjaxResult;
|
||||
import com.maibu.core.enums.ConnectType;
|
||||
import com.maibu.core.page.TableDataInfo;
|
||||
import com.maibu.enums.BusinessType;
|
||||
import com.maibu.mapper.DeviceRunStatisticsMapper;
|
||||
@@ -33,9 +34,7 @@ import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -107,27 +106,82 @@ public class SysDeviceModelController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询支持的协议类型
|
||||
*/
|
||||
@GetMapping("/connectTypes")
|
||||
@ApiOperation("查询协议类型列表")
|
||||
public AjaxResult getConnectTypes() {
|
||||
List<Map<String, Object>> types = Arrays.stream(ConnectType.values())
|
||||
.map(type -> {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("code", type.name());
|
||||
map.put("name", type.name());
|
||||
return map;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
return AjaxResult.success(types);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询支持的协议类型
|
||||
*/
|
||||
@GetMapping("/DataTypes")
|
||||
@ApiOperation("查询数据类型列表")
|
||||
public AjaxResult getDataTypes() {
|
||||
List<Map<String, Object>> types = new ArrayList<>();
|
||||
|
||||
// 1. Java 8大基本数据类型
|
||||
types.add(createTypeMap("byte", "byte(字节型)"));
|
||||
types.add(createTypeMap("short", "short(短整型)"));
|
||||
types.add(createTypeMap("int", "int(整型)"));
|
||||
types.add(createTypeMap("long", "long(长整型)"));
|
||||
types.add(createTypeMap("float", "float(单精度浮点型)"));
|
||||
types.add(createTypeMap("double", "double(双精度浮点型)"));
|
||||
types.add(createTypeMap("char", "char(字符型)"));
|
||||
types.add(createTypeMap("boolean", "boolean(布尔型)"));
|
||||
|
||||
return AjaxResult.success(types);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 构造数据类型Map(抽成工具方法,代码更简洁)
|
||||
*/
|
||||
private Map<String, Object> createTypeMap(String code, String name) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("code", code);
|
||||
map.put("name", name);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除设备模型
|
||||
*/
|
||||
//@PreAuthorize("@ss.hasPermi('iot:deviceModel:remove')")
|
||||
@DeleteMapping("/delete/{id}")
|
||||
@ApiOperation("删除设备模型")
|
||||
@Log(title = "设备模型", businessType = BusinessType.DELETE)
|
||||
public AjaxResult remove(@PathVariable Long id) {
|
||||
if (id == null) {
|
||||
return AjaxResult.error("模型ID不能为空");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
try {
|
||||
int rows = deviceModelService.deleteDeviceModelById(id);
|
||||
return toAjax(rows);
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.maibu.web.controller.system;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.maibu.core.business.Product;
|
||||
import com.maibu.core.business.dto.ProductDTO;
|
||||
import com.maibu.core.controller.BaseController;
|
||||
import com.maibu.core.domain.AjaxResult;
|
||||
import com.maibu.core.page.TableDataInfo;
|
||||
import com.maibu.service.DeviceProductService;
|
||||
import com.maibu.utils.ServletUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 厂家模块
|
||||
*/
|
||||
@Api(tags = "物联网设备模块")
|
||||
@RestController
|
||||
@RequestMapping("/system/iotDevice")
|
||||
public class SysIotCommDeviceController extends BaseController {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -39,4 +39,11 @@ public interface SysDeviceModelService {
|
||||
* @return
|
||||
*/
|
||||
int updateDeviceModel(DeviceModel deviceModel);
|
||||
|
||||
/**
|
||||
* 删除(逻辑删除模型)
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int deleteDeviceModelById(Long id);
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user