The above figure is a tree table structure:
id: the primary key is the parent node of parent_id
parent_id: child node of id
parent_ids: the character set of all parent nodes
Function description: Suppose you want to disable a tree node and the following child nodes,
Database operations:
<update id ="updateUseStatus" > UPDATE position_category SET use_status = #{useStatus}//Enable or disable status WHERE id = #{id} OR parent_ids LIKE '%,'||#{id}||',%' </update>
OR parent_ids LIKE '%,'||#{id}||',%'
'||' splicer
This means: the query matches all child nodes that have the parent node (find out the child nodes under the parent node)
This is achieved, modifying the tree node and all the child nodes below the node are chained together to change