123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- <?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.zhyc.xps.sys.mapper.DocDirMapper">
- <resultMap id="BaseResultMap" type="com.zhyc.xps.sys.entity.DocDir">
- <result column="oc_id" property="ocId" jdbcType="BIGINT" /><!--ID-->
- <result column="dir_id" property="dirId" jdbcType="BIGINT" /><!--目录ID-->
- <result column="dir_title" property="dirTitle" jdbcType="VARCHAR"/>
- <result column="dir_desc" property="dirDesc" jdbcType="VARCHAR"/>
- <result column="parent_id" property="parentId" jdbcType="BIGINT" />
- <result column="is_fixed" property="isFixed" jdbcType="BIGINT" />
- <result column="node_left" property="nodeLeft" jdbcType="BIGINT" />
- <result column="node_right" property="nodeRight" jdbcType="BIGINT" />
- <result column="node_level" property="nodeLevel" jdbcType="BIGINT" />
- <result column="is_leaf" property="isLeaf" jdbcType="BIGINT" />
- </resultMap>
- <sql id="DocDir_Cols">
- A.oc_id,
- A.dir_id,
- A.dir_title,
- A.dir_desc,
- A.parent_id,
- A.is_fixed,
- A.node_left,
- A.node_right,
- A.node_level,
- A.is_leaf
- </sql>
- <!--基于ID查询-->
- <select id="getById" resultMap="BaseResultMap">
- SELECT
- <include refid="DocDir_Cols"/>
- FROM doc_dir AS A
- WHERE 1 = 1 AND A.deleted_flag = 0
- <if test="ocId != null">
- AND A.oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="dirId !=null">
- AND A.dir_id = #{dirId ,jdbcType=BIGINT}
- </if>
- </select>
- <!--列表查询-->
- <select id="getByPage" resultMap="BaseResultMap" parameterType="java.util.Map">
- SELECT
- <include refid="DocDir_Cols"/>
- FROM doc_dir AS A
- WHERE 1 = 1 AND A.deleted_flag = 0
- <if test="ocId != null">
- AND A.oc_id = #{ocId, jdbcType=BIGINT}
- </if>
- <if test="nodeLeft != null and nodeRight != null">
- <![CDATA[
- AND A.node_left > #{nodeLeft ,jdbcType=BIGINT}
- AND A.node_right < #{nodeRight ,jdbcType=BIGINT}
- ]]>
- </if>
- <if test="keywords != null and keywords != ''">
- AND A.dir_title like "%"#{keyword}"%"
- </if>
- ORDER BY A.created_at DESC
- </select>
- <!--列表查询-->
- <select id="getByList" resultMap="BaseResultMap" parameterType="java.util.Map">
- SELECT
- <include refid="DocDir_Cols"/>
- FROM doc_dir AS A
- WHERE 1 = 1 AND A.deleted_flag = 0
- <if test="ocId != null">
- AND A.oc_id = #{ocId, jdbcType=BIGINT}
- </if>
- <if test="nodeLeft != null and nodeRight != null">
- <![CDATA[
- AND A.node_left > #{nodeLeft ,jdbcType=BIGINT}
- AND A.node_right < #{nodeRight ,jdbcType=BIGINT}
- ]]>
- </if>
- <if test="keywords != null and keywords != ''">
- AND A.dir_title like "%"#{keywords}"%"
- </if>
- order by A.created_at DESC
- </select>
- <!--Create-->
- <insert id="create" parameterType="com.zhyc.xps.sys.entity.DocDir">
- INSERT INTO doc_dir
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- oc_id,
- </if>
- <if test="dirId != null">
- dir_id,
- </if>
- <if test="dirTitle != null and dirTitle!=''">
- dir_title,
- </if>
- <if test="dirDesc != null and dirDesc != ''">
- dir_desc,
- </if>
- <if test="parentId != null">
- parent_id,
- </if>
- <if test="isFixed != null">
- is_fixed,
- </if>
- <if test="nodeLeft != null">
- node_left,
- </if>
- <if test="nodeRight != null">
- node_right,
- </if>
- <if test="nodeLevel != null">
- node_level,
- </if>
- <if test="isLeaf != null">
- is_leaf,
- </if>
- <if test="createdBy != null">
- created_by,
- </if>
- <if test="createdAt != null">
- created_at,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- #{ocId ,jdbcType=BIGINT},
- </if>
- <if test="dirId != null">
- #{dirId ,jdbcType=BIGINT},
- </if>
- <if test="dirTitle != null and dirTitle != ''">
- #{dirTitle ,jdbcType=VARCHAR},
- </if>
- <if test="dirDesc != null and dirDesc != ''">
- #{dirDesc ,jdbcType=VARCHAR},
- </if>
- <if test="parentId != null">
- #{parentId ,jdbcType=BIGINT},
- </if>
- <if test="isFixed != null">
- #{isFixed ,jdbcType=BIGINT},
- </if>
- <if test="nodeLeft != null">
- #{nodeLeft ,jdbcType=BIGINT},
- </if>
- <if test="nodeRight != null">
- #{nodeRight ,jdbcType=BIGINT},
- </if>
- <if test="nodeLevel != null">
- #{nodeLevel ,jdbcType=BIGINT},
- </if>
- <if test="isLeaf != null">
- #{isLeaf ,jdbcType=BIGINT},
- </if>
- <if test="createdBy != null">
- #{createdBy ,jdbcType=BIGINT},
- </if>
- <if test="createdAt != null">
- #{createdAt ,jdbcType=TIMESTAMP},
- </if>
- </trim>
- </insert>
- <!--更新-->
- <update id="update" parameterType="com.zhyc.xps.sys.entity.DocDir">
- UPDATE doc_dir
- <trim suffixOverrides=",">
- <set>
- <if test="dirTitle != null and dirTitle != ''">
- dir_title =#{dirTitle ,jdbcType=VARCHAR},
- </if>
- <if test="dirDesc != null and dirDesc != ''">
- dir_desc = #{dirDesc ,jdbcType=VARCHAR},
- </if>
- <if test="parentId != null">
- parent_id = #{parentId ,jdbcType=BIGINT},
- </if>
- <if test="isFixed != null">
- is_fixed = #{isFixed ,jdbcType=BIGINT},
- </if>
- <if test="nodeLeft != null">
- node_left = #{nodeLeft ,jdbcType=BIGINT},
- </if>
- <if test="nodeRight != null">
- node_right = #{nodeRight ,jdbcType=BIGINT},
- </if>
- <if test="nodeLevel != null">
- node_level = #{nodeLevel ,jdbcType=BIGINT},
- </if>
- <if test="isLeaf != null">
- is_leaf = #{isLeaf ,jdbcType=BIGINT},
- </if>
- <if test="updatedBy != null">
- updated_by = #{updatedBy ,jdbcType=BIGINT},
- </if>
- <if test="updatedAt != null">
- updated_at = #{updatedAt ,jdbcType=TIMESTAMP},
- </if>
- </set>
- </trim>
- WHERE 1 = 1
- <if test="dirId != null">
- AND dir_id = #{dirId ,jdbcType=BIGINT}
- </if>
- <if test="ocId != null">
- AND oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- </update>
- <!--删除 -->
- <update id="delete" parameterType="java.util.Map">
- UPDATE doc_dir
- <trim suffixOverrides=",">
- <set>
- <if test="dirId != null">
- dir_id = #{dirId ,jdbcType=BIGINT},
- </if>
- <if test="deletedBy != null">
- deleted_by = #{deletedBy ,jdbcType=BIGINT},
- </if>
- <if test="deletedAt != null">
- deleted_at = #{deletedAt ,jdbcType=DATE},
- </if>
- <if test="deletedFlag != null">
- deleted_flag = #{deletedFlag ,jdbcType=BIGINT},
- </if>
- </set>
- </trim>
- WHERE 1 = 1 AND deleted_flag = 0
- <if test="ocId != null">
- AND oc_id = #{ocId,jdbcType=BIGINT}
- </if>
- <if test="dirId != null ">
- AND dir_id = #{dirId ,jdbcType=BIGINT}
- </if>
- </update>
- </mapper>
|