Browse Source

巡检日期添加区间查询

Sun 3 years ago
parent
commit
b63f54fc1c

+ 49 - 25
ruoyi-warehouse/src/main/java/com/ruoyi/warehouse/check/domain/TWarehouseCheckItems.java

@@ -1,6 +1,8 @@
 package com.ruoyi.warehouse.check.domain;
 
 import java.util.Date;
+import java.util.List;
+
 import com.fasterxml.jackson.annotation.JsonFormat;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
@@ -9,7 +11,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
 
 /**
  * 巡检check-item对象 t_warehouse_check_items
- * 
+ *
  * @author dongyongwei
  * @date 2021-07-21
  */
@@ -108,6 +110,28 @@ public class TWarehouseCheckItems extends BaseEntity
     @Excel(name = "最新巡检日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date fInspectionDatetimeLast;
 
+    /** 最新巡检日期查询 */
+    private String inspectionDate;
+
+    /** 最新巡检日期查询区间 */
+    private List<String> inspectionDateInterval;
+
+    public String getInspectionDate() {
+        return inspectionDate;
+    }
+
+    public void setInspectionDate(String inspectionDate) {
+        this.inspectionDate = inspectionDate;
+    }
+
+    public List<String> getInspectionDateInterval() {
+        return inspectionDateInterval;
+    }
+
+    public void setInspectionDateInterval(List<String> inspectionDateInterval) {
+        this.inspectionDateInterval = inspectionDateInterval;
+    }
+
     /** 巡检备注 */
     @Excel(name = "巡检备注")
     private String fRemark;
@@ -134,111 +158,111 @@ public class TWarehouseCheckItems extends BaseEntity
     @Excel(name = "删除状态", readConverterExp = "0=正常,1=停用")
     private Integer fDelFlag;
 
-    public void setfId(Long fId) 
+    public void setfId(Long fId)
     {
         this.fId = fId;
     }
 
-    public Long getfId() 
+    public Long getfId()
     {
         return fId;
     }
-    public void setfCheckFid(Long fCheckFid) 
+    public void setfCheckFid(Long fCheckFid)
     {
         this.fCheckFid = fCheckFid;
     }
 
-    public Long getfCheckFid() 
+    public Long getfCheckFid()
     {
         return fCheckFid;
     }
-    public void setfWarehouseFid(Long fWarehouseFid) 
+    public void setfWarehouseFid(Long fWarehouseFid)
     {
         this.fWarehouseFid = fWarehouseFid;
     }
 
-    public Long getfWarehouseFid() 
+    public Long getfWarehouseFid()
     {
         return fWarehouseFid;
     }
-    public void setfInspectionDatetime(Date fInspectionDatetime) 
+    public void setfInspectionDatetime(Date fInspectionDatetime)
     {
         this.fInspectionDatetime = fInspectionDatetime;
     }
 
-    public Date getfInspectionDatetime() 
+    public Date getfInspectionDatetime()
     {
         return fInspectionDatetime;
     }
-    public void setfInspectorIdLast(Long fInspectorIdLast) 
+    public void setfInspectorIdLast(Long fInspectorIdLast)
     {
         this.fInspectorIdLast = fInspectorIdLast;
     }
 
-    public Long getfInspectorIdLast() 
+    public Long getfInspectorIdLast()
     {
         return fInspectorIdLast;
     }
-    public void setfInspectionDatetimeLast(Date fInspectionDatetimeLast) 
+    public void setfInspectionDatetimeLast(Date fInspectionDatetimeLast)
     {
         this.fInspectionDatetimeLast = fInspectionDatetimeLast;
     }
 
-    public Date getfInspectionDatetimeLast() 
+    public Date getfInspectionDatetimeLast()
     {
         return fInspectionDatetimeLast;
     }
-    public void setfRemark(String fRemark) 
+    public void setfRemark(String fRemark)
     {
         this.fRemark = fRemark;
     }
 
-    public String getfRemark() 
+    public String getfRemark()
     {
         return fRemark;
     }
-    public void setfCreateBy(Long fCreateBy) 
+    public void setfCreateBy(Long fCreateBy)
     {
         this.fCreateBy = fCreateBy;
     }
 
-    public Long getfCreateBy() 
+    public Long getfCreateBy()
     {
         return fCreateBy;
     }
-    public void setfCreateTime(Date fCreateTime) 
+    public void setfCreateTime(Date fCreateTime)
     {
         this.fCreateTime = fCreateTime;
     }
 
-    public Date getfCreateTime() 
+    public Date getfCreateTime()
     {
         return fCreateTime;
     }
-    public void setfUpdateBy(Long fUpdateBy) 
+    public void setfUpdateBy(Long fUpdateBy)
     {
         this.fUpdateBy = fUpdateBy;
     }
 
-    public Long getfUpdateBy() 
+    public Long getfUpdateBy()
     {
         return fUpdateBy;
     }
-    public void setfUpdateTime(Date fUpdateTime) 
+    public void setfUpdateTime(Date fUpdateTime)
     {
         this.fUpdateTime = fUpdateTime;
     }
 
-    public Date getfUpdateTime() 
+    public Date getfUpdateTime()
     {
         return fUpdateTime;
     }
-    public void setfDelFlag(Integer fDelFlag) 
+    public void setfDelFlag(Integer fDelFlag)
     {
         this.fDelFlag = fDelFlag;
     }
 
-    public Integer getfDelFlag() 
+    public Integer getfDelFlag()
     {
         return fDelFlag;
     }

+ 17 - 8
ruoyi-warehouse/src/main/java/com/ruoyi/warehouse/check/service/impl/TWarehouseCheckItemsServiceImpl.java

@@ -1,9 +1,11 @@
 package com.ruoyi.warehouse.check.service.impl;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
 import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.warehouse.check.mapper.TWarehouseCheckItemsMapper;
@@ -12,19 +14,19 @@ import com.ruoyi.warehouse.check.service.ITWarehouseCheckItemsService;
 
 /**
  * 巡检check-itemService业务层处理
- * 
+ *
  * @author dongyongwei
  * @date 2021-07-21
  */
 @Service
-public class TWarehouseCheckItemsServiceImpl implements ITWarehouseCheckItemsService 
+public class TWarehouseCheckItemsServiceImpl implements ITWarehouseCheckItemsService
 {
     @Autowired
     private TWarehouseCheckItemsMapper tWarehouseCheckItemsMapper;
 
     /**
      * 查询巡检check-item
-     * 
+     *
      * @param fId 巡检check-itemID
      * @return 巡检check-item
      */
@@ -36,7 +38,7 @@ public class TWarehouseCheckItemsServiceImpl implements ITWarehouseCheckItemsSer
 
     /**
      * 查询巡检check-item列表
-     * 
+     *
      * @param tWarehouseCheckItems 巡检check-item
      * @return 巡检check-item
      */
@@ -48,7 +50,7 @@ public class TWarehouseCheckItemsServiceImpl implements ITWarehouseCheckItemsSer
 
     /**
      * 新增巡检check-item
-     * 
+     *
      * @param tWarehouseCheckItems 巡检check-item
      * @return 结果
      */
@@ -62,7 +64,7 @@ public class TWarehouseCheckItemsServiceImpl implements ITWarehouseCheckItemsSer
 
     /**
      * 修改巡检check-item
-     * 
+     *
      * @param tWarehouseCheckItems 巡检check-item
      * @return 结果
      */
@@ -76,7 +78,7 @@ public class TWarehouseCheckItemsServiceImpl implements ITWarehouseCheckItemsSer
 
     /**
      * 批量删除巡检check-item
-     * 
+     *
      * @param fIds 需要删除的巡检check-itemID
      * @return 结果
      */
@@ -88,7 +90,7 @@ public class TWarehouseCheckItemsServiceImpl implements ITWarehouseCheckItemsSer
 
     /**
      * 删除巡检check-item信息
-     * 
+     *
      * @param fId 巡检check-itemID
      * @return 结果
      */
@@ -100,6 +102,13 @@ public class TWarehouseCheckItemsServiceImpl implements ITWarehouseCheckItemsSer
 
     @Override
     public List<TWarehouseCheckItems> appListByUser(TWarehouseCheckItems tWarehouseCheckItems) {
+        String inspectionDate = tWarehouseCheckItems.getInspectionDate();
+        if (StringUtils.isNotEmpty(inspectionDate)) {
+            List<String> inspectionDateInterval = new ArrayList<>();
+            inspectionDateInterval.add(inspectionDate.split(",")[0]);
+            inspectionDateInterval.add(inspectionDate.split(",")[1]);
+            tWarehouseCheckItems.setInspectionDateInterval(inspectionDateInterval);
+        }
         return tWarehouseCheckItemsMapper.selectTWarehouseCheckItemsList(tWarehouseCheckItems);
     }
 }

+ 7 - 1
ruoyi-warehouse/src/main/resources/mapper/warehouse/TWarehouseCheckItemsMapper.xml

@@ -69,6 +69,12 @@
             <if test="fUpdateBy != null ">and a.f_update_by = #{fUpdateBy}</if>
             <if test="fUpdateTime != null ">and a.f_update_time = #{fUpdateTime}</if>
             <if test="fDelFlag != null ">and a.f_del_flag = #{fDelFlag}</if>
+            <if test='inspectionDateInterval != null and inspectionDateInterval[0] != null and inspectionDateInterval[0]!= ""'>
+                and f_inspection_datetime_last &gt;= #{inspectionDateInterval[0]}
+            </if>
+            <if test='inspectionDateInterval != null and inspectionDateInterval[1] != null and inspectionDateInterval[1]!= ""'>
+                and f_inspection_datetime_last &lt;= #{inspectionDateInterval[1]}
+            </if>
         </where>
             order by f_id desc
     </select>
@@ -143,4 +149,4 @@
         </foreach>
     </delete>
 
-</mapper>
+</mapper>