123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315 |
- <?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.ArtCatMapper">
- <resultMap id="ArtCatDtoMap" type="com.zhyc.xps.sys.dto.ArtCatDto">
- <result column="art_cat_id" property="artCatId" jdbcType="BIGINT" />
- <result column="art_cat_title" property="artCatTitle" jdbcType="VARCHAR"/>
- <result column="art_cat_desc" property="artCatDesc" jdbcType="VARCHAR"/>
- <result column="parent_id" property="parentId" jdbcType="BIGINT" />
- <result column="is_fixed" property="isFixed" jdbcType="BIGINT" />
- <result column="root_id" property="rootId" 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="ArtCatDto_Cols">
- art_cat_id,
- art_cat_title,
- art_cat_desc,
- parent_id,
- is_fixed,
- root_id,
- node_left,
- node_right,
- node_level,
- is_leaf
- </sql>
- <!--根据ID获取信息-->
- <select id="getById" resultMap="ArtCatDtoMap">
- SELECT
- <include refid="ArtCatDto_Cols"/>
- FROM art_cat
- WHERE 1 = 1
- <if test="ocId != null">
- AND oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="artCatId != null">
- AND art_cat_id = #{artCatId ,jdbcType=BIGINT}
- </if>
- </select>
- <!--分页查询-->
- <select id="getByPage" parameterType="java.util.Map" resultMap="ArtCatDtoMap">
- SELECT
- <include refid="ArtCatDto_Cols"/>
- FROM art_cat
- WHERE 1 = 1 AND deleted_flag = 0
- <if test="ocId != null">
- AND oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- and art_cat_title like "%"#{keywords}"%"
- </if>
- <if test="nodeLeft != null and nodeRight != null">
- <![CDATA[
- AND node_left > #{nodeLeft ,jdbcType=BIGINT}
- AND node_right < #{nodeRight ,jdbcType=BIGINT}
- ]]>
- </if>
- ORDER BY art_cat_id ASC
- </select>
- <!--列表查询-->
- <select id="getByList" resultMap="ArtCatDtoMap" parameterType="java.util.Map">
- SELECT
- <include refid="ArtCatDto_Cols"/>
- FROM art_cat
- WHERE 1 = 1 AND deleted_flag = 0
- <if test="ocId != null">
- AND oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- AND art_cat_title like "%"#{keywords}"%"
- </if>
- <if test="nodeLeft != null and nodeRight != null">
- <![CDATA[
- AND node_left > #{nodeLeft ,jdbcType=BIGINT}
- AND node_right < #{nodeRight ,jdbcType=BIGINT}
- ]]>
- </if>
- </select>
- <!--列表查询一级结点-->
- <select id="getRootByList" resultMap="ArtCatDtoMap" parameterType="java.util.Map">
- SELECT
- <include refid="ArtCatDto_Cols"/>
- FROM art_cat
- WHERE 1 = 1 AND deleted_flag = 0 AND parent_id = 0
- <if test="ocId != null">
- AND oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- AND art_cat_title like "%"#{keywords}"%"
- </if>
- <if test="nodeLeft != null and nodeRight != null">
- <![CDATA[
- AND node_left > #{nodeLeft ,jdbcType=BIGINT}
- AND node_right < #{nodeRight ,jdbcType=BIGINT}
- ]]>
- </if>
- </select>
- <!--分页查询-->
- <select id="getByPageWithRoot" parameterType="java.util.Map" resultMap="ArtCatDtoMap">
- SELECT
- <include refid="ArtCatDto_Cols"/>
- FROM art_cat
- WHERE 1 = 1 AND deleted_flag = 0
- <if test="ocId != null">
- AND oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- and art_cat_title like "%"#{keywords}"%"
- </if>
- <if test="nodeLeft != null and nodeRight != null">
- <![CDATA[
- AND node_left >= #{nodeLeft ,jdbcType=BIGINT}
- AND node_right <= #{nodeRight ,jdbcType=BIGINT}
- ]]>
- </if>
- ORDER BY art_cat_id ASC
- </select>
- <!--列表查询-->
- <select id="getByListWithRoot" resultMap="ArtCatDtoMap" parameterType="java.util.Map">
- SELECT
- <include refid="ArtCatDto_Cols"/>
- FROM art_cat
- WHERE 1 = 1 AND deleted_flag = 0
- <if test="ocId != null">
- AND oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- AND art_cat_title like "%"#{keywords}"%"
- </if>
- <if test="nodeLeft != null and nodeRight != null">
- <![CDATA[
- AND node_left >= #{nodeLeft ,jdbcType=BIGINT}
- AND node_right <= #{nodeRight ,jdbcType=BIGINT}
- ]]>
- </if>
- </select>
- <insert id="create" parameterType="com.zhyc.xps.sys.entity.ArtCat">
- INSERT INTO art_cat
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- oc_id,
- </if>
- <if test="artCatId != null">
- art_cat_id,
- </if>
- <if test="artCatTitle != null and artCatTitle != ''">
- art_cat_title,
- </if>
- <if test="artCatDesc != null and artCatDesc != ''">
- art_cat_desc,
- </if>
- <if test="isFixed != null">
- is_fixed,
- </if>
- <if test="parentId != null">
- parent_id,
- </if>
- <if test="rootId != null">
- root_id,
- </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="artCatId != null">
- #{artCatId ,jdbcType=BIGINT},
- </if>
- <if test="artCatTitle != null and artCatTitle !=''">
- #{artCatTitle ,jdbcType=VARCHAR},
- </if>
- <if test="artCatDesc != null and artCatDesc !=''">
- #{artCatDesc ,jdbcType=VARCHAR},
- </if>
- <if test="isFixed != null">
- #{isFixed ,jdbcType=BIGINT},
- </if>
- <if test="parentId != null">
- #{parentId ,jdbcType=BIGINT},
- </if>
- <if test="rootId != null">
- #{rootId ,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.ArtCat">
- UPDATE art_cat
- <trim suffixOverrides=",">
- <set>
- <if test="artCatTitle != null and artCatTitle != ''">
- art_cat_title = #{artCatTitle, jdbcType=VARCHAR},
- </if>
- <if test="artCatDesc != null and artCatDesc != ''">
- art_cat_desc = #{artCatDesc, jdbcType=VARCHAR},
- </if>
- <if test="isFixed != null">
- is_fixed = #{isFixed ,jdbcType=BIGINT},
- </if>
- <if test="parentId != null">
- parent_id = #{parentId ,jdbcType=BIGINT},
- </if>
- <if test="rootId != null">
- root_id = #{rootId ,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="ocId != null">
- AND oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="artCatId != null">
- AND art_cat_id = #{artCatId ,jdbcType=BIGINT}
- </if>
- </update>
- <!--删除-->
- <update id="delete" parameterType="java.util.Map">
- UPDATE art_cat
- <trim suffixOverrides=",">
- <set>
- <if test="deletedFlag != null">
- deleted_flag = #{deletedFlag,jdbcType=BIGINT},
- </if>
- <if test="deletedTime != null">
- deleted_time = #{deletedTime,jdbcType=VARCHAR},
- </if>
- <if test="deletedBy != null">
- deleted_by = #{deletedBy,jdbcType=BIGINT},
- </if>
- </set>
- </trim>
- WHERE 1 = 1
- <if test="ocId != null">
- AND oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="artCatId != null">
- AND art_cat_id = #{artCatId ,jdbcType=BIGINT}
- </if>
- <if test="nodeLeft != null and nodeRight != null">
- <![CDATA[
- AND node_left >= #{nodeLeft ,jdbcType=BIGINT}
- AND node_right <= #{nodeRight ,jdbcType=BIGINT}
- ]]>
- </if>
- </update>
- </mapper>
|