Merge remote-tracking branch 'origin/master'
commit
6f814376ca
@ -0,0 +1,245 @@
|
||||
package com.op.device.domain.dto;
|
||||
|
||||
import com.op.device.domain.EquCheckItemDetail;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
// 检查项维护页面DTO
|
||||
public class EquCheckItemDTO {
|
||||
/** 主键 */
|
||||
private String itemId ;
|
||||
/** 检查项编码 */
|
||||
private String itemCode ;
|
||||
/** 检查项名称 */
|
||||
private String itemName ;
|
||||
/** 检查项方法/工具 */
|
||||
private String itemMethod ;
|
||||
/** 维护类型编码 */
|
||||
private String itemType ;
|
||||
/** 维护类型名称 */
|
||||
private String itemTypeName ;
|
||||
/** 检查项备注 */
|
||||
private String itemRemark ;
|
||||
/** 工厂 */
|
||||
private String factoryCode ;
|
||||
/** 备用字段1 */
|
||||
private String attr1 ;
|
||||
/** 备用字段2 */
|
||||
private String attr2 ;
|
||||
/** 备用字段3 */
|
||||
private String attr3 ;
|
||||
/** 删除标识 */
|
||||
private String delFlag ;
|
||||
/** 创建时间 */
|
||||
private Date createdTime ;
|
||||
/** 创建人 */
|
||||
private String createdBy ;
|
||||
/** 更新时间 */
|
||||
private Date updatedTime ;
|
||||
/** 更新人 */
|
||||
private String updatedBy ;
|
||||
// 标准列表
|
||||
private List<EquCheckItemDetail> formStandard;
|
||||
// 创建日期范围list
|
||||
private List<Date> createdTimeArray;
|
||||
|
||||
// 更新日期范围list
|
||||
private List<Date> updateTimeArray;
|
||||
|
||||
// 更新日期开始
|
||||
private String updateTimeStart;
|
||||
|
||||
// 更新日期结束
|
||||
private String updateTimeEnd;
|
||||
|
||||
// 创建日期开始
|
||||
private String createTimeStart;
|
||||
|
||||
// 创建日期结束
|
||||
private String createTimeEnd;
|
||||
|
||||
public List<Date> getCreatedTimeArray() {
|
||||
return createdTimeArray;
|
||||
}
|
||||
|
||||
public void setCreatedTimeArray(List<Date> createdTimeArray) {
|
||||
this.createdTimeArray = createdTimeArray;
|
||||
}
|
||||
|
||||
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 String getItemId() {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
public void setItemId(String itemId) {
|
||||
this.itemId = itemId;
|
||||
}
|
||||
|
||||
public String getItemCode() {
|
||||
return itemCode;
|
||||
}
|
||||
|
||||
public void setItemCode(String itemCode) {
|
||||
this.itemCode = itemCode;
|
||||
}
|
||||
|
||||
public String getItemName() {
|
||||
return itemName;
|
||||
}
|
||||
|
||||
public void setItemName(String itemName) {
|
||||
this.itemName = itemName;
|
||||
}
|
||||
|
||||
public String getItemMethod() {
|
||||
return itemMethod;
|
||||
}
|
||||
|
||||
public void setItemMethod(String itemMethod) {
|
||||
this.itemMethod = itemMethod;
|
||||
}
|
||||
|
||||
public String getItemType() {
|
||||
return itemType;
|
||||
}
|
||||
|
||||
public void setItemType(String itemType) {
|
||||
this.itemType = itemType;
|
||||
}
|
||||
|
||||
public String getItemTypeName() {
|
||||
return itemTypeName;
|
||||
}
|
||||
|
||||
public void setItemTypeName(String itemTypeName) {
|
||||
this.itemTypeName = itemTypeName;
|
||||
}
|
||||
|
||||
public String getItemRemark() {
|
||||
return itemRemark;
|
||||
}
|
||||
|
||||
public void setItemRemark(String itemRemark) {
|
||||
this.itemRemark = itemRemark;
|
||||
}
|
||||
|
||||
public String getFactoryCode() {
|
||||
return factoryCode;
|
||||
}
|
||||
|
||||
public void setFactoryCode(String factoryCode) {
|
||||
this.factoryCode = factoryCode;
|
||||
}
|
||||
|
||||
public String getAttr1() {
|
||||
return attr1;
|
||||
}
|
||||
|
||||
public void setAttr1(String attr1) {
|
||||
this.attr1 = attr1;
|
||||
}
|
||||
|
||||
public String getAttr2() {
|
||||
return attr2;
|
||||
}
|
||||
|
||||
public void setAttr2(String attr2) {
|
||||
this.attr2 = attr2;
|
||||
}
|
||||
|
||||
public String getAttr3() {
|
||||
return attr3;
|
||||
}
|
||||
|
||||
public void setAttr3(String attr3) {
|
||||
this.attr3 = attr3;
|
||||
}
|
||||
|
||||
public String getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public Date getCreatedTime() {
|
||||
return createdTime;
|
||||
}
|
||||
|
||||
public void setCreatedTime(Date createdTime) {
|
||||
this.createdTime = createdTime;
|
||||
}
|
||||
|
||||
public String getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
public void setCreatedBy(String createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
public Date getUpdatedTime() {
|
||||
return updatedTime;
|
||||
}
|
||||
|
||||
public void setUpdatedTime(Date updatedTime) {
|
||||
this.updatedTime = updatedTime;
|
||||
}
|
||||
|
||||
public String getUpdatedBy() {
|
||||
return updatedBy;
|
||||
}
|
||||
|
||||
public void setUpdatedBy(String updatedBy) {
|
||||
this.updatedBy = updatedBy;
|
||||
}
|
||||
|
||||
public List<EquCheckItemDetail> getFormStandard() {
|
||||
return formStandard;
|
||||
}
|
||||
|
||||
public void setFormStandard(List<EquCheckItemDetail> formStandard) {
|
||||
this.formStandard = formStandard;
|
||||
}
|
||||
}
|
@ -0,0 +1,180 @@
|
||||
package com.op.device.domain.vo;
|
||||
|
||||
import com.op.device.domain.EquCheckItemDetail;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
// 检查项维护页面VO
|
||||
public class EquCheckItemVO {
|
||||
/** 主键 */
|
||||
private String itemId ;
|
||||
/** 检查项编码 */
|
||||
private String itemCode ;
|
||||
/** 检查项名称 */
|
||||
private String itemName ;
|
||||
/** 检查项方法/工具 */
|
||||
private String itemMethod ;
|
||||
/** 维护类型编码 */
|
||||
private String itemType ;
|
||||
/** 维护类型名称 */
|
||||
private String itemTypeName ;
|
||||
/** 检查项备注 */
|
||||
private String itemRemark ;
|
||||
/** 工厂 */
|
||||
private String factoryCode ;
|
||||
/** 备用字段1 */
|
||||
private String attr1 ;
|
||||
/** 备用字段2 */
|
||||
private String attr2 ;
|
||||
/** 备用字段3 */
|
||||
private String attr3 ;
|
||||
/** 删除标识 */
|
||||
private String delFlag ;
|
||||
/** 创建时间 */
|
||||
private Date createdTime ;
|
||||
/** 创建人 */
|
||||
private String createdBy ;
|
||||
/** 更新时间 */
|
||||
private Date updatedTime ;
|
||||
/** 更新人 */
|
||||
private String updatedBy ;
|
||||
// 标准列表
|
||||
private List<EquCheckItemDetail> formStandard;
|
||||
|
||||
public String getItemId() {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
public void setItemId(String itemId) {
|
||||
this.itemId = itemId;
|
||||
}
|
||||
|
||||
public String getItemCode() {
|
||||
return itemCode;
|
||||
}
|
||||
|
||||
public void setItemCode(String itemCode) {
|
||||
this.itemCode = itemCode;
|
||||
}
|
||||
|
||||
public String getItemName() {
|
||||
return itemName;
|
||||
}
|
||||
|
||||
public void setItemName(String itemName) {
|
||||
this.itemName = itemName;
|
||||
}
|
||||
|
||||
public String getItemMethod() {
|
||||
return itemMethod;
|
||||
}
|
||||
|
||||
public void setItemMethod(String itemMethod) {
|
||||
this.itemMethod = itemMethod;
|
||||
}
|
||||
|
||||
public String getItemType() {
|
||||
return itemType;
|
||||
}
|
||||
|
||||
public void setItemType(String itemType) {
|
||||
this.itemType = itemType;
|
||||
}
|
||||
|
||||
public String getItemTypeName() {
|
||||
return itemTypeName;
|
||||
}
|
||||
|
||||
public void setItemTypeName(String itemTypeName) {
|
||||
this.itemTypeName = itemTypeName;
|
||||
}
|
||||
|
||||
public String getItemRemark() {
|
||||
return itemRemark;
|
||||
}
|
||||
|
||||
public void setItemRemark(String itemRemark) {
|
||||
this.itemRemark = itemRemark;
|
||||
}
|
||||
|
||||
public String getFactoryCode() {
|
||||
return factoryCode;
|
||||
}
|
||||
|
||||
public void setFactoryCode(String factoryCode) {
|
||||
this.factoryCode = factoryCode;
|
||||
}
|
||||
|
||||
public String getAttr1() {
|
||||
return attr1;
|
||||
}
|
||||
|
||||
public void setAttr1(String attr1) {
|
||||
this.attr1 = attr1;
|
||||
}
|
||||
|
||||
public String getAttr2() {
|
||||
return attr2;
|
||||
}
|
||||
|
||||
public void setAttr2(String attr2) {
|
||||
this.attr2 = attr2;
|
||||
}
|
||||
|
||||
public String getAttr3() {
|
||||
return attr3;
|
||||
}
|
||||
|
||||
public void setAttr3(String attr3) {
|
||||
this.attr3 = attr3;
|
||||
}
|
||||
|
||||
public String getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public Date getCreatedTime() {
|
||||
return createdTime;
|
||||
}
|
||||
|
||||
public void setCreatedTime(Date createdTime) {
|
||||
this.createdTime = createdTime;
|
||||
}
|
||||
|
||||
public String getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
public void setCreatedBy(String createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
public Date getUpdatedTime() {
|
||||
return updatedTime;
|
||||
}
|
||||
|
||||
public void setUpdatedTime(Date updatedTime) {
|
||||
this.updatedTime = updatedTime;
|
||||
}
|
||||
|
||||
public String getUpdatedBy() {
|
||||
return updatedBy;
|
||||
}
|
||||
|
||||
public void setUpdatedBy(String updatedBy) {
|
||||
this.updatedBy = updatedBy;
|
||||
}
|
||||
|
||||
public List<EquCheckItemDetail> getFormStandard() {
|
||||
return formStandard;
|
||||
}
|
||||
|
||||
public void setFormStandard(List<EquCheckItemDetail> formStandard) {
|
||||
this.formStandard = formStandard;
|
||||
}
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
package com.op.device.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.op.device.domain.EquCheckItemDetail;
|
||||
|
||||
/**
|
||||
* 检查项详情Mapper接口
|
||||
*
|
||||
* @author wws
|
||||
* @date 2023-10-10
|
||||
*/
|
||||
public interface EquCheckItemDetailMapper {
|
||||
/**
|
||||
* 查询检查项详情
|
||||
*
|
||||
* @param detailId 检查项详情主键
|
||||
* @return 检查项详情
|
||||
*/
|
||||
public EquCheckItemDetail selectEquCheckItemDetailByDetailId(String detailId);
|
||||
|
||||
/**
|
||||
* 查询检查项详情列表
|
||||
*
|
||||
* @param equCheckItemDetail 检查项详情
|
||||
* @return 检查项详情集合
|
||||
*/
|
||||
public List<EquCheckItemDetail> selectEquCheckItemDetailList(EquCheckItemDetail equCheckItemDetail);
|
||||
|
||||
/**
|
||||
* 新增检查项详情
|
||||
*
|
||||
* @param equCheckItemDetail 检查项详情
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEquCheckItemDetail(EquCheckItemDetail equCheckItemDetail);
|
||||
|
||||
/**
|
||||
* 修改检查项详情
|
||||
*
|
||||
* @param equCheckItemDetail 检查项详情
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEquCheckItemDetail(EquCheckItemDetail equCheckItemDetail);
|
||||
|
||||
/**
|
||||
* 删除检查项详情
|
||||
*
|
||||
* @param detailId 检查项详情主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEquCheckItemDetailByDetailId(String detailId);
|
||||
|
||||
/**
|
||||
* 批量删除检查项详情
|
||||
*
|
||||
* @param detailIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEquCheckItemDetailByDetailIds(String[] detailIds);
|
||||
|
||||
/**
|
||||
* 通过检查项code获取流水号
|
||||
* @param itemCode
|
||||
* @return
|
||||
*/
|
||||
int selectSerialNumber(String itemCode);
|
||||
|
||||
/**
|
||||
* 通过检查项code查询标准
|
||||
* @param itemCode
|
||||
* @return
|
||||
*/
|
||||
List<EquCheckItemDetail> selectEquCheckItemDetailByParentCode(String itemCode);
|
||||
|
||||
/**
|
||||
* 通过检查项id删除标准信息
|
||||
* @param itemId
|
||||
*/
|
||||
void deleteEquCheckItemDetailByItemId(String itemId);
|
||||
}
|
@ -1,112 +1,241 @@
|
||||
package com.op.device.service.impl;
|
||||
|
||||
import java.text.Format;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
|
||||
import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.op.common.core.context.SecurityContextHolder;
|
||||
import com.op.common.core.utils.DateUtils;
|
||||
import com.op.common.core.utils.uuid.IdUtils;
|
||||
import com.op.common.core.web.domain.AjaxResult;
|
||||
import com.op.common.log.annotation.Log;
|
||||
import com.op.device.domain.EquCheckItemDetail;
|
||||
import com.op.device.domain.dto.EquCheckItemDTO;
|
||||
import com.op.device.domain.vo.EquCheckItemVO;
|
||||
import com.op.device.mapper.EquCheckItemDetailMapper;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.op.device.mapper.EquCheckItemMapper;
|
||||
import com.op.device.domain.EquCheckItem;
|
||||
import com.op.device.service.IEquCheckItemService;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import static com.op.common.core.web.domain.AjaxResult.error;
|
||||
import static com.op.common.core.web.domain.AjaxResult.success;
|
||||
|
||||
/**
|
||||
* 检查项维护Service业务层处理
|
||||
*
|
||||
*
|
||||
* @author wws
|
||||
* @date 2023-10-09
|
||||
*/
|
||||
@Service
|
||||
public class EquCheckItemServiceImpl implements IEquCheckItemService {
|
||||
@Autowired
|
||||
private EquCheckItemMapper equCheckItemMapper;
|
||||
|
||||
/**
|
||||
* 查询检查项维护
|
||||
*
|
||||
* @param itemId 检查项维护主键
|
||||
* @return 检查项维护
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public EquCheckItem selectEquCheckItemByItemId(String itemId) {
|
||||
return equCheckItemMapper.selectEquCheckItemByItemId(itemId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询检查项维护列表
|
||||
*
|
||||
* @param equCheckItem 检查项维护
|
||||
* @return 检查项维护
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增检查项维护
|
||||
*
|
||||
* @param equCheckItem 检查项维护
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int insertEquCheckItem(EquCheckItem equCheckItem) {
|
||||
return equCheckItemMapper.insertEquCheckItem(equCheckItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改检查项维护
|
||||
*
|
||||
* @param equCheckItem 检查项维护
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int updateEquCheckItem(EquCheckItem equCheckItem) {
|
||||
return equCheckItemMapper.updateEquCheckItem(equCheckItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除检查项维护
|
||||
*
|
||||
* @param itemIds 需要删除的检查项维护主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int deleteEquCheckItemByItemIds(String[] itemIds) {
|
||||
return equCheckItemMapper.deleteEquCheckItemByItemIds(itemIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除检查项维护信息
|
||||
*
|
||||
* @param itemId 检查项维护主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int deleteEquCheckItemByItemId(String itemId) {
|
||||
return equCheckItemMapper.deleteEquCheckItemByItemId(itemId);
|
||||
}
|
||||
@Autowired
|
||||
private EquCheckItemMapper equCheckItemMapper;
|
||||
@Autowired
|
||||
private EquCheckItemDetailMapper equCheckItemDetailMapper;
|
||||
|
||||
/**
|
||||
* 查询检查项维护
|
||||
*
|
||||
* @param itemId 检查项维护主键
|
||||
* @return 检查项维护
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public EquCheckItemVO selectEquCheckItemByItemId(String itemId) {
|
||||
EquCheckItem equCheckItem = equCheckItemMapper.selectEquCheckItemByItemId(itemId);
|
||||
|
||||
// 创建返回对象
|
||||
EquCheckItemVO equCheckItemVO = new EquCheckItemVO();
|
||||
BeanUtils.copyProperties(equCheckItem, equCheckItemVO);
|
||||
|
||||
equCheckItemVO.setFormStandard(equCheckItemDetailMapper.selectEquCheckItemDetailByParentCode(equCheckItem.getItemCode()));
|
||||
|
||||
return equCheckItemVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询检查项维护列表
|
||||
*
|
||||
* @param equCheckItem 检查项维护
|
||||
* @return 检查项维护
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增检查项维护
|
||||
*
|
||||
* @param equCheckItemDTO 检查项维护
|
||||
* @return 结果
|
||||
* TODO 加事务锁
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public AjaxResult insertEquCheckItem(EquCheckItemDTO equCheckItemDTO) {
|
||||
// 检验重复
|
||||
EquCheckItem checkItem = equCheckItemMapper.selectEquCheckItemByItemName(equCheckItemDTO.getItemName());
|
||||
if (checkItem != null) {
|
||||
return error("检查项已存在!新增失败!");
|
||||
}
|
||||
// 创建检查项对象
|
||||
EquCheckItem equCheckItem = new EquCheckItem();
|
||||
BeanUtils.copyProperties(equCheckItemDTO, equCheckItem);
|
||||
|
||||
//获取当前所选工厂
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||
String key = "#header.poolName";
|
||||
String str = request.getHeader(key.substring(8));
|
||||
int index = str.indexOf("_");
|
||||
String factory = str.substring(index + 1);
|
||||
|
||||
// 获取检查项流水号
|
||||
String serialNum = String.format("%03d", equCheckItemMapper.selectSerialNumber());
|
||||
|
||||
// 处理检查项信息
|
||||
equCheckItem.setItemId(IdUtils.fastSimpleUUID());
|
||||
equCheckItem.setFactoryCode(factory);
|
||||
equCheckItem.setItemCode(DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + serialNum);
|
||||
equCheckItem.setCreatedBy(SecurityContextHolder.getUserName());
|
||||
equCheckItem.setCreatedTime(DateUtils.getNowDate());
|
||||
equCheckItem.setUpdatedBy(SecurityContextHolder.getUserName());
|
||||
equCheckItem.setUpdatedTime(DateUtils.getNowDate());
|
||||
if (equCheckItem.getItemType().equals("spotInspection")) {
|
||||
equCheckItem.setItemTypeName("点检");
|
||||
}
|
||||
if (equCheckItem.getItemType().equals("inspection")) {
|
||||
equCheckItem.setItemTypeName("巡检");
|
||||
}
|
||||
if (equCheckItem.getItemType().equals("maintenance")) {
|
||||
equCheckItem.setItemTypeName("保养");
|
||||
}
|
||||
|
||||
// 插入数据库
|
||||
equCheckItemMapper.insertEquCheckItem(equCheckItem);
|
||||
|
||||
// 处理标准信息
|
||||
for (EquCheckItemDetail detail : equCheckItemDTO.getFormStandard()) {
|
||||
// 获取标准流水号
|
||||
String detailSerialNum = String.format("%03d", equCheckItemDetailMapper.selectSerialNumber(equCheckItem.getItemCode()));
|
||||
|
||||
detail.setDetailId(IdUtils.fastSimpleUUID());
|
||||
detail.setParentCode(equCheckItem.getItemCode());
|
||||
detail.setFactoryCode(factory);
|
||||
detail.setDetailCode(equCheckItem.getItemCode() + detailSerialNum);
|
||||
detail.setCreatedBy(SecurityContextHolder.getUserName());
|
||||
detail.setCreatedTime(DateUtils.getNowDate());
|
||||
detail.setUpdatedBy(SecurityContextHolder.getUserName());
|
||||
detail.setUpdatedTime(DateUtils.getNowDate());
|
||||
|
||||
// 插入到数据库
|
||||
equCheckItemDetailMapper.insertEquCheckItemDetail(detail);
|
||||
}
|
||||
|
||||
return success("新增成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改检查项维护
|
||||
*
|
||||
* @param equCheckItemDTO 检查项维护
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public AjaxResult updateEquCheckItem(EquCheckItemDTO equCheckItemDTO) {
|
||||
EquCheckItem equCheckItem = new EquCheckItem();
|
||||
BeanUtils.copyProperties(equCheckItemDTO, equCheckItem);
|
||||
|
||||
// 处理检查项信息
|
||||
equCheckItem.setUpdatedBy(SecurityContextHolder.getUserName());
|
||||
equCheckItem.setUpdatedTime(DateUtils.getNowDate());
|
||||
if (equCheckItem.getItemType().equals("spotInspection")) {
|
||||
equCheckItem.setItemTypeName("点检");
|
||||
}
|
||||
if (equCheckItem.getItemType().equals("inspection")) {
|
||||
equCheckItem.setItemTypeName("巡检");
|
||||
}
|
||||
if (equCheckItem.getItemType().equals("maintenance")) {
|
||||
equCheckItem.setItemTypeName("保养");
|
||||
}
|
||||
|
||||
equCheckItemMapper.updateEquCheckItem(equCheckItem);
|
||||
|
||||
// 删除所有标准
|
||||
equCheckItemDetailMapper.deleteEquCheckItemDetailByItemId(equCheckItem.getItemId());
|
||||
|
||||
for (EquCheckItemDetail detail : equCheckItemDTO.getFormStandard()) {
|
||||
// 获取标准流水号
|
||||
String detailSerialNum = String.format("%03d", equCheckItemDetailMapper.selectSerialNumber(equCheckItem.getItemCode()));
|
||||
|
||||
detail.setDetailId(IdUtils.fastSimpleUUID());
|
||||
detail.setParentCode(equCheckItem.getItemCode());
|
||||
detail.setFactoryCode(equCheckItem.getFactoryCode());
|
||||
detail.setDetailCode(equCheckItem.getItemCode() + detailSerialNum);
|
||||
detail.setCreatedBy(SecurityContextHolder.getUserName());
|
||||
detail.setCreatedTime(DateUtils.getNowDate());
|
||||
detail.setUpdatedBy(SecurityContextHolder.getUserName());
|
||||
detail.setUpdatedTime(DateUtils.getNowDate());
|
||||
|
||||
// 插入到数据库
|
||||
equCheckItemDetailMapper.insertEquCheckItemDetail(detail);
|
||||
}
|
||||
return success("修改成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除检查项维护
|
||||
*
|
||||
* @param itemIds 需要删除的检查项维护主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int deleteEquCheckItemByItemIds(String[] itemIds) {
|
||||
for (String data : itemIds) {
|
||||
equCheckItemDetailMapper.deleteEquCheckItemDetailByItemId(data);
|
||||
}
|
||||
return equCheckItemMapper.deleteEquCheckItemByItemIds(itemIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除检查项维护信息
|
||||
*
|
||||
* @param itemId 检查项维护主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int deleteEquCheckItemByItemId(String itemId) {
|
||||
// 通过id删除标准信息
|
||||
equCheckItemDetailMapper.deleteEquCheckItemDetailByItemId(itemId);
|
||||
return equCheckItemMapper.deleteEquCheckItemByItemId(itemId);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,152 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.op.device.mapper.EquCheckItemDetailMapper">
|
||||
|
||||
<resultMap type="EquCheckItemDetail" id="EquCheckItemDetailResult">
|
||||
<result property="detailId" column="detail_id" />
|
||||
<result property="parentCode" column="parent_code" />
|
||||
<result property="standardType" column="standard_type" />
|
||||
<result property="standardName" column="standard_name" />
|
||||
<result property="factoryCode" column="factory_code" />
|
||||
<result property="detailUpLimit" column="detail_up_limit" />
|
||||
<result property="detailDownLimit" column="detail_down_limit" />
|
||||
<result property="detailUnit" column="detail_unit" />
|
||||
<result property="attr1" column="attr1" />
|
||||
<result property="attr2" column="attr2" />
|
||||
<result property="attr3" column="attr3" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="createdTime" column="created_time" />
|
||||
<result property="createdBy" column="created_by" />
|
||||
<result property="updatedTime" column="updated_time" />
|
||||
<result property="updatedBy" column="updated_by" />
|
||||
<result property="detailCode" column="detail_code" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEquCheckItemDetailVo">
|
||||
select detail_id, parent_code, standard_type, standard_name, factory_code, detail_up_limit, detail_down_limit, detail_unit, attr1, attr2, attr3, del_flag, created_time, created_by, updated_time, updated_by, detail_code from equ_check_item_detail
|
||||
</sql>
|
||||
|
||||
<select id="selectEquCheckItemDetailList" parameterType="EquCheckItemDetail" resultMap="EquCheckItemDetailResult">
|
||||
<include refid="selectEquCheckItemDetailVo"/>
|
||||
<where>
|
||||
<if test="parentCode != null and parentCode != ''"> and parent_code = #{parentCode}</if>
|
||||
<if test="standardType != null and standardType != ''"> and standard_type = #{standardType}</if>
|
||||
<if test="standardName != null and standardName != ''"> and standard_name like concat('%', #{standardName}, '%')</if>
|
||||
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
|
||||
<if test="detailUpLimit != null "> and detail_up_limit = #{detailUpLimit}</if>
|
||||
<if test="detailDownLimit != null "> and detail_down_limit = #{detailDownLimit}</if>
|
||||
<if test="detailUnit != null and detailUnit != ''"> and detail_unit = #{detailUnit}</if>
|
||||
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
|
||||
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
|
||||
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</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="detailCode != null and detailCode != ''"> and detail_code = #{detailCode}</if>
|
||||
</where>
|
||||
and del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectEquCheckItemDetailByDetailId" parameterType="String" resultMap="EquCheckItemDetailResult">
|
||||
<include refid="selectEquCheckItemDetailVo"/>
|
||||
where detail_id = #{detailId} and del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectSerialNumber" resultType="java.lang.Integer">
|
||||
SELECT COUNT(detail_id)+1 AS serialNum
|
||||
FROM equ_check_item_detail
|
||||
WHERE CONVERT(date, GETDATE()) = CONVERT(date,created_time) and parent_code = #{itemCode} and del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectEquCheckItemDetailByParentCode" parameterType="String" resultMap="EquCheckItemDetailResult">
|
||||
<include refid="selectEquCheckItemDetailVo"/>
|
||||
where parent_code = #{parentCode} and del_flag = '0'
|
||||
ORDER BY created_time
|
||||
</select>
|
||||
|
||||
<insert id="insertEquCheckItemDetail" parameterType="EquCheckItemDetail">
|
||||
insert into equ_check_item_detail
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="detailId != null">detail_id,</if>
|
||||
<if test="parentCode != null and parentCode != ''">parent_code,</if>
|
||||
<if test="standardType != null and standardType != ''">standard_type,</if>
|
||||
<if test="standardName != null and standardName != ''">standard_name,</if>
|
||||
<if test="factoryCode != null">factory_code,</if>
|
||||
<if test="detailUpLimit != null">detail_up_limit,</if>
|
||||
<if test="detailDownLimit != null">detail_down_limit,</if>
|
||||
<if test="detailUnit != null and detailUnit != ''">detail_unit,</if>
|
||||
<if test="attr1 != null">attr1,</if>
|
||||
<if test="attr2 != null">attr2,</if>
|
||||
<if test="attr3 != null">attr3,</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
||||
<if test="createdTime != null">created_time,</if>
|
||||
<if test="createdBy != null and createdBy != ''">created_by,</if>
|
||||
<if test="updatedTime != null">updated_time,</if>
|
||||
<if test="updatedBy != null and updatedBy != ''">updated_by,</if>
|
||||
<if test="detailCode != null and detailCode != ''">detail_code,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="detailId != null">#{detailId},</if>
|
||||
<if test="parentCode != null and parentCode != ''">#{parentCode},</if>
|
||||
<if test="standardType != null and standardType != ''">#{standardType},</if>
|
||||
<if test="standardName != null and standardName != ''">#{standardName},</if>
|
||||
<if test="factoryCode != null">#{factoryCode},</if>
|
||||
<if test="detailUpLimit != null">#{detailUpLimit},</if>
|
||||
<if test="detailDownLimit != null">#{detailDownLimit},</if>
|
||||
<if test="detailUnit != null and detailUnit != ''">#{detailUnit},</if>
|
||||
<if test="attr1 != null">#{attr1},</if>
|
||||
<if test="attr2 != null">#{attr2},</if>
|
||||
<if test="attr3 != null">#{attr3},</if>
|
||||
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
||||
<if test="createdTime != null">#{createdTime},</if>
|
||||
<if test="createdBy != null and createdBy != ''">#{createdBy},</if>
|
||||
<if test="updatedTime != null">#{updatedTime},</if>
|
||||
<if test="updatedBy != null and updatedBy != ''">#{updatedBy},</if>
|
||||
<if test="detailCode != null and detailCode != ''">#{detailCode},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateEquCheckItemDetail" parameterType="EquCheckItemDetail">
|
||||
update equ_check_item_detail
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="parentCode != null and parentCode != ''">parent_code = #{parentCode},</if>
|
||||
<if test="standardType != null and standardType != ''">standard_type = #{standardType},</if>
|
||||
<if test="standardName != null and standardName != ''">standard_name = #{standardName},</if>
|
||||
<if test="factoryCode != null">factory_code = #{factoryCode},</if>
|
||||
<if test="detailUpLimit != null">detail_up_limit = #{detailUpLimit},</if>
|
||||
<if test="detailDownLimit != null">detail_down_limit = #{detailDownLimit},</if>
|
||||
<if test="detailUnit != null and detailUnit != ''">detail_unit = #{detailUnit},</if>
|
||||
<if test="attr1 != null">attr1 = #{attr1},</if>
|
||||
<if test="attr2 != null">attr2 = #{attr2},</if>
|
||||
<if test="attr3 != null">attr3 = #{attr3},</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
||||
<if test="createdTime != null">created_time = #{createdTime},</if>
|
||||
<if test="createdBy != null and createdBy != ''">created_by = #{createdBy},</if>
|
||||
<if test="updatedTime != null">updated_time = #{updatedTime},</if>
|
||||
<if test="updatedBy != null and updatedBy != ''">updated_by = #{updatedBy},</if>
|
||||
<if test="detailCode != null and detailCode != ''">detail_code = #{detailCode},</if>
|
||||
</trim>
|
||||
where detail_id = #{detailId} and del_flag = '0'
|
||||
</update>
|
||||
|
||||
<delete id="deleteEquCheckItemDetailByDetailId" parameterType="String">
|
||||
update equ_check_item_detail set del_flag = '1' where detail_id = #{detailId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEquCheckItemDetailByDetailIds" parameterType="String">
|
||||
update equ_check_item_detail set del_flag = '1' where detail_id in
|
||||
<foreach item="detailId" collection="array" open="(" separator="," close=")">
|
||||
#{detailId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEquCheckItemDetailByItemId" parameterType="String">
|
||||
update equ_check_item_detail
|
||||
set del_flag = '1'
|
||||
where parent_code = (
|
||||
select item_code from equ_check_item where item_id = #{itemId} )
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue