DepotNodeMapper.xml 3.89 KB
<?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.ruoyi.service.mapper.DepotNodeMapper">

    <select id="selectDepotNodeList" parameterType="com.ruoyi.service.domain.DepotNode" resultType="com.ruoyi.service.domain.DepotNode">
        select * from depot_node
        <where>  
            <if test="parentId != null "> and parentId = #{parentId}</if>
            <if test="ancestors != null  and ancestors != ''"> and ancestors = #{ancestors}</if>
            <if test="nodeName != null  and nodeName != ''"> and nodeName like concat('%', #{nodeName}, '%')</if>
            <if test="orderNum != null "> and orderNum = #{orderNum}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
        </where>
    </select>
    
    <select id="selectDepotNodeById" parameterType="Long" resultType="com.ruoyi.service.domain.DepotNode">
        select * from depot_node
        where id = #{id}
    </select>
        
    <insert id="insertDepotNode" parameterType="com.ruoyi.service.domain.DepotNode" useGeneratedKeys="true" keyProperty="id">
        insert into depot_node
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="parentId != null">parentId,</if>
            <if test="ancestors != null">ancestors,</if>
            <if test="nodeName != null">nodeName,</if>
            <if test="orderNum != null">orderNum,</if>
            <if test="status != null">status,</if>
            <if test="delFlag != null">delFlag,</if>
            <if test="nodeFlag != null">nodeFlag,</if>
            <if test="depotCode != null">depotCode,</if>
            <if test="createUser != null">createUser,</if>
            createTime
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="parentId != null">#{parentId},</if>
            <if test="ancestors != null">#{ancestors},</if>
            <if test="nodeName != null">#{nodeName},</if>
            <if test="orderNum != null">#{orderNum},</if>
            <if test="status != null">#{status},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="nodeFlag != null">#{nodeFlag},</if>
            <if test="depotCode != null">#{depotCode},</if>
            <if test="createUser != null">#{createUser},</if>
            sysdate()
         </trim>
    </insert>

    <update id="updateDepotNode" parameterType="com.ruoyi.service.domain.DepotNode">
        update depot_node
        <trim prefix="SET" suffixOverrides=",">
            <if test="parentId != null">parentId = #{parentId},</if>
            <if test="ancestors != null">ancestors = #{ancestors},</if>
            <if test="nodeName != null">nodeName = #{nodeName},</if>
            <if test="orderNum != null">orderNum = #{orderNum},</if>
            <if test="depotCode != null">depotCode = #{depotCode},</if>
            <if test="status != null">status = #{status},</if>
            <if test="delFlag != null">delFlag = #{delFlag},</if>
            <if test="nodeFlag != null">nodeFlag = #{nodeFlag},</if>
            <if test="updateUser != null">updateUser = #{updateUser},</if>
            updateTime = sysdate()
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteDepotNodeById" parameterType="Long">
        delete from depot_node where id = #{id}
    </delete>

    <delete id="deleteDepotNodeByIds" parameterType="String">
        delete from depot_node where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>

    <select id="selectCountBox" resultType="int" parameterType="Long">
        SELECT count(*) from archives_box WHERE deport_node_id in (
            SELECT depotCode FROM `depot_node` where (id=#{id} or FIND_IN_SET(#{id},ancestors)) and nodeFlag='1'
        )
    </select>

</mapper>