返回资源分类的资源数量

This commit is contained in:
none
2023-03-15 11:31:42 +08:00
parent cca6d050bc
commit 3b67766ab2
12 changed files with 116 additions and 20 deletions

View File

@@ -17,8 +17,14 @@
</resultMap>
<sql id="Base_Column_List">
id,title,thumb,
charge,class_hour,is_show,
id,title,thumb,
charge,class_hour,is_show,
created_at,updated_at,deleted_at
</sql>
<select id="getCategoryCount" resultType="xyz.playedu.api.types.mapper.CourseCategoryCountMapper">
SELECT `resource_course_category`.`cid` as `cid`, count(*) as `total`
FROM `resource_course_category`
GROUP BY `resource_course_category`.`category_id`;
</select>
</mapper>

View File

@@ -21,10 +21,19 @@
</resultMap>
<sql id="Base_Column_List">
id,admin_id,type,
name,extension,size,
disk,file_id,path,
url,created_at,parent_id,
id,admin_id,type,
name,extension,size,
disk,file_id,path,
url,created_at,parent_id,
is_hidden
</sql>
<select id="getCategoryCount" resultType="xyz.playedu.api.types.mapper.ResourceCategoryCountMapper">
SELECT `resource_category`.`cid` as `cid`, count(*) as `total`
FROM `resources`
INNER JOIN `resource_category` ON `resource_category`.`rid` = `resources`.`id`
WHERE `resources`.`type` = #{type}
GROUP BY `resource_category`.`cid`;
</select>
</mapper>