检查项删除检验逻辑

highway
wws 1 year ago
parent ac2f99c2c7
commit 6f33aec08c

@ -114,6 +114,6 @@ public class EquCheckItemController extends BaseController {
@Log(title = "检查项维护", businessType = BusinessType.DELETE)
@DeleteMapping("/{itemIds}")
public AjaxResult remove(@PathVariable String[] itemIds) {
return toAjax(equCheckItemService.deleteEquCheckItemByItemIds(itemIds));
return equCheckItemService.deleteEquCheckItemByItemIds(itemIds);
}
}

@ -137,6 +137,16 @@ public class EquPlan extends BaseEntity {
private List<Long> personListVO;
private String workCenterName;
public String getWorkCenterName() {
return workCenterName;
}
public void setWorkCenterName(String workCenterName) {
this.workCenterName = workCenterName;
}
public List<Long> getPersonListVO() {
return personListVO;
}

@ -3,6 +3,7 @@ package com.op.device.mapper;
import java.util.List;
import com.op.device.domain.EquCheckItem;
import com.op.device.domain.EquPlanDetail;
import com.op.device.domain.vo.EquCheckItemVO;
/**
@ -85,4 +86,11 @@ public interface EquCheckItemMapper {
* @return
*/
List<EquCheckItem> selectCheckItemByEquipmentCode(String equipmentCode);
/**
*
* @param itemCode
* @return
*/
List<EquPlanDetail> checkDelItem(String itemCode);
}

@ -52,7 +52,7 @@ public interface IEquCheckItemService {
* @param itemIds
* @return
*/
public int deleteEquCheckItemByItemIds(String[] itemIds);
public AjaxResult deleteEquCheckItemByItemIds(String[] itemIds);
/**
*

@ -11,6 +11,7 @@ import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.core.web.domain.AjaxResult;
import com.op.device.domain.EquCheckItemDetail;
import com.op.device.domain.EquItemEquipment;
import com.op.device.domain.EquPlanDetail;
import com.op.device.domain.dto.EquCheckItemDTO;
import com.op.device.domain.vo.EquCheckItemVO;
import com.op.device.mapper.EquCheckItemDetailMapper;
@ -284,14 +285,26 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService {
*/
@Override
@DS("#header.poolName")
public int deleteEquCheckItemByItemIds(String[] itemIds) {
public AjaxResult deleteEquCheckItemByItemIds(String[] itemIds) {
// 检验
for (String data : itemIds) {
// 检验
EquCheckItem equCheckItem = equCheckItemMapper.selectEquCheckItemByItemId(data);
List<EquPlanDetail> checkItemList = equCheckItemMapper.checkDelItem(equCheckItem.getItemCode());
if (checkItemList.size() > 0) {
return error(500,"该检查项已有计划使用,删除失败!");
}
}
for (String data : itemIds) {
// 逻辑删除检查项详情信息
equCheckItemDetailMapper.delEquCheckItemDetailByItemId(data);
// 逻辑删除设备关联
equItemEquipmentMapper.delEquItemEquipmentByItemId(data);
}
return equCheckItemMapper.deleteEquCheckItemByItemIds(itemIds);
equCheckItemMapper.deleteEquCheckItemByItemIds(itemIds);
return success("删除成功!");
}
/**

@ -77,6 +77,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where item_code in ( select item_code from equ_item_equipment where equipment_code = #{equipmentCode} and del_flag = '0' ) and del_flag = '0'
</select>
<select id="checkDelItem" resultType="com.op.device.domain.EquPlanDetail">
select item_code AS 'itemCode' from equ_plan_detail where del_flag = '0' and item_code = #{itemCode}
</select>
<insert id="insertEquCheckItem" parameterType="EquCheckItem">
insert into equ_check_item
<trim prefix="(" suffix=")" suffixOverrides=",">

@ -38,12 +38,13 @@
<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>
and del_flag = '0'
</where>
</select>
<select id="selectEquPlanEquById" parameterType="String" resultMap="EquPlanEquResult">
<include refid="selectEquPlanEquVo"/>
where id = #{id}
where id = #{id} and del_flag = '0'
</select>
<select id="selectEquPlanEquByPlanCode" parameterType="String" resultMap="EquPlanEquResult">

@ -34,12 +34,13 @@
<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>
and del_flag = '0'
</where>
</select>
<select id="selectEquPlanPersonById" parameterType="String" resultMap="EquPlanPersonResult">
<include refid="selectEquPlanPersonVo"/>
where id = #{id}
where id = #{id} and del_flag = '0'
</select>
<select id="selectEquPlanPersonByPlanCode" parameterType="String" resultMap="EquPlanPersonResult">

@ -46,12 +46,13 @@
<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>
and del_flag = '0'
</where>
</select>
<select id="selectEquPlanStandardById" parameterType="String" resultMap="EquPlanStandardResult">
<include refid="selectEquPlanStandardVo"/>
where id = #{id}
where id = #{id} and del_flag = '0'
</select>
<select id="selectEquPlanStandardByPlanCode" parameterType="String" resultMap="EquPlanStandardResult">

Loading…
Cancel
Save