|
@@ -20,7 +20,18 @@
|
|
|
</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
|
|
|
+ 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"
|
|
@@ -41,9 +52,8 @@
|
|
|
and parent_id = #{obj.parentId}
|
|
|
</if>
|
|
|
</if>
|
|
|
-
|
|
|
</where>
|
|
|
- order by sort, name
|
|
|
+ order by code , sort, convert(name using gbk)
|
|
|
</select>
|
|
|
|
|
|
|
|
@@ -66,31 +76,34 @@
|
|
|
</if>
|
|
|
</if>
|
|
|
</where>
|
|
|
- order by zgc.sort , zgc.name
|
|
|
+ order by zgc.code DESC, zgc.sort, zgcp.name,convert(zgc.name using gbk)
|
|
|
</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 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
|
|
|
+ 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
|
|
|
+ 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>
|
|
|
+ zgcp.top = 1 and zgcp.code = #{categoryCode}
|
|
|
+ </where>
|
|
|
+ order by zgc.code DESC,zgc.sort,zgcp.name,convert(zgc.name using gbk)
|
|
|
</select>
|
|
|
+
|
|
|
<select id="getByParentIds" resultType="com.ruoyi.system.dto.GalleryCategoryDto">
|
|
|
SELECT
|
|
|
zgc.*,
|
|
@@ -100,16 +113,22 @@
|
|
|
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
|
|
|
+ <if test="parentIds != null and parentIds.size() > 0">
|
|
|
+ <where>zgc.parent_id in
|
|
|
+ <foreach collection="parentIds" open="(" close=")" item="item" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </where>
|
|
|
+ </if>
|
|
|
+ order by zgc.code DESC, zgc.sort,zgcp.name,convert(zgc.name using gbk)
|
|
|
</select>
|
|
|
<select id="checkHasChildren" resultType="java.lang.Integer">
|
|
|
- select 1 from zb_gallery_category where parent_id = #{parentId} limit 1
|
|
|
+ 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 getCategoryChildLst(#{parentId}) as childs
|
|
|
</select>
|
|
|
</mapper>
|