Merge remote-tracking branch 'origin/master'

highway
zhaoxiaolin 1 year ago
commit 316c053a6e

@ -135,4 +135,6 @@ public class Constants {
public static final String OPTION="OPTION";
public static final String LOW="LOW";
public static final String HIGH="HIGH";
}

@ -83,7 +83,7 @@ public class EquFaultTypeController extends BaseController {
@Log(title = "故障类型维护", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EquFaultType equFaultType) {
return toAjax(equFaultTypeService.updateEquFaultType(equFaultType));
return equFaultTypeService.updateEquFaultType(equFaultType);
}
/**

@ -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;
}

@ -42,7 +42,7 @@ public interface IEquFaultTypeService {
* @param equFaultType
* @return
*/
public int updateEquFaultType(EquFaultType equFaultType);
public AjaxResult updateEquFaultType(EquFaultType equFaultType);
/**
*

@ -104,10 +104,14 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService {
@Transactional
public AjaxResult insertEquCheckItem(EquCheckItemDTO equCheckItemDTO) {
// 检验重复
EquCheckItem checkItem = equCheckItemMapper.selectEquCheckItemByItemName(equCheckItemDTO.getItemName());
if (checkItem != null) {
return error("检查项已存在!新增失败!");
EquCheckItem checkItem = new EquCheckItem();
checkItem.setItemType(equCheckItemDTO.getItemType());
checkItem.setItemName(equCheckItemDTO.getItemName());
List<EquCheckItem> check = equCheckItemMapper.selectEquCheckItemList(checkItem);
if (check.size() > 0) {
return error(500,"检查项已存在!新增失败!");
}
// 创建检查项对象
EquCheckItem equCheckItem = new EquCheckItem();
BeanUtils.copyProperties(equCheckItemDTO, equCheckItem);
@ -195,6 +199,18 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService {
@DS("#header.poolName")
@Transactional
public AjaxResult updateEquCheckItem(EquCheckItemDTO equCheckItemDTO) {
// 检验
EquCheckItem checkQuery = new EquCheckItem();
checkQuery.setItemType(equCheckItemDTO.getItemType());
checkQuery.setItemName(equCheckItemDTO.getItemName());
List<EquCheckItem> check = equCheckItemMapper.selectEquCheckItemList(checkQuery);
if (check.size()>0) {
if (!check.get(0).getItemCode().equals(equCheckItemDTO.getItemCode())) {
return error(500,"检查项已存在!不可修改!");
}
}
EquCheckItem equCheckItem = new EquCheckItem();
BeanUtils.copyProperties(equCheckItemDTO, equCheckItem);

@ -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);
}
@ -65,6 +82,15 @@ public class EquFaultTypeServiceImpl implements IEquFaultTypeService {
@DS("#header.poolName")
public AjaxResult insertEquFaultType(EquFaultType equFaultType) {
// 检验
EquFaultType checkQuery = new EquFaultType();
checkQuery.setFaultType(equFaultType.getFaultType());
checkQuery.setFaultSubclass(equFaultType.getFaultSubclass());
List<EquFaultType> check = equFaultTypeMapper.selectEquFaultTypeList(checkQuery);
if (check.size() > 0) {
return error(500,"故障子类已存在!不可添加!");
}
//获取当前所选工厂
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
@ -98,9 +124,24 @@ public class EquFaultTypeServiceImpl implements IEquFaultTypeService {
*/
@Override
@DS("#header.poolName")
public int updateEquFaultType(EquFaultType equFaultType) {
public AjaxResult updateEquFaultType(EquFaultType equFaultType) {
// 检验
EquFaultType checkQuery = new EquFaultType();
checkQuery.setFaultType(equFaultType.getFaultType());
checkQuery.setFaultSubclass(equFaultType.getFaultSubclass());
List<EquFaultType> check = equFaultTypeMapper.selectEquFaultTypeList(checkQuery);
if (check.size() > 0) {
if (!check.get(0).equals(equFaultType.getFaultCode())) {
return error(500,"故障子类已存在!修改失败!");
}
}
equFaultType.setUpdateBy(SecurityContextHolder.getUserName());
equFaultType.setUpdateTime(DateUtils.getNowDate());
return equFaultTypeMapper.updateEquFaultType(equFaultType);
// 插入数据库
equFaultTypeMapper.updateEquFaultType(equFaultType);
return success("修改成功");
}
/**

@ -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">
@ -113,11 +116,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteEquFaultTypeByFaultId" parameterType="String">
delete from equ_fault_type where fault_id = #{faultId}
delete equ_fault_type set del_flag = '1' where fault_id = #{faultId}
</delete>
<delete id="deleteEquFaultTypeByFaultIds" parameterType="String">
delete from equ_fault_type where fault_id in
update equ_fault_type set del_flag = '1' where fault_id in
<foreach item="faultId" collection="array" open="(" separator="," close=")">
#{faultId}
</foreach>

Loading…
Cancel
Save