设备信息页面与大屏接口

This commit is contained in:
猫猫guowen
2025-06-12 15:06:57 +08:00
parent 20e6ddfe30
commit 0f094e2d59
11 changed files with 1139 additions and 2 deletions

View File

@@ -0,0 +1,104 @@
package com.ruoyi.device.DeviceCar.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.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.device.DeviceCar.domain.DeviceCar;
import com.ruoyi.device.DeviceCar.service.IDeviceCarService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 设备信息Controller
*
* @author ruoyi
* @date 2025-06-12
*/
@RestController
@RequestMapping("/device/DeviceCar")
public class DeviceCarController extends BaseController
{
@Autowired
private IDeviceCarService deviceCarService;
/**
* 查询设备信息列表
*/
@PreAuthorize("@ss.hasPermi('device:DeviceCar:list')")
@GetMapping("/list")
public TableDataInfo list(DeviceCar deviceCar)
{
startPage();
List<DeviceCar> list = deviceCarService.selectDeviceCarList(deviceCar);
return getDataTable(list);
}
/**
* 导出设备信息列表
*/
@PreAuthorize("@ss.hasPermi('device:DeviceCar:export')")
@Log(title = "设备信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DeviceCar deviceCar)
{
List<DeviceCar> list = deviceCarService.selectDeviceCarList(deviceCar);
ExcelUtil<DeviceCar> util = new ExcelUtil<DeviceCar>(DeviceCar.class);
util.exportExcel(response, list, "设备信息数据");
}
/**
* 获取设备信息详细信息
*/
@PreAuthorize("@ss.hasPermi('device:DeviceCar:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(deviceCarService.selectDeviceCarById(id));
}
/**
* 新增设备信息
*/
@PreAuthorize("@ss.hasPermi('device:DeviceCar:add')")
@Log(title = "设备信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DeviceCar deviceCar)
{
return toAjax(deviceCarService.insertDeviceCar(deviceCar));
}
/**
* 修改设备信息
*/
@PreAuthorize("@ss.hasPermi('device:DeviceCar:edit')")
@Log(title = "设备信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DeviceCar deviceCar)
{
return toAjax(deviceCarService.updateDeviceCar(deviceCar));
}
/**
* 删除设备信息
*/
@PreAuthorize("@ss.hasPermi('device:DeviceCar:remove')")
@Log(title = "设备信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(deviceCarService.deleteDeviceCarByIds(ids));
}
}

View File

@@ -0,0 +1,233 @@
package com.ruoyi.device.DeviceCar.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 设备信息对象 device_car
*
* @author ruoyi
* @date 2025-06-12
*/
public class DeviceCar extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 设备唯一编码 */
@Excel(name = "设备唯一编码")
private String deviceCode ;
/** 设备名称 */
@Excel(name = "设备名称")
private String name ;
/** 1-AGV 2-CTU 3-SSJ */
@Excel(name = "1-AGV 2-CTU 3-SSJ")
private String type;
/** 设备IP */
@Excel(name = "设备IP")
private String ipAddress;
/** 关联缓冲区 */
@Excel(name = "关联缓冲区")
private String bufferAreaId ;
/** 0-F 1-T */
@Excel(name = "0-F 1-T")
private String isActive;
/** 状态 */
@Excel(name = "状态")
private String status;
/** 备用字段 */
@Excel(name = "备用字段")
private String spare1;
/** 备用字段 */
@Excel(name = "备用字段")
private String spare2;
/** 备用字段 */
@Excel(name = "备用字段")
private String spare3;
/** 备用字段 */
@Excel(name = "备用字段")
private String spare4;
/** 任务号 */
@Excel(name = "任务号")
private String taskNo;
/** 执行阶段 */
@Excel(name = "执行阶段")
private String zxjd;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setDeviceCode (String deviceCode )
{
this.deviceCode = deviceCode ;
}
public String getDeviceCode ()
{
return deviceCode ;
}
public void setName (String name )
{
this.name = name ;
}
public String getName ()
{
return name ;
}
public void setType(String type)
{
this.type = type;
}
public String getType()
{
return type;
}
public void setIpAddress(String ipAddress)
{
this.ipAddress = ipAddress;
}
public String getIpAddress()
{
return ipAddress;
}
public void setBufferAreaId (String bufferAreaId )
{
this.bufferAreaId = bufferAreaId ;
}
public String getBufferAreaId ()
{
return bufferAreaId ;
}
public void setIsActive(String isActive)
{
this.isActive = isActive;
}
public String getIsActive()
{
return isActive;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setSpare1(String spare1)
{
this.spare1 = spare1;
}
public String getSpare1()
{
return spare1;
}
public void setSpare2(String spare2)
{
this.spare2 = spare2;
}
public String getSpare2()
{
return spare2;
}
public void setSpare3(String spare3)
{
this.spare3 = spare3;
}
public String getSpare3()
{
return spare3;
}
public void setSpare4(String spare4)
{
this.spare4 = spare4;
}
public String getSpare4()
{
return spare4;
}
public void setTaskNo(String taskNo)
{
this.taskNo = taskNo;
}
public String getTaskNo()
{
return taskNo;
}
public void setZxjd(String zxjd)
{
this.zxjd = zxjd;
}
public String getZxjd()
{
return zxjd;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("deviceCode ", getDeviceCode ())
.append("name ", getName ())
.append("type", getType())
.append("ipAddress", getIpAddress())
.append("bufferAreaId ", getBufferAreaId ())
.append("isActive", getIsActive())
.append("createTime", getCreateTime())
.append("status", getStatus())
.append("spare1", getSpare1())
.append("spare2", getSpare2())
.append("spare3", getSpare3())
.append("spare4", getSpare4())
.append("taskNo", getTaskNo())
.append("zxjd", getZxjd())
.toString();
}
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.device.DeviceCar.mapper;
import java.util.List;
import com.ruoyi.device.DeviceCar.domain.DeviceCar;
/**
* 设备信息Mapper接口
*
* @author ruoyi
* @date 2025-06-12
*/
public interface DeviceCarMapper
{
/**
* 查询设备信息
*
* @param id 设备信息主键
* @return 设备信息
*/
public DeviceCar selectDeviceCarById(Long id);
/**
* 查询设备信息列表
*
* @param deviceCar 设备信息
* @return 设备信息集合
*/
public List<DeviceCar> selectDeviceCarList(DeviceCar deviceCar);
/**
* 新增设备信息
*
* @param deviceCar 设备信息
* @return 结果
*/
public int insertDeviceCar(DeviceCar deviceCar);
/**
* 修改设备信息
*
* @param deviceCar 设备信息
* @return 结果
*/
public int updateDeviceCar(DeviceCar deviceCar);
/**
* 删除设备信息
*
* @param id 设备信息主键
* @return 结果
*/
public int deleteDeviceCarById(Long id);
/**
* 批量删除设备信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteDeviceCarByIds(Long[] ids);
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.device.DeviceCar.service;
import java.util.List;
import com.ruoyi.device.DeviceCar.domain.DeviceCar;
/**
* 设备信息Service接口
*
* @author ruoyi
* @date 2025-06-12
*/
public interface IDeviceCarService
{
/**
* 查询设备信息
*
* @param id 设备信息主键
* @return 设备信息
*/
public DeviceCar selectDeviceCarById(Long id);
/**
* 查询设备信息列表
*
* @param deviceCar 设备信息
* @return 设备信息集合
*/
public List<DeviceCar> selectDeviceCarList(DeviceCar deviceCar);
/**
* 新增设备信息
*
* @param deviceCar 设备信息
* @return 结果
*/
public int insertDeviceCar(DeviceCar deviceCar);
/**
* 修改设备信息
*
* @param deviceCar 设备信息
* @return 结果
*/
public int updateDeviceCar(DeviceCar deviceCar);
/**
* 批量删除设备信息
*
* @param ids 需要删除的设备信息主键集合
* @return 结果
*/
public int deleteDeviceCarByIds(Long[] ids);
/**
* 删除设备信息信息
*
* @param id 设备信息主键
* @return 结果
*/
public int deleteDeviceCarById(Long id);
}

View File

@@ -0,0 +1,95 @@
package com.ruoyi.device.DeviceCar.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.device.DeviceCar.mapper.DeviceCarMapper;
import com.ruoyi.device.DeviceCar.domain.DeviceCar;
import com.ruoyi.device.DeviceCar.service.IDeviceCarService;
/**
* 设备信息Service业务层处理
*
* @author ruoyi
* @date 2025-06-12
*/
@Service
public class DeviceCarServiceImpl implements IDeviceCarService
{
@Autowired
private DeviceCarMapper deviceCarMapper;
/**
* 查询设备信息
*
* @param id 设备信息主键
* @return 设备信息
*/
@Override
public DeviceCar selectDeviceCarById(Long id)
{
return deviceCarMapper.selectDeviceCarById(id);
}
/**
* 查询设备信息列表
*
* @param deviceCar 设备信息
* @return 设备信息
*/
@Override
public List<DeviceCar> selectDeviceCarList(DeviceCar deviceCar)
{
return deviceCarMapper.selectDeviceCarList(deviceCar);
}
/**
* 新增设备信息
*
* @param deviceCar 设备信息
* @return 结果
*/
@Override
public int insertDeviceCar(DeviceCar deviceCar)
{
deviceCar.setCreateTime(DateUtils.getNowDate());
return deviceCarMapper.insertDeviceCar(deviceCar);
}
/**
* 修改设备信息
*
* @param deviceCar 设备信息
* @return 结果
*/
@Override
public int updateDeviceCar(DeviceCar deviceCar)
{
return deviceCarMapper.updateDeviceCar(deviceCar);
}
/**
* 批量删除设备信息
*
* @param ids 需要删除的设备信息主键
* @return 结果
*/
@Override
public int deleteDeviceCarByIds(Long[] ids)
{
return deviceCarMapper.deleteDeviceCarByIds(ids);
}
/**
* 删除设备信息信息
*
* @param id 设备信息主键
* @return 结果
*/
@Override
public int deleteDeviceCarById(Long id)
{
return deviceCarMapper.deleteDeviceCarById(id);
}
}

View File

@@ -18,6 +18,8 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.device.api.domain.RequestLog;
import com.ruoyi.device.api.service.IRequestLogService;
import com.ruoyi.device.DeviceCar.domain.DeviceCar;
import com.ruoyi.device.DeviceCar.service.IDeviceCarService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
@@ -34,6 +36,19 @@ public class RequestLogController extends BaseController
@Autowired
private IRequestLogService requestLogService;
@Autowired
private IDeviceCarService deviceCarService;
/**
* 查询所有设备信息
*/
@GetMapping("/devicecar/list")
public AjaxResult listAllDeviceCar()
{
List<DeviceCar> list = deviceCarService.selectDeviceCarList(new DeviceCar());
return success(list);
}
/**
* 查询接口记录列表
*/

View File

@@ -16,7 +16,7 @@ ruoyi:
# 开发环境配置
server:
# 服务器的HTTP端口,默认为8080
port: 8080
port: 8081
servlet:
# 应用的访问路径
context-path: /

View File

@@ -0,0 +1,120 @@
<?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.ruoyi.device.DeviceCar.mapper.DeviceCarMapper">
<resultMap type="DeviceCar" id="DeviceCarResult">
<result property="id" column="id" />
<result property="deviceCode " column="device_code " />
<result property="name " column="name " />
<result property="type" column="type" />
<result property="ipAddress" column="ip_address" />
<result property="bufferAreaId " column="buffer_area_id " />
<result property="isActive" column="is_active" />
<result property="createTime" column="create_time" />
<result property="status" column="status" />
<result property="spare1" column="spare1" />
<result property="spare2" column="spare2" />
<result property="spare3" column="spare3" />
<result property="spare4" column="spare4" />
<result property="taskNo" column="task_no" />
<result property="zxjd" column="zxjd" />
</resultMap>
<sql id="selectDeviceCarVo">
select id, device_code , name , type, ip_address, buffer_area_id , is_active, create_time, status, spare1, spare2, spare3, spare4, task_no, zxjd from device_car
</sql>
<select id="selectDeviceCarList" parameterType="DeviceCar" resultMap="DeviceCarResult">
<include refid="selectDeviceCarVo"/>
<where>
<if test="deviceCode != null and deviceCode != ''"> and device_code = #{deviceCode }</if>
<if test="name != null and name != ''"> and name like concat('%',#{name },'%')</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="ipAddress != null and ipAddress != ''"> and ip_address like concat('%',#{ipAddress},'%')</if>
<if test="bufferAreaId != null and bufferAreaId != ''"> and buffer_area_id like concat('%',#{bufferAreaId },'%')</if>
<if test="isActive != null and isActive != ''"> and is_active like concat('%',#{isActive},'%')</if>
<if test="status != null and status != ''"> and status like concat('%',#{status},'%')</if>
<if test="spare1 != null and spare1 != ''"> and spare1 like concat('%',#{spare1},'%')</if>
<if test="spare2 != null and spare2 != ''"> and spare2 like concat('%',#{spare2},'%')</if>
<if test="spare3 != null and spare3 != ''"> and spare3 like concat('%',#{spare3},'%')</if>
<if test="spare4 != null and spare4 != ''"> and spare4 like concat('%',#{spare4},'%')</if>
<if test="taskNo != null and taskNo != ''"> and task_no like concat('%',#{taskNo},'%')</if>
<if test="zxjd != null and zxjd != ''"> and zxjd = #{zxjd}</if>
</where>
</select>
<select id="selectDeviceCarById" parameterType="Long" resultMap="DeviceCarResult">
<include refid="selectDeviceCarVo"/>
where id = #{id}
</select>
<insert id="insertDeviceCar" parameterType="DeviceCar" useGeneratedKeys="true" keyProperty="id">
insert into device_car
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deviceCode != null">device_code ,</if>
<if test="name != null">name ,</if>
<if test="type != null">type,</if>
<if test="ipAddress != null">ip_address,</if>
<if test="bufferAreaId != null">buffer_area_id ,</if>
<if test="isActive != null">is_active,</if>
<if test="createTime != null">create_time,</if>
<if test="status != null">status,</if>
<if test="spare1 != null">spare1,</if>
<if test="spare2 != null">spare2,</if>
<if test="spare3 != null">spare3,</if>
<if test="spare4 != null">spare4,</if>
<if test="taskNo != null">task_no,</if>
<if test="zxjd != null">zxjd,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deviceCode != null">#{deviceCode },</if>
<if test="name != null">#{name },</if>
<if test="type != null">#{type},</if>
<if test="ipAddress != null">#{ipAddress},</if>
<if test="bufferAreaId != null">#{bufferAreaId },</if>
<if test="isActive != null">#{isActive},</if>
<if test="createTime != null">#{createTime},</if>
<if test="status != null">#{status},</if>
<if test="spare1 != null">#{spare1},</if>
<if test="spare2 != null">#{spare2},</if>
<if test="spare3 != null">#{spare3},</if>
<if test="spare4 != null">#{spare4},</if>
<if test="taskNo != null">#{taskNo},</if>
<if test="zxjd != null">#{zxjd},</if>
</trim>
</insert>
<update id="updateDeviceCar" parameterType="DeviceCar">
update device_car
<trim prefix="SET" suffixOverrides=",">
<if test="deviceCode != null">device_code = #{deviceCode },</if>
<if test="name != null">name = #{name },</if>
<if test="type != null">type = #{type},</if>
<if test="ipAddress != null">ip_address = #{ipAddress},</if>
<if test="bufferAreaId != null">buffer_area_id = #{bufferAreaId },</if>
<if test="isActive != null">is_active = #{isActive},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="status != null">status = #{status},</if>
<if test="spare1 != null">spare1 = #{spare1},</if>
<if test="spare2 != null">spare2 = #{spare2},</if>
<if test="spare3 != null">spare3 = #{spare3},</if>
<if test="spare4 != null">spare4 = #{spare4},</if>
<if test="taskNo != null">task_no = #{taskNo},</if>
<if test="zxjd != null">zxjd = #{zxjd},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDeviceCarById" parameterType="Long">
delete from device_car where id = #{id}
</delete>
<delete id="deleteDeviceCarByIds" parameterType="String">
delete from device_car where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>