diff --git a/hyp-admin/src/main/java/com/hyp/web/controller/manager/ScoreInfoManager.java b/hyp-admin/src/main/java/com/hyp/web/controller/manager/ScoreInfoManager.java index c9a8b80..70d095a 100644 --- a/hyp-admin/src/main/java/com/hyp/web/controller/manager/ScoreInfoManager.java +++ b/hyp-admin/src/main/java/com/hyp/web/controller/manager/ScoreInfoManager.java @@ -10,6 +10,7 @@ import com.hyp.common.utils.StringUtils; import com.hyp.system.domain.RewApplyInfoList; import com.hyp.system.domain.RewScoreInfo; import com.hyp.system.domain.dto.ScoreInfoSaveDTO; +import com.hyp.system.domain.vo.RewScoreInfoVO; import com.hyp.system.service.RewApplyInfoListService; import com.hyp.system.service.RewScoreInfoService; import org.springframework.stereotype.Component; @@ -69,17 +70,23 @@ public class ScoreInfoManager { * @param applyId * @return java.util.List */ - public List getScoreInfo(String applyId){ + public RewScoreInfoVO getScoreInfo(String applyId){ + RewScoreInfoVO rewScoreInfoVO = new RewScoreInfoVO(); LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(RewScoreInfo::getApplyId,applyId); if (!SysUser.isAdmin(SecurityUtils.getUserId())){ queryWrapper.eq(RewScoreInfo::getCreateId, SecurityUtils.getUserId()); + }else { + rewScoreInfoVO.setAvgScore(avgRewScore(applyId)); } - return scoreInfoService.list(queryWrapper); + List list = scoreInfoService.list(queryWrapper); + rewScoreInfoVO.setRewScoreInfos(list); + return rewScoreInfoVO; } + /** * * 评分提交 @@ -95,4 +102,16 @@ public class ScoreInfoManager { } + /** + * + * 查询平均分 + * @param applyId + * @return java.lang.String + */ + + public String avgRewScore(String applyId){ + return scoreInfoService.avgRewScore(applyId); + } + + } diff --git a/hyp-system/src/main/java/com/hyp/system/domain/vo/RewScoreInfoVO.java b/hyp-system/src/main/java/com/hyp/system/domain/vo/RewScoreInfoVO.java new file mode 100644 index 0000000..7852a8e --- /dev/null +++ b/hyp-system/src/main/java/com/hyp/system/domain/vo/RewScoreInfoVO.java @@ -0,0 +1,29 @@ +package com.hyp.system.domain.vo; + +import com.hyp.system.domain.RewScoreInfo; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * packageName com.hyp.system.domain.vo + * + * @author wangxy + * @version JDK 8 + * @className RewScoreInfoVO + * @date 2024/4/23 + * @description 查询评分 + */ +@Data +public class RewScoreInfoVO implements Serializable { + + + private List rewScoreInfos; + + /** + * + * 平均分 + */ + private String avgScore; +} diff --git a/hyp-system/src/main/java/com/hyp/system/mapper/RewScoreInfoMapper.java b/hyp-system/src/main/java/com/hyp/system/mapper/RewScoreInfoMapper.java index acab938..bcbe09f 100644 --- a/hyp-system/src/main/java/com/hyp/system/mapper/RewScoreInfoMapper.java +++ b/hyp-system/src/main/java/com/hyp/system/mapper/RewScoreInfoMapper.java @@ -3,8 +3,12 @@ package com.hyp.system.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hyp.system.domain.RewScoreInfo; +import com.hyp.system.domain.dto.ApplyInfoListDTO; +import com.hyp.system.domain.vo.ApplyInfoListVO; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * @author wangxy * @description 针对表【rew_score_info(评分表)】的数据库操作Mapper @@ -14,6 +18,9 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface RewScoreInfoMapper extends BaseMapper { + + String avgRewScore(String applyId); + } diff --git a/hyp-system/src/main/java/com/hyp/system/service/RewScoreInfoService.java b/hyp-system/src/main/java/com/hyp/system/service/RewScoreInfoService.java index eb1d7f1..c3d65d2 100644 --- a/hyp-system/src/main/java/com/hyp/system/service/RewScoreInfoService.java +++ b/hyp-system/src/main/java/com/hyp/system/service/RewScoreInfoService.java @@ -11,4 +11,7 @@ import com.hyp.system.domain.RewScoreInfo; */ public interface RewScoreInfoService extends IService { + + String avgRewScore(String applyId); + } diff --git a/hyp-system/src/main/java/com/hyp/system/service/impl/RewScoreInfoServiceImpl.java b/hyp-system/src/main/java/com/hyp/system/service/impl/RewScoreInfoServiceImpl.java index 623a052..2f28691 100644 --- a/hyp-system/src/main/java/com/hyp/system/service/impl/RewScoreInfoServiceImpl.java +++ b/hyp-system/src/main/java/com/hyp/system/service/impl/RewScoreInfoServiceImpl.java @@ -2,10 +2,16 @@ package com.hyp.system.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hyp.system.domain.RewScoreInfo; +import com.hyp.system.domain.dto.ApplyInfoListDTO; +import com.hyp.system.domain.vo.ApplyInfoListVO; +import com.hyp.system.mapper.RewApplyInfoListMapper; import com.hyp.system.mapper.RewScoreInfoMapper; import com.hyp.system.service.RewScoreInfoService; import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import java.util.List; + /** * @author wangxy * @description 针对表【rew_score_info(评分表)】的数据库操作Service实现 @@ -15,6 +21,23 @@ import org.springframework.stereotype.Service; public class RewScoreInfoServiceImpl extends ServiceImpl implements RewScoreInfoService { + + @Resource + private RewScoreInfoMapper rewScoreInfoMapper; + + + /** + * + * 查询平均分 + * @param applyId + * @return java.util.List + */ + @Override + public String avgRewScore(String applyId) + { + return rewScoreInfoMapper.avgRewScore(applyId); + } + } diff --git a/hyp-system/src/main/resources/mapper/system/RewScoreInfoMapper.xml b/hyp-system/src/main/resources/mapper/system/RewScoreInfoMapper.xml index be671d8..1d23018 100644 --- a/hyp-system/src/main/resources/mapper/system/RewScoreInfoMapper.xml +++ b/hyp-system/src/main/resources/mapper/system/RewScoreInfoMapper.xml @@ -21,4 +21,7 @@ create_id,create_by,create_time, update_by,update_time,remark +