故障类型维护(优化查询)

highway
wws 1 year ago
parent 991a9e874b
commit 2de0b1d2df

@ -5,6 +5,9 @@ import org.apache.commons.lang3.builder.ToStringStyle;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
import java.util.Date;
import java.util.List;
/**
* equ_fault_type
*
@ -53,6 +56,72 @@ public class EquFaultType extends BaseEntity {
@Excel(name = "删除标志")
private String delFlag;
// 创建日期范围list
private List<Date> createTimeArray;
// 更新日期范围list
private List<Date> updateTimeArray;
// 更新日期开始
private String updateTimeStart;
// 更新日期结束
private String updateTimeEnd;
// 创建日期开始
private String createTimeStart;
// 创建日期结束
private String createTimeEnd;
public List<Date> getCreateTimeArray() {
return createTimeArray;
}
public void setCreateTimeArray(List<Date> createTimeArray) {
this.createTimeArray = createTimeArray;
}
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;
}
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 void setFaultId(String faultId) {
this.faultId = faultId;
}

@ -1,5 +1,6 @@
package com.op.device.service.impl;
import java.text.SimpleDateFormat;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
@ -52,6 +53,22 @@ public class EquFaultTypeServiceImpl implements IEquFaultTypeService {
@Override
@DS("#header.poolName")
public List<EquFaultType> selectEquFaultTypeList(EquFaultType equFaultType) {
if (equFaultType.getCreateTimeArray() != null) {
// 设置创建日期开始和结束值
if (equFaultType.getCreateTimeArray().size() == 2) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
equFaultType.setCreateTimeStart(formatter.format(equFaultType.getCreateTimeArray().get(0)));
equFaultType.setCreateTimeEnd(formatter.format(equFaultType.getCreateTimeArray().get(1)));
}
}
if (equFaultType.getUpdateTimeArray() != null) {
// 设置更新日期开始和结束
if (equFaultType.getUpdateTimeArray().size() == 2) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
equFaultType.setUpdateTimeStart(formatter.format(equFaultType.getUpdateTimeArray().get(0)));
equFaultType.setUpdateTimeEnd(formatter.format(equFaultType.getUpdateTimeArray().get(1)));
}
}
return equFaultTypeMapper.selectEquFaultTypeList(equFaultType);
}

@ -37,12 +37,15 @@ 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="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and update_by = #{updateBy}</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
<if test="createTimeStart != null "> and CONVERT(date,create_time) >= #{createTimeStart}</if>
<if test="createTimeEnd != null "> and #{createTimeEnd} >= CONVERT(date,create_time)</if>
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
<if test="updateTimeStart != null "> and CONVERT(date,update_time) >= #{updateTimeStart}</if>
<if test="updateTimeEnd != null "> and #{updateTimeEnd} >= CONVERT(date,update_time)</if>
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
and del_flag = '0'
</where>
ORDER BY create_time DESC
</select>
<select id="selectEquFaultTypeByFaultId" parameterType="String" resultMap="EquFaultTypeResult">

Loading…
Cancel
Save