c861f32c 康伟

kangwei: 类别保存后,子类别不显示问题,级联修改子类的药剂属性

1 个父辈 60eb8789
......@@ -168,17 +168,24 @@ public class EquipmentSparepartTypeController {
equipmentSparepartTypeService.updateById( parentSparepartType );
}
}*/
//修改信息
boolean ok = equipmentSparepartTypeService.updateById(equipmentSparepartType);
/* //批量更改祖籍信息
equipmentSparepartTypeService.updateAncestors(equipmentSparepartTypeEntity.getAncestors(), equipmentSparepartType.getAncestors() );*/
String parentAncestors = null;
//更新父级叶子节点状态
String parentId = equipmentSparepartType.getParentId();
if(StringUtils.isNotEmpty(parentId)) {
EquipmentSparepartType parentEquipmentSparepartTypeEntity = equipmentSparepartTypeService.getById(parentId);
parentEquipmentSparepartTypeEntity.putIsLeaf(false);
equipmentSparepartTypeService.updateById(parentEquipmentSparepartTypeEntity);
//获取祖籍信息
parentAncestors = parentEquipmentSparepartTypeEntity.getAncestors();
}
//批量更改祖籍信息
//equipmentSparepartTypeService.updateAncestors(equipmentSparepartTypeEntity.getAncestors(), equipmentSparepartType.getAncestors() );
//修改信息
equipmentSparepartType.setAncestors( parentAncestors +","+ equipmentSparepartType.getId()) ;
//批量修改是否药剂
equipmentSparepartTypeService.batchUpateMedicament( equipmentSparepartType.getId() ,equipmentSparepartType.getMedicament());
boolean ok = equipmentSparepartTypeService.updateById(equipmentSparepartType);
if (ok) {
result.success("修改成功!");
}
......
......@@ -15,4 +15,11 @@ public interface EquipmentSparepartTypeMapper extends BaseMapper<EquipmentSparep
* @param newAncestors
*/
public void updateAncestors(@Param("oldAncestors") String oldAncestors,@Param("newAncestors") String newAncestors);
/***
* 批量修改子类的药剂属性
* @param parentId
* @return
*/
int batchUpateMedicament(@Param("parentId") String parentId,@Param("medicament") Boolean medicament);
}
......
......@@ -6,4 +6,12 @@
<update id="updateAncestors">
update equipment_sparepart_type set ancestors = REPLACE(ancestors,#{oldAncestors}, #{newAncestors});
</update>
</mapper>
\ No newline at end of file
<!-- 批量修改子类的药剂属性 -->
<update id="batchUpateMedicament">
update equipment_sparepart_type set medicament = #{medicament} where ancestors like CONCAT(CONCAT('%', #{parentId}),'%')
</update>
</mapper>
......
......@@ -49,4 +49,10 @@ public interface IEquipmentSparepartTypeService extends IService<EquipmentSparep
* @return
*/
List<EquipmentSparepartTypeVO> querySparepartTypeListByTree(EquipmentSparepartType equipmentSparepartType);
/***
*批量修改子类的药剂属性
* @param parentId
*/
int batchUpateMedicament(String parentId,Boolean medicament);
}
......
......@@ -88,6 +88,14 @@ public class EquipmentSparepartTypeServiceImpl extends ServiceImpl<EquipmentSpar
return voList;
}
/***
* 批量修改子类的药剂属性
* @param parentId
*/
public int batchUpateMedicament(String parentId,Boolean medicament){
return this.baseMapper.batchUpateMedicament(parentId,medicament);
}
/***
* 查询物料类别集合-返回列表
* @param equipmentSparepartType
* @return
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!