设备管理-检查项维护(搜索优化)

highway
wws 1 year ago
parent 6e57dfe409
commit 59ed4122cb

@ -1,6 +1,8 @@
package com.op.device.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;
@ -81,6 +83,72 @@ public class EquCheckItem extends BaseEntity {
@Excel(name = "更新人")
private String updatedBy;
// 创建日期范围list
private List<Date> createdTimeArray;
// 更新日期范围list
private List<Date> updateTimeArray;
// 更新日期开始
private String updateTimeStart;
// 更新日期结束
private String updateTimeEnd;
public List<Date> getUpdateTimeArray() {
return updateTimeArray;
}
public void setUpdateTimeArray(List<Date> updateTimeArray) {
this.updateTimeArray = updateTimeArray;
}
public String getUpdateTimeStart() {
return updateTimeStart;
}
public void setUpdateTimeStart(String updateTimeStart) {
this.updateTimeStart = updateTimeStart;
}
public String getUpdateTimeEnd() {
return updateTimeEnd;
}
public void setUpdateTimeEnd(String updateTimeEnd) {
this.updateTimeEnd = updateTimeEnd;
}
// 创建日期开始
private String createTimeStart;
// 创建日期结束
private String createTimeEnd;
public String getCreateTimeStart() {
return createTimeStart;
}
public void setCreateTimeStart(String createTimeStart) {
this.createTimeStart = createTimeStart;
}
public String getCreateTimeEnd() {
return createTimeEnd;
}
public void setCreateTimeEnd(String createTimeEnd) {
this.createTimeEnd = createTimeEnd;
}
public List<Date> getCreatedTimeArray() {
return createdTimeArray;
}
public void setCreatedTimeArray(List<Date> createdTimeArray) {
this.createdTimeArray = createdTimeArray;
}
public void setItemId(String itemId) {
this.itemId = itemId;
}
@ -213,6 +281,7 @@ public class EquCheckItem extends BaseEntity {
.append("createdBy", getCreatedBy())
.append("updatedTime", getUpdatedTime())
.append("updatedBy", getUpdatedBy())
.append("createdTimeArray",getCreatedTimeArray())
.toString();
}
}

@ -1,8 +1,10 @@
package com.op.device.service.impl;
import java.text.SimpleDateFormat;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.log.annotation.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.device.mapper.EquCheckItemMapper;
@ -41,6 +43,22 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService {
@Override
@DS("#header.poolName")
public List<EquCheckItem> selectEquCheckItemList(EquCheckItem equCheckItem) {
if (equCheckItem.getCreatedTimeArray() != null) {
// 设置创建日期开始和结束值
if (equCheckItem.getCreatedTimeArray().size() == 2) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
equCheckItem.setCreateTimeStart(formatter.format(equCheckItem.getCreatedTimeArray().get(0)));
equCheckItem.setCreateTimeEnd(formatter.format(equCheckItem.getCreatedTimeArray().get(1)));
}
}
if (equCheckItem.getUpdateTimeArray() != null) {
// 设置更新日期开始和结束
if (equCheckItem.getUpdateTimeArray().size() == 2) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
equCheckItem.setUpdateTimeStart(formatter.format(equCheckItem.getUpdateTimeArray().get(0)));
equCheckItem.setUpdateTimeEnd(formatter.format(equCheckItem.getUpdateTimeArray().get(1)));
}
}
return equCheckItemMapper.selectEquCheckItemList(equCheckItem);
}

@ -30,9 +30,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectEquCheckItemList" parameterType="EquCheckItem" resultMap="EquCheckItemResult">
<include refid="selectEquCheckItemVo"/>
<where>
<if test="itemCode != null and itemCode != ''"> and item_code = #{itemCode}</if>
<if test="itemCode != null and itemCode != ''"> and item_code like concat('%', #{itemCode}, '%')</if>
<if test="itemName != null and itemName != ''"> and item_name like concat('%', #{itemName}, '%')</if>
<if test="itemMethod != null and itemMethod != ''"> and item_method = #{itemMethod}</if>
<if test="itemMethod != null and itemMethod != ''"> and item_method like concat('%', #{itemMethod}, '%')</if>
<if test="itemType != null and itemType != ''"> and item_type = #{itemType}</if>
<if test="itemTypeName != null and itemTypeName != ''"> and item_type_name like concat('%', #{itemTypeName}, '%')</if>
<if test="itemRemark != null and itemRemark != ''"> and item_remark = #{itemRemark}</if>
@ -41,10 +41,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
<if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag}</if>
<if test="createdTime != null "> and created_time = #{createdTime}</if>
<if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if>
<if test="updatedTime != null "> and updated_time = #{updatedTime}</if>
<if test="updatedBy != null and updatedBy != ''"> and updated_by = #{updatedBy}</if>
<if test="createTimeStart != null "> and CONVERT(date,created_time) >= #{createTimeStart}</if>
<if test="createTimeEnd != null "> and #{createTimeEnd} >= CONVERT(date,created_time)</if>
<if test="createdBy != null and createdBy != ''"> and created_by like concat('%', #{createdBy}, '%')</if>
<if test="updateTimeStart != null "> and CONVERT(date,updated_time) >= #{updateTimeStart}</if>
<if test="updateTimeEnd != null "> and #{updateTimeEnd} >= CONVERT(date,updated_time)</if>
<if test="updatedBy != null and updatedBy != ''"> and updated_by like concat('%', #{updatedBy}, '%')</if>
</where>
</select>

Loading…
Cancel
Save