|
|
|
@ -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("修改成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|