课程库热点标签排序

This commit is contained in:
670788339
2025-11-08 15:22:59 +08:00
parent 001106043c
commit f5fc56c2d1

View File

@@ -45,7 +45,7 @@ public class CourseTagDao extends BaseDao<CourseTag> {
"on t.id = r.tag_id AND r.deleted =0 \n" +
"where t.deleted =0 and t.is_hot = true and t.status =0 \n" +
"GROUP BY t.id\n" +
"order by relation_count desc,t.last_set_hot_time desc"; // 数据库字段为last_set_hot_time
"order by t.last_set_hot_time desc"; // 数据库字段为last_set_hot_time
// 创建原生查询并指定结果映射到CourseTag实体
javax.persistence.Query query = entityManager.createNativeQuery(sql, CourseTag.class);
@@ -72,11 +72,11 @@ public class CourseTagDao extends BaseDao<CourseTag> {
"WHERE r.deleted = 0 and c.status =0 " +
"AND c.is_hot = true "; // 假设数据库字段为is_hot与实体属性isHot对应
if (StringUtils.isNotBlank(sysType1)){
sql += "AND r.sys_type1 = ?1 ORDER BY c.use_count,c.last_set_hot_time DESC";
sql += "AND r.sys_type1 = ?1 ORDER BY c.last_set_hot_time DESC";
}else if(StringUtils.isNotBlank(sysType2)){
sql += "AND r.sys_type2 = ?1 ORDER BY c.use_count,c.last_set_hot_time DESC";
sql += "AND r.sys_type2 = ?1 ORDER BY c.last_set_hot_time DESC";
}else {
sql += "AND r.sys_type3 = ?1 ORDER BY c.use_count,c.last_set_hot_time DESC";
sql += "AND r.sys_type3 = ?1 ORDER BY c.last_set_hot_time DESC";
}
// 创建原生查询并指定结果映射到CourseTag实体
javax.persistence.Query query = entityManager.createNativeQuery(sql, CourseTag.class);