123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- <?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.system.mapper.ZbGalleryCategoryMapper">
- <resultMap type="com.ruoyi.system.domain.grallery.ZbGalleryCategory" id="ZbGalleryCategoryResult">
- <result property="id" column="id"/>
- <result property="name" column="name"/>
- <result property="code" column="code"/>
- <result property="thumbnailId" column="thumbnail_id"/>
- <result property="top" column="top"/>
- <result property="parentId" column="parent_id"/>
- <result property="createBy" column="create_by"/>
- <result property="createTime" column="create_time"/>
- <result property="updateBy" column="update_by"/>
- <result property="updateTime" column="update_time"/>
- <result property="remark" column="remark"/>
- <result property="show" column="show"/>
- </resultMap>
- <sql id="selectZbGalleryCategoryVo">
- select id, name, code, thumbnail_id, top, parent_id, create_by, create_time, update_by, update_time, remark, show from zb_gallery_category
- </sql>
- <select id="selectZbGalleryCategoryList" parameterType="com.ruoyi.system.domain.grallery.ZbGalleryCategory"
- resultMap="ZbGalleryCategoryResult">
- <include refid="selectZbGalleryCategoryVo"/>
- <where>
- <if test="obj != null">
- <if test="obj.name != null and obj.name != ''">
- and name like concat('%', #{obj.name}, '%')
- </if>
- <if test="obj.thumbnailId != null ">
- and thumbnail_id = #{obj.thumbnailId}
- </if>
- <if test="obj.top != null ">
- and top = #{obj.top}
- </if>
- <if test="obj.parentId != null ">
- and parent_id = #{obj.parentId}
- </if>
- </if>
- </where>
- order by sort, name
- </select>
- <select id="selectGalleryCategory" resultType="com.ruoyi.system.dto.GalleryCategoryDto">
- SELECT
- zgc.*,
- zgcp.NAME AS parent,
- zf.url as thumbnail
- FROM
- zb_gallery_category zgc
- LEFT JOIN zb_file zf ON zgc.thumbnail_id = zf.id
- LEFT JOIN zb_gallery_category zgcp ON zgc.parent_id = zgcp.id
- <where>
- <if test="obj != null">
- <if test="obj.name != null and obj.name != ''">
- and zgc.name like concat('%', #{obj.name}, '%')
- </if>
- <if test="obj.parentId != null ">
- and zgc.parent_id = #{obj.parentId}
- </if>
- </if>
- </where>
- order by zgc.sort , zgc.name
- </select>
- <select id="getDetailById" resultType="com.ruoyi.system.dto.GalleryCategoryDto">
- SELECT
- zgc.*,
- zgcp.name AS parent,
- zf.url as thumbnail
- FROM
- zb_gallery_category zgc
- LEFT JOIN zb_file zf ON zgc.thumbnail_id = zf.id
- LEFT JOIN zb_gallery_category zgcp ON zgc.parent_id = zgcp.id
- where 1=1 and zgc.id = #{categoryId}
- </select>
- <select id="selectGalleryCategoryByParentCode" resultType="com.ruoyi.system.dto.GalleryCategoryDto">
- SELECT
- zgc.*,
- zgcp.name AS parent,
- zf.url as thumbnail
- FROM
- zb_gallery_category zgc
- JOIN zb_gallery_category zgcp ON zgc.parent_id = zgcp.id
- LEFT JOIN zb_file zf ON zgc.thumbnail_id = zf.id
- where 1=1 and zgcp.code = #{categoryCode} and zgcp.top = 1
- order by zgc.sort, zgc.name
- </select>
- <select id="getByParentIds" resultType="com.ruoyi.system.dto.GalleryCategoryDto">
- SELECT
- zgc.*,
- zgcp.name AS parent,
- zf.url as thumbnail
- FROM
- zb_gallery_category zgc
- LEFT JOIN zb_file zf ON zgc.thumbnail_id = zf.id
- LEFT JOIN zb_gallery_category zgcp ON zgc.parent_id = zgcp.id
- where 1=1 and zgc.parent_id in
- <foreach collection="parentIds" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- order by zgc.sort, zgc.name
- </select>
- <select id="checkHasChildren" resultType="java.lang.Integer">
- select 1 from zb_gallery_category where parent_id = #{parentId} limit 1
- </select>
- <select id="getChildrens" resultType="java.lang.String">
- select getCategoryChildLst(#{parentId}) as childs
- </select>
- </mapper>
|