add:设备基础信息
This commit is contained in:
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright [2022] [https://www.xiaonuo.vip]
|
||||
*
|
||||
* Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
|
||||
*
|
||||
* 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
* 2.请不要删除和修改Snowy源码头部的版权声明。
|
||||
* 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
|
||||
* 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
|
||||
* 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
|
||||
* 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
|
||||
*/
|
||||
package org.nl.modular.device.controller;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.nl.common.pojo.CommonResult;
|
||||
import org.nl.modular.device.service.dto.DeviceInfo;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name = "设备模块")
|
||||
@RestController()
|
||||
@RequestMapping("/api/device")
|
||||
@Validated
|
||||
@SaIgnore
|
||||
public class DeviceController {
|
||||
static {
|
||||
System.out.println("初始化AGV模块------------");
|
||||
}
|
||||
@GetMapping("list")
|
||||
public CommonResult<List> status() {
|
||||
List<DeviceInfo> list = new ArrayList<>();
|
||||
JSONObject object = new JSONObject();
|
||||
object.put("action","action");
|
||||
object.put("signal","signal");
|
||||
object.put("power","power");
|
||||
for (int i = 0; i < 20; i++) {
|
||||
DeviceInfo build = DeviceInfo.builder()
|
||||
.name("设备1"+i)
|
||||
.code(i + "sdfsdf")
|
||||
.id(String.valueOf(i))
|
||||
.icon("/Users/mima0000/Desktop/car.png")
|
||||
.description("设备介绍")
|
||||
.editParam(object)
|
||||
.type(i%2==1?"货架":"专机")
|
||||
.build();
|
||||
list.add(build);
|
||||
}
|
||||
return CommonResult.data(list);
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package org.nl.modular.device.service.dto;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class DeviceInfo {
|
||||
/**
|
||||
* 设备Id
|
||||
*/
|
||||
private String id;
|
||||
/**
|
||||
* 设备Id
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
* 车辆类型
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 设备描述
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 设备编辑时存储信息
|
||||
*/
|
||||
private JSONObject editParam;
|
||||
/**
|
||||
* 设备图标
|
||||
*/
|
||||
private String icon="/Users/mima0000/Desktop/car.png";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright [2022] [https://www.xiaonuo.vip]
|
||||
*
|
||||
* Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
|
||||
*
|
||||
* 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
* 2.请不要删除和修改Snowy源码头部的版权声明。
|
||||
* 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
|
||||
* 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
|
||||
* 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
|
||||
* 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
|
||||
*/
|
||||
package org.nl.module.device.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.pojo.CommonResult;
|
||||
import org.nl.module.device.entity.BaseDataDevice;
|
||||
import org.nl.module.device.service.BaseDataDeviceService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 设备信息表Controller
|
||||
*/
|
||||
@Tag(name = "设备信息管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/baseData/device")
|
||||
@Validated
|
||||
public class BaseDataDeviceController {
|
||||
|
||||
@Autowired
|
||||
private BaseDataDeviceService baseDataDeviceService;
|
||||
|
||||
/**
|
||||
* 获取设备列表
|
||||
*/
|
||||
@Operation(summary = "获取设备列表")
|
||||
@GetMapping("/list")
|
||||
public CommonResult list(@RequestParam(required = false) String searchKey,
|
||||
@RequestParam(required = false) String region,
|
||||
@RequestParam(defaultValue = "1") Integer current,
|
||||
@RequestParam(defaultValue = "10") Integer size) {
|
||||
LambdaQueryWrapper<BaseDataDevice> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
// 关键词搜索(设备名称或编码)
|
||||
if (StringUtils.isNotBlank(searchKey)) {
|
||||
queryWrapper.and(wrapper -> wrapper
|
||||
.like(BaseDataDevice::getName, searchKey)
|
||||
.or()
|
||||
.like(BaseDataDevice::getCode, searchKey)
|
||||
);
|
||||
}
|
||||
|
||||
// 区域搜索
|
||||
if (StringUtils.isNotBlank(region)) {
|
||||
queryWrapper.like(BaseDataDevice::getRegion, region);
|
||||
}
|
||||
|
||||
// 按创建时间倒序
|
||||
queryWrapper.orderByDesc(BaseDataDevice::getCreateTime);
|
||||
|
||||
Page<BaseDataDevice> page = new Page<>(current, size);
|
||||
Page<BaseDataDevice> result = baseDataDeviceService.page(page, queryWrapper);
|
||||
|
||||
return CommonResult.data(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备信息
|
||||
*/
|
||||
@Operation(summary = "新增设备信息")
|
||||
@PostMapping("/add")
|
||||
public CommonResult add(@RequestBody BaseDataDevice device) {
|
||||
baseDataDeviceService.save(device);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备信息
|
||||
*/
|
||||
@Operation(summary = "修改设备信息")
|
||||
@PostMapping("/edit")
|
||||
public CommonResult edit(@RequestBody BaseDataDevice device) {
|
||||
baseDataDeviceService.updateById(device);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备信息
|
||||
*/
|
||||
@Operation(summary = "删除设备信息")
|
||||
@PostMapping("/delete")
|
||||
public CommonResult delete(@RequestParam Integer id) {
|
||||
baseDataDeviceService.removeById(id);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package org.nl.module.device.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 设备信息表实体类
|
||||
*/
|
||||
@Data
|
||||
@TableName("base_data_device")
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Schema(description = "设备信息表")
|
||||
public class BaseDataDevice implements Serializable {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
@Schema(description = "主键ID")
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "编码")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "设备名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "所属区域")
|
||||
private String region;
|
||||
|
||||
@Schema(description = "x坐标")
|
||||
private Integer x;
|
||||
|
||||
@Schema(description = "y坐标")
|
||||
private Integer y;
|
||||
|
||||
@Schema(description = "角度")
|
||||
private Integer angle;
|
||||
|
||||
@Schema(description = "放大比例")
|
||||
private Integer size;
|
||||
|
||||
@Schema(description = "图标地址")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@Schema(description = "创建用户")
|
||||
private String createName;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
@Schema(description = "修改用户")
|
||||
private String updateName;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package org.nl.module.device.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.nl.module.device.entity.BaseDataDevice;
|
||||
|
||||
/**
|
||||
* 设备信息表Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface BaseDataDeviceMapper extends BaseMapper<BaseDataDevice> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package org.nl.module.device.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.module.device.entity.BaseDataDevice;
|
||||
|
||||
/**
|
||||
* 设备信息表Service接口
|
||||
*/
|
||||
public interface BaseDataDeviceService extends IService<BaseDataDevice> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.nl.module.device.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.module.device.entity.BaseDataDevice;
|
||||
import org.nl.module.device.mapper.BaseDataDeviceMapper;
|
||||
import org.nl.module.device.service.BaseDataDeviceService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 设备信息表Service实现类
|
||||
*/
|
||||
@Service
|
||||
public class BaseDataDeviceServiceImpl extends ServiceImpl<BaseDataDeviceMapper, BaseDataDevice> implements BaseDataDeviceService {
|
||||
|
||||
}
|
||||
@@ -10,13 +10,13 @@
|
||||
* 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
|
||||
* 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
|
||||
*/
|
||||
package org.nl.modular.point;
|
||||
package org.nl.module.point;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.nl.common.pojo.CommonResult;
|
||||
import org.nl.modular.point.dto.PointStatus;
|
||||
import org.nl.module.point.dto.PointStatus;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.nl.modular.point.dto;
|
||||
package org.nl.module.point.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
Reference in New Issue
Block a user