|
@@ -0,0 +1,155 @@
|
|
|
|
|
+<?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.interfaces.mapper.MdCatalogMapper">
|
|
|
|
|
+
|
|
|
|
|
+ <insert id="insertCatalog">
|
|
|
|
|
+ insert into md_catalog(
|
|
|
|
|
+ catalog_name,
|
|
|
|
|
+ parent_id,
|
|
|
|
|
+ ancestors,
|
|
|
|
|
+ remark,
|
|
|
|
|
+ sort,
|
|
|
|
|
+ status,
|
|
|
|
|
+ create_by,
|
|
|
|
|
+ create_time,
|
|
|
|
|
+ update_by,
|
|
|
|
|
+ update_time)
|
|
|
|
|
+ values ( #{catalogName,jdbcType=VARCHAR}
|
|
|
|
|
+ , #{parentId,jdbcType=INTEGER}
|
|
|
|
|
+ , #{ancestors,jdbcType=VARCHAR}
|
|
|
|
|
+ , #{remark,jdbcType=VARCHAR}
|
|
|
|
|
+ , #{sort,jdbcType=INTEGER}
|
|
|
|
|
+ , #{status,jdbcType=VARCHAR}
|
|
|
|
|
+ , #{createBy,jdbcType=VARCHAR}
|
|
|
|
|
+ , sysdate
|
|
|
|
|
+ , #{updateBy,jdbcType=VARCHAR}
|
|
|
|
|
+ , #{updateTime,jdbcType=DATE}
|
|
|
|
|
+ )
|
|
|
|
|
+ </insert>
|
|
|
|
|
+ <update id="updateDeptChildren">
|
|
|
|
|
+ update md_catalog set ancestors =
|
|
|
|
|
+ <foreach collection="catalogs" item="item" index="index"
|
|
|
|
|
+ separator=" " open="case catalog_id" close="end">
|
|
|
|
|
+ when #{item.catalogId} then #{item.ancestors}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ where catalog_id in
|
|
|
|
|
+ <foreach collection="catalogs" item="item" index="index"
|
|
|
|
|
+ separator="," open="(" close=")">
|
|
|
|
|
+ #{item.catalogId}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ </update>
|
|
|
|
|
+ <update id="updateCatalog">
|
|
|
|
|
+ update md_catalog
|
|
|
|
|
+ <set>
|
|
|
|
|
+ <if test="catalogName != null and catalogName != ''">
|
|
|
|
|
+ catalog_name = #{catalogName},
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="parentId != null ">
|
|
|
|
|
+ parent_id = #{parentId},
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="ancestors != null">
|
|
|
|
|
+ ancestors = #{ancestors},
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="remark != null">
|
|
|
|
|
+ remark = #{remark},
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="sort != null ">
|
|
|
|
|
+ sort = #{sort},
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="status != null">
|
|
|
|
|
+ status = #{status},
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="createBy != null">
|
|
|
|
|
+ create_by = #{createBy},
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="createTime != null ">
|
|
|
|
|
+ create_time = #{createTime},
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="updateBy != null">
|
|
|
|
|
+ update_by = #{updateBy},
|
|
|
|
|
+ </if>
|
|
|
|
|
+ update_time = sysdate
|
|
|
|
|
+ </set>
|
|
|
|
|
+ where catalog_id = #{catalogId}
|
|
|
|
|
+ </update>
|
|
|
|
|
+ <update id="updateCatalogStatusNormal">
|
|
|
|
|
+ update md_catalog set status = '0' where catalog_id in
|
|
|
|
|
+ <foreach collection="array" item="catalogId" open="(" separator="," close=")">
|
|
|
|
|
+ #{catalogId}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ </update>
|
|
|
|
|
+ <delete id="deleteCatalogById">
|
|
|
|
|
+ delete from md_catalog
|
|
|
|
|
+ where catalog_id = #{catalogId}
|
|
|
|
|
+ </delete>
|
|
|
|
|
+ <select id="selectCatalogById" resultType="com.ruoyi.interfaces.domain.MdCatalog">
|
|
|
|
|
+ select catalog_id,
|
|
|
|
|
+ catalog_name,
|
|
|
|
|
+ parent_id,
|
|
|
|
|
+ ancestors,
|
|
|
|
|
+ remark,
|
|
|
|
|
+ sort,
|
|
|
|
|
+ status,
|
|
|
|
|
+ create_by,
|
|
|
|
|
+ create_time,
|
|
|
|
|
+ update_by,
|
|
|
|
|
+ update_time
|
|
|
|
|
+ from md_catalog
|
|
|
|
|
+ <where>
|
|
|
|
|
+ catalog_id = #{catalogId}
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </select>
|
|
|
|
|
+ <select id="selectNormalChildrenDeptById" resultType="java.lang.Integer">
|
|
|
|
|
+ select count(*) from md_catalog where status = 0 and instr(','||ancestors||',' , ','|| #{catalogId} ||',')
|
|
|
|
|
+ </select>
|
|
|
|
|
+ <select id="selectChildrenCatalogById" resultType="com.ruoyi.interfaces.domain.MdCatalog">
|
|
|
|
|
+ select * from md_catalog where instr(','||ancestors||',' , ','|| #{catalogId} ||',')
|
|
|
|
|
+ </select>
|
|
|
|
|
+ <select id="hasChildByCatalogId" resultType="java.lang.Integer">
|
|
|
|
|
+ select count(1) from md_catalog
|
|
|
|
|
+ where parent_id = #{catalogId} limit 1
|
|
|
|
|
+ </select>
|
|
|
|
|
+ <select id="selectCatalogList" resultType="com.ruoyi.interfaces.domain.MdCatalog">
|
|
|
|
|
+ select
|
|
|
|
|
+ catalog_id,catalog_name,parent_id,ancestors,remark,sort,status,create_by,create_time,update_by,update_time
|
|
|
|
|
+ from md_catalog
|
|
|
|
|
+ <where>
|
|
|
|
|
+ <if test="catalogId != null">
|
|
|
|
|
+ and catalog_id = #{catalogId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+
|
|
|
|
|
+ <if test="catalogName != null">
|
|
|
|
|
+ and catalog_name like concat('%', #{catalogName}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="parentId != null">
|
|
|
|
|
+ and parent_id = #{parentId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="ancestors != null">
|
|
|
|
|
+ and ancestors = #{ancestors}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="remark != null">
|
|
|
|
|
+ and remark = #{remark}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="sort != null">
|
|
|
|
|
+ and sort = #{sort}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="status != null">
|
|
|
|
|
+ and status = #{status}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="createBy != null">
|
|
|
|
|
+ and create_by = #{createBy}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="createTime != null ">
|
|
|
|
|
+ and create_time = #{createTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="updateBy != null">
|
|
|
|
|
+ and update_by = #{updateBy}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="updateTime != null">
|
|
|
|
|
+ and update_time = #{updateTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </select>
|
|
|
|
|
+</mapper>
|