Commit b9e87174 authored by KeYong's avatar KeYong

优化检查项

parent f4d406ca
...@@ -36,4 +36,6 @@ public interface InputItemMapper { ...@@ -36,4 +36,6 @@ public interface InputItemMapper {
List<InputItemVo> getInputItemParent(@Param("id") String id); List<InputItemVo> getInputItemParent(@Param("id") String id);
void updatePointById(Map<String, Object> param); void updatePointById(Map<String, Object> param);
List<Long> getIds();
} }
...@@ -27,8 +27,8 @@ public interface IPointDao extends BaseDao<Point, Long> { ...@@ -27,8 +27,8 @@ public interface IPointDao extends BaseDao<Point, Long> {
Optional<Point> findById(Long id); Optional<Point> findById(Long id);
@Query(value = "SELECT id FROM p_point p WHERE p.point_no = (?1) AND p.original_id = (?2)", nativeQuery = true) @Query(value = "SELECT id FROM p_point p WHERE p.point_no = (?1) and is_delete =0 limit 1", nativeQuery = true)
Long findPointByEquipmentIdAndFireFacilityId(String equipmentId, String specificId); Long findPointByPointNoId(String id);
@Modifying @Modifying
@Transactional @Transactional
......
...@@ -1162,26 +1162,27 @@ public class PointServiceImpl implements IPointService { ...@@ -1162,26 +1162,27 @@ public class PointServiceImpl implements IPointService {
} }
} }
point.setOrgCode(StringUtil.isNotEmpty(orgUsrFormDto.getAmosOrgCode()) ? orgUsrFormDto.getAmosOrgCode() : ""); point.setOrgCode(StringUtil.isNotEmpty(orgUsrFormDto.getAmosOrgCode()) ? orgUsrFormDto.getAmosOrgCode() : "");
Long pointId = iPointDao.findPointByEquipmentIdAndFireFacilityId(id, point.getOriginalId()); Long pointId = iPointDao.findPointByPointNoId(point.getPointNo());
if (null != pointId) { if (null != pointId) {
ids.add(pointId); ids.add(pointId);
iPointDao.delPointBIds(pointId); iPointDao.delPointBIds(pointId);
} }
iPointDao.save(point); iPointDao.save(point);
List<InputItem> inputItemVos = inputItemMapper.getInputItemByEquipmentName(point.getName()); List<Long> itemIds = inputItemMapper.getIds();
if (0 < inputItemVos.size()) { if (0 < itemIds.size()) {
inputItemVos.forEach(y -> { itemIds.forEach(y -> {
PointInputItem inputItem = new PointInputItem(); PointInputItem inputItem = new PointInputItem();
inputItem.setPointId(point.getId()); inputItem.setPointId(point.getId());
inputItem.setOrderNo(y.getOrderNo()); inputItem.setInputItemId(y);
inputItem.setInputItemId(y.getId());
inputItems.add(inputItem); inputItems.add(inputItem);
}); });
} }
if (0 < ids.size()) { if (0 < ids.size()) {
iPointInputItemDao.deleteByPointId(ids); iPointInputItemDao.deleteByPointId(ids);
} }
iPointInputItemDao.saveAll(inputItems); if (0 < inputItems.size()) {
iPointInputItemDao.saveAll(inputItems);
}
} }
@Override @Override
......
...@@ -296,4 +296,13 @@ ...@@ -296,4 +296,13 @@
<update id="updatePointById" parameterType="map"> <update id="updatePointById" parameterType="map">
update p_input_item SET item_start = #{itemStart} WHERE id = #{id} update p_input_item SET item_start = #{itemStart} WHERE id = #{id}
</update> </update>
<select id="getIds" resultType="long">
SELECT
pii.id AS id
FROM
p_input_item
WHERE
is_delete = 0
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment