Browse Source

调试设备异常模块功能。

bruce 2 years ago
parent
commit
42fb699d60

+ 26 - 0
imcs-bt-be/imcs-business-biz/src/main/java/com/github/zuihou/business/productionresource/dao/EquStatusMapper.java

@@ -1,7 +1,11 @@
 package com.github.zuihou.business.productionresource.dao;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.github.zuihou.base.mapper.SuperMapper;
+import com.github.zuihou.business.productionresource.dto.EquStatusPageDTO;
 import com.github.zuihou.business.productionresource.entity.EquStatus;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 import org.springframework.stereotype.Repository;
 
 /**
@@ -13,4 +17,26 @@ import org.springframework.stereotype.Repository;
 @Repository
 public interface EquStatusMapper extends SuperMapper<EquStatus>
 {
+	/**
+	 * 分页查询
+	 */
+	@Select
+	(
+		"<script>" +
+			"SELECT " +
+			" bes.id, bes.status, bes.message, bes.create_time," +
+			" itp.name, itp.code, itp.place_id, itp.compnay_id, itp.area_id," +
+			" bp.plc_name, cca.full_name AS area " +
+			"FROM bt_equ_status bes " +
+			"LEFT JOIN imcs_tenant_productionresource itp ON bes.equ_id = itp.id " +
+			"LEFT JOIN bt_place bp ON itp.place_id = bp.id " +
+			"LEFT JOIN c_common_area cca ON cca.code LIKE CONCAT(itp.area_id, '%') " +
+			"WHERE 1 = 1 " +
+			" <if test=\"null != params.beginTime\"> AND bes.create_time &gt; = #{params.beginTime}</if> " +
+			" <if test=\"null != params.endTime\"> AND bes.create_time &lt; = #{params.endTime}</if> " +
+			//" <if test=\"null != params.company and '' != params.company\"> AND ? LIKE ?</if> " +
+			"ORDER BY bes.create_time DESC" +
+		"</script>"
+	)
+	IPage<EquStatus> findByPage(IPage<EquStatus> page, @Param("params") EquStatusPageDTO params);
 }

+ 17 - 0
imcs-bt-be/imcs-business-biz/src/main/java/com/github/zuihou/business/productionresource/service/EquStatusService.java

@@ -0,0 +1,17 @@
+package com.github.zuihou.business.productionresource.service;
+
+import com.github.zuihou.base.service.SuperService;
+import com.github.zuihou.business.place.entity.Place;
+import com.github.zuihou.business.productionresource.entity.EquStatus;
+
+import java.util.List;
+
+/**
+ * 设备状态Service
+ *
+ * @author bruce
+ * @date 2023-02-25
+ */
+public interface EquStatusService extends SuperService<EquStatus>
+{
+}

+ 23 - 0
imcs-bt-be/imcs-business-biz/src/main/java/com/github/zuihou/business/productionresource/service/impl/EquStatusServiceImpl.java

@@ -0,0 +1,23 @@
+package com.github.zuihou.business.productionresource.service.impl;
+
+
+import com.github.zuihou.base.service.SuperServiceImpl;
+import com.github.zuihou.business.productionresource.dao.EquAndGoodsMapper;
+import com.github.zuihou.business.productionresource.dao.EquStatusMapper;
+import com.github.zuihou.business.productionresource.entity.EquAndGoods;
+import com.github.zuihou.business.productionresource.entity.EquStatus;
+import com.github.zuihou.business.productionresource.service.EquAndGoodsService;
+import com.github.zuihou.business.productionresource.service.EquStatusService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+/**
+ * 设备-状态Service实现类
+ *
+ * @author bruce
+ * @date 2023-02-25
+ */
+@Service @Slf4j
+public class EquStatusServiceImpl extends SuperServiceImpl<EquStatusMapper, EquStatus> implements EquStatusService
+{
+}

+ 46 - 0
imcs-bt-be/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/productionresource/EquStatusController.java

@@ -0,0 +1,46 @@
+package com.github.zuihou.business.controller.productionresource;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.zuihou.base.controller.SuperController;
+import com.github.zuihou.base.request.PageParams;
+import com.github.zuihou.business.productionresource.dao.EquStatusMapper;
+import com.github.zuihou.business.productionresource.dto.EquStatusPageDTO;
+import com.github.zuihou.business.productionresource.dto.EquStatusSaveDTO;
+import com.github.zuihou.business.productionresource.dto.EquStatusUpdateDTO;
+import com.github.zuihou.business.productionresource.entity.EquStatus;
+import com.github.zuihou.business.productionresource.service.EquStatusService;
+import io.swagger.annotations.Api;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+/**
+ * 设备状态Controller
+ *
+ * @author bruce
+ * @date 2023-02-25
+ */
+@Api(value = "EquStatusController", tags = "设备状态")
+@RestController @RequestMapping("/equ-status") @Validated @Slf4j
+public class EquStatusController extends SuperController<EquStatusService, Long, EquStatus, EquStatusPageDTO, EquStatusSaveDTO, EquStatusUpdateDTO>
+{
+    @Resource
+    private EquStatusMapper equStatusMapper;
+
+    /**
+     * 分页查询
+     *
+     * @param params  查询参数
+     * @param page    分页信息
+     * @param defSize def大小
+     */
+    @Override
+    public void query(PageParams<EquStatusPageDTO> params, IPage<EquStatus> page, Long defSize)
+    {
+        IPage<EquStatus> resp = equStatusMapper.findByPage(page, params.getModel());
+        log.debug("告警记录总数:{}", resp.getTotal());
+    }
+}

+ 38 - 0
imcs-bt-be/imcs-business-entity/src/main/java/com/github/zuihou/business/productionresource/dto/EquStatusPageDTO.java

@@ -0,0 +1,38 @@
+package com.github.zuihou.business.productionresource.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.*;
+import lombok.experimental.Accessors;
+import org.hibernate.validator.constraints.Length;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 设备-状态分页查询模型
+ *
+ * @author bruce
+ * @since 2023-02-25
+ */
+@ApiModel(value = "EquStatusPageDTO", description = "设备-状态分页查询模型")
+@ToString(callSuper = true) @EqualsAndHashCode(callSuper = false)
+@Data @Builder @NoArgsConstructor @AllArgsConstructor @Accessors(chain = true)
+public class EquStatusPageDTO implements Serializable
+{
+    /**
+     * 开始时间
+     */
+    @ApiModelProperty(value = "开始时间")
+    private LocalDateTime beginTime;
+    /**
+     * 结束时间
+     */
+    @ApiModelProperty(value = "结束时间")
+    private LocalDateTime endTime;
+    /**
+     * 企业
+     */
+    @ApiModelProperty(value = "企业")
+    private String company;
+}

+ 23 - 0
imcs-bt-be/imcs-business-entity/src/main/java/com/github/zuihou/business/productionresource/dto/EquStatusSaveDTO.java

@@ -0,0 +1,23 @@
+package com.github.zuihou.business.productionresource.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.*;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 设备-状态新增模型
+ *
+ * @author bruce
+ * @since 2023-02-25
+ */
+@ApiModel(value = "EquStatusSaveDTO", description = "设备-状态新增模型")
+@ToString(callSuper = true) @EqualsAndHashCode(callSuper = false)
+@Data @Builder @NoArgsConstructor @AllArgsConstructor @Accessors(chain = true)
+public class EquStatusSaveDTO implements Serializable
+{
+	private Long id;
+}

+ 21 - 0
imcs-bt-be/imcs-business-entity/src/main/java/com/github/zuihou/business/productionresource/dto/EquStatusUpdateDTO.java

@@ -0,0 +1,21 @@
+package com.github.zuihou.business.productionresource.dto;
+
+import io.swagger.annotations.ApiModel;
+import lombok.*;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * 设备-状态修改模型
+ *
+ * @author bruce
+ * @since 2023-02-25
+ */
+@ApiModel(value = "EquStatusUpdateDTO", description = "设备-状态修改模型")
+@ToString(callSuper = true) @EqualsAndHashCode(callSuper = false)
+@Data @Builder @NoArgsConstructor @AllArgsConstructor @Accessors(chain = true)
+public class EquStatusUpdateDTO implements Serializable
+{
+	private Long id;
+}

+ 2 - 0
imcs-bt-be/imcs-business-entity/src/main/java/com/github/zuihou/business/productionresource/entity/EquStatus.java

@@ -43,4 +43,6 @@ public class EquStatus extends SuperEntity<Long>
     @ApiModelProperty(value = "错误信息")
     @NotBlank(message = "缺失message参数")
     private String message;
+
+    // TODO 补充分页查询映射属性列表
 }