change - add设备实时状态接口

master
yinq 2 months ago
parent cd028831b8
commit 3c84d4d15a

@ -0,0 +1,99 @@
package com.hw.dms.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
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.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType;
import com.hw.common.security.annotation.RequiresPermissions;
import com.hw.dms.domain.DmsRealtimeStatus;
import com.hw.dms.service.IDmsRealtimeStatusService;
import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.core.utils.poi.ExcelUtil;
import com.hw.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author Yinq
* @date 2024-09-02
*/
@RestController
@RequestMapping("/dmsRealtimeStatus")
public class DmsRealtimeStatusController extends BaseController {
@Autowired
private IDmsRealtimeStatusService dmsRealtimeStatusService;
/**
*
*/
@RequiresPermissions("dms:dmsRealtimeStatus:list")
@GetMapping("/list")
public TableDataInfo list(DmsRealtimeStatus dmsRealtimeStatus) {
startPage();
List<DmsRealtimeStatus> list = dmsRealtimeStatusService.selectDmsRealtimeStatusList(dmsRealtimeStatus);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("dms:dmsRealtimeStatus:export")
@Log(title = "设备实时状态", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DmsRealtimeStatus dmsRealtimeStatus) {
List<DmsRealtimeStatus> list = dmsRealtimeStatusService.selectDmsRealtimeStatusList(dmsRealtimeStatus);
ExcelUtil<DmsRealtimeStatus> util = new ExcelUtil<DmsRealtimeStatus>(DmsRealtimeStatus.class);
util.exportExcel(response, list, "设备实时状态数据");
}
/**
*
*/
@RequiresPermissions("dms:dmsRealtimeStatus:query")
@GetMapping(value = "/{statusId}")
public AjaxResult getInfo(@PathVariable("statusId") Long statusId) {
return success(dmsRealtimeStatusService.selectDmsRealtimeStatusByStatusId(statusId));
}
/**
*
*/
@RequiresPermissions("dms:dmsRealtimeStatus:add")
@Log(title = "设备实时状态", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DmsRealtimeStatus dmsRealtimeStatus) {
return toAjax(dmsRealtimeStatusService.insertDmsRealtimeStatus(dmsRealtimeStatus));
}
/**
*
*/
@RequiresPermissions("dms:dmsRealtimeStatus:edit")
@Log(title = "设备实时状态", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DmsRealtimeStatus dmsRealtimeStatus) {
return toAjax(dmsRealtimeStatusService.updateDmsRealtimeStatus(dmsRealtimeStatus));
}
/**
*
*/
@RequiresPermissions("dms:dmsRealtimeStatus:remove")
@Log(title = "设备实时状态", businessType = BusinessType.DELETE)
@DeleteMapping("/{statusIds}")
public AjaxResult remove(@PathVariable Long[] statusIds) {
return toAjax(dmsRealtimeStatusService.deleteDmsRealtimeStatusByStatusIds(statusIds));
}
}

@ -0,0 +1,128 @@
package com.hw.dms.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
/**
* dms_realtime_status
*
* @author Yinq
* @date 2024-09-02
*/
public class DmsRealtimeStatus extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long statusId;
/**
*
*/
@Excel(name = "设备状态编号")
private String statusCode;
/**
*
*/
@Excel(name = "设备状态名称")
private String statusName;
/**
*
*/
@Excel(name = "设备状态值")
private String statusValue;
/**
* id
*/
@Excel(name = "所属设备id")
private Long deviceId;
/** 设备名称 */
@Excel(name = "设备名称")
private String deviceName;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date creatTime;
public String getDeviceName() {
return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public void setStatusId(Long statusId) {
this.statusId = statusId;
}
public Long getStatusId() {
return statusId;
}
public void setStatusCode(String statusCode) {
this.statusCode = statusCode;
}
public String getStatusCode() {
return statusCode;
}
public void setStatusName(String statusName) {
this.statusName = statusName;
}
public String getStatusName() {
return statusName;
}
public void setStatusValue(String statusValue) {
this.statusValue = statusValue;
}
public String getStatusValue() {
return statusValue;
}
public void setDeviceId(Long deviceId) {
this.deviceId = deviceId;
}
public Long getDeviceId() {
return deviceId;
}
public void setCreatTime(Date creatTime) {
this.creatTime = creatTime;
}
public Date getCreatTime() {
return creatTime;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("statusId", getStatusId())
.append("statusCode", getStatusCode())
.append("statusName", getStatusName())
.append("statusValue", getStatusValue())
.append("deviceId", getDeviceId())
.append("creatTime", getCreatTime())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -0,0 +1,61 @@
package com.hw.dms.mapper;
import java.util.List;
import com.hw.dms.domain.DmsRealtimeStatus;
/**
* Mapper
*
* @author Yinq
* @date 2024-09-02
*/
public interface DmsRealtimeStatusMapper {
/**
*
*
* @param statusId
* @return
*/
public DmsRealtimeStatus selectDmsRealtimeStatusByStatusId(Long statusId);
/**
*
*
* @param dmsRealtimeStatus
* @return
*/
public List<DmsRealtimeStatus> selectDmsRealtimeStatusList(DmsRealtimeStatus dmsRealtimeStatus);
/**
*
*
* @param dmsRealtimeStatus
* @return
*/
public int insertDmsRealtimeStatus(DmsRealtimeStatus dmsRealtimeStatus);
/**
*
*
* @param dmsRealtimeStatus
* @return
*/
public int updateDmsRealtimeStatus(DmsRealtimeStatus dmsRealtimeStatus);
/**
*
*
* @param statusId
* @return
*/
public int deleteDmsRealtimeStatusByStatusId(Long statusId);
/**
*
*
* @param statusIds
* @return
*/
public int deleteDmsRealtimeStatusByStatusIds(Long[] statusIds);
}

@ -0,0 +1,61 @@
package com.hw.dms.service;
import java.util.List;
import com.hw.dms.domain.DmsRealtimeStatus;
/**
* Service
*
* @author Yinq
* @date 2024-09-02
*/
public interface IDmsRealtimeStatusService {
/**
*
*
* @param statusId
* @return
*/
public DmsRealtimeStatus selectDmsRealtimeStatusByStatusId(Long statusId);
/**
*
*
* @param dmsRealtimeStatus
* @return
*/
public List<DmsRealtimeStatus> selectDmsRealtimeStatusList(DmsRealtimeStatus dmsRealtimeStatus);
/**
*
*
* @param dmsRealtimeStatus
* @return
*/
public int insertDmsRealtimeStatus(DmsRealtimeStatus dmsRealtimeStatus);
/**
*
*
* @param dmsRealtimeStatus
* @return
*/
public int updateDmsRealtimeStatus(DmsRealtimeStatus dmsRealtimeStatus);
/**
*
*
* @param statusIds
* @return
*/
public int deleteDmsRealtimeStatusByStatusIds(Long[] statusIds);
/**
*
*
* @param statusId
* @return
*/
public int deleteDmsRealtimeStatusByStatusId(Long statusId);
}

@ -0,0 +1,89 @@
package com.hw.dms.service.impl;
import java.util.List;
import com.hw.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.dms.mapper.DmsRealtimeStatusMapper;
import com.hw.dms.domain.DmsRealtimeStatus;
import com.hw.dms.service.IDmsRealtimeStatusService;
/**
* Service
*
* @author Yinq
* @date 2024-09-02
*/
@Service
public class DmsRealtimeStatusServiceImpl implements IDmsRealtimeStatusService {
@Autowired
private DmsRealtimeStatusMapper dmsRealtimeStatusMapper;
/**
*
*
* @param statusId
* @return
*/
@Override
public DmsRealtimeStatus selectDmsRealtimeStatusByStatusId(Long statusId) {
return dmsRealtimeStatusMapper.selectDmsRealtimeStatusByStatusId(statusId);
}
/**
*
*
* @param dmsRealtimeStatus
* @return
*/
@Override
public List<DmsRealtimeStatus> selectDmsRealtimeStatusList(DmsRealtimeStatus dmsRealtimeStatus) {
return dmsRealtimeStatusMapper.selectDmsRealtimeStatusList(dmsRealtimeStatus);
}
/**
*
*
* @param dmsRealtimeStatus
* @return
*/
@Override
public int insertDmsRealtimeStatus(DmsRealtimeStatus dmsRealtimeStatus) {
return dmsRealtimeStatusMapper.insertDmsRealtimeStatus(dmsRealtimeStatus);
}
/**
*
*
* @param dmsRealtimeStatus
* @return
*/
@Override
public int updateDmsRealtimeStatus(DmsRealtimeStatus dmsRealtimeStatus) {
dmsRealtimeStatus.setUpdateTime(DateUtils.getNowDate());
return dmsRealtimeStatusMapper.updateDmsRealtimeStatus(dmsRealtimeStatus);
}
/**
*
*
* @param statusIds
* @return
*/
@Override
public int deleteDmsRealtimeStatusByStatusIds(Long[] statusIds) {
return dmsRealtimeStatusMapper.deleteDmsRealtimeStatusByStatusIds(statusIds);
}
/**
*
*
* @param statusId
* @return
*/
@Override
public int deleteDmsRealtimeStatusByStatusId(Long statusId) {
return dmsRealtimeStatusMapper.deleteDmsRealtimeStatusByStatusId(statusId);
}
}

@ -3,7 +3,9 @@ package com.hw.dms.service.impl;
import java.util.HashMap;
import java.util.List;
import com.hw.dms.domain.DmsRealtimeStatus;
import com.hw.dms.domain.vo.ModelBoardVo;
import com.hw.dms.mapper.DmsRealtimeStatusMapper;
import com.hw.dms.service.IModelInterfacesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -22,6 +24,9 @@ public class ModelInterfacesServiceImpl implements IModelInterfacesService
@Autowired
private WcsAgvStatusMapper wcsAgvStatusMapper;
@Autowired
private DmsRealtimeStatusMapper dmsRealtimeStatusMapper;
/**
* AGV
* @param modelBoardVo
@ -33,6 +38,9 @@ public class ModelInterfacesServiceImpl implements IModelInterfacesService
WcsAgvStatus wcsAgvStatus = new WcsAgvStatus();
List<WcsAgvStatus> agvStatusList = wcsAgvStatusMapper.selectWcsAgvStatusList(wcsAgvStatus);
result.put("agvStatusList", agvStatusList);
DmsRealtimeStatus realtimeStatus = new DmsRealtimeStatus();
List<DmsRealtimeStatus> realtimeStatusList = dmsRealtimeStatusMapper.selectDmsRealtimeStatusList(realtimeStatus);
result.put("realtimeStatusList", realtimeStatusList);
return result;
}

@ -0,0 +1,94 @@
<?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.hw.dms.mapper.DmsRealtimeStatusMapper">
<resultMap type="DmsRealtimeStatus" id="DmsRealtimeStatusResult">
<result property="statusId" column="status_id"/>
<result property="statusCode" column="status_code"/>
<result property="statusName" column="status_name"/>
<result property="statusValue" column="status_value"/>
<result property="deviceId" column="device_id"/>
<result property="creatTime" column="creat_time"/>
<result property="updateTime" column="update_time"/>
<result property="deviceName" column="device_name"/>
</resultMap>
<sql id="selectDmsRealtimeStatusVo">
select drs.status_id,
drs.status_code,
drs.status_name,
drs.status_value,
drs.device_id,
drs.creat_time,
drs.update_time,
dbdl.device_name
from dms_realtime_status drs
left join dms_base_device_ledger dbdl on drs.device_id = dbdl.device_id
</sql>
<select id="selectDmsRealtimeStatusList" parameterType="DmsRealtimeStatus" resultMap="DmsRealtimeStatusResult">
<include refid="selectDmsRealtimeStatusVo"/>
<where>
<if test="statusCode != null and statusCode != ''">and drs.status_code = #{statusCode}</if>
<if test="statusName != null and statusName != ''">and drs.status_name like concat('%', #{statusName}, '%')
</if>
<if test="statusValue != null and statusValue != ''">and drs.status_value = #{statusValue}</if>
<if test="deviceId != null ">and drs.device_id = #{deviceId}</if>
<if test="creatTime != null ">and drs.creat_time = #{creatTime}</if>
</where>
</select>
<select id="selectDmsRealtimeStatusByStatusId" parameterType="Long" resultMap="DmsRealtimeStatusResult">
<include refid="selectDmsRealtimeStatusVo"/>
where drs.status_id = #{statusId}
</select>
<insert id="insertDmsRealtimeStatus" parameterType="DmsRealtimeStatus" useGeneratedKeys="true"
keyProperty="statusId">
insert into dms_realtime_status
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="statusCode != null and statusCode != ''">status_code,</if>
<if test="statusName != null and statusName != ''">status_name,</if>
<if test="statusValue != null">status_value,</if>
<if test="deviceId != null">device_id,</if>
<if test="creatTime != null">creat_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="statusCode != null and statusCode != ''">#{statusCode},</if>
<if test="statusName != null and statusName != ''">#{statusName},</if>
<if test="statusValue != null">#{statusValue},</if>
<if test="deviceId != null">#{deviceId},</if>
<if test="creatTime != null">#{creatTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateDmsRealtimeStatus" parameterType="DmsRealtimeStatus">
update dms_realtime_status
<trim prefix="SET" suffixOverrides=",">
<if test="statusCode != null and statusCode != ''">status_code = #{statusCode},</if>
<if test="statusName != null and statusName != ''">status_name = #{statusName},</if>
<if test="statusValue != null">status_value = #{statusValue},</if>
<if test="deviceId != null">device_id = #{deviceId},</if>
<if test="creatTime != null">creat_time = #{creatTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where status_id = #{statusId}
</update>
<delete id="deleteDmsRealtimeStatusByStatusId" parameterType="Long">
delete
from dms_realtime_status
where status_id = #{statusId}
</delete>
<delete id="deleteDmsRealtimeStatusByStatusIds" parameterType="String">
delete from dms_realtime_status where status_id in
<foreach item="statusId" collection="array" open="(" separator="," close=")">
#{statusId}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save