成果记录list查询

This commit is contained in:
xxq250 2026-07-07 09:10:16 +08:00
parent 8670953e8a
commit d4dac70695
6 changed files with 15 additions and 48 deletions

View File

@ -42,7 +42,8 @@ public class AchievementsController extends BaseController {
@GetMapping("/list")
public TableDataInfo list(AchQueryVo achQueryVo) {
startPage();
List<Achievements> list = achievementsService.selectAchievementsList(achQueryVo);
achQueryVo.setAllStatus(true);
List<Achievements> list = achievementsService.getAllResult(achQueryVo);
return getDataTable(list);
}

View File

@ -15,6 +15,7 @@ public class AchQueryVo {
private String sortBy; //排序字段
private String sortOrder; //升降序
private Boolean userSelf = false; //用户自己
private Boolean allStatus = false; //所有状态
private List<String> achievementTypeList;//成果类型
private List<String> sourceList;//成果类型
@ -123,4 +124,12 @@ public class AchQueryVo {
public void setUserSelf(Boolean userSelf) {
this.userSelf = userSelf;
}
public Boolean getAllStatus() {
return allStatus;
}
public void setAllStatus(Boolean allStatus) {
this.allStatus = allStatus;
}
}

View File

@ -40,7 +40,6 @@ public interface AchievementsMapper {
* @return 成果集合
*/
public List<Achievements> selectAchievementsList(Achievements achievements);
public List<Achievements> selectAchievementsListNew(AchQueryVo achQueryVo);
/**
* 新增成果

View File

@ -30,7 +30,7 @@ public interface IAchievementsService {
/**
* 查询成果列表
*
* @param achievements 成果
* @param achQueryVo 成果
* @return 成果集合
*/
public List<Achievements> selectAchievementsList(AchQueryVo achQueryVo);

View File

@ -250,6 +250,7 @@ public class AchievementsServiceImpl implements IAchievementsService {
logger.info("getAllResult USERID======={},user={}", SecurityUtils.getGitlinkUserId(),SecurityUtils.getUsername());
if (achQueryVo.getUserSelf() && SecurityUtils.getGitlinkUserId() != null) {
achQueryVo.setUserId(SecurityUtils.getGitlinkUserId().toString());
achQueryVo.setAllStatus(true);
}
List<Achievements> list = achievementsMapper.selectAchievementsByParamNew(achQueryVo);
//遍历成果数据获取对应成果的点击数

View File

@ -89,50 +89,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by create_time desc
</select>
<select id="selectAchievementsListNew" parameterType="com.microservices.dms.achievementLibrary.domain.AchQueryVo" resultType="com.microservices.dms.achievementLibrary.domain.Achievements">
select a.id,IFNULL(a.show_ach_name,a.achievement_name) as "showAchievementName", a.achievement_name,a.field_1,a.field_2,a.field_3,a.achievement_type,a.source,a.source_id,a.source_link,a.tags,a.summary,
a.publishing_unit,a.address,a.is_featured,a.contact_person,a.contact_number,a.owner_id,a.owner_name,a.`status`,a.details,a.reviewer,a.review_date,a.review_comments,a.images,a.attachments,a.create_by,a.create_time,
a.update_by,a.update_time,a.attachment_count,a.is_expert_audit,a.ext1,a.ext2,a.ext3,a.hot_rank,a.show_ach_name,a.storage_type,a.maturity_level,a.recommend_scope,a.ext4,a.ext5,
(select IFNULL(count(*), 0) from favorites where favorite_type = 'Achievements' and favorite_id = a.id) as watcherSum,
(select IFNULL(count(*), 0) from watchers where watchable_type = 'Achievements' and watchable_id = a.id) as favoriteSum
from achievements a
<where>
and 1=1
<if test="achievementName != null and achievementName != ''"> and a.achievement_name like concat('%', #{achievementName}, '%')</if>
<if test="showAchievementName != null and showAchievementName != ''"> and a.show_ach_name like concat('%', #{showAchievementName}, '%')</if>
<if test="source != null and source != ''"> and a.source = #{source}</if>
<if test="maturityLevel != null and maturityLevel != ''"> and a.maturity_level = #{maturityLevel}</if>
<if test='areaQuery != null and areaQuery != "" '>
and (a.field_1 = #{areaQuery} or a.field_2 = #{areaQuery})
</if>
<if test='userSelf != null and userSelf == true'>and a.owner_id = #{userId}</if>
<if test='sourceList != null '>
and a.source in
<foreach collection="sourceList" item="source" index="index"
separator="," open="(" close=")">
#{source}
</foreach>
</if>
<if test='achievementTypeList != null '>
and a.achievement_type in
<foreach collection="achievementTypeList" item="achievementType" index="index"
separator="," open="(" close=")">
#{achievementType}
</foreach>
</if>
</where>
order by
<choose>
<when test="sortBy == 'createTime'">create_time</when>
<when test="sortBy == 'updateTime'">update_time</when>
<otherwise>create_time</otherwise>
</choose>
<choose>
<when test="sortOrder == 'asc'">ASC</when>
<otherwise>desc</otherwise>
</choose>
</select>
<select id="selectAchievementsById" parameterType="Long" resultType="com.microservices.dms.achievementLibrary.domain.Achievements">
select a.id,IFNULL(a.show_ach_name,a.achievement_name) as "showAchievementName", a.achievement_name,a.field_1,a.field_2,a.field_3,a.achievement_type,a.source,a.source_id,a.source_link,a.tags,a.summary,
a.publishing_unit,a.address,a.is_featured,a.contact_person,a.contact_number,a.owner_id,a.owner_name,a.`status`,a.details,a.reviewer,a.review_date,a.review_comments,a.images,a.attachments,a.create_by,a.create_time,
@ -349,7 +305,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
(select IFNULL(count(*), 0) from watchers where watchable_type = 'Achievements' and watchable_id = a.id) as favoriteSum
from achievements a
<where>
and a.status='1'
and 1 = 1
<if test='all == false'> and a.status='1'</if>
<if test="achievementName != null and achievementName != ''"> and a.achievement_name like concat('%', #{achievementName}, '%')</if>
<if test="showAchievementName != null and showAchievementName != ''"> and a.show_ach_name like concat('%', #{showAchievementName}, '%')</if>
<if test="source != null and source != ''"> and a.source = #{source}</if>