管道基础大数据平台系统开发-【后端】-Server
Surpriseplus
2022-10-08 0e0a6258ce04c9b89fdf1b5507675f35f8a09124
src/main/resources/mapper/sys/DepMapper.xml
@@ -10,9 +10,17 @@
        <result property="updateTime" column="update_time"></result>
    </resultMap>
    <select id="selectDepAll" resultMap="resultMap" resultType="com.lf.server.entity.sys.DepEntity">
        select * from lf.sys_dep order by id;
        select * from lf.sys_dep order by order_num;
    </select>
    <select id="selectDepRecursive" resultMap="resultMap" resultType="com.lf.server.entity.sys.DepEntity">
        with recursive rs as(
            select * from lf.sys_dep where name='中国石油天然气管道工程有限公司'
        union
            select a.* from lf.sys_dep a, rs b where a.pid=b.id
        )
        select * FROM rs order by order_num;
    </select>
    <select id="selectDep" resultMap="resultMap" resultType="com.lf.server.entity.sys.DepEntity">
        select * from lf.sys_dep where id = #{id}
    </select>
@@ -48,7 +56,20 @@
    </delete>
    <update id="updateDep">
    update lf.sys_dep set pid=#{pid},name=#{name},sname=#{sname},code=#{code},uncode=#{uncode},addr=#{addr},contact=#{contact},fax=#{fax},
    email=#{email},post=#{post},website=#{website},level=#{level},order_num =#{orderNum},update_user=#{updateUser},update_time=now(),bak=#{bak} where id=#{id}
        update lf.sys_dep set pid=#{pid},name=#{name},sname=#{sname},code=#{code},uncode=#{uncode},addr=#{addr},contact=#{contact},fax=#{fax},
        email=#{email},post=#{post},website=#{website},level=#{level},order_num =#{orderNum},update_user=#{updateUser},update_time=now(),bak=#{bak}
         where id=#{id}
    </update>
    <update id="updateDeps">
        <foreach collection="list" item="item" index="index" separator=","  >
            update lf.sys_menu
            <set>
                pid=#{item.pid},name=#{item.name},sname=#{item.sname},code=#{item.code},uncode=#{item.uncode},addr=#{item.addr},contact=#{item.contact},
                fax=#{item.fax},email=#{item.email},post=#{item.post},website=#{item.website},level=#{item.level},order_num =#{item.orderNum},
                update_user=#{item.updateUser},update_time=now(),bak=#{item.bak}
            </set>
            where id = #{item.id}
        </foreach>
    </update>
</mapper>